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

@@ -4,11 +4,11 @@
  *                         ACPI Namespace oriented interfaces
  *
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * 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:

@@ -41,10 +41,11 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
 #define __NSXFNAME_C__
+#define EXPORT_ACPI_INTERFACES
 
 #include "acpi.h"
 #include "accommon.h"
 #include "acnamesp.h"
 #include "acparser.h"

@@ -56,12 +57,12 @@
 
 /* Local prototypes */
 
 static char *
 AcpiNsCopyDeviceId (
-    ACPI_DEVICE_ID          *Dest,
-    ACPI_DEVICE_ID          *Source,
+    ACPI_PNP_DEVICE_ID      *Dest,
+    ACPI_PNP_DEVICE_ID      *Source,
     char                    *StringArea);
 
 
 /******************************************************************************
  *

@@ -118,11 +119,11 @@
      * 1) Fully qualified pathname
      * 2) Parent + Relative pathname
      *
      * Error for <null Parent + relative path>
      */
-    if (AcpiNsValidRootPrefix (Pathname[0]))
+    if (ACPI_IS_ROOT_PREFIX (Pathname[0]))
     {
         /* Pathname is fully qualified (starts with '\') */
 
         /* Special case for root-only, since we can't search for it */
 

@@ -175,10 +176,11 @@
     UINT32                  NameType,
     ACPI_BUFFER             *Buffer)
 {
     ACPI_STATUS             Status;
     ACPI_NAMESPACE_NODE     *Node;
+    char                    *NodeName;
 
 
     /* Parameter validation */
 
     if (NameType > ACPI_NAME_TYPE_MAX)

@@ -225,12 +227,12 @@
         goto UnlockAndExit;
     }
 
     /* Just copy the ACPI name from the Node and zero terminate it */
 
-    ACPI_STRNCPY (Buffer->Pointer, AcpiUtGetNodeName (Node),
-                ACPI_NAME_SIZE);
+    NodeName = AcpiUtGetNodeName (Node);
+    ACPI_MOVE_NAME (Buffer->Pointer, NodeName);
     ((char *) Buffer->Pointer) [ACPI_NAME_SIZE] = 0;
     Status = AE_OK;
 
 
 UnlockAndExit:

@@ -244,28 +246,29 @@
 
 /******************************************************************************
  *
  * FUNCTION:    AcpiNsCopyDeviceId
  *
- * PARAMETERS:  Dest                - Pointer to the destination DEVICE_ID
- *              Source              - Pointer to the source DEVICE_ID
+ * PARAMETERS:  Dest                - Pointer to the destination PNP_DEVICE_ID
+ *              Source              - Pointer to the source PNP_DEVICE_ID
  *              StringArea          - Pointer to where to copy the dest string
  *
  * RETURN:      Pointer to the next string area
  *
- * DESCRIPTION: Copy a single DEVICE_ID, including the string data.
+ * DESCRIPTION: Copy a single PNP_DEVICE_ID, including the string data.
  *
  ******************************************************************************/
 
 static char *
 AcpiNsCopyDeviceId (
-    ACPI_DEVICE_ID          *Dest,
-    ACPI_DEVICE_ID          *Source,
+    ACPI_PNP_DEVICE_ID      *Dest,
+    ACPI_PNP_DEVICE_ID      *Source,
     char                    *StringArea)
 {
-    /* Create the destination DEVICE_ID */
 
+    /* Create the destination PNP_DEVICE_ID */
+
     Dest->String = StringArea;
     Dest->Length = Source->Length;
 
     /* Copy actual string and return a pointer to the next string area */
 

@@ -285,12 +288,12 @@
  *
  * DESCRIPTION: Returns information about an object as gleaned from the
  *              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.
  *
  ******************************************************************************/
 

@@ -299,13 +302,14 @@
     ACPI_HANDLE             Handle,
     ACPI_DEVICE_INFO        **ReturnBuffer)
 {
     ACPI_NAMESPACE_NODE     *Node;
     ACPI_DEVICE_INFO        *Info;
-    ACPI_DEVICE_ID_LIST     *CidList = NULL;
-    ACPI_DEVICE_ID          *Hid = NULL;
-    ACPI_DEVICE_ID          *Uid = NULL;
+    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;
     UINT8                   ParamCount= 0;
     UINT8                   Valid = 0;

@@ -322,11 +326,11 @@
     }
 
     Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
     if (ACPI_FAILURE (Status))
     {
-        goto Cleanup;
+        return (Status);
     }
 
     Node = AcpiNsValidateHandle (Handle);
     if (!Node)
     {

@@ -354,11 +358,11 @@
     if ((Type == ACPI_TYPE_DEVICE) ||
         (Type == ACPI_TYPE_PROCESSOR))
     {
         /*
          * 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
          * to indicate which methods were found and run successfully.
          */

@@ -379,18 +383,27 @@
         {
             InfoSize += Uid->Length;
             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);
         if (ACPI_SUCCESS (Status))
         {
             /* Add size of CID strings and CID pointer array */
 
-            InfoSize += (CidList->ListSize - sizeof (ACPI_DEVICE_ID_LIST));
+            InfoSize += (CidList->ListSize - sizeof (ACPI_PNP_DEVICE_ID_LIST));
             Valid |= ACPI_VALID_CID;
         }
     }
 
     /*

@@ -411,13 +424,18 @@
     {
         /*
          * Get extra info for ACPI Device/Processor objects only:
          * Run the _STA, _ADR and, SxW, and _SxD methods.
          *
-         * Note: none of these methods are required, so they may or may
+         * Notes: none of these methods are required, so they may or may
          * not be present for this device. The Info->Valid bitfield is used
          * to indicate which methods were found and run successfully.
+         *
+         * For _STA, if the method does not exist, then (as per the ACPI
+         * specification), the returned CurrentStatus flags will indicate
+         * that the device is present/functional/enabled. Otherwise, the
+         * CurrentStatus flags reflect the value returned from _STA.
          */
 
         /* Execute the Device._STA method */
 
         Status = AcpiUtExecute_STA (Node, &Info->CurrentStatus);

@@ -461,18 +479,19 @@
      * Point to the end of the base ACPI_DEVICE_INFO structure.
      */
     NextIdString = ACPI_CAST_PTR (char, Info->CompatibleIdList.Ids);
     if (CidList)
     {
-        /* Point past the CID DEVICE_ID array */
+        /* Point past the CID PNP_DEVICE_ID array */
 
-        NextIdString += ((ACPI_SIZE) CidList->Count * sizeof (ACPI_DEVICE_ID));
+        NextIdString += ((ACPI_SIZE) CidList->Count * sizeof (ACPI_PNP_DEVICE_ID));
     }
 
     /*
-     * 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.
      */
     if (Hid)
     {

@@ -489,10 +508,16 @@
     {
         NextIdString = AcpiNsCopyDeviceId (&Info->UniqueId,
             Uid, NextIdString);
     }
 
+    if (Sub)
+    {
+        NextIdString = AcpiNsCopyDeviceId (&Info->SubsystemId,
+            Sub, NextIdString);
+    }
+
     if (CidList)
     {
         Info->CompatibleIdList.Count = CidList->Count;
         Info->CompatibleIdList.ListSize = CidList->ListSize;
 

@@ -529,10 +554,14 @@
     }
     if (Uid)
     {
         ACPI_FREE (Uid);
     }
+    if (Sub)
+    {
+        ACPI_FREE (Sub);
+    }
     if (CidList)
     {
         ACPI_FREE (CidList);
     }
     return (Status);