AcpiGetObjectInfo: Add support for ACPI 5.0 _SUB method.

Now calls _SUB in addition to the other ID methods: _HID, _CID,
and _UID.
This commit is contained in:
Robert Moore 2012-10-17 10:24:40 -07:00
parent a889648796
commit 8e7a875382
7 changed files with 151 additions and 27 deletions

View File

@ -715,7 +715,7 @@ AcpiDbDisplayCallingTree (
*
* FUNCTION: AcpiDbDisplayObjectType
*
* PARAMETERS: ObjectArg - User entered NS node handle
* PARAMETERS: Name - User entered NS node handle or name
*
* RETURN: None
*
@ -725,17 +725,21 @@ AcpiDbDisplayCallingTree (
void
AcpiDbDisplayObjectType (
char *ObjectArg)
char *Name)
{
ACPI_HANDLE Handle;
ACPI_NAMESPACE_NODE *Node;
ACPI_DEVICE_INFO *Info;
ACPI_STATUS Status;
UINT32 i;
Handle = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16));
Node = AcpiDbConvertToNode (Name);
if (!Node)
{
return;
}
Status = AcpiGetObjectInfo (Handle, &Info);
Status = AcpiGetObjectInfo (ACPI_CAST_PTR (ACPI_HANDLE, Node), &Info);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not get object info, %s\n",
@ -743,18 +747,25 @@ AcpiDbDisplayObjectType (
return;
}
AcpiOsPrintf ("ADR: %8.8X%8.8X, STA: %8.8X, Flags: %X\n",
ACPI_FORMAT_UINT64 (Info->Address),
Info->CurrentStatus, Info->Flags);
AcpiOsPrintf ("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X\n",
Info->HighestDstates[0], Info->HighestDstates[1],
Info->HighestDstates[2], Info->HighestDstates[3]);
AcpiOsPrintf ("S0W-%2.2X S1W-%2.2X S2W-%2.2X S3W-%2.2X S4W-%2.2X\n",
Info->LowestDstates[0], Info->LowestDstates[1],
Info->LowestDstates[2], Info->LowestDstates[3],
Info->LowestDstates[4]);
if (Info->Valid & ACPI_VALID_ADR)
{
AcpiOsPrintf ("ADR: %8.8X%8.8X, STA: %8.8X, Flags: %X\n",
ACPI_FORMAT_UINT64 (Info->Address),
Info->CurrentStatus, Info->Flags);
}
if (Info->Valid & ACPI_VALID_SXDS)
{
AcpiOsPrintf ("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X\n",
Info->HighestDstates[0], Info->HighestDstates[1],
Info->HighestDstates[2], Info->HighestDstates[3]);
}
if (Info->Valid & ACPI_VALID_SXWS)
{
AcpiOsPrintf ("S0W-%2.2X S1W-%2.2X S2W-%2.2X S3W-%2.2X S4W-%2.2X\n",
Info->LowestDstates[0], Info->LowestDstates[1],
Info->LowestDstates[2], Info->LowestDstates[3],
Info->LowestDstates[4]);
}
if (Info->Valid & ACPI_VALID_HID)
{
@ -764,6 +775,10 @@ AcpiDbDisplayObjectType (
{
AcpiOsPrintf ("UID: %s\n", Info->UniqueId.String);
}
if (Info->Valid & ACPI_VALID_SUB)
{
AcpiOsPrintf ("SUB: %s\n", Info->SubsystemId.String);
}
if (Info->Valid & ACPI_VALID_CID)
{
for (i = 0; i < Info->CompatibleIdList.Count; i++)

View File

@ -333,6 +333,7 @@ AcpiNsCopyDeviceId (
ACPI_PNP_DEVICE_ID *Source,
char *StringArea)
{
/* Create the destination PNP_DEVICE_ID */
Dest->String = StringArea;
@ -358,8 +359,8 @@ AcpiNsCopyDeviceId (
* namespace node and possibly by running several standard
* control methods (Such as in the case of a device.)
*
* For Device and Processor objects, run the Device _HID, _UID, _CID, _STA,
* _ADR, _SxW, and _SxD methods.
* For Device and Processor objects, run the Device _HID, _UID, _CID, _SUB,
* _STA, _ADR, _SxW, and _SxD methods.
*
* Note: Allocates the return buffer, must be freed by the caller.
*
@ -375,6 +376,7 @@ AcpiGetObjectInfo (
ACPI_PNP_DEVICE_ID_LIST *CidList = NULL;
ACPI_PNP_DEVICE_ID *Hid = NULL;
ACPI_PNP_DEVICE_ID *Uid = NULL;
ACPI_PNP_DEVICE_ID *Sub = NULL;
char *NextIdString;
ACPI_OBJECT_TYPE Type;
ACPI_NAME Name;
@ -427,7 +429,7 @@ AcpiGetObjectInfo (
{
/*
* Get extra info for ACPI Device/Processor objects only:
* Run the Device _HID, _UID, and _CID methods.
* Run the Device _HID, _UID, _SUB, and _CID methods.
*
* Note: none of these methods are required, so they may or may
* not be present for this device. The Info->Valid bitfield is used
@ -452,6 +454,15 @@ AcpiGetObjectInfo (
Valid |= ACPI_VALID_UID;
}
/* Execute the Device._SUB method */
Status = AcpiUtExecute_SUB (Node, &Sub);
if (ACPI_SUCCESS (Status))
{
InfoSize += Sub->Length;
Valid |= ACPI_VALID_SUB;
}
/* Execute the Device._CID method */
Status = AcpiUtExecute_CID (Node, &CidList);
@ -540,8 +551,9 @@ AcpiGetObjectInfo (
}
/*
* Copy the HID, UID, and CIDs to the return buffer. The variable-length
* strings are copied to the reserved area at the end of the buffer.
* Copy the HID, UID, SUB, and CIDs to the return buffer.
* The variable-length strings are copied to the reserved area
* at the end of the buffer.
*
* For HID and CID, check if the ID is a PCI Root Bridge.
*/
@ -562,6 +574,12 @@ AcpiGetObjectInfo (
Uid, NextIdString);
}
if (Sub)
{
NextIdString = AcpiNsCopyDeviceId (&Info->SubsystemId,
Sub, NextIdString);
}
if (CidList)
{
Info->CompatibleIdList.Count = CidList->Count;
@ -602,6 +620,10 @@ Cleanup:
{
ACPI_FREE (Uid);
}
if (Sub)
{
ACPI_FREE (Sub);
}
if (CidList)
{
ACPI_FREE (CidList);

View File

@ -211,6 +211,77 @@ Cleanup:
}
/*******************************************************************************
*
* 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

View File

@ -122,6 +122,7 @@
#define METHOD_NAME__HID "_HID"
#define METHOD_NAME__CID "_CID"
#define METHOD_NAME__UID "_UID"
#define METHOD_NAME__SUB "_SUB"
#define METHOD_NAME__ADR "_ADR"
#define METHOD_NAME__INI "_INI"
#define METHOD_NAME__STA "_STA"

View File

@ -1181,7 +1181,7 @@ UINT32 (*ACPI_INTERFACE_HANDLER) (
#define ACPI_UUID_LENGTH 16
/* Structures used for device/processor HID, UID, CID */
/* Structures used for device/processor HID, UID, CID, and SUB */
typedef struct acpi_pnp_device_id
{
@ -1216,6 +1216,7 @@ typedef struct acpi_device_info
UINT64 Address; /* _ADR value */
ACPI_PNP_DEVICE_ID HardwareId; /* _HID value */
ACPI_PNP_DEVICE_ID UniqueId; /* _UID value */
ACPI_PNP_DEVICE_ID SubsystemId; /* _SUB value */
ACPI_PNP_DEVICE_ID_LIST CompatibleIdList; /* _CID list <must be last> */
} ACPI_DEVICE_INFO;
@ -1230,11 +1231,12 @@ typedef struct acpi_device_info
#define ACPI_VALID_ADR 0x02
#define ACPI_VALID_HID 0x04
#define ACPI_VALID_UID 0x08
#define ACPI_VALID_CID 0x10
#define ACPI_VALID_SXDS 0x20
#define ACPI_VALID_SXWS 0x40
#define ACPI_VALID_SUB 0x10
#define ACPI_VALID_CID 0x20
#define ACPI_VALID_SXDS 0x40
#define ACPI_VALID_SXWS 0x80
/* Flags for _STA method */
/* Flags for _STA return value (CurrentStatus above) */
#define ACPI_STA_DEVICE_PRESENT 0x01
#define ACPI_STA_DEVICE_ENABLED 0x02

View File

@ -591,6 +591,11 @@ AcpiUtExecute_UID (
ACPI_NAMESPACE_NODE *DeviceNode,
ACPI_PNP_DEVICE_ID **ReturnId);
ACPI_STATUS
AcpiUtExecute_SUB (
ACPI_NAMESPACE_NODE *DeviceNode,
ACPI_PNP_DEVICE_ID **ReturnId);
ACPI_STATUS
AcpiUtExecute_CID (
ACPI_NAMESPACE_NODE *DeviceNode,

View File

@ -170,6 +170,14 @@ AcpiUtExecute_UID (
return (AE_NOT_IMPLEMENTED);
}
ACPI_STATUS
AcpiUtExecute_SUB (
ACPI_NAMESPACE_NODE *DeviceNode,
ACPI_PNP_DEVICE_ID **ReturnId)
{
return (AE_NOT_IMPLEMENTED);
}
ACPI_STATUS
AcpiUtExecutePowerMethods (
ACPI_NAMESPACE_NODE *DeviceNode,