diff --git a/source/components/namespace/nsdump.c b/source/components/namespace/nsdump.c index 426d95eb0..90950e5f9 100644 --- a/source/components/namespace/nsdump.c +++ b/source/components/namespace/nsdump.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsdump - table dumping routines for debug - * $Revision: 1.85 $ + * $Revision: 1.87 $ * *****************************************************************************/ @@ -123,7 +123,7 @@ #include "actables.h" -#define _COMPONENT NAMESPACE +#define _COMPONENT ACPI_NAMESPACE MODULE_NAME ("nsdump") @@ -459,15 +459,15 @@ AcpiNsDumpOneObject ( break; case ACPI_TYPE_FIELD_UNIT: - Value = (UINT8 *) ObjDesc->FieldUnit.Container; + Value = (UINT8 *) ObjDesc->FieldUnit.ContainerObj; break; case INTERNAL_TYPE_DEF_FIELD: - Value = (UINT8 *) ObjDesc->Field.Container; + Value = (UINT8 *) ObjDesc->Field.RegionObj; break; case INTERNAL_TYPE_BANK_FIELD: - Value = (UINT8 *) ObjDesc->BankField.Container; + Value = (UINT8 *) ObjDesc->BankField.RegionObj; break; case INTERNAL_TYPE_INDEX_FIELD: diff --git a/source/components/namespace/nseval.c b/source/components/namespace/nseval.c index 37dab9d74..a96eb8843 100644 --- a/source/components/namespace/nseval.c +++ b/source/components/namespace/nseval.c @@ -1,17 +1,17 @@ - -/****************************************************************************** +/******************************************************************************* * * Module Name: nseval - Object evaluation interfaces -- includes control * method lookup and execution. + * $Revision: 1.89 $ * - *****************************************************************************/ + ******************************************************************************/ /****************************************************************************** * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999, Intel Corp. All rights - * reserved. + * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. + * All rights reserved. * * 2. License * @@ -125,15 +125,15 @@ #include "acnamesp.h" -#define _COMPONENT NAMESPACE - MODULE_NAME ("nseval"); +#define _COMPONENT ACPI_NAMESPACE + MODULE_NAME ("nseval") -/**************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsEvaluateRelative * - * PARAMETERS: RelObjEntry - NTE of the relative containing object + * PARAMETERS: Handle - The relative containing object * *Pathname - Name of method to execute, If NULL, the * handle is the object to execute * **Params - List of parameters to pass to the method, @@ -149,18 +149,18 @@ * * MUTEX: Locks Namespace * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiNsEvaluateRelative ( - ACPI_NAMED_OBJECT *Handle, + ACPI_NAMESPACE_NODE *Handle, NATIVE_CHAR *Pathname, - ACPI_OBJECT_INTERNAL **Params, - ACPI_OBJECT_INTERNAL **ReturnObject) + ACPI_OPERAND_OBJECT **Params, + ACPI_OPERAND_OBJECT **ReturnObject) { - ACPI_NAMED_OBJECT *RelObjEntry; + ACPI_NAMESPACE_NODE *PrefixNode; ACPI_STATUS Status; - ACPI_NAMED_OBJECT *ObjEntry = NULL; + ACPI_NAMESPACE_NODE *Node = NULL; NATIVE_CHAR *InternalPath = NULL; ACPI_GENERIC_STATE ScopeInfo; @@ -184,12 +184,12 @@ AcpiNsEvaluateRelative ( return_ACPI_STATUS (Status); } - /* Get the prefix handle and NTE */ + /* Get the prefix handle and Node */ AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE); - RelObjEntry = AcpiNsConvertHandleToEntry (Handle); - if (!RelObjEntry) + PrefixNode = AcpiNsConvertHandleToEntry (Handle); + if (!PrefixNode) { AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); Status = AE_BAD_PARAMETER; @@ -198,19 +198,18 @@ AcpiNsEvaluateRelative ( /* Lookup the name in the namespace */ - ScopeInfo.Scope.NameTable = RelObjEntry->ChildTable; + ScopeInfo.Scope.Node = PrefixNode; Status = AcpiNsLookup (&ScopeInfo, InternalPath, ACPI_TYPE_ANY, - IMODE_EXECUTE, - NS_NO_UPSEARCH, NULL, - &ObjEntry); + IMODE_EXECUTE, NS_NO_UPSEARCH, NULL, + &Node); AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { DEBUG_PRINT (ACPI_INFO, - ("NsEvaluateRelative: Object [%s] not found [%.4X]\n", - InternalPath, Status)); + ("NsEvaluateRelative: Object [%s] not found [%s]\n", + Pathname, AcpiCmFormatException (Status))); goto Cleanup; } @@ -221,9 +220,9 @@ AcpiNsEvaluateRelative ( DEBUG_PRINT (ACPI_INFO, ("NsEvaluateRelative: %s [%p] Value %p\n", - Pathname, ObjEntry, ObjEntry->Object)); + Pathname, Node, Node->Object)); - Status = AcpiNsEvaluateByHandle (ObjEntry, Params, ReturnObject); + Status = AcpiNsEvaluateByHandle (Node, Params, ReturnObject); DEBUG_PRINT (ACPI_INFO, ("NsEvaluateRelative: *** Completed eval of object %s ***\n", @@ -239,7 +238,7 @@ Cleanup: } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsEvaluateByName * @@ -257,16 +256,16 @@ Cleanup: * * MUTEX: Locks Namespace * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiNsEvaluateByName ( NATIVE_CHAR *Pathname, - ACPI_OBJECT_INTERNAL **Params, - ACPI_OBJECT_INTERNAL **ReturnObject) + ACPI_OPERAND_OBJECT **Params, + ACPI_OPERAND_OBJECT **ReturnObject) { ACPI_STATUS Status; - ACPI_NAMED_OBJECT *ObjEntry = NULL; + ACPI_NAMESPACE_NODE *Node = NULL; NATIVE_CHAR *InternalPath = NULL; @@ -286,9 +285,8 @@ AcpiNsEvaluateByName ( /* Lookup the name in the namespace */ Status = AcpiNsLookup (NULL, InternalPath, ACPI_TYPE_ANY, - IMODE_EXECUTE, - NS_NO_UPSEARCH, NULL, - &ObjEntry); + IMODE_EXECUTE, NS_NO_UPSEARCH, NULL, + &Node); AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); @@ -296,7 +294,7 @@ AcpiNsEvaluateByName ( { DEBUG_PRINT (ACPI_INFO, ("NsEvaluateByName: Object at [%s] was not found, status=%.4X\n", - InternalPath, Status)); + Pathname, Status)); goto Cleanup; } @@ -307,9 +305,9 @@ AcpiNsEvaluateByName ( DEBUG_PRINT (ACPI_INFO, ("NsEvaluateByName: %s [%p] Value %p\n", - Pathname, ObjEntry, ObjEntry->Object)); + Pathname, Node, Node->Object)); - Status = AcpiNsEvaluateByHandle (ObjEntry, Params, ReturnObject); + Status = AcpiNsEvaluateByHandle (Node, Params, ReturnObject); DEBUG_PRINT (ACPI_INFO, ("NsEvaluateByName: *** Completed eval of object %s ***\n", @@ -329,16 +327,16 @@ Cleanup: } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsEvaluateByHandle * - * PARAMETERS: ObjEntry - NTE of method to execute - * *ReturnObject - Where to put method's return value (if - * any). If NULL, no value is returned. + * PARAMETERS: Handle - Method Node to execute * **Params - List of parameters to pass to the method, * terminated by NULL. Params itself may be * NULL if no parameters are being passed. + * *ReturnObject - Where to put method's return value (if + * any). If NULL, no value is returned. * * RETURN: Status * @@ -346,17 +344,17 @@ Cleanup: * * MUTEX: Locks Namespace * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiNsEvaluateByHandle ( - ACPI_NAMED_OBJECT *Handle, - ACPI_OBJECT_INTERNAL **Params, - ACPI_OBJECT_INTERNAL **ReturnObject) + ACPI_NAMESPACE_NODE *Handle, + ACPI_OPERAND_OBJECT **Params, + ACPI_OPERAND_OBJECT **ReturnObject) { - ACPI_NAMED_OBJECT *ObjEntry; + ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; - ACPI_OBJECT_INTERNAL *LocalReturnObject; + ACPI_OPERAND_OBJECT *LocalReturnObject; FUNCTION_TRACE ("NsEvaluateByHandle"); @@ -364,7 +362,7 @@ AcpiNsEvaluateByHandle ( /* Check if namespace has been initialized */ - if (!AcpiGbl_RootObject->ChildTable) + if (!AcpiGbl_RootNode) { return_ACPI_STATUS (AE_NO_NAMESPACE); } @@ -383,15 +381,15 @@ AcpiNsEvaluateByHandle ( *ReturnObject = NULL; } - /* Get the prefix handle and NTE */ + /* Get the prefix handle and Node */ AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE); - ObjEntry = AcpiNsConvertHandleToEntry (Handle); - if (!ObjEntry) + Node = AcpiNsConvertHandleToEntry (Handle); + if (!Node) { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; + AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + return_ACPI_STATUS (AE_BAD_PARAMETER); } @@ -404,15 +402,12 @@ AcpiNsEvaluateByHandle ( * In both cases, the namespace is unlocked by the * AcpiNs* procedure */ - - if (AcpiNsGetType (ObjEntry) == ACPI_TYPE_METHOD) + if (AcpiNsGetType (Node) == ACPI_TYPE_METHOD) { /* * Case 1) We have an actual control method to execute */ - - Status = AcpiNsExecuteControlMethod (ObjEntry, - Params, + Status = AcpiNsExecuteControlMethod (Node, Params, &LocalReturnObject); } @@ -422,9 +417,7 @@ AcpiNsEvaluateByHandle ( * Case 2) Object is NOT a method, just return its * current value */ - - Status = AcpiNsGetObjectValue (ObjEntry, - &LocalReturnObject); + Status = AcpiNsGetObjectValue (Node, &LocalReturnObject); } @@ -432,7 +425,6 @@ AcpiNsEvaluateByHandle ( * Check if there is a return value on the stack that must * be dealt with */ - if (Status == AE_CTRL_RETURN_VALUE) { /* @@ -441,14 +433,12 @@ AcpiNsEvaluateByHandle ( * the returned value to the object descriptor provided * by the caller. */ - if (ReturnObject) { /* * Valid return object, copy the pointer to * the returned object */ - *ReturnObject = LocalReturnObject; } @@ -465,22 +455,15 @@ AcpiNsEvaluateByHandle ( * Namespace was unlocked by the handling AcpiNs* function, * so we just return */ - - return_ACPI_STATUS (Status); - - -UnlockAndExit: - - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (Status); } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsExecuteControlMethod * - * PARAMETERS: MethodEntry - The Nte of the object/method + * PARAMETERS: MethodNode - The object/method * **Params - List of parameters to pass to the method, * terminated by NULL. Params itself may be * NULL if no parameters are being passed. @@ -493,16 +476,16 @@ UnlockAndExit: * * MUTEX: Assumes namespace is locked * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiNsExecuteControlMethod ( - ACPI_NAMED_OBJECT *MethodEntry, - ACPI_OBJECT_INTERNAL **Params, - ACPI_OBJECT_INTERNAL **ReturnObjDesc) + ACPI_NAMESPACE_NODE *MethodNode, + ACPI_OPERAND_OBJECT **Params, + ACPI_OPERAND_OBJECT **ReturnObjDesc) { ACPI_STATUS Status; - ACPI_OBJECT_INTERNAL *ObjDesc; + ACPI_OPERAND_OBJECT *ObjDesc; FUNCTION_TRACE ("NsExecuteControlMethod"); @@ -510,11 +493,13 @@ AcpiNsExecuteControlMethod ( /* Verify that there is a method associated with this object */ - ObjDesc = AcpiNsGetAttachedObject ((ACPI_HANDLE) MethodEntry); + ObjDesc = AcpiNsGetAttachedObject (MethodNode); if (!ObjDesc) { DEBUG_PRINT (ACPI_ERROR, ("Control method is undefined (nil value)\n")); + + AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (AE_ERROR); } @@ -523,7 +508,7 @@ AcpiNsExecuteControlMethod ( ObjDesc->Method.Pcode + 1, ObjDesc->Method.PcodeLength - 1)); - DUMP_PATHNAME (MethodEntry, "NsExecuteControlMethod: Executing", + DUMP_PATHNAME (MethodNode, "NsExecuteControlMethod: Executing", TRACE_NAMES, _COMPONENT); DEBUG_PRINT (TRACE_NAMES, @@ -537,23 +522,22 @@ AcpiNsExecuteControlMethod ( * interpreter locks to ensure that no thread is using the portion of the * namespace that is being deleted. */ - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); /* - * Excecute the method via the interpreter + * Execute the method via the interpreter */ - Status = AcpiAmlExecuteMethod (MethodEntry, Params, ReturnObjDesc); + Status = AcpiAmlExecuteMethod (MethodNode, Params, ReturnObjDesc); return_ACPI_STATUS (Status); } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsGetObjectValue * - * PARAMETERS: ObjectEntry - The Nte of the object + * PARAMETERS: Node - The object * * RETURN: Status * @@ -561,16 +545,16 @@ AcpiNsExecuteControlMethod ( * * MUTEX: Assumes namespace is locked * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiNsGetObjectValue ( - ACPI_NAMED_OBJECT *ObjectEntry, - ACPI_OBJECT_INTERNAL **ReturnObjDesc) + ACPI_NAMESPACE_NODE *Node, + ACPI_OPERAND_OBJECT **ReturnObjDesc) { ACPI_STATUS Status = AE_OK; - ACPI_OBJECT_INTERNAL *ObjDesc; - ACPI_OBJECT_INTERNAL *ValDesc; + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_OPERAND_OBJECT *ValDesc; FUNCTION_TRACE ("NsGetObjectValue"); @@ -580,14 +564,13 @@ AcpiNsGetObjectValue ( * We take the value from certain objects directly */ - if ((ObjectEntry->Type == ACPI_TYPE_PROCESSOR) || - (ObjectEntry->Type == ACPI_TYPE_POWER)) + if ((Node->Type == ACPI_TYPE_PROCESSOR) || + (Node->Type == ACPI_TYPE_POWER)) { - /* * Create a Reference object to contain the object */ - ObjDesc = AcpiCmCreateInternalObject (ObjectEntry->Type); + ObjDesc = AcpiCmCreateInternalObject (Node->Type); if (!ObjDesc) { Status = AE_NO_MEMORY; @@ -598,7 +581,7 @@ AcpiNsGetObjectValue ( * Get the attached object */ - ValDesc = AcpiNsGetAttachedObject (ObjectEntry); + ValDesc = AcpiNsGetAttachedObject (Node); if (!ValDesc) { Status = AE_NULL_OBJECT; @@ -606,13 +589,15 @@ AcpiNsGetObjectValue ( } /* - * Just copy from the original to the return object + * Just copy from the original to the return object + * + * TBD: [Future] - need a low-level object copy that handles + * the reference count automatically. (Don't want to copy it) */ - MEMCPY (&ObjDesc->Common.FirstNonCommonByte, - &ValDesc->Common.FirstNonCommonByte, - (sizeof(ACPI_OBJECT_COMMON) - - sizeof(ObjDesc->Common.FirstNonCommonByte))); + MEMCPY (ObjDesc, ValDesc, sizeof (ACPI_OPERAND_OBJECT)); + ObjDesc->Common.ReferenceCount = 1; + AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); } @@ -633,20 +618,34 @@ AcpiNsGetObjectValue ( /* Construct a descriptor pointing to the name */ - ObjDesc->Reference.OpCode = (UINT8) AML_NAME_OP; - ObjDesc->Reference.Object = (void *) ObjectEntry; + ObjDesc->Reference.Opcode = (UINT8) AML_NAME_OP; + ObjDesc->Reference.Object = (void *) Node; /* - * Use AcpiAmlResolveToValue() to get the associated value. - * The call to AcpiAmlResolveToValue causes - * ObjDesc (allocated above) to always be deleted. + * Use ResolveToValue() to get the associated value. This call + * always deletes ObjDesc (allocated above). * * NOTE: we can get away with passing in NULL for a walk state * because ObjDesc is guaranteed to not be a reference to either * a method local or a method argument + * + * Even though we do not directly invoke the interpreter + * for this, we must enter it because we could access an opregion. + * The opregion access code assumes that the interpreter + * is locked. + * + * We must release the namespace lock before entering the + * intepreter. */ - Status = AcpiAmlResolveToValue (&ObjDesc, NULL); + AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + Status = AcpiAmlEnterInterpreter (); + if (ACPI_SUCCESS (Status)) + { + Status = AcpiAmlResolveToValue (&ObjDesc, NULL); + + AcpiAmlExitInterpreter (); + } } /* @@ -663,6 +662,10 @@ AcpiNsGetObjectValue ( ("NsGetObjectValue: Returning obj %p\n", *ReturnObjDesc)); } + /* Namespace is unlocked */ + + return_ACPI_STATUS (Status); + UnlockAndExit: