Module Name:    src
Committed By:   christos
Date:           Tue Oct 15 16:13:40 UTC 2019

Modified Files:
        src/sys/external/bsd/acpica/dist/compiler: aslcompile.c aslcompiler.h
            aslerror.c aslfiles.c aslload.c asloptions.c aslsupport.l
            aslutils.c aslwalks.c aslxref.c dtcompile.c dtcompilerparser.y
            dtfield.c
        src/sys/external/bsd/acpica/dist/debugger: dbinput.c dbmethod.c
        src/sys/external/bsd/acpica/dist/events: evxface.c
        src/sys/external/bsd/acpica/dist/executer: exconfig.c exdump.c
        src/sys/external/bsd/acpica/dist/include: acglobal.h aclocal.h
            acnamesp.h acpiosxf.h acpixf.h actypes.h acutils.h
        src/sys/external/bsd/acpica/dist/namespace: nsaccess.c nsdump.c
            nseval.c nsinit.c nsrepair2.c
        src/sys/external/bsd/acpica/dist/tables: tbdata.c tbxfload.c
        src/sys/external/bsd/acpica/dist/tools/acpidump: apfiles.c
        src/sys/external/bsd/acpica/dist/utilities: utdebug.c utosi.c

Log Message:
merge conflicts


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 \
    src/sys/external/bsd/acpica/dist/compiler/aslcompile.c
cvs rdiff -u -r1.14 -r1.15 \
    src/sys/external/bsd/acpica/dist/compiler/aslcompiler.h \
    src/sys/external/bsd/acpica/dist/compiler/aslload.c \
    src/sys/external/bsd/acpica/dist/compiler/aslxref.c
cvs rdiff -u -r1.12 -r1.13 \
    src/sys/external/bsd/acpica/dist/compiler/aslerror.c \
    src/sys/external/bsd/acpica/dist/compiler/aslwalks.c
cvs rdiff -u -r1.13 -r1.14 \
    src/sys/external/bsd/acpica/dist/compiler/aslfiles.c \
    src/sys/external/bsd/acpica/dist/compiler/aslsupport.l \
    src/sys/external/bsd/acpica/dist/compiler/dtcompile.c \
    src/sys/external/bsd/acpica/dist/compiler/dtfield.c
cvs rdiff -u -r1.10 -r1.11 \
    src/sys/external/bsd/acpica/dist/compiler/asloptions.c
cvs rdiff -u -r1.23 -r1.24 \
    src/sys/external/bsd/acpica/dist/compiler/aslutils.c
cvs rdiff -u -r1.1.1.1 -r1.2 \
    src/sys/external/bsd/acpica/dist/compiler/dtcompilerparser.y
cvs rdiff -u -r1.18 -r1.19 \
    src/sys/external/bsd/acpica/dist/debugger/dbinput.c
cvs rdiff -u -r1.12 -r1.13 \
    src/sys/external/bsd/acpica/dist/debugger/dbmethod.c
cvs rdiff -u -r1.11 -r1.12 src/sys/external/bsd/acpica/dist/events/evxface.c
cvs rdiff -u -r1.14 -r1.15 \
    src/sys/external/bsd/acpica/dist/executer/exconfig.c
cvs rdiff -u -r1.13 -r1.14 src/sys/external/bsd/acpica/dist/executer/exdump.c
cvs rdiff -u -r1.19 -r1.20 \
    src/sys/external/bsd/acpica/dist/include/acglobal.h \
    src/sys/external/bsd/acpica/dist/include/aclocal.h \
    src/sys/external/bsd/acpica/dist/include/actypes.h \
    src/sys/external/bsd/acpica/dist/include/acutils.h
cvs rdiff -u -r1.16 -r1.17 \
    src/sys/external/bsd/acpica/dist/include/acnamesp.h
cvs rdiff -u -r1.13 -r1.14 \
    src/sys/external/bsd/acpica/dist/include/acpiosxf.h
cvs rdiff -u -r1.22 -r1.23 src/sys/external/bsd/acpica/dist/include/acpixf.h
cvs rdiff -u -r1.17 -r1.18 \
    src/sys/external/bsd/acpica/dist/namespace/nsaccess.c
cvs rdiff -u -r1.14 -r1.15 \
    src/sys/external/bsd/acpica/dist/namespace/nsdump.c \
    src/sys/external/bsd/acpica/dist/namespace/nseval.c
cvs rdiff -u -r1.16 -r1.17 \
    src/sys/external/bsd/acpica/dist/namespace/nsinit.c
cvs rdiff -u -r1.13 -r1.14 \
    src/sys/external/bsd/acpica/dist/namespace/nsrepair2.c
cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/acpica/dist/tables/tbdata.c
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/acpica/dist/tables/tbxfload.c
cvs rdiff -u -r1.11 -r1.12 \
    src/sys/external/bsd/acpica/dist/tools/acpidump/apfiles.c
cvs rdiff -u -r1.16 -r1.17 \
    src/sys/external/bsd/acpica/dist/utilities/utdebug.c
cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/acpica/dist/utilities/utosi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/acpica/dist/compiler/aslcompile.c
diff -u src/sys/external/bsd/acpica/dist/compiler/aslcompile.c:1.16 src/sys/external/bsd/acpica/dist/compiler/aslcompile.c:1.17
--- src/sys/external/bsd/acpica/dist/compiler/aslcompile.c:1.16	Sun Apr 28 21:18:06 2019
+++ src/sys/external/bsd/acpica/dist/compiler/aslcompile.c	Tue Oct 15 12:13:39 2019
@@ -116,7 +116,6 @@ CmDoCompile (
         if (AslGbl_PreprocessOnly)
         {
             UtEndEvent (Event);
-            CmCleanupAndExit ();
             return (AE_OK);
         }
     }
