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

@@ -3,11 +3,11 @@
  * Module Name: psargs - Parse AML opcode arguments
  *
  *****************************************************************************/
 
 /*
- * 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:

@@ -180,11 +180,12 @@
     ACPI_FUNCTION_TRACE (PsGetNextNamestring);
 
 
     /* Point past any namestring prefix characters (backslash or carat) */
 
-    while (AcpiPsIsPrefixChar (*End))
+    while (ACPI_IS_ROOT_PREFIX (*End) ||
+           ACPI_IS_PARENT_PREFIX (*End))
     {
         End++;
     }
 
     /* Decode the path prefix character */

@@ -444,41 +445,37 @@
         Opcode = AML_BYTE_OP;
         Arg->Common.Value.Integer = (UINT64) *Aml;
         Length = 1;
         break;
 
-
     case ARGP_WORDDATA:
 
         /* Get 2 bytes from the AML stream */
 
         Opcode = AML_WORD_OP;
         ACPI_MOVE_16_TO_64 (&Arg->Common.Value.Integer, Aml);
         Length = 2;
         break;
 
-
     case ARGP_DWORDDATA:
 
         /* Get 4 bytes from the AML stream */
 
         Opcode = AML_DWORD_OP;
         ACPI_MOVE_32_TO_64 (&Arg->Common.Value.Integer, Aml);
         Length = 4;
         break;
 
-
     case ARGP_QWORDDATA:
 
         /* Get 8 bytes from the AML stream */
 
         Opcode = AML_QWORD_OP;
         ACPI_MOVE_64_TO_64 (&Arg->Common.Value.Integer, Aml);
         Length = 8;
         break;
 
-
     case ARGP_CHARLIST:
 
         /* Get a pointer to the string, point past the string */
 
         Opcode = AML_STRING_OP;

@@ -492,19 +489,17 @@
             Length++;
         }
         Length++;
         break;
 
-
     case ARGP_NAME:
     case ARGP_NAMESTRING:
 
         AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP);
         Arg->Common.Value.Name = AcpiPsGetNextNamestring (ParserState);
         return_VOID;
 
-
     default:
 
         ACPI_ERROR ((AE_INFO, "Invalid ArgType 0x%X", ArgType));
         return_VOID;
     }

@@ -529,41 +524,61 @@
 
 static ACPI_PARSE_OBJECT *
 AcpiPsGetNextField (
     ACPI_PARSE_STATE        *ParserState)
 {
-    UINT32                  AmlOffset = (UINT32)
-                                ACPI_PTR_DIFF (ParserState->Aml,
-                                               ParserState->AmlStart);
+    UINT32                  AmlOffset;
     ACPI_PARSE_OBJECT       *Field;
+    ACPI_PARSE_OBJECT       *Arg = NULL;
     UINT16                  Opcode;
     UINT32                  Name;
+    UINT8                   AccessType;
+    UINT8                   AccessAttribute;
+    UINT8                   AccessLength;
+    UINT32                  PkgLength;
+    UINT8                   *PkgEnd;
+    UINT32                  BufferLength;
 
 
     ACPI_FUNCTION_TRACE (PsGetNextField);
 
 
+    AmlOffset = (UINT32) ACPI_PTR_DIFF (
+        ParserState->Aml, ParserState->AmlStart);
+
     /* Determine field type */
 
     switch (ACPI_GET8 (ParserState->Aml))
     {
-    default:
+    case AML_FIELD_OFFSET_OP:
 
-        Opcode = AML_INT_NAMEDFIELD_OP;
+        Opcode = AML_INT_RESERVEDFIELD_OP;
+        ParserState->Aml++;
         break;
 
-    case 0x00:
+    case AML_FIELD_ACCESS_OP:
 
-        Opcode = AML_INT_RESERVEDFIELD_OP;
+        Opcode = AML_INT_ACCESSFIELD_OP;
         ParserState->Aml++;
         break;
 
-    case 0x01:
+    case AML_FIELD_CONNECTION_OP:
 
-        Opcode = AML_INT_ACCESSFIELD_OP;
+        Opcode = AML_INT_CONNECTION_OP;
         ParserState->Aml++;
         break;
+
+    case AML_FIELD_EXT_ACCESS_OP:
+
+        Opcode = AML_INT_EXTACCESSFIELD_OP;
+        ParserState->Aml++;
+        break;
+
+    default:
+
+        Opcode = AML_INT_NAMEDFIELD_OP;
+        break;
     }
 
     /* Allocate a new field op */
 
     Field = AcpiPsAllocOp (Opcode);

@@ -599,23 +614,128 @@
         Field->Common.Value.Size = AcpiPsGetNextPackageLength (ParserState);
         break;
 
 
     case AML_INT_ACCESSFIELD_OP:
+    case AML_INT_EXTACCESSFIELD_OP:
 
         /*
          * Get AccessType and AccessAttrib and merge into the field Op
-         * AccessType is first operand, AccessAttribute is second
+         * AccessType is first operand, AccessAttribute is second. stuff
+         * these bytes into the node integer value for convenience.
          */
-        Field->Common.Value.Integer = (((UINT32) ACPI_GET8 (ParserState->Aml) << 8));
+
+        /* Get the two bytes (Type/Attribute) */
+
+        AccessType = ACPI_GET8 (ParserState->Aml);
         ParserState->Aml++;
-        Field->Common.Value.Integer |= ACPI_GET8 (ParserState->Aml);
+        AccessAttribute = ACPI_GET8 (ParserState->Aml);
         ParserState->Aml++;
+
+        Field->Common.Value.Integer = (UINT8) AccessType;
+        Field->Common.Value.Integer |= (UINT16) (AccessAttribute << 8);
+
+        /* This opcode has a third byte, AccessLength */
+
+        if (Opcode == AML_INT_EXTACCESSFIELD_OP)
+        {
+            AccessLength = ACPI_GET8 (ParserState->Aml);
+            ParserState->Aml++;
+
+            Field->Common.Value.Integer |= (UINT32) (AccessLength << 16);
+        }
         break;
 
+
+    case AML_INT_CONNECTION_OP:
+
+        /*
+         * Argument for Connection operator can be either a Buffer
+         * (resource descriptor), or a NameString.
+         */
+        if (ACPI_GET8 (ParserState->Aml) == AML_BUFFER_OP)
+        {
+            ParserState->Aml++;
+
+            PkgEnd = ParserState->Aml;
+            PkgLength = AcpiPsGetNextPackageLength (ParserState);
+            PkgEnd += PkgLength;
+
+            if (ParserState->Aml < PkgEnd)
+            {
+                /* Non-empty list */
+
+                Arg = AcpiPsAllocOp (AML_INT_BYTELIST_OP);
+                if (!Arg)
+                {
+                    AcpiPsFreeOp (Field);
+                    return_PTR (NULL);
+                }
+
+                /* Get the actual buffer length argument */
+
+                Opcode = ACPI_GET8 (ParserState->Aml);
+                ParserState->Aml++;
+
+                switch (Opcode)
+                {
+                case AML_BYTE_OP:       /* AML_BYTEDATA_ARG */
+
+                    BufferLength = ACPI_GET8 (ParserState->Aml);
+                    ParserState->Aml += 1;
+                    break;
+
+                case AML_WORD_OP:       /* AML_WORDDATA_ARG */
+
+                    BufferLength = ACPI_GET16 (ParserState->Aml);
+                    ParserState->Aml += 2;
+                    break;
+
+                case AML_DWORD_OP:      /* AML_DWORDATA_ARG */
+
+                    BufferLength = ACPI_GET32 (ParserState->Aml);
+                    ParserState->Aml += 4;
+                    break;
+
     default:
 
+                    BufferLength = 0;
+                    break;
+                }
+
+                /* Fill in bytelist data */
+
+                Arg->Named.Value.Size = BufferLength;
+                Arg->Named.Data = ParserState->Aml;
+            }
+
+            /* Skip to End of byte data */
+
+            ParserState->Aml = PkgEnd;
+        }
+        else
+        {
+            Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP);
+            if (!Arg)
+            {
+                AcpiPsFreeOp (Field);
+                return_PTR (NULL);
+            }
+
+            /* Get the Namestring argument */
+
+            Arg->Common.Value.Name = AcpiPsGetNextNamestring (ParserState);
+        }
+
+        /* Link the buffer/namestring to parent (CONNECTION_OP) */
+
+        AcpiPsAppendArg (Field, Arg);
+        break;
+
+
+    default:
+
         /* Opcode was set in previous switch */
         break;
     }
 
     return_PTR (Field);

