aboutsummaryrefslogtreecommitdiff
path: root/source/compiler
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2018-11-01 02:09:52 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2018-11-01 02:09:52 +0000
commit4d4b15a0e8524e15826ac932bd05252dbd246422 (patch)
tree2733e92ee403325b88fed63fcb339890232290af /source/compiler
parent98117aa0347721c1b33897e435818da3673040ca (diff)
downloadsrc-4d4b15a0e8524e15826ac932bd05252dbd246422.tar.gz
src-4d4b15a0e8524e15826ac932bd05252dbd246422.zip
Import ACPICA 20181031.vendor/acpica/20181031
Notes
Notes: svn path=/vendor-sys/acpica/dist/; revision=339981 svn path=/vendor-sys/acpica/20181031/; revision=339982; tag=vendor/acpica/20181031
Diffstat (limited to 'source/compiler')
-rw-r--r--source/compiler/aslcompile.c2
-rw-r--r--source/compiler/aslerror.c4
-rw-r--r--source/compiler/aslload.c97
-rw-r--r--source/compiler/aslmain.c2
-rw-r--r--source/compiler/aslmessages.c6
-rw-r--r--source/compiler/aslmessages.h2
-rw-r--r--source/compiler/aslpredef.c2
-rw-r--r--source/compiler/aslxref.c46
-rw-r--r--source/compiler/dtio.c28
-rw-r--r--source/compiler/dttable2.c66
-rw-r--r--source/compiler/prscan.c1
11 files changed, 210 insertions, 46 deletions
diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c
index e08442e06867..4ae190763cc9 100644
--- a/source/compiler/aslcompile.c
+++ b/source/compiler/aslcompile.c
@@ -858,7 +858,7 @@ CmCleanupAndExit (
if (AslGbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT)
{
- printf ("\nMaximum error count (%u) exceeded\n",
+ printf ("\nMaximum error count (%d) exceeded\n",
ASL_MAX_ERROR_COUNT);
}
diff --git a/source/compiler/aslerror.c b/source/compiler/aslerror.c
index 6d45cd400351..10ea3ec1b4bd 100644
--- a/source/compiler/aslerror.c
+++ b/source/compiler/aslerror.c
@@ -1097,7 +1097,7 @@ AslExpectException (
if (AslGbl_ExpectedMessagesIndex >= ASL_MAX_EXPECTED_MESSAGES)
{
- printf ("Too many messages have been registered as expected (max %u)\n",
+ printf ("Too many messages have been registered as expected (max %d)\n",
ASL_MAX_DISABLED_MESSAGES);
return (AE_LIMIT);
}
@@ -1144,7 +1144,7 @@ AslDisableException (
if (AslGbl_DisabledMessagesIndex >= ASL_MAX_DISABLED_MESSAGES)
{
- printf ("Too many messages have been disabled (max %u)\n",
+ printf ("Too many messages have been disabled (max %d)\n",
ASL_MAX_DISABLED_MESSAGES);
return (AE_LIMIT);
}
diff --git a/source/compiler/aslload.c b/source/compiler/aslload.c
index 5bb0a8515566..7f29b90c6366 100644
--- a/source/compiler/aslload.c
+++ b/source/compiler/aslload.c
@@ -417,10 +417,8 @@ LdLoadResourceElements (
{
Status = AcpiNsLookup (WalkState->ScopeInfo,
InitializerOp->Asl.ExternalName,
- ACPI_TYPE_LOCAL_RESOURCE_FIELD,
- ACPI_IMODE_LOAD_PASS1,
- ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE,
- NULL, &Node);
+ ACPI_TYPE_LOCAL_RESOURCE_FIELD, ACPI_IMODE_LOAD_PASS1,
+ ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node);
if (ACPI_FAILURE (Status))
{
return (Status);
@@ -687,8 +685,7 @@ LdNamespace1Begin (
* handle this case. Perhaps someday this case can go away.
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,
- ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
- WalkState, &(Node));
+ ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &Node);
if (ACPI_FAILURE (Status))
{
if (Status == AE_NOT_FOUND)
@@ -696,23 +693,26 @@ LdNamespace1Begin (
/* The name was not found, go ahead and create it */
Status = AcpiNsLookup (WalkState->ScopeInfo, Path,
- ACPI_TYPE_LOCAL_SCOPE,
- ACPI_IMODE_LOAD_PASS1, Flags,
- WalkState, &(Node));
+ ACPI_TYPE_LOCAL_SCOPE, ACPI_IMODE_LOAD_PASS1,
+ Flags, WalkState, &Node);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
- /*
- * However, this is an error -- primarily because the MS
- * interpreter can't handle a forward reference from the
- * Scope() operator.
- */
- AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op,
- Op->Asl.ExternalName);
- AslError (ASL_ERROR, ASL_MSG_SCOPE_FWD_REF, Op,
- Op->Asl.ExternalName);
+ /* However, this is an error -- operand to Scope must exist */
+
+ if (strlen (Op->Asl.ExternalName) == ACPI_NAME_SIZE)
+ {
+ AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op,
+ Op->Asl.ExternalName);
+ }
+ else
+ {
+ AslError (ASL_ERROR, ASL_MSG_NAMEPATH_NOT_EXIST, Op,
+ Op->Asl.ExternalName);
+ }
+
goto FinishNode;
}
@@ -824,7 +824,6 @@ LdNamespace1Begin (
break;
}
-
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Loading name: %s, (%s)\n",
Op->Asl.ExternalName, AcpiUtGetTypeName (ObjectType)));
@@ -833,6 +832,18 @@ LdNamespace1Begin (
Flags |= ACPI_NS_ERROR_IF_FOUND;
/*
+ * For opcodes that enter new names into the namespace,
+ * all prefix NameSegs must exist.
+ */
+ WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
+ if (((WalkState->OpInfo->Flags & AML_NAMED) ||
+ (WalkState->OpInfo->Flags & AML_CREATE)) &&
+ (Op->Asl.AmlOpcode != AML_EXTERNAL_OP))
+ {
+ Flags |= ACPI_NS_PREFIX_MUST_EXIST;
+ }
+
+ /*
* Enter the named type into the internal namespace. We enter the name
* as we go downward in the parse tree. Any necessary subobjects that
* involve arguments to the opcode must be created as we go back up the
@@ -915,8 +926,20 @@ LdNamespace1Begin (
return_ACPI_STATUS (AE_OK);
}
}
+ else if (AE_NOT_FOUND)
+ {
+ /*
+ * One or more prefix NameSegs of the NamePath do not exist
+ * (all of them must exist). Attempt to continue compilation
+ * by setting the current scope to the root.
+ */
+ Node = AcpiGbl_RootNode;
+ Status = AE_OK;
+ }
else
{
+ /* Flag all other errors as coming from the ACPICA core */
+
AslCoreSubsystemError (Op, Status,
"Failure from namespace lookup", FALSE);
return_ACPI_STATUS (Status);
@@ -1043,10 +1066,10 @@ LdNamespace2Begin (
if (Op->Asl.ParseOpcode == PARSEOP_ALIAS)
{
- /* Complete the alias node by getting and saving the target node */
-
- /* First child is the alias target */
-
+ /*
+ * Complete the alias node by getting and saving the target node.
+ * First child is the alias target
+ */
Arg = Op->Asl.Child;
/* Get the target pathname */
@@ -1070,18 +1093,34 @@ LdNamespace2Begin (
{
if (Status == AE_NOT_FOUND)
{
- AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op,
- Op->Asl.ExternalName);
+ /* Standalone NameSeg vs. NamePath */
+
+ if (strlen (Arg->Asl.ExternalName) == ACPI_NAME_SIZE)
+ {
+ AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op,
+ Arg->Asl.ExternalName);
+ }
+ else
+ {
+ AslError (ASL_ERROR, ASL_MSG_NAMEPATH_NOT_EXIST, Op,
+ Arg->Asl.ExternalName);
+ }
+#if 0
+/*
+ * NOTE: Removed 10/2018 to enhance compiler error reporting. No
+ * regressions seen.
+ */
/*
* The name was not found, go ahead and create it.
* This prevents more errors later.
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, Path,
- ACPI_TYPE_ANY,
- ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH,
- WalkState, &(Node));
- return (AE_OK);
+ ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS1,
+ ACPI_NS_NO_UPSEARCH, WalkState, &Node);
+#endif
+ return (Status);
+/* Removed: return (AE_OK)*/
}
AslCoreSubsystemError (Op, Status,
diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c
index 4f24bb3e9329..70386f8a0c22 100644
--- a/source/compiler/aslmain.c
+++ b/source/compiler/aslmain.c
@@ -329,7 +329,7 @@ AslSignalHandler (
default:
- printf (ASL_PREFIX "Unknown interrupt signal (%u)\n", Sig);
+ printf (ASL_PREFIX "Unknown interrupt signal (%d)\n", Sig);
break;
}
diff --git a/source/compiler/aslmessages.c b/source/compiler/aslmessages.c
index 14e140b2f1ba..23297183709d 100644
--- a/source/compiler/aslmessages.c
+++ b/source/compiler/aslmessages.c
@@ -285,7 +285,7 @@ const char *AslCompilerMsgs [] =
/* ASL_MSG_NON_ASCII */ "Invalid characters found in file",
/* ASL_MSG_NON_ZERO */ "Operand evaluates to zero",
/* ASL_MSG_NOT_EXIST */ "Object does not exist",
-/* ASL_MSG_NOT_FOUND */ "Object not found or not accessible from scope",
+/* ASL_MSG_NOT_FOUND */ "Object not found or not accessible from current scope",
/* ASL_MSG_NOT_METHOD */ "Not a control method, cannot invoke",
/* ASL_MSG_NOT_PARAMETER */ "Not a parameter, used as local only",
/* ASL_MSG_NOT_REACHABLE */ "Object is not accessible from this scope",
@@ -359,7 +359,9 @@ const char *AslCompilerMsgs [] =
/* ASL_MSG_OEM_ID */ "Invalid OEM ID",
/* ASL_MSG_UNLOAD */ "Unload is not supported by all operating systems",
/* ASL_MSG_OFFSET */ "Unnecessary/redundant use of Offset operator",
-/* ASL_MSG_LONG_SLEEP */ "Very long Sleep, greater than 1 second"
+/* ASL_MSG_LONG_SLEEP */ "Very long Sleep, greater than 1 second",
+/* 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"
};
/* Table compiler */
diff --git a/source/compiler/aslmessages.h b/source/compiler/aslmessages.h
index 907744a23a57..c932aded425a 100644
--- a/source/compiler/aslmessages.h
+++ b/source/compiler/aslmessages.h
@@ -362,6 +362,8 @@ typedef enum
ASL_MSG_UNLOAD,
ASL_MSG_OFFSET,
ASL_MSG_LONG_SLEEP,
+ ASL_MSG_PREFIX_NOT_EXIST,
+ ASL_MSG_NAMEPATH_NOT_EXIST,
/* These messages are used by the Data Table compiler only */
diff --git a/source/compiler/aslpredef.c b/source/compiler/aslpredef.c
index bc30fe9108cb..ae806412e1e3 100644
--- a/source/compiler/aslpredef.c
+++ b/source/compiler/aslpredef.c
@@ -222,7 +222,7 @@ ApCheckForPredefinedMethod (
if (MethodInfo->NumArguments != 0)
{
- sprintf (AslGbl_MsgBuffer, "%s requires %u", Op->Asl.ExternalName, 0);
+ sprintf (AslGbl_MsgBuffer, "%s requires %d", Op->Asl.ExternalName, 0);
AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op,
AslGbl_MsgBuffer);
diff --git a/source/compiler/aslxref.c b/source/compiler/aslxref.c
index 5273ea82e032..8b2135778e3a 100644
--- a/source/compiler/aslxref.c
+++ b/source/compiler/aslxref.c
@@ -718,11 +718,34 @@ XfNamespaceLocateBegin (
}
else
{
- /* Check for a fully qualified path */
+ /* The NamePath contains multiple NameSegs */
- if (Path[0] == AML_ROOT_PREFIX)
+ if ((OpInfo->Flags & AML_CREATE) ||
+ (OpInfo->ObjectType == ACPI_TYPE_LOCAL_ALIAS))
{
- /* Gave full path, the object does not exist */
+ /*
+ * The new name is the last parameter. For the
+ * CreateXXXXField and Alias operators
+ */
+ NextOp = Op->Asl.Child;
+ while (!(NextOp->Asl.CompileFlags & OP_IS_NAME_DECLARATION))
+ {
+ NextOp = NextOp->Asl.Next;
+ }
+
+ AslError (ASL_ERROR, ASL_MSG_PREFIX_NOT_EXIST, NextOp,
+ NextOp->Asl.ExternalName);
+ }
+ else if (OpInfo->Flags & AML_NAMED)
+ {
+ /* The new name is the first parameter */
+
+ AslError (ASL_ERROR, ASL_MSG_PREFIX_NOT_EXIST, Op,
+ Op->Asl.ExternalName);
+ }
+ else if (Path[0] == AML_ROOT_PREFIX)
+ {
+ /* Full namepath from root, the object does not exist */
AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op,
Op->Asl.ExternalName);
@@ -730,11 +753,20 @@ XfNamespaceLocateBegin (
else
{
/*
- * We can't tell whether it doesn't exist or just
- * can't be reached.
+ * Generic "not found" error. Cannot determine whether it
+ * doesn't exist or just can't be reached. However, we
+ * can differentiate between a NameSeg vs. NamePath.
*/
- AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op,
- Op->Asl.ExternalName);
+ if (strlen (Op->Asl.ExternalName) == ACPI_NAME_SIZE)
+ {
+ AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op,
+ Op->Asl.ExternalName);
+ }
+ else
+ {
+ AslError (ASL_ERROR, ASL_MSG_NAMEPATH_NOT_EXIST, Op,
+ Op->Asl.ExternalName);
+ }
}
}
diff --git a/source/compiler/dtio.c b/source/compiler/dtio.c
index b15d3b97f407..bd1890534506 100644
--- a/source/compiler/dtio.c
+++ b/source/compiler/dtio.c
@@ -236,7 +236,7 @@ DtTrim (
/* Skip lines that start with a space */
- if (!strcmp (String, " "))
+ if (*String == 0 || !strcmp (String, " "))
{
ReturnString = UtLocalCacheCalloc (1);
return (ReturnString);
@@ -258,7 +258,7 @@ DtTrim (
while (End >= Start)
{
- if (*End == '\r' || *End == '\n')
+ if (*End == '\n')
{
End--;
continue;
@@ -522,6 +522,7 @@ DtGetNextLine (
UINT32 CurrentLineOffset;
UINT32 i;
int c;
+ int c1;
memset (AslGbl_CurrentLineBuffer, 0, AslGbl_LineBufferSize);
@@ -569,6 +570,29 @@ DtGetNextLine (
c = '\n';
State = DT_NORMAL_TEXT;
}
+ else if (c == '\r')
+ {
+ c1 = getc (Handle);
+ if (c1 == '\n')
+ {
+ /*
+ * Skip the carriage return as if it didn't exist. This is
+ * onlt meant for input files in DOS format in unix. fopen in
+ * unix may not support "text mode" and leaves CRLF intact.
+ */
+ c = '\n';
+ }
+ else
+ {
+ /* This was not a CRLF. Only a CR */
+
+ ungetc(c1, Handle);
+
+ DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL,
+ "Carriage return without linefeed detected");
+ return (ASL_EOF);
+ }
+ }
switch (State)
{
diff --git a/source/compiler/dttable2.c b/source/compiler/dttable2.c
index 3f97037763f3..0b196a2fed33 100644
--- a/source/compiler/dttable2.c
+++ b/source/compiler/dttable2.c
@@ -1878,6 +1878,62 @@ DtCompileTcpa (
/******************************************************************************
*
+ * FUNCTION: DtCompileTpm2Rev3
+ *
+ * PARAMETERS: PFieldList - Current field list pointer
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Compile TPM2 revision 3
+ *
+ *****************************************************************************/
+static ACPI_STATUS
+DtCompileTpm2Rev3 (
+ void **List)
+{
+ DT_FIELD **PFieldList = (DT_FIELD **) List;
+ DT_SUBTABLE *Subtable;
+ ACPI_TABLE_TPM23 *Tpm23Header;
+ DT_SUBTABLE *ParentTable;
+ ACPI_STATUS Status = AE_OK;
+
+
+ Status = DtCompileTable (PFieldList, AcpiDmTableInfoTpm23,
+ &Subtable);
+
+ ParentTable = DtPeekSubtable ();
+ DtInsertSubtable (ParentTable, Subtable);
+ Tpm23Header = ACPI_CAST_PTR (ACPI_TABLE_TPM23, ParentTable->Buffer);
+
+ /* Subtable type depends on the StartMethod */
+
+ switch (Tpm23Header->StartMethod)
+ {
+ case ACPI_TPM23_ACPI_START_METHOD:
+
+ /* Subtable specific to to ARM_SMC */
+
+ Status = DtCompileTable (PFieldList, AcpiDmTableInfoTpm23a,
+ &Subtable);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ ParentTable = DtPeekSubtable ();
+ DtInsertSubtable (ParentTable, Subtable);
+ break;
+
+ default:
+ break;
+ }
+
+ return (Status);
+}
+
+
+/******************************************************************************
+ *
* FUNCTION: DtCompileTpm2
*
* PARAMETERS: PFieldList - Current field list pointer
@@ -1897,8 +1953,18 @@ DtCompileTpm2 (
ACPI_TABLE_TPM2 *Tpm2Header;
DT_SUBTABLE *ParentTable;
ACPI_STATUS Status = AE_OK;
+ ACPI_TABLE_HEADER *Header;
+ ParentTable = DtPeekSubtable ();
+
+ Header = ACPI_CAST_PTR (ACPI_TABLE_HEADER, ParentTable->Buffer);
+
+ if (Header->Revision == 3)
+ {
+ return (DtCompileTpm2Rev3 (List));
+ }
+
/* Compile the main table */
Status = DtCompileTable (PFieldList, AcpiDmTableInfoTpm2,
diff --git a/source/compiler/prscan.c b/source/compiler/prscan.c
index 580b47f0a13f..325569ed42c8 100644
--- a/source/compiler/prscan.c
+++ b/source/compiler/prscan.c
@@ -1259,7 +1259,6 @@ PrPopDirective (
AslGbl_DirectiveInfo[Info->Directive].Name,
Info->Argument, AslGbl_IgnoringThisCodeBlock ? "TRUE" : "FALSE");
- ACPI_FREE (Info);
return (AE_OK);
}