svn commit: r356471 - in stable/12: sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/debugger sys/contrib/dev/acpica/components...

Jung-uk Kim jkim at FreeBSD.org
Tue Jan 7 20:35:48 UTC 2020


Author: jkim
Date: Tue Jan  7 20:35:43 2020
New Revision: 356471
URL: https://svnweb.freebsd.org/changeset/base/356471

Log:
  MFC:	r351081, r353764, r355739
  
  Merge ACPICA 20190816, 20191018, and 20191213.

Added:
  stable/12/sys/contrib/dev/acpica/compiler/dtcompilerparser.l
     - copied unchanged from r353764, head/sys/contrib/dev/acpica/compiler/dtcompilerparser.l
  stable/12/sys/contrib/dev/acpica/compiler/dtcompilerparser.y
     - copied unchanged from r353764, head/sys/contrib/dev/acpica/compiler/dtcompilerparser.y
Modified:
  stable/12/sys/contrib/dev/acpica/acpica_prep.sh
  stable/12/sys/contrib/dev/acpica/changes.txt
  stable/12/sys/contrib/dev/acpica/common/acgetline.c
  stable/12/sys/contrib/dev/acpica/common/adisasm.c
  stable/12/sys/contrib/dev/acpica/common/adwalk.c
  stable/12/sys/contrib/dev/acpica/common/dmrestag.c
  stable/12/sys/contrib/dev/acpica/common/dmtables.c
  stable/12/sys/contrib/dev/acpica/common/dmtbdump1.c
  stable/12/sys/contrib/dev/acpica/common/dmtbdump2.c
  stable/12/sys/contrib/dev/acpica/common/dmtbdump3.c
  stable/12/sys/contrib/dev/acpica/compiler/aslanalyze.c
  stable/12/sys/contrib/dev/acpica/compiler/aslbtypes.c
  stable/12/sys/contrib/dev/acpica/compiler/aslcache.c
  stable/12/sys/contrib/dev/acpica/compiler/aslcodegen.c
  stable/12/sys/contrib/dev/acpica/compiler/aslcompile.c
  stable/12/sys/contrib/dev/acpica/compiler/aslcompiler.h
  stable/12/sys/contrib/dev/acpica/compiler/asldebug.c
  stable/12/sys/contrib/dev/acpica/compiler/asldefine.h
  stable/12/sys/contrib/dev/acpica/compiler/aslerror.c
  stable/12/sys/contrib/dev/acpica/compiler/aslfiles.c
  stable/12/sys/contrib/dev/acpica/compiler/aslglobal.h
  stable/12/sys/contrib/dev/acpica/compiler/aslhelp.c
  stable/12/sys/contrib/dev/acpica/compiler/aslkeywords.y
  stable/12/sys/contrib/dev/acpica/compiler/asllength.c
  stable/12/sys/contrib/dev/acpica/compiler/asllistsup.c
  stable/12/sys/contrib/dev/acpica/compiler/aslload.c
  stable/12/sys/contrib/dev/acpica/compiler/aslmain.c
  stable/12/sys/contrib/dev/acpica/compiler/aslmessages.c
  stable/12/sys/contrib/dev/acpica/compiler/aslmessages.h
  stable/12/sys/contrib/dev/acpica/compiler/aslmethod.c
  stable/12/sys/contrib/dev/acpica/compiler/aslnamesp.c
  stable/12/sys/contrib/dev/acpica/compiler/asloptions.c
  stable/12/sys/contrib/dev/acpica/compiler/aslparseop.c
  stable/12/sys/contrib/dev/acpica/compiler/aslprepkg.c
  stable/12/sys/contrib/dev/acpica/compiler/aslresource.c
  stable/12/sys/contrib/dev/acpica/compiler/aslrestype2.c
  stable/12/sys/contrib/dev/acpica/compiler/aslrestype2s.c
  stable/12/sys/contrib/dev/acpica/compiler/aslstartup.c
  stable/12/sys/contrib/dev/acpica/compiler/asltransform.c
  stable/12/sys/contrib/dev/acpica/compiler/asltypes.h
  stable/12/sys/contrib/dev/acpica/compiler/aslutils.c
  stable/12/sys/contrib/dev/acpica/compiler/aslxref.c
  stable/12/sys/contrib/dev/acpica/compiler/aslxrefout.c
  stable/12/sys/contrib/dev/acpica/compiler/cvdisasm.c
  stable/12/sys/contrib/dev/acpica/compiler/cvparser.c
  stable/12/sys/contrib/dev/acpica/compiler/dtcompile.c
  stable/12/sys/contrib/dev/acpica/compiler/dtcompiler.h
  stable/12/sys/contrib/dev/acpica/compiler/dtfield.c
  stable/12/sys/contrib/dev/acpica/compiler/dtio.c
  stable/12/sys/contrib/dev/acpica/compiler/dtparser.l
  stable/12/sys/contrib/dev/acpica/compiler/dttable2.c
  stable/12/sys/contrib/dev/acpica/compiler/dttemplate.c
  stable/12/sys/contrib/dev/acpica/compiler/prmacros.c
  stable/12/sys/contrib/dev/acpica/compiler/prscan.c
  stable/12/sys/contrib/dev/acpica/components/debugger/dbconvert.c
  stable/12/sys/contrib/dev/acpica/components/debugger/dbdisply.c
  stable/12/sys/contrib/dev/acpica/components/debugger/dbfileio.c
  stable/12/sys/contrib/dev/acpica/components/debugger/dbhistry.c
  stable/12/sys/contrib/dev/acpica/components/debugger/dbinput.c
  stable/12/sys/contrib/dev/acpica/components/debugger/dbmethod.c
  stable/12/sys/contrib/dev/acpica/components/debugger/dbnames.c
  stable/12/sys/contrib/dev/acpica/components/debugger/dbobject.c
  stable/12/sys/contrib/dev/acpica/components/debugger/dbstats.c
  stable/12/sys/contrib/dev/acpica/components/disassembler/dmdeferred.c
  stable/12/sys/contrib/dev/acpica/components/disassembler/dmresrc.c
  stable/12/sys/contrib/dev/acpica/components/disassembler/dmwalk.c
  stable/12/sys/contrib/dev/acpica/components/dispatcher/dscontrol.c
  stable/12/sys/contrib/dev/acpica/components/dispatcher/dsfield.c
  stable/12/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c
  stable/12/sys/contrib/dev/acpica/components/dispatcher/dswload.c
  stable/12/sys/contrib/dev/acpica/components/events/evgpe.c
  stable/12/sys/contrib/dev/acpica/components/events/evgpeblk.c
  stable/12/sys/contrib/dev/acpica/components/events/evgpeinit.c
  stable/12/sys/contrib/dev/acpica/components/events/evmisc.c
  stable/12/sys/contrib/dev/acpica/components/events/evregion.c
  stable/12/sys/contrib/dev/acpica/components/events/evrgnini.c
  stable/12/sys/contrib/dev/acpica/components/events/evxfgpe.c
  stable/12/sys/contrib/dev/acpica/components/executer/exdump.c
  stable/12/sys/contrib/dev/acpica/components/executer/exfield.c
  stable/12/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c
  stable/12/sys/contrib/dev/acpica/components/namespace/nsaccess.c
  stable/12/sys/contrib/dev/acpica/components/namespace/nsalloc.c
  stable/12/sys/contrib/dev/acpica/components/namespace/nsconvert.c
  stable/12/sys/contrib/dev/acpica/components/namespace/nsdump.c
  stable/12/sys/contrib/dev/acpica/components/namespace/nsrepair2.c
  stable/12/sys/contrib/dev/acpica/components/namespace/nsxfname.c
  stable/12/sys/contrib/dev/acpica/components/parser/psobject.c
  stable/12/sys/contrib/dev/acpica/components/resources/rscreate.c
  stable/12/sys/contrib/dev/acpica/components/tables/tbdata.c
  stable/12/sys/contrib/dev/acpica/components/tables/tbxfload.c
  stable/12/sys/contrib/dev/acpica/components/utilities/utbuffer.c
  stable/12/sys/contrib/dev/acpica/components/utilities/utdebug.c
  stable/12/sys/contrib/dev/acpica/components/utilities/uterror.c
  stable/12/sys/contrib/dev/acpica/components/utilities/utosi.c
  stable/12/sys/contrib/dev/acpica/components/utilities/utownerid.c
  stable/12/sys/contrib/dev/acpica/components/utilities/uttrack.c
  stable/12/sys/contrib/dev/acpica/include/acconfig.h
  stable/12/sys/contrib/dev/acpica/include/acdebug.h
  stable/12/sys/contrib/dev/acpica/include/aclocal.h
  stable/12/sys/contrib/dev/acpica/include/acobject.h
  stable/12/sys/contrib/dev/acpica/include/acpiosxf.h
  stable/12/sys/contrib/dev/acpica/include/acpixf.h
  stable/12/sys/contrib/dev/acpica/include/acstruct.h
  stable/12/sys/contrib/dev/acpica/include/actypes.h
  stable/12/sys/contrib/dev/acpica/include/acutils.h
  stable/12/sys/contrib/dev/acpica/include/platform/acenv.h
  stable/12/sys/contrib/dev/acpica/include/platform/acfreebsd.h
  stable/12/usr.sbin/acpi/iasl/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/contrib/dev/acpica/acpica_prep.sh
