Print this page
update to acpica-unix2-20140114
acpica-unix2-20130823
PANKOVs restructure

*** 3,13 **** * Module Name: utids - support for device IDs - HID, UID, CID * *****************************************************************************/ /* ! * Copyright (C) 2000 - 2011, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: --- 3,13 ---- * Module Name: utids - support for device IDs - HID, UID, CID * *****************************************************************************/ /* ! * Copyright (C) 2000 - 2014, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met:
*** 71,84 **** ******************************************************************************/ ACPI_STATUS AcpiUtExecute_HID ( ACPI_NAMESPACE_NODE *DeviceNode, ! ACPI_DEVICE_ID **ReturnId) { ACPI_OPERAND_OBJECT *ObjDesc; ! ACPI_DEVICE_ID *Hid; UINT32 Length; ACPI_STATUS Status; ACPI_FUNCTION_TRACE (UtExecute_HID); --- 71,84 ---- ******************************************************************************/ ACPI_STATUS AcpiUtExecute_HID ( ACPI_NAMESPACE_NODE *DeviceNode, ! ACPI_PNP_DEVICE_ID **ReturnId) { ACPI_OPERAND_OBJECT *ObjDesc; ! ACPI_PNP_DEVICE_ID *Hid; UINT32 Length; ACPI_STATUS Status; ACPI_FUNCTION_TRACE (UtExecute_HID);
*** 102,121 **** Length = ObjDesc->String.Length + 1; } /* Allocate a buffer for the HID */ ! Hid = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_DEVICE_ID) + (ACPI_SIZE) Length); if (!Hid) { Status = AE_NO_MEMORY; goto Cleanup; } ! /* Area for the string starts after DEVICE_ID struct */ ! Hid->String = ACPI_ADD_PTR (char, Hid, sizeof (ACPI_DEVICE_ID)); /* Convert EISAID to a string or simply copy existing string */ if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) { --- 102,121 ---- Length = ObjDesc->String.Length + 1; } /* Allocate a buffer for the HID */ ! Hid = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PNP_DEVICE_ID) + (ACPI_SIZE) Length); if (!Hid) { Status = AE_NO_MEMORY; goto Cleanup; } ! /* Area for the string starts after PNP_DEVICE_ID struct */ ! Hid->String = ACPI_ADD_PTR (char, Hid, sizeof (ACPI_PNP_DEVICE_ID)); /* Convert EISAID to a string or simply copy existing string */ if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) {
*** 139,148 **** --- 139,219 ---- } /******************************************************************************* * + * FUNCTION: AcpiUtExecute_SUB + * + * PARAMETERS: DeviceNode - Node for the device + * ReturnId - Where the _SUB is returned + * + * RETURN: Status + * + * DESCRIPTION: Executes the _SUB control method that returns the subsystem + * ID of the device. The _SUB value is always a string containing + * either a valid PNP or ACPI ID. + * + * NOTE: Internal function, no parameter validation + * + ******************************************************************************/ + + ACPI_STATUS + AcpiUtExecute_SUB ( + ACPI_NAMESPACE_NODE *DeviceNode, + ACPI_PNP_DEVICE_ID **ReturnId) + { + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_PNP_DEVICE_ID *Sub; + UINT32 Length; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (UtExecute_SUB); + + + Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__SUB, + ACPI_BTYPE_STRING, &ObjDesc); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Get the size of the String to be returned, includes null terminator */ + + Length = ObjDesc->String.Length + 1; + + /* Allocate a buffer for the SUB */ + + Sub = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PNP_DEVICE_ID) + (ACPI_SIZE) Length); + if (!Sub) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } + + /* Area for the string starts after PNP_DEVICE_ID struct */ + + Sub->String = ACPI_ADD_PTR (char, Sub, sizeof (ACPI_PNP_DEVICE_ID)); + + /* Simply copy existing string */ + + ACPI_STRCPY (Sub->String, ObjDesc->String.Pointer); + Sub->Length = Length; + *ReturnId = Sub; + + + Cleanup: + + /* On exit, we must delete the return object */ + + AcpiUtRemoveReference (ObjDesc); + return_ACPI_STATUS (Status); + } + + + /******************************************************************************* + * * FUNCTION: AcpiUtExecute_UID * * PARAMETERS: DeviceNode - Node for the device * ReturnId - Where the string UID is returned *
*** 158,171 **** ******************************************************************************/ ACPI_STATUS AcpiUtExecute_UID ( ACPI_NAMESPACE_NODE *DeviceNode, ! ACPI_DEVICE_ID **ReturnId) { ACPI_OPERAND_OBJECT *ObjDesc; ! ACPI_DEVICE_ID *Uid; UINT32 Length; ACPI_STATUS Status; ACPI_FUNCTION_TRACE (UtExecute_UID); --- 229,242 ---- ******************************************************************************/ ACPI_STATUS AcpiUtExecute_UID ( ACPI_NAMESPACE_NODE *DeviceNode, ! ACPI_PNP_DEVICE_ID **ReturnId) { ACPI_OPERAND_OBJECT *ObjDesc; ! ACPI_PNP_DEVICE_ID *Uid; UINT32 Length; ACPI_STATUS Status; ACPI_FUNCTION_TRACE (UtExecute_UID);
*** 189,208 **** Length = ObjDesc->String.Length + 1; } /* Allocate a buffer for the UID */ ! Uid = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_DEVICE_ID) + (ACPI_SIZE) Length); if (!Uid) { Status = AE_NO_MEMORY; goto Cleanup; } ! /* Area for the string starts after DEVICE_ID struct */ ! Uid->String = ACPI_ADD_PTR (char, Uid, sizeof (ACPI_DEVICE_ID)); /* Convert an Integer to string, or just copy an existing string */ if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) { --- 260,279 ---- Length = ObjDesc->String.Length + 1; } /* Allocate a buffer for the UID */ ! Uid = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PNP_DEVICE_ID) + (ACPI_SIZE) Length); if (!Uid) { Status = AE_NO_MEMORY; goto Cleanup; } ! /* Area for the string starts after PNP_DEVICE_ID struct */ ! Uid->String = ACPI_ADD_PTR (char, Uid, sizeof (ACPI_PNP_DEVICE_ID)); /* Convert an Integer to string, or just copy an existing string */ if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) {
*** 250,264 **** ******************************************************************************/ ACPI_STATUS AcpiUtExecute_CID ( ACPI_NAMESPACE_NODE *DeviceNode, ! ACPI_DEVICE_ID_LIST **ReturnCidList) { ACPI_OPERAND_OBJECT **CidObjects; ACPI_OPERAND_OBJECT *ObjDesc; ! ACPI_DEVICE_ID_LIST *CidList; char *NextIdString; UINT32 StringAreaSize; UINT32 Length; UINT32 CidListSize; ACPI_STATUS Status; --- 321,335 ---- ******************************************************************************/ ACPI_STATUS AcpiUtExecute_CID ( ACPI_NAMESPACE_NODE *DeviceNode, ! ACPI_PNP_DEVICE_ID_LIST **ReturnCidList) { ACPI_OPERAND_OBJECT **CidObjects; ACPI_OPERAND_OBJECT *ObjDesc; ! ACPI_PNP_DEVICE_ID_LIST *CidList; char *NextIdString; UINT32 StringAreaSize; UINT32 Length; UINT32 CidListSize; ACPI_STATUS Status;
*** 302,345 **** /* String lengths include null terminator */ switch (CidObjects[i]->Common.Type) { case ACPI_TYPE_INTEGER: StringAreaSize += ACPI_EISAID_STRING_SIZE; break; case ACPI_TYPE_STRING: StringAreaSize += CidObjects[i]->String.Length + 1; break; default: Status = AE_TYPE; goto Cleanup; } } /* * Now that we know the length of the CIDs, allocate return buffer: * 1) Size of the base structure + ! * 2) Size of the CID DEVICE_ID array + * 3) Size of the actual CID strings */ ! CidListSize = sizeof (ACPI_DEVICE_ID_LIST) + ! ((Count - 1) * sizeof (ACPI_DEVICE_ID)) + StringAreaSize; CidList = ACPI_ALLOCATE_ZEROED (CidListSize); if (!CidList) { Status = AE_NO_MEMORY; goto Cleanup; } ! /* Area for CID strings starts after the CID DEVICE_ID array */ NextIdString = ACPI_CAST_PTR (char, CidList->Ids) + ! ((ACPI_SIZE) Count * sizeof (ACPI_DEVICE_ID)); /* Copy/convert the CIDs to the return buffer */ for (i = 0; i < Count; i++) { --- 373,419 ---- /* String lengths include null terminator */ switch (CidObjects[i]->Common.Type) { case ACPI_TYPE_INTEGER: + StringAreaSize += ACPI_EISAID_STRING_SIZE; break; case ACPI_TYPE_STRING: + StringAreaSize += CidObjects[i]->String.Length + 1; break; default: + Status = AE_TYPE; goto Cleanup; } } /* * Now that we know the length of the CIDs, allocate return buffer: * 1) Size of the base structure + ! * 2) Size of the CID PNP_DEVICE_ID array + * 3) Size of the actual CID strings */ ! CidListSize = sizeof (ACPI_PNP_DEVICE_ID_LIST) + ! ((Count - 1) * sizeof (ACPI_PNP_DEVICE_ID)) + StringAreaSize; CidList = ACPI_ALLOCATE_ZEROED (CidListSize); if (!CidList) { Status = AE_NO_MEMORY; goto Cleanup; } ! /* Area for CID strings starts after the CID PNP_DEVICE_ID array */ NextIdString = ACPI_CAST_PTR (char, CidList->Ids) + ! ((ACPI_SIZE) Count * sizeof (ACPI_PNP_DEVICE_ID)); /* Copy/convert the CIDs to the return buffer */ for (i = 0; i < Count; i++) {
*** 375,380 **** /* On exit, we must delete the _CID return object */ AcpiUtRemoveReference (ObjDesc); return_ACPI_STATUS (Status); } - --- 449,453 ----