Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 03 Sep 2019 14:06:26 -0000
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r345980 - in head/sys/contrib/dev/acpica: . common compiler components/events components/namespace include
Message-ID:  <201904060602.x3662gLP030506@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jkim
Date: Sat Apr  6 06:02:42 2019
New Revision: 345980
URL: https://svnweb.freebsd.org/changeset/base/345980

Log:
  MFV:	r345969
  
  Import ACPICA 20190405.

Modified:
  head/sys/contrib/dev/acpica/changes.txt
  head/sys/contrib/dev/acpica/common/adisasm.c
  head/sys/contrib/dev/acpica/compiler/aslcodegen.c
  head/sys/contrib/dev/acpica/compiler/aslcompile.c
  head/sys/contrib/dev/acpica/compiler/aslcompiler.h
  head/sys/contrib/dev/acpica/compiler/asldefine.h
  head/sys/contrib/dev/acpica/compiler/aslerror.c
  head/sys/contrib/dev/acpica/compiler/aslfileio.c
  head/sys/contrib/dev/acpica/compiler/aslfiles.c
  head/sys/contrib/dev/acpica/compiler/aslglobal.h
  head/sys/contrib/dev/acpica/compiler/asllisting.c
  head/sys/contrib/dev/acpica/compiler/aslload.c
  head/sys/contrib/dev/acpica/compiler/aslmain.c
  head/sys/contrib/dev/acpica/compiler/aslmessages.c
  head/sys/contrib/dev/acpica/compiler/aslmessages.h
  head/sys/contrib/dev/acpica/compiler/asloperands.c
  head/sys/contrib/dev/acpica/compiler/asloptions.c
  head/sys/contrib/dev/acpica/compiler/aslstartup.c
  head/sys/contrib/dev/acpica/compiler/aslsupport.l
  head/sys/contrib/dev/acpica/compiler/asltree.c
  head/sys/contrib/dev/acpica/compiler/asltypes.h
  head/sys/contrib/dev/acpica/compiler/aslutils.c
  head/sys/contrib/dev/acpica/compiler/aslxref.c
  head/sys/contrib/dev/acpica/compiler/dtcompile.c
  head/sys/contrib/dev/acpica/compiler/prutils.c
  head/sys/contrib/dev/acpica/components/events/evgpe.c
  head/sys/contrib/dev/acpica/components/namespace/nsalloc.c
  head/sys/contrib/dev/acpica/include/acpixf.h
Directory Properties:
  head/sys/contrib/dev/acpica/   (props changed)

Modified: head/sys/contrib/dev/acpica/changes.txt
==============================================================================
--- head/sys/contrib/dev/acpica/changes.txt	Sat Apr  6 05:34:51 2019	(r345979)
+++ head/sys/contrib/dev/acpica/changes.txt	Sat Apr  6 06:02:42 2019	(r345980)
@@ -1,4 +1,38 @@
 ----------------------------------------
+05 April 2019. Summary of changes for version 20190405:
+
+
+1) ACPICA kernel-resident subsystem:
+
+Event Manager: History: Commit 18996f2db918 ("ACPICA: Events: Stop 
+unconditionally clearing ACPI IRQs during suspend/resume") was added 
+earlier to stop clearing of event status bits unconditionally on suspend 
+and resume paths. Though this change fixed an issue on suspend path, it 
+introduced regressions on several resume paths. In the case of S0ix, 
+events are enabled as part of device suspend path. If status bits for the 
+events are set when they are enabled, it could result in premature wake 
+from S0ix. If status is cleared for any event that is being enabled so 
+that any stale events are cleared out. In case of S0ix, events are 
+enabled as part of device suspend path. If status bits for the events are 
+set when they are enabled, it could result in premature wake from S0ix.
+
+This change ensures that status is cleared for any event that is being 
+enabled so that any stale events are cleared out.
+
+
+2) iASL Compiler/Disassembler and ACPICA tools:
+
+iASL: Implemented an enhanced multiple file compilation that combines 
+named objects from all input files to a single namespace. With this 
+feature, any unresolved external declarations as well as duplicate named 
+object declarations can be detected during compilation rather than 
+generating errors much later at runtime. The following commands are 
+examples that utilize this feature:
+    iasl dsdt.asl ssdt.asl
+    iasl dsdt.asl ssdt1.asl ssdt2.asl
+    iasl dsdt.asl ssdt*.asl
+
+----------------------------------------
 29 March 2019. Summary of changes for version 20190329:
 
 

Modified: head/sys/contrib/dev/acpica/common/adisasm.c
==============================================================================
--- head/sys/contrib/dev/acpica/common/adisasm.c	Sat Apr  6 05:34:51 2019	(r345979)
+++ head/sys/contrib/dev/acpica/common/adisasm.c	Sat Apr  6 06:02:42 2019	(r345980)
@@ -579,7 +579,7 @@ AdDisassembleOneTable (
         if (AslGbl_MapfileFlag)
         {
             fprintf (stderr, "%14s %s - %u bytes\n",
-                AslGbl_Files[ASL_FILE_MAP_OUTPUT].ShortDescription,
+                AslGbl_FileDescs[ASL_FILE_MAP_OUTPUT].ShortDescription,
                 AslGbl_Files[ASL_FILE_MAP_OUTPUT].Filename,
                 FlGetFileSize (ASL_FILE_MAP_OUTPUT));
         }

Modified: head/sys/contrib/dev/acpica/compiler/aslcodegen.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslcodegen.c	Sat Apr  6 05:34:51 2019	(r345979)
+++ head/sys/contrib/dev/acpica/compiler/aslcodegen.c	Sat Apr  6 06:02:42 2019	(r345980)
@@ -174,11 +174,11 @@ CgWriteTableHeader (
     ACPI_PARSE_OBJECT       *Op);
 
 static void
-CgCloseTable (
-    void);
+CgWriteNode (
+    ACPI_PARSE_OBJECT       *Op);
 
 static void
-CgWriteNode (
+CgUpdateHeader (
     ACPI_PARSE_OBJECT       *Op);
 
 
@@ -202,15 +202,12 @@ CgGenerateAmlOutput (
 
     /* Generate the AML output file */
 
-    FlSeekFile (ASL_FILE_SOURCE_OUTPUT, 0);
-    AslGbl_SourceLine = 0;
-    AslGbl_NextError = AslGbl_ErrorLog;
-
-    TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,
+    TrWalkParseTree (AslGbl_CurrentDB,
+        ASL_WALK_VISIT_DOWNWARD | ASL_WALK_VISIT_DB_SEPARATELY,
         CgAmlWriteWalk, NULL, NULL);
 
     DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_HEADER2);
-    CgCloseTable ();
+    CgUpdateHeader (AslGbl_CurrentDB);
 }
 
 
@@ -708,38 +705,13 @@ CgUpdateHeader (
         ACPI_OFFSET (ACPI_TABLE_HEADER, Checksum));
 
     FlWriteFile (ASL_FILE_AML_OUTPUT, &Checksum, 1);
-}
 
-
-/*******************************************************************************
- *
- * FUNCTION:    CgCloseTable
- *
- * PARAMETERS:  None.
- *
- * RETURN:      None.
- *
- * DESCRIPTION: Complete the ACPI table by calculating the checksum and
- *              re-writing each table header. This allows support for
- *              multiple definition blocks in a single source file.
- *
- ******************************************************************************/
-
-static void
-CgCloseTable (
-    void)
-{
-    ACPI_PARSE_OBJECT   *Op;
-
-
-    /* Process all definition blocks */
-
-    Op = AslGbl_ParseTreeRoot->Asl.Child;
-    while (Op)
-    {
-        CgUpdateHeader (Op);
-        Op = Op->Asl.Next;
-    }
+    /*
+     * Seek to the end of the file. This is done to support multiple file
+     * compilation. Doing this simplifies other parts of the codebase because
+     * it eliminates the need to seek for a different starting place.
+     */
+    FlSeekFile (ASL_FILE_AML_OUTPUT, Op->Asl.FinalAmlOffset + Length);
 }
 
 

Modified: head/sys/contrib/dev/acpica/compiler/aslcompile.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslcompile.c	Sat Apr  6 05:34:51 2019	(r345979)
+++ head/sys/contrib/dev/acpica/compiler/aslcompile.c	Sat Apr  6 06:02:42 2019	(r345980)
@@ -178,7 +178,11 @@ static void
 CmDumpAllEvents (
     void);
 
+static void
+CmFinishFiles(
+    BOOLEAN                 DeleteAmlFile);
 
+
 /*******************************************************************************
  *
  * FUNCTION:    CmDoCompile
@@ -191,13 +195,13 @@ CmDumpAllEvents (
  *
  ******************************************************************************/
 