==============================================================================
--- stable/12/sys/contrib/dev/acpica/acpica_prep.sh	Tue Jan  7 20:24:21 2020	(r356470)
+++ stable/12/sys/contrib/dev/acpica/acpica_prep.sh	Tue Jan  7 20:35:43 2020	(r356471)
@@ -18,12 +18,13 @@ fulldirs="common compiler components include os_specif
 
 # files to remove
 stripdirs="generate libraries parsers preprocessor tests tools"
-stripfiles="Makefile README accygwin.h acdragonfly.h acdragonflyex.h	\
-	acefi.h acefiex.h achaiku.h acintel.h aclinux.h aclinuxex.h	\
-	acmacosx.h acmsvc.h acmsvcex.h acnetbsd.h acos2.h acqnx.h	\
-	acwin.h acwin64.h acwinex.h new_table.txt osbsdtbl.c osefitbl.c	\
-	osefixf.c osfreebsdtbl.c oslinuxtbl.c osunixdir.c osunixmap.c	\
-	oswindir.c oswintbl.c oswinxf.c readme.txt utclib.c utprint.c"
+stripfiles="Makefile README aslcompiler.y accygwin.h acdragonfly.h	\
+	acdragonflyex.h acefi.h acefiex.h achaiku.h acintel.h aclinux.h	\
+	aclinuxex.h acmacosx.h acmsvc.h acmsvcex.h acnetbsd.h acos2.h	\
+	acqnx.h acwin.h acwin64.h acwinex.h new_table.txt osbsdtbl.c	\
+	osefitbl.c osefixf.c osfreebsdtbl.c oslinuxtbl.c osunixdir.c	\
+	osunixmap.c oswindir.c oswintbl.c oswinxf.c readme.txt utclib.c	\
+	utprint.c"
 
 # include files to canonify
 src_headers="acapps.h acbuffer.h acclib.h accommon.h acconfig.h		\

Modified: stable/12/sys/contrib/dev/acpica/changes.txt
==============================================================================
--- stable/12/sys/contrib/dev/acpica/changes.txt	Tue Jan  7 20:24:21 2020	(r356470)
+++ stable/12/sys/contrib/dev/acpica/changes.txt	Tue Jan  7 20:35:43 2020	(r356471)
@@ -1,4 +1,138 @@
 ----------------------------------------
