![]() |
|
|||
File indexing completed on 2025-05-11 08:24:02
0001 /****************************************************************************** 0002 * 0003 * Module Name: exresolv - AML Interpreter object resolution 0004 * 0005 *****************************************************************************/ 0006 0007 /****************************************************************************** 0008 * 0009 * 1. Copyright Notice 0010 * 0011 * Some or all of this work - Copyright (c) 1999 - 2024, Intel Corp. 0012 * All rights reserved. 0013 * 0014 * 2. License 0015 * 0016 * 2.1. This is your license from Intel Corp. under its intellectual property 0017 * rights. You may have additional license terms from the party that provided 0018 * you this software, covering your right to use that party's intellectual 0019 * property rights. 0020 * 0021 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 0022 * copy of the source code appearing in this file ("Covered Code") an 0023 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 0024 * base code distributed originally by Intel ("Original Intel Code") to copy, 0025 * make derivatives, distribute, use and display any portion of the Covered 0026 * Code in any form, with the right to sublicense such rights; and 0027 * 0028 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 0029 * license (with the right to sublicense), under only those claims of Intel 0030 * patents that are infringed by the Original Intel Code, to make, use, sell, 0031 * offer to sell, and import the Covered Code and derivative works thereof 0032 * solely to the minimum extent necessary to exercise the above copyright 0033 * license, and in no event shall the patent license extend to any additions 0034 * to or modifications of the Original Intel Code. No other license or right 0035 * is granted directly or by implication, estoppel or otherwise; 0036 * 0037 * The above copyright and patent license is granted only if the following 0038 * conditions are met: 0039 * 0040 * 3. Conditions 0041 * 0042 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 0043 * Redistribution of source code of any substantial portion of the Covered 0044 * Code or modification with rights to further distribute source must include 0045 * the above Copyright Notice, the above License, this list of Conditions, 0046 * and the following Disclaimer and Export Compliance provision. In addition, 0047 * Licensee must cause all Covered Code to which Licensee contributes to 0048 * contain a file documenting the changes Licensee made to create that Covered 0049 * Code and the date of any change. Licensee must include in that file the 0050 * documentation of any changes made by any predecessor Licensee. Licensee 0051 * must include a prominent statement that the modification is derived, 0052 * directly or indirectly, from Original Intel Code. 0053 * 0054 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 0055 * Redistribution of source code of any substantial portion of the Covered 0056 * Code or modification without rights to further distribute source must 0057 * include the following Disclaimer and Export Compliance provision in the 0058 * documentation and/or other materials provided with distribution. In 0059 * addition, Licensee may not authorize further sublicense of source of any 0060 * portion of the Covered Code, and must include terms to the effect that the 0061 * license from Licensee to its licensee is limited to the intellectual 0062 * property embodied in the software Licensee provides to its licensee, and 0063 * not to intellectual property embodied in modifications its licensee may 0064 * make. 0065 * 0066 * 3.3. Redistribution of Executable. Redistribution in executable form of any 0067 * substantial portion of the Covered Code or modification must reproduce the 0068 * above Copyright Notice, and the following Disclaimer and Export Compliance 0069 * provision in the documentation and/or other materials provided with the 0070 * distribution. 0071 * 0072 * 3.4. Intel retains all right, title, and interest in and to the Original 0073 * Intel Code. 0074 * 0075 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 0076 * Intel shall be used in advertising or otherwise to promote the sale, use or 0077 * other dealings in products derived from or relating to the Covered Code 0078 * without prior written authorization from Intel. 0079 * 0080 * 4. Disclaimer and Export Compliance 0081 * 0082 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 0083 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 0084 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 0085 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 0086 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 0087 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 0088 * PARTICULAR PURPOSE. 0089 * 0090 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 0091 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 0092 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 0093 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 0094 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 0095 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 0096 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 0097 * LIMITED REMEDY. 0098 * 0099 * 4.3. Licensee shall not export, either directly or indirectly, any of this 0100 * software or system incorporating such software without first obtaining any 0101 * required license or other approval from the U. S. Department of Commerce or 0102 * any other agency or department of the United States Government. In the 0103 * event Licensee exports any such software from the United States or 0104 * re-exports any such software from a foreign destination, Licensee shall 0105 * ensure that the distribution and export/re-export of the software is in 0106 * compliance with all laws, regulations, orders, or other restrictions of the 0107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 0108 * any of its subsidiaries will export/re-export any technical data, process, 0109 * software, or service, directly or indirectly, to any country for which the 0110 * United States government or any agency thereof requires an export license, 0111 * other governmental approval, or letter of assurance, without first obtaining 0112 * such license, approval or letter. 0113 * 0114 ***************************************************************************** 0115 * 0116 * Alternatively, you may choose to be licensed under the terms of the 0117 * following license: 0118 * 0119 * Redistribution and use in source and binary forms, with or without 0120 * modification, are permitted provided that the following conditions 0121 * are met: 0122 * 1. Redistributions of source code must retain the above copyright 0123 * notice, this list of conditions, and the following disclaimer, 0124 * without modification. 0125 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 0126 * substantially similar to the "NO WARRANTY" disclaimer below 0127 * ("Disclaimer") and any redistribution must be conditioned upon 0128 * including a substantially similar Disclaimer requirement for further 0129 * binary redistribution. 0130 * 3. Neither the names of the above-listed copyright holders nor the names 0131 * of any contributors may be used to endorse or promote products derived 0132 * from this software without specific prior written permission. 0133 * 0134 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 0135 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 0136 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 0137 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 0138 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 0139 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 0140 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 0141 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 0142 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 0143 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 0144 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 0145 * 0146 * Alternatively, you may choose to be licensed under the terms of the 0147 * GNU General Public License ("GPL") version 2 as published by the Free 0148 * Software Foundation. 0149 * 0150 *****************************************************************************/ 0151 0152 #include "acpi.h" 0153 #include "accommon.h" 0154 #include "amlcode.h" 0155 #include "acdispat.h" 0156 #include "acinterp.h" 0157 #include "acnamesp.h" 0158 0159 0160 #define _COMPONENT ACPI_EXECUTER 0161 ACPI_MODULE_NAME ("exresolv") 0162 0163 /* Local prototypes */ 0164 0165 static ACPI_STATUS 0166 AcpiExResolveObjectToValue ( 0167 ACPI_OPERAND_OBJECT **StackPtr, 0168 ACPI_WALK_STATE *WalkState); 0169 0170 0171 /******************************************************************************* 0172 * 0173 * FUNCTION: AcpiExResolveToValue 0174 * 0175 * PARAMETERS: **StackPtr - Points to entry on ObjStack, which can 0176 * be either an (ACPI_OPERAND_OBJECT *) 0177 * or an ACPI_HANDLE. 0178 * WalkState - Current method state 0179 * 0180 * RETURN: Status 0181 * 0182 * DESCRIPTION: Convert Reference objects to values 0183 * 0184 ******************************************************************************/ 0185 0186 ACPI_STATUS 0187 AcpiExResolveToValue ( 0188 ACPI_OPERAND_OBJECT **StackPtr, 0189 ACPI_WALK_STATE *WalkState) 0190 { 0191 ACPI_STATUS Status; 0192 0193 0194 ACPI_FUNCTION_TRACE_PTR (ExResolveToValue, StackPtr); 0195 0196 0197 if (!StackPtr || !*StackPtr) 0198 { 0199 ACPI_ERROR ((AE_INFO, "Internal - null pointer")); 0200 return_ACPI_STATUS (AE_AML_NO_OPERAND); 0201 } 0202 0203 /* 0204 * The entity pointed to by the StackPtr can be either 0205 * 1) A valid ACPI_OPERAND_OBJECT, or 0206 * 2) A ACPI_NAMESPACE_NODE (NamedObj) 0207 */ 0208 if (ACPI_GET_DESCRIPTOR_TYPE (*StackPtr) == ACPI_DESC_TYPE_OPERAND) 0209 { 0210 Status = AcpiExResolveObjectToValue (StackPtr, WalkState); 0211 if (ACPI_FAILURE (Status)) 0212 { 0213 return_ACPI_STATUS (Status); 0214 } 0215 0216 if (!*StackPtr) 0217 { 0218 ACPI_ERROR ((AE_INFO, "Internal - null pointer")); 0219 return_ACPI_STATUS (AE_AML_NO_OPERAND); 0220 } 0221 } 0222 0223 /* 0224 * Object on the stack may have changed if AcpiExResolveObjectToValue() 0225 * was called (i.e., we can't use an _else_ here.) 0226 */ 0227 if (ACPI_GET_DESCRIPTOR_TYPE (*StackPtr) == ACPI_DESC_TYPE_NAMED) 0228 { 0229 Status = AcpiExResolveNodeToValue ( 0230 ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, StackPtr), 0231 WalkState); 0232 if (ACPI_FAILURE (Status)) 0233 { 0234 return_ACPI_STATUS (Status); 0235 } 0236 } 0237 0238 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Resolved object %p\n", *StackPtr)); 0239 return_ACPI_STATUS (AE_OK); 0240 } 0241 0242 0243 /******************************************************************************* 0244 * 0245 * FUNCTION: AcpiExResolveObjectToValue 0246 * 0247 * PARAMETERS: StackPtr - Pointer to an internal object 0248 * WalkState - Current method state 0249 * 0250 * RETURN: Status 0251 * 0252 * DESCRIPTION: Retrieve the value from an internal object. The Reference type 0253 * uses the associated AML opcode to determine the value. 0254 * 0255 ******************************************************************************/ 0256 0257 static ACPI_STATUS 0258 AcpiExResolveObjectToValue ( 0259 ACPI_OPERAND_OBJECT **StackPtr, 0260 ACPI_WALK_STATE *WalkState) 0261 { 0262 ACPI_STATUS Status = AE_OK; 0263 ACPI_OPERAND_OBJECT *StackDesc; 0264 ACPI_OPERAND_OBJECT *ObjDesc = NULL; 0265 UINT8 RefType; 0266 0267 0268 ACPI_FUNCTION_TRACE (ExResolveObjectToValue); 0269 0270 0271 StackDesc = *StackPtr; 0272 0273 /* This is an object of type ACPI_OPERAND_OBJECT */ 0274 0275 switch (StackDesc->Common.Type) 0276 { 0277 case ACPI_TYPE_LOCAL_REFERENCE: 0278 0279 RefType = StackDesc->Reference.Class; 0280 0281 switch (RefType) 0282 { 0283 case ACPI_REFCLASS_LOCAL: 0284 case ACPI_REFCLASS_ARG: 0285 /* 0286 * Get the local from the method's state info 0287 * Note: this increments the local's object reference count 0288 */ 0289 Status = AcpiDsMethodDataGetValue (RefType, 0290 StackDesc->Reference.Value, WalkState, &ObjDesc); 0291 if (ACPI_FAILURE (Status)) 0292 { 0293 return_ACPI_STATUS (Status); 0294 } 0295 0296 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Arg/Local %X] ValueObj is %p\n", 0297 StackDesc->Reference.Value, ObjDesc)); 0298 0299 /* 0300 * Now we can delete the original Reference Object and 0301 * replace it with the resolved value 0302 */ 0303 AcpiUtRemoveReference (StackDesc); 0304 *StackPtr = ObjDesc; 0305 break; 0306 0307 case ACPI_REFCLASS_INDEX: 0308 0309 switch (StackDesc->Reference.TargetType) 0310 { 0311 case ACPI_TYPE_BUFFER_FIELD: 0312 0313 /* Just return - do not dereference */ 0314 break; 0315 0316 case ACPI_TYPE_PACKAGE: 0317 0318 /* If method call or CopyObject - do not dereference */ 0319 0320 if ((WalkState->Opcode == AML_INT_METHODCALL_OP) || 0321 (WalkState->Opcode == AML_COPY_OBJECT_OP)) 0322 { 0323 break; 0324 } 0325 0326 /* Otherwise, dereference the PackageIndex to a package element */ 0327 0328 ObjDesc = *StackDesc->Reference.Where; 0329 if (ObjDesc) 0330 { 0331 /* 0332 * Valid object descriptor, copy pointer to return value 0333 * (i.e., dereference the package index) 0334 * Delete the ref object, increment the returned object 0335 */ 0336 AcpiUtAddReference (ObjDesc); 0337 *StackPtr = ObjDesc; 0338 } 0339 else 0340 { 0341 /* 0342 * A NULL object descriptor means an uninitialized element of 0343 * the package, can't dereference it 0344 */ 0345 ACPI_ERROR ((AE_INFO, 0346 "Attempt to dereference an Index to " 0347 "NULL package element Idx=%p", 0348 StackDesc)); 0349 Status = AE_AML_UNINITIALIZED_ELEMENT; 0350 } 0351 break; 0352 0353 default: 0354 0355 /* Invalid reference object */ 0356 0357 ACPI_ERROR ((AE_INFO, 0358 "Unknown TargetType 0x%X in Index/Reference object %p", 0359 StackDesc->Reference.TargetType, StackDesc)); 0360 Status = AE_AML_INTERNAL; 0361 break; 0362 } 0363 break; 0364 0365 case ACPI_REFCLASS_REFOF: 0366 case ACPI_REFCLASS_DEBUG: 0367 case ACPI_REFCLASS_TABLE: 0368 0369 /* Just leave the object as-is, do not dereference */ 0370 0371 break; 0372 0373 case ACPI_REFCLASS_NAME: /* Reference to a named object */ 0374 0375 /* Dereference the name */ 0376 0377 if ((StackDesc->Reference.Node->Type == ACPI_TYPE_DEVICE) || 0378 (StackDesc->Reference.Node->Type == ACPI_TYPE_THERMAL)) 0379 { 0380 /* These node types do not have 'real' subobjects */ 0381 0382 *StackPtr = (void *) StackDesc->Reference.Node; 0383 } 0384 else 0385 { 0386 /* Get the object pointed to by the namespace node */ 0387 0388 *StackPtr = (StackDesc->Reference.Node)->Object; 0389 AcpiUtAddReference (*StackPtr); 0390 } 0391 0392 AcpiUtRemoveReference (StackDesc); 0393 break; 0394 0395 default: 0396 0397 ACPI_ERROR ((AE_INFO, 0398 "Unknown Reference type 0x%X in %p", 0399 RefType, StackDesc)); 0400 Status = AE_AML_INTERNAL; 0401 break; 0402 } 0403 break; 0404 0405 case ACPI_TYPE_BUFFER: 0406 0407 Status = AcpiDsGetBufferArguments (StackDesc); 0408 break; 0409 0410 case ACPI_TYPE_PACKAGE: 0411 0412 Status = AcpiDsGetPackageArguments (StackDesc); 0413 break; 0414 0415 case ACPI_TYPE_BUFFER_FIELD: 0416 case ACPI_TYPE_LOCAL_REGION_FIELD: 0417 case ACPI_TYPE_LOCAL_BANK_FIELD: 0418 case ACPI_TYPE_LOCAL_INDEX_FIELD: 0419 0420 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 0421 "FieldRead SourceDesc=%p Type=%X\n", 0422 StackDesc, StackDesc->Common.Type)); 0423 0424 Status = AcpiExReadDataFromField (WalkState, StackDesc, &ObjDesc); 0425 0426 /* Remove a reference to the original operand, then override */ 0427 0428 AcpiUtRemoveReference (*StackPtr); 0429 *StackPtr = (void *) ObjDesc; 0430 break; 0431 0432 default: 0433 0434 break; 0435 } 0436 0437 return_ACPI_STATUS (Status); 0438 } 0439 0440 0441 /******************************************************************************* 0442 * 0443 * FUNCTION: AcpiExResolveMultiple 0444 * 0445 * PARAMETERS: WalkState - Current state (contains AML opcode) 0446 * Operand - Starting point for resolution 0447 * ReturnType - Where the object type is returned 0448 * ReturnDesc - Where the resolved object is returned 0449 * 0450 * RETURN: Status 0451 * 0452 * DESCRIPTION: Return the base object and type. Traverse a reference list if 0453 * necessary to get to the base object. 0454 * 0455 ******************************************************************************/ 0456 0457 ACPI_STATUS 0458 AcpiExResolveMultiple ( 0459 ACPI_WALK_STATE *WalkState, 0460 ACPI_OPERAND_OBJECT *Operand, 0461 ACPI_OBJECT_TYPE *ReturnType, 0462 ACPI_OPERAND_OBJECT **ReturnDesc) 0463 { 0464 ACPI_OPERAND_OBJECT *ObjDesc = ACPI_CAST_PTR (void, Operand); 0465 ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Operand); 0466 ACPI_OBJECT_TYPE Type; 0467 ACPI_STATUS Status; 0468 0469 0470 ACPI_FUNCTION_TRACE (AcpiExResolveMultiple); 0471 0472 0473 /* Operand can be either a namespace node or an operand descriptor */ 0474 0475 switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)) 0476 { 0477 case ACPI_DESC_TYPE_OPERAND: 0478 0479 Type = ObjDesc->Common.Type; 0480 break; 0481 0482 case ACPI_DESC_TYPE_NAMED: 0483 0484 Type = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type; 0485 ObjDesc = AcpiNsGetAttachedObject (Node); 0486 0487 /* If we had an Alias node, use the attached object for type info */ 0488 0489 if (Type == ACPI_TYPE_LOCAL_ALIAS) 0490 { 0491 Type = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type; 0492 ObjDesc = AcpiNsGetAttachedObject ( 0493 (ACPI_NAMESPACE_NODE *) ObjDesc); 0494 } 0495 0496 switch (Type) 0497 { 0498 case ACPI_TYPE_DEVICE: 0499 case ACPI_TYPE_THERMAL: 0500 0501 /* These types have no attached subobject */ 0502 break; 0503 0504 default: 0505 0506 /* All other types require a subobject */ 0507 0508 if (!ObjDesc) 0509 { 0510 ACPI_ERROR ((AE_INFO, 0511 "[%4.4s] Node is unresolved or uninitialized", 0512 AcpiUtGetNodeName (Node))); 0513 return_ACPI_STATUS (AE_AML_UNINITIALIZED_NODE); 0514 } 0515 break; 0516 } 0517 break; 0518 0519 default: 0520 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 0521 } 0522 0523 /* If type is anything other than a reference, we are done */ 0524 0525 if (Type != ACPI_TYPE_LOCAL_REFERENCE) 0526 { 0527 goto Exit; 0528 } 0529 0530 /* 0531 * For reference objects created via the RefOf, Index, or Load/LoadTable 0532 * operators, we need to get to the base object (as per the ACPI 0533 * specification of the ObjectType and SizeOf operators). This means 0534 * traversing the list of possibly many nested references. 0535 */ 0536 while (ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) 0537 { 0538 switch (ObjDesc->Reference.Class) 0539 { 0540 case ACPI_REFCLASS_REFOF: 0541 case ACPI_REFCLASS_NAME: 0542 0543 /* Dereference the reference pointer */ 0544 0545 if (ObjDesc->Reference.Class == ACPI_REFCLASS_REFOF) 0546 { 0547 Node = ObjDesc->Reference.Object; 0548 } 0549 else /* AML_INT_NAMEPATH_OP */ 0550 { 0551 Node = ObjDesc->Reference.Node; 0552 } 0553 0554 /* All "References" point to a NS node */ 0555 0556 if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) 0557 { 0558 ACPI_ERROR ((AE_INFO, 0559 "Not a namespace node %p [%s]", 0560 Node, AcpiUtGetDescriptorName (Node))); 0561 return_ACPI_STATUS (AE_AML_INTERNAL); 0562 } 0563 0564 /* Get the attached object */ 0565 0566 ObjDesc = AcpiNsGetAttachedObject (Node); 0567 if (!ObjDesc) 0568 { 0569 /* No object, use the NS node type */ 0570 0571 Type = AcpiNsGetType (Node); 0572 goto Exit; 0573 } 0574 0575 /* Check for circular references */ 0576 0577 if (ObjDesc == Operand) 0578 { 0579 return_ACPI_STATUS (AE_AML_CIRCULAR_REFERENCE); 0580 } 0581 break; 0582 0583 case ACPI_REFCLASS_INDEX: 0584 0585 /* Get the type of this reference (index into another object) */ 0586 0587 Type = ObjDesc->Reference.TargetType; 0588 if (Type != ACPI_TYPE_PACKAGE) 0589 { 0590 goto Exit; 0591 } 0592 0593 /* 0594 * The main object is a package, we want to get the type 0595 * of the individual package element that is referenced by 0596 * the index. 0597 * 0598 * This could of course in turn be another reference object. 0599 */ 0600 ObjDesc = *(ObjDesc->Reference.Where); 0601 if (!ObjDesc) 0602 { 0603 /* NULL package elements are allowed */ 0604 0605 Type = 0; /* Uninitialized */ 0606 goto Exit; 0607 } 0608 break; 0609 0610 case ACPI_REFCLASS_TABLE: 0611 0612 Type = ACPI_TYPE_DDB_HANDLE; 0613 goto Exit; 0614 0615 case ACPI_REFCLASS_LOCAL: 0616 case ACPI_REFCLASS_ARG: 0617 0618 if (ReturnDesc) 0619 { 0620 Status = AcpiDsMethodDataGetValue (ObjDesc->Reference.Class, 0621 ObjDesc->Reference.Value, WalkState, &ObjDesc); 0622 if (ACPI_FAILURE (Status)) 0623 { 0624 return_ACPI_STATUS (Status); 0625 } 0626 AcpiUtRemoveReference (ObjDesc); 0627 } 0628 else 0629 { 0630 Status = AcpiDsMethodDataGetNode (ObjDesc->Reference.Class, 0631 ObjDesc->Reference.Value, WalkState, &Node); 0632 if (ACPI_FAILURE (Status)) 0633 { 0634 return_ACPI_STATUS (Status); 0635 } 0636 0637 ObjDesc = AcpiNsGetAttachedObject (Node); 0638 if (!ObjDesc) 0639 { 0640 Type = ACPI_TYPE_ANY; 0641 goto Exit; 0642 } 0643 } 0644 break; 0645 0646 case ACPI_REFCLASS_DEBUG: 0647 0648 /* The Debug Object is of type "DebugObject" */ 0649 0650 Type = ACPI_TYPE_DEBUG_OBJECT; 0651 goto Exit; 0652 0653 default: 0654 0655 ACPI_ERROR ((AE_INFO, 0656 "Unknown Reference Class 0x%2.2X", 0657 ObjDesc->Reference.Class)); 0658 return_ACPI_STATUS (AE_AML_INTERNAL); 0659 } 0660 } 0661 0662 /* 0663 * Now we are guaranteed to have an object that has not been created 0664 * via the RefOf or Index operators. 0665 */ 0666 Type = ObjDesc->Common.Type; 0667 0668 0669 Exit: 0670 /* Convert internal types to external types */ 0671 0672 switch (Type) 0673 { 0674 case ACPI_TYPE_LOCAL_REGION_FIELD: 0675 case ACPI_TYPE_LOCAL_BANK_FIELD: 0676 case ACPI_TYPE_LOCAL_INDEX_FIELD: 0677 0678 Type = ACPI_TYPE_FIELD_UNIT; 0679 break; 0680 0681 case ACPI_TYPE_LOCAL_SCOPE: 0682 0683 /* Per ACPI Specification, Scope is untyped */ 0684 0685 Type = ACPI_TYPE_ANY; 0686 break; 0687 0688 default: 0689 0690 /* No change to Type required */ 0691 0692 break; 0693 } 0694 0695 *ReturnType = Type; 0696 if (ReturnDesc) 0697 { 0698 *ReturnDesc = ObjDesc; 0699 } 0700 return_ACPI_STATUS (AE_OK); 0701 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |