summaryrefslogtreecommitdiff
path: root/source/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'source/compiler')
-rw-r--r--source/compiler/aslcompile.c39
-rw-r--r--source/compiler/aslcompiler.y4
-rw-r--r--source/compiler/asldefine.h10
-rw-r--r--source/compiler/aslerror.c45
-rw-r--r--source/compiler/aslfiles.c24
-rw-r--r--source/compiler/aslload.c15
-rw-r--r--source/compiler/aslmessages.c4
-rw-r--r--source/compiler/aslmessages.h2
-rw-r--r--source/compiler/aslmethod.c4
-rw-r--r--source/compiler/asloptions.c2
-rw-r--r--source/compiler/aslstartup.c4
-rw-r--r--source/compiler/asltransform.c204
-rw-r--r--source/compiler/aslutils.c5
-rw-r--r--source/compiler/aslxref.c31
-rw-r--r--source/compiler/dtcompile.c29
-rw-r--r--source/compiler/dtcompiler.h1
-rw-r--r--source/compiler/dttable2.c1
17 files changed, 328 insertions, 96 deletions
diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c
index 9214cfdfc9ba..ce60b2dab958 100644
--- a/source/compiler/aslcompile.c
+++ b/source/compiler/aslcompile.c
@@ -220,6 +220,7 @@ CmDoCompile (
PrDoPreprocess ();
AslGbl_CurrentLineNumber = 1;
AslGbl_LogicalLineNumber = 1;
+ AslGbl_CurrentLineOffset = 0;
if (AslGbl_PreprocessOnly)
{
@@ -282,25 +283,6 @@ CmDoCompile (
LsDumpParseTree ();
- OpcGetIntegerWidth (AslGbl_ParseTreeRoot->Asl.Child);
- UtEndEvent (Event);
-
- /* Pre-process parse tree for any operator transforms */
-
- Event = UtBeginEvent ("Parse tree transforms");
- DbgPrint (ASL_DEBUG_OUTPUT, "\nParse tree transforms\n\n");
- TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE,
- TrAmlTransformWalkBegin, TrAmlTransformWalkEnd, NULL);
- UtEndEvent (Event);
-
- /* Generate AML opcodes corresponding to the parse tokens */
-
- Event = UtBeginEvent ("Generate AML opcodes");
- DbgPrint (ASL_DEBUG_OUTPUT, "Generating AML opcodes\n\n");
- TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL,
- OpcAmlOpcodeWalk, NULL);
- UtEndEvent (Event);
-
UtEndEvent (FullCompile);
return (AE_OK);
@@ -331,6 +313,25 @@ CmDoAslMiddleAndBackEnd (
ACPI_STATUS Status;
+ OpcGetIntegerWidth (AslGbl_ParseTreeRoot->Asl.Child);
+
+ /* Pre-process parse tree for any operator transforms */
+
+ Event = UtBeginEvent ("Parse tree transforms");
+ DbgPrint (ASL_DEBUG_OUTPUT, "\nParse tree transforms\n\n");
+ TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE,
+ TrAmlTransformWalkBegin, TrAmlTransformWalkEnd, NULL);
+ UtEndEvent (Event);
+
+ /* Generate AML opcodes corresponding to the parse tokens */
+
+ Event = UtBeginEvent ("Generate AML opcodes");
+ DbgPrint (ASL_DEBUG_OUTPUT, "Generating AML opcodes\n\n");
+ TrWalkParseTree (AslGbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD,
+ NULL, OpcAmlOpcodeWalk, NULL);
+ UtEndEvent (Event);
+
+
/* Interpret and generate all compile-time constants */
Event = UtBeginEvent ("Constant folding via AML interpreter");
diff --git a/source/compiler/aslcompiler.y b/source/compiler/aslcompiler.y
index c767c89a4337..8f0a512e8539 100644
--- a/source/compiler/aslcompiler.y
+++ b/source/compiler/aslcompiler.y
@@ -3442,7 +3442,7 @@ AddressKeyword
;
AddressSpaceKeyword
- : ByteConst {$$ = UtCheckIntegerRange ($1, 0x0A, 0xFF);}
+ : ByteConst {$$ = UtCheckIntegerRange ($1, ACPI_NUM_PREDEFINED_REGIONS, 0xFF);}
| RegionSpaceKeyword {}
;
@@ -4843,7 +4843,6 @@ OptionalXferSize
/* Local support functions in C */
-
/******************************************************************************
*
* Local support functions
@@ -4918,4 +4917,3 @@ UtGetOpName (
return ("[Unknown parser generator]");
#endif
}
-
diff --git a/source/compiler/asldefine.h b/source/compiler/asldefine.h
index 0ba08962047a..675a5870d56c 100644
--- a/source/compiler/asldefine.h
+++ b/source/compiler/asldefine.h
@@ -222,11 +222,11 @@
/* Misc */
-#define ASL_EXTERNAL_METHOD 255
-#define ASL_ABORT TRUE
-#define ASL_NO_ABORT FALSE
-#define ASL_EOF ACPI_UINT32_MAX
-#define ASL_IGNORE_LINE (ACPI_UINT32_MAX -1)
+#define ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS 255
+#define ASL_ABORT TRUE
+#define ASL_NO_ABORT FALSE
+#define ASL_EOF ACPI_UINT32_MAX
+#define ASL_IGNORE_LINE (ACPI_UINT32_MAX -1)
/* Listings */
diff --git a/source/compiler/aslerror.c b/source/compiler/aslerror.c
index ae1f38acfe77..f6eab921e455 100644
--- a/source/compiler/aslerror.c
+++ b/source/compiler/aslerror.c
@@ -335,7 +335,7 @@ AeAddToErrorLog (
* PARAMETERS: OutputFile - Output file
* Enode - Error node to print
* PrematureEOF - True = PrematureEOF has been reached
- * Total - Total legth of line
+ * Total - Total length of line
*
* RETURN: None
*
@@ -445,7 +445,7 @@ AeDecodeErrorMessageId (
* PARAMETERS: OutputFile - Output file
* Enode - Error node to print
* PrematureEOF - True = PrematureEOF has been reached
- * Total - amount of characters printed so far
+ * Total - Number of characters printed so far
*
*
* RETURN: Status
@@ -527,6 +527,7 @@ AePrintErrorSourceLine (
fprintf (OutputFile, "\n");
return AE_OK;
}
+
/*
* Seek to the offset in the combined source file,
* read the source line, and write it to the output.
@@ -550,7 +551,8 @@ AePrintErrorSourceLine (
AslGbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
return AE_IO_ERROR;
}
- /* Read/write the source line, up to the maximum line length */
+
+ /* Read/write the source line, up to the maximum line length */
while (RActual && SourceByte && (SourceByte != '\n'))
{
@@ -732,7 +734,7 @@ AePrintException (
*
* RETURN: None
*
- * DESCRIPTION: Print the contents of an error nodes. This function is tailored
+ * DESCRIPTION: Print the contents of an error node. This function is tailored
* to print error nodes that are SubErrors within ASL_ERROR_MSG
*
******************************************************************************/
@@ -795,8 +797,8 @@ AePrintErrorLog (
* LogicalLineNumber - Cumulative line number
* LogicalByteOffset - Byte offset in source file
* Column - Column in current line
- * Filename - source filename
- * ExtraMessage - additional error message
+ * Filename - Source filename
+ * ExtraMessage - Additional error message
* SourceLine - Line of error source code
* SubError - SubError of this InputEnode
*
@@ -863,10 +865,17 @@ static void AslInitEnode (
Enode->FilenameLength = 6;
}
- FileNode = FlGetCurrentFileNode ();
+ /*
+ * Attempt to get the file node of the filename listed in the parse
+ * node. If the name doesn't exist in the global file node, it is
+ * because the file is included by #include or ASL include. In this
+ * case, get the current file node. The source output of the current
+ * file will contain the contents of the file listed in the parse node.
+ */
+ FileNode = FlGetFileNode (ASL_FILE_INPUT, Filename);
if (!FileNode)
{
- return;
+ FileNode = FlGetCurrentFileNode ();
}
Enode->SourceFilename =
@@ -884,8 +893,8 @@ static void AslInitEnode (
* LineNumber - Actual file line number
* Column - Column in current line
* SourceLine - Actual source code line
- * Filename - source filename
- * ExtraMessage - additional error message
+ * Filename - Source filename
+ * ExtraMessage - Additional error message
*
* RETURN: None
*
@@ -918,8 +927,8 @@ AslCommonError2 (
* LogicalLineNumber - Cumulative line number
* LogicalByteOffset - Byte offset in source file
* Column - Column in current line
- * Filename - source filename
- * ExtraMessage - additional error message
+ * Filename - Source filename
+ * ExtraMessage - Additional error message
*
* RETURN: None
*
@@ -961,8 +970,8 @@ AslCommonError (
* LogicalLineNumber - Cumulative line number
* LogicalByteOffset - Byte offset in source file
* Column - Column in current line
- * Filename - source filename
- * Message - additional error message
+ * Filename - Source filename
+ * Message - Additional error message
* SourceLine - Actual line of source code
* SubError - Sub-error associated with this error
*
@@ -1025,7 +1034,7 @@ AslLogNewError (
* PARAMETERS: Level - Seriousness (Warning/error, etc.)
* MessageId - Index into global message buffer
*
- * RETURN: UINT8 - modified level
+ * RETURN: UINT8 - Modified level
*
* DESCRIPTION: Get the modified level of exception codes that are reported as
* errors from the -ww option.
@@ -1369,7 +1378,7 @@ AslIsExceptionDisabled (
* MainMsg - Message pertaining to the MainOp
* SubMsgId - Index into global message buffer
* SubOp - Additional parse node for better message
- * SubMsg - Message pertainint to SubOp
+ * SubMsg - Message pertaining to SubOp
*
*
* RETURN: None
@@ -1421,7 +1430,7 @@ AslDualParseOpError (
* PARAMETERS: Level - Seriousness (Warning/error, etc.)
* MessageId - Index into global message buffer
* Op - Parse node where error happened
- * ExtraMessage - additional error message
+ * ExtraMessage - Additional error message
*
* RETURN: None
*
@@ -1459,7 +1468,7 @@ AslError (
*
* PARAMETERS: Op - Parse node where error happened
* Status - The ACPICA Exception
- * ExtraMessage - additional error message
+ * ExtraMessage - Additional error message
* Abort - TRUE -> Abort compilation
*
* RETURN: None
diff --git a/source/compiler/aslfiles.c b/source/compiler/aslfiles.c
index b9208c7c4492..dba05d35d33a 100644
--- a/source/compiler/aslfiles.c
+++ b/source/compiler/aslfiles.c
@@ -207,12 +207,6 @@ FlInitOneFile (
NewFileNode = ACPI_CAST_PTR (ASL_GLOBAL_FILE_NODE,
UtLocalCacheCalloc (sizeof (ASL_GLOBAL_FILE_NODE)));
- if (!NewFileNode)
- {
- AslError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION, NULL, NULL);
- return (AE_NO_MEMORY);
- }
-
NewFileNode->ParserErrorDetected = FALSE;
NewFileNode->Next = AslGbl_FilesList;
@@ -420,8 +414,22 @@ ASL_GLOBAL_FILE_NODE *
FlGetCurrentFileNode (
void)
{
- return (FlGetFileNode (
- ASL_FILE_INPUT,AslGbl_Files[ASL_FILE_INPUT].Filename));
+ ASL_GLOBAL_FILE_NODE *FileNode =
+ FlGetFileNode (ASL_FILE_INPUT,AslGbl_Files[ASL_FILE_INPUT].Filename);
+
+
+ if (!FileNode)
+ {
+ /*
+ * If the current file node does not exist after initializing the file
+ * node structures, something went wrong and this is an unrecoverable
+ * condition.
+ */
+ FlFileError (ASL_FILE_INPUT, ASL_MSG_COMPILER_INTERNAL);
+ AslAbort ();
+ }
+
+ return (FileNode);
}
diff --git a/source/compiler/aslload.c b/source/compiler/aslload.c
index db6c2d41eeef..6e3d7e7d99eb 100644
--- a/source/compiler/aslload.c
+++ b/source/compiler/aslload.c
@@ -357,7 +357,7 @@ LdLoadFieldElements (
* The name already exists in this scope
* But continue processing the elements
*/
- AslDualParseOpError (ASL_WARNING, ASL_MSG_NAME_EXISTS, Child,
+ AslDualParseOpError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Child,
Child->Asl.Value.String, ASL_MSG_FOUND_HERE, Node->Op,
Node->Op->Asl.ExternalName);
}
@@ -986,12 +986,19 @@ FinishNode:
Op->Asl.Node = Node;
Node->Op = Op;
- /* Set the actual data type if appropriate (EXTERNAL term only) */
-
+ /*
+ * Set the actual data type if appropriate (EXTERNAL term only)
+ * As of 11/19/2019, ASL External() does not support parameter
+ * counts. When an External method is loaded, the parameter count is
+ * unknown setting Node->Value to ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS
+ * indicates that the parameter count for this method is unknown.
+ * This information is used in ASL cross reference to help determine the
+ * parameter count through method calls.
+ */
if (ActualObjectType != ACPI_TYPE_ANY)
{
Node->Type = (UINT8) ActualObjectType;
- Node->Value = ASL_EXTERNAL_METHOD;
+ Node->Value = ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS;
}
if (Op->Asl.ParseOpcode == PARSEOP_METHOD)
diff --git a/source/compiler/aslmessages.c b/source/compiler/aslmessages.c
index d132935234f2..ea118c0d43fc 100644
--- a/source/compiler/aslmessages.c
+++ b/source/compiler/aslmessages.c
@@ -368,7 +368,9 @@ const char *AslCompilerMsgs [] =
/* ASL_MSG_BUFFER_FIELD_OVERFLOW */ "Buffer field extends beyond end of target buffer",
/* ASL_MSG_INVALID_SPECIAL_NAME */ "declaration of this named object outside root scope is illegal",
/* ASL_MSG_INVALID_PROCESSOR_UID */ "_UID inside processor declaration must be an integer",
-/* ASL_MSG_LEGACY_PROCESSOR_OP */ "Legacy Processor() keyword detected. Use Device() keyword instead."
+/* ASL_MSG_LEGACY_PROCESSOR_OP */ "Legacy Processor() keyword detected. Use Device() keyword instead.",
+/* ASL_MSG_NAMESTRING_LENGTH */ "NameString contains too many NameSegs (>255)",
+/* ASL_MSG_CASE_FOUND_HERE */ "Original Case value below:"
};
/* Table compiler */
diff --git a/source/compiler/aslmessages.h b/source/compiler/aslmessages.h
index 47e5bf4314d8..385b730ff0c5 100644
--- a/source/compiler/aslmessages.h
+++ b/source/compiler/aslmessages.h
@@ -371,6 +371,8 @@ typedef enum
ASL_MSG_INVALID_SPECIAL_NAME,
ASL_MSG_INVALID_PROCESSOR_UID,
ASL_MSG_LEGACY_PROCESSOR_OP,
+ ASL_MSG_NAMESTRING_LENGTH,
+ ASL_MSG_CASE_FOUND_HERE,
/* These messages are used by the Data Table compiler only */
diff --git a/source/compiler/aslmethod.c b/source/compiler/aslmethod.c
index 667eaaaf8a81..4b29fc9e7acd 100644
--- a/source/compiler/aslmethod.c
+++ b/source/compiler/aslmethod.c
@@ -586,7 +586,7 @@ MtMethodAnalysisWalkBegin (
/* Special typechecking for _HID */
- if (!strcmp (METHOD_NAME__HID, Op->Asl.NameSeg))
+ if (ACPI_COMPARE_NAMESEG (METHOD_NAME__HID, Op->Asl.NameSeg))
{
Next = Op->Asl.Child->Asl.Next;
AnCheckId (Next, ASL_TYPE_HID);
@@ -594,7 +594,7 @@ MtMethodAnalysisWalkBegin (
/* Special typechecking for _CID */
- else if (!strcmp (METHOD_NAME__CID, Op->Asl.NameSeg))
+ else if (ACPI_COMPARE_NAMESEG (METHOD_NAME__CID, Op->Asl.NameSeg))
{
Next = Op->Asl.Child->Asl.Next;
diff --git a/source/compiler/asloptions.c b/source/compiler/asloptions.c
index 7c17814966e4..7758610cfb35 100644
--- a/source/compiler/asloptions.c
+++ b/source/compiler/asloptions.c
@@ -219,7 +219,7 @@ AslCommandLine (
{
exit (-1);
}
- exit (1);
+ exit (0);
}
/* Next parameter must be the input filename */
diff --git a/source/compiler/aslstartup.c b/source/compiler/aslstartup.c
index c43c1a9717dc..73c555a6749d 100644
--- a/source/compiler/aslstartup.c
+++ b/source/compiler/aslstartup.c
@@ -457,10 +457,6 @@ AslDoOneFile (
}
FileNode = FlGetCurrentFileNode();
- if (!FileNode)
- {
- return (AE_ERROR);
- }
FileNode->OriginalInputFileSize = FlGetFileSize (ASL_FILE_INPUT);
diff --git a/source/compiler/asltransform.c b/source/compiler/asltransform.c
index 7dc642d880ac..c80afe3a6b44 100644
--- a/source/compiler/asltransform.c
+++ b/source/compiler/asltransform.c
@@ -151,6 +151,7 @@
#include "aslcompiler.h"
#include "aslcompiler.y.h"
+#include "acnamesp.h"
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("asltransform")
@@ -194,6 +195,16 @@ static void
TrDoSwitch (
ACPI_PARSE_OBJECT *StartNode);
+static void
+TrCheckForDuplicateCase (
+ ACPI_PARSE_OBJECT *CaseOp,
+ ACPI_PARSE_OBJECT *Predicate1);
+
+static BOOLEAN
+TrCheckForBufferMatch (
+ ACPI_PARSE_OBJECT *Next1,
+ ACPI_PARSE_OBJECT *Next2);
+
/*******************************************************************************
*
@@ -431,6 +442,7 @@ TrTransformSubtree (
ACPI_PARSE_OBJECT *Op)
{
ACPI_PARSE_OBJECT *MethodOp;
+ ACPI_NAMESTRING_INFO Info;
if (Op->Asl.AmlOpcode == AML_RAW_DATA_BYTE)
@@ -492,6 +504,22 @@ TrTransformSubtree (
Op->Asl.Value.String = "\\";
break;
+ case PARSEOP_NAMESTRING:
+ /*
+ * A NameString can be up to 255 (0xFF) individual NameSegs maximum
+ * (with 254 dot separators) - as per the ACPI specification. Note:
+ * Cannot check for NumSegments == 0 because things like
+ * Scope(\) are legal and OK.
+ */
+ Info.ExternalName = Op->Asl.Value.String;
+ AcpiNsGetInternalNameLength (&Info);
+
+ if (Info.NumSegments > 255)
+ {
+ AslError (ASL_ERROR, ASL_MSG_NAMESTRING_LENGTH, Op, NULL);
+ }
+ break;
+
case PARSEOP_UNLOAD:
AslError (ASL_WARNING, ASL_MSG_UNLOAD, Op, NULL);
@@ -510,7 +538,6 @@ TrTransformSubtree (
case PARSEOP_PROCESSOR:
AslError (ASL_WARNING, ASL_MSG_LEGACY_PROCESSOR_OP, Op, Op->Asl.ExternalName);
-
break;
default:
@@ -646,6 +673,8 @@ TrDoSwitch (
if (Next->Asl.ParseOpcode == PARSEOP_CASE)
{
+ TrCheckForDuplicateCase (Next, Next->Asl.Child);
+
if (CaseOp)
{
/* Add an ELSE to complete the previous CASE */
@@ -977,3 +1006,176 @@ TrDoSwitch (
BreakOp->Asl.Parent = StartNode;
TrAmlInsertPeer (Conditional, BreakOp);
}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrCheckForDuplicateCase
+ *
+ * PARAMETERS: CaseOp - Parse node for first Case statement in list
+ * Predicate1 - Case value for the input CaseOp
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Check for duplicate case values. Currently, only handles
+ * Integers, Strings and Buffers. No support for Package objects.
+ *
+ ******************************************************************************/
+
+static void
+TrCheckForDuplicateCase (
+ ACPI_PARSE_OBJECT *CaseOp,
+ ACPI_PARSE_OBJECT *Predicate1)
+{
+ ACPI_PARSE_OBJECT *Next;
+ ACPI_PARSE_OBJECT *Predicate2;
+
+
+ /* Walk the list of CASE opcodes */
+
+ Next = CaseOp->Asl.Next;
+ while (Next)
+ {
+ if (Next->Asl.ParseOpcode == PARSEOP_CASE)
+ {
+ /* Emit error only once */
+
+ if (Next->Asl.CompileFlags & OP_IS_DUPLICATE)
+ {
+ goto NextCase;
+ }
+
+ /* Check for a duplicate plain integer */
+
+ Predicate2 = Next->Asl.Child;
+ if ((Predicate1->Asl.ParseOpcode == PARSEOP_INTEGER) &&
+ (Predicate2->Asl.ParseOpcode == PARSEOP_INTEGER))
+ {
+ if (Predicate1->Asl.Value.Integer == Predicate2->Asl.Value.Integer)
+ {
+ goto FoundDuplicate;
+ }
+ }
+
+ /* Check for pairs of the constants ZERO, ONE, ONES */
+
+ else if (((Predicate1->Asl.ParseOpcode == PARSEOP_ZERO) &&
+ (Predicate2->Asl.ParseOpcode == PARSEOP_ZERO)) ||
+ ((Predicate1->Asl.ParseOpcode == PARSEOP_ONE) &&
+ (Predicate2->Asl.ParseOpcode == PARSEOP_ONE)) ||
+ ((Predicate1->Asl.ParseOpcode == PARSEOP_ONES) &&
+ (Predicate2->Asl.ParseOpcode == PARSEOP_ONES)))
+ {
+ goto FoundDuplicate;
+ }
+
+ /* Check for a duplicate string constant (literal) */
+
+ else if ((Predicate1->Asl.ParseOpcode == PARSEOP_STRING_LITERAL) &&
+ (Predicate2->Asl.ParseOpcode == PARSEOP_STRING_LITERAL))
+ {
+ if (!strcmp (Predicate1->Asl.Value.String,
+ Predicate2->Asl.Value.String))
+ {
+ goto FoundDuplicate;
+ }
+ }
+
+ /* Check for a duplicate buffer constant */
+
+ else if ((Predicate1->Asl.ParseOpcode == PARSEOP_BUFFER) &&
+ (Predicate2->Asl.ParseOpcode == PARSEOP_BUFFER))
+ {
+ if (TrCheckForBufferMatch (Predicate1->Asl.Child,
+ Predicate2->Asl.Child))
+ {
+ goto FoundDuplicate;
+ }
+ }
+ }
+ goto NextCase;
+
+FoundDuplicate:
+ /* Emit error message only once */
+
+ Next->Asl.CompileFlags |= OP_IS_DUPLICATE;
+
+ AslDualParseOpError (ASL_ERROR, ASL_MSG_DUPLICATE_CASE, Next,
+ Next->Asl.Value.String, ASL_MSG_CASE_FOUND_HERE, CaseOp,
+ CaseOp->Asl.ExternalName);
+
+NextCase:
+ Next = Next->Asl.Next;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrCheckForBufferMatch
+ *
+ * PARAMETERS: Next1 - Parse node for first opcode in first buffer list
+ * (The DEFAULT_ARG or INTEGER node)
+ * Next2 - Parse node for first opcode in second buffer list
+ * (The DEFAULT_ARG or INTEGER node)
+ *
+ * RETURN: TRUE if buffers match, FALSE otherwise
+ *
+ * DESCRIPTION: Check for duplicate Buffer case values.
+ *
+ ******************************************************************************/
+
+static BOOLEAN
+TrCheckForBufferMatch (
+ ACPI_PARSE_OBJECT *NextOp1,
+ ACPI_PARSE_OBJECT *NextOp2)
+{
+
+ if (NextOp1->Asl.Value.Integer != NextOp2->Asl.Value.Integer)
+ {
+ return (FALSE);
+ }
+
+ /* Start at the BYTECONST initializer node list */
+
+ NextOp1 = NextOp1->Asl.Next;
+ NextOp2 = NextOp2->Asl.Next;
+
+ /*
+ * Walk both lists until either a mismatch is found, or one or more
+ * end-of-lists are found
+ */
+ while (NextOp1 && NextOp2)
+ {
+ if ((NextOp1->Asl.ParseOpcode == PARSEOP_STRING_LITERAL) &&
+ (NextOp2->Asl.ParseOpcode == PARSEOP_STRING_LITERAL))
+ {
+ if (!strcmp (NextOp1->Asl.Value.String, NextOp2->Asl.Value.String))
+ {
+ return (TRUE);
+ }
+ else
+ {
+ return (FALSE);
+ }
+ }
+ if ((UINT8) NextOp1->Asl.Value.Integer != (UINT8) NextOp2->Asl.Value.Integer)
+ {
+ return (FALSE);
+ }
+
+ NextOp1 = NextOp1->Asl.Next;
+ NextOp2 = NextOp2->Asl.Next;
+ }
+
+ /* Not a match if one of the lists is not at end-of-list */
+
+ if (NextOp1 || NextOp2)
+ {
+ return (FALSE);
+ }
+
+ /* Otherwise, the buffers match */
+
+ return (TRUE);
+}
diff --git a/source/compiler/aslutils.c b/source/compiler/aslutils.c
index 0faaec03dd8d..0ee94d6a927b 100644
--- a/source/compiler/aslutils.c
+++ b/source/compiler/aslutils.c
@@ -567,11 +567,6 @@ UtDisplayOneSummary (
/* Summary of main input and output files */
FileNode = FlGetCurrentFileNode ();
- if (!FileNode)
- {
- fprintf (stderr, "Summary could not be generated");
- return;
- }
if (FileNode->ParserErrorDetected)
{
diff --git a/source/compiler/aslxref.c b/source/compiler/aslxref.c
index d903ef1ba876..8a1f1a4c5e7f 100644
--- a/source/compiler/aslxref.c
+++ b/source/compiler/aslxref.c
@@ -1055,7 +1055,7 @@ XfNamespaceLocateBegin (
NextOp = NextOp->Asl.Next;
}
- if (Node->Value != ASL_EXTERNAL_METHOD &&
+ if (Node->Value != ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS &&
Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_EXTERNAL)
{
/*
@@ -1064,8 +1064,17 @@ XfNamespaceLocateBegin (
*/
if (PassedArgs != Node->Value)
{
- sprintf (AslGbl_MsgBuffer, "%s requires %u", Op->Asl.ExternalName,
- Node->Value);
+ if (Node->Flags & ANOBJ_IS_EXTERNAL)
+ {
+ sprintf (AslGbl_MsgBuffer,
+ "according to previous use, %s requires %u",
+ Op->Asl.ExternalName, Node->Value);
+ }
+ else
+ {
+ sprintf (AslGbl_MsgBuffer, "%s requires %u", Op->Asl.ExternalName,
+ Node->Value);
+ }
if (PassedArgs < Node->Value)
{
@@ -1077,6 +1086,22 @@ XfNamespaceLocateBegin (
}
}
}
+
+ /*
+ * At this point, a method call to an external method has been
+ * detected. As of 11/19/2019, iASL does not support parameter counts
+ * for methods declared as external. Therefore, save the parameter
+ * count of the first method call and use this count check other
+ * method calls to ensure that the methods are being called with the
+ * same amount of parameters.
+ */
+ else if (Node->Type == ACPI_TYPE_METHOD &&
+ (Node->Flags & ANOBJ_IS_EXTERNAL) &&
+ Node->Value == ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS &&
+ Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_EXTERNAL)
+ {
+ Node->Value = PassedArgs;
+ }
}
/* 4) Check for an ASL Field definition */
diff --git a/source/compiler/dtcompile.c b/source/compiler/dtcompile.c
index bdd8c1b70b8d..6c52f98987cd 100644
--- a/source/compiler/dtcompile.c
+++ b/source/compiler/dtcompile.c
@@ -261,25 +261,15 @@ DtDoCompile (
UtEndEvent (Event);
FileNode = FlGetCurrentFileNode ();
- if (!FileNode)
- {
- fprintf (stderr, "Summary for %s could not be generated",
- AslGbl_Files[ASL_FILE_INPUT].Filename);
- }
- else
- {
- FileNode->TotalLineCount = AslGbl_CurrentLineNumber;
- FileNode->OriginalInputFileSize = AslGbl_InputByteCount;
- DbgPrint (ASL_PARSE_OUTPUT, "Line count: %u input file size: %u\n",
- FileNode->TotalLineCount, FileNode->OriginalInputFileSize);
- }
+
+ FileNode->TotalLineCount = AslGbl_CurrentLineNumber;
+ FileNode->OriginalInputFileSize = AslGbl_InputByteCount;
+ DbgPrint (ASL_PARSE_OUTPUT, "Line count: %u input file size: %u\n",
+ FileNode->TotalLineCount, FileNode->OriginalInputFileSize);
if (ACPI_FAILURE (Status))
{
- if (FileNode)
- {
- FileNode->ParserErrorDetected = TRUE;
- }
+ FileNode->ParserErrorDetected = TRUE;
/* TBD: temporary error message. Msgs should come from function above */
@@ -306,11 +296,8 @@ DtDoCompile (
/* Save the compile time statistics to the current file node */
- if (FileNode)
- {
- FileNode->TotalFields = AslGbl_InputFieldCount;
- FileNode->OutputByteLength = AslGbl_TableLength;
- }
+ FileNode->TotalFields = AslGbl_InputFieldCount;
+ FileNode->OutputByteLength = AslGbl_TableLength;
return (Status);
}
diff --git a/source/compiler/dtcompiler.h b/source/compiler/dtcompiler.h
index 7c78b55bafa7..427051c31b92 100644
--- a/source/compiler/dtcompiler.h
+++ b/source/compiler/dtcompiler.h
@@ -459,7 +459,6 @@ DtCreateTableUnit (
UINT32 Column);
-
/* dtparser - lex/yacc files */
UINT64 DtCompilerParserResult; /* Expression return value */
diff --git a/source/compiler/dttable2.c b/source/compiler/dttable2.c
index bbaaafaa763b..550cca131475 100644
--- a/source/compiler/dttable2.c
+++ b/source/compiler/dttable2.c
@@ -1662,6 +1662,7 @@ DtCompileSlit (
"Found %u entries, must match LocalityCount: %u",
LocalityListLength, Localities);
DtError (ASL_ERROR, ASL_MSG_ENTRY_LIST, EndOfFieldList, AslGbl_MsgBuffer);
+ ACPI_FREE (LocalityBuffer);
return (AE_LIMIT);
}