@@ -672,19 +792,17 @@
             return_ACPI_STATUS (AE_NO_MEMORY);
         }
         AcpiPsGetNextSimpleArg (ParserState, ArgType, Arg);
         break;
 
-
     case ARGP_PKGLENGTH:
 
         /* Package length, nothing returned */
 
         ParserState->PkgEnd = AcpiPsGetNextPackageEnd (ParserState);
         break;
 
-
     case ARGP_FIELDLIST:
 
         if (ParserState->Aml < ParserState->PkgEnd)
         {
             /* Non-empty list */

@@ -712,11 +830,10 @@
 
             ParserState->Aml = ParserState->PkgEnd;
         }
         break;
 
-
     case ARGP_BYTELIST:
 
         if (ParserState->Aml < ParserState->PkgEnd)
         {
             /* Non-empty list */

@@ -737,19 +854,19 @@
 
             ParserState->Aml = ParserState->PkgEnd;
         }
         break;
 
-
     case ARGP_TARGET:
     case ARGP_SUPERNAME:
     case ARGP_SIMPLENAME:
 
         Subop = AcpiPsPeekOpcode (ParserState);
         if (Subop == 0                  ||
             AcpiPsIsLeadingChar (Subop) ||
-            AcpiPsIsPrefixChar (Subop))
+            ACPI_IS_ROOT_PREFIX (Subop) ||
+            ACPI_IS_PARENT_PREFIX (Subop))
         {
             /* NullName or NameString */
 
             Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP);
             if (!Arg)

@@ -784,20 +901,18 @@
 
             WalkState->ArgCount = 1;
         }
         break;
 
-
     case ARGP_DATAOBJ:
     case ARGP_TERMARG:
 
         /* Single complex argument, nothing returned */
 
         WalkState->ArgCount = 1;
         break;
 
-
     case ARGP_DATAOBJLIST:
     case ARGP_TERMLIST:
     case ARGP_OBJLIST:
 
         if (ParserState->Aml < ParserState->PkgEnd)

@@ -806,11 +921,10 @@
 
             WalkState->ArgCount = ACPI_VAR_ARGS;
         }
         break;
 
-
     default:
 
         ACPI_ERROR ((AE_INFO, "Invalid ArgType: 0x%X", ArgType));
         Status = AE_AML_OPERAND_TYPE;
         break;