summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/compiler/aslload.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/compiler/aslload.c')
-rw-r--r--sys/contrib/dev/acpica/compiler/aslload.c119
1 files changed, 88 insertions, 31 deletions
diff --git a/sys/contrib/dev/acpica/compiler/aslload.c b/sys/contrib/dev/acpica/compiler/aslload.c
index c8ae3ad..f14e01d 100644
--- a/sys/contrib/dev/acpica/compiler/aslload.c
+++ b/sys/contrib/dev/acpica/compiler/aslload.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2015, Intel Corp.
+ * Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -104,8 +104,6 @@ LdLoadNamespace (
ACPI_WALK_STATE *WalkState;
- DbgPrint (ASL_DEBUG_OUTPUT, "\nCreating namespace\n\n");
-
/* Create a new walk state */
WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
@@ -196,12 +194,11 @@ LdLoadFieldElements (
default:
Status = AcpiNsLookup (WalkState->ScopeInfo,
- Child->Asl.Value.String,
- ACPI_TYPE_LOCAL_REGION_FIELD,
- ACPI_IMODE_LOAD_PASS1,
- ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
- ACPI_NS_ERROR_IF_FOUND,
- NULL, &Node);
+ Child->Asl.Value.String,
+ ACPI_TYPE_LOCAL_REGION_FIELD,
+ ACPI_IMODE_LOAD_PASS1,
+ ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
+ ACPI_NS_ERROR_IF_FOUND, NULL, &Node);
if (ACPI_FAILURE (Status))
{
if (Status != AE_ALREADY_EXISTS)
@@ -266,9 +263,9 @@ LdLoadResourceElements (
* This opens a scope, so later field names are guaranteed to be new/unique.
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Asl.Namepath,
- ACPI_TYPE_LOCAL_RESOURCE, ACPI_IMODE_LOAD_PASS1,
- ACPI_NS_NO_UPSEARCH | ACPI_NS_ERROR_IF_FOUND,
- WalkState, &Node);
+ ACPI_TYPE_LOCAL_RESOURCE, ACPI_IMODE_LOAD_PASS1,
+ ACPI_NS_NO_UPSEARCH | ACPI_NS_ERROR_IF_FOUND,
+ WalkState, &Node);
if (ACPI_FAILURE (Status))
{
if (Status == AE_ALREADY_EXISTS)
@@ -296,11 +293,11 @@ LdLoadResourceElements (
if (InitializerOp->Asl.ExternalName)
{
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);
+ InitializerOp->Asl.ExternalName,
+ 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);
@@ -344,6 +341,7 @@ LdNamespace1Begin (
{
ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context;
ACPI_NAMESPACE_NODE *Node;
+ ACPI_PARSE_OBJECT *MethodOp;
ACPI_STATUS Status;
ACPI_OBJECT_TYPE ObjectType;
ACPI_OBJECT_TYPE ActualObjectType = ACPI_TYPE_ANY;
@@ -500,8 +498,8 @@ 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)
@@ -509,9 +507,9 @@ 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);
@@ -534,6 +532,35 @@ LdNamespace1Begin (
return_ACPI_STATUS (Status);
}
+ else /* Status AE_OK */
+ {
+ /*
+ * Do not allow references to external scopes from the DSDT.
+ * This is because the DSDT is always loaded first, and the
+ * external reference cannot be resolved -- causing a runtime
+ * error because Scope() must be resolved immediately.
+ * 10/2015.
+ */
+ if ((Node->Flags & ANOBJ_IS_EXTERNAL) &&
+ (ACPI_COMPARE_NAME (Gbl_TableSignature, "DSDT")))
+ {
+ /* However, allowed if the reference is within a method */
+
+ MethodOp = Op->Asl.Parent;
+ while (MethodOp &&
+ (MethodOp->Asl.ParseOpcode != PARSEOP_METHOD))
+ {
+ MethodOp = MethodOp->Asl.Parent;
+ }
+
+ if (!MethodOp)
+ {
+ /* Not in a control method, error */
+
+ AslError (ASL_ERROR, ASL_MSG_CROSS_TABLE_SCOPE, Op, NULL);
+ }
+ }
+ }
/* We found a node with this name, now check the type */
@@ -569,7 +596,7 @@ LdNamespace1Begin (
Node->Type = ACPI_TYPE_LOCAL_SCOPE;
Status = AcpiDsScopeStackPush (Node, ACPI_TYPE_LOCAL_SCOPE,
- WalkState);
+ WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -591,7 +618,7 @@ LdNamespace1Begin (
*/
Node->Type = ACPI_TYPE_LOCAL_SCOPE;
Status = AcpiDsScopeStackPush (Node, ACPI_TYPE_LOCAL_SCOPE,
- WalkState);
+ WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -611,7 +638,7 @@ LdNamespace1Begin (
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Loading name: %s, (%s)\n",
- Op->Asl.ExternalName, AcpiUtGetTypeName (ObjectType)));
+ Op->Asl.ExternalName, AcpiUtGetTypeName (ObjectType)));
/* The name must not already exist */
@@ -624,7 +651,7 @@ LdNamespace1Begin (
* parse tree later.
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
- ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node);
+ ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node);
if (ACPI_FAILURE (Status))
{
if (Status == AE_ALREADY_EXISTS)
@@ -658,8 +685,38 @@ LdNamespace1Begin (
return_ACPI_STATUS (Status);
}
}
+
+ Status = AE_OK;
+ }
+ else if (!(Node->Flags & ANOBJ_IS_EXTERNAL) &&
+ (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL))
+ {
+ /*
+ * Allow externals in same scope as the definition of the
+ * actual object. Similar to C. Allows multiple definition
+ * blocks that refer to each other in the same file.
+ */
Status = AE_OK;
}
+ else if ((Node->Flags & ANOBJ_IS_EXTERNAL) &&
+ (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) &&
+ (ObjectType == ACPI_TYPE_ANY))
+ {
+ /* Allow update of externals of unknown type. */
+
+ if (AcpiNsOpensScope (ActualObjectType))
+ {
+ Node->Type = (UINT8) ActualObjectType;
+ Status = AE_OK;
+ }
+ else
+ {
+ sprintf (MsgBuffer, "%s [%s]", Op->Asl.ExternalName,
+ AcpiUtGetTypeName (Node->Type));
+ AslError (ASL_ERROR, ASL_MSG_SCOPE_TYPE, Op, MsgBuffer);
+ return_ACPI_STATUS (AE_OK);
+ }
+ }
else
{
/* Valid error, object already exists */
@@ -818,8 +875,8 @@ LdNamespace2Begin (
/* Get the NS node associated with the target. It must exist. */
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,
- ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
- WalkState, &TargetNode);
+ ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
+ WalkState, &TargetNode);
if (ACPI_FAILURE (Status))
{
if (Status == AE_NOT_FOUND)
@@ -832,9 +889,9 @@ LdNamespace2Begin (
* This prevents more errors later.
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, Path,
- ACPI_TYPE_ANY,
- ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH,
- WalkState, &(Node));
+ ACPI_TYPE_ANY,
+ ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH,
+ WalkState, &(Node));
return (AE_OK);
}
OpenPOWER on IntegriCloud