+13 December 2019. Summary of changes for version 20191213:
+
+
+1) ACPICA kernel-resident subsystem:
+
+Return a Buffer object for all fields created via the CreateField operator. Previously, an Integer would be returned if the size of the field was less than or equal to the current size of an Integer. Although this goes against the ACPI specification, it provides compatibility with other ACPI implementations. Also updated the ASLTS test suite to reflect this new behavior.
+
+2) iASL Compiler/Disassembler and ACPICA tools:
+
+iASL: Implemented detection of (and throw an error for) duplicate values for Case statements within a single Switch statement. Duplicate Integers, Strings, and Buffers are supported.
+
+iASL: Fix error logging issue during multiple file compilation -- Switch to the correct input file during error node creation.
+
+iASL: For duplicate named object creation, now emit an error instead of a warning - since this will cause a runtime error.
+
+AcpiSrc: Add unix line-ending support for non-Windows builds.
+
+iASL: Add an error condition for an attempt to create a NameString with > 255 NameSegs (the max allowable via the AML definition).
+
+
+----------------------------------------
+18 October 2019. Summary of changes for version 20191018:
+
+
+1) ACPICA kernel-resident subsystem:
+
+Debugger: added a new command: ?Fields [address space ID]?. This command 
+dumps the contents of all field units that are defined within the 
+namespace with a particular address space ID.
+
+Modified the external interface AcpiLoadTable() to return a table index. 
+This table index can be used for unloading a table for debugging.
+    ACPI_STATUS
+    AcpiLoadTable (
+        ACPI_TABLE_HEADER       *Table,
+        UINT32                  *TableIndex))
+
+Implemented a new external interface: AcpiUnloadTable() This new function 
+takes a table index as an argument and unloads the table. Useful for 
+debugging only.
+    ACPI_STATUS
+    AcpiUnloadTable (
+        UINT32                  TableIndex))
+
+Ported the AcpiNames utility to use the new table initialization 
+sequence. The utility was broken before this change. Also, it was 
+required to include most of the AML interpreter into the utility in order 
+to process table initialization (module-level code execution.)
+
+Update for results from running Clang V8.0.1. This fixes all "dead 
+assignment" warnings. There are still several "Dereference of NULL 
+pointer" warnings, but these have been found to be false positive 
+warnings.
+
+
+2) iASL Compiler/Disassembler and ACPICA tools:
+
+iASL: numerous table compiler changes to ensure that the usage of 
+yacc/bison syntax is POSIX-compliant.
+
+iASL/disassembler: several simple bug fixes in the data table 
+disassembler.
+
+Acpiexec: expanded the initialization file (the -fi option) to initialize 
+strings, buffers, packages, and field units.
+
+
+----------------------------------------
+16 August 2019. Summary of changes for version 20190816:
+
+This release is available at https://acpica.org/downloads
+
+
+1) ACPICA kernel-resident subsystem:
+
+Modified the OwnerId mechanism to allow for more Owner Ids. The previous 
+limit was 256 Ids, now it is 4096 Ids. This prevents OWNER_ID_LIMIT 
+exceptions on machines with a large number of initialization threads, 
+many CPU cores and nested initialization control methods.
+
+Introduced acpi_dispatch_gpe() as a wrapper around AcpiEvDetectGpe() for 
+checking if the given GPE (as represented by a GPE device handle and a 
+GPE number) is currently active and dispatching it (if that's the case) 
+outside of interrupt context.
+
+Table load: exit the interpreter before initializing objects within the 
+new table This prevents re-acquiring the interpreter lock when loading 
+tables
+
+Added the "Windows 2019" string to the _OSI support (version 1903). Jung-
+uk Kim
+
+Macros: removed pointer math on a null pointer. Causes warnings on some 
+compilers and/or tools. Changed ACPI_TO_POINTER to use ACPI_CAST_PTR 
+instead of using arithmetic.
+
+Fully deployed the ACPI_PRINTF_LIKE macro. This macro was not being used 
+across all "printf-like" internal functions. Also, cleanup all calls to 
+such functions (both in 32-bit mode and 64-bit mode) now that they are 
+analyzed by the gcc compiler via ACPI_PRINTF_LIKE.
+
+
+2) iASL Compiler/Disassembler and ACPICA tools:
+
+iASL: implemented a new data table compiler flex/bison front-end. This 
+change is internal and is not intended to result in changes to the 
+compiled code. This new compiler front-end can be invoked using the -tp 
+option for now, until the old mechanism is removed.
+
+ASLTS: Implemented a new data table compiler test suite. This test suite 
+generates all table templates and compile/disassemble/re-compile/binary-
+compare each file. 
+
+iASL: return -1 if AML files were not generated due to compiler errors
+
+iASL: added a warning on use of the now-legacy ASL Processor () keyword.
+
+iASL: added an error on _UID object declaration that returns a String 
+within a Processor () declaration. A _UID for a processor must be an 
+Integer.
+
+iASL: added a null terminator to name strings that consist only of 
+multiple parent prefixes (^)
+
+iASL: added support to compile both ASL and data table files in a single 
+command.
+
+Updated the tool generation project files that were recently migrated to 
+MSVC 2017 to eliminate all new warnings. The new project files appear in 
+the directory \acpica\generate\msvc2017. This change effectively 
+deprecates the older project files in \acpica\generate\msvc9.
+
+
+----------------------------------------
 03 July 2019. Summary of changes for version 20190703:
 
 

