[ACPICA]
authorThomas Faber <thomas.faber@reactos.org>
Sat, 4 Mar 2017 16:54:26 +0000 (16:54 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Sat, 4 Mar 2017 16:54:26 +0000 (16:54 +0000)
- Update to version 20170303
CORE-12885

svn path=/trunk/; revision=74056

43 files changed:
reactos/drivers/bus/acpi/acpica/dispatcher/dscontrol.c
reactos/drivers/bus/acpi/acpica/dispatcher/dsmthdat.c
reactos/drivers/bus/acpi/acpica/dispatcher/dsobject.c
reactos/drivers/bus/acpi/acpica/dispatcher/dsopcode.c
reactos/drivers/bus/acpi/acpica/dispatcher/dsutils.c
reactos/drivers/bus/acpi/acpica/dispatcher/dswexec.c
reactos/drivers/bus/acpi/acpica/dispatcher/dswload2.c
reactos/drivers/bus/acpi/acpica/executer/exmisc.c
reactos/drivers/bus/acpi/acpica/executer/exnames.c
reactos/drivers/bus/acpi/acpica/executer/exoparg1.c
reactos/drivers/bus/acpi/acpica/executer/exoparg2.c
reactos/drivers/bus/acpi/acpica/executer/exoparg6.c
reactos/drivers/bus/acpi/acpica/executer/exresolv.c
reactos/drivers/bus/acpi/acpica/executer/exstore.c
reactos/drivers/bus/acpi/acpica/executer/exstoren.c
reactos/drivers/bus/acpi/acpica/hardware/hwvalid.c
reactos/drivers/bus/acpi/acpica/include/acconfig.h
reactos/drivers/bus/acpi/acpica/include/acconvert.h [new file with mode: 0644]
reactos/drivers/bus/acpi/acpica/include/acdisasm.h
reactos/drivers/bus/acpi/acpica/include/acglobal.h
reactos/drivers/bus/acpi/acpica/include/aclocal.h
reactos/drivers/bus/acpi/acpica/include/acmacros.h
reactos/drivers/bus/acpi/acpica/include/acopcode.h
reactos/drivers/bus/acpi/acpica/include/acpixf.h
reactos/drivers/bus/acpi/acpica/include/actbl2.h
reactos/drivers/bus/acpi/acpica/include/amlcode.h
reactos/drivers/bus/acpi/acpica/namespace/nsaccess.c
reactos/drivers/bus/acpi/acpica/namespace/nsrepair.c
reactos/drivers/bus/acpi/acpica/namespace/nsrepair2.c
reactos/drivers/bus/acpi/acpica/namespace/nsutils.c
reactos/drivers/bus/acpi/acpica/parser/psargs.c
reactos/drivers/bus/acpi/acpica/parser/psloop.c
reactos/drivers/bus/acpi/acpica/parser/psobject.c
reactos/drivers/bus/acpi/acpica/parser/psopcode.c
reactos/drivers/bus/acpi/acpica/parser/psopinfo.c
reactos/drivers/bus/acpi/acpica/parser/psparse.c
reactos/drivers/bus/acpi/acpica/parser/pstree.c
reactos/drivers/bus/acpi/acpica/parser/psutils.c
reactos/drivers/bus/acpi/acpica/utilities/utalloc.c
reactos/drivers/bus/acpi/acpica/utilities/utcache.c
reactos/drivers/bus/acpi/acpica/utilities/utdebug.c
reactos/drivers/bus/acpi/acpica/utilities/utresrc.c
reactos/drivers/bus/acpi/acpica/utilities/utxferror.c

index db014cf..df22ddf 100644 (file)
@@ -358,7 +358,7 @@ AcpiDsExecEndControlOp (
 
         break;
 
-    case AML_BREAK_POINT_OP:
+    case AML_BREAKPOINT_OP:
 
         AcpiDbSignalBreakPoint (WalkState);
 
index 98fca89..18d7cd7 100644 (file)
@@ -728,7 +728,8 @@ AcpiDsStoreObjectToLocal (
  *
  * FUNCTION:    AcpiDsMethodDataGetType
  *
- * PARAMETERS:  Opcode              - Either AML_LOCAL_OP or AML_ARG_OP
+ * PARAMETERS:  Opcode              - Either AML_FIRST LOCAL_OP or
+ *                                    AML_FIRST_ARG_OP
  *              Index               - Which Local or Arg whose type to get
  *              WalkState           - Current walk state object
  *
index 645c816..cb432e3 100644 (file)
@@ -113,7 +113,7 @@ AcpiDsBuildInternalObject (
                 if ((Status == AE_NOT_FOUND) && (AcpiGbl_EnableInterpreterSlack) &&
 
                     ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
-                     (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP)))
+                     (Op->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP)))
                 {
                     /*
                      * We didn't find the target and we are populating elements
@@ -142,7 +142,7 @@ AcpiDsBuildInternalObject (
         /* Special object resolution for elements of a package */
 
         if ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
-            (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
+            (Op->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP))
         {
             /*
              * Attempt to resolve the node to a value before we insert it into
@@ -411,7 +411,7 @@ AcpiDsBuildInternalPackageObj (
 
     Parent = Op->Common.Parent;
     while ((Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
-           (Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
+           (Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP))
     {
         Parent = Parent->Common.Parent;
     }
@@ -795,9 +795,9 @@ AcpiDsInitObjectFromOp (
         {
         case AML_TYPE_LOCAL_VARIABLE:
 
-            /* Local ID (0-7) is (AML opcode - base AML_LOCAL_OP) */
+            /* Local ID (0-7) is (AML opcode - base AML_FIRST_LOCAL_OP) */
 
-            ObjDesc->Reference.Value = ((UINT32) Opcode) - AML_LOCAL_OP;
+            ObjDesc->Reference.Value = ((UINT32) Opcode) - AML_FIRST_LOCAL_OP;
             ObjDesc->Reference.Class = ACPI_REFCLASS_LOCAL;
 
 #ifndef ACPI_NO_METHOD_EXECUTION
@@ -810,9 +810,9 @@ AcpiDsInitObjectFromOp (
 
         case AML_TYPE_METHOD_ARGUMENT:
 
-            /* Arg ID (0-6) is (AML opcode - base AML_ARG_OP) */
+            /* Arg ID (0-6) is (AML opcode - base AML_FIRST_ARG_OP) */
 
-            ObjDesc->Reference.Value = ((UINT32) Opcode) - AML_ARG_OP;
+            ObjDesc->Reference.Value = ((UINT32) Opcode) - AML_FIRST_ARG_OP;
             ObjDesc->Reference.Class = ACPI_REFCLASS_ARG;
 
 #ifndef ACPI_NO_METHOD_EXECUTION
index e7e037c..ceb0dab 100644 (file)
@@ -681,7 +681,7 @@ AcpiDsEvalDataObjectOperands (
         break;
 
     case AML_PACKAGE_OP:
-    case AML_VAR_PACKAGE_OP:
+    case AML_VARIABLE_PACKAGE_OP:
 
         Status = AcpiDsBuildInternalPackageObj (
             WalkState, Op, Length, &ObjDesc);
@@ -701,7 +701,7 @@ AcpiDsEvalDataObjectOperands (
          */
         if ((!Op->Common.Parent) ||
             ((Op->Common.Parent->Common.AmlOpcode != AML_PACKAGE_OP) &&
-             (Op->Common.Parent->Common.AmlOpcode != AML_VAR_PACKAGE_OP) &&
+             (Op->Common.Parent->Common.AmlOpcode != AML_VARIABLE_PACKAGE_OP) &&
              (Op->Common.Parent->Common.AmlOpcode != AML_NAME_OP)))
         {
             WalkState->ResultObj = ObjDesc;
index d940014..f44fb9f 100644 (file)
@@ -297,8 +297,8 @@ AcpiDsIsResultUsed (
         if ((Op->Common.Parent->Common.AmlOpcode == AML_REGION_OP)       ||
             (Op->Common.Parent->Common.AmlOpcode == AML_DATA_REGION_OP)  ||
             (Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP)      ||
-            (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP)  ||
             (Op->Common.Parent->Common.AmlOpcode == AML_BUFFER_OP)       ||
+            (Op->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP) ||
             (Op->Common.Parent->Common.AmlOpcode == AML_INT_EVAL_SUBTREE_OP) ||
             (Op->Common.Parent->Common.AmlOpcode == AML_BANK_FIELD_OP))
         {
@@ -589,7 +589,7 @@ AcpiDsCreateOperand (
              */
             if (Status == AE_NOT_FOUND)
             {
-                if (ParentOp->Common.AmlOpcode == AML_COND_REF_OF_OP)
+                if (ParentOp->Common.AmlOpcode == AML_CONDITIONAL_REF_OF_OP)
                 {
                     /*
                      * For the Conditional Reference op, it's OK if
@@ -870,7 +870,7 @@ AcpiDsEvaluateNamePath (
     }
 
     if ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
-        (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP) ||
+        (Op->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP) ||
         (Op->Common.Parent->Common.AmlOpcode == AML_REF_OF_OP))
     {
         /* TBD: Should we specify this feature as a bit of OpInfo->Flags of these opcodes? */
index 35f348f..7d7022e 100644 (file)
@@ -536,7 +536,7 @@ AcpiDsExecEndOp (
              */
             if ((Op->Asl.Parent) &&
                ((Op->Asl.Parent->Asl.AmlOpcode == AML_PACKAGE_OP) ||
-                (Op->Asl.Parent->Asl.AmlOpcode == AML_VAR_PACKAGE_OP)))
+                (Op->Asl.Parent->Asl.AmlOpcode == AML_VARIABLE_PACKAGE_OP)))
             {
                 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
                     "Method Reference in a Package, Op=%p\n", Op));
index a81e978..4985f20 100644 (file)
@@ -543,7 +543,7 @@ AcpiDsLoad2EndOp (
             Status = AcpiExCreateProcessor (WalkState);
             break;
 
-        case AML_POWER_RES_OP:
+        case AML_POWER_RESOURCE_OP:
 
             Status = AcpiExCreatePowerResource (WalkState);
             break;
index 6d17116..80d420c 100644 (file)
@@ -274,7 +274,7 @@ AcpiExDoLogicalNumericOp (
 
     switch (Opcode)
     {
-    case AML_LAND_OP:               /* LAnd (Integer0, Integer1) */
+    case AML_LOGICAL_AND_OP:        /* LAnd (Integer0, Integer1) */
 
         if (Integer0 && Integer1)
         {
@@ -282,7 +282,7 @@ AcpiExDoLogicalNumericOp (
         }
         break;
 
-    case AML_LOR_OP:                /* LOr (Integer0, Integer1) */
+    case AML_LOGICAL_OR_OP:         /* LOr (Integer0, Integer1) */
 
         if (Integer0 || Integer1)
         {
@@ -400,7 +400,7 @@ AcpiExDoLogicalOp (
 
         switch (Opcode)
         {
-        case AML_LEQUAL_OP:             /* LEqual (Operand0, Operand1) */
+        case AML_LOGICAL_EQUAL_OP:          /* LEqual (Operand0, Operand1) */
 
             if (Integer0 == Integer1)
             {
@@ -408,7 +408,7 @@ AcpiExDoLogicalOp (
             }
             break;
 
-        case AML_LGREATER_OP:           /* LGreater (Operand0, Operand1) */
+        case AML_LOGICAL_GREATER_OP:        /* LGreater (Operand0, Operand1) */
 
             if (Integer0 > Integer1)
             {
@@ -416,7 +416,7 @@ AcpiExDoLogicalOp (
             }
             break;
 
-        case AML_LLESS_OP:              /* LLess (Operand0, Operand1) */
+        case AML_LOGICAL_LESS_OP:           /* LLess (Operand0, Operand1) */
 
             if (Integer0 < Integer1)
             {
@@ -449,7 +449,7 @@ AcpiExDoLogicalOp (
 
         switch (Opcode)
         {
-        case AML_LEQUAL_OP:             /* LEqual (Operand0, Operand1) */
+        case AML_LOGICAL_EQUAL_OP:      /* LEqual (Operand0, Operand1) */
 
             /* Length and all bytes must be equal */
 
@@ -462,7 +462,7 @@ AcpiExDoLogicalOp (
             }
             break;
 
-        case AML_LGREATER_OP:           /* LGreater (Operand0, Operand1) */
+        case AML_LOGICAL_GREATER_OP:    /* LGreater (Operand0, Operand1) */
 
             if (Compare > 0)
             {
@@ -482,7 +482,7 @@ AcpiExDoLogicalOp (
             }
             break;
 
-        case AML_LLESS_OP:              /* LLess (Operand0, Operand1) */
+        case AML_LOGICAL_LESS_OP:       /* LLess (Operand0, Operand1) */
 
             if (Compare > 0)
             {
index e921745..7cd68ba 100644 (file)
@@ -141,7 +141,7 @@ AcpiExAllocateNameString (
     {
         /* Set up multi prefixes   */
 
-        *TempPtr++ = AML_MULTI_NAME_PREFIX_OP;
+        *TempPtr++ = AML_MULTI_NAME_PREFIX;
         *TempPtr++ = (char) NumNameSegs;
     }
     else if (2 == NumNameSegs)
@@ -385,7 +385,7 @@ AcpiExGetNameString (
             }
             break;
 
-        case AML_MULTI_NAME_PREFIX_OP:
+        case AML_MULTI_NAME_PREFIX:
 
             ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "MultiNamePrefix at %p\n",
                 AmlAddress));
index 656c60a..b3323db 100644 (file)
@@ -304,7 +304,7 @@ AcpiExOpcode_1A_1T_1R (
     case AML_FIND_SET_RIGHT_BIT_OP:
     case AML_FROM_BCD_OP:
     case AML_TO_BCD_OP:
-    case AML_COND_REF_OF_OP:
+    case AML_CONDITIONAL_REF_OF_OP:
 
         /* Create a return object of type Integer for these opcodes */
 
@@ -435,7 +435,7 @@ AcpiExOpcode_1A_1T_1R (
             }
             break;
 
-        case AML_COND_REF_OF_OP:        /* CondRefOf (SourceObject, Result)  */
+        case AML_CONDITIONAL_REF_OF_OP:     /* CondRefOf (SourceObject, Result)  */
             /*
              * This op is a little strange because the internal return value is
              * different than the return value stored in the result descriptor
@@ -507,13 +507,13 @@ AcpiExOpcode_1A_1T_1R (
     /*
      * ACPI 2.0 Opcodes
      */
-    case AML_COPY_OP:               /* Copy (Source, Target) */
+    case AML_COPY_OBJECT_OP:        /* CopyObject (Source, Target) */
 
         Status = AcpiUtCopyIobjectToIobject (
             Operand[0], &ReturnDesc, WalkState);
         break;
 
-    case AML_TO_DECSTRING_OP:       /* ToDecimalString (Data, Result) */
+    case AML_TO_DECIMAL_STRING_OP:  /* ToDecimalString (Data, Result) */
 
         Status = AcpiExConvertToString (
             Operand[0], &ReturnDesc, ACPI_EXPLICIT_CONVERT_DECIMAL);
@@ -525,7 +525,7 @@ AcpiExOpcode_1A_1T_1R (
         }
         break;
 
-    case AML_TO_HEXSTRING_OP:       /* ToHexString (Data, Result) */
+    case AML_TO_HEX_STRING_OP:      /* ToHexString (Data, Result) */
 
         Status = AcpiExConvertToString (
             Operand[0], &ReturnDesc, ACPI_EXPLICIT_CONVERT_HEX);
@@ -640,7 +640,7 @@ AcpiExOpcode_1A_0T_1R (
 
     switch (WalkState->Opcode)
     {
-    case AML_LNOT_OP:               /* LNot (Operand) */
+    case AML_LOGICAL_NOT_OP:        /* LNot (Operand) */
 
         ReturnDesc = AcpiUtCreateIntegerObject ((UINT64) 0);
         if (!ReturnDesc)
@@ -691,7 +691,8 @@ AcpiExOpcode_1A_0T_1R (
          * NOTE:  We use LNOT_OP here in order to force resolution of the
          * reference operand to an actual integer.
          */
-        Status = AcpiExResolveOperands (AML_LNOT_OP, &TempDesc, WalkState);
+        Status = AcpiExResolveOperands (AML_LOGICAL_NOT_OP,
+            &TempDesc, WalkState);
         if (ACPI_FAILURE (Status))
         {
             ACPI_EXCEPTION ((AE_INFO, Status,
index 01003d4..cbbb4b5 100644 (file)
@@ -330,7 +330,7 @@ AcpiExOpcode_2A_1T_1R (
             &ReturnDesc->Integer.Value);
         break;
 
-    case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */
+    case AML_CONCATENATE_OP: /* Concatenate (Data1, Data2, Result) */
 
         Status = AcpiExDoConcatenate (
             Operand[0], Operand[1], &ReturnDesc, WalkState);
@@ -376,7 +376,7 @@ AcpiExOpcode_2A_1T_1R (
             Operand[0]->Buffer.Pointer, Length);
         break;
 
-    case AML_CONCAT_RES_OP:
+    case AML_CONCATENATE_TEMPLATE_OP:
 
         /* ConcatenateResTemplate (Buffer, Buffer, Result) (ACPI 2.0) */
 
index d3e6d9d..89c089b 100644 (file)
@@ -133,7 +133,7 @@ AcpiExDoMatch (
          * Change to:     (M == P[i])
          */
         Status = AcpiExDoLogicalOp (
-            AML_LEQUAL_OP, MatchObj, PackageObj, &LogicalResult);
+            AML_LOGICAL_EQUAL_OP, MatchObj, PackageObj, &LogicalResult);
         if (ACPI_FAILURE (Status))
         {
             return (FALSE);
@@ -146,7 +146,7 @@ AcpiExDoMatch (
          * Change to:                  (M >= P[i]) (M NotLess than P[i])
          */
         Status = AcpiExDoLogicalOp (
-            AML_LLESS_OP, MatchObj, PackageObj, &LogicalResult);
+            AML_LOGICAL_LESS_OP, MatchObj, PackageObj, &LogicalResult);
         if (ACPI_FAILURE (Status))
         {
             return (FALSE);
@@ -160,7 +160,7 @@ AcpiExDoMatch (
          * Change to:         (M > P[i])
          */
         Status = AcpiExDoLogicalOp (
-            AML_LGREATER_OP, MatchObj, PackageObj, &LogicalResult);
+            AML_LOGICAL_GREATER_OP, MatchObj, PackageObj, &LogicalResult);
         if (ACPI_FAILURE (Status))
         {
             return (FALSE);
@@ -173,7 +173,7 @@ AcpiExDoMatch (
          * Change to:                     (M <= P[i]) (M NotGreater than P[i])
          */
         Status = AcpiExDoLogicalOp (
-            AML_LGREATER_OP, MatchObj, PackageObj, &LogicalResult);
+            AML_LOGICAL_GREATER_OP, MatchObj, PackageObj, &LogicalResult);
         if (ACPI_FAILURE (Status))
         {
             return (FALSE);
@@ -187,7 +187,7 @@ AcpiExDoMatch (
          * Change to:            (M < P[i])
          */
         Status = AcpiExDoLogicalOp (
-            AML_LLESS_OP, MatchObj, PackageObj, &LogicalResult);
+            AML_LOGICAL_LESS_OP, MatchObj, PackageObj, &LogicalResult);
         if (ACPI_FAILURE (Status))
         {
             return (FALSE);
index b15e08c..bbef5c1 100644 (file)
@@ -210,7 +210,7 @@ AcpiExResolveObjectToValue (
                 /* If method call or CopyObject - do not dereference */
 
                 if ((WalkState->Opcode == AML_INT_METHODCALL_OP) ||
-                    (WalkState->Opcode == AML_COPY_OP))
+                    (WalkState->Opcode == AML_COPY_OBJECT_OP))
                 {
                     break;
                 }
index b9a8906..cc3074b 100644 (file)
@@ -435,7 +435,7 @@ AcpiExStoreObjectToNode (
 
     /* Only limited target types possible for everything except CopyObject */
 
-    if (WalkState->Opcode != AML_COPY_OP)
+    if (WalkState->Opcode != AML_COPY_OBJECT_OP)
     {
         /*
          * Only CopyObject allows all object types to be overwritten. For
@@ -521,7 +521,7 @@ AcpiExStoreObjectToNode (
     case ACPI_TYPE_STRING:
     case ACPI_TYPE_BUFFER:
 
-        if ((WalkState->Opcode == AML_COPY_OP) ||
+        if ((WalkState->Opcode == AML_COPY_OBJECT_OP) ||
             !ImplicitConversion)
         {
             /*
index 88c2eac..d930ed4 100644 (file)
@@ -113,7 +113,7 @@ AcpiExResolveObject (
 
         /* For CopyObject, no further validation necessary */
 
-        if (WalkState->Opcode == AML_COPY_OP)
+        if (WalkState->Opcode == AML_COPY_OBJECT_OP)
         {
             break;
         }
index e961258..8fce29b 100644 (file)
@@ -107,7 +107,7 @@ static const ACPI_PORT_INFO     AcpiProtectedPorts[] =
     {"PCI",     0x0CF8, 0x0CFF, ACPI_OSI_WIN_XP}
 };
 
-#define ACPI_PORT_INFO_ENTRIES  ACPI_ARRAY_LENGTH (AcpiProtectedPorts)
+#define ACPI_PORT_INFO_ENTRIES      ACPI_ARRAY_LENGTH (AcpiProtectedPorts)
 
 
 /******************************************************************************
@@ -137,7 +137,7 @@ AcpiHwValidateIoRequest (
     const ACPI_PORT_INFO    *PortInfo;
 
 
-    ACPI_FUNCTION_TRACE (HwValidateIoRequest);
+    ACPI_FUNCTION_NAME (HwValidateIoRequest);
 
 
     /* Supported widths are 8/16/32 */
@@ -166,14 +166,14 @@ AcpiHwValidateIoRequest (
         ACPI_ERROR ((AE_INFO,
             "Illegal I/O port address/length above 64K: %8.8X%8.8X/0x%X",
             ACPI_FORMAT_UINT64 (Address), ByteWidth));
-        return_ACPI_STATUS (AE_LIMIT);
+        return (AE_LIMIT);
     }
 
     /* Exit if requested address is not within the protected port table */
 
     if (Address > AcpiProtectedPorts[ACPI_PORT_INFO_ENTRIES - 1].End)
     {
-        return_ACPI_STATUS (AE_OK);
+        return (AE_OK);
     }
 
     /* Check request against the list of protected I/O ports */
@@ -182,7 +182,7 @@ AcpiHwValidateIoRequest (
     {
         /*
          * Check if the requested address range will write to a reserved
-         * port. Four cases to consider:
+         * port. There are four cases to consider:
          *
          * 1) Address range is contained completely in the port address range
          * 2) Address range overlaps port range at the port range start
@@ -212,7 +212,7 @@ AcpiHwValidateIoRequest (
         }
     }
 
-    return_ACPI_STATUS (AE_OK);
+    return (AE_OK);
 }
 
 
@@ -221,7 +221,7 @@ AcpiHwValidateIoRequest (
  * FUNCTION:    AcpiHwReadPort
  *
  * PARAMETERS:  Address             Address of I/O port/register to read
- *              Value               Where value is placed
+ *              Value               Where value (data) is returned
  *              Width               Number of bits
  *
  * RETURN:      Status and value read from port
@@ -267,7 +267,7 @@ AcpiHwReadPort (
     /*
      * There has been a protection violation within the request. Fall
      * back to byte granularity port I/O and ignore the failing bytes.
-     * This provides Windows compatibility.
+     * This provides compatibility with other ACPI implementations.
      */
     for (i = 0, *Value = 0; i < Width; i += 8)
     {
@@ -341,7 +341,7 @@ AcpiHwWritePort (
     /*
      * There has been a protection violation within the request. Fall
      * back to byte granularity port I/O and ignore the failing bytes.
-     * This provides Windows compatibility.
+     * This provides compatibility with other ACPI implementations.
      */
     for (i = 0; i < Width; i += 8)
     {
index 5e1912e..a0e2270 100644 (file)
@@ -79,6 +79,7 @@
 #define ACPI_MAX_EXTPARSE_CACHE_DEPTH   96          /* Parse tree objects */
 #define ACPI_MAX_OBJECT_CACHE_DEPTH     96          /* Interpreter operand objects */
 #define ACPI_MAX_NAMESPACE_CACHE_DEPTH  96          /* Namespace objects */
+#define ACPI_MAX_COMMENT_CACHE_DEPTH    96          /* Comments for the -ca option */
 
 /*
  * Should the subsystem abort the loading of an ACPI table if the
diff --git a/reactos/drivers/bus/acpi/acpica/include/acconvert.h b/reactos/drivers/bus/acpi/acpica/include/acconvert.h
new file mode 100644 (file)
index 0000000..90a141a
--- /dev/null
@@ -0,0 +1,204 @@
+/******************************************************************************
+ *
+ * Module Name: acapps - common include for ACPI applications/tools
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2017, 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:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef _ACCONVERT
+#define _ACCONVERT
+
+/* Definitions for comment state */
+
+#define ASL_COMMENT_STANDARD    1
+#define ASLCOMMENT_INLINE       2
+#define ASL_COMMENT_OPEN_PAREN  3
+#define ASL_COMMENT_CLOSE_PAREN 4
+#define ASL_COMMENT_CLOSE_BRACE 5
+
+/* Definitions for comment print function*/
+
+#define AML_COMMENT_STANDARD    1
+#define AMLCOMMENT_INLINE       2
+#define AML_COMMENT_END_NODE    3
+#define AML_NAMECOMMENT         4
+#define AML_COMMENT_CLOSE_BRACE 5
+#define AML_COMMENT_ENDBLK      6
+#define AML_COMMENT_INCLUDE     7
+
+
+#ifdef ACPI_ASL_COMPILER
+/*
+ * cvcompiler
+ */
+void
+CvProcessComment (
+    ASL_COMMENT_STATE       CurrentState,
+    char                    *StringBuffer,
+    int                     c1);
+
+void
+CvProcessCommentType2 (
+    ASL_COMMENT_STATE       CurrentState,
+    char                    *StringBuffer);
+
+UINT32
+CvCalculateCommentLengths(
+   ACPI_PARSE_OBJECT        *Op);
+
+void
+CvProcessCommentState (
+    char                    input);
+
+char*
+CvAppendInlineComment (
+    char                    *InlineComment,
+    char                    *ToAdd);
+
+void
+CvAddToCommentList (
+    char*                   ToAdd);
+
+void
+CvPlaceComment (
+    UINT8                   Type,
+    char                    *CommentString);
+
+UINT32
+CvParseOpBlockType (
+    ACPI_PARSE_OBJECT       *Op);
+
+ACPI_COMMENT_NODE*
+CvCommentNodeCalloc (
+    void);
+
+void
+CgWriteAmlDefBlockComment (
+    ACPI_PARSE_OBJECT       *Op);
+
+void
+CgWriteOneAmlComment (
+    ACPI_PARSE_OBJECT       *Op,
+    char*                   CommentToPrint,
+    UINT8                   InputOption);
+
+void
+CgWriteAmlComment (
+    ACPI_PARSE_OBJECT       *Op);
+
+
+/*
+ * cvparser
+ */
+void
+CvInitFileTree (
+    ACPI_TABLE_HEADER       *Table,
+    UINT8                   *AmlStart,
+    UINT32                  AmlLength);
+
+void
+CvClearOpComments (
+    ACPI_PARSE_OBJECT       *Op);
+
+ACPI_FILE_NODE*
+CvFilenameExists (
+    char                    *Filename,
+    ACPI_FILE_NODE           *Head);
+
+void
+CvLabelFileNode (
+    ACPI_PARSE_OBJECT       *Op);
+
+void
+CvCaptureListComments (
+    ACPI_PARSE_STATE        *ParserState,
+    ACPI_COMMENT_NODE       *ListHead,
+    ACPI_COMMENT_NODE       *ListTail);
+
+void
+CvCaptureCommentsOnly (
+    ACPI_PARSE_STATE        *ParserState);
+
+void
+CvCaptureComments (
+    ACPI_WALK_STATE         *WalkState);
+
+void
+CvTransferComments (
+    ACPI_PARSE_OBJECT       *Op);
+
+/*
+ * cvdisasm
+ */
+void
+CvSwitchFiles (
+    UINT32                  level,
+    ACPI_PARSE_OBJECT       *op);
+
+BOOLEAN
+CvFileHasSwitched (
+    ACPI_PARSE_OBJECT       *Op);
+
+
+void
+CvCloseParenWriteComment (
+    ACPI_PARSE_OBJECT       *Op,
+    UINT32                  Level);
+
+void
+CvCloseBraceWriteComment (
+    ACPI_PARSE_OBJECT       *Op,
+    UINT32                  Level);
+
+void
+CvPrintOneCommentList (
+    ACPI_COMMENT_NODE       *CommentList,
+    UINT32                  Level);
+
+void
+CvPrintOneCommentType (
+    ACPI_PARSE_OBJECT       *Op,
+    UINT8                   CommentType,
+    char*                   EndStr,
+    UINT32                  Level);
+
+
+#endif
+
+#endif /* _ACCONVERT */
index 3c5851f..b9b03d3 100644 (file)
@@ -802,6 +802,11 @@ void
 AcpiDmEmitExternals (
     void);
 
+void
+AcpiDmEmitExternal (
+    ACPI_PARSE_OBJECT       *NameOp,
+    ACPI_PARSE_OBJECT       *TypeOp);
+
 void
 AcpiDmUnresolvedWarning (
     UINT8                   Type);
@@ -1097,4 +1102,13 @@ ACPI_STATUS
 AdDisplayStatistics (
     void);
 
+
+/*
+ * dmwalk
+ */
+UINT32
+AcpiDmBlockType (
+    ACPI_PARSE_OBJECT       *Op);
+
+
 #endif  /* __ACDISASM_H__ */
index d83825f..3dfbe42 100644 (file)
@@ -374,6 +374,50 @@ ACPI_GLOBAL (const char,                *AcpiGbl_PldShapeList[]);
 
 #endif
 
+/*
+ * Meant for the -ca option.
+ */
+ACPI_INIT_GLOBAL (char*,   AcpiGbl_CurrentInlineComment,     NULL);
+ACPI_INIT_GLOBAL (char*,   AcpiGbl_CurrentEndNodeComment,    NULL);
+ACPI_INIT_GLOBAL (char*,   AcpiGbl_CurrentOpenBraceComment,  NULL);
+ACPI_INIT_GLOBAL (char*,   AcpiGbl_CurrentCloseBraceComment, NULL);
+
+ACPI_INIT_GLOBAL (char*,   AcpiGbl_RootFilename, NULL);
+ACPI_INIT_GLOBAL (char*,   AcpiGbl_CurrentFilename, NULL);
+ACPI_INIT_GLOBAL (char*,   AcpiGbl_CurrentParentFilename, NULL);
+ACPI_INIT_GLOBAL (char*,   AcpiGbl_CurrentIncludeFilename, NULL);
+
+ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE,   *AcpiGbl_LastListHead, NULL);
+
+ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE,   *AcpiGbl_DefBlkCommentListHead, NULL);
+ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE,   *AcpiGbl_DefBlkCommentListTail, NULL);
+
+ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE,   *AcpiGbl_RegCommentListHead, NULL);
+ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE,   *AcpiGbl_RegCommentListTail, NULL);
+
+ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE,   *AcpiGbl_IncCommentListHead, NULL);
+ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE,   *AcpiGbl_IncCommentListTail, NULL);
+
+ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE,   *AcpiGbl_EndBlkCommentListHead, NULL);
+ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE,   *AcpiGbl_EndBlkCommentListTail, NULL);
+
+ACPI_INIT_GLOBAL (ACPI_COMMENT_ADDR_NODE,   *AcpiGbl_CommentAddrListHead, NULL);
+
+ACPI_INIT_GLOBAL (ACPI_PARSE_OBJECT,   *AcpiGbl_CurrentScope,     NULL);
+
+ACPI_INIT_GLOBAL (ACPI_FILE_NODE,      *AcpiGbl_FileTreeRoot, NULL);
+
+ACPI_GLOBAL (ACPI_CACHE_T *,            AcpiGbl_RegCommentCache);
+ACPI_GLOBAL (ACPI_CACHE_T *,            AcpiGbl_CommentAddrCache);
+ACPI_GLOBAL (ACPI_CACHE_T *,            AcpiGbl_FileCache);
+
+ACPI_INIT_GLOBAL (BOOLEAN, Gbl_CaptureComments, FALSE);
+
+ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DebugAslConversion, FALSE);
+ACPI_INIT_GLOBAL (ACPI_FILE, AcpiGbl_ConvDebugFile, NULL);
+
+ACPI_GLOBAL (char, AcpiGbl_TableSig[4]);
+
 /*****************************************************************************
  *
  * Application globals
index 3b5f779..47c5f8f 100644 (file)
@@ -54,7 +54,7 @@ typedef UINT32                          ACPI_MUTEX_HANDLE;
 
 /* Total number of aml opcodes defined */
 
-#define AML_NUM_OPCODES                 0x82
+#define AML_NUM_OPCODES                 0x83
 
 
 /* Forward declarations */
@@ -906,21 +906,55 @@ typedef union acpi_parse_value
 #define ACPI_DISASM_ONLY_MEMBERS(a)
 #endif
 
+#if defined(ACPI_ASL_COMPILER)
+#define ACPI_CONVERTER_ONLY_MEMBERS(a)  a;
+#else
+#define ACPI_CONVERTER_ONLY_MEMBERS(a)
+#endif
+
 #define ACPI_PARSE_COMMON \
-    union acpi_parse_object         *Parent;        /* Parent op */\
-    UINT8                           DescriptorType; /* To differentiate various internal objs */\
-    UINT8                           Flags;          /* Type of Op */\
-    UINT16                          AmlOpcode;      /* AML opcode */\
-    UINT8                           *Aml;           /* Address of declaration in AML */\
-    union acpi_parse_object         *Next;          /* Next op */\
-    ACPI_NAMESPACE_NODE             *Node;          /* For use by interpreter */\
-    ACPI_PARSE_VALUE                Value;          /* Value or args associated with the opcode */\
-    UINT8                           ArgListLength;  /* Number of elements in the arg list */\
-    ACPI_DISASM_ONLY_MEMBERS (\
-    UINT16                          DisasmFlags;    /* Used during AML disassembly */\
-    UINT8                           DisasmOpcode;   /* Subtype used for disassembly */\
-    char                            *OperatorSymbol;/* Used for C-style operator name strings */\
-    char                            AmlOpName[16])  /* Op name (debug only) */
+    union acpi_parse_object         *Parent;            /* Parent op */\
+    UINT8                           DescriptorType;     /* To differentiate various internal objs */\
+    UINT8                           Flags;              /* Type of Op */\
+    UINT16                          AmlOpcode;          /* AML opcode */\
+    UINT8                           *Aml;               /* Address of declaration in AML */\
+    union acpi_parse_object         *Next;              /* Next op */\
+    ACPI_NAMESPACE_NODE             *Node;              /* For use by interpreter */\
+    ACPI_PARSE_VALUE                Value;              /* Value or args associated with the opcode */\
+    UINT8                           ArgListLength;      /* Number of elements in the arg list */\
+     ACPI_DISASM_ONLY_MEMBERS (\
+    UINT16                          DisasmFlags;        /* Used during AML disassembly */\
+    UINT8                           DisasmOpcode;       /* Subtype used for disassembly */\
+    char                            *OperatorSymbol;    /* Used for C-style operator name strings */\
+    char                            AmlOpName[16])      /* Op name (debug only) */\
+     ACPI_CONVERTER_ONLY_MEMBERS (\
+    char                            *InlineComment;     /* Inline comment */\
+    char                            *EndNodeComment;    /* End of node comment */\
+    char                            *NameComment;       /* Comment associated with the first parameter of the name node */\
+    char                            *CloseBraceComment; /* Comments that come after } on the same as } */\
+    ACPI_COMMENT_NODE               *CommentList;       /* comments that appears before this node */\
+    ACPI_COMMENT_NODE               *EndBlkComment;     /* comments that at the end of a block but before ) or } */\
+    char                            *CvFilename;        /* Filename associated with this node. Used for ASL/ASL+ converter */\
+    char                            *CvParentFilename)  /* Parent filename associated with this node. Used for ASL/ASL+ converter */
+
+
+/* categories of comments */
+
+typedef enum
+{
+    STANDARD_COMMENT = 1,
+    INLINE_COMMENT,
+    ENDNODE_COMMENT,
+    OPENBRACE_COMMENT,
+    CLOSE_BRACE_COMMENT,
+    STD_DEFBLK_COMMENT,
+    END_DEFBLK_COMMENT,
+    FILENAME_COMMENT,
+    PARENTFILENAME_COMMENT,
+    ENDBLK_COMMENT,
+    INCLUDE_COMMENT
+
+} ASL_COMMENT_TYPES;
 
 
 /* Internal opcodes for DisasmOpcode field above */
@@ -937,9 +971,46 @@ typedef union acpi_parse_value
 #define ACPI_DASM_LNOT_SUFFIX           0x09        /* End  of a LNotEqual (etc.) pair of opcodes */
 #define ACPI_DASM_HID_STRING            0x0A        /* String is a _HID or _CID */
 #define ACPI_DASM_IGNORE_SINGLE         0x0B        /* Ignore the opcode but not it's children */
-#define ACPI_DASM_SWITCH_PREDICATE      0x0C        /* Object is a predicate for a Switch or Case block */
-#define ACPI_DASM_CASE                  0x0D        /* If/Else is a Case in a Switch/Case block */
-#define ACPI_DASM_DEFAULT               0x0E        /* Else is a Default in a Switch/Case block */
+#define ACPI_DASM_SWITCH                0x0C        /* While is a Switch */
+#define ACPI_DASM_SWITCH_PREDICATE      0x0D        /* Object is a predicate for a Switch or Case block */
+#define ACPI_DASM_CASE                  0x0E        /* If/Else is a Case in a Switch/Case block */
+#define ACPI_DASM_DEFAULT               0x0F        /* Else is a Default in a Switch/Case block */
+
+
+/*
+ * List struct used in the -ca option
+ */
+typedef struct acpi_comment_node
+{
+  char                      *Comment;
+  struct acpi_comment_node  *Next;
+
+} ACPI_COMMENT_NODE;
+
+
+typedef struct acpi_comment_addr_node
+{
+  UINT8                                    *Addr;
+  struct acpi_comment_addr_node            *Next;
+} ACPI_COMMENT_ADDR_NODE;
+
+/*
+ * File node - used for "Include" operator file stack and
+ * depdendency tree for the -ca option
+ */
+typedef struct acpi_file_node
+{
+    void                    *File;
+    char                    *Filename;
+    char                    *FileStart;  /* Points to AML and indicates when the AML for this particular file starts. */
+    char                    *FileEnd;    /* Points to AML and indicates when the AML for this particular file ends. */
+    struct acpi_file_node   *Next;
+    struct acpi_file_node   *Parent;
+    BOOLEAN                 IncludeWritten;
+    ACPI_COMMENT_NODE       *IncludeComment;
+
+} ACPI_FILE_NODE;
+
 
 /*
  * Generic operation (for example:  If, While, Store)
@@ -975,6 +1046,8 @@ typedef struct acpi_parse_obj_asl
     union acpi_parse_object         *Child;
     union acpi_parse_object         *ParentMethod;
     char                            *Filename;
+    BOOLEAN                         FileChanged;
+    char                            *ParentFilename;
     char                            *ExternalName;
     char                            *Namepath;
     char                            NameSeg[4];
@@ -1007,6 +1080,15 @@ typedef union acpi_parse_object
 
 } ACPI_PARSE_OBJECT;
 
+typedef struct asl_comment_state
+{
+    UINT8                   CommentType;
+    UINT32                  SpacesBefore;
+    ACPI_PARSE_OBJECT       *Latest_Parse_Node;
+    ACPI_PARSE_OBJECT       *ParsingParenBraceNode;
+    BOOLEAN                 CaptureComments;
+} ASL_COMMENT_STATE;
+
 
 /*
  * Parse state - one state per parser invocation and each control
index 0e6dee6..f9d9dac 100644 (file)
 #define ACPI_IS_OCTAL_DIGIT(d)              (((char)(d) >= '0') && ((char)(d) <= '7'))
 
 
+/*
+ * Macors used for the ASL-/ASL+ converter utility
+ */
+#ifdef ACPI_ASL_COMPILER
+
+#define ASL_CV_LABEL_FILENODE(a)         CvLabelFileNode(a);
+#define ASL_CV_CAPTURE_COMMENTS_ONLY(a)   CvCaptureCommentsOnly (a);
+#define ASL_CV_CAPTURE_COMMENTS(a)       CvCaptureComments (a);
+#define ASL_CV_TRANSFER_COMMENTS(a)      CvTransferComments (a);
+#define ASL_CV_CLOSE_PAREN(a,b)          CvCloseParenWriteComment(a,b);
+#define ASL_CV_CLOSE_BRACE(a,b)          CvCloseBraceWriteComment(a,b);
+#define ASL_CV_SWITCH_FILES(a,b)         CvSwitchFiles(a,b);
+#define ASL_CV_CLEAR_OP_COMMENTS(a)       CvClearOpComments(a);
+#define ASL_CV_PRINT_ONE_COMMENT(a,b,c,d) CvPrintOneCommentType (a,b,c,d);
+#define ASL_CV_PRINT_ONE_COMMENT_LIST(a,b) CvPrintOneCommentList (a,b);
+#define ASL_CV_FILE_HAS_SWITCHED(a)       CvFileHasSwitched(a)
+#define ASL_CV_INIT_FILETREE(a,b,c)      CvInitFileTree(a,b,c);
+
+#else
+
+#define ASL_CV_LABEL_FILENODE(a)
+#define ASL_CV_CAPTURE_COMMENTS_ONLY(a)
+#define ASL_CV_CAPTURE_COMMENTS(a)
+#define ASL_CV_TRANSFER_COMMENTS(a)
+#define ASL_CV_CLOSE_PAREN(a,b)          AcpiOsPrintf (")");
+#define ASL_CV_CLOSE_BRACE(a,b)          AcpiOsPrintf ("}");
+#define ASL_CV_SWITCH_FILES(a,b)
+#define ASL_CV_CLEAR_OP_COMMENTS(a)
+#define ASL_CV_PRINT_ONE_COMMENT(a,b,c,d)
+#define ASL_CV_PRINT_ONE_COMMENT_LIST(a,b)
+#define ASL_CV_FILE_HAS_SWITCHED(a)       0
+#define ASL_CV_INIT_FILETREE(a,b,c)
+
+#endif
+
 #endif /* ACMACROS_H */
index ce4e420..336d146 100644 (file)
@@ -91,6 +91,7 @@
 #define ARGP_BUFFER_OP                  ARGP_LIST3 (ARGP_PKGLENGTH,  ARGP_TERMARG,       ARGP_BYTELIST)
 #define ARGP_BYTE_OP                    ARGP_LIST1 (ARGP_BYTEDATA)
 #define ARGP_BYTELIST_OP                ARGP_LIST1 (ARGP_NAMESTRING)
+#define ARGP_COMMENT_OP                 ARGP_LIST2 (ARGP_BYTEDATA,   ARGP_COMMENT)
 #define ARGP_CONCAT_OP                  ARGP_LIST3 (ARGP_TERMARG,    ARGP_TERMARG,       ARGP_TARGET)
 #define ARGP_CONCAT_RES_OP              ARGP_LIST3 (ARGP_TERMARG,    ARGP_TERMARG,       ARGP_TARGET)
 #define ARGP_COND_REF_OF_OP             ARGP_LIST2 (ARGP_SIMPLENAME, ARGP_TARGET)
 #define ARGI_BUFFER_OP                  ARGI_LIST1 (ARGI_INTEGER)
 #define ARGI_BYTE_OP                    ARGI_INVALID_OPCODE
 #define ARGI_BYTELIST_OP                ARGI_INVALID_OPCODE
+#define ARGI_COMMENT_OP                 ARGI_INVALID_OPCODE
 #define ARGI_CONCAT_OP                  ARGI_LIST3 (ARGI_ANYTYPE,    ARGI_ANYTYPE,       ARGI_TARGETREF)
 #define ARGI_CONCAT_RES_OP              ARGI_LIST3 (ARGI_BUFFER,     ARGI_BUFFER,        ARGI_TARGETREF)
 #define ARGI_COND_REF_OF_OP             ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF)
index 8b1ea4f..60ea725 100644 (file)
@@ -46,7 +46,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20170119
+#define ACPI_CA_VERSION                 0x20170303
 
 #include "acconfig.h"
 #include "actypes.h"
index 86d3a43..51aafc0 100644 (file)
@@ -89,6 +89,7 @@
 #define ACPI_SIG_WDAT           "WDAT"      /* Watchdog Action Table */
 #define ACPI_SIG_WDDT           "WDDT"      /* Watchdog Timer Description Table */
 #define ACPI_SIG_WDRT           "WDRT"      /* Watchdog Resource Table */
+#define ACPI_SIG_XXXX           "XXXX"      /* Intermediate AML header for ASL/ASL+ converter */
 
 #ifdef ACPI_UNDEFINED_TABLES
 /*
@@ -909,6 +910,16 @@ typedef struct acpi_iort_smmu
 #define ACPI_IORT_SMMU_DVM_SUPPORTED    (1)
 #define ACPI_IORT_SMMU_COHERENT_WALK    (1<<1)
 
+/* Global interrupt format */
+
+typedef struct acpi_iort_smmu_gsi
+{
+    UINT32                  NSgIrpt;
+    UINT32                  NSgIrptFlags;
+    UINT32                  NSgCfgIrpt;
+    UINT32                  NSgCfgIrptFlags;
+} ACPI_IORT_SMMU_GSI;
+
 
 typedef struct acpi_iort_smmu_v3
 {
index 401dfc3..ed70466 100644 (file)
 
 /* primary opcodes */
 
-#define AML_NULL_CHAR               (UINT16) 0x00
-
 #define AML_ZERO_OP                 (UINT16) 0x00
 #define AML_ONE_OP                  (UINT16) 0x01
-#define AML_UNASSIGNED              (UINT16) 0x02
 #define AML_ALIAS_OP                (UINT16) 0x06
 #define AML_NAME_OP                 (UINT16) 0x08
 #define AML_BYTE_OP                 (UINT16) 0x0a
 #define AML_SCOPE_OP                (UINT16) 0x10
 #define AML_BUFFER_OP               (UINT16) 0x11
 #define AML_PACKAGE_OP              (UINT16) 0x12
-#define AML_VAR_PACKAGE_OP          (UINT16) 0x13     /* ACPI 2.0 */
+#define AML_VARIABLE_PACKAGE_OP     (UINT16) 0x13     /* ACPI 2.0 */
 #define AML_METHOD_OP               (UINT16) 0x14
 #define AML_EXTERNAL_OP             (UINT16) 0x15     /* ACPI 6.0 */
 #define AML_DUAL_NAME_PREFIX        (UINT16) 0x2e
-#define AML_MULTI_NAME_PREFIX_OP    (UINT16) 0x2f
-#define AML_NAME_CHAR_SUBSEQ        (UINT16) 0x30
-#define AML_NAME_CHAR_FIRST         (UINT16) 0x41
-#define AML_EXTENDED_OP_PREFIX      (UINT16) 0x5b
+#define AML_MULTI_NAME_PREFIX       (UINT16) 0x2f
+#define AML_EXTENDED_PREFIX         (UINT16) 0x5b
 #define AML_ROOT_PREFIX             (UINT16) 0x5c
 #define AML_PARENT_PREFIX           (UINT16) 0x5e
-#define AML_LOCAL_OP                (UINT16) 0x60
+#define AML_FIRST_LOCAL_OP          (UINT16) 0x60     /* Used for Local op # calculations */
 #define AML_LOCAL0                  (UINT16) 0x60
 #define AML_LOCAL1                  (UINT16) 0x61
 #define AML_LOCAL2                  (UINT16) 0x62
@@ -82,7 +77,7 @@
 #define AML_LOCAL5                  (UINT16) 0x65
 #define AML_LOCAL6                  (UINT16) 0x66
 #define AML_LOCAL7                  (UINT16) 0x67
-#define AML_ARG_OP                  (UINT16) 0x68
+#define AML_FIRST_ARG_OP            (UINT16) 0x68     /* Used for Arg op # calculations */
 #define AML_ARG0                    (UINT16) 0x68
 #define AML_ARG1                    (UINT16) 0x69
 #define AML_ARG2                    (UINT16) 0x6a
@@ -93,7 +88,7 @@
 #define AML_STORE_OP                (UINT16) 0x70
 #define AML_REF_OF_OP               (UINT16) 0x71
 #define AML_ADD_OP                  (UINT16) 0x72
-#define AML_CONCAT_OP               (UINT16) 0x73
+#define AML_CONCATENATE_OP          (UINT16) 0x73
 #define AML_SUBTRACT_OP             (UINT16) 0x74
 #define AML_INCREMENT_OP            (UINT16) 0x75
 #define AML_DECREMENT_OP            (UINT16) 0x76
 #define AML_FIND_SET_LEFT_BIT_OP    (UINT16) 0x81
 #define AML_FIND_SET_RIGHT_BIT_OP   (UINT16) 0x82
 #define AML_DEREF_OF_OP             (UINT16) 0x83
-#define AML_CONCAT_RES_OP           (UINT16) 0x84     /* ACPI 2.0 */
+#define AML_CONCATENATE_TEMPLATE_OP (UINT16) 0x84     /* ACPI 2.0 */
 #define AML_MOD_OP                  (UINT16) 0x85     /* ACPI 2.0 */
 #define AML_NOTIFY_OP               (UINT16) 0x86
 #define AML_SIZE_OF_OP              (UINT16) 0x87
 #define AML_CREATE_BIT_FIELD_OP     (UINT16) 0x8d
 #define AML_OBJECT_TYPE_OP          (UINT16) 0x8e
 #define AML_CREATE_QWORD_FIELD_OP   (UINT16) 0x8f     /* ACPI 2.0 */
-#define AML_LAND_OP                 (UINT16) 0x90
-#define AML_LOR_OP                  (UINT16) 0x91
-#define AML_LNOT_OP                 (UINT16) 0x92
-#define AML_LEQUAL_OP               (UINT16) 0x93
-#define AML_LGREATER_OP             (UINT16) 0x94
-#define AML_LLESS_OP                (UINT16) 0x95
+#define AML_LOGICAL_AND_OP          (UINT16) 0x90
+#define AML_LOGICAL_OR_OP           (UINT16) 0x91
+#define AML_LOGICAL_NOT_OP          (UINT16) 0x92
+#define AML_LOGICAL_EQUAL_OP        (UINT16) 0x93
+#define AML_LOGICAL_GREATER_OP      (UINT16) 0x94
+#define AML_LOGICAL_LESS_OP         (UINT16) 0x95
 #define AML_TO_BUFFER_OP            (UINT16) 0x96     /* ACPI 2.0 */
-#define AML_TO_DECSTRING_OP         (UINT16) 0x97     /* ACPI 2.0 */
-#define AML_TO_HEXSTRING_OP         (UINT16) 0x98     /* ACPI 2.0 */
+#define AML_TO_DECIMAL_STRING_OP    (UINT16) 0x97     /* ACPI 2.0 */
+#define AML_TO_HEX_STRING_OP        (UINT16) 0x98     /* ACPI 2.0 */
 #define AML_TO_INTEGER_OP           (UINT16) 0x99     /* ACPI 2.0 */
 #define AML_TO_STRING_OP            (UINT16) 0x9c     /* ACPI 2.0 */
-#define AML_COPY_OP                 (UINT16) 0x9d     /* ACPI 2.0 */
+#define AML_COPY_OBJECT_OP          (UINT16) 0x9d     /* ACPI 2.0 */
 #define AML_MID_OP                  (UINT16) 0x9e     /* ACPI 2.0 */
 #define AML_CONTINUE_OP             (UINT16) 0x9f     /* ACPI 2.0 */
 #define AML_IF_OP                   (UINT16) 0xa0
 #define AML_NOOP_OP                 (UINT16) 0xa3
 #define AML_RETURN_OP               (UINT16) 0xa4
 #define AML_BREAK_OP                (UINT16) 0xa5
-#define AML_BREAK_POINT_OP          (UINT16) 0xcc
+#define AML_COMMENT_OP              (UINT16) 0xa9
+#define AML_BREAKPOINT_OP          (UINT16) 0xcc
 #define AML_ONES_OP                 (UINT16) 0xff
 
-/* prefixed opcodes */
 
-#define AML_EXTENDED_OPCODE         (UINT16) 0x5b00     /* prefix for 2-byte opcodes */
+/*
+ * Combination opcodes (actually two one-byte opcodes)
+ * Used by the disassembler and iASL compiler
+ */
+#define AML_LOGICAL_GREATER_EQUAL_OP (UINT16) 0x9295    /* LNot (LLess) */
+#define AML_LOGICAL_LESS_EQUAL_OP    (UINT16) 0x9294    /* LNot (LGreater) */
+#define AML_LOGICAL_NOT_EQUAL_OP     (UINT16) 0x9293    /* LNot (LEqual) */
+
+
+/* Prefixed (2-byte) opcodes (with AML_EXTENDED_PREFIX) */
+
+#define AML_EXTENDED_OPCODE         (UINT16) 0x5b00     /* Prefix for 2-byte opcodes */
 
 #define AML_MUTEX_OP                (UINT16) 0x5b01
 #define AML_EVENT_OP                (UINT16) 0x5b02
-#define AML_SHIFT_RIGHT_BIT_OP      (UINT16) 0x5b10
-#define AML_SHIFT_LEFT_BIT_OP       (UINT16) 0x5b11
-#define AML_COND_REF_OF_OP          (UINT16) 0x5b12
+#define AML_SHIFT_RIGHT_BIT_OP      (UINT16) 0x5b10     /* Obsolete, not in ACPI spec */
+#define AML_SHIFT_LEFT_BIT_OP       (UINT16) 0x5b11     /* Obsolete, not in ACPI spec */
+#define AML_CONDITIONAL_REF_OF_OP   (UINT16) 0x5b12
 #define AML_CREATE_FIELD_OP         (UINT16) 0x5b13
 #define AML_LOAD_TABLE_OP           (UINT16) 0x5b1f     /* ACPI 2.0 */
 #define AML_LOAD_OP                 (UINT16) 0x5b20
 #define AML_FIELD_OP                (UINT16) 0x5b81
 #define AML_DEVICE_OP               (UINT16) 0x5b82
 #define AML_PROCESSOR_OP            (UINT16) 0x5b83
-#define AML_POWER_RES_OP            (UINT16) 0x5b84
+#define AML_POWER_RESOURCE_OP       (UINT16) 0x5b84
 #define AML_THERMAL_ZONE_OP         (UINT16) 0x5b85
 #define AML_INDEX_FIELD_OP          (UINT16) 0x5b86
 #define AML_BANK_FIELD_OP           (UINT16) 0x5b87
 #define AML_DATA_REGION_OP          (UINT16) 0x5b88     /* ACPI 2.0 */
 
 
-/*
- * Combination opcodes (actually two one-byte opcodes)
- * Used by the disassembler and iASL compiler
- */
-#define AML_LGREATEREQUAL_OP        (UINT16) 0x9295
-#define AML_LLESSEQUAL_OP           (UINT16) 0x9294
-#define AML_LNOTEQUAL_OP            (UINT16) 0x9293
-
-
 /*
  * Opcodes for "Field" operators
  */
 #define ARGP_SIMPLENAME             0x12 /* NameString | LocalTerm | ArgTerm */
 #define ARGP_NAME_OR_REF            0x13 /* For ObjectType only */
 #define ARGP_MAX                    0x13
+#define ARGP_COMMENT                0x14
 
 /*
  * Resolved argument types for the AML Interpreter
 
 
 /*
- * hash offsets
- */
-#define AML_EXTOP_HASH_OFFSET       22
-#define AML_LNOT_HASH_OFFSET        19
-
-
-/*
- * opcode groups and types
+ * Some of the flags and types below are of the form:
+ *
+ * AML_FLAGS_EXEC_#A_#T,#R, or
+ * AML_TYPE_EXEC_#A_#T,#R where:
+ *
+ *      #A is the number of required arguments
+ *      #T is the number of target operands
+ *      #R indicates whether there is a return value
  */
-#define OPGRP_NAMED                 0x01
-#define OPGRP_FIELD                 0x02
-#define OPGRP_BYTELIST              0x04
-
 
 /*
- * Opcode information
+ * Opcode information flags
  */
-
-/* Opcode flags */
-
 #define AML_LOGICAL                 0x0001
 #define AML_LOGICAL_NUMERIC         0x0002
 #define AML_MATH                    0x0004
 #define AML_CONSTANT                0x2000
 #define AML_NO_OPERAND_RESOLVE      0x4000
 
-/* Convenient flag groupings */
+/* Convenient flag groupings of the flags above */
 
 #define AML_FLAGS_EXEC_0A_0T_1R                                     AML_HAS_RETVAL
 #define AML_FLAGS_EXEC_1A_0T_0R     AML_HAS_ARGS                                   /* Monadic1  */
 
 /*
  * The opcode Type is used in a dispatch table, do not change
- * without updating the table.
+ * or add anything new without updating the table.
  */
 #define AML_TYPE_EXEC_0A_0T_1R      0x00
 #define AML_TYPE_EXEC_1A_0T_0R      0x01 /* Monadic1  */
 
 #define AML_TYPE_METHOD_CALL        0x10
 
-/* Misc */
+/* Miscellaneous types */
 
 #define AML_TYPE_CREATE_FIELD       0x11
 #define AML_TYPE_CREATE_OBJECT      0x12
 #define AML_TYPE_NAMED_SIMPLE       0x16
 #define AML_TYPE_NAMED_COMPLEX      0x17
 #define AML_TYPE_RETURN             0x18
-
 #define AML_TYPE_UNDEFINED          0x19
 #define AML_TYPE_BOGUS              0x1A
 
index 2dd55c4..7b5715b 100644 (file)
@@ -505,7 +505,7 @@ AcpiNsLookup (
                 "Dual Pathname (2 segments, Flags=%X)\n", Flags));
             break;
 
-        case AML_MULTI_NAME_PREFIX_OP:
+        case AML_MULTI_NAME_PREFIX:
 
             /* More than one NameSeg, search rules do not apply */
 
index 96dd885..59957e4 100644 (file)
@@ -302,24 +302,12 @@ ObjectRepaired:
 
     if (PackageIndex != ACPI_NOT_PACKAGE_ELEMENT)
     {
-        /*
-         * The original object is a package element. We need to
-         * decrement the reference count of the original object,
-         * for removing it from the package.
-         *
-         * However, if the original object was just wrapped with a
-         * package object as part of the repair, we don't need to
-         * change the reference count.
-         */
+        /* Update reference count of new object */
+
         if (!(Info->ReturnFlags & ACPI_OBJECT_WRAPPED))
         {
             NewObject->Common.ReferenceCount =
                 ReturnObject->Common.ReferenceCount;
-
-            if (ReturnObject->Common.ReferenceCount > 1)
-            {
-                ReturnObject->Common.ReferenceCount--;
-            }
         }
 
         ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
index fe8b763..22ac870 100644 (file)
@@ -448,16 +448,12 @@ AcpiNsRepair_CID (
             return (Status);
         }
 
-        /* Take care with reference counts */
-
         if (OriginalElement != *ElementPtr)
         {
-            /* Element was replaced */
+            /* Update reference count of new object */
 
             (*ElementPtr)->Common.ReferenceCount =
                 OriginalRefCount;
-
-            AcpiUtRemoveReference (OriginalElement);
         }
 
         ElementPtr++;
index 3664cbe..652b19c 100644 (file)
@@ -294,7 +294,7 @@ AcpiNsBuildInternalName (
         }
         else
         {
-            InternalName[1] = AML_MULTI_NAME_PREFIX_OP;
+            InternalName[1] = AML_MULTI_NAME_PREFIX;
             InternalName[2] = (char) NumSegments;
             Result = &InternalName[3];
         }
@@ -325,7 +325,7 @@ AcpiNsBuildInternalName (
         }
         else
         {
-            InternalName[i] = AML_MULTI_NAME_PREFIX_OP;
+            InternalName[i] = AML_MULTI_NAME_PREFIX;
             InternalName[(ACPI_SIZE) i+1] = (char) NumSegments;
             Result = &InternalName[(ACPI_SIZE) i+2];
         }
@@ -534,7 +534,7 @@ AcpiNsExternalizeName (
     {
         switch (InternalName[PrefixLength])
         {
-        case AML_MULTI_NAME_PREFIX_OP:
+        case AML_MULTI_NAME_PREFIX:
 
             /* <count> 4-byte names */
 
@@ -694,28 +694,23 @@ AcpiNsTerminate (
     void)
 {
     ACPI_STATUS             Status;
+    ACPI_OPERAND_OBJECT     *Prev;
+    ACPI_OPERAND_OBJECT     *Next;
 
 
     ACPI_FUNCTION_TRACE (NsTerminate);
 
 
-#ifdef ACPI_EXEC_APP
-    {
-        ACPI_OPERAND_OBJECT     *Prev;
-        ACPI_OPERAND_OBJECT     *Next;
-
-        /* Delete any module-level code blocks */
+    /* Delete any module-level code blocks */
 
-        Next = AcpiGbl_ModuleCodeList;
-        while (Next)
-        {
-            Prev = Next;
-            Next = Next->Method.Mutex;
-            Prev->Method.Mutex = NULL; /* Clear the Mutex (cheated) field */
-            AcpiUtRemoveReference (Prev);
-        }
+    Next = AcpiGbl_ModuleCodeList;
+    while (Next)
+    {
+        Prev = Next;
+        Next = Next->Method.Mutex;
+        Prev->Method.Mutex = NULL; /* Clear the Mutex (cheated) field */
+        AcpiUtRemoveReference (Prev);
     }
-#endif
 
     /*
      * Free the entire namespace -- all nodes and all objects
index 22f7a29..4fc55b2 100644 (file)
@@ -47,6 +47,7 @@
 #include "amlcode.h"
 #include "acnamesp.h"
 #include "acdispat.h"
+#include "acconvert.h"
 
 #define _COMPONENT          ACPI_PARSER
         ACPI_MODULE_NAME    ("psargs")
@@ -208,7 +209,7 @@ AcpiPsGetNextNamestring (
         End += 1 + (2 * ACPI_NAME_SIZE);
         break;
 
-    case AML_MULTI_NAME_PREFIX_OP:
+    case AML_MULTI_NAME_PREFIX:
 
         /* Multiple name segments, 4 chars each, count in next byte */
 
@@ -369,7 +370,7 @@ AcpiPsGetNextNamepath (
 
         /* 2) NotFound during a CondRefOf(x) is ok by definition */
 
-        else if (WalkState->Op->Common.AmlOpcode == AML_COND_REF_OF_OP)
+        else if (WalkState->Op->Common.AmlOpcode == AML_CONDITIONAL_REF_OF_OP)
         {
             Status = AE_OK;
         }
@@ -381,7 +382,7 @@ AcpiPsGetNextNamepath (
          */
         else if ((Arg->Common.Parent) &&
             ((Arg->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
-             (Arg->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP)))
+             (Arg->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP)))
         {
             Status = AE_OK;
         }
@@ -543,6 +544,7 @@ AcpiPsGetNextField (
     ACPI_FUNCTION_TRACE (PsGetNextField);
 
 
+    ASL_CV_CAPTURE_COMMENTS_ONLY (ParserState);
     Aml = ParserState->Aml;
 
     /* Determine field type */
@@ -589,6 +591,7 @@ AcpiPsGetNextField (
 
     /* Decode the field type */
 
+    ASL_CV_CAPTURE_COMMENTS_ONLY (ParserState);
     switch (Opcode)
     {
     case AML_INT_NAMEDFIELD_OP:
@@ -599,6 +602,23 @@ AcpiPsGetNextField (
         AcpiPsSetName (Field, Name);
         ParserState->Aml += ACPI_NAME_SIZE;
 
+
+        ASL_CV_CAPTURE_COMMENTS_ONLY (ParserState);
+
+#ifdef ACPI_ASL_COMPILER
+        /*
+         * Because the package length isn't represented as a parse tree object,
+         * take comments surrounding this and add to the previously created
+         * parse node.
+         */
+        if (Field->Common.InlineComment)
+        {
+            Field->Common.NameComment = Field->Common.InlineComment;
+        }
+        Field->Common.InlineComment  = AcpiGbl_CurrentInlineComment;
+        AcpiGbl_CurrentInlineComment = NULL;
+#endif
+
         /* Get the length which is encoded as a package length */
 
         Field->Common.Value.Size = AcpiPsGetNextPackageLength (ParserState);
@@ -655,10 +675,12 @@ AcpiPsGetNextField (
         {
             ParserState->Aml++;
 
+            ASL_CV_CAPTURE_COMMENTS_ONLY (ParserState);
             PkgEnd = ParserState->Aml;
             PkgLength = AcpiPsGetNextPackageLength (ParserState);
             PkgEnd += PkgLength;
 
+            ASL_CV_CAPTURE_COMMENTS_ONLY (ParserState);
             if (ParserState->Aml < PkgEnd)
             {
                 /* Non-empty list */
@@ -675,6 +697,7 @@ AcpiPsGetNextField (
                 Opcode = ACPI_GET8 (ParserState->Aml);
                 ParserState->Aml++;
 
+                ASL_CV_CAPTURE_COMMENTS_ONLY (ParserState);
                 switch (Opcode)
                 {
                 case AML_BYTE_OP:       /* AML_BYTEDATA_ARG */
@@ -703,6 +726,7 @@ AcpiPsGetNextField (
 
                 /* Fill in bytelist data */
 
+                ASL_CV_CAPTURE_COMMENTS_ONLY (ParserState);
                 Arg->Named.Value.Size = BufferLength;
                 Arg->Named.Data = ParserState->Aml;
             }
index be5b260..9ff8bcf 100644 (file)
@@ -55,6 +55,7 @@
 #include "acparser.h"
 #include "acdispat.h"
 #include "amlcode.h"
+#include "acconvert.h"
 
 #define _COMPONENT          ACPI_PARSER
         ACPI_MODULE_NAME    ("psloop")
@@ -142,6 +143,22 @@ AcpiPsGetArguments (
         {
             WalkState->Aml = WalkState->ParserState.Aml;
 
+            switch (Op->Common.AmlOpcode)
+            {
+            case AML_METHOD_OP:
+            case AML_BUFFER_OP:
+            case AML_PACKAGE_OP:
+            case AML_VARIABLE_PACKAGE_OP:
+            case AML_WHILE_OP:
+
+                break;
+
+            default:
+
+                ASL_CV_CAPTURE_COMMENTS (WalkState);
+                break;
+            }
+
             Status = AcpiPsGetNextArg (WalkState, &(WalkState->ParserState),
                 GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg);
             if (ACPI_FAILURE (Status))
@@ -249,7 +266,7 @@ AcpiPsGetArguments (
 
         case AML_BUFFER_OP:
         case AML_PACKAGE_OP:
-        case AML_VAR_PACKAGE_OP:
+        case AML_VARIABLE_PACKAGE_OP:
 
             if ((Op->Common.Parent) &&
                 (Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) &&
@@ -487,6 +504,8 @@ AcpiPsParseLoop (
 
     while ((ParserState->Aml < ParserState->AmlEnd) || (Op))
     {
+        ASL_CV_CAPTURE_COMMENTS (WalkState);
+
         AmlOpStart = ParserState->Aml;
         if (!Op)
         {
@@ -520,12 +539,26 @@ AcpiPsParseLoop (
             AcpiExStartTraceOpcode (Op, WalkState);
         }
 
-
         /*
          * Start ArgCount at zero because we don't know if there are
          * any args yet
          */
-        WalkState->ArgCount  = 0;
+        WalkState->ArgCount = 0;
+
+        switch (Op->Common.AmlOpcode)
+        {
+        case AML_BYTE_OP:
+        case AML_WORD_OP:
+        case AML_DWORD_OP:
+        case AML_QWORD_OP:
+
+            break;
+
+        default:
+
+            ASL_CV_CAPTURE_COMMENTS (WalkState);
+            break;
+        }
 
         /* Are there any arguments that must be processed? */
 
index 7f1a086..bcc2aa2 100644 (file)
@@ -45,6 +45,7 @@
 #include "accommon.h"
 #include "acparser.h"
 #include "amlcode.h"
+#include "acconvert.h"
 
 #define _COMPONENT          ACPI_PARSER
         ACPI_MODULE_NAME    ("psobject")
@@ -201,6 +202,7 @@ AcpiPsBuildNamedOp (
     while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) &&
           (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) != ARGP_NAME))
     {
+        ASL_CV_CAPTURE_COMMENTS (WalkState);
         Status = AcpiPsGetNextArg (WalkState, &(WalkState->ParserState),
             GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg);
         if (ACPI_FAILURE (Status))
@@ -212,6 +214,18 @@ AcpiPsBuildNamedOp (
         INCREMENT_ARG_LIST (WalkState->ArgTypes);
     }
 
+    /* are there any inline comments associated with the NameSeg?? If so, save this. */
+
+    ASL_CV_CAPTURE_COMMENTS (WalkState);
+
+#ifdef ACPI_ASL_COMPILER
+    if (AcpiGbl_CurrentInlineComment != NULL)
+    {
+        UnnamedOp->Common.NameComment = AcpiGbl_CurrentInlineComment;
+        AcpiGbl_CurrentInlineComment = NULL;
+    }
+#endif
+
     /*
      * Make sure that we found a NAME and didn't run out of arguments
      */
@@ -257,6 +271,28 @@ AcpiPsBuildNamedOp (
 
     AcpiPsAppendArg (*Op, UnnamedOp->Common.Value.Arg);
 
+#ifdef ACPI_ASL_COMPILER
+
+    /* save any comments that might be associated with UnnamedOp. */
+
+    (*Op)->Common.InlineComment     = UnnamedOp->Common.InlineComment;
+    (*Op)->Common.EndNodeComment    = UnnamedOp->Common.EndNodeComment;
+    (*Op)->Common.CloseBraceComment = UnnamedOp->Common.CloseBraceComment;
+    (*Op)->Common.NameComment       = UnnamedOp->Common.NameComment;
+    (*Op)->Common.CommentList       = UnnamedOp->Common.CommentList;
+    (*Op)->Common.EndBlkComment     = UnnamedOp->Common.EndBlkComment;
+    (*Op)->Common.CvFilename        = UnnamedOp->Common.CvFilename;
+    (*Op)->Common.CvParentFilename  = UnnamedOp->Common.CvParentFilename;
+    (*Op)->Named.Aml                = UnnamedOp->Common.Aml;
+
+    UnnamedOp->Common.InlineComment     = NULL;
+    UnnamedOp->Common.EndNodeComment    = NULL;
+    UnnamedOp->Common.CloseBraceComment = NULL;
+    UnnamedOp->Common.NameComment       = NULL;
+    UnnamedOp->Common.CommentList       = NULL;
+    UnnamedOp->Common.EndBlkComment     = NULL;
+#endif
+
     if ((*Op)->Common.AmlOpcode == AML_REGION_OP ||
         (*Op)->Common.AmlOpcode == AML_DATA_REGION_OP)
     {
index 968d7db..c355c3d 100644 (file)
@@ -72,7 +72,7 @@
     AML_DEVICE_OP
     AML_THERMAL_ZONE_OP
     AML_METHOD_OP
-    AML_POWER_RES_OP
+    AML_POWER_RESOURCE_OP
     AML_PROCESSOR_OP
     AML_FIELD_OP
     AML_INDEX_FIELD_OP
@@ -98,7 +98,7 @@
     AML_DEVICE_OP
     AML_THERMAL_ZONE_OP
     AML_METHOD_OP
-    AML_POWER_RES_OP
+    AML_POWER_RESOURCE_OP
     AML_PROCESSOR_OP
     AML_FIELD_OP
     AML_INDEX_FIELD_OP
     AML_DEVICE_OP
     AML_THERMAL_ZONE_OP
     AML_METHOD_OP
-    AML_POWER_RES_OP
+    AML_POWER_RESOURCE_OP
     AML_PROCESSOR_OP
     AML_NAME_OP
     AML_ALIAS_OP
     AML_DEVICE_OP
     AML_THERMAL_ZONE_OP
     AML_METHOD_OP
-    AML_POWER_RES_OP
+    AML_POWER_RESOURCE_OP
     AML_PROCESSOR_OP
     AML_NAME_OP
     AML_ALIAS_OP
   must be deferred until needed
 
     AML_METHOD_OP
-    AML_VAR_PACKAGE_OP
+    AML_VARIABLE_PACKAGE_OP
     AML_CREATE_FIELD_OP
     AML_CREATE_BIT_FIELD_OP
     AML_CREATE_BYTE_FIELD_OP
@@ -337,7 +337,8 @@ const ACPI_OPCODE_INFO    AcpiGbl_AmlOpInfo[AML_NUM_OPCODES] =
 
 /* ACPI 6.0 opcodes */
 
-/* 81 */ ACPI_OP ("External",           ARGP_EXTERNAL_OP,          ARGI_EXTERNAL_OP,           ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,/* ? */  AML_TYPE_EXEC_3A_0T_0R,   AML_FLAGS_EXEC_3A_0T_0R)
+/* 81 */ ACPI_OP ("External",           ARGP_EXTERNAL_OP,          ARGI_EXTERNAL_OP,           ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,/* ? */  AML_TYPE_EXEC_3A_0T_0R,   AML_FLAGS_EXEC_3A_0T_0R),
+/* 82 */ ACPI_OP ("Comment",            ARGP_COMMENT_OP,           ARGI_COMMENT_OP,            ACPI_TYPE_STRING,            AML_CLASS_ARGUMENT,        AML_TYPE_LITERAL,         AML_CONSTANT)
 
 /*! [End] no source code translation !*/
 };
index fa4bb11..d8f8129 100644 (file)
@@ -242,7 +242,7 @@ const UINT8 AcpiGbl_ShortOpIndex[256] =
 /* 0x90 */    0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x73, 0x74,
 /* 0x98 */    0x75, 0x76, _UNK, _UNK, 0x77, 0x78, 0x79, 0x7A,
 /* 0xA0 */    0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x60, 0x61,
-/* 0xA8 */    0x62, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xA8 */    0x62, 0x82, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
 /* 0xB0 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
 /* 0xB8 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
 /* 0xC0 */    _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
index d8ec494..112a4fc 100644 (file)
@@ -114,7 +114,7 @@ AcpiPsPeekOpcode (
     Aml = ParserState->Aml;
     Opcode = (UINT16) ACPI_GET8 (Aml);
 
-    if (Opcode == AML_EXTENDED_OP_PREFIX)
+    if (Opcode == AML_EXTENDED_PREFIX)
     {
         /* Extended opcode, get the second opcode byte */
 
@@ -218,7 +218,7 @@ AcpiPsCompleteThisOp (
                 (Op->Common.Parent->Common.AmlOpcode == AML_BUFFER_OP)       ||
                 (Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP)      ||
                 (Op->Common.Parent->Common.AmlOpcode == AML_BANK_FIELD_OP)   ||
-                (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
+                (Op->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP))
             {
                 ReplacementOp = AcpiPsAllocOp (
                     AML_INT_RETURN_VALUE_OP, Op->Common.Aml);
@@ -232,7 +232,7 @@ AcpiPsCompleteThisOp (
             {
                 if ((Op->Common.AmlOpcode == AML_BUFFER_OP) ||
                     (Op->Common.AmlOpcode == AML_PACKAGE_OP) ||
-                    (Op->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
+                    (Op->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP))
                 {
                     ReplacementOp = AcpiPsAllocOp (Op->Common.AmlOpcode,
                         Op->Common.Aml);
index 0e150bc..94658cc 100644 (file)
@@ -45,6 +45,7 @@
 #include "accommon.h"
 #include "acparser.h"
 #include "amlcode.h"
+#include "acconvert.h"
 
 #define _COMPONENT          ACPI_PARSER
         ACPI_MODULE_NAME    ("pstree")
@@ -242,6 +243,7 @@ AcpiPsGetDepthNext (
     Next = AcpiPsGetArg (Op, 0);
     if (Next)
     {
+        ASL_CV_LABEL_FILENODE (Next);
         return (Next);
     }
 
@@ -250,6 +252,7 @@ AcpiPsGetDepthNext (
     Next = Op->Common.Next;
     if (Next)
     {
+        ASL_CV_LABEL_FILENODE (Next);
         return (Next);
     }
 
@@ -262,6 +265,8 @@ AcpiPsGetDepthNext (
         Arg = AcpiPsGetArg (Parent, 0);
         while (Arg && (Arg != Origin) && (Arg != Op))
         {
+
+            ASL_CV_LABEL_FILENODE (Arg);
             Arg = Arg->Common.Next;
         }
 
@@ -276,6 +281,7 @@ AcpiPsGetDepthNext (
         {
             /* Found sibling of parent */
 
+            ASL_CV_LABEL_FILENODE (Parent->Common.Next);
             return (Parent->Common.Next);
         }
 
@@ -283,6 +289,7 @@ AcpiPsGetDepthNext (
         Parent = Parent->Common.Parent;
     }
 
+    ASL_CV_LABEL_FILENODE (Next);
     return (Next);
 }
 
@@ -331,7 +338,7 @@ AcpiPsGetChild (
         Child = AcpiPsGetArg (Op, 1);
         break;
 
-    case AML_POWER_RES_OP:
+    case AML_POWER_RESOURCE_OP:
     case AML_INDEX_FIELD_OP:
 
         Child = AcpiPsGetArg (Op, 2);
index 766fd1b..0569948 100644 (file)
@@ -45,6 +45,7 @@
 #include "accommon.h"
 #include "acparser.h"
 #include "amlcode.h"
+#include "acconvert.h"
 
 #define _COMPONENT          ACPI_PARSER
         ACPI_MODULE_NAME    ("psutils")
@@ -177,6 +178,17 @@ AcpiPsAllocOp (
         AcpiPsInitOp (Op, Opcode);
         Op->Common.Aml = Aml;
         Op->Common.Flags = Flags;
+        ASL_CV_CLEAR_OP_COMMENTS(Op);
+
+        if (Opcode == AML_SCOPE_OP)
+        {
+            AcpiGbl_CurrentScope = Op;
+        }
+    }
+
+    if (Gbl_CaptureComments)
+    {
+        ASL_CV_TRANSFER_COMMENTS (Op);
     }
 
     return (Op);
@@ -203,6 +215,7 @@ AcpiPsFreeOp (
     ACPI_FUNCTION_NAME (PsFreeOp);
 
 
+    ASL_CV_CLEAR_OP_COMMENTS(Op);
     if (Op->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP)
     {
         ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
index 3cd82ae..e9507ff 100644 (file)
@@ -144,6 +144,40 @@ AcpiUtCreateCaches (
         return (Status);
     }
 
+#ifdef ACPI_ASL_COMPILER
+    /*
+     * For use with the ASL-/ASL+ option. This cache keeps track of regular
+     * 0xA9 0x01 comments.
+     */
+    Status = AcpiOsCreateCache ("Acpi-Comment", sizeof (ACPI_COMMENT_NODE),
+        ACPI_MAX_COMMENT_CACHE_DEPTH, &AcpiGbl_RegCommentCache);
+    if (ACPI_FAILURE (Status))
+    {
+        return (Status);
+    }
+
+    /*
+     * This cache keeps track of the starting addresses of where the comments
+     * lie. This helps prevent duplication of comments.
+     */
+    Status = AcpiOsCreateCache ("Acpi-Comment-Addr", sizeof (ACPI_COMMENT_ADDR_NODE),
+        ACPI_MAX_COMMENT_CACHE_DEPTH, &AcpiGbl_CommentAddrCache);
+    if (ACPI_FAILURE (Status))
+    {
+        return (Status);
+    }
+
+    /*
+     * This cache will be used for nodes that represent files.
+     */
+    Status = AcpiOsCreateCache ("Acpi-File", sizeof (ACPI_FILE_NODE),
+        ACPI_MAX_COMMENT_CACHE_DEPTH, &AcpiGbl_FileCache);
+    if (ACPI_FAILURE (Status))
+    {
+        return (Status);
+    }
+#endif
+
 
 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
 
@@ -210,6 +244,16 @@ AcpiUtDeleteCaches (
     (void) AcpiOsDeleteCache (AcpiGbl_PsNodeExtCache);
     AcpiGbl_PsNodeExtCache = NULL;
 
+#ifdef ACPI_ASL_COMPILER
+    (void) AcpiOsDeleteCache (AcpiGbl_RegCommentCache);
+    AcpiGbl_RegCommentCache = NULL;
+
+    (void) AcpiOsDeleteCache (AcpiGbl_CommentAddrCache);
+    AcpiGbl_CommentAddrCache = NULL;
+
+    (void) AcpiOsDeleteCache (AcpiGbl_FileCache);
+    AcpiGbl_FileCache = NULL;
+#endif
 
 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
 
index 36bdb31..888d5c9 100644 (file)
@@ -77,7 +77,7 @@ AcpiOsCreateCache (
     ACPI_FUNCTION_ENTRY ();
 
 
-    if (!CacheName || !ReturnCache || (ObjectSize < 16))
+    if (!CacheName || !ReturnCache || !ObjectSize)
     {
         return (AE_BAD_PARAMETER);
     }
index ed78a84..f3cd77c 100644 (file)
@@ -526,6 +526,16 @@ AcpiUtWalkAmlResources (
                 return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG);
             }
 
+            /*
+             * The EndTag opcode must be followed by a zero byte.
+             * Although this byte is technically defined to be a checksum,
+             * in practice, all ASL compilers set this byte to zero.
+             */
+            if (*(Aml + 1) != 0)
+            {
+                return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG);
+            }
+
             /* Return the pointer to the EndTag if requested */
 
             if (!UserFunction)
index 0c65302..e881086 100644 (file)
@@ -101,7 +101,7 @@ ACPI_EXPORT_SYMBOL (AcpiError)
  *
  * PARAMETERS:  ModuleName          - Caller's module name (for error output)
  *              LineNumber          - Caller's line number (for error output)
- *              Status              - Status to be formatted
+ *              Status              - Status value to be decoded/formatted
  *              Format              - Printf format string + additional args
  *
  * RETURN:      None
@@ -152,8 +152,8 @@ ACPI_EXPORT_SYMBOL (AcpiException)
  *
  * FUNCTION:    AcpiWarning
  *
- * PARAMETERS:  ModuleName          - Caller's module name (for error output)
- *              LineNumber          - Caller's line number (for error output)
+ * PARAMETERS:  ModuleName          - Caller's module name (for warning output)
+ *              LineNumber          - Caller's line number (for warning output)
  *              Format              - Printf format string + additional args
  *
  * RETURN:      None
@@ -190,17 +190,13 @@ ACPI_EXPORT_SYMBOL (AcpiWarning)
  *
  * FUNCTION:    AcpiInfo
  *
- * PARAMETERS:  ModuleName          - Caller's module name (for error output)
- *              LineNumber          - Caller's line number (for error output)
- *              Format              - Printf format string + additional args
+ * PARAMETERS:  Format              - Printf format string + additional args
  *
  * RETURN:      None
  *
  * DESCRIPTION: Print generic "ACPI:" information message. There is no
  *              module/line/version info in order to keep the message simple.
  *
- * TBD: ModuleName and LineNumber args are not needed, should be removed.
- *
  ******************************************************************************/
 
 void ACPI_INTERNAL_VAR_XFACE
@@ -268,8 +264,8 @@ ACPI_EXPORT_SYMBOL (AcpiBiosError)
  *
  * FUNCTION:    AcpiBiosWarning
  *
- * PARAMETERS:  ModuleName          - Caller's module name (for error output)
- *              LineNumber          - Caller's line number (for error output)
+ * PARAMETERS:  ModuleName          - Caller's module name (for warning output)
+ *              LineNumber          - Caller's line number (for warning output)
  *              Format              - Printf format string + additional args
  *
  * RETURN:      None