| author | rmoore1 <rmoore1> | 2007-09-25 20:31:26 (GMT) |
|---|---|---|
| committer | rmoore1 <rmoore1> | 2007-09-25 20:31:26 (GMT) |
| commit | 1e8f03866122dc06146879c9d4d4ad8bb408b60e (patch) | |
| tree | 3713993f60399a8bfe011478f7d884cc2257b454 | |
| parent | d14753d20af4c8c48e04a40ead096d8bb1ccd12a (diff) | |
| download | acpica-1e8f03866122dc06146879c9d4d4ad8bb408b60e.zip acpica-1e8f03866122dc06146879c9d4d4ad8bb408b60e.tar.gz acpica-1e8f03866122dc06146879c9d4d4ad8bb408b60e.tar.bz2 | |
Fix for Alias operator to see target child objects.
Fixed a problem with the Alias operator when the target of the alias is a named ASL operator that opens a new scope -- Scope, Device, PowerResource, Processor, and ThermalZone. In these cases, any children of the original operator could not be accessed via the alias, potentially causing unexpected AE_NOT_FOUND exceptions.
| -rw-r--r-- | source/components/debugger/dbcmds.c | 31 | ||||
| -rw-r--r-- | source/components/executer/excreate.c | 22 | ||||
| -rw-r--r-- | source/components/namespace/nsaccess.c | 93 |
3 files changed, 100 insertions, 46 deletions
diff --git a/source/components/debugger/dbcmds.c b/source/components/debugger/dbcmds.c index f14b020..bb58520 100644 --- a/source/components/debugger/dbcmds.c +++ b/source/components/debugger/dbcmds.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbcmds - debug commands and output routines - * $Revision: 1.151 $ + * $Revision: 1.152 $ * ******************************************************************************/ @@ -1603,24 +1603,45 @@ AcpiDbIntegrityWalk ( ACPI_INTEGRITY_INFO *Info = (ACPI_INTEGRITY_INFO *) Context; ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; ACPI_OPERAND_OBJECT *Object; + BOOLEAN Alias = TRUE; Info->Nodes++; - if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) + + /* Verify the NS node, and dereference aliases */ + + while (Alias) { - AcpiOsPrintf ("Invalid Descriptor Type for Node %p [%s]\n", - Node, AcpiUtGetDescriptorName (Node)); - } + if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) + { + AcpiOsPrintf ("Invalid Descriptor Type for Node %p [%s] - is %2.2X should be %2.2X\n", + Node, AcpiUtGetDescriptorName (Node), ACPI_GET_DESCRIPTOR_TYPE (Node), + ACPI_DESC_TYPE_NAMED); + return (AE_OK); + } + + if ((Node->Type == ACPI_TYPE_LOCAL_ALIAS) || + (Node->Type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) + { + Node = (ACPI_NAMESPACE_NODE *) Node->Object; + } + else + { + Alias = FALSE; + } + } if (Node->Type > ACPI_TYPE_LOCAL_MAX) { AcpiOsPrintf ("Invalid Object Type for Node %p, Type = %X\n", Node, Node->Type); + return (AE_OK); } if (!AcpiUtValidAcpiName (Node->Name.Integer)) { AcpiOsPrintf ("Invalid AcpiName for Node %p\n", Node); + return (AE_OK); } Object = AcpiNsGetAttachedObject (Node); diff --git a/source/components/executer/excreate.c b/source/components/executer/excreate.c index 5fed416..da4ced3 100644 --- a/source/components/executer/excreate.c +++ b/source/components/executer/excreate.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: excreate - Named object creation - * $Revision: 1.114 $ + * $Revision: 1.115 $ * *****************************************************************************/ @@ -180,16 +180,28 @@ AcpiExCreateAlias ( */ switch (TargetNode->Type) { + + /* For these types, the sub-object can change dynamically via a Store */ + case ACPI_TYPE_INTEGER: case ACPI_TYPE_STRING: case ACPI_TYPE_BUFFER: case ACPI_TYPE_PACKAGE: case ACPI_TYPE_BUFFER_FIELD: + /* + * These types open a new scope, so we need the NS node in order to access + * any children. + */ + case ACPI_TYPE_DEVICE: + case ACPI_TYPE_POWER: + case ACPI_TYPE_PROCESSOR: + case ACPI_TYPE_THERMAL: + case ACPI_TYPE_LOCAL_SCOPE: + /* * The new alias has the type ALIAS and points to the original - * NS node, not the object itself. This is because for these - * types, the object can change dynamically via a Store. + * NS node, not the object itself. */ AliasNode->Type = ACPI_TYPE_LOCAL_ALIAS; AliasNode->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode); @@ -198,9 +210,7 @@ AcpiExCreateAlias ( case ACPI_TYPE_METHOD: /* - * The new alias has the type ALIAS and points to the original - * NS node, not the object itself. This is because for these - * types, the object can change dynamically via a Store. + * Control method aliases need to be differentiated */ AliasNode->Type = ACPI_TYPE_LOCAL_METHOD_ALIAS; AliasNode->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode); diff --git a/source/components/namespace/nsaccess.c b/source/components/namespace/nsaccess.c index b96a372..14842d0 100644 --- a/source/components/namespace/nsaccess.c +++ b/source/components/namespace/nsaccess.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nsaccess - Top-level functions for accessing ACPI namespace - * $Revision: 1.206 $ + * $Revision: 1.207 $ * ******************************************************************************/ @@ -679,44 +679,67 @@ AcpiNsLookup ( return_ACPI_STATUS (Status); } - /* - * Sanity typecheck of the target object: - * - * If 1) This is the last segment (NumSegments == 0) - * 2) And we are looking for a specific type - * (Not checking for TYPE_ANY) - * 3) Which is not an alias - * 4) Which is not a local type (TYPE_SCOPE) - * 5) And the type of target object is known (not TYPE_ANY) - * 6) And target object does not match what we are looking for - * - * Then we have a type mismatch. Just warn and ignore it. - */ - if ((NumSegments == 0) && - (TypeToCheckFor != ACPI_TYPE_ANY) && - (TypeToCheckFor != ACPI_TYPE_LOCAL_ALIAS) && - (TypeToCheckFor != ACPI_TYPE_LOCAL_METHOD_ALIAS) && - (TypeToCheckFor != ACPI_TYPE_LOCAL_SCOPE) && - (ThisNode->Type != ACPI_TYPE_ANY) && - (ThisNode->Type != TypeToCheckFor)) - { - /* Complain about a type mismatch */ + /* More segments to follow? */ - ACPI_WARNING ((AE_INFO, - "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)", - ACPI_CAST_PTR (char, &SimpleName), - AcpiUtGetTypeName (ThisNode->Type), - AcpiUtGetTypeName (TypeToCheckFor))); + if (NumSegments > 0) + { + /* + * If we have an alias to an object that opens a scope (such as a + * device or processor), we need to dereference the alias here so that + * we can access any children of the original node (via the remaining + * segments). + */ + if (ThisNode->Type == ACPI_TYPE_LOCAL_ALIAS) + { + if (AcpiNsOpensScope (((ACPI_NAMESPACE_NODE *) ThisNode->Object)->Type)) + { + ThisNode = (ACPI_NAMESPACE_NODE *) ThisNode->Object; + } + } } - /* - * If this is the last name segment and we are not looking for a - * specific type, but the type of found object is known, use that type - * to see if it opens a scope. - */ - if ((NumSegments == 0) && (Type == ACPI_TYPE_ANY)) + /* Special handling for the last segment (NumSegments == 0) */ + + else { - Type = ThisNode->Type; + /* + * Sanity typecheck of the target object: + * + * If 1) This is the last segment (NumSegments == 0) + * 2) And we are looking for a specific type + * (Not checking for TYPE_ANY) + * 3) Which is not an alias + * 4) Which is not a local type (TYPE_SCOPE) + * 5) And the type of target object is known (not TYPE_ANY) + * 6) And target object does not match what we are looking for + * + * Then we have a type mismatch. Just warn and ignore it. + */ + if ((TypeToCheckFor != ACPI_TYPE_ANY) && + (TypeToCheckFor != ACPI_TYPE_LOCAL_ALIAS) && + (TypeToCheckFor != ACPI_TYPE_LOCAL_METHOD_ALIAS) && + (TypeToCheckFor != ACPI_TYPE_LOCAL_SCOPE) && + (ThisNode->Type != ACPI_TYPE_ANY) && + (ThisNode->Type != TypeToCheckFor)) + { + /* Complain about a type mismatch */ + + ACPI_WARNING ((AE_INFO, + "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)", + ACPI_CAST_PTR (char, &SimpleName), + AcpiUtGetTypeName (ThisNode->Type), + AcpiUtGetTypeName (TypeToCheckFor))); + } + + /* + * If this is the last name segment and we are not looking for a + * specific type, but the type of found object is known, use that type + * to (later) see if it opens a scope. + */ + if (Type == ACPI_TYPE_ANY) + { + Type = ThisNode->Type; + } } /* Point to next name segment and make this node current */ |