@@ -746,10 +745,11 @@ CmDumpAllEvents (
  *
  ******************************************************************************/
 
-void
+int
 CmCleanupAndExit (
     void)
 {
+    int                     Status = 0;
     BOOLEAN                 DeleteAmlFile = FALSE;
     ASL_GLOBAL_FILE_NODE    *CurrentFileNode = AslGbl_FilesList;
 
@@ -808,20 +808,38 @@ CmCleanupAndExit (
     UtDisplaySummary (ASL_FILE_STDOUT);
 
     /*
-     * We will delete the AML file if there are errors and the
-     * force AML output option has not been used.
+     * Delete the AML file if there are errors and the force AML output option
+     * (-f) has not been used.
+     *
+     * Return -1 as a status of the compiler if no AML files are generated. If
+     * the AML file is generated in the presence of errors, return 0. In the
+     * latter case, the errors were ignored by the user so the compilation is
+     * considered successful.
      */
-    if (AslGbl_ParserErrorDetected || ((AslGbl_ExceptionCount[ASL_ERROR] > 0) &&
+    if (AslGbl_ParserErrorDetected || AslGbl_PreprocessOnly ||
+        ((AslGbl_ExceptionCount[ASL_ERROR] > 0) &&
         (!AslGbl_IgnoreErrors) &&
         AslGbl_Files[ASL_FILE_AML_OUTPUT].Handle))
     {
         DeleteAmlFile = TRUE;
+        Status = -1;
     }
 
     /* Close all open files */
 
     while (CurrentFileNode)
     {
+        /*
+         * Set the program return status based on file errors. If there are any
+         * errors and during compilation, the command is not considered
+         * successful.
+         */
+        if (Status != -1 && !AslGbl_IgnoreErrors &&
+            CurrentFileNode->ParserErrorDetected)
+        {
+            Status = -1;
+        }
+
         switch  (FlSwitchFileSet (CurrentFileNode->Files[ASL_FILE_INPUT].Filename))
         {
             case SWITCH_TO_SAME_FILE:
@@ -845,6 +863,8 @@ CmCleanupAndExit (
     {
         UtDeleteLocalCaches ();
     }
+
+    return (Status);
 }
 
 

Index: src/sys/external/bsd/acpica/dist/compiler/aslcompiler.h
diff -u src/sys/external/bsd/acpica/dist/compiler/aslcompiler.h:1.14 src/sys/external/bsd/acpica/dist/compiler/aslcompiler.h:1.15
--- src/sys/external/bsd/acpica/dist/compiler/aslcompiler.h:1.14	Sun Apr 28 21:18:06 2019
+++ src/sys/external/bsd/acpica/dist/compiler/aslcompiler.h	Tue Oct 15 12:13:39 2019
@@ -158,7 +158,7 @@ void
 CmDoOutputFiles (
     void);
 
-void
+int
 CmCleanupAndExit (
     void);
 
@@ -944,6 +944,7 @@ void
 FlCloseFile (
     UINT32                  FileId);
 
+ACPI_PRINTF_LIKE (2)
 void
 FlPrintFile (
     UINT32                  FileId,
@@ -997,10 +998,6 @@ ASL_GLOBAL_FILE_NODE *
 FlGetCurrentFileNode (
     void);
 
-BOOLEAN
-FlInputFileExists (
-    char                    *InputFilename);
-
 
 /*
  * aslhwmap - hardware map summary
@@ -1091,6 +1088,7 @@ OtXrefWalkPart1 (
 /*
  * aslutils - common compiler utilities
  */
+ACPI_PRINTF_LIKE(2)
 void
 DbgPrint (
     UINT32                  Type,
@@ -1185,6 +1183,10 @@ UtInternalizeName (
     char                    *ExternalName,
     char                    **ConvertedName);
 
+BOOLEAN
+UtNameContainsAllPrefix (
+    ACPI_PARSE_OBJECT       *Op);
+
 void
 UtAttachNamepathToOwner (
     ACPI_PARSE_OBJECT       *Op,
@@ -1200,6 +1202,15 @@ UINT64
 UtDoConstant (
     char                    *String);
 
+char *
+AcpiUtStrdup (
+    char                    *String);
+
+char *
+AcpiUtStrcat (
+    char                    *String1,
+    char                    *String2);
+
 
 /*
  * asluuid - UUID support
@@ -1501,6 +1512,7 @@ DtCreateTemplates (
 /*
  * ASL/ASL+ converter debug
  */
+ACPI_PRINTF_LIKE (1)
 void
 CvDbgPrint (
     char                    *Fmt,
Index: src/sys/external/bsd/acpica/dist/compiler/aslload.c
diff -u src/sys/external/bsd/acpica/dist/compiler/aslload.c:1.14 src/sys/external/bsd/acpica/dist/compiler/aslload.c:1.15
--- src/sys/external/bsd/acpica/dist/compiler/aslload.c:1.14	Sun Apr 28 21:18:06 2019
+++ src/sys/external/bsd/acpica/dist/compiler/aslload.c	Tue Oct 15 12:13:39 2019
@@ -56,6 +56,7 @@
 
 static ACPI_STATUS
 LdLoadFieldElements (
+    UINT32                  AmlType,
     ACPI_PARSE_OBJECT       *Op,
     ACPI_WALK_STATE         *WalkState);
 
@@ -82,6 +83,10 @@ LdCommonNamespaceEnd (
     UINT32                  Level,
     void                    *Context);
 
+static void
+LdCheckSpecialNames (
+    ACPI_NAMESPACE_NODE     *Node,
+    ACPI_PARSE_OBJECT       *Op);
 
 /*******************************************************************************
  *
@@ -139,7 +144,8 @@ LdLoadNamespace (
  *
  * FUNCTION:    LdLoadFieldElements
  *
- * PARAMETERS:  Op              - Parent node (Field)
+ * PARAMETERS:  AmlType         - Type to search
+ *              Op              - Parent node (Field)
  *              WalkState       - Current walk state
  *
  * RETURN:      Status
@@ -151,14 +157,33 @@ LdLoadNamespace (
 
 static ACPI_STATUS
 LdLoadFieldElements (
+    UINT32                  AmlType,
     ACPI_PARSE_OBJECT       *Op,
     ACPI_WALK_STATE         *WalkState)
 {
     ACPI_PARSE_OBJECT       *Child = NULL;
+    ACPI_PARSE_OBJECT       *SourceRegion;
     ACPI_NAMESPACE_NODE     *Node;
     ACPI_STATUS             Status;
 
 
+    SourceRegion = UtGetArg (Op, 0);
+    if (SourceRegion)
+    {
+        Status = AcpiNsLookup (WalkState->ScopeInfo,
+            SourceRegion->Asl.Value.String,
+            AmlType, ACPI_IMODE_EXECUTE,
+            ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node);
+        if (Status == AE_NOT_FOUND)
+        {
+            /*
+             * If the named object is not found, it means that it is either a
+             * forward reference or the named object does not exist.
+             */
+            SourceRegion->Asl.CompileFlags |= OP_NOT_FOUND_DURING_LOAD;
+        }
+    }
+
     /* Get the first named field element */
 
     switch (Op->Asl.AmlOpcode)
@@ -380,12 +405,16 @@ LdNamespace1Begin (
      */
     switch (Op->Asl.AmlOpcode)
     {
-    case AML_BANK_FIELD_OP:
     case AML_INDEX_FIELD_OP:
+
+        Status = LdLoadFieldElements (ACPI_TYPE_LOCAL_REGION_FIELD, Op, WalkState);
+        return (Status);
+
+    case AML_BANK_FIELD_OP:
     case AML_FIELD_OP:
 
-        Status = LdLoadFieldElements (Op, WalkState);
-        break;
+        Status = LdLoadFieldElements (ACPI_TYPE_REGION, Op, WalkState);
+        return (Status);
 
     case AML_INT_CONNECTION_OP:
 
@@ -449,8 +478,7 @@ LdNamespace1Begin (
          * We only want references to named objects:
          *      Store (2, WXYZ) -> Attempt to resolve the name
          */
-        if ((OpInfo->Class == AML_CLASS_NAMED_OBJECT) &&
-            (OpInfo->Type != AML_TYPE_NAMED_FIELD))
+        if (OpInfo->Class == AML_CLASS_NAMED_OBJECT)
         {
             return (AE_OK);
         }
@@ -840,6 +868,10 @@ LdNamespace1Begin (
         }
     }
 
+    /* Check special names like _WAK and _PTS */
+
+    LdCheckSpecialNames (Node, Op);
+
     if (ForceNewScope)
     {
         Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
@@ -880,6 +912,50 @@ FinishNode:
 
 /*******************************************************************************
  *
+ * FUNCTION:    LdCheckSpecialNames
+ *
+ * PARAMETERS:  Node        - Node that represents the named object
+ *              Op          - Named object declaring this named object
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Check if certain named objects are declared in the incorrect
+ *              scope. Special named objects are listed in
+ *              AslGbl_SpecialNamedObjects and can only be declared at the root
+ *              scope. _UID inside of a processor declaration must not be a
+ *              string.
+ *
+ ******************************************************************************/
+
+static void
+LdCheckSpecialNames (
+    ACPI_NAMESPACE_NODE     *Node,
+    ACPI_PARSE_OBJECT       *Op)
+{
+    UINT32                  i;
+
+
+    for (i = 0; i < MAX_SPECIAL_NAMES; i++)
+    {
+        if (ACPI_COMPARE_NAMESEG(Node->Name.Ascii, AslGbl_SpecialNamedObjects[i]) &&
+            Node->Parent != AcpiGbl_RootNode)
+        {
+            AslError (ASL_ERROR, ASL_MSG_INVALID_SPECIAL_NAME, Op, Op->Asl.ExternalName);
+            return;
+        }
+    }
+
+    if (ACPI_COMPARE_NAMESEG (Node->Name.Ascii, "_UID") &&
+        Node->Parent->Type == ACPI_TYPE_PROCESSOR &&
+        Node->Type == ACPI_TYPE_STRING)
+    {
+        AslError (ASL_ERROR, ASL_MSG_INVALID_PROCESSOR_UID , Op, "found a string");
+    }
+}
+
+
+/*******************************************************************************
+ *
  * FUNCTION:    LdNamespace2Begin
  *
  * PARAMETERS:  ASL_WALK_CALLBACK
Index: src/sys/external/bsd/acpica/dist/compiler/aslxref.c
diff -u src/sys/external/bsd/acpica/dist/compiler/aslxref.c:1.14 src/sys/external/bsd/acpica/dist/compiler/aslxref.c:1.15
--- src/sys/external/bsd/acpica/dist/compiler/aslxref.c:1.14	Sun Apr 28 21:18:06 2019
+++ src/sys/external/bsd/acpica/dist/compiler/aslxref.c	Tue Oct 15 12:13:39 2019
@@ -352,6 +352,8 @@ XfNamespaceLocateBegin (
     ASL_METHOD_LOCAL        *MethodArgs = NULL;
     int                     RegisterNumber;
     UINT32                  i;
+    ACPI_NAMESPACE_NODE     *DeclarationParentMethod;
+    ACPI_PARSE_OBJECT       *ReferenceParentMethod;
 
 
     ACPI_FUNCTION_TRACE_PTR (XfNamespaceLocateBegin, Op);
@@ -505,8 +507,7 @@ XfNamespaceLocateBegin (
         (Op->Asl.ParseOpcode != PARSEOP_NAMESTRING) &&
         (Op->Asl.ParseOpcode != PARSEOP_NAMESEG)    &&
         (Op->Asl.ParseOpcode != PARSEOP_METHODCALL) &&
-        (Op->Asl.ParseOpcode != PARSEOP_EXTERNAL)   &&
-        (OpInfo->Type != AML_TYPE_NAMED_FIELD))
+        (Op->Asl.ParseOpcode != PARSEOP_EXTERNAL))
     {
         return_ACPI_STATUS (AE_OK);
     }
@@ -530,8 +531,7 @@ XfNamespaceLocateBegin (
     if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) ||
         (Op->Asl.ParseOpcode == PARSEOP_NAMESEG)    ||
         (Op->Asl.ParseOpcode == PARSEOP_METHODCALL) ||
-        (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL)   ||
-        (OpInfo->Type == AML_TYPE_NAMED_FIELD))
+        (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL))
     {
         /*
          * These are name references, do not push the scope stack
@@ -568,10 +568,6 @@ XfNamespaceLocateBegin (
 
         Path = NextOp->Asl.Value.String;
     }
-    else if (OpInfo->Type == AML_TYPE_NAMED_FIELD)
-    {
-        Path = Op->Asl.Child->Asl.Value.String;
-    }
     else
     {
         Path = Op->Asl.Value.String;
@@ -690,24 +686,45 @@ XfNamespaceLocateBegin (
         return_ACPI_STATUS (Status);
     }
 
-    /* Object was found above, check for an illegal forward reference */
+   /* Object was found above, check for an illegal forward reference */
 
     if (Op->Asl.CompileFlags & OP_NOT_FOUND_DURING_LOAD)
     {
         /*
          * During the load phase, this Op was flagged as a possible
-         * illegal forward reference
+         * illegal forward reference. In other words, Op is a name path or
+         * name segment that refers to a named object declared after the
+         * reference. In this scinario, Node refers to the actual declaration
+         * and Op is a parse node that references the named object.
          *
-         * Note: Allow "forward references" from within a method to an
-         * object that is not within any method (module-level code)
+         * Note:
+         *
+         * Object references inside of control methods are allowed to
+         * refer to objects declared outside of control methods.
+         *
+         * If the declaration and reference are both contained inside of the
+         * same method or outside of any method, this is a forward reference
+         * and should be reported as a compiler error.
          */
-        if (!WalkState->ScopeInfo || (UtGetParentMethod (Node) &&
-            !UtNodeIsDescendantOf (WalkState->ScopeInfo->Scope.Node,
-                UtGetParentMethod (Node))))
+        DeclarationParentMethod = UtGetParentMethod (Node);
+        ReferenceParentMethod = XfGetParentMethod (Op);
+
+        /* case 1: declaration and refrence are both outside of method */
+
+        if (!ReferenceParentMethod && !DeclarationParentMethod)
         {
             AslError (ASL_ERROR, ASL_MSG_ILLEGAL_FORWARD_REF, Op,
                 Op->Asl.ExternalName);
         }
+
+        /* case 2: declaration and reference are both inside of the same method */
+
+        else if (ReferenceParentMethod && DeclarationParentMethod &&
+            ReferenceParentMethod == DeclarationParentMethod->Op)
+        {
+             AslError (ASL_ERROR, ASL_MSG_ILLEGAL_FORWARD_REF, Op,
+                Op->Asl.ExternalName);
+        }
     }
 
     /* Check for a reference vs. name declaration */

Index: src/sys/external/bsd/acpica/dist/compiler/aslerror.c
diff -u src/sys/external/bsd/acpica/dist/compiler/aslerror.c:1.12 src/sys/external/bsd/acpica/dist/compiler/aslerror.c:1.13
--- src/sys/external/bsd/acpica/dist/compiler/aslerror.c:1.12	Sun Apr 28 21:18:06 2019
+++ src/sys/external/bsd/acpica/dist/compiler/aslerror.c	Tue Oct 15 12:13:39 2019
@@ -761,16 +761,8 @@ static void AslInitEnode (
             return;
         }
 
-	if (!FlInputFileExists (Filename))
-	{
-            /*
-             * This means that this file is an include file. Record the .src
-             * file as the error message source because this file is not in
-             * the global file list.
-             */
-            Enode->SourceFilename =
-                FileNode->Files[ASL_FILE_SOURCE_OUTPUT].Filename;
-	}
+        Enode->SourceFilename =
+            FileNode->Files[ASL_FILE_SOURCE_OUTPUT].Filename;
     }
 }
 
Index: src/sys/external/bsd/acpica/dist/compiler/aslwalks.c
diff -u src/sys/external/bsd/acpica/dist/compiler/aslwalks.c:1.12 src/sys/external/bsd/acpica/dist/compiler/aslwalks.c:1.13
--- src/sys/external/bsd/acpica/dist/compiler/aslwalks.c:1.12	Sun Apr 28 21:18:06 2019
+++ src/sys/external/bsd/acpica/dist/compiler/aslwalks.c	Tue Oct 15 12:13:39 2019
@@ -57,6 +57,14 @@ static void
 AnAnalyzeStoreOperator (
     ACPI_PARSE_OBJECT       *Op);
 
+static BOOLEAN
+AnIsValidBufferConstant (
+    ACPI_PARSE_OBJECT       *Op);
+
+static void
+AnValidateCreateBufferField (
+    ACPI_PARSE_OBJECT       *CreateBufferFieldOp);
+
 
 /*******************************************************************************
  *
@@ -561,6 +569,14 @@ AnOtherSemanticAnalysisWalkBegin (
     OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
 
 
+    if (OpInfo->Flags & AML_CREATE)
+    {
+        /* This group contains all of the Create Buffer Field operators */
+
+        AnValidateCreateBufferField (Op);
+        return (AE_OK);
+    }
+
     /*
      * Determine if an execution class operator actually does something by
      * checking if it has a target and/or the function return value is used.
@@ -626,10 +642,10 @@ AnOtherSemanticAnalysisWalkBegin (
         }
     }
 
-
     /*
      * Semantic checks for individual ASL operators
      */
+
     switch (Op->Asl.ParseOpcode)
     {
     case PARSEOP_STORE:
@@ -677,22 +693,6 @@ AnOtherSemanticAnalysisWalkBegin (
         }
         break;
 
-    case PARSEOP_CREATEFIELD:
-        /*
-         * Check for a zero Length (NumBits) operand. NumBits is the 3rd operand
-         */
-        ArgOp = Op->Asl.Child;
-        ArgOp = ArgOp->Asl.Next;
-        ArgOp = ArgOp->Asl.Next;
-
-        if ((ArgOp->Asl.ParseOpcode == PARSEOP_ZERO) ||
-           ((ArgOp->Asl.ParseOpcode == PARSEOP_INTEGER) &&
-            (ArgOp->Asl.Value.Integer == 0)))
-        {
-            AslError (ASL_ERROR, ASL_MSG_NON_ZERO, ArgOp, NULL);
-        }
-        break;
-
     case PARSEOP_CONNECTION:
         /*
          * Ensure that the referenced operation region has the correct SPACE_ID.
@@ -780,6 +780,194 @@ AnOtherSemanticAnalysisWalkBegin (
 
 /*******************************************************************************
  *
+ * FUNCTION:    AnValidateCreateBufferField
+ *
+ * PARAMETERS:  Op                  - A create buffer field operator
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Check if a buffer index argument to a create buffer field
+ *              operation is beyond the end of the target buffer.
+ *
+ *  Validates these AML operators:
+ *
+ *  AML_CREATE_FIELD_OP
+ *  AML_CREATE_BIT_FIELD_OP
+ *  AML_CREATE_BYTE_FIELD_OP
+ *  AML_CREATE_WORD_FIELD_OP
+ *  AML_CREATE_DWORD_FIELD_OP
+ *  AML_CREATE_QWORD_FIELD_OP
+ *
+ *  There are two conditions that must be satisfied in order to enable
+ *  validation at compile time:
+ *
+ *  1) The length of the target buffer must be an integer constant
+ *  2) The index specified in the create* must be an integer constant
+ *  3) For CreateField, the bit length argument must be non-zero.
+ *
+ ******************************************************************************/
+
+static void
+AnValidateCreateBufferField (
+    ACPI_PARSE_OBJECT       *CreateBufferFieldOp)
+{
+    ACPI_PARSE_OBJECT       *TargetBufferOp;
+    ACPI_PARSE_OBJECT       *ArgOp;
+    UINT32                  TargetBufferLength;
+    UINT32                  LastFieldByteIndex;
+
+
+    /*
+     * 1) Get the length of the target buffer
+     */
+    ArgOp = CreateBufferFieldOp->Asl.Child;     /* Reference to target buffer */
+
+    /*
+     * If no attached Node, the target buffer may be something like an
+     * ArgX or LocalX and cannot be evaluated at compile time.
+     */
+    if (!ArgOp->Asl.Node)
+    {
+        return;
+    }
+
+    TargetBufferOp = ArgOp->Asl.Node->Op;
+    TargetBufferOp = TargetBufferOp->Asl.Child; /* Target buffer */
+    TargetBufferOp = TargetBufferOp->Asl.Next;  /* "Buffer" keyword */
+    if (!TargetBufferOp)
+    {
+        /* Not a statement of the form NAME(XXXX, Buffer.... */
+
+        return;
+    }
+
+    /* Get the buffer length argument. It must be an integer constant */
+
+    ArgOp = TargetBufferOp->Asl.Child;
+    if (!AnIsValidBufferConstant (ArgOp))
+    {
+        return;
+    }
+
+    TargetBufferLength = (UINT32) ArgOp->Asl.Value.Integer;
+
+    /*
+     * 2) Get the value of the buffer index argument. It must be
+     * an integer constant.
+     */
+    ArgOp = CreateBufferFieldOp->Asl.Child;     /* Reference to target buffer */
+    ArgOp = ArgOp->Asl.Next;                    /* Buffer Index argument*/
+    if (!AnIsValidBufferConstant (ArgOp))
+    {
+        return;
+    }
+
+    LastFieldByteIndex =
+        (UINT32) ArgOp->Asl.Value.Integer;      /* Index can be in either bytes or bits */
+
+    /*
+     * 3) Get the length of the new buffer field, in bytes. Also,
+     * create the final target buffer index for the last byte of the field
+     */
+    switch (CreateBufferFieldOp->Asl.ParseOpcode)
+    {
+    case PARSEOP_CREATEBITFIELD:                /* A one bit field */
+
+        LastFieldByteIndex = ACPI_ROUND_BITS_DOWN_TO_BYTES (LastFieldByteIndex);
+        break;
+
+    case PARSEOP_CREATEBYTEFIELD:
+        break;
+
+    case PARSEOP_CREATEWORDFIELD:
+
+        LastFieldByteIndex += (sizeof (UINT16) - 1);
+        break;
+
+    case PARSEOP_CREATEDWORDFIELD:
+
+        LastFieldByteIndex += (sizeof (UINT32) - 1);
+        break;
+
+    case PARSEOP_CREATEQWORDFIELD:
+
+        LastFieldByteIndex += (sizeof (UINT64) - 1);
+        break;
+
+    case PARSEOP_CREATEFIELD:                   /* Multi-bit field */
+
+        ArgOp = ArgOp->Asl.Next;                /* Length argument, in bits */
+        if (!AnIsValidBufferConstant (ArgOp))
+        {
+            return;
+        }
+
+        /* The buffer field length is not allowed to be zero */
+
+        if (ArgOp->Asl.Value.Integer == 0)
+        {
+            AslError (ASL_WARNING,  ASL_MSG_BUFFER_FIELD_LENGTH, ArgOp, NULL);
+            return;
+        }
+
+        LastFieldByteIndex +=
+            ((UINT32) ArgOp->Asl.Value.Integer - 1);    /* Create final bit index */
+
+        /* Convert bit index to a byte index */
+
+        LastFieldByteIndex = ACPI_ROUND_BITS_DOWN_TO_BYTES (LastFieldByteIndex);
+        break;
+
+    default:
+        return;
+    }
+
+    /*
+     * 4) Check for an access (index) beyond the end of the target buffer,
+     * or a zero length target buffer.
+     */
+    if (!TargetBufferLength || (LastFieldByteIndex >= TargetBufferLength))
+    {
+        AslError (ASL_WARNING, ASL_MSG_BUFFER_FIELD_OVERFLOW, ArgOp, NULL);
+    }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AnIsValidBufferConstant
+ *
+ * PARAMETERS:  Op                  - A buffer-related operand
+ *
+ * RETURN:      TRUE if operand is valid constant, FALSE otherwise
+ *
+ * DESCRIPTION: Check if the input Op is valid constant that can be used
+ *              in compile-time analysis.
+ *
+ ******************************************************************************/
+
+static BOOLEAN
+AnIsValidBufferConstant (
+    ACPI_PARSE_OBJECT       *Op)
+{
+    if (!Op)
+    {
+        return (FALSE);
+    }
+
+    if ((Op->Asl.ParseOpcode == PARSEOP_INTEGER) ||
+        (Op->Asl.ParseOpcode == PARSEOP_ZERO)    ||
+        (Op->Asl.ParseOpcode == PARSEOP_ONE))
+    {
+        return (TRUE);
+    }
+
+    return (FALSE);
+}
+
+
+/*******************************************************************************
+ *
  * FUNCTION:    AnAnalyzeStoreOperator
  *
  * PARAMETERS:  Op                  - Store() operator

Index: src/sys/external/bsd/acpica/dist/compiler/aslfiles.c
diff -u src/sys/external/bsd/acpica/dist/compiler/aslfiles.c:1.13 src/sys/external/bsd/acpica/dist/compiler/aslfiles.c:1.14
--- src/sys/external/bsd/acpica/dist/compiler/aslfiles.c:1.13	Sun Apr 28 21:18:06 2019
+++ src/sys/external/bsd/acpica/dist/compiler/aslfiles.c	Tue Oct 15 12:13:39 2019
@@ -55,6 +55,10 @@ FlOpenIncludeWithPrefix (
     ACPI_PARSE_OBJECT       *Op,
     char                    *Filename);
 
+static BOOLEAN
+FlInputFileExists (
+    char                    *InputFilename);
+
 #ifdef ACPI_OBSOLETE_FUNCTIONS
 ACPI_STATUS
 FlParseInputPathname (
@@ -142,7 +146,7 @@ FlInitOneFile (
  *
  ******************************************************************************/
 
-BOOLEAN
+static BOOLEAN
 FlInputFileExists (
     char                    *Filename)
 {
Index: src/sys/external/bsd/acpica/dist/compiler/aslsupport.l
diff -u src/sys/external/bsd/acpica/dist/compiler/aslsupport.l:1.13 src/sys/external/bsd/acpica/dist/compiler/aslsupport.l:1.14
--- src/sys/external/bsd/acpica/dist/compiler/aslsupport.l:1.13	Sun Apr 28 21:18:06 2019
+++ src/sys/external/bsd/acpica/dist/compiler/aslsupport.l	Tue Oct 15 12:13:39 2019
@@ -112,7 +112,7 @@ AslDoLineDirective (
 
     while ((c = input()) != '\n' && c != EOF)
     {
-        *AslGbl_LineBufPtr = c;
+        *AslGbl_LineBufPtr = (char) c;
         AslGbl_LineBufPtr++;
     }
     *AslGbl_LineBufPtr = 0;
@@ -390,7 +390,7 @@ AslInsertLineBuffer (
 
         if (AcpiGbl_CaptureComments)
         {
-            CvProcessCommentState (SourceChar);
+            CvProcessCommentState ((char) SourceChar);
         }
     }
 }
@@ -493,7 +493,7 @@ loop:
         AslInsertLineBuffer (c);
         if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
         {
-            *StringBuffer = c;
+            *StringBuffer = (char) c;
             ++StringBuffer;
         }
         c1 = c;
@@ -521,7 +521,7 @@ loop:
     AslInsertLineBuffer (c);
     if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
     {
-        *StringBuffer = c;
+        *StringBuffer = (char) c;
         ++StringBuffer;
     }
 
@@ -612,7 +612,7 @@ AslDoCommentType2 (
         AslInsertLineBuffer (c);
         if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
         {
-            *StringBuffer = c;
+            *StringBuffer = (char) c;
             ++StringBuffer;
         }
     }
@@ -770,7 +770,7 @@ DoCharacter:
                 if (ACPI_IS_OCTAL_DIGIT (StringChar))
                 {
                     State = ASL_OCTAL_CONSTANT;
-                    ConvertBuffer[0] = StringChar;
+                    ConvertBuffer[0] = (char) StringChar;
                     i = 1;
                     continue;
                 }
@@ -826,7 +826,7 @@ DoCharacter:
 
             /* Append another digit of the constant */
 
-            ConvertBuffer[i] = StringChar;
+            ConvertBuffer[i] = (char) StringChar;
             i++;
             continue;
 
@@ -870,7 +870,7 @@ DoCharacter:
 
             /* Append another digit of the constant */
 
-            ConvertBuffer[i] = StringChar;
+            ConvertBuffer[i] = (char) StringChar;
             i++;
             continue;
 
@@ -881,7 +881,7 @@ DoCharacter:
 
         /* Save the finished character */
 
-        *StringBuffer = StringChar;
+        *StringBuffer = (char) StringChar;
         StringBuffer++;
         if (StringBuffer >= EndBuffer)
         {
Index: src/sys/external/bsd/acpica/dist/compiler/dtcompile.c
diff -u src/sys/external/bsd/acpica/dist/compiler/dtcompile.c:1.13 src/sys/external/bsd/acpica/dist/compiler/dtcompile.c:1.14
--- src/sys/external/bsd/acpica/dist/compiler/dtcompile.c:1.13	Sun Apr 28 21:18:06 2019
+++ src/sys/external/bsd/acpica/dist/compiler/dtcompile.c	Tue Oct 15 12:13:39 2019
@@ -53,7 +53,7 @@ static char                 VersionStrin
 
 /* Local prototypes */
 
-static ACPI_STATUS
+void
 DtInitialize (
     void);
 
@@ -88,16 +88,12 @@ DtDoCompile (
     ACPI_STATUS             Status;
     UINT8                   Event;
     DT_FIELD                *FieldList;
+    ASL_GLOBAL_FILE_NODE    *FileNode;
 
 
     /* Initialize globals */
 
-    Status = DtInitialize ();
-    if (ACPI_FAILURE (Status))
-    {
-        printf ("Error during compiler initialization, 0x%X\n", Status);
-        return (Status);
-    }
+    DtInitialize ();
 
     /* Preprocessor */
 
@@ -115,13 +111,29 @@ DtDoCompile (
         }
     }
 
-    /*
-     * Scan the input file (file is already open) and
-     * build the parse tree
-     */
-    Event = UtBeginEvent ("Scan and parse input file");
-    FieldList = DtScanFile (AslGbl_Files[ASL_FILE_INPUT].Handle);
-    UtEndEvent (Event);
+    /* Compile the parse tree */
+
+    if (AslGbl_DtLexBisonPrototype)
+    {
+        Event = UtBeginEvent ("Parse data table in prototype mode");
+
+        DtCompilerInitLexer (AslGbl_Files[ASL_FILE_INPUT].Handle);
+        DtCompilerParserparse ();
+        FieldList = AslGbl_FieldList;
+        DtCompilerTerminateLexer ();
+
+        UtEndEvent (Event);
+    }
+    else
+    {
+        /*
+         * Scan the input file (file is already open) and
+         * build the parse tree
+         */
+        Event = UtBeginEvent ("Scan and parse input file");
+        FieldList = DtScanFile (AslGbl_Files[ASL_FILE_INPUT].Handle);
+        UtEndEvent (Event);
+    }
 
     /* Did the parse tree get successfully constructed? */
 
@@ -137,14 +149,27 @@ DtDoCompile (
 
     Event = UtBeginEvent ("Compile parse tree");
 
-    /*
-     * Compile the parse tree
-     */
     Status = DtCompileDataTable (&FieldList);
     UtEndEvent (Event);
 
+    FileNode = FlGetCurrentFileNode ();
+    if (!FileNode)
+    {
+        fprintf (stderr, "Summary for %s could not be generated",
+            AslGbl_Files[ASL_FILE_INPUT].Filename);
+    }
+    else
+    {
+        FileNode->TotalLineCount = AslGbl_CurrentLineNumber;
+        FileNode->OriginalInputFileSize = AslGbl_InputByteCount;
+        DbgPrint (ASL_PARSE_OUTPUT, "Line count: %u input file size: %u\n",
+                FileNode->TotalLineCount, FileNode->OriginalInputFileSize);
+    }
+
     if (ACPI_FAILURE (Status))
     {
+        FileNode->ParserErrorDetected = TRUE;
+
         /* TBD: temporary error message. Msgs should come from function above */
 
         DtError (ASL_ERROR, ASL_MSG_SYNTAX, NULL,
@@ -168,6 +193,14 @@ DtDoCompile (
     HxDoHexOutput ();
     DtWriteTableToListing ();
 
+    /* Save the compile time statistics to the current file node */
+
+    if (FileNode)
+    {
+        FileNode->TotalFields = AslGbl_InputFieldCount;
+        FileNode->OutputByteLength = AslGbl_TableLength;
+    }
+
     return (Status);
 }
 
@@ -185,25 +218,12 @@ DtDoCompile (
  *
  *****************************************************************************/
 
-static ACPI_STATUS
+void
 DtInitialize (
     void)
 {
-    ACPI_STATUS             Status;
 
 
-    Status = AcpiOsInitialize ();
-    if (ACPI_FAILURE (Status))
-    {
-        return (Status);
-    }
-
-    Status = AcpiUtInitGlobals ();
-    if (ACPI_FAILURE (Status))
-    {
-        return (Status);
-    }
-
     AcpiUtSetIntegerWidth (2); /* Set width to 64 bits */
 
     AslGbl_FieldList = NULL;
@@ -212,7 +232,7 @@ DtInitialize (
 
     snprintf (VersionString, sizeof(VersionString), "%X",
 	(UINT32) ACPI_CA_VERSION);
-    return (AE_OK);
+    return;
 }
 
 
Index: src/sys/external/bsd/acpica/dist/compiler/dtfield.c
diff -u src/sys/external/bsd/acpica/dist/compiler/dtfield.c:1.13 src/sys/external/bsd/acpica/dist/compiler/dtfield.c:1.14
--- src/sys/external/bsd/acpica/dist/compiler/dtfield.c:1.13	Sun Apr 28 21:18:06 2019
+++ src/sys/external/bsd/acpica/dist/compiler/dtfield.c	Tue Oct 15 12:13:39 2019
@@ -172,7 +172,9 @@ DtCompileString (
 
     if (Length > ByteLength)
     {
-        snprintf (AslGbl_MsgBuffer, sizeof(AslGbl_MsgBuffer), "Maximum %u characters", ByteLength);
+        snprintf (AslGbl_MsgBuffer, sizeof(AslGbl_MsgBuffer),
+            "Maximum %u characters, found %u characters [%s]",
+            ByteLength, Length, Field->Value);
         DtError (ASL_ERROR, ASL_MSG_STRING_LENGTH, Field, AslGbl_MsgBuffer);
         Length = ByteLength;
     }

Index: src/sys/external/bsd/acpica/dist/compiler/asloptions.c
diff -u src/sys/external/bsd/acpica/dist/compiler/asloptions.c:1.10 src/sys/external/bsd/acpica/dist/compiler/asloptions.c:1.11
--- src/sys/external/bsd/acpica/dist/compiler/asloptions.c:1.10	Sun Apr 28 21:18:06 2019
+++ src/sys/external/bsd/acpica/dist/compiler/asloptions.c	Tue Oct 15 12:13:39 2019
@@ -729,6 +729,11 @@ AslDoOptions (
             AslGbl_HexOutputFlag = HEX_OUTPUT_C;
             break;
 
+    case 'p': /* data table flex/bison prototype */
+
+            AslGbl_DtLexBisonPrototype = TRUE;
+            break;
+
         case 's':
 
             AslGbl_HexOutputFlag = HEX_OUTPUT_ASL;

Index: src/sys/external/bsd/acpica/dist/compiler/aslutils.c
diff -u src/sys/external/bsd/acpica/dist/compiler/aslutils.c:1.23 src/sys/external/bsd/acpica/dist/compiler/aslutils.c:1.24
--- src/sys/external/bsd/acpica/dist/compiler/aslutils.c:1.23	Sun Apr 28 21:18:06 2019
+++ src/sys/external/bsd/acpica/dist/compiler/aslutils.c	Tue Oct 15 12:13:39 2019
@@ -115,6 +115,7 @@ UtQueryForOverwrite (
     char                    *Pathname)
 {
     struct stat             StatInfo;
+    int                     InChar = 0x34;
 
 
     if (!stat (Pathname, &StatInfo))
@@ -122,7 +123,13 @@ UtQueryForOverwrite (
         fprintf (stderr, "Target file \"%s\" already exists, overwrite? [y|n] ",
             Pathname);
 
-        if (getchar () != 'y')
+        InChar = fgetc (stdin);
+        if (InChar == '\n')
+        {
+            InChar = fgetc (stdin);
+        }
+
+        if ((InChar != 'y') && (InChar != 'Y'))
         {
             return (FALSE);
         }
@@ -433,8 +440,14 @@ UtDisplayOneSummary (
 {
     UINT32                  i;
     ASL_GLOBAL_FILE_NODE    *FileNode;
+    BOOLEAN                 DisplayAMLSummary;
 
 
+    DisplayAMLSummary =
+        !AslGbl_PreprocessOnly && !AslGbl_ParserErrorDetected &&
+        ((AslGbl_ExceptionCount[ASL_ERROR] == 0) || AslGbl_IgnoreErrors) &&
+        AslGbl_Files[ASL_FILE_AML_OUTPUT].Handle;
+
     if (FileId != ASL_FILE_STDOUT)
     {
         /* Compiler name and version number */
@@ -445,60 +458,54 @@ UtDisplayOneSummary (
 
     /* Summary of main input and output files */
 
-    if (AslGbl_FileType == ASL_INPUT_TYPE_ASCII_DATA)
+    FileNode = FlGetCurrentFileNode ();
+    if (!FileNode)
+    {
+        fprintf (stderr, "Summary could not be generated");
+        return;
+    }
+
+    if (FileNode->ParserErrorDetected)
     {
         FlPrintFile (FileId,
-            "%-14s %s - %u lines, %u bytes, %u fields\n",
+            "%-14s %s - Compilation aborted due to parser-detected syntax error(s)\n",
+            "Input file:", AslGbl_Files[ASL_FILE_INPUT].Filename);
+    }
+    else if (FileNode->FileType == ASL_INPUT_TYPE_ASCII_DATA)
+    {
+        FlPrintFile (FileId,
+            "%-14s %s - %7u bytes %6u fields %8u source lines\n",
             "Table Input:",
-            AslGbl_Files[ASL_FILE_INPUT].Filename, AslGbl_CurrentLineNumber,
-            AslGbl_InputByteCount, AslGbl_InputFieldCount);
+            AslGbl_Files[ASL_FILE_INPUT].Filename,
+            FileNode->OriginalInputFileSize, FileNode->TotalFields,
+            FileNode->TotalLineCount);
 
-        if ((AslGbl_ExceptionCount[ASL_ERROR] == 0) || (AslGbl_IgnoreErrors))
-        {
-            FlPrintFile (FileId,
-                "%-14s %s - %u bytes\n",
-                "Binary Output:",
-                AslGbl_Files[ASL_FILE_AML_OUTPUT].Filename, AslGbl_TableLength);
-        }
+        FlPrintFile (FileId,
+            "%-14s %s - %7u bytes\n",
+            "Binary Output:",
+            AslGbl_Files[ASL_FILE_AML_OUTPUT].Filename, FileNode->OutputByteLength);
     }
-    else
+    else if (FileNode->FileType == ASL_INPUT_TYPE_ASCII_ASL)
     {
-        FileNode = FlGetCurrentFileNode ();
-        if (!FileNode)
-        {
-            fprintf (stderr, "Summary could not be generated");
-            return;
-        }
-        if (FileNode->ParserErrorDetected)
-        {
-            FlPrintFile (FileId,
-                "%-14s %s - Compilation aborted due to parser-detected syntax error(s)\n",
-                "ASL Input:", AslGbl_Files[ASL_FILE_INPUT].Filename);
-        }
-        else
+        FlPrintFile (FileId,
+            "%-14s %s - %7u bytes %6u keywords %6u source lines\n",
+            "ASL Input:",
+            AslGbl_Files[ASL_FILE_INPUT].Filename,
+            FileNode->OriginalInputFileSize,
+            FileNode->TotalKeywords,
+            FileNode->TotalLineCount);
+
+        /* AML summary */
+
+        if (DisplayAMLSummary)
         {
             FlPrintFile (FileId,
-                "%-14s %s - %7u bytes %6u keywords %6u source lines\n",
-                "ASL Input:",
-                AslGbl_Files[ASL_FILE_INPUT].Filename,
-                FileNode->OriginalInputFileSize,
-                FileNode->TotalKeywords,
-                FileNode->TotalLineCount);
-
-            /* AML summary */
-
-            if (!AslGbl_ParserErrorDetected &&
-                ((AslGbl_ExceptionCount[ASL_ERROR] == 0) || AslGbl_IgnoreErrors) &&
-                AslGbl_Files[ASL_FILE_AML_OUTPUT].Handle)
-            {
-                FlPrintFile (FileId,
-                    "%-14s %s - %7u bytes %6u opcodes  %6u named objects\n",
-                    "AML Output:",
-                    AslGbl_Files[ASL_FILE_AML_OUTPUT].Filename,
-                    FlGetFileSize (ASL_FILE_AML_OUTPUT),
-                    FileNode->TotalExecutableOpcodes,
-                    FileNode->TotalNamedObjects);
-            }
+                "%-14s %s - %7u bytes %6u opcodes  %6u named objects\n",
+                "AML Output:",
+                AslGbl_Files[ASL_FILE_AML_OUTPUT].Filename,
+                FlGetFileSize (ASL_FILE_AML_OUTPUT),
+                FileNode->TotalExecutableOpcodes,
+                FileNode->TotalNamedObjects);
         }
     }
 
@@ -525,7 +532,7 @@ UtDisplayOneSummary (
             continue;
         }
 
-        FlPrintFile (FileId, "%14s %s - %u bytes\n",
+        FlPrintFile (FileId, "%-14s %s - %7u bytes\n",
             AslGbl_FileDescs[i].ShortDescription,
             AslGbl_Files[i].Filename, FlGetFileSize (i));
     }
@@ -882,6 +889,37 @@ UtAttachNamepathToOwner (
 
 /*******************************************************************************
  *
+ * FUNCTION:    UtNameContainsAllPrefix
+ *
+ * PARAMETERS:  Op                  - Op containing NameString
+ *
+ * RETURN:      NameString consists of all ^ characters
+ *
+ * DESCRIPTION: Determine if this Op contains a name segment that consists of
+ *              all '^' characters.
+ *
+ ******************************************************************************/
+
+BOOLEAN
+UtNameContainsAllPrefix (
+    ACPI_PARSE_OBJECT       *Op)
+{
+    UINT32                  Length = Op->Asl.AmlLength;
+    UINT32                  i;
+
+    for (i = 0; i < Length; i++)
+    {
+        if (Op->Asl.Value.String[i] != '^')
+        {
+            return (FALSE);
+        }
+    }
+
+    return (TRUE);
+}
+
+/*******************************************************************************
+ *
  * FUNCTION:    UtDoConstant
  *
  * PARAMETERS:  String              - Hex/Decimal/Octal
@@ -914,3 +952,56 @@ UtDoConstant (
 
     return (ConvertedInteger);
 }
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    AcpiUtStrdup
+ *
+ * PARAMETERS:  String1             - string to duplicate
+ *
+ * RETURN:      int that signifies string relationship. Zero means strings
+ *              are equal.
+ *
+ * DESCRIPTION: Duplicate the string using UtCacheAlloc to avoid manual memory
+ *              reclamation.
+ *
+ ******************************************************************************/
+
+char *
+AcpiUtStrdup (
+    char                    *String)
+{
+    char                    *NewString = (char *) UtLocalCalloc (strlen (String) + 1);
+
+
+    strcpy (NewString, String);
+    return (NewString);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    AcpiUtStrcat
+ *
+ * PARAMETERS:  String1
+ *              String2
+ *
+ * RETURN:      New string with String1 concatenated with String2
+ *
+ * DESCRIPTION: Concatenate string1 and string2
+ *
+ ******************************************************************************/
+
+char *
+AcpiUtStrcat (
+    char                    *String1,
+    char                    *String2)
+{
+    UINT32                  String1Length = strlen (String1);
+    char                    *NewString = (char *) UtLocalCalloc (strlen (String1) + strlen (String2) + 1);
+
+    strcpy (NewString, String1);
+    strcpy (NewString + String1Length, String2);
+    return (NewString);
+}

Index: src/sys/external/bsd/acpica/dist/compiler/dtcompilerparser.y
diff -u src/sys/external/bsd/acpica/dist/compiler/dtcompilerparser.y:1.1.1.1 src/sys/external/bsd/acpica/dist/compiler/dtcompilerparser.y:1.2
--- src/sys/external/bsd/acpica/dist/compiler/dtcompilerparser.y:1.1.1.1	Tue Oct 15 12:07:23 2019
+++ src/sys/external/bsd/acpica/dist/compiler/dtcompilerparser.y	Tue Oct 15 12:13:39 2019
@@ -57,7 +57,11 @@ void *                      AslLocalAllo
 
 int                         DtCompilerParserlex (void);
 int                         DtCompilerParserparse (void);
-void                        DtCompilerParsererror (char const *msg);
+void                        DtCompilerParsererror (
+#ifdef YYBYACC
+				    YYLTYPE *loc,
+#endif
+				    char const *msg);
 extern char                 *DtCompilerParsertext;
 extern DT_FIELD             *AslGbl_CurrentField;
 
@@ -166,6 +170,9 @@ Datum
 
 void
 DtCompilerParsererror (
+#ifdef YYBYACC
+    YYLTYPE *loc,
+#endif
     char const              *Message)
 {
     DtError (ASL_ERROR, ASL_MSG_SYNTAX,

Index: src/sys/external/bsd/acpica/dist/debugger/dbinput.c
diff -u src/sys/external/bsd/acpica/dist/debugger/dbinput.c:1.18 src/sys/external/bsd/acpica/dist/debugger/dbinput.c:1.19
--- src/sys/external/bsd/acpica/dist/debugger/dbinput.c:1.18	Sun Apr 28 21:18:06 2019
+++ src/sys/external/bsd/acpica/dist/debugger/dbinput.c	Tue Oct 15 12:13:39 2019
@@ -677,7 +677,7 @@ AcpiDbGetLine (
     {
         AcpiOsPrintf (
             "Buffer overflow while parsing input line (max %u characters)\n",
-            sizeof (AcpiGbl_DbParsedBuf));
+            (UINT32) sizeof (AcpiGbl_DbParsedBuf));
         return (0);
     }
 
@@ -952,10 +952,10 @@ AcpiDbCommandDispatch (
         if (ParamCount == 0)
         {
             AcpiOsPrintf (
-                "Current debug level for file output is:    %8.8lX\n",
+                "Current debug level for file output is:    %8.8X\n",
                 AcpiGbl_DbDebugLevel);
             AcpiOsPrintf (
-                "Current debug level for console output is: %8.8lX\n",
+                "Current debug level for console output is: %8.8X\n",
                 AcpiGbl_DbConsoleDebugLevel);
         }
         else if (ParamCount == 2)
@@ -964,7 +964,7 @@ AcpiDbCommandDispatch (
             AcpiGbl_DbConsoleDebugLevel =
                 strtoul (AcpiGbl_DbArgs[1], NULL, 16);
             AcpiOsPrintf (
-                "Debug Level for console output was %8.8lX, now %8.8lX\n",
+                "Debug Level for console output was %8.8X, now %8.8X\n",
                 Temp, AcpiGbl_DbConsoleDebugLevel);
         }
         else
@@ -972,7 +972,7 @@ AcpiDbCommandDispatch (
             Temp = AcpiGbl_DbDebugLevel;
             AcpiGbl_DbDebugLevel = strtoul (AcpiGbl_DbArgs[1], NULL, 16);
             AcpiOsPrintf (
-                "Debug Level for file output was %8.8lX, now %8.8lX\n",
+                "Debug Level for file output was %8.8X, now %8.8X\n",
                 Temp, AcpiGbl_DbDebugLevel);
         }
         break;

Index: src/sys/external/bsd/acpica/dist/debugger/dbmethod.c
diff -u src/sys/external/bsd/acpica/dist/debugger/dbmethod.c:1.12 src/sys/external/bsd/acpica/dist/debugger/dbmethod.c:1.13
--- src/sys/external/bsd/acpica/dist/debugger/dbmethod.c:1.12	Sun Apr 28 21:18:06 2019
+++ src/sys/external/bsd/acpica/dist/debugger/dbmethod.c	Tue Oct 15 12:13:39 2019
@@ -385,6 +385,11 @@ AcpiDbDisassembleMethod (
     }
 
     Status = AcpiUtAllocateOwnerId (&ObjDesc->Method.OwnerId);
+    if (ACPI_FAILURE(Status))
+    {
+        return (Status);
+    }
+
     WalkState->OwnerId = ObjDesc->Method.OwnerId;
 
     /* Push start scope on scope stack and make it current */

Index: src/sys/external/bsd/acpica/dist/events/evxface.c
diff -u src/sys/external/bsd/acpica/dist/events/evxface.c:1.11 src/sys/external/bsd/acpica/dist/events/evxface.c:1.12
--- src/sys/external/bsd/acpica/dist/events/evxface.c:1.11	Sun Apr 28 21:18:06 2019
+++ src/sys/external/bsd/acpica/dist/events/evxface.c	Tue Oct 15 12:13:39 2019
@@ -1148,7 +1148,7 @@ AcpiRemoveGpeHandler (
             ACPI_GPE_DISPATCH_NOTIFY)) &&
         Handler->OriginallyEnabled)
     {
-        (void) AcpiEvAddGpeReference (GpeEventInfo);
+        (void) AcpiEvAddGpeReference (GpeEventInfo, FALSE);
         if (ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo))
         {
             /* Poll edge triggered GPEs to handle existing events */

Index: src/sys/external/bsd/acpica/dist/executer/exconfig.c
diff -u src/sys/external/bsd/acpica/dist/executer/exconfig.c:1.14 src/sys/external/bsd/acpica/dist/executer/exconfig.c:1.15
--- src/sys/external/bsd/acpica/dist/executer/exconfig.c:1.14	Sun Apr 28 21:18:07 2019
+++ src/sys/external/bsd/acpica/dist/executer/exconfig.c	Tue Oct 15 12:13:39 2019
@@ -233,10 +233,11 @@ AcpiExLoadTableOp (
         return_ACPI_STATUS (Status);
     }
 
-    /* Complete the initialization/resolution of package objects */
+    /* Complete the initialization/resolution of new objects */
 
-    Status = AcpiNsWalkNamespace (ACPI_TYPE_PACKAGE, ACPI_ROOT_OBJECT,
-        ACPI_UINT32_MAX, 0, AcpiNsInitOnePackage, NULL, NULL, NULL);
+    AcpiExExitInterpreter();
+    AcpiNsInitializeObjects();
+    AcpiExEnterInterpreter();
 
     /* Parameter Data (optional) */
 
@@ -511,10 +512,11 @@ AcpiExLoadOp (
         return_ACPI_STATUS (Status);
     }
 
-    /* Complete the initialization/resolution of package objects */
+    /* Complete the initialization/resolution of new objects */
 
-    Status = AcpiNsWalkNamespace (ACPI_TYPE_PACKAGE, ACPI_ROOT_OBJECT,
-        ACPI_UINT32_MAX, 0, AcpiNsInitOnePackage, NULL, NULL, NULL);
+    AcpiExExitInterpreter ();
+    AcpiNsInitializeObjects ();
+    AcpiExEnterInterpreter ();
 
     /* Store the DdbHandle into the Target operand */
 

Index: src/sys/external/bsd/acpica/dist/executer/exdump.c
diff -u src/sys/external/bsd/acpica/dist/executer/exdump.c:1.13 src/sys/external/bsd/acpica/dist/executer/exdump.c:1.14
--- src/sys/external/bsd/acpica/dist/executer/exdump.c:1.13	Sun Apr 28 21:18:07 2019
+++ src/sys/external/bsd/acpica/dist/executer/exdump.c	Tue Oct 15 12:13:39 2019
@@ -147,7 +147,7 @@ static ACPI_EXDUMP_INFO     AcpiExDumpMe
     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Method.ParamCount),            "Parameter Count"},
     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Method.SyncLevel),             "Sync Level"},
     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Method.Mutex),                 "Mutex"},
-    {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Method.OwnerId),               "Owner Id"},
+    {ACPI_EXD_UINT16,   ACPI_EXD_OFFSET (Method.OwnerId),               "Owner Id"},
     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Method.ThreadCount),           "Thread Count"},
     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (Method.AmlLength),             "Aml Length"},
     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Method.AmlStart),              "Aml Start"}
@@ -314,8 +314,8 @@ static ACPI_EXDUMP_INFO     AcpiExDumpFi
 static ACPI_EXDUMP_INFO     AcpiExDumpNode[7] =
 {
     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpNode),           NULL},
-    {ACPI_EXD_UINT8,    ACPI_EXD_NSOFFSET (Flags),                      "Flags"},
-    {ACPI_EXD_UINT8,    ACPI_EXD_NSOFFSET (OwnerId),                    "Owner Id"},
+    {ACPI_EXD_UINT16,   ACPI_EXD_NSOFFSET (Flags),                      "Flags"},
+    {ACPI_EXD_UINT16,   ACPI_EXD_NSOFFSET (OwnerId),                    "Owner Id"},
     {ACPI_EXD_LIST,     ACPI_EXD_NSOFFSET (Object),                     "Object List"},
     {ACPI_EXD_NODE,     ACPI_EXD_NSOFFSET (Parent),                     "Parent"},
     {ACPI_EXD_NODE,     ACPI_EXD_NSOFFSET (Child),                      "Child"},

Index: src/sys/external/bsd/acpica/dist/include/acglobal.h
diff -u src/sys/external/bsd/acpica/dist/include/acglobal.h:1.19 src/sys/external/bsd/acpica/dist/include/acglobal.h:1.20
--- src/sys/external/bsd/acpica/dist/include/acglobal.h:1.19	Sun Apr 28 21:18:07 2019
+++ src/sys/external/bsd/acpica/dist/include/acglobal.h	Tue Oct 15 12:13:39 2019
@@ -215,7 +215,6 @@ ACPI_GLOBAL (BOOLEAN,                   
 ACPI_GLOBAL (ACPI_NAMESPACE_NODE,       AcpiGbl_RootNodeStruct);
 ACPI_GLOBAL (ACPI_NAMESPACE_NODE *,     AcpiGbl_RootNode);
 ACPI_GLOBAL (ACPI_NAMESPACE_NODE *,     AcpiGbl_FadtGpeDevice);
-ACPI_GLOBAL (ACPI_OPERAND_OBJECT *,     AcpiGbl_ModuleCodeList);
 
 extern const UINT8                      AcpiGbl_NsProperties [ACPI_NUM_NS_TYPES];
 extern const ACPI_PREDEFINED_NAMES      AcpiGbl_PreDefinedNames [NUM_PREDEFINED_NAMES];
Index: src/sys/external/bsd/acpica/dist/include/aclocal.h
diff -u src/sys/external/bsd/acpica/dist/include/aclocal.h:1.19 src/sys/external/bsd/acpica/dist/include/aclocal.h:1.20
--- src/sys/external/bsd/acpica/dist/include/aclocal.h:1.19	Sun Apr 28 21:18:07 2019
+++ src/sys/external/bsd/acpica/dist/include/aclocal.h	Tue Oct 15 12:13:39 2019
@@ -186,12 +186,12 @@ typedef struct acpi_namespace_node
     union acpi_operand_object       *Object;        /* Interpreter object */
     UINT8                           DescriptorType; /* Differentiate object descriptor types */
     UINT8                           Type;           /* ACPI Type associated with this name */
-    UINT8                           Flags;          /* Miscellaneous flags */
-    ACPI_OWNER_ID                   OwnerId;        /* Node creator */
+    UINT16                          Flags;          /* Miscellaneous flags */
     ACPI_NAME_UNION                 Name;           /* ACPI Name, always 4 chars per ACPI spec */
     struct acpi_namespace_node      *Parent;        /* Parent node */
     struct acpi_namespace_node      *Child;         /* First child */
     struct acpi_namespace_node      *Peer;          /* First peer */
+    ACPI_OWNER_ID                   OwnerId;        /* Node creator */
 
     /*
      * The following fields are used by the ASL compiler and disassembler only
Index: src/sys/external/bsd/acpica/dist/include/actypes.h
diff -u src/sys/external/bsd/acpica/dist/include/actypes.h:1.19 src/sys/external/bsd/acpica/dist/include/actypes.h:1.20
--- src/sys/external/bsd/acpica/dist/include/actypes.h:1.19	Fri May 17 16:27:48 2019
+++ src/sys/external/bsd/acpica/dist/include/actypes.h	Tue Oct 15 12:13:39 2019
@@ -484,8 +484,8 @@ typedef void *                          
 
 /* Owner IDs are used to track namespace nodes for selective deletion */
 
-typedef UINT8                           ACPI_OWNER_ID;
-#define ACPI_OWNER_ID_MAX               0xFF
+typedef UINT16                          ACPI_OWNER_ID;
+#define ACPI_OWNER_ID_MAX               0xFFF   /* 4095 possible owner IDs */
 
 
 #define ACPI_INTEGER_BIT_SIZE           64
@@ -554,8 +554,8 @@ typedef UINT64                          
 
 /* Pointer/Integer type conversions */
 
-#define ACPI_TO_POINTER(i)              ((void *)((uintptr_t)(ACPI_SIZE) (i)))
-#define ACPI_TO_INTEGER(p)              ((uintptr_t)(p))
+#define ACPI_TO_POINTER(i)              ACPI_CAST_PTR (void, (ACPI_SIZE) (i))
+#define ACPI_TO_INTEGER(p)              ACPI_PTR_DIFF (p, (void *) 0)
 #define ACPI_OFFSET(d, f)               ACPI_PTR_DIFF (&(((d *) 0)->f), (void *) 0)
 #define ACPI_PHYSADDR_TO_PTR(i)         ACPI_TO_POINTER(i)
 #define ACPI_PTR_TO_PHYSADDR(i)         ACPI_TO_INTEGER(i)
@@ -1410,12 +1410,14 @@ typedef enum
 #define ACPI_OSI_WIN_VISTA_SP2          0x0A
 #define ACPI_OSI_WIN_7                  0x0B
 #define ACPI_OSI_WIN_8                  0x0C
-#define ACPI_OSI_WIN_10                 0x0D
-#define ACPI_OSI_WIN_10_RS1             0x0E
-#define ACPI_OSI_WIN_10_RS2             0x0F
-#define ACPI_OSI_WIN_10_RS3             0x10
-#define ACPI_OSI_WIN_10_RS4             0x11
-#define ACPI_OSI_WIN_10_RS5             0x12
+#define ACPI_OSI_WIN_8_1                0x0D
+#define ACPI_OSI_WIN_10                 0x0E
+#define ACPI_OSI_WIN_10_RS1             0x0F
+#define ACPI_OSI_WIN_10_RS2             0x10
+#define ACPI_OSI_WIN_10_RS3             0x11
+#define ACPI_OSI_WIN_10_RS4             0x12
+#define ACPI_OSI_WIN_10_RS5             0x13
+#define ACPI_OSI_WIN_10_19H1            0x14
 
 
 /* Definitions of getopt */
Index: src/sys/external/bsd/acpica/dist/include/acutils.h
diff -u src/sys/external/bsd/acpica/dist/include/acutils.h:1.19 src/sys/external/bsd/acpica/dist/include/acutils.h:1.20
--- src/sys/external/bsd/acpica/dist/include/acutils.h:1.19	Sun Apr 28 21:18:07 2019
+++ src/sys/external/bsd/acpica/dist/include/acutils.h	Tue Oct 15 12:13:39 2019
@@ -1086,30 +1086,33 @@ AcpiUtDeleteAddressLists (
 /*
  * utxferror - various error/warning output functions
  */
+ACPI_PRINTF_LIKE(5)
 void ACPI_INTERNAL_VAR_XFACE
 AcpiUtPredefinedWarning (
     const char              *ModuleName,
     UINT32                  LineNumber,
     char                    *Pathname,
-    UINT8                   NodeFlags,
+    UINT16                  NodeFlags,
     const char              *Format,
     ...);
 
+ACPI_PRINTF_LIKE(5)
 void ACPI_INTERNAL_VAR_XFACE
 AcpiUtPredefinedInfo (
     const char              *ModuleName,
     UINT32                  LineNumber,
     char                    *Pathname,
-    UINT8                   NodeFlags,
+    UINT16                  NodeFlags,
     const char              *Format,
     ...);
 
+ACPI_PRINTF_LIKE(5)
 void ACPI_INTERNAL_VAR_XFACE
 AcpiUtPredefinedBiosError (
     const char              *ModuleName,
     UINT32                  LineNumber,
     char                    *Pathname,
-    UINT8                   NodeFlags,
+    UINT16                  NodeFlags,
     const char              *Format,
     ...);
 

Index: src/sys/external/bsd/acpica/dist/include/acnamesp.h
diff -u src/sys/external/bsd/acpica/dist/include/acnamesp.h:1.16 src/sys/external/bsd/acpica/dist/include/acnamesp.h:1.17
--- src/sys/external/bsd/acpica/dist/include/acnamesp.h:1.16	Sun Apr 28 21:18:07 2019
+++ src/sys/external/bsd/acpica/dist/include/acnamesp.h	Tue Oct 15 12:13:39 2019
@@ -311,10 +311,6 @@ ACPI_STATUS
 AcpiNsEvaluate (
     ACPI_EVALUATE_INFO      *Info);
 
-void
-AcpiNsExecModuleCodeList (
-    void);
-
 
 /*
  * nsarguments - Argument count/type checking for predefined/reserved names

Index: src/sys/external/bsd/acpica/dist/include/acpiosxf.h
diff -u src/sys/external/bsd/acpica/dist/include/acpiosxf.h:1.13 src/sys/external/bsd/acpica/dist/include/acpiosxf.h:1.14
--- src/sys/external/bsd/acpica/dist/include/acpiosxf.h:1.13	Sun Apr 28 21:18:07 2019
+++ src/sys/external/bsd/acpica/dist/include/acpiosxf.h	Tue Oct 15 12:13:39 2019
@@ -469,6 +469,7 @@ AcpiOsEnterSleep (
  * Debug print routines
  */
 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPrintf
+ACPI_PRINTF_LIKE (1)
 void ACPI_INTERNAL_VAR_XFACE
 AcpiOsPrintf (
     const char              *Format,

Index: src/sys/external/bsd/acpica/dist/include/acpixf.h
diff -u src/sys/external/bsd/acpica/dist/include/acpixf.h:1.22 src/sys/external/bsd/acpica/dist/include/acpixf.h:1.23
--- src/sys/external/bsd/acpica/dist/include/acpixf.h:1.22	Sun Apr 28 21:18:07 2019
+++ src/sys/external/bsd/acpica/dist/include/acpixf.h	Tue Oct 15 12:13:39 2019
@@ -46,7 +46,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20190405
+#define ACPI_CA_VERSION                 0x20190816
 
 #include "acconfig.h"
 #include "actypes.h"
@@ -338,6 +338,9 @@ ACPI_GLOBAL (BOOLEAN,               Acpi
 #define ACPI_HW_DEPENDENT_RETURN_OK(Prototype) \
     ACPI_EXTERNAL_RETURN_OK(Prototype)
 
+#define ACPI_HW_DEPENDENT_RETURN_UINT32(prototype) \
+    ACPI_EXTERNAL_RETURN_UINT32(prototype)
+
 #define ACPI_HW_DEPENDENT_RETURN_VOID(Prototype) \
     ACPI_EXTERNAL_RETURN_VOID(Prototype)
 
@@ -348,6 +351,9 @@ ACPI_GLOBAL (BOOLEAN,               Acpi
 #define ACPI_HW_DEPENDENT_RETURN_OK(Prototype) \
     static ACPI_INLINE Prototype {return(AE_OK);}
 
+#define ACPI_HW_DEPENDENT_RETURN_UINT32(prototype) \
+    static ACPI_INLINE prototype {return(0);}
+
 #define ACPI_HW_DEPENDENT_RETURN_VOID(Prototype) \
     static ACPI_INLINE Prototype {return;}
 
@@ -968,6 +974,12 @@ AcpiGetGpeStatus (
     UINT32                  GpeNumber,
     ACPI_EVENT_STATUS       *EventStatus))
 
+ACPI_HW_DEPENDENT_RETURN_UINT32 (
+UINT32
+AcpiDispatchGpe (
+    ACPI_HANDLE             GpeDevice,
+    UINT32                  GpeNumber))
+
 ACPI_HW_DEPENDENT_RETURN_STATUS (
 ACPI_STATUS
 AcpiDisableAllGpes (

Index: src/sys/external/bsd/acpica/dist/namespace/nsaccess.c
diff -u src/sys/external/bsd/acpica/dist/namespace/nsaccess.c:1.17 src/sys/external/bsd/acpica/dist/namespace/nsaccess.c:1.18
--- src/sys/external/bsd/acpica/dist/namespace/nsaccess.c:1.17	Sun Apr 28 21:18:07 2019
+++ src/sys/external/bsd/acpica/dist/namespace/nsaccess.c	Tue Oct 15 12:13:39 2019
@@ -76,6 +76,7 @@ AcpiNsRootInitialize (
     ACPI_STATUS                 Status;
     const ACPI_PREDEFINED_NAMES *InitVal = NULL;
     ACPI_NAMESPACE_NODE         *NewNode;
+    ACPI_NAMESPACE_NODE         *PrevNode = NULL;
     ACPI_OPERAND_OBJECT         *ObjDesc;
     ACPI_STRING                 Val = NULL;
 
@@ -105,13 +106,30 @@ AcpiNsRootInitialize (
      */
     AcpiGbl_RootNode = &AcpiGbl_RootNodeStruct;
 
-    /* Enter the pre-defined names in the name table */
+    /* Enter the predefined names in the name table */
 
     ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
         "Entering predefined entries into namespace\n"));
 
+    /*
+     * Create the initial (default) namespace.
+     * This namespace looks like something similar to this:
+     *
+     *   ACPI Namespace (from Namespace Root):
+     *    0  _GPE Scope        00203160 00
+     *    0  _PR_ Scope        002031D0 00
+     *    0  _SB_ Device       00203240 00 Notify Object: 0020ADD8
+     *    0  _SI_ Scope        002032B0 00
+     *    0  _TZ_ Device       00203320 00
+     *    0  _REV Integer      00203390 00 = 0000000000000002
+     *    0  _OS_ String       00203488 00 Len 14 "Microsoft Windows NT"
+     *    0  _GL_ Mutex        00203580 00 Object 002035F0
+     *    0  _OSI Method       00203678 00 Args 1 Len 0000 Aml 00000000
+     */
     for (InitVal = AcpiGbl_PreDefinedNames; InitVal->Name; InitVal++)
     {
+        Status = AE_OK;
+
         /* _OSI is optional for now, will be permanent later */
 
         if (!strcmp (InitVal->Name, "_OSI") && !AcpiGbl_CreateOsiMethod)
@@ -119,17 +137,35 @@ AcpiNsRootInitialize (
             continue;
         }
 
-        Status = AcpiNsLookup (NULL, ACPI_CAST_PTR (char, InitVal->Name),
-            InitVal->Type, ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,
-            NULL, &NewNode);
-        if (ACPI_FAILURE (Status))
+        /*
+         * Create, init, and link the new predefined name
+         * Note: No need to use AcpiNsLookup here because all the
+         * predefined names are at the root level. It is much easier to
+         * just create and link the new node(s) here.
+         */
+        NewNode = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_NAMESPACE_NODE));
+        if (!NewNode)
         {
-            ACPI_EXCEPTION ((AE_INFO, Status,
-                "Could not create predefined name %s",
-                InitVal->Name));
-            continue;
+            Status = AE_NO_MEMORY;
+            goto UnlockAndExit;
         }
 
+        ACPI_COPY_NAMESEG (NewNode->Name.Ascii, InitVal->Name);
+        NewNode->DescriptorType = ACPI_DESC_TYPE_NAMED;
+        NewNode->Type = InitVal->Type;
+
+        if (!PrevNode)
+        {
+            AcpiGbl_RootNodeStruct.Child = NewNode;
+        }
+        else
+        {
+            PrevNode->Peer = NewNode;
+        }
+
+        NewNode->Parent = &AcpiGbl_RootNodeStruct;
+        PrevNode = NewNode;
+
         /*
          * Name entered successfully. If entry in PreDefinedNames[] specifies
          * an initial value, create the initial value.
@@ -178,7 +214,7 @@ AcpiNsRootInitialize (
 
                 NewNode->Value = ObjDesc->Method.ParamCount;
 #else
-                /* Mark this as a very SPECIAL method */
+                /* Mark this as a very SPECIAL method (_OSI) */
 
                 ObjDesc->Method.InfoFlags = ACPI_METHOD_INTERNAL_ONLY;
                 ObjDesc->Method.Dispatch.Implementation = AcpiUtOsiImplementation;
@@ -251,7 +287,6 @@ AcpiNsRootInitialize (
         }
     }
 
-
 UnlockAndExit:
     (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
 
@@ -624,7 +659,7 @@ AcpiNsLookup (
                 if (Flags & ACPI_NS_PREFIX_MUST_EXIST)
                 {
                     AcpiOsPrintf (ACPI_MSG_BIOS_ERROR
-                        "Object does not exist: %4.4s\n", &SimpleName);
+                        "Object does not exist: %4.4s\n", (char *) &SimpleName);
                 }
 #endif
                 /* Name not found in ACPI namespace */

Index: src/sys/external/bsd/acpica/dist/namespace/nsdump.c
diff -u src/sys/external/bsd/acpica/dist/namespace/nsdump.c:1.14 src/sys/external/bsd/acpica/dist/namespace/nsdump.c:1.15
--- src/sys/external/bsd/acpica/dist/namespace/nsdump.c:1.14	Sun Apr 28 21:18:07 2019
+++ src/sys/external/bsd/acpica/dist/namespace/nsdump.c	Tue Oct 15 12:13:39 2019
@@ -272,7 +272,7 @@ AcpiNsDumpOneObject (
 
     /* Now we can print out the pertinent information */
 
-    AcpiOsPrintf (" %-12s %p %2.2X ",
+    AcpiOsPrintf (" %-12s %p %3.3X ",
         AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId);
 
     DbgLevel = AcpiDbgLevel;
Index: src/sys/external/bsd/acpica/dist/namespace/nseval.c
diff -u src/sys/external/bsd/acpica/dist/namespace/nseval.c:1.14 src/sys/external/bsd/acpica/dist/namespace/nseval.c:1.15
--- src/sys/external/bsd/acpica/dist/namespace/nseval.c:1.14	Sun Apr 28 21:18:07 2019
+++ src/sys/external/bsd/acpica/dist/namespace/nseval.c	Tue Oct 15 12:13:39 2019
@@ -51,13 +51,6 @@
 #define _COMPONENT          ACPI_NAMESPACE
         ACPI_MODULE_NAME    ("nseval")
 
-/* Local prototypes */
-
-static void
-AcpiNsExecModuleCode (
-    ACPI_OPERAND_OBJECT     *MethodObj,
-    ACPI_EVALUATE_INFO      *Info);
-
 
 /*******************************************************************************
  *
@@ -356,206 +349,3 @@ Cleanup:
     Info->FullPathname = NULL;
     return_ACPI_STATUS (Status);
 }
-
-
-/*******************************************************************************
- *
- * FUNCTION:    AcpiNsExecModuleCodeList
- *
- * PARAMETERS:  None
- *
- * RETURN:      None. Exceptions during method execution are ignored, since
- *              we cannot abort a table load.
- *
- * DESCRIPTION: Execute all elements of the global module-level code list.
- *              Each element is executed as a single control method.
- *
- * NOTE: With this option enabled, each block of detected executable AML
- * code that is outside of any control method is wrapped with a temporary
- * control method object and placed on a global list. The methods on this
- * list are executed below.
- *
- * This function executes the module-level code for all tables only after
- * all of the tables have been loaded. It is a legacy option and is
- * not compatible with other ACPI implementations. See AcpiNsLoadTable.
- *
- * This function will be removed when the legacy option is removed.
- *
- ******************************************************************************/
-
-void
-AcpiNsExecModuleCodeList (
-    void)
-{
-    ACPI_OPERAND_OBJECT     *Prev;
-    ACPI_OPERAND_OBJECT     *Next;
-    ACPI_EVALUATE_INFO      *Info;
-    UINT32                  MethodCount = 0;
-
-
-    ACPI_FUNCTION_TRACE (NsExecModuleCodeList);
-
-
-    /* Exit now if the list is empty */
-
-    Next = AcpiGbl_ModuleCodeList;
-    if (!Next)
-    {
-        ACPI_DEBUG_PRINT ((ACPI_DB_INIT_NAMES,
-            "Legacy MLC block list is empty\n"));
-
-        return_VOID;
-    }
-
-    /* Allocate the evaluation information block */
-
-    Info = ACPI_ALLOCATE (sizeof (ACPI_EVALUATE_INFO));
-    if (!Info)
-    {
-        return_VOID;
-    }
-
-    /* Walk the list, executing each "method" */
-
-    while (Next)
-    {
-        Prev = Next;
-        Next = Next->Method.Mutex;
-
-        /* Clear the link field and execute the method */
-
-        Prev->Method.Mutex = NULL;
-        AcpiNsExecModuleCode (Prev, Info);
-        MethodCount++;
-
-        /* Delete the (temporary) method object */
-
-        AcpiUtRemoveReference (Prev);
-    }
-
-    ACPI_INFO ((
-        "Executed %u blocks of module-level executable AML code",
-        MethodCount));
-
-    ACPI_FREE (Info);
-    AcpiGbl_ModuleCodeList = NULL;
-    return_VOID;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    AcpiNsExecModuleCode
- *
- * PARAMETERS:  MethodObj           - Object container for the module-level code
- *              Info                - Info block for method evaluation
- *
- * RETURN:      None. Exceptions during method execution are ignored, since
- *              we cannot abort a table load.
- *
- * DESCRIPTION: Execute a control method containing a block of module-level
- *              executable AML code. The control method is temporarily
- *              installed to the root node, then evaluated.
- *
- ******************************************************************************/
-
-static void
-AcpiNsExecModuleCode (
-    ACPI_OPERAND_OBJECT     *MethodObj,
-    ACPI_EVALUATE_INFO      *Info)
-{
-    ACPI_OPERAND_OBJECT     *ParentObj;
-    ACPI_NAMESPACE_NODE     *ParentNode;
-    ACPI_OBJECT_TYPE        Type;
-    ACPI_STATUS             Status;
-
-
-    ACPI_FUNCTION_TRACE (NsExecModuleCode);
-
-
-    /*
-     * Get the parent node. We cheat by using the NextObject field
-     * of the method object descriptor.
-     */
-    ParentNode = ACPI_CAST_PTR (
-        ACPI_NAMESPACE_NODE, MethodObj->Method.NextObject);
-    Type = AcpiNsGetType (ParentNode);
-
-    /*
-     * Get the region handler and save it in the method object. We may need
-     * this if an operation region declaration causes a _REG method to be run.
-     *
-     * We can't do this in AcpiPsLinkModuleCode because
-     * AcpiGbl_RootNode->Object is NULL at PASS1.
-     */
-    if ((Type == ACPI_TYPE_DEVICE) && ParentNode->Object)
-    {
-        MethodObj->Method.Dispatch.Handler =
-            ParentNode->Object->Device.Handler;
-    }
-
-    /* Must clear NextObject (AcpiNsAttachObject needs the field) */
-
-    MethodObj->Method.NextObject = NULL;
-
-    /* Initialize the evaluation information block */
-
-    memset (Info, 0, sizeof (ACPI_EVALUATE_INFO));
-    Info->PrefixNode = ParentNode;
-
-    /*
-     * Get the currently attached parent object. Add a reference,
-     * because the ref count will be decreased when the method object
-     * is installed to the parent node.
-     */
-    ParentObj = AcpiNsGetAttachedObject (ParentNode);
-    if (ParentObj)
-    {
-        AcpiUtAddReference (ParentObj);
-    }
-
-    /* Install the method (module-level code) in the parent node */
-
-    Status = AcpiNsAttachObject (ParentNode, MethodObj, ACPI_TYPE_METHOD);
-    if (ACPI_FAILURE (Status))
-    {
-        goto Exit;
-    }
-
-    /* Execute the parent node as a control method */
-
-    Status = AcpiNsEvaluate (Info);
-
-    ACPI_DEBUG_PRINT ((ACPI_DB_INIT_NAMES,
-        "Executed module-level code at %p\n",
-        MethodObj->Method.AmlStart));
-
-    /* Delete a possible implicit return value (in slack mode) */
-
-    if (Info->ReturnObject)
-    {
-        AcpiUtRemoveReference (Info->ReturnObject);
-    }
-
-    /* Detach the temporary method object */
-
-    AcpiNsDetachObject (ParentNode);
-
-    /* Restore the original parent object */
-
-    if (ParentObj)
-    {
-        Status = AcpiNsAttachObject (ParentNode, ParentObj, Type);
-    }
-    else
-    {
-        ParentNode->Type = (UINT8) Type;
-    }
-
-Exit:
-    if (ParentObj)
-    {
-        AcpiUtRemoveReference (ParentObj);
-    }
-    return_VOID;
-}

Index: src/sys/external/bsd/acpica/dist/namespace/nsinit.c
diff -u src/sys/external/bsd/acpica/dist/namespace/nsinit.c:1.16 src/sys/external/bsd/acpica/dist/namespace/nsinit.c:1.17
--- src/sys/external/bsd/acpica/dist/namespace/nsinit.c:1.16	Sun Apr 28 21:18:07 2019
+++ src/sys/external/bsd/acpica/dist/namespace/nsinit.c	Tue Oct 15 12:13:39 2019
@@ -104,29 +104,30 @@ AcpiNsInitializeObjects (
     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
         "**** Starting initialization of namespace objects ****\n"));
     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
-        "Completing Region/Field/Buffer/Package initialization:\n"));
+        "Final data object initialization: "));
 
-    /* Set all init info to zero */
+    /* Clear the info block */
 
     memset (&Info, 0, sizeof (ACPI_INIT_WALK_INFO));
 
     /* Walk entire namespace from the supplied root */
 
+    /*
+     * TBD: will become ACPI_TYPE_PACKAGE as this type object
+     * is now the only one that supports deferred initialization
+     * (forward references).
+     */
     Status = AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
-        ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL,
-        &Info, NULL);
+        ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL, &Info, NULL);
     if (ACPI_FAILURE (Status))
     {
         ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace"));
     }
 
     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
-        "    Initialized %u/%u Regions %u/%u Fields %u/%u "
-        "Buffers %u/%u Packages (%u nodes)\n",
-        Info.OpRegionInit,  Info.OpRegionCount,
-        Info.FieldInit,     Info.FieldCount,
-        Info.BufferInit,    Info.BufferCount,
-        Info.PackageInit,   Info.PackageCount, Info.ObjectCount));
+        "Namespace contains %u (0x%X) objects\n",
+        Info.ObjectCount,
+        Info.ObjectCount));
 
     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
         "%u Control Methods found\n%u Op Regions found\n",
@@ -453,35 +454,19 @@ AcpiNsInitOneObject (
     AcpiExEnterInterpreter ();
 
     /*
-     * Each of these types can contain executable AML code within the
-     * declaration.
+     * Only initialization of Package objects can be deferred, in order
+     * to support forward references.
      */
     switch (Type)
     {
-    case ACPI_TYPE_REGION:
-
-        Info->OpRegionInit++;
-        Status = AcpiDsGetRegionArguments (ObjDesc);
-        break;
-
-    case ACPI_TYPE_BUFFER_FIELD:
-
-        Info->FieldInit++;
-        Status = AcpiDsGetBufferFieldArguments (ObjDesc);
-        break;
-
     case ACPI_TYPE_LOCAL_BANK_FIELD:
 
+        /* TBD: BankFields do not require deferred init, remove this code */
+
         Info->FieldInit++;
         Status = AcpiDsGetBankFieldArguments (ObjDesc);
         break;
 
-    case ACPI_TYPE_BUFFER:
-
-        Info->BufferInit++;
-        Status = AcpiDsGetBufferArguments (ObjDesc);
-        break;
-
     case ACPI_TYPE_PACKAGE:
 
         /* Complete the initialization/resolution of the package object */
@@ -492,8 +477,12 @@ AcpiNsInitOneObject (
 
     default:
 
-        /* No other types can get here */
+        /* No other types should get here */
 
+        Status = AE_TYPE;
+        ACPI_EXCEPTION ((AE_INFO, Status,
+            "Opcode is not deferred [%4.4s] (%s)",
+            AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Type)));
         break;
     }
 

Index: src/sys/external/bsd/acpica/dist/namespace/nsrepair2.c
diff -u src/sys/external/bsd/acpica/dist/namespace/nsrepair2.c:1.13 src/sys/external/bsd/acpica/dist/namespace/nsrepair2.c:1.14
--- src/sys/external/bsd/acpica/dist/namespace/nsrepair2.c:1.13	Sun Apr 28 21:18:07 2019
+++ src/sys/external/bsd/acpica/dist/namespace/nsrepair2.c	Tue Oct 15 12:13:39 2019
@@ -181,7 +181,7 @@ static const ACPI_REPAIR_INFO       Acpi
 
 #define ACPI_FDE_FIELD_COUNT        5
 #define ACPI_FDE_BYTE_BUFFER_SIZE   5
-#define ACPI_FDE_DWORD_BUFFER_SIZE  (ACPI_FDE_FIELD_COUNT * sizeof (UINT32))
+#define ACPI_FDE_DWORD_BUFFER_SIZE  (ACPI_FDE_FIELD_COUNT * (UINT32) sizeof (UINT32))
 
 
 /******************************************************************************

Index: src/sys/external/bsd/acpica/dist/tables/tbdata.c
diff -u src/sys/external/bsd/acpica/dist/tables/tbdata.c:1.12 src/sys/external/bsd/acpica/dist/tables/tbdata.c:1.13
--- src/sys/external/bsd/acpica/dist/tables/tbdata.c:1.12	Sun Apr 28 21:18:07 2019
+++ src/sys/external/bsd/acpica/dist/tables/tbdata.c	Tue Oct 15 12:13:39 2019
@@ -865,6 +865,7 @@ AcpiTbDeleteNamespaceByOwner (
     {
         return_ACPI_STATUS (Status);
     }
+
     AcpiNsDeleteNamespaceByOwner (OwnerId);
     AcpiUtReleaseWriteLock (&AcpiGbl_NamespaceRwLock);
     return_ACPI_STATUS (Status);
@@ -1083,19 +1084,6 @@ AcpiTbLoadTable (
     Status = AcpiNsLoadTable (TableIndex, ParentNode);
 
     /*
-     * This case handles the legacy option that groups all module-level
-     * code blocks together and defers execution until all of the tables
-     * are loaded. Execute all of these blocks at this time.
-     * Execute any module-level code that was detected during the table
-     * load phase.
-     *
-     * Note: this option is deprecated and will be eliminated in the
-     * future. Use of this option can cause problems with AML code that
-     * depends upon in-order immediate execution of module-level code.
-     */
-    AcpiNsExecModuleCodeList ();
-
-    /*
      * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is
      * responsible for discovering any new wake GPEs by running _PRW methods
      * that may have been loaded by this table.

Index: src/sys/external/bsd/acpica/dist/tables/tbxfload.c
diff -u src/sys/external/bsd/acpica/dist/tables/tbxfload.c:1.10 src/sys/external/bsd/acpica/dist/tables/tbxfload.c:1.11
--- src/sys/external/bsd/acpica/dist/tables/tbxfload.c:1.10	Sun Apr 28 21:18:08 2019
+++ src/sys/external/bsd/acpica/dist/tables/tbxfload.c	Tue Oct 15 12:13:39 2019
@@ -382,6 +382,13 @@ AcpiLoadTable (
     ACPI_INFO (("Host-directed Dynamic ACPI Table Load:"));
     Status = AcpiTbInstallAndLoadTable (ACPI_PTR_TO_PHYSADDR (Table),
         ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, FALSE, &TableIndex);
+    if (ACPI_SUCCESS (Status))
+    {
+        /* Complete the initialization/resolution of new objects */
+
+        AcpiNsInitializeObjects ();
+    }
+
     return_ACPI_STATUS (Status);
 }
 

Index: src/sys/external/bsd/acpica/dist/tools/acpidump/apfiles.c
diff -u src/sys/external/bsd/acpica/dist/tools/acpidump/apfiles.c:1.11 src/sys/external/bsd/acpica/dist/tools/acpidump/apfiles.c:1.12
--- src/sys/external/bsd/acpica/dist/tools/acpidump/apfiles.c:1.11	Sun Apr 28 21:18:08 2019
+++ src/sys/external/bsd/acpica/dist/tools/acpidump/apfiles.c	Tue Oct 15 12:13:40 2019
@@ -69,20 +69,27 @@ ApIsExistingFile (
 {
 #if !defined(_GNU_EFI) && !defined(_EDK2_EFI)
     struct stat             StatInfo;
+    int                     InChar;
 
 
     if (!stat (Pathname, &StatInfo))
     {
         fprintf (stderr, "Target path already exists, overwrite? [y|n] ");
 
-        if (getchar () != 'y')
+        InChar = fgetc (stdin);
+        if (InChar == '\n')
+        {
+            InChar = fgetc (stdin);
+        }
+
+        if (InChar != 'y' && InChar != 'Y')
         {
             return (-1);
         }
     }
 #endif
 
-    return 0;
+    return (0);
 }
 
 

Index: src/sys/external/bsd/acpica/dist/utilities/utdebug.c
diff -u src/sys/external/bsd/acpica/dist/utilities/utdebug.c:1.16 src/sys/external/bsd/acpica/dist/utilities/utdebug.c:1.17
--- src/sys/external/bsd/acpica/dist/utilities/utdebug.c:1.16	Sun Apr 28 21:18:08 2019
+++ src/sys/external/bsd/acpica/dist/utilities/utdebug.c	Tue Oct 15 12:13:40 2019
@@ -214,7 +214,7 @@ AcpiDebugPrint (
      * Display the module name, current line number, thread ID (if requested),
      * current procedure nesting level, and the current procedure name
      */
-    AcpiOsPrintf ("%9s-%04ld ", ModuleName, LineNumber);
+    AcpiOsPrintf ("%9s-%04d ", ModuleName, LineNumber);
 
 #ifdef ACPI_APPLICATION
     /*
@@ -235,7 +235,7 @@ AcpiDebugPrint (
         FillCount = 0;
     }
 
-    AcpiOsPrintf ("[%02ld] %*s",
+    AcpiOsPrintf ("[%02d] %*s",
         AcpiGbl_NestingLevel, AcpiGbl_NestingLevel + 1, " ");
     AcpiOsPrintf ("%s%*s: ",
         AcpiUtTrimFunctionName (FunctionName), FillCount, " ");

Index: src/sys/external/bsd/acpica/dist/utilities/utosi.c
diff -u src/sys/external/bsd/acpica/dist/utilities/utosi.c:1.12 src/sys/external/bsd/acpica/dist/utilities/utosi.c:1.13
--- src/sys/external/bsd/acpica/dist/utilities/utosi.c:1.12	Sun Apr 28 21:18:08 2019
+++ src/sys/external/bsd/acpica/dist/utilities/utosi.c	Tue Oct 15 12:13:40 2019
@@ -104,13 +104,14 @@ static ACPI_INTERFACE_INFO    AcpiDefaul
     {"Windows 2006 SP2",    NULL, 0, ACPI_OSI_WIN_VISTA_SP2},    /* Windows Vista SP2 - Added 09/2010 */
     {"Windows 2009",        NULL, 0, ACPI_OSI_WIN_7},            /* Windows 7 and Server 2008 R2 - Added 09/2009 */
     {"Windows 2012",        NULL, 0, ACPI_OSI_WIN_8},            /* Windows 8 and Server 2012 - Added 08/2012 */
-    {"Windows 2013",        NULL, 0, ACPI_OSI_WIN_8},            /* Windows 8.1 and Server 2012 R2 - Added 01/2014 */
+    {"Windows 2013",        NULL, 0, ACPI_OSI_WIN_8_1},          /* Windows 8.1 and Server 2012 R2 - Added 01/2014 */
     {"Windows 2015",        NULL, 0, ACPI_OSI_WIN_10},           /* Windows 10 - Added 03/2015 */
     {"Windows 2016",        NULL, 0, ACPI_OSI_WIN_10_RS1},       /* Windows 10 version 1607 - Added 12/2017 */
     {"Windows 2017",        NULL, 0, ACPI_OSI_WIN_10_RS2},       /* Windows 10 version 1703 - Added 12/2017 */
     {"Windows 2017.2",      NULL, 0, ACPI_OSI_WIN_10_RS3},       /* Windows 10 version 1709 - Added 02/2018 */
     {"Windows 2018",        NULL, 0, ACPI_OSI_WIN_10_RS4},       /* Windows 10 version 1803 - Added 11/2018 */
     {"Windows 2018.2",      NULL, 0, ACPI_OSI_WIN_10_RS5},       /* Windows 10 version 1809 - Added 11/2018 */
+    {"Windows 2019",        NULL, 0, ACPI_OSI_WIN_10_19H1},      /* Windows 10 version 1903 - Added 08/2019 */
 
 	/* Feature Group Strings */
 

Reply via email to