[PATCH 1/3] ACPICA: Update to version 20160930

Colin King colin.king at canonical.com
Mon Oct 3 09:39:24 UTC 2016


From: Colin Ian King <colin.king at canonical.com>

Changes in this release of ACPICA are detailed at the following
link on the ACPICA developer mailing list:

https://lists.acpica.org/pipermail/devel/2016-September/000972.html

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/acpica/source/common/acfileio.c                | 10 ++-
 src/acpica/source/compiler/aslmaputils.c           |  6 ++
 src/acpica/source/compiler/asloperands.c           | 14 ++++
 src/acpica/source/compiler/aslrules.y              |  2 +-
 src/acpica/source/compiler/aslxref.c               |  6 +-
 .../source/components/disassembler/dmbuffer.c      | 68 ++++++++++++++--
 .../source/components/disassembler/dmcstyle.c      | 91 ++++++++++++++++++++++
 .../source/components/disassembler/dmopcode.c      | 66 +++++++++++++++-
 .../source/components/disassembler/dmresrcl.c      | 15 ++--
 src/acpica/source/components/executer/exconfig.c   | 24 +++++-
 src/acpica/source/components/parser/psxface.c      | 12 +++
 src/acpica/source/components/tables/tbdata.c       |  7 +-
 src/acpica/source/components/tables/tbfind.c       |  2 +-
 src/acpica/source/components/tables/tbxfload.c     | 16 +++-
 .../source/components/utilities/utstrtoul64.c      |  2 +-
 src/acpica/source/include/acconfig.h               |  2 +-
 src/acpica/source/include/acglobal.h               |  5 +-
 src/acpica/source/include/aclocal.h                | 19 ++---
 src/acpica/source/include/acpixf.h                 |  9 ++-
 .../source/os_specific/service_layers/osunixxf.c   | 13 +++-
 20 files changed, 336 insertions(+), 53 deletions(-)

diff --git a/src/acpica/source/common/acfileio.c b/src/acpica/source/common/acfileio.c
index b7d5039..6cb9536 100644
--- a/src/acpica/source/common/acfileio.c
+++ b/src/acpica/source/common/acfileio.c
@@ -334,12 +334,14 @@ AcGetOneTableFromFile (
         return (Status);
     }
 
+
     if (GetOnlyAmlTables)
     {
-        /* Table must be an AML table (DSDT/SSDT) or FADT */
-
-        if (!ACPI_COMPARE_NAME (TableHeader.Signature, ACPI_SIG_FADT) &&
-            !AcpiUtIsAmlTable (&TableHeader))
+        /*
+         * Table must be an AML table (DSDT/SSDT).
+         * Used for iASL -e option only.
+         */
+        if (!AcpiUtIsAmlTable (&TableHeader))
         {
             fprintf (stderr,
                 "    %s: Table [%4.4s] is not an AML table - ignoring\n",
diff --git a/src/acpica/source/compiler/aslmaputils.c b/src/acpica/source/compiler/aslmaputils.c
index ee947e8..cb282e2 100644
--- a/src/acpica/source/compiler/aslmaputils.c
+++ b/src/acpica/source/compiler/aslmaputils.c
@@ -152,6 +152,12 @@ MpGetHidFromParseTree (
 
 
     Op = HidNode->Op;
+    if (!Op)
+    {
+        /* Object is not resolved, probably an External */
+
+        return ("Unresolved Symbol - referenced but not defined in this table");
+    }
 
     switch (Op->Asl.ParseOpcode)
     {
diff --git a/src/acpica/source/compiler/asloperands.c b/src/acpica/source/compiler/asloperands.c
index 2e2f2d1..db4d013 100644
--- a/src/acpica/source/compiler/asloperands.c
+++ b/src/acpica/source/compiler/asloperands.c
@@ -423,6 +423,20 @@ OpnDoFieldCommon (
             NewBitOffset = (UINT32) PkgLengthNode->Asl.Value.Integer;
             CurrentBitOffset += NewBitOffset;
 
+            if ((NewBitOffset == 0) &&
+                (Next->Asl.ParseOpcode == PARSEOP_RESERVED_BYTES))
+            {
+                /*
+                 * Unnamed field with a bit length of zero. We can
+                 * safely just ignore this. However, we will not ignore
+                 * a named field of zero length, we don't want to just
+                 * toss out a name.
+                 */
+                Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+                PkgLengthNode->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+                break;
+            }
+
             /* Save the current AccessAs value for error checking later */
 
             switch (AccessType)
diff --git a/src/acpica/source/compiler/aslrules.y b/src/acpica/source/compiler/aslrules.y
index 73c8062..4bcbbf2 100644
--- a/src/acpica/source/compiler/aslrules.y
+++ b/src/acpica/source/compiler/aslrules.y
@@ -602,7 +602,7 @@ ObjectTypeName
     | RefOfTerm                     {}
     | DerefOfTerm                   {}
     | IndexTerm                     {}
-
+    | IndexExpTerm                  {}
 /*    | MethodInvocationTerm          {} */  /* Caused reduce/reduce with Type6Opcode->MethodInvocationTerm */
     ;
 
diff --git a/src/acpica/source/compiler/aslxref.c b/src/acpica/source/compiler/aslxref.c
index a3eab4a..a12bcc7 100644
--- a/src/acpica/source/compiler/aslxref.c
+++ b/src/acpica/source/compiler/aslxref.c
@@ -898,16 +898,18 @@ XfNamespaceLocateBegin (
         /*
          * A reference to a method within one of these opcodes is not an
          * invocation of the method, it is simply a reference to the method.
+         *
+         * September 2016: Removed DeRefOf from this list
          */
         if ((Op->Asl.Parent) &&
-           ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_REFOF)      ||
-            (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEREFOF)    ||
+            ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_REFOF)     ||
             (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_PACKAGE)    ||
             (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_VAR_PACKAGE)||
             (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_OBJECTTYPE)))
         {
             return_ACPI_STATUS (AE_OK);
         }
+
         /*
          * There are two types of method invocation:
          * 1) Invocation with arguments -- the parser recognizes this
diff --git a/src/acpica/source/components/disassembler/dmbuffer.c b/src/acpica/source/components/disassembler/dmbuffer.c
index 72d2ada..7b2fcc4 100644
--- a/src/acpica/source/components/disassembler/dmbuffer.c
+++ b/src/acpica/source/components/disassembler/dmbuffer.c
@@ -601,7 +601,8 @@ AcpiDmIsStringBuffer (
  *
  * PARAMETERS:  Op                  - Buffer Object to be examined
  *
- * RETURN:      TRUE if buffer contains a ASCII string, FALSE otherwise
+ * RETURN:      TRUE if buffer appears to contain data produced via the
+ *              ToPLD macro, FALSE otherwise
  *
  * DESCRIPTION: Determine if a buffer Op contains a _PLD structure
  *
@@ -613,12 +614,60 @@ AcpiDmIsPldBuffer (
 {
     ACPI_NAMESPACE_NODE     *Node;
     ACPI_PARSE_OBJECT       *SizeOp;
+    ACPI_PARSE_OBJECT       *ByteListOp;
     ACPI_PARSE_OBJECT       *ParentOp;
+    UINT64                  BufferSize;
+    UINT64                  InitializerSize;
 
 
-    /* Buffer size is the buffer argument */
-
+    /*
+     * Get the BufferSize argument - Buffer(BufferSize)
+     * If the buffer was generated by the ToPld macro, it must
+     * be a BYTE constant.
+     */
     SizeOp = Op->Common.Value.Arg;
+    if (SizeOp->Common.AmlOpcode != AML_BYTE_OP)
+    {
+        return (FALSE);
+    }
+
+    /* Check the declared BufferSize, two possibilities */
+
+    BufferSize = SizeOp->Common.Value.Integer;
+    if ((BufferSize != ACPI_PLD_REV1_BUFFER_SIZE) &&
+        (BufferSize != ACPI_PLD_REV2_BUFFER_SIZE))
+    {
+        return (FALSE);
+    }
+
+    /*
+     * Check the initializer list length. This is the actual
+     * number of bytes in the buffer as counted by the AML parser.
+     * The declared BufferSize can be larger than the actual length.
+     * However, for the ToPLD macro, the BufferSize will be the same
+     * as the initializer list length.
+     */
+    ByteListOp = SizeOp->Common.Next;
+    if (!ByteListOp)
+    {
+        return (FALSE); /* Zero-length buffer case */
+    }
+
+    InitializerSize = ByteListOp->Common.Value.Integer;
+    if ((InitializerSize != ACPI_PLD_REV1_BUFFER_SIZE) &&
+        (InitializerSize != ACPI_PLD_REV2_BUFFER_SIZE))
+    {
+        return (FALSE);
+    }
+
+    /* Final size check */
+
+    if (BufferSize != InitializerSize)
+    {
+        return (FALSE);
+    }
+
+    /* Now examine the buffer parent */
 
     ParentOp = Op->Common.Parent;
     if (!ParentOp)
@@ -643,8 +692,17 @@ AcpiDmIsPldBuffer (
         return (FALSE);
     }
 
-    /* Check for proper form: Name(_PLD, Package() {Buffer() {}}) */
-
+    /*
+     * Check for proper form: Name(_PLD, Package() {ToPLD()})
+     *
+     * Note: All other forms such as
+     *      Return (Package() {ToPLD()})
+     *      Local0 = ToPLD()
+     * etc. are not converted back to the ToPLD macro, because
+     * there is really no deterministic way to disassemble the buffer
+     * back to the ToPLD macro, other than trying to find the "_PLD"
+     * name
+     */
     if (ParentOp->Common.AmlOpcode == AML_PACKAGE_OP)
     {
         ParentOp = ParentOp->Common.Parent;
diff --git a/src/acpica/source/components/disassembler/dmcstyle.c b/src/acpica/source/components/disassembler/dmcstyle.c
index 7ff388f..dcfc044 100644
--- a/src/acpica/source/components/disassembler/dmcstyle.c
+++ b/src/acpica/source/components/disassembler/dmcstyle.c
@@ -170,6 +170,9 @@ AcpiDmCheckForSymbolicOpcode (
     ACPI_PARSE_OBJECT       *Child1;
     ACPI_PARSE_OBJECT       *Child2;
     ACPI_PARSE_OBJECT       *Target;
+    ACPI_PARSE_OBJECT       *GrandChild1;
+    ACPI_PARSE_OBJECT       *GrandChild2;
+    ACPI_PARSE_OBJECT       *GrandTarget = NULL;
 
 
     /* Exit immediately if ASL+ not enabled */
@@ -179,6 +182,14 @@ AcpiDmCheckForSymbolicOpcode (
         return (FALSE);
     }
 
+    /* Check for a non-ASL+ statement, propagate the flag */
+
+    if (Op->Common.Parent->Common.DisasmFlags & ACPI_PARSEOP_LEGACY_ASL_ONLY)
+    {
+        Op->Common.DisasmFlags |= ACPI_PARSEOP_LEGACY_ASL_ONLY;
+        return (FALSE);
+    }
+
     /* Get the first operand */
 
     Child1 = AcpiPsGetArg (Op, 0);
@@ -395,6 +406,7 @@ AcpiDmCheckForSymbolicOpcode (
             if (AcpiDmIsValidTarget (Target))
             {
                 Child1->Common.OperatorSymbol = NULL;
+                Op->Common.DisasmFlags |= ACPI_PARSEOP_LEGACY_ASL_ONLY;
                 return (FALSE);
             }
 
@@ -411,6 +423,13 @@ AcpiDmCheckForSymbolicOpcode (
 
         if (!AcpiDmIsValidTarget (Target))
         {
+            if (Op->Common.Parent->Common.AmlOpcode == AML_STORE_OP)
+            {
+                Op->Common.DisasmFlags = 0;
+                Child1->Common.OperatorSymbol = NULL;
+                return (FALSE);
+            }
+
             /* Not a valid target (placeholder only, from parser) */
             break;
         }
@@ -550,6 +569,69 @@ AcpiDmCheckForSymbolicOpcode (
         /*
          * Target is the 2nd operand.
          * We know the target is valid, it is not optional.
+         *
+         * The following block implements "Ignore conversion if a store
+         * is followed by a math/bit operator that has no target". Used
+         * only for the ASL test suite.
+         */
+        if (!AcpiGbl_DoDisassemblerOptimizations)
+        {
+            switch (Child1->Common.AmlOpcode)
+            {
+            /* This operator has two operands and two targets */
+
+            case AML_DIVIDE_OP:
+
+                GrandChild1 = Child1->Common.Value.Arg;
+                GrandChild2 = GrandChild1->Common.Next;
+                GrandTarget = GrandChild2->Common.Next;
+
+                if (GrandTarget && !AcpiDmIsValidTarget (GrandTarget))
+                {
+                    Op->Common.DisasmFlags |= ACPI_PARSEOP_LEGACY_ASL_ONLY;
+                    return (FALSE);
+                }
+                GrandTarget = GrandTarget->Common.Next;
+                break;
+
+            case AML_ADD_OP:
+            case AML_SUBTRACT_OP:
+            case AML_MULTIPLY_OP:
+            case AML_MOD_OP:
+            case AML_SHIFT_LEFT_OP:
+            case AML_SHIFT_RIGHT_OP:
+            case AML_BIT_AND_OP:
+            case AML_BIT_OR_OP:
+            case AML_BIT_XOR_OP:
+            case AML_INDEX_OP:
+
+                /* These operators have two operands and a target */
+
+                GrandChild1 = Child1->Common.Value.Arg;
+                GrandChild2 = GrandChild1->Common.Next;
+                GrandTarget = GrandChild2->Common.Next;
+                break;
+
+            case AML_BIT_NOT_OP:
+
+                /* This operator has one operand and a target */
+
+                GrandChild1 = Child1->Common.Value.Arg;
+                GrandTarget = GrandChild1->Common.Next;
+                break;
+
+            default:
+                break;
+            }
+
+            if (GrandTarget && !AcpiDmIsValidTarget (GrandTarget))
+            {
+                Op->Common.DisasmFlags |= ACPI_PARSEOP_LEGACY_ASL_ONLY;
+                return (FALSE);
+            }
+        }
+
+        /*
          * In the parse tree, simply swap the target with the
          * source so that the target is processed first.
          */
@@ -635,6 +717,7 @@ AcpiDmCloseOperator (
 {
     BOOLEAN                 IsCStyleOp = FALSE;
 
+
     /* Always emit paren if ASL+ disassembly disabled */
 
     if (!AcpiGbl_CstyleDisassembly)
@@ -643,6 +726,14 @@ AcpiDmCloseOperator (
         return;
     }
 
+    /* Check for a non-ASL+ statement */
+
+    if (Op->Common.DisasmFlags & ACPI_PARSEOP_LEGACY_ASL_ONLY)
+    {
+        AcpiOsPrintf (")");
+        return;
+    }
+
     /* Check if we need to add an additional closing paren */
 
     switch (Op->Common.AmlOpcode)
diff --git a/src/acpica/source/components/disassembler/dmopcode.c b/src/acpica/source/components/disassembler/dmopcode.c
index 683fd0a..1ea92fa 100644
--- a/src/acpica/source/components/disassembler/dmopcode.c
+++ b/src/acpica/source/components/disassembler/dmopcode.c
@@ -136,6 +136,10 @@ static void
 AcpiDmConvertToElseIf (
     ACPI_PARSE_OBJECT       *Op);
 
+static void
+AcpiDmPromoteSubtree (
+    ACPI_PARSE_OBJECT       *StartOp);
+
 
 /*******************************************************************************
  *
@@ -1139,12 +1143,22 @@ AcpiDmConvertToElseIf (
      *    be the only blocks under the original Else.
      */
     IfOp = OriginalElseOp->Common.Value.Arg;
+
     if (!IfOp ||
         (IfOp->Common.AmlOpcode != AML_IF_OP) ||
         (IfOp->Asl.Next && (IfOp->Asl.Next->Common.AmlOpcode != AML_ELSE_OP)))
     {
-        /* Not an Else..If sequence, cannot convert to ElseIf */
+        /* Not a proper Else..If sequence, cannot convert to ElseIf */
+
+        AcpiOsPrintf ("%s", "Else");
+        return;
+    }
+
+    /* Cannot have anything following the If...Else block */
 
+    ElseOp = IfOp->Common.Next;
+    if (ElseOp && ElseOp->Common.Next)
+    {
         AcpiOsPrintf ("%s", "Else");
         return;
     }
@@ -1172,7 +1186,10 @@ AcpiDmConvertToElseIf (
         /* If an ELSE matches the IF, promote it also */
 
         ElseOp->Common.Parent = OriginalElseOp->Common.Parent;
-        ElseOp->Common.Next = OriginalElseOp->Common.Next;
+
+        /* Promote the entire block under the ElseIf (All Next OPs) */
+
+        AcpiDmPromoteSubtree (OriginalElseOp);
     }
     else
     {
@@ -1194,3 +1211,48 @@ AcpiDmConvertToElseIf (
 
     OriginalElseOp->Common.Next = IfOp;
 }
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiDmPromoteSubtree
+ *
+ * PARAMETERS:  StartOpOp           - Original parent of the entire subtree
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Promote an entire parse subtree up one level.
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmPromoteSubtree (
+    ACPI_PARSE_OBJECT       *StartOp)
+{
+    ACPI_PARSE_OBJECT       *Op;
+    ACPI_PARSE_OBJECT       *ParentOp;
+
+
+    /* New parent for subtree elements */
+
+    ParentOp = StartOp->Common.Parent;
+
+    /* First child starts the subtree */
+
+    Op = StartOp->Common.Value.Arg;
+
+    /* Walk the top-level elements of the subtree */
+
+    while (Op)
+    {
+        Op->Common.Parent = ParentOp;
+        if (!Op->Common.Next)
+        {
+            /* Last Op in list, update its next field */
+
+            Op->Common.Next = StartOp->Common.Next;
+            break;
+        }
+        Op = Op->Common.Next;
+    }
+}
diff --git a/src/acpica/source/components/disassembler/dmresrcl.c b/src/acpica/source/components/disassembler/dmresrcl.c
index 8e71a67..e975e5e 100644
--- a/src/acpica/source/components/disassembler/dmresrcl.c
+++ b/src/acpica/source/components/disassembler/dmresrcl.c
@@ -515,16 +515,17 @@ AcpiDmIoFlags2 (
         UINT8               SpecificFlags)
 {
 
+    /* _TTP */
+
     AcpiOsPrintf (", %s",
         AcpiGbl_TtpDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 4)]);
 
-    /* TRS is only used if TTP is TypeTranslation */
-
-    if (SpecificFlags & 0x10)
-    {
-        AcpiOsPrintf (", %s",
-            AcpiGbl_TrsDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 5)]);
-    }
+    /*
+     * TRS is only used if TTP is TypeTranslation. However, the disassembler
+     * always emits exactly what is in the AML.
+     */
+    AcpiOsPrintf (", %s",
+        AcpiGbl_TrsDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 5)]);
 }
 
 
diff --git a/src/acpica/source/components/executer/exconfig.c b/src/acpica/source/components/executer/exconfig.c
index 5223434..fb55b67 100644
--- a/src/acpica/source/components/executer/exconfig.c
+++ b/src/acpica/source/components/executer/exconfig.c
@@ -654,11 +654,18 @@ AcpiExUnloadTable (
 
     TableIndex = TableDesc->Reference.Value;
 
+    /*
+     * Release the interpreter lock so that the table lock won't have
+     * strict order requirement against it.
+     */
+    AcpiExExitInterpreter ();
+
     /* Ensure the table is still loaded */
 
     if (!AcpiTbIsTableLoaded (TableIndex))
     {
-        return_ACPI_STATUS (AE_NOT_EXIST);
+        Status = AE_NOT_EXIST;
+        goto LockAndExit;
     }
 
     /* Invoke table handler if present */
@@ -678,16 +685,25 @@ AcpiExUnloadTable (
     Status = AcpiTbDeleteNamespaceByOwner (TableIndex);
     if (ACPI_FAILURE (Status))
     {
-        return_ACPI_STATUS (Status);
+        goto LockAndExit;
     }
 
     (void) AcpiTbReleaseOwnerId (TableIndex);
     AcpiTbSetTableLoadedFlag (TableIndex, FALSE);
 
+LockAndExit:
+
+    /* Re-acquire the interpreter lock */
+
+    AcpiExEnterInterpreter ();
+
     /*
      * Invalidate the handle. We do this because the handle may be stored
      * in a named object and may not be actually deleted until much later.
      */
-    DdbHandle->Common.Flags &= ~AOPOBJ_DATA_VALID;
-    return_ACPI_STATUS (AE_OK);
+    if (ACPI_SUCCESS (Status))
+    {
+        DdbHandle->Common.Flags &= ~AOPOBJ_DATA_VALID;
+    }
+    return_ACPI_STATUS (Status);
 }
diff --git a/src/acpica/source/components/parser/psxface.c b/src/acpica/source/components/parser/psxface.c
index 71b880d..a89b93c 100644
--- a/src/acpica/source/components/parser/psxface.c
+++ b/src/acpica/source/components/parser/psxface.c
@@ -406,6 +406,18 @@ AcpiPsExecuteTable (
         WalkState->ParseFlags |= ACPI_PARSE_MODULE_LEVEL;
     }
 
+    /* Info->Node is the default location to load the table  */
+
+    if (Info->Node && Info->Node != AcpiGbl_RootNode)
+    {
+        Status = AcpiDsScopeStackPush (
+            Info->Node, ACPI_TYPE_METHOD, WalkState);
+        if (ACPI_FAILURE (Status))
+        {
+            goto Cleanup;
+        }
+    }
+
     /*
      * Parse the AML, WalkState will be deleted by ParseAml
      */
diff --git a/src/acpica/source/components/tables/tbdata.c b/src/acpica/source/components/tables/tbdata.c
index 0bddeef..4136047 100644
--- a/src/acpica/source/components/tables/tbdata.c
+++ b/src/acpica/source/components/tables/tbdata.c
@@ -753,18 +753,13 @@ AcpiTbDeleteNamespaceByOwner (
      * lock may block, and also since the execution of a namespace walk
      * must be allowed to use the interpreter.
      */
-    (void) AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER);
     Status = AcpiUtAcquireWriteLock (&AcpiGbl_NamespaceRwLock);
-
-    AcpiNsDeleteNamespaceByOwner (OwnerId);
     if (ACPI_FAILURE (Status))
     {
         return_ACPI_STATUS (Status);
     }
-
+    AcpiNsDeleteNamespaceByOwner (OwnerId);
     AcpiUtReleaseWriteLock (&AcpiGbl_NamespaceRwLock);
-
-    Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER);
     return_ACPI_STATUS (Status);
 }
 
diff --git a/src/acpica/source/components/tables/tbfind.c b/src/acpica/source/components/tables/tbfind.c
index d688c42..4fc98fc 100644
--- a/src/acpica/source/components/tables/tbfind.c
+++ b/src/acpica/source/components/tables/tbfind.c
@@ -228,5 +228,5 @@ AcpiTbFindTable (
 
 UnlockAndExit:
     (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
-    return_ACPI_STATUS (AE_NOT_FOUND);
+    return_ACPI_STATUS (Status);
 }
diff --git a/src/acpica/source/components/tables/tbxfload.c b/src/acpica/source/components/tables/tbxfload.c
index 6a937b1..aa826fe 100644
--- a/src/acpica/source/components/tables/tbxfload.c
+++ b/src/acpica/source/components/tables/tbxfload.c
@@ -334,7 +334,7 @@ AcpiTbLoadNamespace (
     if (!TablesFailed)
     {
         ACPI_INFO ((
-            "%u ACPI AML tables successfully acquired and loaded\n",
+            "%u ACPI AML tables successfully acquired and loaded",
             TablesLoaded));
     }
     else
@@ -348,6 +348,11 @@ AcpiTbLoadNamespace (
         Status = AE_CTRL_TERMINATE;
     }
 
+#ifdef ACPI_APPLICATION
+    ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "\n"));
+#endif
+
+
 UnlockAndExit:
     (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
     return_ACPI_STATUS (Status);
@@ -495,9 +500,9 @@ AcpiUnloadParentTable (
         return_ACPI_STATUS (AE_TYPE);
     }
 
-    /* Must acquire the interpreter lock during this operation */
+    /* Must acquire the table lock during this operation */
 
-    Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER);
+    Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES);
     if (ACPI_FAILURE (Status))
     {
         return_ACPI_STATUS (Status);
@@ -528,9 +533,11 @@ AcpiUnloadParentTable (
 
         /* Ensure the table is actually loaded */
 
+        (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
         if (!AcpiTbIsTableLoaded (i))
         {
             Status = AE_NOT_EXIST;
+            (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
             break;
         }
 
@@ -557,10 +564,11 @@ AcpiUnloadParentTable (
 
         Status = AcpiTbReleaseOwnerId (i);
         AcpiTbSetTableLoadedFlag (i, FALSE);
+        (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
         break;
     }
 
-    (void) AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER);
+    (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
     return_ACPI_STATUS (Status);
 }
 
diff --git a/src/acpica/source/components/utilities/utstrtoul64.c b/src/acpica/source/components/utilities/utstrtoul64.c
index bdc424b..ff84ed4 100644
--- a/src/acpica/source/components/utilities/utstrtoul64.c
+++ b/src/acpica/source/components/utilities/utstrtoul64.c
@@ -157,7 +157,7 @@ AcpiUtStrtoulBase16 (
  * The integer is initialized to the value zero.
  * The ASCII string is interpreted as a hexadecimal constant.
  *
- *  1)  A “0x” prefix is not allowed. However, ACPICA allows this for
+ *  1)  A "0x" prefix is not allowed. However, ACPICA allows this for
  *      compatibility with previous ACPICA. (NO ERROR)
  *
  *  2)  Terminates when the size of an integer is reached (32 or 64 bits).
diff --git a/src/acpica/source/include/acconfig.h b/src/acpica/source/include/acconfig.h
index 23cf1c2..bf7421f 100644
--- a/src/acpica/source/include/acconfig.h
+++ b/src/acpica/source/include/acconfig.h
@@ -220,7 +220,7 @@
 
 /* Maximum number of While() loops before abort */
 
-#define ACPI_MAX_LOOP_COUNT             0xFFFF
+#define ACPI_MAX_LOOP_COUNT             0x000FFFFF
 
 
 /******************************************************************************
diff --git a/src/acpica/source/include/acglobal.h b/src/acpica/source/include/acglobal.h
index 001519f..eb48d40 100644
--- a/src/acpica/source/include/acglobal.h
+++ b/src/acpica/source/include/acglobal.h
@@ -317,10 +317,6 @@ ACPI_INIT_GLOBAL (UINT32,               AcpiGbl_NestingLevel, 0);
 
 ACPI_GLOBAL (ACPI_THREAD_STATE *,       AcpiGbl_CurrentWalkList);
 
-/* Maximum number of While() loop iterations before forced abort */
-
-ACPI_GLOBAL (UINT16,                    AcpiGbl_MaxLoopIterations);
-
 /* Control method single step flag */
 
 ACPI_GLOBAL (UINT8,                     AcpiGbl_CmSingleStep);
@@ -394,6 +390,7 @@ ACPI_INIT_GLOBAL (BOOLEAN,              AcpiGbl_CstyleDisassembly, TRUE);
 ACPI_INIT_GLOBAL (BOOLEAN,              AcpiGbl_ForceAmlDisassembly, FALSE);
 ACPI_INIT_GLOBAL (BOOLEAN,              AcpiGbl_DmOpt_Verbose, TRUE);
 ACPI_INIT_GLOBAL (BOOLEAN,              AcpiGbl_DmEmitExternalOpcodes, FALSE);
+ACPI_INIT_GLOBAL (BOOLEAN,              AcpiGbl_DoDisassemblerOptimizations, TRUE);
 
 ACPI_GLOBAL (BOOLEAN,                   AcpiGbl_DmOpt_Disasm);
 ACPI_GLOBAL (BOOLEAN,                   AcpiGbl_DmOpt_Listing);
diff --git a/src/acpica/source/include/aclocal.h b/src/acpica/source/include/aclocal.h
index c5dc19a..4d28120 100644
--- a/src/acpica/source/include/aclocal.h
+++ b/src/acpica/source/include/aclocal.h
@@ -989,7 +989,7 @@ typedef union acpi_parse_value
     ACPI_PARSE_VALUE                Value;          /* Value or args associated with the opcode */\
     UINT8                           ArgListLength;  /* Number of elements in the arg list */\
     ACPI_DISASM_ONLY_MEMBERS (\
-    UINT8                           DisasmFlags;    /* Used during AML disassembly */\
+    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) */
@@ -1109,14 +1109,15 @@ typedef struct acpi_parse_state
 
 /* Parse object DisasmFlags */
 
-#define ACPI_PARSEOP_IGNORE                 0x01
-#define ACPI_PARSEOP_PARAMETER_LIST         0x02
-#define ACPI_PARSEOP_EMPTY_TERMLIST         0x04
-#define ACPI_PARSEOP_PREDEFINED_CHECKED     0x08
-#define ACPI_PARSEOP_CLOSING_PAREN          0x10
-#define ACPI_PARSEOP_COMPOUND_ASSIGNMENT    0x20
-#define ACPI_PARSEOP_ASSIGNMENT             0x40
-#define ACPI_PARSEOP_ELSEIF                 0x80
+#define ACPI_PARSEOP_IGNORE                 0x0001
+#define ACPI_PARSEOP_PARAMETER_LIST         0x0002
+#define ACPI_PARSEOP_EMPTY_TERMLIST         0x0004
+#define ACPI_PARSEOP_PREDEFINED_CHECKED     0x0008
+#define ACPI_PARSEOP_CLOSING_PAREN          0x0010
+#define ACPI_PARSEOP_COMPOUND_ASSIGNMENT    0x0020
+#define ACPI_PARSEOP_ASSIGNMENT             0x0040
+#define ACPI_PARSEOP_ELSEIF                 0x0080
+#define ACPI_PARSEOP_LEGACY_ASL_ONLY        0x0100
 
 
 /*****************************************************************************
diff --git a/src/acpica/source/include/acpixf.h b/src/acpica/source/include/acpixf.h
index 7d4b67c..8efd759 100644
--- a/src/acpica/source/include/acpixf.h
+++ b/src/acpica/source/include/acpixf.h
@@ -118,7 +118,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20160831
+#define ACPI_CA_VERSION                 0x20160930
 
 #include "acconfig.h"
 #include "actypes.h"
@@ -333,6 +333,13 @@ ACPI_INIT_GLOBAL (UINT8,            AcpiGbl_OsiData, 0);
 ACPI_INIT_GLOBAL (BOOLEAN,          AcpiGbl_ReducedHardware, FALSE);
 
 /*
+ * Maximum number of While() loop iterations before forced method abort.
+ * This mechanism is intended to prevent infinite loops during interpreter
+ * execution within a host kernel.
+ */
+ACPI_INIT_GLOBAL (UINT32,           AcpiGbl_MaxLoopIterations, ACPI_MAX_LOOP_COUNT);
+
+/*
  * This mechanism is used to trace a specified AML method. The method is
  * traced each time it is executed.
  */
diff --git a/src/acpica/source/os_specific/service_layers/osunixxf.c b/src/acpica/source/os_specific/service_layers/osunixxf.c
index f04b59e..413a708 100644
--- a/src/acpica/source/os_specific/service_layers/osunixxf.c
+++ b/src/acpica/source/os_specific/service_layers/osunixxf.c
@@ -826,8 +826,12 @@ AcpiOsCreateSemaphore (
 
 #ifdef __APPLE__
     {
-        char            *SemaphoreName = tmpnam (NULL);
+        static int      SemaphoreCount = 0;
+        char            SemaphoreName[32];
 
+        snprintf (SemaphoreName, sizeof (SemaphoreName), "acpi_sem_%d",
+            SemaphoreCount++);
+        printf ("%s\n", SemaphoreName);
         Sem = sem_open (SemaphoreName, O_EXCL|O_CREAT, 0755, InitialUnits);
         if (!Sem)
         {
@@ -879,10 +883,17 @@ AcpiOsDeleteSemaphore (
         return (AE_BAD_PARAMETER);
     }
 
+#ifdef __APPLE__
+    if (sem_close (Sem) == -1)
+    {
+        return (AE_BAD_PARAMETER);
+    }
+#else
     if (sem_destroy (Sem) == -1)
     {
         return (AE_BAD_PARAMETER);
     }
+#endif
 
     return (AE_OK);
 }
-- 
2.9.3




More information about the fwts-devel mailing list