summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/uteval.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/uteval.c')
-rw-r--r--sys/contrib/dev/acpica/uteval.c106
1 files changed, 98 insertions, 8 deletions
diff --git a/sys/contrib/dev/acpica/uteval.c b/sys/contrib/dev/acpica/uteval.c
index 463c4f7..d2dd7c5 100644
--- a/sys/contrib/dev/acpica/uteval.c
+++ b/sys/contrib/dev/acpica/uteval.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: uteval - Object evaluation
- * $Revision: 31 $
+ * $Revision: 34 $
*
*****************************************************************************/
@@ -250,7 +250,6 @@ AcpiUtExecute_HID (
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "_HID on %4.4s was not found\n",
(char*)&DeviceNode->Name));
}
-
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_HID on %4.4s failed %s\n",
@@ -280,7 +279,6 @@ AcpiUtExecute_HID (
"Type returned from _HID not a number or string: %s(%X) \n",
AcpiUtGetTypeName (ObjDesc->Common.Type), ObjDesc->Common.Type));
}
-
else
{
if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER)
@@ -289,7 +287,6 @@ AcpiUtExecute_HID (
AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, Hid->Buffer);
}
-
else
{
/* Copy the String HID from the returned object */
@@ -298,6 +295,103 @@ AcpiUtExecute_HID (
}
}
+ /* On exit, we must delete the return object */
+
+ AcpiUtRemoveReference (ObjDesc);
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtExecute_CID
+ *
+ * PARAMETERS: DeviceNode - Node for the device
+ * *Cid - Where the CID is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Executes the _CID control method that returns one or more
+ * compatible hardware IDs for the device.
+ *
+ * NOTE: Internal function, no parameter validation
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtExecute_CID (
+ ACPI_NAMESPACE_NODE *DeviceNode,
+ ACPI_DEVICE_ID *Cid)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STATUS Status;
+
+
+ FUNCTION_TRACE ("UtExecute_CID");
+
+ /* Execute the method */
+
+ Status = AcpiNsEvaluateRelative (DeviceNode,
+ METHOD_NAME__CID, NULL, &ObjDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status == AE_NOT_FOUND)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "_CID on %4.4s was not found\n",
+ (char *)&DeviceNode->Name));
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_CID on %4.4s failed %s\n",
+ (char *)&DeviceNode->Name, AcpiFormatException (Status)));
+ }
+
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Did we get a return object? */
+
+ if (!ObjDesc)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _CID\n"));
+ return_ACPI_STATUS (AE_TYPE);
+ }
+
+ /*
+ * A _CID can return either a single compatible ID or a package of compatible
+ * IDs. Each compatible ID can be a Number (32 bit compressed EISA ID) or
+ * string (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss").
+ */
+ switch (ObjDesc->Common.Type)
+ {
+ case ACPI_TYPE_INTEGER:
+
+ /* Convert the Numeric CID to string */
+
+ AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, Cid->Buffer);
+ break;
+
+ case ACPI_TYPE_STRING:
+
+ /* Copy the String CID from the returned object */
+
+ STRNCPY(Cid->Buffer, ObjDesc->String.Pointer, sizeof(Cid->Buffer));
+ break;
+
+ case ACPI_TYPE_PACKAGE:
+
+ /* TBD: Parse package elements; need different return struct, etc. */
+ break;
+
+ default:
+
+ Status = AE_TYPE;
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Type returned from _CID not a number, string, or package: %s(%X) \n",
+ AcpiUtGetTypeName (ObjDesc->Common.Type), ObjDesc->Common.Type));
+ break;
+ }
/* On exit, we must delete the return object */
@@ -346,7 +440,6 @@ AcpiUtExecute_UID (
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "_UID on %4.4s was not found\n",
(char*)&DeviceNode->Name));
}
-
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
@@ -377,7 +470,6 @@ AcpiUtExecute_UID (
"Type returned from _UID was not a number or string: %X \n",
ObjDesc->Common.Type));
}
-
else
{
if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER)
@@ -386,7 +478,6 @@ AcpiUtExecute_UID (
AcpiExUnsignedIntegerToString (ObjDesc->Integer.Value, Uid->Buffer);
}
-
else
{
/* Copy the String UID from the returned object */
@@ -472,7 +563,6 @@ AcpiUtExecute_STA (
"Type returned from _STA was not a number: %X \n",
ObjDesc->Common.Type));
}
-
else
{
/* Extract the status flags */
OpenPOWER on IntegriCloud