![]() |
|
|||
File indexing completed on 2025-05-11 08:24:02
0001 /****************************************************************************** 0002 * 0003 * Module Name: dspkginit - Completion of deferred package initialization 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 "acnamesp.h" 0155 #include "amlcode.h" 0156 #include "acdispat.h" 0157 #include "acinterp.h" 0158 #include "acparser.h" 0159 0160 0161 #define _COMPONENT ACPI_NAMESPACE 0162 ACPI_MODULE_NAME ("dspkginit") 0163 0164 0165 /* Local prototypes */ 0166 0167 static void 0168 AcpiDsResolvePackageElement ( 0169 ACPI_OPERAND_OBJECT **Element); 0170 0171 0172 /******************************************************************************* 0173 * 0174 * FUNCTION: AcpiDsBuildInternalPackageObj 0175 * 0176 * PARAMETERS: WalkState - Current walk state 0177 * Op - Parser object to be translated 0178 * ElementCount - Number of elements in the package - this is 0179 * the NumElements argument to Package() 0180 * ObjDescPtr - Where the ACPI internal object is returned 0181 * 0182 * RETURN: Status 0183 * 0184 * DESCRIPTION: Translate a parser Op package object to the equivalent 0185 * namespace object 0186 * 0187 * NOTE: The number of elements in the package will be always be the NumElements 0188 * count, regardless of the number of elements in the package list. If 0189 * NumElements is smaller, only that many package list elements are used. 0190 * if NumElements is larger, the Package object is padded out with 0191 * objects of type Uninitialized (as per ACPI spec.) 0192 * 0193 * Even though the ASL compilers do not allow NumElements to be smaller 0194 * than the Package list length (for the fixed length package opcode), some 0195 * BIOS code modifies the AML on the fly to adjust the NumElements, and 0196 * this code compensates for that. This also provides compatibility with 0197 * other AML interpreters. 0198 * 0199 ******************************************************************************/ 0200 0201 ACPI_STATUS 0202 AcpiDsBuildInternalPackageObj ( 0203 ACPI_WALK_STATE *WalkState, 0204 ACPI_PARSE_OBJECT *Op, 0205 UINT32 ElementCount, 0206 ACPI_OPERAND_OBJECT **ObjDescPtr) 0207 { 0208 ACPI_PARSE_OBJECT *Arg; 0209 ACPI_PARSE_OBJECT *Parent; 0210 ACPI_OPERAND_OBJECT *ObjDesc = NULL; 0211 ACPI_STATUS Status = AE_OK; 0212 BOOLEAN ModuleLevelCode = FALSE; 0213 UINT16 ReferenceCount; 0214 UINT32 Index; 0215 UINT32 i; 0216 0217 0218 ACPI_FUNCTION_TRACE (DsBuildInternalPackageObj); 0219 0220 0221 /* Check if we are executing module level code */ 0222 0223 if (WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL) 0224 { 0225 ModuleLevelCode = TRUE; 0226 } 0227 0228 /* Find the parent of a possibly nested package */ 0229 0230 Parent = Op->Common.Parent; 0231 while ((Parent->Common.AmlOpcode == AML_PACKAGE_OP) || 0232 (Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP)) 0233 { 0234 Parent = Parent->Common.Parent; 0235 } 0236 0237 /* 0238 * If we are evaluating a Named package object of the form: 0239 * Name (xxxx, Package) 0240 * the package object already exists, otherwise it must be created. 0241 */ 0242 ObjDesc = *ObjDescPtr; 0243 if (!ObjDesc) 0244 { 0245 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_PACKAGE); 0246 *ObjDescPtr = ObjDesc; 0247 if (!ObjDesc) 0248 { 0249 return_ACPI_STATUS (AE_NO_MEMORY); 0250 } 0251 0252 ObjDesc->Package.Node = Parent->Common.Node; 0253 } 0254 0255 if (ObjDesc->Package.Flags & AOPOBJ_DATA_VALID) /* Just in case */ 0256 { 0257 return_ACPI_STATUS (AE_OK); 0258 } 0259 0260 /* 0261 * Allocate the element array (array of pointers to the individual 0262 * objects) if necessary. the count is based on the NumElements 0263 * parameter. Add an extra pointer slot so that the list is always 0264 * null terminated. 0265 */ 0266 if (!ObjDesc->Package.Elements) 0267 { 0268 ObjDesc->Package.Elements = ACPI_ALLOCATE_ZEROED ( 0269 ((ACPI_SIZE) ElementCount + 1) * sizeof (void *)); 0270 0271 if (!ObjDesc->Package.Elements) 0272 { 0273 AcpiUtDeleteObjectDesc (ObjDesc); 0274 return_ACPI_STATUS (AE_NO_MEMORY); 0275 } 0276 0277 ObjDesc->Package.Count = ElementCount; 0278 } 0279 0280 /* First arg is element count. Second arg begins the initializer list */ 0281 0282 Arg = Op->Common.Value.Arg; 0283 Arg = Arg->Common.Next; 0284 0285 /* 0286 * If we are executing module-level code, we will defer the 0287 * full resolution of the package elements in order to support 0288 * forward references from the elements. This provides 0289 * compatibility with other ACPI implementations. 0290 */ 0291 if (ModuleLevelCode) 0292 { 0293 ObjDesc->Package.AmlStart = WalkState->Aml; 0294 ObjDesc->Package.AmlLength = 0; 0295 0296 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_PARSE, 0297 "%s: Deferring resolution of Package elements\n", 0298 ACPI_GET_FUNCTION_NAME)); 0299 } 0300 0301 /* 0302 * Initialize the elements of the package, up to the NumElements count. 0303 * Package is automatically padded with uninitialized (NULL) elements 0304 * if NumElements is greater than the package list length. Likewise, 0305 * Package is truncated if NumElements is less than the list length. 0306 */ 0307 for (i = 0; Arg && (i < ElementCount); i++) 0308 { 0309 if (Arg->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP) 0310 { 0311 if (!Arg->Common.Node) 0312 { 0313 /* 0314 * This is the case where an expression has returned a value. 0315 * The use of expressions (TermArgs) within individual 0316 * package elements is not supported by the AML interpreter, 0317 * even though the ASL grammar supports it. Example: 0318 * 0319 * Name (INT1, 0x1234) 0320 * 0321 * Name (PKG3, Package () { 0322 * Add (INT1, 0xAAAA0000) 0323 * }) 0324 * 0325 * 1) No known AML interpreter supports this type of construct 0326 * 2) This fixes a fault if the construct is encountered 0327 */ 0328 ACPI_EXCEPTION ((AE_INFO, AE_SUPPORT, 0329 "Expressions within package elements are not supported")); 0330 0331 /* Cleanup the return object, it is not needed */ 0332 0333 AcpiUtRemoveReference (WalkState->Results->Results.ObjDesc[0]); 0334 return_ACPI_STATUS (AE_SUPPORT); 0335 } 0336 0337 if (Arg->Common.Node->Type == ACPI_TYPE_METHOD) 0338 { 0339 /* 0340 * A method reference "looks" to the parser to be a method 0341 * invocation, so we special case it here 0342 */ 0343 Arg->Common.AmlOpcode = AML_INT_NAMEPATH_OP; 0344 Status = AcpiDsBuildInternalObject ( 0345 WalkState, Arg, &ObjDesc->Package.Elements[i]); 0346 } 0347 else 0348 { 0349 /* This package element is already built, just get it */ 0350 0351 ObjDesc->Package.Elements[i] = 0352 ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Arg->Common.Node); 0353 } 0354 } 0355 else 0356 { 0357 Status = AcpiDsBuildInternalObject ( 0358 WalkState, Arg, &ObjDesc->Package.Elements[i]); 0359 if (Status == AE_NOT_FOUND) 0360 { 0361 ACPI_ERROR ((AE_INFO, "%-48s", "****DS namepath not found")); 0362 } 0363 0364 if (!ModuleLevelCode) 0365 { 0366 /* 0367 * Initialize this package element. This function handles the 0368 * resolution of named references within the package. 0369 * Forward references from module-level code are deferred 0370 * until all ACPI tables are loaded. 0371 */ 0372 AcpiDsInitPackageElement (0, ObjDesc->Package.Elements[i], 0373 NULL, &ObjDesc->Package.Elements[i]); 0374 } 0375 } 0376 0377 if (*ObjDescPtr) 0378 { 0379 /* Existing package, get existing reference count */ 0380 0381 ReferenceCount = (*ObjDescPtr)->Common.ReferenceCount; 0382 if (ReferenceCount > 1) 0383 { 0384 /* Make new element ref count match original ref count */ 0385 /* TBD: Probably need an AcpiUtAddReferences function */ 0386 0387 for (Index = 0; Index < ((UINT32) ReferenceCount - 1); Index++) 0388 { 0389 AcpiUtAddReference ((ObjDesc->Package.Elements[i])); 0390 } 0391 } 0392 } 0393 0394 Arg = Arg->Common.Next; 0395 } 0396 0397 /* Check for match between NumElements and actual length of PackageList */ 0398 0399 if (Arg) 0400 { 0401 /* 0402 * NumElements was exhausted, but there are remaining elements in 0403 * the PackageList. Truncate the package to NumElements. 0404 * 0405 * Note: technically, this is an error, from ACPI spec: "It is an 0406 * error for NumElements to be less than the number of elements in 0407 * the PackageList". However, we just print a message and no 0408 * exception is returned. This provides compatibility with other 0409 * ACPI implementations. Some firmware implementations will alter 0410 * the NumElements on the fly, possibly creating this type of 0411 * ill-formed package object. 0412 */ 0413 while (Arg) 0414 { 0415 /* 0416 * We must delete any package elements that were created earlier 0417 * and are not going to be used because of the package truncation. 0418 */ 0419 if (Arg->Common.Node) 0420 { 0421 AcpiUtRemoveReference ( 0422 ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Arg->Common.Node)); 0423 Arg->Common.Node = NULL; 0424 } 0425 0426 /* Find out how many elements there really are */ 0427 0428 i++; 0429 Arg = Arg->Common.Next; 0430 } 0431 0432 ACPI_INFO (( 0433 "Actual Package length (%u) is larger than " 0434 "NumElements field (%u), truncated", 0435 i, ElementCount)); 0436 } 0437 else if (i < ElementCount) 0438 { 0439 /* 0440 * Arg list (elements) was exhausted, but we did not reach 0441 * NumElements count. 0442 * 0443 * Note: this is not an error, the package is padded out 0444 * with NULLs as per the ACPI specification. 0445 */ 0446 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, 0447 "%s: Package List length (%u) smaller than NumElements " 0448 "count (%u), padded with null elements\n", 0449 ACPI_GET_FUNCTION_NAME, i, ElementCount)); 0450 } 0451 0452 /* Module-level packages will be resolved later */ 0453 0454 if (!ModuleLevelCode) 0455 { 0456 ObjDesc->Package.Flags |= AOPOBJ_DATA_VALID; 0457 } 0458 0459 Op->Common.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjDesc); 0460 return_ACPI_STATUS (Status); 0461 } 0462 0463 0464 /******************************************************************************* 0465 * 0466 * FUNCTION: AcpiDsInitPackageElement 0467 * 0468 * PARAMETERS: ACPI_PKG_CALLBACK 0469 * 0470 * RETURN: Status 0471 * 0472 * DESCRIPTION: Resolve a named reference element within a package object 0473 * 0474 ******************************************************************************/ 0475 0476 ACPI_STATUS 0477 AcpiDsInitPackageElement ( 0478 UINT8 ObjectType, 0479 ACPI_OPERAND_OBJECT *SourceObject, 0480 ACPI_GENERIC_STATE *State, 0481 void *Context) 0482 { 0483 ACPI_OPERAND_OBJECT **ElementPtr; 0484 0485 0486 ACPI_FUNCTION_TRACE (DsInitPackageElement); 0487 0488 0489 if (!SourceObject) 0490 { 0491 return_ACPI_STATUS (AE_OK); 0492 } 0493 0494 /* 0495 * The following code is a bit of a hack to workaround a (current) 0496 * limitation of the ACPI_PKG_CALLBACK interface. We need a pointer 0497 * to the location within the element array because a new object 0498 * may be created and stored there. 0499 */ 0500 if (Context) 0501 { 0502 /* A direct call was made to this function */ 0503 0504 ElementPtr = (ACPI_OPERAND_OBJECT **) Context; 0505 } 0506 else 0507 { 0508 /* Call came from AcpiUtWalkPackageTree */ 0509 0510 ElementPtr = State->Pkg.ThisTargetObj; 0511 } 0512 0513 /* We are only interested in reference objects/elements */ 0514 0515 if (SourceObject->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) 0516 { 0517 /* Attempt to resolve the (named) reference to a namespace node */ 0518 0519 AcpiDsResolvePackageElement (ElementPtr); 0520 } 0521 else if (SourceObject->Common.Type == ACPI_TYPE_PACKAGE) 0522 { 0523 SourceObject->Package.Flags |= AOPOBJ_DATA_VALID; 0524 } 0525 0526 return_ACPI_STATUS (AE_OK); 0527 } 0528 0529 0530 /******************************************************************************* 0531 * 0532 * FUNCTION: AcpiDsResolvePackageElement 0533 * 0534 * PARAMETERS: ElementPtr - Pointer to a reference object 0535 * 0536 * RETURN: Possible new element is stored to the indirect ElementPtr 0537 * 0538 * DESCRIPTION: Resolve a package element that is a reference to a named 0539 * object. 0540 * 0541 ******************************************************************************/ 0542 0543 static void 0544 AcpiDsResolvePackageElement ( 0545 ACPI_OPERAND_OBJECT **ElementPtr) 0546 { 0547 ACPI_STATUS Status; 0548 ACPI_STATUS Status2; 0549 ACPI_GENERIC_STATE ScopeInfo; 0550 ACPI_OPERAND_OBJECT *Element = *ElementPtr; 0551 ACPI_NAMESPACE_NODE *ResolvedNode; 0552 ACPI_NAMESPACE_NODE *OriginalNode; 0553 char *ExternalPath = ""; 0554 ACPI_OBJECT_TYPE Type; 0555 0556 0557 ACPI_FUNCTION_TRACE (DsResolvePackageElement); 0558 0559 0560 /* Check if reference element is already resolved */ 0561 0562 if (Element->Reference.Resolved) 0563 { 0564 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_PARSE, 0565 "%s: Package element is already resolved\n", 0566 ACPI_GET_FUNCTION_NAME)); 0567 0568 return_VOID; 0569 } 0570 0571 /* Element must be a reference object of correct type */ 0572 0573 ScopeInfo.Scope.Node = Element->Reference.Node; /* Prefix node */ 0574 0575 Status = AcpiNsLookup (&ScopeInfo, (char *) Element->Reference.Aml, 0576 ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, 0577 ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, 0578 NULL, &ResolvedNode); 0579 if (ACPI_FAILURE (Status)) 0580 { 0581 if ((Status == AE_NOT_FOUND) && AcpiGbl_IgnorePackageResolutionErrors) 0582 { 0583 /* 0584 * Optionally be silent about the NOT_FOUND case for the referenced 0585 * name. Although this is potentially a serious problem, 0586 * it can generate a lot of noise/errors on platforms whose 0587 * firmware carries around a bunch of unused Package objects. 0588 * To disable these errors, set this global to TRUE: 0589 * AcpiGbl_IgnorePackageResolutionErrors 0590 * 0591 * If the AML actually tries to use such a package, the unresolved 0592 * element(s) will be replaced with NULL elements. 0593 */ 0594 0595 /* Referenced name not found, set the element to NULL */ 0596 0597 AcpiUtRemoveReference (*ElementPtr); 0598 *ElementPtr = NULL; 0599 return_VOID; 0600 } 0601 0602 Status2 = AcpiNsExternalizeName (ACPI_UINT32_MAX, 0603 (char *) Element->Reference.Aml, NULL, &ExternalPath); 0604 0605 ACPI_EXCEPTION ((AE_INFO, Status, 0606 "While resolving a named reference package element - %s", 0607 ExternalPath)); 0608 if (ACPI_SUCCESS (Status2)) 0609 { 0610 ACPI_FREE (ExternalPath); 0611 } 0612 0613 /* Could not resolve name, set the element to NULL */ 0614 0615 AcpiUtRemoveReference (*ElementPtr); 0616 *ElementPtr = NULL; 0617 return_VOID; 0618 } 0619 else if (ResolvedNode->Type == ACPI_TYPE_ANY) 0620 { 0621 /* Named reference not resolved, return a NULL package element */ 0622 0623 ACPI_ERROR ((AE_INFO, 0624 "Could not resolve named package element [%4.4s] in [%4.4s]", 0625 ResolvedNode->Name.Ascii, ScopeInfo.Scope.Node->Name.Ascii)); 0626 *ElementPtr = NULL; 0627 return_VOID; 0628 } 0629 0630 /* 0631 * Special handling for Alias objects. We need ResolvedNode to point 0632 * to the Alias target. This effectively "resolves" the alias. 0633 */ 0634 if (ResolvedNode->Type == ACPI_TYPE_LOCAL_ALIAS) 0635 { 0636 ResolvedNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, 0637 ResolvedNode->Object); 0638 } 0639 0640 /* Update the reference object */ 0641 0642 Element->Reference.Resolved = TRUE; 0643 Element->Reference.Node = ResolvedNode; 0644 Type = Element->Reference.Node->Type; 0645 0646 /* 0647 * Attempt to resolve the node to a value before we insert it into 0648 * the package. If this is a reference to a common data type, 0649 * resolve it immediately. According to the ACPI spec, package 0650 * elements can only be "data objects" or method references. 0651 * Attempt to resolve to an Integer, Buffer, String or Package. 0652 * If cannot, return the named reference (for things like Devices, 0653 * Methods, etc.) Buffer Fields and Fields will resolve to simple 0654 * objects (int/buf/str/pkg). 0655 * 0656 * NOTE: References to things like Devices, Methods, Mutexes, etc. 0657 * will remain as named references. This behavior is not described 0658 * in the ACPI spec, but it appears to be an oversight. 0659 */ 0660 OriginalNode = ResolvedNode; 0661 Status = AcpiExResolveNodeToValue (&ResolvedNode, NULL); 0662 if (ACPI_FAILURE (Status)) 0663 { 0664 return_VOID; 0665 } 0666 0667 switch (Type) 0668 { 0669 /* 0670 * These object types are a result of named references, so we will 0671 * leave them as reference objects. In other words, these types 0672 * have no intrinsic "value". 0673 */ 0674 case ACPI_TYPE_DEVICE: 0675 case ACPI_TYPE_THERMAL: 0676 case ACPI_TYPE_METHOD: 0677 break; 0678 0679 case ACPI_TYPE_MUTEX: 0680 case ACPI_TYPE_POWER: 0681 case ACPI_TYPE_PROCESSOR: 0682 case ACPI_TYPE_EVENT: 0683 case ACPI_TYPE_REGION: 0684 0685 /* AcpiExResolveNodeToValue gave these an extra reference */ 0686 0687 AcpiUtRemoveReference (OriginalNode->Object); 0688 break; 0689 0690 default: 0691 /* 0692 * For all other types - the node was resolved to an actual 0693 * operand object with a value, return the object. Remove 0694 * a reference on the existing object. 0695 */ 0696 AcpiUtRemoveReference (Element); 0697 *ElementPtr = (ACPI_OPERAND_OBJECT *) ResolvedNode; 0698 break; 0699 } 0700 0701 return_VOID; 0702 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |