diff options
Diffstat (limited to 'sys/contrib/dev/acpica/exresolv.c')
-rw-r--r-- | sys/contrib/dev/acpica/exresolv.c | 74 |
1 files changed, 50 insertions, 24 deletions
diff --git a/sys/contrib/dev/acpica/exresolv.c b/sys/contrib/dev/acpica/exresolv.c index 51f234c..630540c 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: 125 $ + * $Revision: 1.132 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License @@ -128,6 +128,13 @@ #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME ("exresolv") +/* Local prototypes */ + +static ACPI_STATUS +AcpiExResolveObjectToValue ( + ACPI_OPERAND_OBJECT **StackPtr, + ACPI_WALK_STATE *WalkState); + /******************************************************************************* * @@ -173,6 +180,12 @@ AcpiExResolveToValue ( { return_ACPI_STATUS (Status); } + + if (!*StackPtr) + { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n")); + return_ACPI_STATUS (AE_AML_NO_OPERAND); + } } /* @@ -199,18 +212,17 @@ AcpiExResolveToValue ( * * FUNCTION: AcpiExResolveObjectToValue * - * PARAMETERS: StackPtr - Pointer to a stack location that contains a - * ptr to an internal object. + * PARAMETERS: StackPtr - Pointer to an internal object * WalkState - Current method state * * RETURN: Status * - * DESCRIPTION: Retrieve the value from an internal object. The Reference type + * DESCRIPTION: Retrieve the value from an internal object. The Reference type * uses the associated AML opcode to determine the value. * ******************************************************************************/ -ACPI_STATUS +static ACPI_STATUS AcpiExResolveObjectToValue ( ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState) @@ -240,7 +252,7 @@ AcpiExResolveObjectToValue ( case AML_NAME_OP: /* - * Convert indirect name ptr to a direct name ptr. + * Convert name reference to a namespace node * Then, AcpiExResolveNodeToValue can be used to get the value */ TempNode = StackDesc->Reference.Object; @@ -249,7 +261,7 @@ AcpiExResolveObjectToValue ( AcpiUtRemoveReference (StackDesc); - /* Put direct name pointer onto stack and exit */ + /* Return the namespace node */ (*StackPtr) = TempNode; break; @@ -340,10 +352,19 @@ AcpiExResolveObjectToValue ( break; + case AML_INT_NAMEPATH_OP: /* Reference to a named object */ + + /* Get the object pointed to by the namespace node */ + + *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_REPORT_ERROR (( + "During resolve, Unknown Reference opcode %X (%s) in %p\n", Opcode, AcpiPsGetOpcodeName (Opcode), StackDesc)); Status = AE_AML_INTERNAL; break; @@ -363,9 +384,8 @@ AcpiExResolveObjectToValue ( break; - /* - * These cases may never happen here, but just in case.. - */ + /* 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: @@ -418,10 +438,8 @@ AcpiExResolveMultiple ( ACPI_FUNCTION_TRACE ("AcpiExResolveMultiple"); + /* Operand can be either a namespace node or an operand descriptor */ - /* - * Operand can be either a namespace node or an operand descriptor - */ switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)) { case ACPI_DESC_TYPE_OPERAND: @@ -445,10 +463,8 @@ AcpiExResolveMultiple ( return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } + /* If type is anything other than a reference, we are done */ - /* - * If type is anything other than a reference, we are done - */ if (Type != ACPI_TYPE_LOCAL_REFERENCE) { goto Exit; @@ -474,8 +490,9 @@ AcpiExResolveMultiple ( if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) { - ACPI_REPORT_ERROR (("AcpiExResolveMultiple: Not a NS node %p [%s]\n", - Node, AcpiUtGetDescriptorName (Node))); + ACPI_REPORT_ERROR (( + "AcpiExResolveMultiple: Not a NS node %p [%s]\n", + Node, AcpiUtGetDescriptorName (Node))); return_ACPI_STATUS (AE_AML_INTERNAL); } @@ -517,6 +534,13 @@ AcpiExResolveMultiple ( * This could of course in turn be another reference object. */ ObjDesc = *(ObjDesc->Reference.Where); + if (!ObjDesc) + { + /* NULL package elements are allowed */ + + Type = 0; /* Uninitialized */ + goto Exit; + } break; @@ -530,8 +554,9 @@ AcpiExResolveMultiple ( if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) { - ACPI_REPORT_ERROR (("AcpiExResolveMultiple: Not a NS node %p [%s]\n", - Node, AcpiUtGetDescriptorName (Node))); + ACPI_REPORT_ERROR (( + "AcpiExResolveMultiple: Not a NS node %p [%s]\n", + Node, AcpiUtGetDescriptorName (Node))); return_ACPI_STATUS (AE_AML_INTERNAL); } @@ -561,7 +586,7 @@ AcpiExResolveMultiple ( if (ReturnDesc) { Status = AcpiDsMethodDataGetValue (ObjDesc->Reference.Opcode, - ObjDesc->Reference.Offset, WalkState, &ObjDesc); + ObjDesc->Reference.Offset, WalkState, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -597,7 +622,8 @@ AcpiExResolveMultiple ( default: - ACPI_REPORT_ERROR (("AcpiExResolveMultiple: Unknown Reference subtype %X\n", + ACPI_REPORT_ERROR (( + "AcpiExResolveMultiple: Unknown Reference subtype %X\n", ObjDesc->Reference.Opcode)); return_ACPI_STATUS (AE_AML_INTERNAL); } |