summaryrefslogtreecommitdiff
path: root/source/compiler/aslload.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/compiler/aslload.c')
-rw-r--r--source/compiler/aslload.c97
1 files changed, 68 insertions, 29 deletions
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,