aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2019-05-09 22:49:10 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2019-05-09 22:49:10 +0000
commit08f4234e06d8d6855c0b79c95da98f267ca3554e (patch)
tree1ad7923ff2f449c959fe850588203300417861ab
parenta4d090d50dca12716fbca0cc738e692a0db75068 (diff)
Notes
-rw-r--r--changes.txt87
-rw-r--r--source/compiler/aslcodegen.c3
-rw-r--r--source/compiler/aslcompile.c3
-rw-r--r--source/compiler/aslcompiler.h4
-rw-r--r--source/compiler/aslerror.c12
-rw-r--r--source/compiler/aslfiles.c6
-rw-r--r--source/compiler/aslload.c24
-rw-r--r--source/compiler/aslmain.c3
-rw-r--r--source/compiler/aslmessages.c7
-rw-r--r--source/compiler/aslmessages.h3
-rw-r--r--source/compiler/asloperands.c2
-rw-r--r--source/compiler/aslstartup.c6
-rw-r--r--source/compiler/aslutils.c12
-rw-r--r--source/compiler/aslwalks.c222
-rw-r--r--source/compiler/aslxref.c47
-rw-r--r--source/components/events/evgpe.c8
-rw-r--r--source/include/acpixf.h2
-rw-r--r--source/include/platform/aclinux.h10
18 files changed, 380 insertions, 81 deletions
diff --git a/changes.txt b/changes.txt
index 7be71e602afa..6d7724949565 100644
--- a/changes.txt
+++ b/changes.txt
@@ -1,4 +1,91 @@
----------------------------------------
+09 May 2019. Summary of changes for version 20190509:
+
+
+1) ACPICA kernel-resident subsystem:
+
+Revert commit 6c43e1a ("ACPICA: Clear status of GPEs before enabling
+them") that causes problems with Thunderbolt controllers to occur if a
+dock device is connected at init time (the xhci_hcd and thunderbolt
+modules crash which prevents peripherals connected through them from
+working). Commit 6c43e1a effectively causes commit ecc1165b8b74 ("ACPICA:
+Dispatch active GPEs at init time") to get undone, so the problem
+addressed by commit ecc1165b8b74 appears again as a result of it.
+
+
+2) iASL Compiler/Disassembler and ACPICA tools:
+
+Reverted iASL: Additional forward reference detection. This change
+reverts forward reference detection for field declarations. The feature
+unintentionally emitted AML bytecode with incorrect package lengths for
+some ASL code related to Fields and OperationRegions. This malformed AML
+can cause systems to crash
+during boot. The malformed AML bytecode is emitted in iASL version
+20190329 and 20190405.
+
+iASL: improve forward reference detection. This change improves forward
+reference detection for named objects inside of scopes. If a parse object
+has the OP_NOT_FOUND_DURING_LOAD set, it means that Op is a reference to
+a named object that is declared later in the AML bytecode. This is
+allowed if the reference is inside of a method and the declaration is
+outside of a method like so:
+
+DefinitionBlock(...)
+{
+ Method (TEST)
+ {
+ Return (NUM0)
+ }
+ Name (NUM0,0)
+}
+
+However, if the declaration and reference are both in the same method or
+outside any methods, this is a forward reference and should be marked as
+an error because it would result in runtime errors.
+
+DefinitionBlock(...)
+{
+ Name (BUFF, Buffer (NUM0) {}) // Forward reference
+ Name (NUM0, 0x0)
+
+ Method (TEST)
+ {
+ Local0 = NUM1
+ Name (NUM1, 0x1) // Forward reference
+ return (Local0)
+ }
+}
+
+iASL: Implemented additional buffer overflow analysis for BufferField
+declarations. Check if a buffer index argument to a create buffer field
+operation is beyond the end of the target buffer.
+
+This affects these AML operators:
+
+ AML_CREATE_FIELD_OP
+ AML_CREATE_BIT_FIELD_OP
+ AML_CREATE_BYTE_FIELD_OP
+ AML_CREATE_WORD_FIELD_OP
+ AML_CREATE_DWORD_FIELD_OP
+ AML_CREATE_QWORD_FIELD_OP
+
+ There are three conditions that must be satisfied in order to allow this
+validation at compile time:
+
+ 1) The length of the target buffer must be an integer constant
+ 2) The index specified in the create* must be an integer constant
+ 3) For CreateField, the bit length argument must be non-zero.
+
+Example:
+ Name (BUF1, Buffer() {1,2})
+ CreateField (BUF1, 7, 9, CF03) // 3: ERR
+
+dsdt.asl 14: CreateField (BUF1, 7, 9, CF03) // 3: ERR
+Error 6165 - ^ Buffer index beyond end of
+target buffer
+
+
+----------------------------------------
05 April 2019. Summary of changes for version 20190405:
diff --git a/source/compiler/aslcodegen.c b/source/compiler/aslcodegen.c
index 88e3482427b9..54b5ac2cf18a 100644
--- a/source/compiler/aslcodegen.c
+++ b/source/compiler/aslcodegen.c
@@ -690,7 +690,8 @@ CgUpdateHeader (
{
if (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte, 1) != AE_OK)
{
- printf ("EOF while reading checksum bytes\n");
+ AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, NULL,
+ "Table length is greater than size of the input file");
return;
}
diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c
index 845f15bc236e..5f152dc94db3 100644
--- a/source/compiler/aslcompile.c
+++ b/source/compiler/aslcompile.c
@@ -224,7 +224,6 @@ CmDoCompile (
if (AslGbl_PreprocessOnly)
{
UtEndEvent (Event);
- CmCleanupAndExit ();
return (AE_OK);
}
}
@@ -919,7 +918,7 @@ CmCleanupAndExit (
* We will delete the AML file if there are errors and the
* force AML output option has not been used.
*/
- if (AslGbl_ParserErrorDetected || ((AslGbl_ExceptionCount[ASL_ERROR] > 0) &&
+ if (AslGbl_ParserErrorDetected || AslGbl_PreprocessOnly || ((AslGbl_ExceptionCount[ASL_ERROR] > 0) &&
(!AslGbl_IgnoreErrors) &&
AslGbl_Files[ASL_FILE_AML_OUTPUT].Handle))
{
diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h
index ad0e73f3cebf..5c4bdc177333 100644
--- a/source/compiler/aslcompiler.h
+++ b/source/compiler/aslcompiler.h
@@ -1105,10 +1105,6 @@ ASL_GLOBAL_FILE_NODE *
FlGetCurrentFileNode (
void);
-BOOLEAN
-FlInputFileExists (
- char *InputFilename);
-
/*
* aslhwmap - hardware map summary
diff --git a/source/compiler/aslerror.c b/source/compiler/aslerror.c
index db6d871deff2..ae1f38acfe77 100644
--- a/source/compiler/aslerror.c
+++ b/source/compiler/aslerror.c
@@ -869,16 +869,8 @@ static void AslInitEnode (
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;
- }
+ Enode->SourceFilename =
+ FileNode->Files[ASL_FILE_SOURCE_OUTPUT].Filename;
}
}
diff --git a/source/compiler/aslfiles.c b/source/compiler/aslfiles.c
index 80a74e816087..b9208c7c4492 100644
--- a/source/compiler/aslfiles.c
+++ b/source/compiler/aslfiles.c
@@ -163,6 +163,10 @@ FlOpenIncludeWithPrefix (
ACPI_PARSE_OBJECT *Op,
char *Filename);
+static BOOLEAN
+FlInputFileExists (
+ char *InputFilename);
+
#ifdef ACPI_OBSOLETE_FUNCTIONS
ACPI_STATUS
FlParseInputPathname (
@@ -250,7 +254,7 @@ FlInitOneFile (
*
******************************************************************************/
-BOOLEAN
+static BOOLEAN
FlInputFileExists (
char *Filename)
{
diff --git a/source/compiler/aslload.c b/source/compiler/aslload.c
index a055bab0605f..d1523ab69cc8 100644
--- a/source/compiler/aslload.c
+++ b/source/compiler/aslload.c
@@ -263,10 +263,29 @@ LdLoadFieldElements (
ACPI_WALK_STATE *WalkState)
{
ACPI_PARSE_OBJECT *Child = NULL;
+ ACPI_PARSE_OBJECT *SourceRegion;
ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
+
+ SourceRegion = UtGetArg (Op, 0);
+ if (SourceRegion)
+ {
+ Status = AcpiNsLookup (WalkState->ScopeInfo,
+ SourceRegion->Asl.Value.String,
+ ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
+ ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node);
+ if (Status == AE_NOT_FOUND)
+ {
+ /*
+ * If the named object is not found, it means that it is either a
+ * forward reference or the named object does not exist.
+ */
+ SourceRegion->Asl.CompileFlags |= OP_NOT_FOUND_DURING_LOAD;
+ }
+ }
+
/* Get the first named field element */
switch (Op->Asl.AmlOpcode)
@@ -493,7 +512,7 @@ LdNamespace1Begin (
case AML_FIELD_OP:
Status = LdLoadFieldElements (Op, WalkState);
- break;
+ return (Status);
case AML_INT_CONNECTION_OP:
@@ -557,8 +576,7 @@ LdNamespace1Begin (
* We only want references to named objects:
* Store (2, WXYZ) -> Attempt to resolve the name
*/
- if ((OpInfo->Class == AML_CLASS_NAMED_OBJECT) &&
- (OpInfo->Type != AML_TYPE_NAMED_FIELD))
+ if (OpInfo->Class == AML_CLASS_NAMED_OBJECT)
{
return (AE_OK);
}
diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c
index 81f634e678ff..2afb20f6903a 100644
--- a/source/compiler/aslmain.c
+++ b/source/compiler/aslmain.c
@@ -291,7 +291,8 @@ main (
/*
* At this point, compilation of a data table or disassembly is complete.
*/
- if (AslGbl_FileType == ASL_INPUT_TYPE_ASCII_DATA || AcpiGbl_DisasmFlag)
+ if (AslGbl_PreprocessOnly || AcpiGbl_DisasmFlag ||
+ AslGbl_FileType == ASL_INPUT_TYPE_ASCII_DATA)
{
goto CleanupAndExit;
}
diff --git a/source/compiler/aslmessages.c b/source/compiler/aslmessages.c
index d7e2eb43f617..cf7a7a4f47cb 100644
--- a/source/compiler/aslmessages.c
+++ b/source/compiler/aslmessages.c
@@ -283,7 +283,7 @@ const char *AslCompilerMsgs [] =
/* ASL_MSG_NO_RETVAL */ "Called method returns no value",
/* ASL_MSG_NO_WHILE */ "No enclosing While statement",
/* ASL_MSG_NON_ASCII */ "Invalid characters found in file",
-/* ASL_MSG_NON_ZERO */ "Operand evaluates to zero",
+/* ASL_MSG_BUFFER_FIELD_LENGTH */ "Field length must be non-zero",
/* ASL_MSG_NOT_EXIST */ "Object does not exist",
/* ASL_MSG_NOT_FOUND */ "Object not found or not accessible from current scope",
/* ASL_MSG_NOT_METHOD */ "Not a control method, cannot invoke",
@@ -342,7 +342,7 @@ const char *AslCompilerMsgs [] =
/* ASL_MSG_RANGE */ "Constant out of range",
/* ASL_MSG_BUFFER_ALLOCATION */ "Could not allocate line buffer",
/* ASL_MSG_MISSING_DEPENDENCY */ "Missing dependency",
-/* ASL_MSG_ILLEGAL_FORWARD_REF */ "Forward references are not supported by the ASL language",
+/* ASL_MSG_ILLEGAL_FORWARD_REF */ "Illegal forward reference",
/* ASL_MSG_ILLEGAL_METHOD_REF */ "Object is declared in a different method",
/* ASL_MSG_LOCAL_NOT_USED */ "Method Local is set but never used",
/* ASL_MSG_ARG_AS_LOCAL_NOT_USED */ "Method Argument (as a local) is set but never used",
@@ -364,7 +364,8 @@ const char *AslCompilerMsgs [] =
/* 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_UNDEFINED_EXTERNAL */ "Named object was declared external but the actual definition does not exist"
+/* ASL_MSG_UNDEFINED_EXTERNAL */ "Named object was declared external but the actual definition does not exist",
+/* ASL_MSG_BUFFER_FIELD_OVERFLOW */ "Buffer field extends beyond end of target buffer"
};
/* Table compiler */
diff --git a/source/compiler/aslmessages.h b/source/compiler/aslmessages.h
index a7cd1f314fd1..15613685d192 100644
--- a/source/compiler/aslmessages.h
+++ b/source/compiler/aslmessages.h
@@ -285,7 +285,7 @@ typedef enum
ASL_MSG_NO_RETVAL,
ASL_MSG_NO_WHILE,
ASL_MSG_NON_ASCII,
- ASL_MSG_NON_ZERO,
+ ASL_MSG_BUFFER_FIELD_LENGTH,
ASL_MSG_NOT_EXIST,
ASL_MSG_NOT_FOUND,
ASL_MSG_NOT_METHOD,
@@ -367,6 +367,7 @@ typedef enum
ASL_MSG_REGION_LENGTH,
ASL_MSG_TEMPORARY_OBJECT,
ASL_MSG_UNDEFINED_EXTERNAL,
+ ASL_MSG_BUFFER_FIELD_OVERFLOW,
/* These messages are used by the Data Table compiler only */
diff --git a/source/compiler/asloperands.c b/source/compiler/asloperands.c
index 4f4b636d5c1e..cb9c5c89971f 100644
--- a/source/compiler/asloperands.c
+++ b/source/compiler/asloperands.c
@@ -819,6 +819,7 @@ OpnDoBuffer (
BufferLengthOp->Asl.Value.Integer = BufferLength;
(void) OpcSetOptimalIntegerSize (BufferLengthOp);
+ UtSetParseOpName (BufferLengthOp);
/* Remaining nodes are handled via the tree walk */
}
@@ -905,6 +906,7 @@ OpnDoPackage (
*/
Op->Asl.Child->Asl.ParseOpcode = PARSEOP_INTEGER;
Op->Asl.Child->Asl.Value.Integer = PackageLength;
+ UtSetParseOpName (Op);
/* Set the AML opcode */
diff --git a/source/compiler/aslstartup.c b/source/compiler/aslstartup.c
index aee5ad60998c..472f777c40b3 100644
--- a/source/compiler/aslstartup.c
+++ b/source/compiler/aslstartup.c
@@ -550,14 +550,10 @@ AslDoOneFile (
Status = CmDoCompile ();
if (ACPI_FAILURE (Status))
{
+ PrTerminatePreprocessor ();
return (Status);
}
- /* Cleanup (for next source file) and exit */
-
- AeClearErrorLog ();
- PrTerminatePreprocessor ();
-
/*
* At this point, we know how many lines are in the input file. Save it
* to display for post-compilation summary.
diff --git a/source/compiler/aslutils.c b/source/compiler/aslutils.c
index 0b78f473a985..80149247e145 100644
--- a/source/compiler/aslutils.c
+++ b/source/compiler/aslutils.c
@@ -541,8 +541,14 @@ UtDisplayOneSummary (
{
UINT32 i;
ASL_GLOBAL_FILE_NODE *FileNode;
+ BOOLEAN DisplayAMLSummary;
+ DisplayAMLSummary =
+ !AslGbl_PreprocessOnly && !AslGbl_ParserErrorDetected &&
+ ((AslGbl_ExceptionCount[ASL_ERROR] == 0) || AslGbl_IgnoreErrors) &&
+ AslGbl_Files[ASL_FILE_AML_OUTPUT].Handle;
+
if (FileId != ASL_FILE_STDOUT)
{
/* Compiler name and version number */
@@ -595,9 +601,7 @@ UtDisplayOneSummary (
/* AML summary */
- if (!AslGbl_ParserErrorDetected &&
- ((AslGbl_ExceptionCount[ASL_ERROR] == 0) || AslGbl_IgnoreErrors) &&
- AslGbl_Files[ASL_FILE_AML_OUTPUT].Handle)
+ if (DisplayAMLSummary)
{
FlPrintFile (FileId,
"%-14s %s - %7u bytes %6u opcodes %6u named objects\n",
@@ -633,7 +637,7 @@ UtDisplayOneSummary (
continue;
}
- FlPrintFile (FileId, "%14s %s - %u bytes\n",
+ FlPrintFile (FileId, "%-14s %s - %7u bytes\n",
AslGbl_FileDescs[i].ShortDescription,
AslGbl_Files[i].Filename, FlGetFileSize (i));
}
diff --git a/source/compiler/aslwalks.c b/source/compiler/aslwalks.c
index f1ebd9038333..e383e7947515 100644
--- a/source/compiler/aslwalks.c
+++ b/source/compiler/aslwalks.c
@@ -165,6 +165,14 @@ static void
AnAnalyzeStoreOperator (
ACPI_PARSE_OBJECT *Op);
+static BOOLEAN
+AnIsValidBufferConstant (
+ ACPI_PARSE_OBJECT *Op);
+
+static void
+AnValidateCreateBufferField (
+ ACPI_PARSE_OBJECT *CreateBufferFieldOp);
+
/*******************************************************************************
*
@@ -669,6 +677,14 @@ AnOtherSemanticAnalysisWalkBegin (
OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
+ if (OpInfo->Flags & AML_CREATE)
+ {
+ /* This group contains all of the Create Buffer Field operators */
+
+ AnValidateCreateBufferField (Op);
+ return (AE_OK);
+ }
+
/*
* Determine if an execution class operator actually does something by
* checking if it has a target and/or the function return value is used.
@@ -734,10 +750,10 @@ AnOtherSemanticAnalysisWalkBegin (
}
}
-
/*
* Semantic checks for individual ASL operators
*/
+
switch (Op->Asl.ParseOpcode)
{
case PARSEOP_STORE:
@@ -785,22 +801,6 @@ AnOtherSemanticAnalysisWalkBegin (
}
break;
- case PARSEOP_CREATEFIELD:
- /*
- * Check for a zero Length (NumBits) operand. NumBits is the 3rd operand
- */
- ArgOp = Op->Asl.Child;
- ArgOp = ArgOp->Asl.Next;
- ArgOp = ArgOp->Asl.Next;
-
- if ((ArgOp->Asl.ParseOpcode == PARSEOP_ZERO) ||
- ((ArgOp->Asl.ParseOpcode == PARSEOP_INTEGER) &&
- (ArgOp->Asl.Value.Integer == 0)))
- {
- AslError (ASL_ERROR, ASL_MSG_NON_ZERO, ArgOp, NULL);
- }
- break;
-
case PARSEOP_CONNECTION:
/*
* Ensure that the referenced operation region has the correct SPACE_ID.
@@ -888,6 +888,194 @@ AnOtherSemanticAnalysisWalkBegin (
/*******************************************************************************
*
+ * FUNCTION: AnValidateCreateBufferField
+ *
+ * PARAMETERS: Op - A create buffer field operator
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Check if a buffer index argument to a create buffer field
+ * operation is beyond the end of the target buffer.
+ *
+ * Validates these AML operators:
+ *
+ * AML_CREATE_FIELD_OP
+ * AML_CREATE_BIT_FIELD_OP
+ * AML_CREATE_BYTE_FIELD_OP
+ * AML_CREATE_WORD_FIELD_OP
+ * AML_CREATE_DWORD_FIELD_OP
+ * AML_CREATE_QWORD_FIELD_OP
+ *
+ * There are two conditions that must be satisfied in order to enable
+ * validation at compile time:
+ *
+ * 1) The length of the target buffer must be an integer constant
+ * 2) The index specified in the create* must be an integer constant
+ * 3) For CreateField, the bit length argument must be non-zero.
+ *
+ ******************************************************************************/
+
+static void
+AnValidateCreateBufferField (
+ ACPI_PARSE_OBJECT *CreateBufferFieldOp)
+{
+ ACPI_PARSE_OBJECT *TargetBufferOp;
+ ACPI_PARSE_OBJECT *ArgOp;
+ UINT32 TargetBufferLength;
+ UINT32 LastFieldByteIndex;
+
+
+ /*
+ * 1) Get the length of the target buffer
+ */
+ ArgOp = CreateBufferFieldOp->Asl.Child; /* Reference to target buffer */
+
+ /*
+ * If no attached Node, the target buffer may be something like an
+ * ArgX or LocalX and cannot be evaluated at compile time.
+ */
+ if (!ArgOp->Asl.Node)
+ {
+ return;
+ }
+
+ TargetBufferOp = ArgOp->Asl.Node->Op;
+ TargetBufferOp = TargetBufferOp->Asl.Child; /* Target buffer */
+ TargetBufferOp = TargetBufferOp->Asl.Next; /* "Buffer" keyword */
+ if (!TargetBufferOp)
+ {
+ /* Not a statement of the form NAME(XXXX, Buffer.... */
+
+ return;
+ }
+
+ /* Get the buffer length argument. It must be an integer constant */
+
+ ArgOp = TargetBufferOp->Asl.Child;
+ if (!AnIsValidBufferConstant (ArgOp))
+ {
+ return;
+ }
+
+ TargetBufferLength = (UINT32) ArgOp->Asl.Value.Integer;
+
+ /*
+ * 2) Get the value of the buffer index argument. It must be
+ * an integer constant.
+ */
+ ArgOp = CreateBufferFieldOp->Asl.Child; /* Reference to target buffer */
+ ArgOp = ArgOp->Asl.Next; /* Buffer Index argument*/
+ if (!AnIsValidBufferConstant (ArgOp))
+ {
+ return;
+ }
+
+ LastFieldByteIndex =
+ (UINT32) ArgOp->Asl.Value.Integer; /* Index can be in either bytes or bits */
+
+ /*
+ * 3) Get the length of the new buffer field, in bytes. Also,
+ * create the final target buffer index for the last byte of the field
+ */
+ switch (CreateBufferFieldOp->Asl.ParseOpcode)
+ {
+ case PARSEOP_CREATEBITFIELD: /* A one bit field */
+
+ LastFieldByteIndex = ACPI_ROUND_BITS_DOWN_TO_BYTES (LastFieldByteIndex);
+ break;
+
+ case PARSEOP_CREATEBYTEFIELD:
+ break;
+
+ case PARSEOP_CREATEWORDFIELD:
+
+ LastFieldByteIndex += (sizeof (UINT16) - 1);
+ break;
+
+ case PARSEOP_CREATEDWORDFIELD:
+
+ LastFieldByteIndex += (sizeof (UINT32) - 1);
+ break;
+
+ case PARSEOP_CREATEQWORDFIELD:
+
+ LastFieldByteIndex += (sizeof (UINT64) - 1);
+ break;
+
+ case PARSEOP_CREATEFIELD: /* Multi-bit field */
+
+ ArgOp = ArgOp->Asl.Next; /* Length argument, in bits */
+ if (!AnIsValidBufferConstant (ArgOp))
+ {
+ return;
+ }
+
+ /* The buffer field length is not allowed to be zero */
+
+ if (ArgOp->Asl.Value.Integer == 0)
+ {
+ AslError (ASL_WARNING, ASL_MSG_BUFFER_FIELD_LENGTH, ArgOp, NULL);
+ return;
+ }
+
+ LastFieldByteIndex +=
+ ((UINT32) ArgOp->Asl.Value.Integer - 1); /* Create final bit index */
+
+ /* Convert bit index to a byte index */
+
+ LastFieldByteIndex = ACPI_ROUND_BITS_DOWN_TO_BYTES (LastFieldByteIndex);
+ break;
+
+ default:
+ return;
+ }
+
+ /*
+ * 4) Check for an access (index) beyond the end of the target buffer,
+ * or a zero length target buffer.
+ */
+ if (!TargetBufferLength || (LastFieldByteIndex >= TargetBufferLength))
+ {
+ AslError (ASL_WARNING, ASL_MSG_BUFFER_FIELD_OVERFLOW, ArgOp, NULL);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnIsValidBufferConstant
+ *
+ * PARAMETERS: Op - A buffer-related operand
+ *
+ * RETURN: TRUE if operand is valid constant, FALSE otherwise
+ *
+ * DESCRIPTION: Check if the input Op is valid constant that can be used
+ * in compile-time analysis.
+ *
+ ******************************************************************************/
+
+static BOOLEAN
+AnIsValidBufferConstant (
+ ACPI_PARSE_OBJECT *Op)
+{
+ if (!Op)
+ {
+ return (FALSE);
+ }
+
+ if ((Op->Asl.ParseOpcode == PARSEOP_INTEGER) ||
+ (Op->Asl.ParseOpcode == PARSEOP_ZERO) ||
+ (Op->Asl.ParseOpcode == PARSEOP_ONE))
+ {
+ return (TRUE);
+ }
+
+ return (FALSE);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AnAnalyzeStoreOperator
*
* PARAMETERS: Op - Store() operator
diff --git a/source/compiler/aslxref.c b/source/compiler/aslxref.c
index 9d6e5c0bc68a..d903ef1ba876 100644
--- a/source/compiler/aslxref.c
+++ b/source/compiler/aslxref.c
@@ -460,6 +460,8 @@ XfNamespaceLocateBegin (
ASL_METHOD_LOCAL *MethodArgs = NULL;
int RegisterNumber;
UINT32 i;
+ ACPI_NAMESPACE_NODE *DeclarationParentMethod;
+ ACPI_PARSE_OBJECT *ReferenceParentMethod;
ACPI_FUNCTION_TRACE_PTR (XfNamespaceLocateBegin, Op);
@@ -613,8 +615,7 @@ XfNamespaceLocateBegin (
(Op->Asl.ParseOpcode != PARSEOP_NAMESTRING) &&
(Op->Asl.ParseOpcode != PARSEOP_NAMESEG) &&
(Op->Asl.ParseOpcode != PARSEOP_METHODCALL) &&
- (Op->Asl.ParseOpcode != PARSEOP_EXTERNAL) &&
- (OpInfo->Type != AML_TYPE_NAMED_FIELD))
+ (Op->Asl.ParseOpcode != PARSEOP_EXTERNAL))
{
return_ACPI_STATUS (AE_OK);
}
@@ -638,8 +639,7 @@ XfNamespaceLocateBegin (
if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) ||
(Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
(Op->Asl.ParseOpcode == PARSEOP_METHODCALL) ||
- (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) ||
- (OpInfo->Type == AML_TYPE_NAMED_FIELD))
+ (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL))
{
/*
* These are name references, do not push the scope stack
@@ -676,10 +676,6 @@ XfNamespaceLocateBegin (
Path = NextOp->Asl.Value.String;
}
- else if (OpInfo->Type == AML_TYPE_NAMED_FIELD)
- {
- Path = Op->Asl.Child->Asl.Value.String;
- }
else
{
Path = Op->Asl.Value.String;
@@ -798,24 +794,45 @@ XfNamespaceLocateBegin (
return_ACPI_STATUS (Status);
}
- /* Object was found above, check for an illegal forward reference */
+ /* Object was found above, check for an illegal forward reference */
if (Op->Asl.CompileFlags & OP_NOT_FOUND_DURING_LOAD)
{
/*
* During the load phase, this Op was flagged as a possible
- * illegal forward reference
+ * illegal forward reference. In other words, Op is a name path or
+ * name segment that refers to a named object declared after the
+ * reference. In this scinario, Node refers to the actual declaration
+ * and Op is a parse node that references the named object.
*
- * Note: Allow "forward references" from within a method to an
- * object that is not within any method (module-level code)
+ * Note:
+ *
+ * Object references inside of control methods are allowed to
+ * refer to objects declared outside of control methods.
+ *
+ * If the declaration and reference are both contained inside of the
+ * same method or outside of any method, this is a forward reference
+ * and should be reported as a compiler error.
*/
- if (!WalkState->ScopeInfo || (UtGetParentMethod (Node) &&
- !UtNodeIsDescendantOf (WalkState->ScopeInfo->Scope.Node,
- UtGetParentMethod (Node))))
+ DeclarationParentMethod = UtGetParentMethod (Node);
+ ReferenceParentMethod = XfGetParentMethod (Op);
+
+ /* case 1: declaration and refrence are both outside of method */
+
+ if (!ReferenceParentMethod && !DeclarationParentMethod)
{
AslError (ASL_ERROR, ASL_MSG_ILLEGAL_FORWARD_REF, Op,
Op->Asl.ExternalName);
}
+
+ /* case 2: declaration and reference are both inside of the same method */
+
+ else if (ReferenceParentMethod && DeclarationParentMethod &&
+ ReferenceParentMethod == DeclarationParentMethod->Op)
+ {
+ AslError (ASL_ERROR, ASL_MSG_ILLEGAL_FORWARD_REF, Op,
+ Op->Asl.ExternalName);
+ }
}
/* Check for a reference vs. name declaration */
diff --git a/source/components/events/evgpe.c b/source/components/events/evgpe.c
index 7534f6d75025..f5ea992a270b 100644
--- a/source/components/events/evgpe.c
+++ b/source/components/events/evgpe.c
@@ -240,14 +240,6 @@ 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/include/acpixf.h b/source/include/acpixf.h
index be338bbe75d9..8778da7241b0 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 0x20190405
+#define ACPI_CA_VERSION 0x20190509
#include "acconfig.h"
#include "actypes.h"
diff --git a/source/include/platform/aclinux.h b/source/include/platform/aclinux.h
index f6522e326275..e6d57e3162af 100644
--- a/source/include/platform/aclinux.h
+++ b/source/include/platform/aclinux.h
@@ -205,6 +205,11 @@
#define ACPI_INIT_FUNCTION __init
+/* Use a specific bugging default separate from ACPICA */
+
+#undef ACPI_DEBUG_DEFAULT
+#define ACPI_DEBUG_DEFAULT (ACPI_LV_INFO | ACPI_LV_REPAIR)
+
#ifndef CONFIG_ACPI
/* External globals for __KERNEL__, stubs is needed */
@@ -221,11 +226,6 @@
#define ACPI_NO_ERROR_MESSAGES
#undef ACPI_DEBUG_OUTPUT
-/* Use a specific bugging default separate from ACPICA */
-
-#undef ACPI_DEBUG_DEFAULT
-#define ACPI_DEBUG_DEFAULT (ACPI_LV_INFO | ACPI_LV_REPAIR)
-
/* External interface for __KERNEL__, stub is needed */
#define ACPI_EXTERNAL_RETURN_STATUS(Prototype) \