diff options
Diffstat (limited to 'sys/contrib/dev/acpica/exresolv.c')
-rw-r--r-- | sys/contrib/dev/acpica/exresolv.c | 126 |
1 files changed, 47 insertions, 79 deletions
diff --git a/sys/contrib/dev/acpica/exresolv.c b/sys/contrib/dev/acpica/exresolv.c index 630540c..b15e86b 100644 --- a/sys/contrib/dev/acpica/exresolv.c +++ b/sys/contrib/dev/acpica/exresolv.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exresolv - AML Interpreter object resolution - * $Revision: 1.132 $ + * $Revision: 1.142 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. * All rights reserved. * * 2. License @@ -159,12 +159,12 @@ AcpiExResolveToValue ( ACPI_STATUS Status; - ACPI_FUNCTION_TRACE_PTR ("ExResolveToValue", StackPtr); + ACPI_FUNCTION_TRACE_PTR (ExResolveToValue, StackPtr); if (!StackPtr || !*StackPtr) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n")); + ACPI_ERROR ((AE_INFO, "Internal - null pointer")); return_ACPI_STATUS (AE_AML_NO_OPERAND); } @@ -183,7 +183,7 @@ AcpiExResolveToValue ( if (!*StackPtr) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n")); + ACPI_ERROR ((AE_INFO, "Internal - null pointer")); return_ACPI_STATUS (AE_AML_NO_OPERAND); } } @@ -229,12 +229,11 @@ AcpiExResolveObjectToValue ( { ACPI_STATUS Status = AE_OK; ACPI_OPERAND_OBJECT *StackDesc; - void *TempNode; - ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_OPERAND_OBJECT *ObjDesc = NULL; UINT16 Opcode; - ACPI_FUNCTION_TRACE ("ExResolveObjectToValue"); + ACPI_FUNCTION_TRACE (ExResolveObjectToValue); StackDesc = *StackPtr; @@ -249,24 +248,6 @@ AcpiExResolveObjectToValue ( switch (Opcode) { - case AML_NAME_OP: - - /* - * Convert name reference to a namespace node - * Then, AcpiExResolveNodeToValue can be used to get the value - */ - TempNode = StackDesc->Reference.Object; - - /* Delete the Reference Object */ - - AcpiUtRemoveReference (StackDesc); - - /* Return the namespace node */ - - (*StackPtr) = TempNode; - break; - - case AML_LOCAL_OP: case AML_ARG_OP: @@ -323,8 +304,8 @@ AcpiExResolveObjectToValue ( * A NULL object descriptor means an unitialized element of * the package, can't dereference it */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Attempt to deref an Index to NULL pkg element Idx=%p\n", + ACPI_ERROR ((AE_INFO, + "Attempt to deref an Index to NULL pkg element Idx=%p", StackDesc)); Status = AE_AML_UNINITIALIZED_ELEMENT; } @@ -335,8 +316,8 @@ AcpiExResolveObjectToValue ( /* Invalid reference object */ - ACPI_REPORT_ERROR (( - "During resolve, Unknown TargetType %X in Index/Reference obj %p\n", + ACPI_ERROR ((AE_INFO, + "Unknown TargetType %X in Index/Reference obj %p", StackDesc->Reference.TargetType, StackDesc)); Status = AE_AML_INTERNAL; break; @@ -354,17 +335,30 @@ AcpiExResolveObjectToValue ( case AML_INT_NAMEPATH_OP: /* Reference to a named object */ - /* Get the object pointed to by the namespace node */ + /* Dereference the name */ + + if ((StackDesc->Reference.Node->Type == ACPI_TYPE_DEVICE) || + (StackDesc->Reference.Node->Type == ACPI_TYPE_THERMAL)) + { + /* These node types do not have 'real' subobjects */ + + *StackPtr = (void *) StackDesc->Reference.Node; + } + else + { + /* Get the object pointed to by the namespace node */ + + *StackPtr = (StackDesc->Reference.Node)->Object; + AcpiUtAddReference (*StackPtr); + } - *StackPtr = (StackDesc->Reference.Node)->Object; - AcpiUtAddReference (*StackPtr); AcpiUtRemoveReference (StackDesc); break; default: - ACPI_REPORT_ERROR (( - "During resolve, Unknown Reference opcode %X (%s) in %p\n", + ACPI_ERROR ((AE_INFO, + "Unknown Reference opcode %X (%s) in %p", Opcode, AcpiPsGetOpcodeName (Opcode), StackDesc)); Status = AE_AML_INTERNAL; break; @@ -384,8 +378,6 @@ AcpiExResolveObjectToValue ( break; - /* These cases may never happen here, but just in case.. */ - case ACPI_TYPE_BUFFER_FIELD: case ACPI_TYPE_LOCAL_REGION_FIELD: case ACPI_TYPE_LOCAL_BANK_FIELD: @@ -395,6 +387,10 @@ AcpiExResolveObjectToValue ( StackDesc, ACPI_GET_OBJECT_TYPE (StackDesc))); Status = AcpiExReadDataFromField (WalkState, StackDesc, &ObjDesc); + + /* Remove a reference to the original operand, then override */ + + AcpiUtRemoveReference (*StackPtr); *StackPtr = (void *) ObjDesc; break; @@ -435,7 +431,7 @@ AcpiExResolveMultiple ( ACPI_STATUS Status; - ACPI_FUNCTION_TRACE ("AcpiExResolveMultiple"); + ACPI_FUNCTION_TRACE (AcpiExResolveMultiple); /* Operand can be either a namespace node or an operand descriptor */ @@ -481,17 +477,25 @@ AcpiExResolveMultiple ( switch (ObjDesc->Reference.Opcode) { case AML_REF_OF_OP: + case AML_INT_NAMEPATH_OP: /* Dereference the reference pointer */ - Node = ObjDesc->Reference.Object; + if (ObjDesc->Reference.Opcode == AML_REF_OF_OP) + { + Node = ObjDesc->Reference.Object; + } + else /* AML_INT_NAMEPATH_OP */ + { + Node = ObjDesc->Reference.Node; + } /* All "References" point to a NS node */ if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) { - ACPI_REPORT_ERROR (( - "AcpiExResolveMultiple: Not a NS node %p [%s]\n", + ACPI_ERROR ((AE_INFO, + "Not a NS node %p [%s]", Node, AcpiUtGetDescriptorName (Node))); return_ACPI_STATUS (AE_AML_INTERNAL); } @@ -544,42 +548,6 @@ AcpiExResolveMultiple ( break; - case AML_INT_NAMEPATH_OP: - - /* Dereference the reference pointer */ - - Node = ObjDesc->Reference.Node; - - /* All "References" point to a NS node */ - - if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) - { - ACPI_REPORT_ERROR (( - "AcpiExResolveMultiple: Not a NS node %p [%s]\n", - Node, AcpiUtGetDescriptorName (Node))); - return_ACPI_STATUS (AE_AML_INTERNAL); - } - - /* Get the attached object */ - - ObjDesc = AcpiNsGetAttachedObject (Node); - if (!ObjDesc) - { - /* No object, use the NS node type */ - - Type = AcpiNsGetType (Node); - goto Exit; - } - - /* Check for circular references */ - - if (ObjDesc == Operand) - { - return_ACPI_STATUS (AE_AML_CIRCULAR_REFERENCE); - } - break; - - case AML_LOCAL_OP: case AML_ARG_OP: @@ -622,8 +590,8 @@ AcpiExResolveMultiple ( default: - ACPI_REPORT_ERROR (( - "AcpiExResolveMultiple: Unknown Reference subtype %X\n", + ACPI_ERROR ((AE_INFO, + "Unknown Reference subtype %X", ObjDesc->Reference.Opcode)); return_ACPI_STATUS (AE_AML_INTERNAL); } |