-int
+ACPI_STATUS
 CmDoCompile (
     void)
 {
-    ACPI_STATUS             Status;
     UINT8                   FullCompile;
     UINT8                   Event;
+    ASL_GLOBAL_FILE_NODE    *FileNode;
 
 
     FullCompile = UtBeginEvent ("*** Total Compile time ***");
@@ -221,7 +225,7 @@ CmDoCompile (
         {
             UtEndEvent (Event);
             CmCleanupAndExit ();
-            return (0);
+            return (AE_OK);
         }
     }
     UtEndEvent (Event);
@@ -239,6 +243,12 @@ CmDoCompile (
     {
         fprintf (stderr,
             "Compiler aborting due to parser-detected syntax error(s)\n");
+
+        /* Flag this error in the FileNode for compilation summary */
+
+        FileNode = FlGetCurrentFileNode ();
+        FileNode->ParserErrorDetected = TRUE;
+        AslGbl_ParserErrorDetected = TRUE;
         LsDumpParseTree ();
         goto ErrorExit;
     }
@@ -292,20 +302,36 @@ CmDoCompile (
         OpcAmlOpcodeWalk, NULL);
     UtEndEvent (Event);
 
-    /*
-     * Now that the input is parsed, we can open the AML output file.
-     * Note: by default, the name of this file comes from the table
-     * descriptor within the input file.
-     */
-    Event = UtBeginEvent ("Open AML output file");
-    Status = FlOpenAmlOutputFile (AslGbl_OutputFilenamePrefix);
-    UtEndEvent (Event);
-    if (ACPI_FAILURE (Status))
-    {
-        AePrintErrorLog (ASL_FILE_STDERR);
-        return (-1);
-    }
+    UtEndEvent (FullCompile);
+    return (AE_OK);
 
+ErrorExit:
+    UtEndEvent (FullCompile);
+    return (AE_ERROR);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    CmDoAslMiddleAndBackEnd
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status of middle-end and back-end
+ *
+ * DESCRIPTION: Perform compiler middle-end (type checking and semantic
+ *              analysis) and back-end (code generation)
+ *
+ ******************************************************************************/
+
+int
+CmDoAslMiddleAndBackEnd (
+    void)
+{
+    UINT8                   Event;
+    ACPI_STATUS             Status;
+
+
     /* Interpret and generate all compile-time constants */
 
     Event = UtBeginEvent ("Constant folding via AML interpreter");
@@ -351,7 +377,6 @@ CmDoCompile (
             AePrintErrorLog (ASL_FILE_STDOUT);
             UtDisplaySummary (ASL_FILE_STDOUT);
         }
-        UtEndEvent (FullCompile);
         return (0);
     }
 
@@ -367,7 +392,7 @@ CmDoCompile (
     UtEndEvent (Event);
     if (ACPI_FAILURE (Status))
     {
-        goto ErrorExit;
+        return (-1);
     }
 
     /* Namespace cross-reference */
@@ -378,7 +403,7 @@ CmDoCompile (
     Status = XfCrossReferenceNamespace ();
     if (ACPI_FAILURE (Status))
     {
-        goto ErrorExit;
+        return (-1);
     }
 
     /* Namespace - Check for non-referenced objects */
@@ -486,22 +511,47 @@ CmDoCompile (
 
     Event = UtBeginEvent ("Generate AML code and write output files");
     DbgPrint (ASL_DEBUG_OUTPUT, "Writing AML byte code\n\n");
-    CgGenerateAmlOutput ();
+
+    AslGbl_CurrentDB = AslGbl_ParseTreeRoot->Asl.Child;
+
+    while (AslGbl_CurrentDB)
+    {
+        switch  (FlSwitchFileSet(AslGbl_CurrentDB->Asl.Filename))
+        {
+            case SWITCH_TO_DIFFERENT_FILE:
+                /*
+                 * Reset these parameters when definition blocks belong in
+                 * different files. If they belong in the same file, there is
+                 * no need to reset these parameters
+                 */
+                FlSeekFile (ASL_FILE_SOURCE_OUTPUT, 0);
+                AslGbl_SourceLine = 0;
+                AslGbl_NextError = AslGbl_ErrorLog;
+
+                /* fall-through */
+
+            case SWITCH_TO_SAME_FILE:
+
+                CgGenerateAmlOutput ();
+                CmDoOutputFiles ();
+                AslGbl_CurrentDB = AslGbl_CurrentDB->Asl.Next;
+
+                break;
+
+            default: /* FILE_NOT_FOUND */
+
+                /* The requested file could not be found. Get out of here */
+
+                AslGbl_CurrentDB = NULL;
+                break;
+        }
+    }
     UtEndEvent (Event);
 
     Event = UtBeginEvent ("Write optional output files");
-    CmDoOutputFiles ();
     UtEndEvent (Event);
 
-    UtEndEvent (FullCompile);
-    AslCheckExpectedExceptions ();
-    CmCleanupAndExit ();
     return (0);
-
-ErrorExit:
-    UtEndEvent (FullCompile);
-    CmCleanupAndExit ();
-    return (-1);
 }
 
 
@@ -808,10 +858,14 @@ void
 CmCleanupAndExit (
     void)
 {
-    UINT32                  i;
     BOOLEAN                 DeleteAmlFile = FALSE;
+    ASL_GLOBAL_FILE_NODE    *CurrentFileNode = AslGbl_FilesList;
 
 
+    /* Check if any errors occurred during compile */
+
+    (void) AslCheckForErrorExit ();
+
     AePrintErrorLog (ASL_FILE_STDERR);
     if (AslGbl_DebugFlag)
     {
@@ -865,15 +919,63 @@ CmCleanupAndExit (
      * We will delete the AML file if there are errors and the
      * force AML output option has not been used.
      */
-    if ((AslGbl_ExceptionCount[ASL_ERROR] > 0) &&
+    if (AslGbl_ParserErrorDetected || ((AslGbl_ExceptionCount[ASL_ERROR] > 0) &&
         (!AslGbl_IgnoreErrors) &&
-        AslGbl_Files[ASL_FILE_AML_OUTPUT].Handle)
+        AslGbl_Files[ASL_FILE_AML_OUTPUT].Handle))
     {
         DeleteAmlFile = TRUE;
     }
 
     /* Close all open files */
 
+    while (CurrentFileNode)
+    {
+        switch  (FlSwitchFileSet (CurrentFileNode->Files[ASL_FILE_INPUT].Filename))
+        {
+            case SWITCH_TO_SAME_FILE:
+            case SWITCH_TO_DIFFERENT_FILE:
+
+                CmFinishFiles (DeleteAmlFile);
+                CurrentFileNode = CurrentFileNode->Next;
+                break;
+
+            case FILE_NOT_FOUND:
+            default:
+
+                CurrentFileNode = NULL;
+                break;
+        }
+    }
+
+    /* Final cleanup after compiling one file */
+
+    if (!AslGbl_DoAslConversion)
+    {
+        UtDeleteLocalCaches ();
+    }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    CmFinishFiles
+ *
+ * PARAMETERS:  DeleteAmlFile
+ *
+ * RETURN:      None.
+ *
+ * DESCRIPTION: Close all open files, delete AML files depending on the
+ *              function parameter is true.
+ *
+ ******************************************************************************/
+
+static void
+CmFinishFiles(
+    BOOLEAN                 DeleteAmlFile)
+{
+    UINT32                  i;
+
+
     /*
      * Take care with the preprocessor file (.pre), it might be the same
      * as the "input" file, depending on where the compiler has terminated
@@ -890,7 +992,15 @@ CmCleanupAndExit (
 
     for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++)
     {
-        FlCloseFile (i);
+        /*
+         * Some files such as debug output files could be pointing to
+         * stderr or stdout. Leave these alone.
+         */
+        if (AslGbl_Files[i].Handle != stderr &&
+            AslGbl_Files[i].Handle != stdout)
+        {
+            FlCloseFile (i);
+        }
     }
 
     /* Delete AML file if there are errors */
@@ -922,12 +1032,5 @@ CmCleanupAndExit (
     if (!AslGbl_SourceOutputFlag)
     {
         FlDeleteFile (ASL_FILE_SOURCE_OUTPUT);
-    }
-
-    /* Final cleanup after compiling one file */
-
-    if (!AslGbl_DoAslConversion)
-    {
-        UtDeleteLocalCaches ();
     }
 }

Modified: head/sys/contrib/dev/acpica/compiler/aslcompiler.h
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslcompiler.h	Sat Apr  6 05:34:51 2019	(r345979)
+++ head/sys/contrib/dev/acpica/compiler/aslcompiler.h	Sat Apr  6 06:02:42 2019	(r345980)
@@ -254,10 +254,14 @@ void
 AslCompilerFileHeader (
     UINT32                  FileId);
 
-int
+ACPI_STATUS
 CmDoCompile (
     void);
 
+int
+CmDoAslMiddleAndBackEnd (
+    void);
+
 void
 CmDoOutputFiles (
     void);
@@ -266,7 +270,11 @@ void
 CmCleanupAndExit (
     void);
 
+ACPI_STATUS
+AslDoDisassembly (
+    void);
 
+
 /*
  * aslallocate - memory allocation
  */
@@ -875,9 +883,10 @@ ExDoExternal (
 
 /* Values for "Visitation" parameter above */
 
-#define ASL_WALK_VISIT_DOWNWARD     0x01
-#define ASL_WALK_VISIT_UPWARD       0x02
-#define ASL_WALK_VISIT_TWICE        (ASL_WALK_VISIT_DOWNWARD | ASL_WALK_VISIT_UPWARD)
+#define ASL_WALK_VISIT_DOWNWARD         0x01
+#define ASL_WALK_VISIT_UPWARD           0x02
+#define ASL_WALK_VISIT_DB_SEPARATELY    0x04
+#define ASL_WALK_VISIT_TWICE            (ASL_WALK_VISIT_DOWNWARD | ASL_WALK_VISIT_UPWARD)
 
 
 /*
@@ -1035,6 +1044,11 @@ FlSeekFile (
     long                    Offset);
 
 void
+FlSeekFileSet (
+    UINT32                  FileId,
+    long                    Offset);
+
+void
 FlCloseFile (
     UINT32                  FileId);
 
@@ -1068,6 +1082,34 @@ ACPI_STATUS
 FlOpenMiscOutputFiles (
     char                    *InputFilename);
 
+ACPI_STATUS
+FlInitOneFile (
+    char                    *InputFilename);
+
+ASL_FILE_SWITCH_STATUS
+FlSwitchFileSet (
+    char                    *InputFilename);
+
+FILE *
+FlGetFileHandle (
+    UINT32                  OutFileId,
+    UINT32                  InFileId,
+    char                    *Filename);
+
+ASL_GLOBAL_FILE_NODE *
+FlGetFileNode (
+    UINT32                  FileId,
+    char                    *Filename);
+
+ASL_GLOBAL_FILE_NODE *
+FlGetCurrentFileNode (
+    void);
+
+BOOLEAN
+FlInputFileExists (
+    char                    *InputFilename);
+
+
 /*
  * aslhwmap - hardware map summary
  */
@@ -1083,7 +1125,6 @@ ACPI_STATUS
 LdLoadNamespace (
     ACPI_PARSE_OBJECT       *RootOp);
 
-
 /*
  * asllookup - namespace lookup functions
  */
@@ -1091,6 +1132,7 @@ void
 LkFindUnreferencedObjects (
     void);
 
+
 /*
  * aslhelp - help screens
  */
@@ -1118,6 +1160,7 @@ void
 NsSetupNamespaceListing (
     void                    *Handle);
 
+
 /*
  * asloptions - command line processing
  */
@@ -1126,6 +1169,7 @@ AslCommandLine (
     int                     argc,
     char                    **argv);
 
+
 /*
  * aslxref - namespace cross reference
  */
@@ -1221,6 +1265,11 @@ UtDisplaySummary (
     UINT32                  FileId);
 
 void
+UtDisplayOneSummary (
+    UINT32                  FileId,
+    BOOLEAN                 DisplayErrorSummary);
+
+void
 UtConvertByteToHex (
     UINT8                   RawByte,
     UINT8                   *Buffer);
@@ -1271,6 +1320,7 @@ AuConvertUuidToString (
     char                    *UuIdBuffer,
     char                    *OutString);
 
+
 /*
  * aslresource - Resource template generation utilities
  */
@@ -1477,6 +1527,7 @@ RsDoPinGroupFunctionDescriptor (
 ASL_RESOURCE_NODE *
 RsDoPinGroupConfigDescriptor (
     ASL_RESOURCE_INFO       *Info);
+
 
 /*
  * aslrestype2d - DWord address descriptors

Modified: head/sys/contrib/dev/acpica/compiler/asldefine.h
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/asldefine.h	Sat Apr  6 05:34:51 2019	(r345979)
+++ head/sys/contrib/dev/acpica/compiler/asldefine.h	Sat Apr  6 06:02:42 2019	(r345980)
@@ -298,5 +298,4 @@
 #define COMMENT_CAPTURE_ON    AslGbl_CommentState.CaptureComments = TRUE;
 #define COMMENT_CAPTURE_OFF   AslGbl_CommentState.CaptureComments = FALSE;
 
-
 #endif /* ASLDEFINE.H */

Modified: head/sys/contrib/dev/acpica/compiler/aslerror.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslerror.c	Sat Apr  6 05:34:51 2019	(r345979)
+++ head/sys/contrib/dev/acpica/compiler/aslerror.c	Sat Apr  6 06:02:42 2019	(r345980)
@@ -474,10 +474,12 @@ AePrintErrorSourceLine (
          * Use the merged header/source file if present, otherwise
          * use input file
          */
-        SourceFile = AslGbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle;
+        SourceFile = FlGetFileHandle (ASL_FILE_SOURCE_OUTPUT,
+            ASL_FILE_SOURCE_OUTPUT, Enode->SourceFilename);
         if (!SourceFile)
         {
-            SourceFile = AslGbl_Files[ASL_FILE_INPUT].Handle;
+            SourceFile = FlGetFileHandle (ASL_FILE_INPUT,
+                ASL_FILE_INPUT, Enode->Filename);
         }
 
         if (SourceFile)
@@ -818,6 +820,7 @@ static void AslInitEnode (
     ASL_ERROR_MSG           *SubError)
 {
     ASL_ERROR_MSG           *Enode;
+    ASL_GLOBAL_FILE_NODE    *FileNode;
 
 
     *InputEnode = UtLocalCalloc (sizeof (ASL_ERROR_MSG));
@@ -859,6 +862,23 @@ static void AslInitEnode (
         {
             Enode->FilenameLength = 6;
         }
+
+        FileNode = FlGetCurrentFileNode ();
+        if (!FileNode)
+        {
+            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;
+	}
     }
 }
 
@@ -992,7 +1012,7 @@ AslLogNewError (
     }
 
     AslGbl_ExceptionCount[ModifiedLevel]++;
-    if (AslGbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT)
+    if (!AslGbl_IgnoreErrors && AslGbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT)
     {
         printf ("\nMaximum error count (%u) exceeded\n", ASL_MAX_ERROR_COUNT);
 

Modified: head/sys/contrib/dev/acpica/compiler/aslfileio.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslfileio.c	Sat Apr  6 05:34:51 2019	(r345979)
+++ head/sys/contrib/dev/acpica/compiler/aslfileio.c	Sat Apr  6 06:02:42 2019	(r345980)
@@ -177,7 +177,7 @@ FlFileError (
 {
 
     sprintf (AslGbl_MsgBuffer, "\"%s\" (%s) - %s", AslGbl_Files[FileId].Filename,
-        AslGbl_Files[FileId].Description, strerror (errno));
+        AslGbl_FileDescs[FileId].Description, strerror (errno));
 
     AslCommonError (ASL_ERROR, ErrorId, 0, 0, 0, 0, NULL, AslGbl_MsgBuffer);
 }
@@ -500,7 +500,7 @@ FlDeleteFile (
     if (remove (Info->Filename))
     {
         printf ("%s (%s file) ",
-            Info->Filename, Info->Description);
+            Info->Filename, AslGbl_FileDescs[FileId].Description);
         perror ("Could not delete");
     }
 

Modified: head/sys/contrib/dev/acpica/compiler/aslfiles.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslfiles.c	Sat Apr  6 05:34:51 2019	(r345979)
+++ head/sys/contrib/dev/acpica/compiler/aslfiles.c	Sat Apr  6 06:02:42 2019	(r345980)
@@ -172,6 +172,257 @@ FlParseInputPathname (
 
 /*******************************************************************************
  *
+ * FUNCTION:    FlInitOneFile
+ *
+ * PARAMETERS:  InputFilename       - The user-specified ASL source file to be
+ *                                    compiled
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Initialize global file structure for one input file. This file
+ *              structure contains references to input, output, debugging, and
+ *              other miscellaneous files that are associated for a single
+ *              input ASL file.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+FlInitOneFile (
+    char                    *InputFilename)
+{
+    UINT32                  i;
+    ASL_GLOBAL_FILE_NODE    *NewFileNode;
+
+
+    if (FlInputFileExists (InputFilename))
+    {
+        AslError (ASL_ERROR, ASL_MSG_DUPLICATE_INPUT_FILE, NULL, InputFilename);
+        return (AE_ALREADY_EXISTS);
+    }
+
+    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;
+
+    AslGbl_FilesList = NewFileNode;
+    AslGbl_Files = NewFileNode->Files;
+
+    for (i = 0; i < ASL_NUM_FILES; i++)
+    {
+        AslGbl_Files[i].Handle = NULL;
+        AslGbl_Files[i].Filename = NULL;
+    }
+
+    AslGbl_Files[ASL_FILE_STDOUT].Handle   = stdout;
+    AslGbl_Files[ASL_FILE_STDOUT].Filename = "STDOUT";
+
+    if (AslGbl_VerboseErrors)
+    {
+        AslGbl_Files[ASL_FILE_STDERR].Handle = stderr;
+    }
+    else
+    {
+        AslGbl_Files[ASL_FILE_STDERR].Handle = stdout;
+    }
+
+    AslGbl_Files[ASL_FILE_STDERR].Filename = "STDERR";
+    return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    FlInputFileExists
+ *
+ * PARAMETERS:  Filename       - File name to be searched
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Returns true if the file name already exists.
+ *
+ ******************************************************************************/
+
+BOOLEAN
+FlInputFileExists (
+    char                    *Filename)
+{
+    ASL_GLOBAL_FILE_NODE    *Current = AslGbl_FilesList;
+
+
+    while (Current)
+    {
+        if (!strcmp (Filename, Current->Files[ASL_FILE_INPUT].Filename))
+        {
+            return (TRUE);
+        }
+
+        Current = Current->Next;
+    }
+
+    return (FALSE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    FlSwitchFileSet
+ *
+ * PARAMETERS:  Op        - Parse node for the LINE asl statement
+ *
+ * RETURN:      None.
+ *
+ * DESCRIPTION: Set the current line number
+ *
+ ******************************************************************************/
+
+ASL_FILE_SWITCH_STATUS
+FlSwitchFileSet (
+    char                    *InputFilename)
+{
+    ASL_GLOBAL_FILE_NODE    *Current = AslGbl_FilesList;
+    char                    *PrevFilename = Current->Files[ASL_FILE_INPUT].Filename;
+
+
+    while (Current)
+    {
+        if (!strcmp(Current->Files[ASL_FILE_INPUT].Filename, InputFilename))
+        {
+            AslGbl_Files = Current->Files;
+            AslGbl_TableSignature = Current->TableSignature;
+            AslGbl_TableId = Current->TableId;
+
+            if (!strcmp (InputFilename, PrevFilename))
+            {
+                return (SWITCH_TO_SAME_FILE);
+            }
+            else
+            {
+                return (SWITCH_TO_DIFFERENT_FILE);
+            }
+        }
+
+        Current = Current->Next;
+    }
+
+    return (FILE_NOT_FOUND);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    FlGetFileHandle
+ *
+ * PARAMETERS:  OutFileId       - denotes file type of output handle
+ *              InFileId        - denotes file type of the input Filename
+ *              Filename
+ *
+ * RETURN:      File handle
+ *
+ * DESCRIPTION: Get the file handle for a particular filename/FileId. This
+ *              function also allows the caller to specify the file Id of the
+ *              desired type.
+ *
+ ******************************************************************************/
+
+FILE *
+FlGetFileHandle (
+    UINT32                  OutFileId,
+    UINT32                  InFileId,
+    char                    *Filename)
+{
+    ASL_GLOBAL_FILE_NODE    *Current = AslGbl_FilesList;
+
+
+    if (!Filename)
+    {
+        return (NULL);
+    }
+
+    while (Current)
+    {
+        if (!strcmp (Current->Files[InFileId].Filename, Filename))
+        {
+            return (Current->Files[OutFileId].Handle);
+        }
+
+        Current = Current->Next;
+    }
+
+    return (NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    FlGetFileNode
+ *
+ * PARAMETERS:  FileId        - File type (ID) of the input Filename
+ *              Filename      - File to search for
+ *
+ * RETURN:      A global file node
+ *
+ * DESCRIPTION: Get the file node for a particular filename/FileId.
+ *
+ ******************************************************************************/
+
+ASL_GLOBAL_FILE_NODE *
+FlGetFileNode (
+    UINT32                  FileId,
+    char                    *Filename)
+{
+    ASL_GLOBAL_FILE_NODE    *Current = AslGbl_FilesList;
+
+
+    if (!Filename)
+    {
+        return (NULL);
+    }
+
+    while (Current)
+    {
+        if (!strcmp (Current->Files[FileId].Filename, Filename))
+        {
+            return (Current);
+        }
+
+        Current = Current->Next;
+    }
+
+    return (NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    FlGetCurrentFileNode
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Global file node
+ *
+ * DESCRIPTION: Get the current input file node
+ *
+ ******************************************************************************/
+
+ASL_GLOBAL_FILE_NODE *
+FlGetCurrentFileNode (
+    void)
+{
+    return (FlGetFileNode (
+        ASL_FILE_INPUT,AslGbl_Files[ASL_FILE_INPUT].Filename));
+}
+
+
+/*******************************************************************************
+ *
  * FUNCTION:    FlSetLineNumber
  *
  * PARAMETERS:  Op        - Parse node for the LINE asl statement
@@ -426,8 +677,6 @@ FlOpenIncludeWithPrefix (
     IncludeFile = fopen (Pathname, "r");
     if (!IncludeFile)
     {
-        fprintf (stderr, "Could not open include file %s\n", Pathname);
-        ACPI_FREE (Pathname);
         return (NULL);
     }
 

Modified: head/sys/contrib/dev/acpica/compiler/aslglobal.h
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslglobal.h	Sat Apr  6 05:34:51 2019	(r345979)
+++ head/sys/contrib/dev/acpica/compiler/aslglobal.h	Sat Apr  6 06:02:42 2019	(r345980)
@@ -172,28 +172,27 @@
 UINT32                              AslGbl_ExceptionCount[ASL_NUM_REPORT_LEVELS] = {0,0,0,0,0,0};
 
 /* Table below must match ASL_FILE_TYPES in asltypes.h */
-
-ASL_FILE_INFO                       AslGbl_Files [ASL_NUM_FILES] =
+ASL_FILE_DESC                       AslGbl_FileDescs [ASL_NUM_FILES] =
 {
-    {NULL, NULL, "stdout:       ", "Standard Output"},
-    {NULL, NULL, "stderr:       ", "Standard Error"},
-    {NULL, NULL, "Table Input:  ", "Source Input"},
-    {NULL, NULL, "Binary Output:", "AML Output"},
-    {NULL, NULL, "Source Output:", "Source Output"},
-    {NULL, NULL, "Preprocessor: ", "Preprocessor Output"},
-    {NULL, NULL, "Preprocessor: ", "Preprocessor Temp File"},
-    {NULL, NULL, "Listing File: ", "Listing Output"},
-    {NULL, NULL, "Hex Dump:     ", "Hex Table Output"},
-    {NULL, NULL, "Namespace:    ", "Namespace Output"},
-    {NULL, NULL, "Debug File:   ", "Debug Output"},
-    {NULL, NULL, "ASM Source:   ", "Assembly Code Output"},
-    {NULL, NULL, "C Source:     ", "C Code Output"},
-    {NULL, NULL, "ASM Include:  ", "Assembly Header Output"},
-    {NULL, NULL, "C Include:    ", "C Header Output"},
-    {NULL, NULL, "Offset Table: ", "C Offset Table Output"},
-    {NULL, NULL, "Device Map:   ", "Device Map Output"},
-    {NULL, NULL, "Cross Ref:    ", "Cross-reference Output"},
-    {NULL, NULL, "Converter db :", "Converter debug Output"}
+    {"stdout:       ", "Standard Output"},
+    {"stderr:       ", "Standard Error"},
+    {"Table Input:  ", "Source Input"},
+    {"Binary Output:", "AML Output"},
+    {"Source Output:", "Source Output"},
+    {"Preprocessor: ", "Preprocessor Output"},
+    {"Preprocessor: ", "Preprocessor Temp File"},
+    {"Listing File: ", "Listing Output"},
+    {"Hex Dump:     ", "Hex Table Output"},
+    {"Namespace:    ", "Namespace Output"},
+    {"Debug File:   ", "Debug Output"},
+    {"ASM Source:   ", "Assembly Code Output"},
+    {"C Source:     ", "C Code Output"},
+    {"ASM Include:  ", "Assembly Header Output"},
+    {"C Include:    ", "C Header Output"},
+    {"Offset Table: ", "C Offset Table Output"},
+    {"Device Map:   ", "Device Map Output"},
+    {"Cross Ref:    ", "Cross-reference Output"},
+    {"Converter dbg:", "Converter debug Output"}
 };
 
 /* Table below must match the defines with the same names in actypes.h */
@@ -225,8 +224,8 @@ const char                          *AslGbl_OpFlagName
 };
 
 #else
+extern ASL_FILE_DESC                AslGbl_FileDescs [ASL_NUM_FILES];
 extern UINT32                       AslGbl_ExceptionCount[ASL_NUM_REPORT_LEVELS];
-extern ASL_FILE_INFO                AslGbl_Files [ASL_NUM_FILES];
 extern const char                   *AslGbl_OpFlagNames[ACPI_NUM_OP_FLAGS];
 #endif
 
@@ -269,7 +268,6 @@ ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (A
 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (AslGbl_CurrentLineNumber, 1);

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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201904060602.x3662gLP030506>