Modified: stable/12/sys/contrib/dev/acpica/common/acgetline.c
==============================================================================
--- stable/12/sys/contrib/dev/acpica/common/acgetline.c	Tue Jan  7 20:24:21 2020	(r356470)
+++ stable/12/sys/contrib/dev/acpica/common/acgetline.c	Tue Jan  7 20:35:43 2020	(r356471)
@@ -532,7 +532,7 @@ AcpiOsGetLine (
                  * Ignore the various keys like insert/delete/home/end, etc.
                  * But we must eat the final character of the ESC sequence.
                  */
-                InputChar = getchar ();
+                (void) getchar ();
                 continue;
 
             default:

Modified: stable/12/sys/contrib/dev/acpica/common/adisasm.c
==============================================================================
--- stable/12/sys/contrib/dev/acpica/common/adisasm.c	Tue Jan  7 20:24:21 2020	(r356470)
+++ stable/12/sys/contrib/dev/acpica/common/adisasm.c	Tue Jan  7 20:35:43 2020	(r356471)
@@ -746,7 +746,6 @@ AdDoExternalFileList (
             {
                 ExternalFileList = ExternalFileList->Next;
                 GlobalStatus = AE_TYPE;
-                Status = AE_OK;
                 continue;
             }
 

Modified: stable/12/sys/contrib/dev/acpica/common/adwalk.c
==============================================================================
--- stable/12/sys/contrib/dev/acpica/common/adwalk.c	Tue Jan  7 20:24:21 2020	(r356470)
+++ stable/12/sys/contrib/dev/acpica/common/adwalk.c	Tue Jan  7 20:35:43 2020	(r356471)
@@ -480,6 +480,7 @@ AcpiDmDumpDescending (
 {
     ACPI_OP_WALK_INFO       *Info = Context;
     char                    *Path;
+    ACPI_STATUS             Status;
 
 
     if (!Op)
@@ -522,10 +523,18 @@ AcpiDmDumpDescending (
 
         if (Op->Common.Value.String)
         {
-            AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Common.Value.String,
+            Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Common.Value.String,
                 NULL, &Path);
-            AcpiOsPrintf ("%s %p", Path, Op->Common.Node);
-            ACPI_FREE (Path);
+            if (ACPI_SUCCESS (Status))
+            {
+                AcpiOsPrintf ("%s %p", Path, Op->Common.Node);
+                ACPI_FREE (Path);
+            }
+            else
+            {
+                AcpiOsPrintf ("Could not externalize pathname for node [%4.4s]",
+                    Op->Common.Node->Name.Ascii);
+            }
         }
         else
         {
@@ -592,7 +601,9 @@ AcpiDmFindOrphanDescending (
         return (AE_OK);
     }
 
+#ifdef ACPI_UNDER_DEVELOPMENT
     OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+#endif
 
     switch (Op->Common.AmlOpcode)
     {
@@ -830,9 +841,9 @@ AcpiDmLoadDescendingOp (
          * 2) Not the root node
          * 3) Not a node created by Scope
          */
-
-        if (!PreDefined && Node != AcpiGbl_RootNode &&
-            Op->Common.AmlOpcode != AML_SCOPE_OP)
+        if (!PreDefined &&
+            (Node != AcpiGbl_RootNode) &&
+            (Op->Common.AmlOpcode != AML_SCOPE_OP))
         {
             Node->OwnerId = WalkState->OwnerId;
         }
@@ -1091,7 +1102,7 @@ AcpiDmCommonDescendingOp (
     /* Switch/Case conversion */
 
     Status = AcpiDmProcessSwitch (Op);
-    return (AE_OK);
+    return (Status);
 }
 
 

Modified: stable/12/sys/contrib/dev/acpica/common/dmrestag.c
==============================================================================
--- stable/12/sys/contrib/dev/acpica/common/dmrestag.c	Tue Jan  7 20:24:21 2020	(r356470)
+++ stable/12/sys/contrib/dev/acpica/common/dmrestag.c	Tue Jan  7 20:35:43 2020	(r356471)
@@ -833,8 +833,12 @@ AcpiGetTagPathname (
 
     /* Internalize the namepath to AML format */
 
-    AcpiNsInternalizeName (Pathname, &InternalPath);
+    Status = AcpiNsInternalizeName (Pathname, &InternalPath);
     ACPI_FREE (Pathname);
+    if (ACPI_FAILURE (Status))
+    {
+        return (NULL);
+    }
 
     /* Update the Op with the symbol */
 

Modified: stable/12/sys/contrib/dev/acpica/common/dmtables.c
==============================================================================
--- stable/12/sys/contrib/dev/acpica/common/dmtables.c	Tue Jan  7 20:24:21 2020	(r356470)
+++ stable/12/sys/contrib/dev/acpica/common/dmtables.c	Tue Jan  7 20:35:43 2020	(r356471)
@@ -327,7 +327,7 @@ AdCreateTableHeader (
      * makes it easier to rename the disassembled ASL file if needed.
      */
     AcpiOsPrintf (
-        "DefinitionBlock (\"\", \"%4.4s\", %hu, \"%.6s\", \"%.8s\", 0x%8.8X)\n",
+        "DefinitionBlock (\"\", \"%4.4s\", %u, \"%.6s\", \"%.8s\", 0x%8.8X)\n",
         Table->Signature, Table->Revision,
         Table->OemId, Table->OemTableId, Table->OemRevision);
 }
@@ -443,8 +443,8 @@ AdGetLocalTables (
     /* Get the DSDT via table override */
 
     ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_DSDT);
-    AcpiOsTableOverride (&TableHeader, &NewTable);
-    if (!NewTable)
+    Status = AcpiOsTableOverride (&TableHeader, &NewTable);
+    if (ACPI_FAILURE (Status) || !NewTable)
     {
         fprintf (stderr, "Could not obtain DSDT\n");
         return (AE_NO_ACPI_TABLES);
@@ -508,6 +508,8 @@ AdParseTable (
     AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER));
     ASL_CV_INIT_FILETREE(Table, AmlStart, AmlLength);
 
+    AcpiUtSetIntegerWidth (Table->Revision);
+
     /* Create the root object */
 
     AcpiGbl_ParseOpRoot = AcpiPsCreateScopeOp (AmlStart);
@@ -543,7 +545,6 @@ AdParseTable (
     }
 
     WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;
-    WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
 
     Status = AcpiPsParseAml (WalkState);
     if (ACPI_FAILURE (Status))
@@ -601,7 +602,7 @@ AdParseTable (
     fprintf (stderr,
         "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n");
 
-    Status = AcpiDmParseDeferredOps (AcpiGbl_ParseOpRoot);
+    (void) AcpiDmParseDeferredOps (AcpiGbl_ParseOpRoot);
     fprintf (stderr, "\n");
 
     /* Process Resource Templates */

Modified: stable/12/sys/contrib/dev/acpica/common/dmtbdump1.c
==============================================================================
--- stable/12/sys/contrib/dev/acpica/common/dmtbdump1.c	Tue Jan  7 20:24:21 2020	(r356470)
+++ stable/12/sys/contrib/dev/acpica/common/dmtbdump1.c	Tue Jan  7 20:35:43 2020	(r356471)
@@ -474,7 +474,6 @@ AcpiDmDumpCsrt (
                 {
                     return;
                 }
-                SubSubOffset += InfoLength;
             }
 
             /* Point to next sub-subtable */
@@ -1401,7 +1400,6 @@ AcpiDmDumpHmat (
     while (Offset < Table->Length)
     {
         AcpiOsPrintf ("\n");
-        SubtableOffset = 0;
 
         /* Dump HMAT structure header */
 
@@ -1484,6 +1482,11 @@ AcpiDmDumpHmat (
                 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
                     ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset),
                     4, AcpiDmTableInfoHmat1a);
+                if (ACPI_FAILURE (Status))
+                {
+                    return;
+                }
+
                 SubtableOffset += 4;
             }
 
@@ -1500,6 +1503,11 @@ AcpiDmDumpHmat (
                 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
                     ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset),
                     4, AcpiDmTableInfoHmat1b);
+                if (ACPI_FAILURE (Status))
+                {
+                    return;
+                }
+
                 SubtableOffset += 4;
             }
 
@@ -1519,6 +1527,11 @@ AcpiDmDumpHmat (
                     Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
                         ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset),
                         2, AcpiDmTableInfoHmat1c);
+                    if (ACPI_FAILURE(Status))
+                    {
+                        return;
+                    }
+
                     SubtableOffset += 2;
                 }
             }
@@ -1542,6 +1555,11 @@ AcpiDmDumpHmat (
                 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
                     ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset),
                     2, AcpiDmTableInfoHmat2a);
+                if (ACPI_FAILURE (Status))
+                {
+                    return;
+                }
+
                 SubtableOffset += 2;
             }
             break;

