aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2019-04-05 22:45:01 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2019-04-05 22:45:01 +0000
commita4d090d50dca12716fbca0cc738e692a0db75068 (patch)
tree13c8f19a527d6be9080917cf0bddbfe06103e99f
parent222d1f49264d00972299c6ff23de8100be561897 (diff)
downloadsrc-a4d090d50dca12716fbca0cc738e692a0db75068.tar.gz
src-a4d090d50dca12716fbca0cc738e692a0db75068.zip
Import ACPICA 20190405.vendor/acpica/20190405
Notes
Notes: svn path=/vendor-sys/acpica/dist/; revision=345969 svn path=/vendor-sys/acpica/20190405/; revision=345971; tag=vendor/acpica/20190405
-rw-r--r--changes.txt34
-rw-r--r--source/common/adisasm.c2
-rw-r--r--source/compiler/aslcodegen.c52
-rw-r--r--source/compiler/aslcompile.c183
-rw-r--r--source/compiler/aslcompiler.h61
-rw-r--r--source/compiler/asldefine.h1
-rw-r--r--source/compiler/aslerror.c26
-rw-r--r--source/compiler/aslfileio.c4
-rw-r--r--source/compiler/aslfiles.c253
-rw-r--r--source/compiler/aslglobal.h48
-rw-r--r--source/compiler/asllisting.c7
-rw-r--r--source/compiler/aslload.c1
-rw-r--r--source/compiler/aslmain.c81
-rw-r--r--source/compiler/aslmessages.c7
-rw-r--r--source/compiler/aslmessages.h5
-rw-r--r--source/compiler/asloperands.c25
-rw-r--r--source/compiler/asloptions.c1
-rw-r--r--source/compiler/aslstartup.c130
-rw-r--r--source/compiler/aslsupport.l12
-rw-r--r--source/compiler/asltree.c70
-rw-r--r--source/compiler/asltypes.h62
-rw-r--r--source/compiler/aslutils.c156
-rw-r--r--source/compiler/aslxref.c18
-rw-r--r--source/compiler/dtcompile.c11
-rw-r--r--source/compiler/prutils.c1
-rw-r--r--source/components/events/evgpe.c8
-rw-r--r--source/components/namespace/nsalloc.c5
-rw-r--r--source/include/acpixf.h2
28 files changed, 986 insertions, 280 deletions
diff --git a/changes.txt b/changes.txt
index f8de9aafa208..7be71e602afa 100644
--- a/changes.txt
+++ b/changes.txt
@@ -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:
diff --git a/source/common/adisasm.c b/source/common/adisasm.c
index 518468b7feba..c73208f68df6 100644
--- a/source/common/adisasm.c
+++ b/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/source/compiler/aslcodegen.c b/source/compiler/aslcodegen.c
index 8edcb668af4a..88e3482427b9 100644
--- a/source/compiler/aslcodegen.c
+++ b/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/source/compiler/aslcompile.c b/source/compiler/aslcompile.c
index c46b28da16b3..845f15bc236e 100644
--- a/source/compiler/aslcompile.c
+++ b/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/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h
index efcee77b519d..ad0e73f3cebf 100644
--- a/source/compiler/aslcompiler.h
+++ b/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)
/*
@@ -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
*/
@@ -1478,6 +1528,7 @@ ASL_RESOURCE_NODE *
RsDoPinGroupConfigDescriptor (
ASL_RESOURCE_INFO *Info);
+
/*
* aslrestype2d - DWord address descriptors
*/
diff --git a/source/compiler/asldefine.h b/source/compiler/asldefine.h
index 8089d0b95a0b..cffb0af1fe52 100644
--- a/source/compiler/asldefine.h
+++ b/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/source/compiler/aslerror.c b/source/compiler/aslerror.c
index a2f9fcef1766..db6d871deff2 100644
--- a/source/compiler/aslerror.c
+++ b/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/source/compiler/aslfileio.c b/source/compiler/aslfileio.c
index 3243ab5194ed..3db7b5335482 100644
--- a/source/compiler/aslfileio.c
+++ b/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/source/compiler/aslfiles.c b/source/compiler/aslfiles.c
index 0120af026b7b..80a74e816087 100644
--- a/source/compiler/aslfiles.c
+++ b/source/compiler/aslfiles.c
@@ -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);
}
diff --git a/source/compiler/aslglobal.h b/source/compiler/aslglobal.h
index bc7358cd62f3..213c540875f5 100644
--- a/source/compiler/aslglobal.h
+++ b/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/source/compiler/asllisting.c b/source/compiler/asllisting.c
index df3b7587a266..7bc118bc2511 100644
--- a/source/compiler/asllisting.c
+++ b/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/source/compiler/aslload.c b/source/compiler/aslload.c
index dfbdf7cefc4c..a055bab0605f 100644
--- a/source/compiler/aslload.c
+++ b/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/source/compiler/aslmain.c b/source/compiler/aslmain.c
index 26f4a0c4973d..81f634e678ff 100644
--- a/source/compiler/aslmain.c
+++ b/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/source/compiler/aslmessages.c b/source/compiler/aslmessages.c
index 0f31c655af78..d7e2eb43f617 100644
--- a/source/compiler/aslmessages.c
+++ b/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/source/compiler/aslmessages.h b/source/compiler/aslmessages.h
index 817e192e02cd..a7cd1f314fd1 100644
--- a/source/compiler/aslmessages.h
+++ b/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/source/compiler/asloperands.c b/source/compiler/asloperands.c
index 67e16fd58b19..4f4b636d5c1e 100644
--- a/source/compiler/asloperands.c
+++ b/source/compiler/asloperands.c
@@ -1045,6 +1045,7 @@ OpnDoDefinitionBlock (
ACPI_SIZE Length;
UINT32 i;
char *Filename;
+ ACPI_STATUS Status;
/*
@@ -1063,6 +1064,12 @@ OpnDoDefinitionBlock (
(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/source/compiler/asloptions.c b/source/compiler/asloptions.c
index dc0b9079b47f..dc00e1d2004b 100644
--- a/source/compiler/asloptions.c
+++ b/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/source/compiler/aslstartup.c b/source/compiler/aslstartup.c
index c0f14c80fba4..aee5ad60998c 100644
--- a/source/compiler/aslstartup.c
+++ b/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 =
@@ -459,18 +446,6 @@ AslDoOneFile (
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/source/compiler/aslsupport.l b/source/compiler/aslsupport.l
index 5cac84dc6df8..69c1399a9ec4 100644
--- a/source/compiler/aslsupport.l
+++ b/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/source/compiler/asltree.c b/source/compiler/asltree.c
index 6bb40888ed5d..62efc5fa907c 100644
--- a/source/compiler/asltree.c
+++ b/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/source/compiler/asltypes.h b/source/compiler/asltypes.h
index 628b2d378cc2..8a6a07505181 100644
--- a/source/compiler/asltypes.h
+++ b/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/source/compiler/aslutils.c b/source/compiler/aslutils.c
index 6b0d5eff31d7..0b78f473a985 100644
--- a/source/compiler/aslutils.c
+++ b/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]);
@@ -643,6 +719,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
*
* PARAMETERS: Op - Integer parse node
diff --git a/source/compiler/aslxref.c b/source/compiler/aslxref.c
index 99f6c4a07c0b..9d6e5c0bc68a 100644
--- a/source/compiler/aslxref.c
+++ b/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/source/compiler/dtcompile.c b/source/compiler/dtcompile.c
index 95fcb2d460d8..09cb3e6c4a2e 100644
--- a/source/compiler/dtcompile.c
+++ b/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/source/compiler/prutils.c b/source/compiler/prutils.c
index b5ddfa9ffbdf..f3d615ad5c16 100644
--- a/source/compiler/prutils.c
+++ b/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/source/components/events/evgpe.c b/source/components/events/evgpe.c
index f5ea992a270b..7534f6d75025 100644
--- a/source/components/events/evgpe.c
+++ b/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/source/components/namespace/nsalloc.c b/source/components/namespace/nsalloc.c
index ff178d491bbc..127723081a31 100644
--- a/source/components/namespace/nsalloc.c
+++ b/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/source/include/acpixf.h b/source/include/acpixf.h
index d3e4e7b54757..be338bbe75d9 100644
--- a/source/include/acpixf.h
+++ b/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"