exresolv.c revision 306536
1323124Sdes/****************************************************************************** 257429Smarkm * 357429Smarkm * Module Name: exresolv - AML Interpreter object resolution 457429Smarkm * 557429Smarkm *****************************************************************************/ 657429Smarkm 765668Skris/* 865668Skris * Copyright (C) 2000 - 2016, Intel Corp. 965668Skris * All rights reserved. 1065668Skris * 1165668Skris * Redistribution and use in source and binary forms, with or without 1265668Skris * modification, are permitted provided that the following conditions 1365668Skris * are met: 1460573Skris * 1. Redistributions of source code must retain the above copyright 1592559Sdes * notice, this list of conditions, and the following disclaimer, 1665668Skris * without modification. 1765668Skris * 2. Redistributions in binary form must reproduce at minimum a disclaimer 1865668Skris * substantially similar to the "NO WARRANTY" disclaimer below 1965668Skris * ("Disclaimer") and any redistribution must be conditioned upon 2065668Skris * including a substantially similar Disclaimer requirement for further 2165668Skris * binary redistribution. 2265668Skris * 3. Neither the names of the above-listed copyright holders nor the names 2365668Skris * of any contributors may be used to endorse or promote products derived 2465668Skris * from this software without specific prior written permission. 2565668Skris * 2665668Skris * Alternatively, this software may be distributed under the terms of the 2765668Skris * GNU General Public License ("GPL") version 2 as published by the Free 2865668Skris * Software Foundation. 2965668Skris * 3065668Skris * NO WARRANTY 3165668Skris * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 3265668Skris * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 3365668Skris * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 3465668Skris * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 3565668Skris * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3660573Skris * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3757429Smarkm * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3857429Smarkm * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 3969587Sgreen * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40295367Sdes * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41162856Sdes * POSSIBILITY OF SUCH DAMAGES. 42162856Sdes */ 43162856Sdes 44162856Sdes#include <contrib/dev/acpica/include/acpi.h> 45162856Sdes#include <contrib/dev/acpica/include/accommon.h> 46162856Sdes#include <contrib/dev/acpica/include/amlcode.h> 47162856Sdes#include <contrib/dev/acpica/include/acdispat.h> 48162856Sdes#include <contrib/dev/acpica/include/acinterp.h> 49162856Sdes#include <contrib/dev/acpica/include/acnamesp.h> 50162856Sdes 51162856Sdes 52162856Sdes#define _COMPONENT ACPI_EXECUTER 53162856Sdes ACPI_MODULE_NAME ("exresolv") 54162856Sdes 55162856Sdes/* Local prototypes */ 56162856Sdes 57162856Sdesstatic ACPI_STATUS 58162856SdesAcpiExResolveObjectToValue ( 59181111Sdes ACPI_OPERAND_OBJECT **StackPtr, 6057429Smarkm ACPI_WALK_STATE *WalkState); 6157429Smarkm 6257429Smarkm 6376262Sgreen/******************************************************************************* 64295367Sdes * 6557429Smarkm * FUNCTION: AcpiExResolveToValue 66106130Sdes * 6776262Sgreen * PARAMETERS: **StackPtr - Points to entry on ObjStack, which can 6860573Skris * be either an (ACPI_OPERAND_OBJECT *) 6960573Skris * or an ACPI_HANDLE. 7076262Sgreen * WalkState - Current method state 7160573Skris * 72162856Sdes * RETURN: Status 73162856Sdes * 74162856Sdes * DESCRIPTION: Convert Reference objects to values 75162856Sdes * 7676262Sgreen ******************************************************************************/ 7760573Skris 7860573SkrisACPI_STATUS 7965668SkrisAcpiExResolveToValue ( 8076262Sgreen ACPI_OPERAND_OBJECT **StackPtr, 81295367Sdes ACPI_WALK_STATE *WalkState) 8260573Skris{ 8369587Sgreen ACPI_STATUS Status; 8469587Sgreen 8576262Sgreen 86126277Sdes ACPI_FUNCTION_TRACE_PTR (ExResolveToValue, StackPtr); 87157019Sdes 8876262Sgreen 8957429Smarkm if (!StackPtr || !*StackPtr) 9057429Smarkm { 9157429Smarkm ACPI_ERROR ((AE_INFO, "Internal - null pointer")); 9257429Smarkm return_ACPI_STATUS (AE_AML_NO_OPERAND); 9357429Smarkm } 9457429Smarkm 9557429Smarkm /* 9657429Smarkm * The entity pointed to by the StackPtr can be either 9757429Smarkm * 1) A valid ACPI_OPERAND_OBJECT, or 9857429Smarkm * 2) A ACPI_NAMESPACE_NODE (NamedObj) 9957429Smarkm */ 10057429Smarkm if (ACPI_GET_DESCRIPTOR_TYPE (*StackPtr) == ACPI_DESC_TYPE_OPERAND) 10157429Smarkm { 10257429Smarkm Status = AcpiExResolveObjectToValue (StackPtr, WalkState); 10374500Sgreen if (ACPI_FAILURE (Status)) 10457429Smarkm { 10557429Smarkm return_ACPI_STATUS (Status); 10676262Sgreen } 10776262Sgreen 108181111Sdes if (!*StackPtr) 10957429Smarkm { 11057429Smarkm ACPI_ERROR ((AE_INFO, "Internal - null pointer")); 11157429Smarkm return_ACPI_STATUS (AE_AML_NO_OPERAND); 11257429Smarkm } 11357429Smarkm } 11457429Smarkm 11592559Sdes /* 11657429Smarkm * Object on the stack may have changed if AcpiExResolveObjectToValue() 117157019Sdes * was called (i.e., we can't use an _else_ here.) 118157019Sdes */ 119157019Sdes if (ACPI_GET_DESCRIPTOR_TYPE (*StackPtr) == ACPI_DESC_TYPE_NAMED) 12092559Sdes { 12192559Sdes Status = AcpiExResolveNodeToValue ( 12260573Skris ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, StackPtr), 12392559Sdes WalkState); 12492559Sdes if (ACPI_FAILURE (Status)) 12592559Sdes { 12692559Sdes return_ACPI_STATUS (Status); 12792559Sdes } 12892559Sdes } 12992559Sdes 13057429Smarkm ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Resolved object %p\n", *StackPtr)); 13192559Sdes return_ACPI_STATUS (AE_OK); 13292559Sdes} 133226046Sdes 134226046Sdes 13592559Sdes/******************************************************************************* 13692559Sdes * 13792559Sdes * FUNCTION: AcpiExResolveObjectToValue 13892559Sdes * 13992559Sdes * PARAMETERS: StackPtr - Pointer to an internal object 14092559Sdes * WalkState - Current method state 14192559Sdes * 14257429Smarkm * RETURN: Status 14392559Sdes * 14492559Sdes * DESCRIPTION: Retrieve the value from an internal object. The Reference type 14557429Smarkm * uses the associated AML opcode to determine the value. 14692559Sdes * 14792559Sdes ******************************************************************************/ 14857429Smarkm 14992559Sdesstatic ACPI_STATUS 150255767SdesAcpiExResolveObjectToValue ( 15192559Sdes ACPI_OPERAND_OBJECT **StackPtr, 15292559Sdes ACPI_WALK_STATE *WalkState) 15392559Sdes{ 15492559Sdes ACPI_STATUS Status = AE_OK; 15592559Sdes ACPI_OPERAND_OBJECT *StackDesc; 15692559Sdes ACPI_OPERAND_OBJECT *ObjDesc = NULL; 15792559Sdes UINT8 RefType; 15892559Sdes 15992559Sdes 16092559Sdes ACPI_FUNCTION_TRACE (ExResolveObjectToValue); 16192559Sdes 16292559Sdes 16392559Sdes StackDesc = *StackPtr; 16492559Sdes 16592559Sdes /* This is an object of type ACPI_OPERAND_OBJECT */ 16692559Sdes 16792559Sdes switch (StackDesc->Common.Type) 168162856Sdes { 16992559Sdes case ACPI_TYPE_LOCAL_REFERENCE: 17092559Sdes 17192559Sdes RefType = StackDesc->Reference.Class; 17260573Skris 17360573Skris switch (RefType) 174106130Sdes { 17598941Sdes case ACPI_REFCLASS_LOCAL: 176106130Sdes case ACPI_REFCLASS_ARG: 17792559Sdes /* 17860573Skris * Get the local from the method's state info 17957429Smarkm * Note: this increments the local's object reference count 18057429Smarkm */ 181162856Sdes Status = AcpiDsMethodDataGetValue (RefType, 182157019Sdes StackDesc->Reference.Value, WalkState, &ObjDesc); 183157019Sdes if (ACPI_FAILURE (Status)) 184157019Sdes { 185157019Sdes return_ACPI_STATUS (Status); 186157019Sdes } 187157019Sdes 18857429Smarkm ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Arg/Local %X] ValueObj is %p\n", 18957429Smarkm StackDesc->Reference.Value, ObjDesc)); 19057429Smarkm 19157429Smarkm /* 19292559Sdes * Now we can delete the original Reference Object and 19376262Sgreen * replace it with the resolved value 19457429Smarkm */ 195124211Sdes AcpiUtRemoveReference (StackDesc); 19657429Smarkm *StackPtr = ObjDesc; 19757429Smarkm break; 19857429Smarkm 19957429Smarkm case ACPI_REFCLASS_INDEX: 20057429Smarkm 20157429Smarkm switch (StackDesc->Reference.TargetType) 20257429Smarkm { 20357429Smarkm case ACPI_TYPE_BUFFER_FIELD: 20457429Smarkm 20557429Smarkm /* Just return - do not dereference */ 20657429Smarkm break; 20757429Smarkm 20857429Smarkm case ACPI_TYPE_PACKAGE: 20957429Smarkm 21057429Smarkm /* If method call or CopyObject - do not dereference */ 21157429Smarkm 21257429Smarkm if ((WalkState->Opcode == AML_INT_METHODCALL_OP) || 21357429Smarkm (WalkState->Opcode == AML_COPY_OP)) 21457429Smarkm { 21557429Smarkm break; 21657429Smarkm } 21757429Smarkm 21857429Smarkm /* Otherwise, dereference the PackageIndex to a package element */ 21957429Smarkm 22057429Smarkm ObjDesc = *StackDesc->Reference.Where; 22192559Sdes if (ObjDesc) 22276262Sgreen { 22357429Smarkm /* 224124211Sdes * Valid object descriptor, copy pointer to return value 22557429Smarkm * (i.e., dereference the package index) 22657429Smarkm * Delete the ref object, increment the returned object 22757429Smarkm */ 22857429Smarkm AcpiUtAddReference (ObjDesc); 22957429Smarkm *StackPtr = ObjDesc; 23057429Smarkm } 23157429Smarkm else 23257429Smarkm { 23357429Smarkm /* 23457429Smarkm * A NULL object descriptor means an uninitialized element of 23557429Smarkm * the package, can't dereference it 23676262Sgreen */ 23757429Smarkm ACPI_ERROR ((AE_INFO, 23857429Smarkm "Attempt to dereference an Index to " 23957429Smarkm "NULL package element Idx=%p", 24057429Smarkm StackDesc)); 24157429Smarkm Status = AE_AML_UNINITIALIZED_ELEMENT; 24257429Smarkm } 24357429Smarkm break; 24457429Smarkm 24557429Smarkm default: 24692559Sdes 24792559Sdes /* Invalid reference object */ 24892559Sdes 249126277Sdes ACPI_ERROR ((AE_INFO, 25092559Sdes "Unknown TargetType 0x%X in Index/Reference object %p", 25192559Sdes StackDesc->Reference.TargetType, StackDesc)); 252197679Sdes Status = AE_AML_INTERNAL; 253164149Sdes break; 254164149Sdes } 255164149Sdes break; 25692559Sdes 25792559Sdes case ACPI_REFCLASS_REFOF: 258126277Sdes case ACPI_REFCLASS_DEBUG: 25992559Sdes case ACPI_REFCLASS_TABLE: 26092559Sdes 261126277Sdes /* Just leave the object as-is, do not dereference */ 262126277Sdes 263126277Sdes break; 264126277Sdes 265126277Sdes case ACPI_REFCLASS_NAME: /* Reference to a named object */ 266126277Sdes 267126277Sdes /* Dereference the name */ 26892559Sdes 26992559Sdes if ((StackDesc->Reference.Node->Type == ACPI_TYPE_DEVICE) || 27092559Sdes (StackDesc->Reference.Node->Type == ACPI_TYPE_THERMAL)) 27157429Smarkm { 27257429Smarkm /* These node types do not have 'real' subobjects */ 27357429Smarkm 27457429Smarkm *StackPtr = (void *) StackDesc->Reference.Node; 27557429Smarkm } 27657429Smarkm else 27792559Sdes { 27876262Sgreen /* Get the object pointed to by the namespace node */ 279323124Sdes 28057429Smarkm *StackPtr = (StackDesc->Reference.Node)->Object; 28157429Smarkm AcpiUtAddReference (*StackPtr); 28257429Smarkm } 283240075Sdes 28476262Sgreen AcpiUtRemoveReference (StackDesc); 285181111Sdes break; 28657429Smarkm 287240075Sdes default: 288240075Sdes 289240075Sdes ACPI_ERROR ((AE_INFO, 290240075Sdes "Unknown Reference type 0x%X in %p", 291323124Sdes RefType, StackDesc)); 292240075Sdes Status = AE_AML_INTERNAL; 293323124Sdes break; 294240075Sdes } 29576262Sgreen break; 29692559Sdes 29776262Sgreen case ACPI_TYPE_BUFFER: 29876262Sgreen 29976262Sgreen Status = AcpiDsGetBufferArguments (StackDesc); 30076262Sgreen break; 30192559Sdes 30276262Sgreen case ACPI_TYPE_PACKAGE: 303323124Sdes 304323124Sdes Status = AcpiDsGetPackageArguments (StackDesc); 305323124Sdes break; 306323124Sdes 30792559Sdes case ACPI_TYPE_BUFFER_FIELD: 308323124Sdes case ACPI_TYPE_LOCAL_REGION_FIELD: 309323124Sdes case ACPI_TYPE_LOCAL_BANK_FIELD: 31092559Sdes case ACPI_TYPE_LOCAL_INDEX_FIELD: 31176262Sgreen 31260573Skris ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 31392559Sdes "FieldRead SourceDesc=%p Type=%X\n", 31460573Skris StackDesc, StackDesc->Common.Type)); 31560573Skris 31692559Sdes Status = AcpiExReadDataFromField (WalkState, StackDesc, &ObjDesc); 31792559Sdes 31860573Skris /* Remove a reference to the original operand, then override */ 31961209Skris 32061209Skris AcpiUtRemoveReference (*StackPtr); 32161209Skris *StackPtr = (void *) ObjDesc; 32261209Skris break; 32361209Skris 32460573Skris default: 32576262Sgreen 32661209Skris break; 32761209Skris } 32861209Skris 32961209Skris return_ACPI_STATUS (Status); 33061209Skris} 331181111Sdes 33261209Skris 33376262Sgreen/******************************************************************************* 33461209Skris * 33576262Sgreen * FUNCTION: AcpiExResolveMultiple 33661209Skris * 33761209Skris * PARAMETERS: WalkState - Current state (contains AML opcode) 33861209Skris * Operand - Starting point for resolution 33961209Skris * ReturnType - Where the object type is returned 34061209Skris * ReturnDesc - Where the resolved object is returned 34161209Skris * 34276262Sgreen * RETURN: Status 34360573Skris * 34492559Sdes * DESCRIPTION: Return the base object and type. Traverse a reference list if 34557429Smarkm * necessary to get to the base object. 34657429Smarkm * 34757429Smarkm ******************************************************************************/ 34857429Smarkm 34957429SmarkmACPI_STATUS 35057429SmarkmAcpiExResolveMultiple ( 35176262Sgreen ACPI_WALK_STATE *WalkState, 35257429Smarkm ACPI_OPERAND_OBJECT *Operand, 35357429Smarkm ACPI_OBJECT_TYPE *ReturnType, 35457429Smarkm ACPI_OPERAND_OBJECT **ReturnDesc) 35557429Smarkm{ 35657429Smarkm ACPI_OPERAND_OBJECT *ObjDesc = ACPI_CAST_PTR (void, Operand); 35757429Smarkm ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Operand); 358323124Sdes ACPI_OBJECT_TYPE Type; 359323124Sdes ACPI_STATUS Status; 36057429Smarkm 361323124Sdes 36257429Smarkm ACPI_FUNCTION_TRACE (AcpiExResolveMultiple); 36357429Smarkm 364323124Sdes 365323124Sdes /* Operand can be either a namespace node or an operand descriptor */ 36657429Smarkm 36757429Smarkm switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)) 36857429Smarkm { 36957429Smarkm case ACPI_DESC_TYPE_OPERAND: 37076262Sgreen 37157429Smarkm Type = ObjDesc->Common.Type; 37276262Sgreen break; 37392559Sdes 37492559Sdes case ACPI_DESC_TYPE_NAMED: 37557429Smarkm 37657429Smarkm Type = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type; 377181111Sdes ObjDesc = AcpiNsGetAttachedObject (Node); 378181111Sdes 379181111Sdes /* If we had an Alias node, use the attached object for type info */ 380181111Sdes 381181111Sdes if (Type == ACPI_TYPE_LOCAL_ALIAS) 382181111Sdes { 383181111Sdes Type = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type; 384181111Sdes ObjDesc = AcpiNsGetAttachedObject ( 385181111Sdes (ACPI_NAMESPACE_NODE *) ObjDesc); 386181111Sdes } 38776262Sgreen 38892559Sdes if (!ObjDesc) 38957429Smarkm { 39057429Smarkm ACPI_ERROR ((AE_INFO, 39157429Smarkm "[%4.4s] Node is unresolved or uninitialized", 39257429Smarkm AcpiUtGetNodeName (Node))); 39357429Smarkm return_ACPI_STATUS (AE_AML_UNINITIALIZED_NODE); 39457429Smarkm } 39592559Sdes break; 396162856Sdes 39757429Smarkm default: 398323124Sdes return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 39957429Smarkm } 40057429Smarkm 40157429Smarkm /* If type is anything other than a reference, we are done */ 40257429Smarkm 40357429Smarkm if (Type != ACPI_TYPE_LOCAL_REFERENCE) 404296781Sdes { 40557429Smarkm goto Exit; 406323124Sdes } 407323124Sdes 40876262Sgreen /* 40976262Sgreen * For reference objects created via the RefOf, Index, or Load/LoadTable 41076262Sgreen * operators, we need to get to the base object (as per the ACPI 411126277Sdes * specification of the ObjectType and SizeOf operators). This means 41261209Skris * traversing the list of possibly many nested references. 413181111Sdes */ 414181111Sdes while (ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) 415106130Sdes { 416323124Sdes switch (ObjDesc->Reference.Class) 417323124Sdes { 418323124Sdes case ACPI_REFCLASS_REFOF: 419126277Sdes case ACPI_REFCLASS_NAME: 42061209Skris 42161209Skris /* Dereference the reference pointer */ 42261209Skris 42361209Skris if (ObjDesc->Reference.Class == ACPI_REFCLASS_REFOF) 42457429Smarkm { 42557429Smarkm Node = ObjDesc->Reference.Object; 42660573Skris } 42760573Skris else /* AML_INT_NAMEPATH_OP */ 42860573Skris { 42957429Smarkm Node = ObjDesc->Reference.Node; 43057429Smarkm } 431162856Sdes 43257429Smarkm /* All "References" point to a NS node */ 433181111Sdes 434181111Sdes if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) 43561209Skris { 436162856Sdes ACPI_ERROR ((AE_INFO, 43761209Skris "Not a namespace node %p [%s]", 438162856Sdes Node, AcpiUtGetDescriptorName (Node))); 439162856Sdes return_ACPI_STATUS (AE_AML_INTERNAL); 440162856Sdes } 441162856Sdes 44257429Smarkm /* Get the attached object */ 44361209Skris 44457429Smarkm ObjDesc = AcpiNsGetAttachedObject (Node); 44557429Smarkm if (!ObjDesc) 44657429Smarkm { 44757429Smarkm /* No object, use the NS node type */ 44857429Smarkm 44957429Smarkm Type = AcpiNsGetType (Node); 450162856Sdes goto Exit; 45157429Smarkm } 452181111Sdes 453181111Sdes /* Check for circular references */ 45461209Skris 455162856Sdes if (ObjDesc == Operand) 45661209Skris { 457162856Sdes return_ACPI_STATUS (AE_AML_CIRCULAR_REFERENCE); 458162856Sdes } 459162856Sdes break; 460162856Sdes 46157429Smarkm case ACPI_REFCLASS_INDEX: 46261209Skris 46357429Smarkm /* Get the type of this reference (index into another object) */ 46461209Skris 46557429Smarkm Type = ObjDesc->Reference.TargetType; 46657429Smarkm if (Type != ACPI_TYPE_PACKAGE) 46757429Smarkm { 46857429Smarkm goto Exit; 46957429Smarkm } 47057429Smarkm 47192559Sdes /* 472162856Sdes * The main object is a package, we want to get the type 47357429Smarkm * of the individual package element that is referenced by 47474500Sgreen * the index. 47592559Sdes * 47692559Sdes * This could of course in turn be another reference object. 47757429Smarkm */ 47857429Smarkm ObjDesc = *(ObjDesc->Reference.Where); 47957429Smarkm if (!ObjDesc) 48060573Skris { 48192559Sdes /* NULL package elements are allowed */ 48292559Sdes 48392559Sdes Type = 0; /* Uninitialized */ 484181111Sdes goto Exit; 485181111Sdes } 48661209Skris break; 48761209Skris 48860573Skris case ACPI_REFCLASS_TABLE: 48957429Smarkm 49057429Smarkm Type = ACPI_TYPE_DDB_HANDLE; 49157429Smarkm goto Exit; 49257429Smarkm 49357429Smarkm case ACPI_REFCLASS_LOCAL: 49474500Sgreen case ACPI_REFCLASS_ARG: 49592559Sdes 49692559Sdes if (ReturnDesc) 49774500Sgreen { 49874500Sgreen Status = AcpiDsMethodDataGetValue (ObjDesc->Reference.Class, 49974500Sgreen ObjDesc->Reference.Value, WalkState, &ObjDesc); 50074500Sgreen if (ACPI_FAILURE (Status)) 50174500Sgreen { 50276262Sgreen return_ACPI_STATUS (Status); 50374500Sgreen } 50474500Sgreen AcpiUtRemoveReference (ObjDesc); 50574500Sgreen } 50657429Smarkm else 50757429Smarkm { 50857429Smarkm Status = AcpiDsMethodDataGetNode (ObjDesc->Reference.Class, 50957429Smarkm ObjDesc->Reference.Value, WalkState, &Node); 51057429Smarkm if (ACPI_FAILURE (Status)) 51157429Smarkm { 51257429Smarkm return_ACPI_STATUS (Status); 51357429Smarkm } 51457429Smarkm 51557429Smarkm ObjDesc = AcpiNsGetAttachedObject (Node); 51657429Smarkm if (!ObjDesc) 51757429Smarkm { 51857429Smarkm Type = ACPI_TYPE_ANY; 51957429Smarkm goto Exit; 52092559Sdes } 52176262Sgreen } 52257429Smarkm break; 52357429Smarkm 52457429Smarkm case ACPI_REFCLASS_DEBUG: 52557429Smarkm 52657429Smarkm /* The Debug Object is of type "DebugObject" */ 52757429Smarkm 52857429Smarkm Type = ACPI_TYPE_DEBUG_OBJECT; 52957429Smarkm goto Exit; 53057429Smarkm 53157429Smarkm default: 53257429Smarkm 53357429Smarkm ACPI_ERROR ((AE_INFO, 53457429Smarkm "Unknown Reference Class 0x%2.2X", 53557429Smarkm ObjDesc->Reference.Class)); 53657429Smarkm return_ACPI_STATUS (AE_AML_INTERNAL); 53757429Smarkm } 53857429Smarkm } 53957429Smarkm 54057429Smarkm /* 54157429Smarkm * Now we are guaranteed to have an object that has not been created 54257429Smarkm * via the RefOf or Index operators. 54357429Smarkm */ 54457429Smarkm Type = ObjDesc->Common.Type; 54592559Sdes 54676262Sgreen 54760573SkrisExit: 548295367Sdes /* Convert internal types to external types */ 54960573Skris 55060573Skris switch (Type) 55157429Smarkm { 55257429Smarkm case ACPI_TYPE_LOCAL_REGION_FIELD: 55357429Smarkm case ACPI_TYPE_LOCAL_BANK_FIELD: 55457429Smarkm case ACPI_TYPE_LOCAL_INDEX_FIELD: 55557429Smarkm 55657429Smarkm Type = ACPI_TYPE_FIELD_UNIT; 55757429Smarkm break; 55860573Skris 55960573Skris case ACPI_TYPE_LOCAL_SCOPE: 56057429Smarkm 56176262Sgreen /* Per ACPI Specification, Scope is untyped */ 562137019Sdes 563137019Sdes Type = ACPI_TYPE_ANY; 56460573Skris break; 56560573Skris 56657429Smarkm default: 567255767Sdes 56876262Sgreen /* No change to Type required */ 56976262Sgreen 57057429Smarkm break; 57157429Smarkm } 57257429Smarkm 57357429Smarkm *ReturnType = Type; 57457429Smarkm if (ReturnDesc) 57557429Smarkm { 57698941Sdes *ReturnDesc = ObjDesc; 57757429Smarkm } 578157019Sdes return_ACPI_STATUS (AE_OK); 579157019Sdes} 580157019Sdes