Modified: stable/12/sys/contrib/dev/acpica/common/dmtbdump2.c
==============================================================================
--- stable/12/sys/contrib/dev/acpica/common/dmtbdump2.c	Tue Jan  7 20:24:21 2020	(r356470)
+++ stable/12/sys/contrib/dev/acpica/common/dmtbdump2.c	Tue Jan  7 20:35:43 2020	(r356471)
@@ -187,6 +187,7 @@ AcpiDmDumpIort (
     ACPI_DMTABLE_INFO       *InfoTable;
     char                    *String;
     UINT32                  i;
+    UINT32                  MappingByteLength;
 
 
     /* Main table */
@@ -314,6 +315,11 @@ AcpiDmDumpIort (
                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
                         4, AcpiDmTableInfoIort0a);
+                    if (ACPI_FAILURE (Status))
+                    {
+                        return;
+                    }
+
                     NodeOffset += 4;
                 }
             }
@@ -325,8 +331,10 @@ AcpiDmDumpIort (
 
             if (IortNode->Length > NodeOffset)
             {
+                MappingByteLength =
+                    IortNode->MappingCount * sizeof (ACPI_IORT_ID_MAPPING);
                 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
-                    Table, IortNode->Length - NodeOffset,
+                    Table, IortNode->Length - NodeOffset - MappingByteLength,
                     AcpiDmTableInfoIort1a);
                 if (ACPI_FAILURE (Status))
                 {
@@ -410,7 +418,6 @@ NextSubtable:
         /* Point to next node subtable */
 
         Offset += IortNode->Length;
-        IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, IortNode->Length);
     }
 }
 
