ACK: [PATCH 1/3] ACPICA: Update to version 20190405

ivanhu ivan.hu at canonical.com
Fri Apr 19 02:58:40 UTC 2019


On 4/8/19 10:51 PM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> changes in this release of ACPICA are detailed at the following
> link on the ACPICA developer mailing list:
>
> https://lists.acpica.org/pipermail/devel/2019-April/001889.html
>
> This also required some rework with the fwts iasl interface
> because of changes to where error messages are now being written
> (stderr rather than stdout).
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>  src/acpi/syntaxcheck/syntaxcheck.c            |   4 +-
>  src/acpica/source/common/adisasm.c            |   2 +-
>  src/acpica/source/compiler/aslcodegen.c       |  52 +---
>  src/acpica/source/compiler/aslcompile.c       | 183 ++++++++++---
>  src/acpica/source/compiler/aslcompiler.h      |  61 ++++-
>  src/acpica/source/compiler/asldefine.h        |   1 -
>  src/acpica/source/compiler/aslerror.c         |  26 +-
>  src/acpica/source/compiler/aslfileio.c        |   4 +-
>  src/acpica/source/compiler/aslfiles.c         | 253 +++++++++++++++++-
>  src/acpica/source/compiler/aslglobal.h        |  48 ++--
>  src/acpica/source/compiler/asllisting.c       |   7 +-
>  src/acpica/source/compiler/aslload.c          |   1 +
>  src/acpica/source/compiler/aslmain.c          |  81 ++++--
>  src/acpica/source/compiler/aslmessages.c      |   7 +-
>  src/acpica/source/compiler/aslmessages.h      |   5 +-
>  src/acpica/source/compiler/asloperands.c      |  25 ++
>  src/acpica/source/compiler/asloptions.c       |   1 -
>  src/acpica/source/compiler/aslstartup.c       | 130 ++++-----
>  src/acpica/source/compiler/aslsupport.l       |  12 +-
>  src/acpica/source/compiler/asltree.c          |  70 ++++-
>  src/acpica/source/compiler/asltypes.h         |  62 +++--
>  src/acpica/source/compiler/aslutils.c         | 156 +++++++++--
>  src/acpica/source/compiler/aslxref.c          |  18 ++
>  src/acpica/source/compiler/dtcompile.c        |  11 +-
>  .../source/compiler/fwts_iasl_interface.c     |  42 +--
>  src/acpica/source/compiler/prutils.c          |   1 -
>  src/acpica/source/components/events/evgpe.c   |   8 +
>  .../source/components/namespace/nsalloc.c     |   5 +
>  src/acpica/source/include/acpixf.h            |   2 +-
>  29 files changed, 978 insertions(+), 300 deletions(-)
>
> diff --git a/src/acpi/syntaxcheck/syntaxcheck.c b/src/acpi/syntaxcheck/syntaxcheck.c
> index 5d1ea112..d1eb0798 100644
> --- a/src/acpi/syntaxcheck/syntaxcheck.c
> +++ b/src/acpi/syntaxcheck/syntaxcheck.c
> @@ -488,9 +488,9 @@ static int syntaxcheck_single_table(
>  	fwts_log_info(fw, "Checking ACPI table %s (#%d)", info->name, n);
>  	fwts_log_nl(fw);
>  
> -	if (iasl_stdout) {
> +	if (iasl_stderr) {
>  		/* Scan error text from assembly */
> -		fwts_list_foreach(item, iasl_stdout) {
> +		fwts_list_foreach(item, iasl_stderr) {
>  			int num;
>  			char ch;
>  			char *line = fwts_text_list_text(item);
> diff --git a/src/acpica/source/common/adisasm.c b/src/acpica/source/common/adisasm.c
> index 518468b7..c73208f6 100644
> --- a/src/acpica/source/common/adisasm.c
> +++ b/src/acpica/source/common/adisasm.c
> @@ -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));
>          }
> diff --git a/src/acpica/source/compiler/aslcodegen.c b/src/acpica/source/compiler/aslcodegen.c
> index 8edcb668..88e34824 100644
> --- a/src/acpica/source/compiler/aslcodegen.c
> +++ b/src/acpica/source/compiler/aslcodegen.c
> @@ -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);
>  }
>  
>  
> diff --git a/src/acpica/source/compiler/aslcompile.c b/src/acpica/source/compiler/aslcompile.c
> index c46b28da..845f15bc 100644
> --- a/src/acpica/source/compiler/aslcompile.c
> +++ b/src/acpica/source/compiler/aslcompile.c
> @@ -178,6 +178,10 @@ static void
>  CmDumpAllEvents (
>      void);
>  
> +static void
> +CmFinishFiles(
> +    BOOLEAN                 DeleteAmlFile);
> +
>  
>  /*******************************************************************************
>   *
> @@ -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,19 +302,35 @@ 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 */
>  
> @@ -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 */
> @@ -923,11 +1033,4 @@ CmCleanupAndExit (
>      {
>          FlDeleteFile (ASL_FILE_SOURCE_OUTPUT);
>      }
> -
> -    /* Final cleanup after compiling one file */
> -
> -    if (!AslGbl_DoAslConversion)
> -    {
> -        UtDeleteLocalCaches ();
> -    }
>  }
> diff --git a/src/acpica/source/compiler/aslcompiler.h b/src/acpica/source/compiler/aslcompiler.h
> index efcee77b..ad0e73f3 100644
> --- a/src/acpica/source/compiler/aslcompiler.h
> +++ b/src/acpica/source/compiler/aslcompiler.h
> @@ -254,10 +254,14 @@ void
>  AslCompilerFileHeader (
>      UINT32                  FileId);
>  
> -int
> +ACPI_STATUS
>  CmDoCompile (
>      void);
>  
> +int
> +CmDoAslMiddleAndBackEnd (
> +    void);
> +
>  void
>  CmDoOutputFiles (
>      void);
> @@ -266,6 +270,10 @@ 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)
>  
>  
>  /*
> @@ -1034,6 +1043,11 @@ FlSeekFile (
>      UINT32                  FileId,
>      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
>   */
> @@ -1220,6 +1264,11 @@ void
>  UtDisplaySummary (
>      UINT32                  FileId);
>  
> +void
> +UtDisplayOneSummary (
> +    UINT32                  FileId,
> +    BOOLEAN                 DisplayErrorSummary);
> +
>  void
>  UtConvertByteToHex (
>      UINT8                   RawByte,
> @@ -1271,6 +1320,7 @@ AuConvertUuidToString (
>      char                    *UuIdBuffer,
>      char                    *OutString);
>  
> +
>  /*
>   * aslresource - Resource template generation utilities
>   */
> @@ -1478,6 +1528,7 @@ ASL_RESOURCE_NODE *
>  RsDoPinGroupConfigDescriptor (
>      ASL_RESOURCE_INFO       *Info);
>  
> +
>  /*
>   * aslrestype2d - DWord address descriptors
>   */
> diff --git a/src/acpica/source/compiler/asldefine.h b/src/acpica/source/compiler/asldefine.h
> index 8089d0b9..cffb0af1 100644
> --- a/src/acpica/source/compiler/asldefine.h
> +++ b/src/acpica/source/compiler/asldefine.h
> @@ -298,5 +298,4 @@
>  #define COMMENT_CAPTURE_ON    AslGbl_CommentState.CaptureComments = TRUE;
>  #define COMMENT_CAPTURE_OFF   AslGbl_CommentState.CaptureComments = FALSE;
>  
> -
>  #endif /* ASLDEFINE.H */
> diff --git a/src/acpica/source/compiler/aslerror.c b/src/acpica/source/compiler/aslerror.c
> index a2f9fcef..db6d871d 100644
> --- a/src/acpica/source/compiler/aslerror.c
> +++ b/src/acpica/source/compiler/aslerror.c
> @@ -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);
>  
> diff --git a/src/acpica/source/compiler/aslfileio.c b/src/acpica/source/compiler/aslfileio.c
> index 3243ab51..3db7b533 100644
> --- a/src/acpica/source/compiler/aslfileio.c
> +++ b/src/acpica/source/compiler/aslfileio.c
> @@ -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");
>      }
>  
> diff --git a/src/acpica/source/compiler/aslfiles.c b/src/acpica/source/compiler/aslfiles.c
> index 0120af02..80a74e81 100644
> --- a/src/acpica/source/compiler/aslfiles.c
> +++ b/src/acpica/source/compiler/aslfiles.c
> @@ -170,6 +170,257 @@ FlParseInputPathname (
>  #endif
>  
>  
> +/*******************************************************************************
> + *
> + * 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
> @@ -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);
>      }
>  
> diff --git a/src/acpica/source/compiler/aslglobal.h b/src/acpica/source/compiler/aslglobal.h
> index bc7358cd..213c5408 100644
> --- a/src/acpica/source/compiler/aslglobal.h
> +++ b/src/acpica/source/compiler/aslglobal.h
> @@ -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_OpFlagNames[ACPI_NUM_OP_FLAGS] =
>  };
>  
>  #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 (AslGbl_CurrentColumn, 0);
>  ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (AslGbl_CurrentLineNumber, 1);
>  ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (AslGbl_LogicalLineNumber, 1);
>  ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (AslGbl_CurrentLineOffset, 0);
> -ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (AslGbl_OriginalInputFileSize, 0);
>  ASL_EXTERN UINT8                    ASL_INIT_GLOBAL (AslGbl_SyntaxError, 0);
>  
>  /* Exception reporting */
> @@ -300,6 +298,7 @@ ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (AslGbl_ListingFlag, FALSE);
>  ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (AslGbl_IgnoreErrors, FALSE);
>  ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (AslGbl_SourceOutputFlag, FALSE);
>  ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (AslGbl_ParseOnlyFlag, FALSE);
> +ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (AslGbl_ParserErrorDetected, FALSE);
>  ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (AslGbl_CompileTimesFlag, FALSE);
>  ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (AslGbl_FoldConstants, TRUE);
>  ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (AslGbl_VerboseErrors, TRUE);
> @@ -385,6 +384,7 @@ ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (AslGbl_SourceLine, 0);
>  ASL_EXTERN UINT8                    ASL_INIT_GLOBAL (AslGbl_FileType, 0);
>  ASL_EXTERN char                     ASL_INIT_GLOBAL (*AslGbl_Signature, NULL);
>  ASL_EXTERN ACPI_PARSE_OBJECT        ASL_INIT_GLOBAL (*AslGbl_ParseTreeRoot, NULL);
> +ASL_EXTERN ACPI_PARSE_OBJECT        ASL_INIT_GLOBAL (*AslGbl_CurrentDB, NULL);
>  ASL_EXTERN ACPI_PARSE_OBJECT        ASL_INIT_GLOBAL (*AslGbl_ExternalsListHead, NULL);
>  ASL_EXTERN ASL_LISTING_NODE         ASL_INIT_GLOBAL (*AslGbl_ListingNode, NULL);
>  ASL_EXTERN ACPI_PARSE_OBJECT        *AslGbl_FirstLevelInsertionNode;
> @@ -403,6 +403,8 @@ ASL_EXTERN UINT16                   ASL_INIT_GLOBAL (AslGbl_PruneType, 0);
>  ASL_EXTERN ASL_FILE_NODE            ASL_INIT_GLOBAL (*AslGbl_IncludeFileStack, NULL);
>  ASL_EXTERN char                     ASL_INIT_GLOBAL (*AslGbl_TableSignature, "NO_SIG");
>  ASL_EXTERN char                     ASL_INIT_GLOBAL (*AslGbl_TableId, "NO_ID");
> +ASL_EXTERN ASL_FILE_INFO            ASL_INIT_GLOBAL (*AslGbl_Files, NULL);
> +ASL_EXTERN ASL_GLOBAL_FILE_NODE     ASL_INIT_GLOBAL (*AslGbl_FilesList, NULL);
>  
>  /* Specific to the -q option */
>  
> diff --git a/src/acpica/source/compiler/asllisting.c b/src/acpica/source/compiler/asllisting.c
> index df3b7587..7bc118bc 100644
> --- a/src/acpica/source/compiler/asllisting.c
> +++ b/src/acpica/source/compiler/asllisting.c
> @@ -254,6 +254,7 @@ static void
>  LsGenerateListing (
>      UINT32                  FileId)
>  {
> +    UINT32                  WalkMode = ASL_WALK_VISIT_DOWNWARD | ASL_WALK_VISIT_DB_SEPARATELY;
>  
>      /* Start at the beginning of both the source and AML files */
>  
> @@ -271,7 +272,7 @@ LsGenerateListing (
>  
>          LsDoOffsetTableHeader (FileId);
>  
> -        TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,
> +        TrWalkParseTree (AslGbl_CurrentDB, WalkMode,
>              LsAmlOffsetWalk, NULL, (void *) ACPI_TO_POINTER (FileId));
>          LsDoOffsetTableFooter (FileId);
>          return;
> @@ -279,7 +280,7 @@ LsGenerateListing (
>  
>      /* Process all parse nodes */
>  
> -    TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,
> +    TrWalkParseTree (AslGbl_CurrentDB, WalkMode,
>          LsAmlListingWalk, NULL, (void *) ACPI_TO_POINTER (FileId));
>  
>      /* Final processing */
> @@ -847,7 +848,7 @@ LsFinishSourceListing (
>          FlPrintFile (FileId, "\n\nSummary of errors and warnings\n\n");
>          AePrintErrorLog (FileId);
>          FlPrintFile (FileId, "\n");
> -        UtDisplaySummary (FileId);
> +        UtDisplayOneSummary (FileId, TRUE);
>          FlPrintFile (FileId, "\n");
>      }
>  }
> diff --git a/src/acpica/source/compiler/aslload.c b/src/acpica/source/compiler/aslload.c
> index dfbdf7ce..a055bab0 100644
> --- a/src/acpica/source/compiler/aslload.c
> +++ b/src/acpica/source/compiler/aslload.c
> @@ -324,6 +324,7 @@ LdLoadFieldElements (
>                      (Node->Flags & ANOBJ_IS_EXTERNAL))
>                  {
>                      Node->Type = (UINT8) ACPI_TYPE_LOCAL_REGION_FIELD;
> +                    Node->Flags &= ~ANOBJ_IS_EXTERNAL;
>                  }
>                  else
>                  {
> diff --git a/src/acpica/source/compiler/aslmain.c b/src/acpica/source/compiler/aslmain.c
> index 26f4a0c4..81f634e6 100644
> --- a/src/acpica/source/compiler/aslmain.c
> +++ b/src/acpica/source/compiler/aslmain.c
> @@ -255,6 +255,14 @@ main (
>          }
>      }
>  
> +    /* ACPICA subsystem initialization */
> +
> +    Status = AdInitialize ();
> +    if (ACPI_FAILURE (Status))
> +    {
> +        return (Status);
> +    }
> +
>  
>      /* Process each pathname/filename in the list, with possible wildcards */
>  
> @@ -280,17 +288,71 @@ main (
>          Index2++;
>      }
>  
> +    /*
> +     * At this point, compilation of a data table or disassembly is complete.
> +     */
> +    if (AslGbl_FileType == ASL_INPUT_TYPE_ASCII_DATA || AcpiGbl_DisasmFlag)
> +    {
> +        goto CleanupAndExit;
> +    }
> +
> +    CmDoAslMiddleAndBackEnd ();
> +
> +    /*
> +     * At this point, all semantic analysis has been completed. Check
> +     * expected error messages before cleanup or conversion.
> +     */
> +    AslCheckExpectedExceptions ();
> +
> +    /* ASL-to-ASL+ conversion - Perform immediate disassembly */
> +
> +    if (AslGbl_DoAslConversion)
> +    {
> +        /* re-initialize ACPICA subsystem for disassembler */
> +
> +        Status = AdInitialize ();
> +        if (ACPI_FAILURE (Status))
> +        {
> +            return (Status);
> +        }
> +
> +        /*
> +         * New input file is the output AML file from above.
> +         * New output is from the input ASL file from above.
> +         */
> +        AslGbl_OutputFilenamePrefix = AslGbl_Files[ASL_FILE_INPUT].Filename;
> +        AslGbl_Files[ASL_FILE_INPUT].Filename =
> +            AslGbl_Files[ASL_FILE_AML_OUTPUT].Filename;
> +
> +        CvDbgPrint ("Output filename: %s\n", AslGbl_OutputFilenamePrefix);
> +        fprintf (stderr, "\n");
> +
> +        AcpiGbl_DisasmFlag = TRUE;
> +        AslDoDisassembly ();
> +        AcpiGbl_DisasmFlag = FALSE;
> +
> +        /* delete the AML file. This AML file should never be utilized by AML interpreters. */
> +
> +        FlDeleteFile (ASL_FILE_AML_OUTPUT);
> +    }
> +
> +
>  
>  CleanupAndExit:
>  
>      UtFreeLineBuffers ();
>      AslParserCleanup ();
> +    AcpiDmClearExternalFileList();
> +    (void) AcpiTerminate ();
> +
> +    /* CmCleanupAndExit is intended for the compiler only */
>  
> -    if (AcpiGbl_ExternalFileList)
> +    if (!AcpiGbl_DisasmFlag)
>      {
> -        AcpiDmClearExternalFileList();
> +        CmCleanupAndExit ();
>      }
>  
> +
>      return (ReturnStatus);
>  }
>  
> @@ -372,9 +434,6 @@ static void
>  AslInitialize (
>      void)
>  {
> -    UINT32                  i;
> -
> -
>      AcpiGbl_DmOpt_Verbose = FALSE;
>  
>      /* Default integer width is 32 bits */
> @@ -382,16 +441,4 @@ AslInitialize (
>      AcpiGbl_IntegerBitWidth = 32;
>      AcpiGbl_IntegerNybbleWidth = 8;
>      AcpiGbl_IntegerByteWidth = 4;
> -
> -    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";
> -
> -    AslGbl_Files[ASL_FILE_STDERR].Handle   = stderr;
> -    AslGbl_Files[ASL_FILE_STDERR].Filename = "STDERR";
>  }
> diff --git a/src/acpica/source/compiler/aslmessages.c b/src/acpica/source/compiler/aslmessages.c
> index 0f31c655..d7e2eb43 100644
> --- a/src/acpica/source/compiler/aslmessages.c
> +++ b/src/acpica/source/compiler/aslmessages.c
> @@ -353,8 +353,8 @@ const char                      *AslCompilerMsgs [] =
>  /*    ASL_MSG_NULL_RESOURCE_TEMPLATE */     "Empty Resource Template (END_TAG only)",
>  /*    ASL_MSG_FOUND_HERE */                 "Original name creation/declaration below: ",
>  /*    ASL_MSG_ILLEGAL_RECURSION */          "Illegal recursive call to method that creates named objects",
> -/*    ASL_MSG_PLACE_HOLDER_00 */            "", /* TODO: fill in this slot with a new error message */
> -/*    ASL_MSG_PLACE_HOLDER_01 */            "", /* TODO: fill in this slot with a new error message */
> +/*    ASL_MSG_DUPLICATE_INPUT_FILE */       "Duplicate input files detected:",
> +/*    ASL_MSG_WARNING_AS_ERROR */           "Warnings detected during compilation",
>  /*    ASL_MSG_OEM_TABLE_ID */               "Invalid OEM Table ID",
>  /*    ASL_MSG_OEM_ID */                     "Invalid OEM ID",
>  /*    ASL_MSG_UNLOAD */                     "Unload is not supported by all operating systems",
> @@ -363,7 +363,8 @@ const char                      *AslCompilerMsgs [] =
>  /*    ASL_MSG_PREFIX_NOT_EXIST */           "One or more prefix Scopes do not exist",
>  /*    ASL_MSG_NAMEPATH_NOT_EXIST */         "One or more objects within the Pathname do not exist",
>  /*    ASL_MSG_REGION_LENGTH */              "Operation Region declared with zero length",
> -/*    ASL_MSG_TEMPORARY_OBJECT */           "Object is created temporarily in another method and cannot be accessed"
> +/*    ASL_MSG_TEMPORARY_OBJECT */           "Object is created temporarily in another method and cannot be accessed",
> +/*    ASL_MSG_UNDEFINED_EXTERNAL */         "Named object was declared external but the actual definition does not exist"
>  };
>  
>  /* Table compiler */
> diff --git a/src/acpica/source/compiler/aslmessages.h b/src/acpica/source/compiler/aslmessages.h
> index 817e192e..a7cd1f31 100644
> --- a/src/acpica/source/compiler/aslmessages.h
> +++ b/src/acpica/source/compiler/aslmessages.h
> @@ -355,8 +355,8 @@ typedef enum
>      ASL_MSG_NULL_RESOURCE_TEMPLATE,
>      ASL_MSG_FOUND_HERE,
>      ASL_MSG_ILLEGAL_RECURSION,
> -    ASL_MSG_PLACE_HOLDER_00,
> -    ASL_MSG_PLACE_HOLDER_01,
> +    ASL_MSG_DUPLICATE_INPUT_FILE,
> +    ASL_MSG_WARNING_AS_ERROR,
>      ASL_MSG_OEM_TABLE_ID,
>      ASL_MSG_OEM_ID,
>      ASL_MSG_UNLOAD,
> @@ -366,6 +366,7 @@ typedef enum
>      ASL_MSG_NAMEPATH_NOT_EXIST,
>      ASL_MSG_REGION_LENGTH,
>      ASL_MSG_TEMPORARY_OBJECT,
> +    ASL_MSG_UNDEFINED_EXTERNAL,
>  
>      /* These messages are used by the Data Table compiler only */
>  
> diff --git a/src/acpica/source/compiler/asloperands.c b/src/acpica/source/compiler/asloperands.c
> index 67e16fd5..4f4b636d 100644
> --- a/src/acpica/source/compiler/asloperands.c
> +++ b/src/acpica/source/compiler/asloperands.c
> @@ -1045,6 +1045,7 @@ OpnDoDefinitionBlock (
>      ACPI_SIZE               Length;
>      UINT32                  i;
>      char                    *Filename;
> +    ACPI_STATUS             Status;
>  
>  
>      /*
> @@ -1062,6 +1063,12 @@ OpnDoDefinitionBlock (
>          *Child->Asl.Value.Buffer &&
>          (AslGbl_UseDefaultAmlFilename))
>      {
> +        /*
> +         * The walk may traverse multiple definition blocks. Switch files
> +         * to ensure that the correct files are manipulated.
> +         */
> +        FlSwitchFileSet (Op->Asl.Filename);
> +
>          /*
>           * We will use the AML filename that is embedded in the source file
>           * for the output filename.
> @@ -1076,6 +1083,22 @@ OpnDoDefinitionBlock (
>  
>          AslGbl_OutputFilenamePrefix = Filename;
>          UtConvertBackslashes (AslGbl_OutputFilenamePrefix);
> +
> +        /*
> +         * Use the definition block file parameter instead of the input
> +         * filename. Since all files were opened previously, remove the
> +         * existing file and open a new file with the name of this
> +         * definiton block parameter. Since AML code generation has yet
> +         * to happen, the previous file can be removed without any impacts.
> +         */
> +        FlCloseFile (ASL_FILE_AML_OUTPUT);
> +        FlDeleteFile (ASL_FILE_AML_OUTPUT);
> +        Status = FlOpenAmlOutputFile (AslGbl_OutputFilenamePrefix);
> +        if (ACPI_FAILURE (Status))
> +        {
> +            AslError (ASL_ERROR, ASL_MSG_OUTPUT_FILE_OPEN, NULL, NULL);
> +            return;
> +        }
>      }
>  
>      Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
> @@ -1086,6 +1109,7 @@ OpnDoDefinitionBlock (
>      Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
>      if (Child->Asl.Value.String)
>      {
> +        AslGbl_FilesList->TableSignature = Child->Asl.Value.String;
>          AslGbl_TableSignature = Child->Asl.Value.String;
>          if (strlen (AslGbl_TableSignature) != ACPI_NAMESEG_SIZE)
>          {
> @@ -1138,6 +1162,7 @@ OpnDoDefinitionBlock (
>  
>          AslGbl_TableId = UtLocalCacheCalloc (Length + 1);
>          strcpy (AslGbl_TableId, Child->Asl.Value.String);
> +        AslGbl_FilesList->TableId = AslGbl_TableId;
>  
>          /*
>           * Convert anything non-alphanumeric to an underscore. This
> diff --git a/src/acpica/source/compiler/asloptions.c b/src/acpica/source/compiler/asloptions.c
> index dc0b9079..dc00e1d2 100644
> --- a/src/acpica/source/compiler/asloptions.c
> +++ b/src/acpica/source/compiler/asloptions.c
> @@ -896,7 +896,6 @@ AslDoOptions (
>               */
>              AslGbl_VerboseErrors = FALSE;
>              AslGbl_DoSignon = FALSE;
> -            AslGbl_Files[ASL_FILE_STDERR].Handle = stdout;
>              break;
>  
>          case 'o':
> diff --git a/src/acpica/source/compiler/aslstartup.c b/src/acpica/source/compiler/aslstartup.c
> index c0f14c80..aee5ad60 100644
> --- a/src/acpica/source/compiler/aslstartup.c
> +++ b/src/acpica/source/compiler/aslstartup.c
> @@ -165,10 +165,6 @@ static UINT8
>  AslDetectSourceFileType (
>      ASL_FILE_INFO           *Info);
>  
> -static ACPI_STATUS
> -AslDoDisassembly (
> -    void);
> -
>  
>  /* Globals */
>  
> @@ -227,12 +223,6 @@ AslInitializeGlobals (
>          AslGbl_ExceptionCount[i] = 0;
>      }
>  
> -    for (i = ASL_FILE_INPUT; i <= ASL_MAX_FILE_TYPE; i++)
> -    {
> -        AslGbl_Files[i].Handle = NULL;
> -        AslGbl_Files[i].Filename = NULL;
> -    }
> -
>      if (AcpiGbl_CaptureComments)
>      {
>          AslGbl_CommentState.SpacesBefore          = 0;
> @@ -343,25 +333,19 @@ Cleanup:
>   * RETURN:      Status
>   *
>   * DESCRIPTION: Initiate AML file disassembly. Uses ACPICA subsystem to build
> - *              namespace.
> + *              namespace. This function assumes that the ACPI subsystem has
> + *              been initialized. The caller of the initialization will also
> + *              terminate the ACPI subsystem.
>   *
>   ******************************************************************************/
>  
> -static ACPI_STATUS
> +ACPI_STATUS
>  AslDoDisassembly (
>      void)
>  {
>      ACPI_STATUS             Status;
>  
>  
> -    /* ACPICA subsystem initialization */
> -
> -    Status = AdInitialize ();
> -    if (ACPI_FAILURE (Status))
> -    {
> -        return (Status);
> -    }
> -
>      Status = AcpiAllocateRootTable (4);
>      if (ACPI_FAILURE (Status))
>      {
> @@ -370,11 +354,6 @@ AslDoDisassembly (
>          return (Status);
>      }
>  
> -    /* Handle additional output files for disassembler */
> -
> -    AslGbl_FileType = ASL_INPUT_TYPE_BINARY_ACPI_TABLE;
> -    Status = FlOpenMiscOutputFiles (AslGbl_OutputFilenamePrefix);
> -
>      /* This is where the disassembly happens */
>  
>      AcpiGbl_DmOpt_Disasm = TRUE;
> @@ -390,10 +369,9 @@ AslDoDisassembly (
>  
>      AcpiDmUnresolvedWarning (0);
>  
> -    /* Shutdown compiler and ACPICA subsystem */
> +    /* Clear Error log */
>  
>      AeClearErrorLog ();
> -    (void) AcpiTerminate ();
>  
>      /*
>       * AslGbl_Files[ASL_FILE_INPUT].Filename was replaced with the
> @@ -406,11 +384,6 @@ AslDoDisassembly (
>          return (AE_CTRL_CONTINUE);
>      }
>  
> -    /* No need to free the filename string */
> -
> -    AslGbl_Files[ASL_FILE_INPUT].Filename = NULL;
> -
> -    UtDeleteLocalCaches ();
>      return (AE_OK);
>  }
>  
> @@ -432,6 +405,8 @@ AslDoOneFile (
>      char                    *Filename)
>  {
>      ACPI_STATUS             Status;
> +    UINT8                   Event;
> +    ASL_GLOBAL_FILE_NODE    *FileNode;
>  
>  
>      /* Re-initialize "some" compiler/preprocessor globals */
> @@ -450,6 +425,18 @@ AslDoOneFile (
>          return (Status);
>      }
>  
> +    /*
> +     * There was an input file detected at this point. Each input ASL file is
> +     * associated with one global file node consisting of the input file and
> +     * all output files associated with it. This is useful when compiling
> +     * multiple files in one command.
> +     */
> +    Status = FlInitOneFile(Filename);
> +    if (ACPI_FAILURE (Status))
> +    {
> +        return (AE_ERROR);
> +    }
> +
>      /* Take a copy of the input filename, convert any backslashes */
>  
>      AslGbl_Files[ASL_FILE_INPUT].Filename =
> @@ -458,18 +445,6 @@ AslDoOneFile (
>      strcpy (AslGbl_Files[ASL_FILE_INPUT].Filename, Filename);
>      UtConvertBackslashes (AslGbl_Files[ASL_FILE_INPUT].Filename);
>  
> -    /*
> -     * AML Disassembly (Optional)
> -     */
> -    if (AcpiGbl_DisasmFlag)
> -    {
> -        Status = AslDoDisassembly ();
> -        if (Status != AE_CTRL_CONTINUE)
> -        {
> -            return (Status);
> -        }
> -    }
> -
>      /*
>       * Open the input file. Here, this should be an ASCII source file,
>       * either an ASL file or a Data Table file
> @@ -481,7 +456,13 @@ AslDoOneFile (
>          return (AE_ERROR);
>      }
>  
> -    AslGbl_OriginalInputFileSize = FlGetFileSize (ASL_FILE_INPUT);
> +    FileNode = FlGetCurrentFileNode();
> +    if (!FileNode)
> +    {
> +        return (AE_ERROR);
> +    }
> +
> +    FileNode->OriginalInputFileSize = FlGetFileSize (ASL_FILE_INPUT);
>  
>      /* Determine input file type */
>  
> @@ -500,6 +481,22 @@ AslDoOneFile (
>          AslGbl_OutputFilenamePrefix = AslGbl_Files[ASL_FILE_INPUT].Filename;
>      }
>  
> +    /*
> +     * Open the output file. Note: by default, the name of this file comes from
> +     * the table descriptor within the input file.
> +     */
> +    if (AslGbl_FileType == ASL_INPUT_TYPE_ASCII_ASL)
> +    {
> +        Event = UtBeginEvent ("Open AML output file");
> +        Status = FlOpenAmlOutputFile (AslGbl_OutputFilenamePrefix);
> +        UtEndEvent (Event);
> +        if (ACPI_FAILURE (Status))
> +        {
> +            AePrintErrorLog (ASL_FILE_STDERR);
> +            return (AE_ERROR);
> +        }
> +    }
> +
>      /* Open the optional output files (listings, etc.) */
>  
>      Status = FlOpenMiscOutputFiles (AslGbl_OutputFilenamePrefix);
> @@ -550,20 +547,7 @@ AslDoOneFile (
>       */
>      case ASL_INPUT_TYPE_ASCII_ASL:
>  
> -        /* ACPICA subsystem initialization */
> -
> -        Status = AdInitialize ();
> -        if (ACPI_FAILURE (Status))
> -        {
> -            return (Status);
> -        }
> -
> -        (void) CmDoCompile ();
> -        (void) AcpiTerminate ();
> -
> -        /* Check if any errors occurred during compile */
> -
> -        Status = AslCheckForErrorExit ();
> +        Status = CmDoCompile ();
>          if (ACPI_FAILURE (Status))
>          {
>              return (Status);
> @@ -574,27 +558,11 @@ AslDoOneFile (
>          AeClearErrorLog ();
>          PrTerminatePreprocessor ();
>  
> -        /* ASL-to-ASL+ conversion - Perform immediate disassembly */
> -
> -        if (AslGbl_DoAslConversion)
> -        {
> -            /*
> -             * New input file is the output AML file from above.
> -             * New output is from the input ASL file from above.
> -             */
> -            AslGbl_OutputFilenamePrefix = AslGbl_Files[ASL_FILE_INPUT].Filename;
> -            CvDbgPrint ("OUTPUTFILENAME: %s\n", AslGbl_OutputFilenamePrefix);
> -            AslGbl_Files[ASL_FILE_INPUT].Filename =
> -                AslGbl_Files[ASL_FILE_AML_OUTPUT].Filename;
> -            AcpiGbl_DisasmFlag = TRUE;
> -            fprintf (stderr, "\n");
> -            AslDoDisassembly ();
> -
> -            /* delete the AML file. This AML file should never be utilized by AML interpreters. */
> -
> -            FlDeleteFile (ASL_FILE_AML_OUTPUT);
> -        }
> -
> +        /*
> +         * At this point, we know how many lines are in the input file. Save it
> +         * to display for post-compilation summary.
> +         */
> +        FileNode->TotalLineCount = AslGbl_CurrentLineNumber;
>          return (AE_OK);
>  
>      /*
> @@ -661,6 +629,8 @@ AslCheckForErrorExit (
>                  (AslGbl_ExceptionCount[ASL_WARNING2] > 0) ||
>                  (AslGbl_ExceptionCount[ASL_WARNING3] > 0))
>              {
> +                AslError (ASL_ERROR, ASL_MSG_WARNING_AS_ERROR, NULL,
> +                    "(reporting warnings as errors)");
>                  return (AE_ERROR);
>              }
>          }
> diff --git a/src/acpica/source/compiler/aslsupport.l b/src/acpica/source/compiler/aslsupport.l
> index 5cac84dc..69c1399a 100644
> --- a/src/acpica/source/compiler/aslsupport.l
> +++ b/src/acpica/source/compiler/aslsupport.l
> @@ -532,14 +532,18 @@ count (
>      {
>      case 2:
>  
> -        AslGbl_TotalKeywords++;
> -        AslGbl_TotalNamedObjects++;
> +        ++AslGbl_TotalKeywords;
> +        ++AslGbl_TotalNamedObjects;
> +        ++AslGbl_FilesList->TotalKeywords;
> +        ++AslGbl_FilesList->TotalNamedObjects;
>          break;
>  
>      case 3:
>  
> -        AslGbl_TotalKeywords++;
> -        AslGbl_TotalExecutableOpcodes++;
> +        ++AslGbl_TotalKeywords;
> +        ++AslGbl_TotalExecutableOpcodes;
> +        ++AslGbl_FilesList->TotalKeywords;
> +        ++AslGbl_FilesList->TotalExecutableOpcodes;
>          break;
>  
>      default:
> diff --git a/src/acpica/source/compiler/asltree.c b/src/acpica/source/compiler/asltree.c
> index 6bb40888..62efc5fa 100644
> --- a/src/acpica/source/compiler/asltree.c
> +++ b/src/acpica/source/compiler/asltree.c
> @@ -462,6 +462,7 @@ TrLinkOpChildren (
>  {
>      ACPI_PARSE_OBJECT       *Child;
>      ACPI_PARSE_OBJECT       *PrevChild;
> +    ACPI_PARSE_OBJECT       *LastSibling;
>      va_list                 ap;
>      UINT32                  i;
>      BOOLEAN                 FirstChild;
> @@ -480,8 +481,18 @@ TrLinkOpChildren (
>      {
>      case PARSEOP_ASL_CODE:
>  
> -        AslGbl_ParseTreeRoot = Op;
> -        Op->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
> +        if (!AslGbl_ParseTreeRoot)
> +        {
> +            DbgPrint (ASL_PARSE_OUTPUT, "Creating first Definition Block\n");
> +            AslGbl_ParseTreeRoot = Op;
> +            Op->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
> +        }
> +        else
> +        {
> +            DbgPrint (ASL_PARSE_OUTPUT, "Creating subsequent Definition Block\n");
> +            Op = AslGbl_ParseTreeRoot;
> +        }
> +
>          DbgPrint (ASL_PARSE_OUTPUT, "ASLCODE (Tree Completed)->");
>          break;
>  
> @@ -560,7 +571,27 @@ TrLinkOpChildren (
>          if (FirstChild)
>          {
>              FirstChild = FALSE;
> -            Op->Asl.Child = Child;
> +
> +            /*
> +             * In the case that multiple definition blocks are being compiled,
> +             * append the definition block to the end of the child list as the
> +             * last sibling. This is done to facilitate namespace cross-
> +             * reference between multiple definition blocks.
> +             */
> +            if (Op->Asl.Child &&
> +                (Op->Asl.Child->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK))
> +            {
> +                LastSibling = Op->Asl.Child;
> +                while (LastSibling->Asl.Next)
> +                {
> +                    LastSibling = LastSibling->Asl.Next;
> +                }
> +                LastSibling->Asl.Next = Child;
> +            }
> +            else
> +            {
> +                Op->Asl.Child = Child;
> +            }
>          }
>  
>          /* Point all children to parent */
> @@ -825,6 +856,8 @@ TrWalkParseTree (
>      BOOLEAN                 OpPreviouslyVisited;
>      ACPI_PARSE_OBJECT       *StartOp = Op;
>      ACPI_STATUS             Status;
> +    ACPI_PARSE_OBJECT       *Restore = NULL;
> +    BOOLEAN                 WalkOneDefinitionBlock = Visitation & ASL_WALK_VISIT_DB_SEPARATELY;
>  
>  
>      if (!AslGbl_ParseTreeRoot)
> @@ -835,7 +868,13 @@ TrWalkParseTree (
>      Level = 0;
>      OpPreviouslyVisited = FALSE;
>  
> -    switch (Visitation)
> +    if (Op->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK &&
> +        WalkOneDefinitionBlock)
> +    {
> +        Restore = Op->Asl.Next;
> +        Op->Asl.Next = NULL;
> +    }
> +    switch (Visitation & ~ASL_WALK_VISIT_DB_SEPARATELY)
>      {
>      case ASL_WALK_VISIT_DOWNWARD:
>  
> @@ -861,7 +900,7 @@ TrWalkParseTree (
>                  {
>                      /* Exit immediately on any error */
>  
> -                    return (Status);
> +                    goto ErrorExit;
>                  }
>              }
>  
> @@ -907,7 +946,7 @@ TrWalkParseTree (
>                  Status = AscendingCallback (Op, Level, Context);
>                  if (ACPI_FAILURE (Status))
>                  {
> -                    return (Status);
> +                    goto ErrorExit;
>                  }
>              }
>              else
> @@ -956,7 +995,7 @@ TrWalkParseTree (
>                  Status = AscendingCallback (Op, Level, Context);
>                  if (ACPI_FAILURE (Status))
>                  {
> -                    return (Status);
> +                    goto ErrorExit;
>                  }
>              }
>              else
> @@ -979,7 +1018,7 @@ TrWalkParseTree (
>                  {
>                      /* Exit immediately on any error */
>  
> -                    return (Status);
> +                    goto ErrorExit;
>                  }
>              }
>  
> @@ -1018,5 +1057,20 @@ TrWalkParseTree (
>  
>      /* If we get here, the walk completed with no errors */
>  
> +    if (Op->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK &&
> +        WalkOneDefinitionBlock)
> +    {
> +        Op->Asl.Next = Restore;
> +    }
> +
>      return (AE_OK);
> +
> +ErrorExit:
> +
> +    if (Op->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK &&
> +        WalkOneDefinitionBlock)
> +    {
> +        Op->Asl.Next = Restore;
> +    }
> +    return (Status);
>  }
> diff --git a/src/acpica/source/compiler/asltypes.h b/src/acpica/source/compiler/asltypes.h
> index 628b2d37..8a6a0750 100644
> --- a/src/acpica/source/compiler/asltypes.h
> +++ b/src/acpica/source/compiler/asltypes.h
> @@ -221,10 +221,10 @@ typedef struct asl_analysis_walk_info
>  
>  typedef struct asl_mapping_entry
>  {
> -    UINT32                      Value;
> -    UINT32                      AcpiBtype;   /* Object type or return type */
> -    UINT16                      AmlOpcode;
> -    UINT8                       Flags;
> +    UINT32                  Value;
> +    UINT32                  AcpiBtype;   /* Object type or return type */
> +    UINT16                  AmlOpcode;
> +    UINT8                   Flags;
>  
>  } ASL_MAPPING_ENTRY;
>  
> @@ -233,8 +233,8 @@ typedef struct asl_mapping_entry
>  
>  typedef struct asl_walk_info
>  {
> -    ACPI_PARSE_OBJECT           **NodePtr;
> -    UINT32                      *LevelPtr;
> +    ACPI_PARSE_OBJECT       **NodePtr;
> +    UINT32                  *LevelPtr;
>  
>  } ASL_WALK_INFO;
>  
> @@ -243,10 +243,8 @@ typedef struct asl_walk_info
>  
>  typedef struct asl_file_info
>  {
> -    FILE                        *Handle;
> -    char                        *Filename;
> -    const char                  *ShortDescription;
> -    const char                  *Description;
> +    FILE                    *Handle;
> +    char                    *Filename;
>  
>  } ASL_FILE_INFO;
>  
> @@ -258,6 +256,11 @@ typedef struct asl_file_status
>  } ASL_FILE_STATUS;
>  
>  
> +typedef UINT32                      ASL_FILE_SWITCH_STATUS;    /* File switch status */
> +#define SWITCH_TO_DIFFERENT_FILE    0
> +#define SWITCH_TO_SAME_FILE         1
> +#define FILE_NOT_FOUND              2
> +
>  /*
>   * File types. Note: Any changes to this table must also be reflected
>   * in the Gbl_Files array.
> @@ -295,10 +298,17 @@ typedef enum
>  
>  } ASL_FILE_TYPES;
>  
> -
>  #define ASL_MAX_FILE_TYPE       18
>  #define ASL_NUM_FILES           (ASL_MAX_FILE_TYPE + 1)
>  
> +typedef struct asl_file_desc
> +{
> +    const char              *ShortDescription;
> +    const char              *Description;
> +
> +} ASL_FILE_DESC;
> +
> +
>  /* Name suffixes used to create filenames for output files */
>  
>  #define FILE_SUFFIX_ASL_CODE        "asl"
> @@ -325,16 +335,16 @@ typedef enum
>  
>  typedef struct asl_cache_info
>  {
> -    void                            *Next;
> -    char                            Buffer[1];
> +    void                    *Next;
> +    char                    Buffer[1];
>  
>  } ASL_CACHE_INFO;
>  
>  
>  typedef struct asl_include_dir
>  {
> -    char                        *Dir;
> -    struct asl_include_dir      *Next;
> +    char                    *Dir;
> +    struct asl_include_dir  *Next;
>  
>  } ASL_INCLUDE_DIR;
>  
> @@ -343,6 +353,11 @@ typedef struct asl_include_dir
>   * An entry in the exception list, one for each error/warning
>   * Note: SubError nodes would be treated with the same messageId and Level
>   * as the parent error node.
> + *
> + * The source filename represents the name of the .src of where the error
> + * occurred. This is useful for errors that occur inside of include files.
> + * Since include files aren't recorded as a part of the global files list,
> + * this provides a way to get the included file.
>   */
>  typedef struct asl_error_msg
>  {
> @@ -355,6 +370,7 @@ typedef struct asl_error_msg
>      struct asl_error_msg        *SubError;
>      char                        *Filename;
>      char                        *SourceLine;
> +    char                        *SourceFilename;
>      UINT32                      FilenameLength;
>      UINT16                      MessageId;
>      UINT8                       Level;
> @@ -362,6 +378,7 @@ typedef struct asl_error_msg
>  } ASL_ERROR_MSG;
>  
>  /* An entry in the expected messages array */
> +
>  typedef struct asl_expected_message
>  {
>      UINT32                       MessageId;
> @@ -479,4 +496,19 @@ typedef struct asl_file_node
>  
>  } ASL_FILE_NODE;
>  
> +typedef struct asl_files_node
> +{
> +    struct asl_file_info    Files[ASL_NUM_FILES];
> +    struct asl_files_node   *Next;
> +    char                    *TableSignature;
> +    char                    *TableId;
> +    UINT32                  TotalLineCount;
> +    UINT32                  OriginalInputFileSize;
> +    UINT32                  TotalKeywords;
> +    UINT32                  TotalNamedObjects;
> +    UINT32                  TotalExecutableOpcodes;
> +    BOOLEAN                 ParserErrorDetected;
> +
> +} ASL_GLOBAL_FILE_NODE;
> +
>  #endif  /* __ASLTYPES_H */
> diff --git a/src/acpica/source/compiler/aslutils.c b/src/acpica/source/compiler/aslutils.c
> index 6b0d5eff..0b78f473 100644
> --- a/src/acpica/source/compiler/aslutils.c
> +++ b/src/acpica/source/compiler/aslutils.c
> @@ -174,6 +174,10 @@ UtAttachNameseg (
>      ACPI_PARSE_OBJECT       *Op,
>      char                    *Name);
>  
> +static void
> +UtDisplayErrorSummary (
> +    UINT32                  FileId);
> +
>  
>  /*******************************************************************************
>   *
> @@ -520,21 +524,23 @@ UtSetParseOpName (
>  
>  /*******************************************************************************
>   *
> - * FUNCTION:    UtDisplaySummary
> + * FUNCTION:    UtDisplayOneSummary
>   *
>   * PARAMETERS:  FileID              - ID of outpout file
>   *
>   * RETURN:      None
>   *
> - * DESCRIPTION: Display compilation statistics
> + * DESCRIPTION: Display compilation statistics for one input file
>   *
>   ******************************************************************************/
>  
>  void
> -UtDisplaySummary (
> -    UINT32                  FileId)
> +UtDisplayOneSummary (
> +    UINT32                  FileId,
> +    BOOLEAN                 DisplayErrorSummary)
>  {
>      UINT32                  i;
> +    ASL_GLOBAL_FILE_NODE    *FileNode;
>  
>  
>      if (FileId != ASL_FILE_STDOUT)
> @@ -565,25 +571,41 @@ UtDisplaySummary (
>      }
>      else
>      {
> -        FlPrintFile (FileId,
> -            "%-14s %s - %u lines, %u bytes, %u keywords\n",
> -            "ASL Input:",
> -            AslGbl_Files[ASL_FILE_INPUT].Filename, AslGbl_CurrentLineNumber,
> -            AslGbl_OriginalInputFileSize, AslGbl_TotalKeywords);
> -
> -        /* AML summary */
> -
> -        if ((AslGbl_ExceptionCount[ASL_ERROR] == 0) || (AslGbl_IgnoreErrors))
> +        FileNode = FlGetCurrentFileNode ();
> +        if (!FileNode)
>          {
> -            if (AslGbl_Files[ASL_FILE_AML_OUTPUT].Handle)
> +            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 (!AslGbl_ParserErrorDetected &&
> +                ((AslGbl_ExceptionCount[ASL_ERROR] == 0) || AslGbl_IgnoreErrors) &&
> +                AslGbl_Files[ASL_FILE_AML_OUTPUT].Handle)
>              {
>                  FlPrintFile (FileId,
> -                    "%-14s %s - %u bytes, %u named objects, "
> -                    "%u executable opcodes\n",
> +                    "%-14s %s - %7u bytes %6u opcodes  %6u named objects\n",
>                      "AML Output:",
>                      AslGbl_Files[ASL_FILE_AML_OUTPUT].Filename,
>                      FlGetFileSize (ASL_FILE_AML_OUTPUT),
> -                    AslGbl_TotalNamedObjects, AslGbl_TotalExecutableOpcodes);
> +                    FileNode->TotalExecutableOpcodes,
> +                    FileNode->TotalNamedObjects);
>              }
>          }
>      }
> @@ -612,14 +634,55 @@ UtDisplaySummary (
>          }
>  
>          FlPrintFile (FileId, "%14s %s - %u bytes\n",
> -            AslGbl_Files[i].ShortDescription,
> +            AslGbl_FileDescs[i].ShortDescription,
>              AslGbl_Files[i].Filename, FlGetFileSize (i));
>      }
>  
> -    /* Error summary */
> +
> +    /*
> +     * Optionally emit an error summary for a file. This is used to enhance the
> +     * appearance of listing files.
> +     */
> +    if (DisplayErrorSummary)
> +    {
> +        UtDisplayErrorSummary (FileId);
> +    }
> +}
> +
> +
> +/*******************************************************************************
> + *
> + * FUNCTION:    UtDisplayErrorSummary
> + *
> + * PARAMETERS:  FileID              - ID of outpout file
> + *
> + * RETURN:      None
> + *
> + * DESCRIPTION: Display compilation statistics for all input files
> + *
> + ******************************************************************************/
> +
> +static void
> +UtDisplayErrorSummary (
> +    UINT32                  FileId)
> +{
> +    BOOLEAN                 ErrorDetected;
> +
> +
> +    ErrorDetected = AslGbl_ParserErrorDetected ||
> +        ((AslGbl_ExceptionCount[ASL_ERROR] > 0) && !AslGbl_IgnoreErrors);
> +
> +    if (ErrorDetected)
> +    {
> +        FlPrintFile (FileId, "\nCompilation failed. ");
> +    }
> +    else
> +    {
> +        FlPrintFile (FileId, "\nCompilation successful. ");
> +    }
>  
>      FlPrintFile (FileId,
> -        "\nCompilation complete. %u Errors, %u Warnings, %u Remarks",
> +        "%u Errors, %u Warnings, %u Remarks",
>          AslGbl_ExceptionCount[ASL_ERROR],
>          AslGbl_ExceptionCount[ASL_WARNING] +
>              AslGbl_ExceptionCount[ASL_WARNING2] +
> @@ -628,6 +691,19 @@ UtDisplaySummary (
>  
>      if (AslGbl_FileType != ASL_INPUT_TYPE_ASCII_DATA)
>      {
> +        if (AslGbl_ParserErrorDetected)
> +        {
> +            FlPrintFile (FileId,
> +                "\nNo AML files were generated due to syntax error(s)\n");
> +            return;
> +        }
> +        else if (ErrorDetected)
> +        {
> +            FlPrintFile (FileId,
> +                "\nNo AML files were generated due to compiler error(s)\n");
> +            return;
> +        }
> +
>          FlPrintFile (FileId, ", %u Optimizations",
>              AslGbl_ExceptionCount[ASL_OPTIMIZATION]);
>  
> @@ -641,6 +717,46 @@ UtDisplaySummary (
>  }
>  
>  
> +/*******************************************************************************
> + *
> + * FUNCTION:    UtDisplaySummary
> + *
> + * PARAMETERS:  FileID              - ID of outpout file
> + *
> + * RETURN:      None
> + *
> + * DESCRIPTION: Display compilation statistics for all input files
> + *
> + ******************************************************************************/
> +
> +void
> +UtDisplaySummary (
> +    UINT32                  FileId)
> +{
> +    ASL_GLOBAL_FILE_NODE    *Current = AslGbl_FilesList;
> +
> +
> +    while (Current)
> +    {
> +        switch  (FlSwitchFileSet(Current->Files[ASL_FILE_INPUT].Filename))
> +        {
> +            case SWITCH_TO_SAME_FILE:
> +            case SWITCH_TO_DIFFERENT_FILE:
> +
> +                UtDisplayOneSummary (FileId, FALSE);
> +                Current = Current->Next;
> +                break;
> +
> +            case FILE_NOT_FOUND:
> +            default:
> +
> +                Current = NULL;
> +                break;
> +        }
> +    }
> +    UtDisplayErrorSummary (FileId);
> +}
> +
>  /*******************************************************************************
>   *
>   * FUNCTION:    UtCheckIntegerRange
> diff --git a/src/acpica/source/compiler/aslxref.c b/src/acpica/source/compiler/aslxref.c
> index 99f6c4a0..9d6e5c0b 100644
> --- a/src/acpica/source/compiler/aslxref.c
> +++ b/src/acpica/source/compiler/aslxref.c
> @@ -1185,6 +1185,24 @@ XfNamespaceLocateBegin (
>          }
>      }
>  
> +    /*
> +     * 5) Check for external resolution
> +     * By this point, everything should be loaded in the namespace. If a
> +     * namespace lookup results in a namespace node that is an external, it
> +     * means that this named object was not defined in the input ASL. This
> +     * causes issues because there are plenty of incidents where developers
> +     * use the external keyword to suppress compiler errors about undefined
> +     * objects. Note: this only applies when compiling multiple definition
> +     * blocks.
> +     */
> +    if (AslGbl_ParseTreeRoot->Asl.Child && AslGbl_ParseTreeRoot->Asl.Child->Asl.Next &&
> +        (Op->Asl.ParseOpcode != PARSEOP_EXTERNAL &&
> +        Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_EXTERNAL) &&
> +        (Node->Flags & ANOBJ_IS_EXTERNAL))
> +    {
> +        AslError (ASL_ERROR, ASL_MSG_UNDEFINED_EXTERNAL, Op, NULL);
> +    }
> +
>      /* 5) Check for a connection object */
>  #if 0
>      else if (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONNECTION)
> diff --git a/src/acpica/source/compiler/dtcompile.c b/src/acpica/source/compiler/dtcompile.c
> index 95fcb2d4..09cb3e6c 100644
> --- a/src/acpica/source/compiler/dtcompile.c
> +++ b/src/acpica/source/compiler/dtcompile.c
> @@ -240,8 +240,7 @@ DtDoCompile (
>          DtError (ASL_ERROR, ASL_MSG_SYNTAX, NULL,
>              "Input file does not appear to be an ASL or data table source file");
>  
> -        Status = AE_ERROR;
> -        goto CleanupAndExit;
> +        return (AE_ERROR);
>      }
>  
>      Event = UtBeginEvent ("Compile parse tree");
> @@ -259,7 +258,7 @@ DtDoCompile (
>          DtError (ASL_ERROR, ASL_MSG_SYNTAX, NULL,
>              "Could not compile input file");
>  
> -        goto CleanupAndExit;
> +        return (Status);
>      }
>  
>      /* Create/open the binary output file */
> @@ -268,7 +267,7 @@ DtDoCompile (
>      Status = FlOpenAmlOutputFile (AslGbl_OutputFilenamePrefix);
>      if (ACPI_FAILURE (Status))
>      {
> -        goto CleanupAndExit;
> +        return (Status);
>      }
>  
>      /* Write the binary, then the optional hex file */
> @@ -277,10 +276,6 @@ DtDoCompile (
>      HxDoHexOutput ();
>      DtWriteTableToListing ();
>  
> -CleanupAndExit:
> -
> -    AcpiUtDeleteCaches ();
> -    CmCleanupAndExit ();
>      return (Status);
>  }
>  
> diff --git a/src/acpica/source/compiler/fwts_iasl_interface.c b/src/acpica/source/compiler/fwts_iasl_interface.c
> index 9679e272..1699eb6c 100644
> --- a/src/acpica/source/compiler/fwts_iasl_interface.c
> +++ b/src/acpica/source/compiler/fwts_iasl_interface.c
> @@ -35,27 +35,17 @@
>   */
>  static void init_asl_core(void)
>  {
> -	int i;
> -
>  	AcpiOsInitialize();
>  	ACPI_DEBUG_INITIALIZE();
>  	AcpiGbl_ExternalFileList = NULL;
>  	AcpiDbgLevel = 0;
>  	PrInitializePreprocessor();
> -	AcpiGbl_DmOpt_Verbose = FALSE;
> -	AcpiGbl_IntegerBitWidth = 64;
> -	AcpiGbl_IntegerNybbleWidth = 16;
> -	AcpiGbl_IntegerByteWidth = 8;
> -
> -	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";
> -	AslGbl_Files[ASL_FILE_STDERR].Handle   = stdout;
> -	AslGbl_Files[ASL_FILE_STDERR].Filename = "STDOUT";
> +	/* From AslInitialize */
> +	AcpiGbl_DmOpt_Verbose = FALSE;
> +	AcpiGbl_IntegerBitWidth = 32;
> +	AcpiGbl_IntegerNybbleWidth = 8;
> +	AcpiGbl_IntegerByteWidth = 4;
>  
>  	AslGbl_LineBufferSize = 1024;
>  	AslGbl_CurrentLineBuffer = NULL;
> @@ -99,6 +89,7 @@ int fwts_iasl_disassemble_aml(
>  		AslGbl_UseDefaultAmlFilename = FALSE;
>  		AcpiGbl_CstyleDisassembly = FALSE;
>  		AcpiGbl_DmOpt_Verbose = FALSE;
> +		AslGbl_ParserErrorDetected = FALSE;
>  		UtConvertBackslashes (AslGbl_OutputFilenamePrefix);
>  
>  		/* Do we need to include external tables in? */
> @@ -135,6 +126,7 @@ int fwts_iasl_disassemble_aml(
>  			(void)fclose(fpout);
>  			_exit(1);
>  		}
> +		AdInitialize();
>  
>  		/* ...and do the ACPICA disassambly... */
>  		AslDoOneFile((char *)tables[which]);
> @@ -231,14 +223,28 @@ int fwts_iasl_assemble_aml(const char *source, char **stdout_output, char **stde
>  		(void)close(stderr_fds[0]);
>  
>  		/* Setup ACPICA compiler globals */
> +		AslGbl_WarningLevel = 0;
> +		AslGbl_NoErrors = FALSE;
>  		AcpiGbl_DisasmFlag = FALSE;
> +		AslGbl_DisplayRemarks = TRUE;
> +		AslGbl_DisplayWarnings = TRUE;
> +		AslGbl_DisplayOptimizations = TRUE;
> +		/* AslGbl_CompileTimesFlag = TRUE; */
>  		AslGbl_DoCompile = TRUE;
>  		AslGbl_PreprocessFlag = TRUE;
>  		AslGbl_UseDefaultAmlFilename = FALSE;
>  		AslGbl_OutputFilenamePrefix = (char*)source;
> -		UtConvertBackslashes (AslGbl_OutputFilenamePrefix);
> +		UtConvertBackslashes(AslGbl_OutputFilenamePrefix);
>  
> -		(void)AslDoOneFile((char *)source);
> +		AdInitialize();
> +		status = AslDoOneFile((char *)source);
> +
> +		AslCheckExpectedExceptions();
> +		UtFreeLineBuffers();
> +		AslParserCleanup();
> +		AcpiDmClearExternalFileList();
> +		AcpiTerminate();
> +		CmCleanupAndExit();
>  
>  		/*
>  		 * We need to flush buffered I/O on IASL stdout
> @@ -246,7 +252,6 @@ int fwts_iasl_assemble_aml(const char *source, char **stdout_output, char **stde
>  		 */
>  		(void)fflush(stdout);
>  		(void)fflush(stderr);
> -
>  		_exit(0);
>  		break;
>  	default:
> @@ -261,6 +266,7 @@ int fwts_iasl_assemble_aml(const char *source, char **stdout_output, char **stde
>  			if (fwts_iasl_read_output(stderr_fds[0], stderr_output, &stderr_len, &stderr_eof) < 0)
>  				break;
>  		}
> +
>  		(void)waitpid(pid, &status, WUNTRACED | WCONTINUED);
>  		(void)close(stdout_fds[0]);
>  		(void)close(stderr_fds[0]);
> diff --git a/src/acpica/source/compiler/prutils.c b/src/acpica/source/compiler/prutils.c
> index b5ddfa9f..f3d615ad 100644
> --- a/src/acpica/source/compiler/prutils.c
> +++ b/src/acpica/source/compiler/prutils.c
> @@ -455,7 +455,6 @@ PrOpenIncludeWithPrefix (
>      IncludeFile = fopen (Pathname, OpenMode);
>      if (!IncludeFile)
>      {
> -        fprintf (stderr, "Could not open include file %s\n", Pathname);
>          return (NULL);
>      }
>  
> diff --git a/src/acpica/source/components/events/evgpe.c b/src/acpica/source/components/events/evgpe.c
> index f5ea992a..7534f6d7 100644
> --- a/src/acpica/source/components/events/evgpe.c
> +++ b/src/acpica/source/components/events/evgpe.c
> @@ -240,6 +240,14 @@ AcpiEvEnableGpe (
>      ACPI_FUNCTION_TRACE (EvEnableGpe);
>  
>  
> +    /* Clear the GPE (of stale events) */
> +
> +    Status = AcpiHwClearGpe(GpeEventInfo);
> +    if (ACPI_FAILURE(Status))
> +    {
> +        return_ACPI_STATUS(Status);
> +    }
> +
>      /* Enable the requested GPE */
>  
>      Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_ENABLE);
> diff --git a/src/acpica/source/components/namespace/nsalloc.c b/src/acpica/source/components/namespace/nsalloc.c
> index ff178d49..12772308 100644
> --- a/src/acpica/source/components/namespace/nsalloc.c
> +++ b/src/acpica/source/components/namespace/nsalloc.c
> @@ -232,6 +232,11 @@ AcpiNsDeleteNode (
>      ACPI_FUNCTION_NAME (NsDeleteNode);
>  
>  
> +    if (!Node)
> +    {
> +        return_VOID;
> +    }
> +
>      /* Detach an object if there is one */
>  
>      AcpiNsDetachObject (Node);
> diff --git a/src/acpica/source/include/acpixf.h b/src/acpica/source/include/acpixf.h
> index d3e4e7b5..be338bbe 100644
> --- a/src/acpica/source/include/acpixf.h
> +++ b/src/acpica/source/include/acpixf.h
> @@ -154,7 +154,7 @@
>  
>  /* Current ACPICA subsystem version in YYYYMMDD format */
>  
> -#define ACPI_CA_VERSION                 0x20190329
> +#define ACPI_CA_VERSION                 0x20190405
>  
>  #include "acconfig.h"
>  #include "actypes.h"

Acked-by: Ivan Hu <ivan.hu at canonical.com>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/fwts-devel/attachments/20190419/74fa2736/attachment-0001.sig>


More information about the fwts-devel mailing list