@@ -871,7 +878,7 @@ AcpiDmDumpMcfg (
         if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
         {
             AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n",
-                sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
+                (UINT32) sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
             return;
         }
 
@@ -1211,7 +1218,6 @@ AcpiDmDumpNfit (
             /* Has a variable number of 32-bit values at the end */
 
             InfoTable = AcpiDmTableInfoNfit2;
-            Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable);
             FieldOffset = sizeof (ACPI_NFIT_INTERLEAVE);
             break;
 
@@ -1236,7 +1242,6 @@ AcpiDmDumpNfit (
             /* Has a variable number of 64-bit addresses at the end */
 
             InfoTable = AcpiDmTableInfoNfit6;
-            Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable);
             FieldOffset = sizeof (ACPI_NFIT_FLUSH_ADDRESS) - sizeof (UINT64);
             break;
 
@@ -1273,6 +1278,7 @@ AcpiDmDumpNfit (
         {
         case ACPI_NFIT_TYPE_INTERLEAVE:
 
+            Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable);
             for (i = 0; i < Interleave->LineCount; i++)
             {
                 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
@@ -1308,6 +1314,7 @@ AcpiDmDumpNfit (
 
         case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
 
+            Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable);
             for (i = 0; i < Hint->HintCount; i++)
             {
                 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
@@ -1806,6 +1813,11 @@ AcpiDmDumpPptt (
                 Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
                     ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset),
                     4, AcpiDmTableInfoPptt0a);
+                if (ACPI_FAILURE (Status))
+                {
+                    return;
+                }
+
                 SubtableOffset += 4;
             }
             break;
@@ -2063,6 +2075,10 @@ AcpiDmDumpSdev (
                 Status = AcpiDmDumpTable (Table->Length, 0,
                     ACPI_ADD_PTR (UINT8, Pcie, VendorDataOffset),
                     VendorDataLength, AcpiDmTableInfoSdev1b);
+                if (ACPI_FAILURE (Status))
+                {
+                    return;
+                }
             }
             break;
 

Modified: stable/12/sys/contrib/dev/acpica/common/dmtbdump3.c
==============================================================================
--- stable/12/sys/contrib/dev/acpica/common/dmtbdump3.c	Tue Jan  7 20:24:21 2020	(r356470)
+++ stable/12/sys/contrib/dev/acpica/common/dmtbdump3.c	Tue Jan  7 20:35:43 2020	(r356471)
@@ -410,7 +410,7 @@ AcpiDmDumpStao (
         Namepath = ACPI_ADD_PTR (char, Table, Offset);
         StringLength = strlen (Namepath) + 1;
 
-        AcpiDmLineHeader (Offset, StringLength, "Namestring");
+        AcpiDmLineHeader (Offset, StringLength, "Namepath");
         AcpiOsPrintf ("\"%s\"\n", Namepath);
 
         /* Point to next namepath */
@@ -526,7 +526,7 @@ AcpiDmDumpTpm2Rev3 (
     {
     case ACPI_TPM23_ACPI_START_METHOD:
 
-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
+        (void) AcpiDmDumpTable (Table->Length, Offset, Subtable,
             Table->Length - Offset, AcpiDmTableInfoTpm23a);
         break;
 
@@ -591,7 +591,7 @@ AcpiDmDumpTpm2 (
         Offset += sizeof (ACPI_TPM2_TRAILER);
 
         AcpiOsPrintf ("\n");
-        Status = AcpiDmDumpTable (Table->Length, Offset, ArmSubtable,
+        (void) AcpiDmDumpTable (Table->Length, Offset, ArmSubtable,
             Table->Length - Offset, AcpiDmTableInfoTpm211);
         break;
 

Modified: stable/12/sys/contrib/dev/acpica/compiler/aslanalyze.c
==============================================================================
--- stable/12/sys/contrib/dev/acpica/compiler/aslanalyze.c	Tue Jan  7 20:24:21 2020	(r356470)
+++ stable/12/sys/contrib/dev/acpica/compiler/aslanalyze.c	Tue Jan  7 20:35:43 2020	(r356471)
@@ -569,7 +569,7 @@ ApCheckForGpeNameConflict (
 
     /* Need a null-terminated string version of NameSeg */
 
-    ACPI_MOVE_32_TO_32 (Name, &Op->Asl.NameSeg);
+    ACPI_MOVE_32_TO_32 (Name, Op->Asl.NameSeg);
     Name[ACPI_NAMESEG_SIZE] = 0;
 
     /*

Modified: stable/12/sys/contrib/dev/acpica/compiler/aslbtypes.c
==============================================================================
--- stable/12/sys/contrib/dev/acpica/compiler/aslbtypes.c	Tue Jan  7 20:24:21 2020	(r356470)
+++ stable/12/sys/contrib/dev/acpica/compiler/aslbtypes.c	Tue Jan  7 20:35:43 2020	(r356471)
@@ -474,7 +474,6 @@ AnFormatBtype (
             strcat (Buffer, "|");
         }
 
-        First = FALSE;
         strcat (Buffer, "Resource");
     }
 }

Modified: stable/12/sys/contrib/dev/acpica/compiler/aslcache.c
==============================================================================
--- stable/12/sys/contrib/dev/acpica/compiler/aslcache.c	Tue Jan  7 20:24:21 2020	(r356470)
+++ stable/12/sys/contrib/dev/acpica/compiler/aslcache.c	Tue Jan  7 20:35:43 2020	(r356471)
@@ -421,7 +421,7 @@ UtDeleteLocalCaches (
     DbgPrint (ASL_DEBUG_OUTPUT,
         "%u ParseOps, Buffer size: %u ops (%u bytes), %u Buffers\n",
         AslGbl_ParseOpCount, ASL_PARSEOP_CACHE_SIZE,
-        (sizeof (ACPI_PARSE_OBJECT) * ASL_PARSEOP_CACHE_SIZE), BufferCount);
+        ((UINT32) sizeof (ACPI_PARSE_OBJECT) * ASL_PARSEOP_CACHE_SIZE), BufferCount);
 
     /* Reset cache globals */
 
@@ -445,7 +445,7 @@ UtDeleteLocalCaches (
     DbgPrint (ASL_DEBUG_OUTPUT,
         "%u Fields, Buffer size: %u fields (%u bytes), %u Buffers\n",
         AslGbl_FieldCount, ASL_FIELD_CACHE_SIZE,
-        (sizeof (DT_FIELD) * ASL_FIELD_CACHE_SIZE), BufferCount);
+        ((UINT32) sizeof (DT_FIELD) * ASL_FIELD_CACHE_SIZE), BufferCount);
 
     /* Reset cache globals */
 
@@ -468,7 +468,7 @@ UtDeleteLocalCaches (
     DbgPrint (ASL_DEBUG_OUTPUT,
         "%u Subtables, Buffer size: %u subtables (%u bytes), %u Buffers\n",
         AslGbl_SubtableCount, ASL_SUBTABLE_CACHE_SIZE,
-        (sizeof (DT_SUBTABLE) * ASL_SUBTABLE_CACHE_SIZE), BufferCount);
+        ((UINT32) sizeof (DT_SUBTABLE) * ASL_SUBTABLE_CACHE_SIZE), BufferCount);
 
     /* Reset cache globals */
 

Modified: stable/12/sys/contrib/dev/acpica/compiler/aslcodegen.c
==============================================================================
--- stable/12/sys/contrib/dev/acpica/compiler/aslcodegen.c	Tue Jan  7 20:24:21 2020	(r356470)
+++ stable/12/sys/contrib/dev/acpica/compiler/aslcodegen.c	Tue Jan  7 20:35:43 2020	(r356471)
@@ -618,8 +618,8 @@ CgWriteTableHeader (
         Op->Asl.AmlSubtreeLength +=
             strlen (AslGbl_ParseTreeRoot->Asl.Filename) + 3;
 
-        CvDbgPrint ("     Length: %lu\n",
-            strlen (AslGbl_ParseTreeRoot->Asl.Filename) + 3);
+        CvDbgPrint ("     Length: %u\n",
+            (UINT32) strlen (AslGbl_ParseTreeRoot->Asl.Filename) + 3);
 
         if (Op->Asl.CommentList)
         {

Modified: stable/12/sys/contrib/dev/acpica/compiler/aslcompile.c
==============================================================================
--- stable/12/sys/contrib/dev/acpica/compiler/aslcompile.c	Tue Jan  7 20:24:21 2020	(r356470)
+++ stable/12/sys/contrib/dev/acpica/compiler/aslcompile.c	Tue Jan  7 20:35:43 2020	(r356471)
@@ -220,6 +220,7 @@ CmDoCompile (
         PrDoPreprocess ();
         AslGbl_CurrentLineNumber = 1;
         AslGbl_LogicalLineNumber = 1;
+        AslGbl_CurrentLineOffset = 0;
 
         if (AslGbl_PreprocessOnly)
         {
@@ -282,25 +283,6 @@ CmDoCompile (
 
     LsDumpParseTree ();
 
-    OpcGetIntegerWidth (AslGbl_ParseTreeRoot->Asl.Child);
-    UtEndEvent (Event);
-
-    /* Pre-process parse tree for any operator transforms */
-
-    Event = UtBeginEvent ("Parse tree transforms");
-    DbgPrint (ASL_DEBUG_OUTPUT, "\nParse tree transforms\n\n");
-    TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE,
-        TrAmlTransformWalkBegin, TrAmlTransformWalkEnd, NULL);
-    UtEndEvent (Event);
-
-    /* Generate AML opcodes corresponding to the parse tokens */
-
-    Event = UtBeginEvent ("Generate AML opcodes");
-    DbgPrint (ASL_DEBUG_OUTPUT, "Generating AML opcodes\n\n");
-    TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL,
-        OpcAmlOpcodeWalk, NULL);
-    UtEndEvent (Event);
-
     UtEndEvent (FullCompile);
     return (AE_OK);
 
@@ -331,6 +313,25 @@ CmDoAslMiddleAndBackEnd (
     ACPI_STATUS             Status;
 
 
+    OpcGetIntegerWidth (AslGbl_ParseTreeRoot->Asl.Child);
+
+    /* Pre-process parse tree for any operator transforms */
+
+    Event = UtBeginEvent ("Parse tree transforms");
+    DbgPrint (ASL_DEBUG_OUTPUT, "\nParse tree transforms\n\n");
+    TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE,
+        TrAmlTransformWalkBegin, TrAmlTransformWalkEnd, NULL);
+    UtEndEvent (Event);
+
+    /* Generate AML opcodes corresponding to the parse tokens */
+
+    Event = UtBeginEvent ("Generate AML opcodes");
+    DbgPrint (ASL_DEBUG_OUTPUT, "Generating AML opcodes\n\n");
+    TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD,
+        NULL, OpcAmlOpcodeWalk, NULL);
+    UtEndEvent (Event);
+
+
     /* Interpret and generate all compile-time constants */
 
     Event = UtBeginEvent ("Constant folding via AML interpreter");
@@ -853,10 +854,11 @@ CmDumpAllEvents (
  *
  ******************************************************************************/
 
-void
+int
 CmCleanupAndExit (
     void)
 {
+    int                     Status = 0;
     BOOLEAN                 DeleteAmlFile = FALSE;
     ASL_GLOBAL_FILE_NODE    *CurrentFileNode = AslGbl_FilesList;
 
@@ -915,20 +917,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_PreprocessOnly || ((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:
@@ -952,6 +972,8 @@ CmCleanupAndExit (
     {
         UtDeleteLocalCaches ();
     }
+
+    return (Status);
 }
 
 

Modified: stable/12/sys/contrib/dev/acpica/compiler/aslcompiler.h
==============================================================================
--- stable/12/sys/contrib/dev/acpica/compiler/aslcompiler.h	Tue Jan  7 20:24:21 2020	(r356470)
+++ stable/12/sys/contrib/dev/acpica/compiler/aslcompiler.h	Tue Jan  7 20:35:43 2020	(r356471)
@@ -266,7 +266,7 @@ void
 CmDoOutputFiles (
     void);
 
-void
+int
 CmCleanupAndExit (
     void);
 
@@ -1052,6 +1052,7 @@ void
 FlCloseFile (
     UINT32                  FileId);
 
+ACPI_PRINTF_LIKE (2)
 void
 FlPrintFile (
     UINT32                  FileId,
@@ -1195,6 +1196,7 @@ OtXrefWalkPart1 (
 /*
  * aslutils - common compiler utilities
  */
+ACPI_PRINTF_LIKE(2)
 void
 DbgPrint (
     UINT32                  Type,
@@ -1288,6 +1290,10 @@ UtInternalizeName (
     char                    *ExternalName,
     char                    **ConvertedName);
 
+BOOLEAN
+UtNameContainsAllPrefix (
+    ACPI_PARSE_OBJECT       *Op);
+
 void
 UtAttachNamepathToOwner (
     ACPI_PARSE_OBJECT       *Op,
@@ -1303,7 +1309,16 @@ UINT64
 UtDoConstant (
     char                    *String);
 
+char *
+AcpiUtStrdup (
+    char                    *String);
 
+char *
+AcpiUtStrcat (
+    char                    *String1,
+    char                    *String2);
+
+
 /*
  * asluuid - UUID support
  */
@@ -1604,6 +1619,7 @@ DtCreateTemplates (
 /*
  * ASL/ASL+ converter debug
  */
+ACPI_PRINTF_LIKE (1)
 void
 CvDbgPrint (
     char                    *Fmt,

Modified: stable/12/sys/contrib/dev/acpica/compiler/asldebug.c
==============================================================================
--- stable/12/sys/contrib/dev/acpica/compiler/asldebug.c	Tue Jan  7 20:24:21 2020	(r356470)
+++ stable/12/sys/contrib/dev/acpica/compiler/asldebug.c	Tue Jan  7 20:35:43 2020	(r356471)
@@ -239,7 +239,7 @@ UtDumpIntegerOp (
     case 8: /* Dword */
 
         DbgPrint (ASL_TREE_OUTPUT,
-            "%*.*X", IntegerLength, IntegerLength, Op->Asl.Value.Integer);
+            "%*.*X", IntegerLength, IntegerLength, (UINT32) Op->Asl.Value.Integer);
         break;
 
     case 16: /* Qword and Integer */

Modified: stable/12/sys/contrib/dev/acpica/compiler/asldefine.h
==============================================================================
--- stable/12/sys/contrib/dev/acpica/compiler/asldefine.h	Tue Jan  7 20:24:21 2020	(r356470)
+++ stable/12/sys/contrib/dev/acpica/compiler/asldefine.h	Tue Jan  7 20:35:43 2020	(r356471)
@@ -222,11 +222,11 @@
 
 /* Misc */
 
-#define ASL_EXTERNAL_METHOD         255
-#define ASL_ABORT                   TRUE
-#define ASL_NO_ABORT                FALSE
-#define ASL_EOF                     ACPI_UINT32_MAX
-#define ASL_IGNORE_LINE            (ACPI_UINT32_MAX -1)
+#define ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS  255
+#define ASL_ABORT                           TRUE
+#define ASL_NO_ABORT                        FALSE
+#define ASL_EOF                             ACPI_UINT32_MAX
+#define ASL_IGNORE_LINE                     (ACPI_UINT32_MAX -1)
 
 
 /* Listings */
@@ -290,7 +290,7 @@
 
 #define ASL_PARSE_TREE_DEBUG2 \
     " %08X %04X %04X %01X     %04X  %04X %05X  %05X   "\
-    "%08X %08X %08X %08X %08X %08X %04X  %02d  %5d %5d %5d %5d"
+    "%8p %8p %8p %8p %08X %08X %04X  %02d  %5d %5d %5d %5d"
 
 /*
  * Macros for ASL/ASL+ converter

Modified: stable/12/sys/contrib/dev/acpica/compiler/aslerror.c
==============================================================================
--- stable/12/sys/contrib/dev/acpica/compiler/aslerror.c	Tue Jan  7 20:24:21 2020	(r356470)
+++ stable/12/sys/contrib/dev/acpica/compiler/aslerror.c	Tue Jan  7 20:35:43 2020	(r356471)
@@ -335,7 +335,7 @@ AeAddToErrorLog (
  * PARAMETERS:  OutputFile      - Output file
  *              Enode           - Error node to print
  *              PrematureEOF    - True = PrematureEOF has been reached
- *              Total           - Total legth of line
+ *              Total           - Total length of line
  *
  * RETURN:      None
  *
@@ -445,7 +445,7 @@ AeDecodeErrorMessageId (
  * PARAMETERS:  OutputFile      - Output file
  *              Enode           - Error node to print
  *              PrematureEOF    - True = PrematureEOF has been reached
- *              Total           - amount of characters printed so far
+ *              Total           - Number of characters printed so far
  *
  *
  * RETURN:      Status
@@ -527,6 +527,7 @@ AePrintErrorSourceLine (
                 fprintf (OutputFile, "\n");
                 return AE_OK;
             }
+
             /*
              * Seek to the offset in the combined source file,
              * read the source line, and write it to the output.
@@ -550,8 +551,9 @@ AePrintErrorSourceLine (
                     AslGbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
                 return AE_IO_ERROR;
             }
-                /* Read/write the source line, up to the maximum line length */
 
+            /* Read/write the source line, up to the maximum line length */
+
             while (RActual && SourceByte && (SourceByte != '\n'))
             {
                 if (*Total < 256)
@@ -732,7 +734,7 @@ AePrintException (
  *
  * RETURN:      None
  *
- * DESCRIPTION: Print the contents of an error nodes. This function is tailored
+ * DESCRIPTION: Print the contents of an error node. This function is tailored
  *              to print error nodes that are SubErrors within ASL_ERROR_MSG
  *
  ******************************************************************************/
@@ -795,8 +797,8 @@ AePrintErrorLog (
  *              LogicalLineNumber   - Cumulative line number
  *              LogicalByteOffset   - Byte offset in source file
  *              Column              - Column in current line
- *              Filename            - source filename
- *              ExtraMessage        - additional error message
+ *              Filename            - Source filename
+ *              ExtraMessage        - Additional error message
  *              SourceLine          - Line of error source code
  *              SubError            - SubError of this InputEnode
  *
@@ -863,10 +865,17 @@ static void AslInitEnode (
             Enode->FilenameLength = 6;
         }
 
-        FileNode = FlGetCurrentFileNode ();
+        /*
+         * Attempt to get the file node of the filename listed in the parse
+         * node. If the name doesn't exist in the global file node, it is
+         * because the file is included by #include or ASL include. In this
+         * case, get the current file node. The source output of the current
+         * file will contain the contents of the file listed in the parse node.
+         */
+        FileNode = FlGetFileNode (ASL_FILE_INPUT, Filename);
         if (!FileNode)
         {
-            return;
+            FileNode = FlGetCurrentFileNode ();
         }
 
         Enode->SourceFilename =
@@ -884,8 +893,8 @@ static void AslInitEnode (
  *              LineNumber          - Actual file line number
  *              Column              - Column in current line
  *              SourceLine          - Actual source code line
- *              Filename            - source filename
- *              ExtraMessage        - additional error message
+ *              Filename            - Source filename
+ *              ExtraMessage        - Additional error message
  *
  * RETURN:      None
  *
@@ -918,8 +927,8 @@ AslCommonError2 (
  *              LogicalLineNumber   - Cumulative line number
  *              LogicalByteOffset   - Byte offset in source file
  *              Column              - Column in current line
- *              Filename            - source filename
- *              ExtraMessage        - additional error message
+ *              Filename            - Source filename
+ *              ExtraMessage        - Additional error message
  *
  * RETURN:      None
  *
@@ -961,8 +970,8 @@ AslCommonError (
  *              LogicalLineNumber   - Cumulative line number
  *              LogicalByteOffset   - Byte offset in source file
  *              Column              - Column in current line
- *              Filename            - source filename
- *              Message             - additional error message
+ *              Filename            - Source filename
+ *              Message             - Additional error message
  *              SourceLine          - Actual line of source code
  *              SubError            - Sub-error associated with this error
  *
@@ -1025,7 +1034,7 @@ AslLogNewError (
  * PARAMETERS:  Level           - Seriousness (Warning/error, etc.)
  *              MessageId       - Index into global message buffer
  *
- * RETURN:      UINT8           - modified level
+ * RETURN:      UINT8           - Modified level
  *
  * DESCRIPTION: Get the modified level of exception codes that are reported as
  *              errors from the -ww option.
@@ -1369,7 +1378,7 @@ AslIsExceptionDisabled (
  *              MainMsg         - Message pertaining to the MainOp
  *              SubMsgId        - Index into global message buffer
  *              SubOp           - Additional parse node for better message
- *              SubMsg          - Message pertainint to SubOp
+ *              SubMsg          - Message pertaining to SubOp
  *
  *
  * RETURN:      None
@@ -1421,7 +1430,7 @@ AslDualParseOpError (
  * PARAMETERS:  Level               - Seriousness (Warning/error, etc.)
  *              MessageId           - Index into global message buffer
  *              Op                  - Parse node where error happened
- *              ExtraMessage        - additional error message
+ *              ExtraMessage        - Additional error message
  *
  * RETURN:      None
  *
@@ -1459,7 +1468,7 @@ AslError (
  *
  * PARAMETERS:  Op                  - Parse node where error happened
  *              Status              - The ACPICA Exception
- *              ExtraMessage        - additional error message
+ *              ExtraMessage        - Additional error message
  *              Abort               - TRUE -> Abort compilation
  *
  * RETURN:      None

Modified: stable/12/sys/contrib/dev/acpica/compiler/aslfiles.c
==============================================================================
--- stable/12/sys/contrib/dev/acpica/compiler/aslfiles.c	Tue Jan  7 20:24:21 2020	(r356470)
+++ stable/12/sys/contrib/dev/acpica/compiler/aslfiles.c	Tue Jan  7 20:35:43 2020	(r356471)
@@ -207,12 +207,6 @@ FlInitOneFile (
     NewFileNode = ACPI_CAST_PTR (ASL_GLOBAL_FILE_NODE,
         UtLocalCacheCalloc (sizeof (ASL_GLOBAL_FILE_NODE)));
 
-    if (!NewFileNode)
-    {
-        AslError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION, NULL, NULL);
-        return (AE_NO_MEMORY);
-    }
-
     NewFileNode->ParserErrorDetected = FALSE;
     NewFileNode->Next = AslGbl_FilesList;
 
@@ -420,8 +414,22 @@ ASL_GLOBAL_FILE_NODE *
 FlGetCurrentFileNode (
     void)
 {
-    return (FlGetFileNode (
-        ASL_FILE_INPUT,AslGbl_Files[ASL_FILE_INPUT].Filename));
+    ASL_GLOBAL_FILE_NODE    *FileNode =
+        FlGetFileNode (ASL_FILE_INPUT,AslGbl_Files[ASL_FILE_INPUT].Filename);
+
+
+    if (!FileNode)
+    {
+        /*
+         * If the current file node does not exist after initializing the file
+         * node structures, something went wrong and this is an unrecoverable
+         * condition.
+         */
+        FlFileError (ASL_FILE_INPUT, ASL_MSG_COMPILER_INTERNAL);
+        AslAbort ();
+    }
+
+    return (FileNode);
 }
 
 

Modified: stable/12/sys/contrib/dev/acpica/compiler/aslglobal.h
==============================================================================
--- stable/12/sys/contrib/dev/acpica/compiler/aslglobal.h	Tue Jan  7 20:24:21 2020	(r356470)
+++ stable/12/sys/contrib/dev/acpica/compiler/aslglobal.h	Tue Jan  7 20:35:43 2020	(r356471)
@@ -244,7 +244,6 @@ extern const char                   *AslGbl_SpecialNam
 #endif
 
 
-
 /*

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-all mailing list