Path: blob/main/sys/contrib/dev/acpica/components/namespace/nsrepair.c
48524 views
/******************************************************************************1*2* Module Name: nsrepair - Repair for objects returned by predefined methods3*4*****************************************************************************/56/******************************************************************************7*8* 1. Copyright Notice9*10* Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp.11* All rights reserved.12*13* 2. License14*15* 2.1. This is your license from Intel Corp. under its intellectual property16* rights. You may have additional license terms from the party that provided17* you this software, covering your right to use that party's intellectual18* property rights.19*20* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a21* copy of the source code appearing in this file ("Covered Code") an22* irrevocable, perpetual, worldwide license under Intel's copyrights in the23* base code distributed originally by Intel ("Original Intel Code") to copy,24* make derivatives, distribute, use and display any portion of the Covered25* Code in any form, with the right to sublicense such rights; and26*27* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent28* license (with the right to sublicense), under only those claims of Intel29* patents that are infringed by the Original Intel Code, to make, use, sell,30* offer to sell, and import the Covered Code and derivative works thereof31* solely to the minimum extent necessary to exercise the above copyright32* license, and in no event shall the patent license extend to any additions33* to or modifications of the Original Intel Code. No other license or right34* is granted directly or by implication, estoppel or otherwise;35*36* The above copyright and patent license is granted only if the following37* conditions are met:38*39* 3. Conditions40*41* 3.1. Redistribution of Source with Rights to Further Distribute Source.42* Redistribution of source code of any substantial portion of the Covered43* Code or modification with rights to further distribute source must include44* the above Copyright Notice, the above License, this list of Conditions,45* and the following Disclaimer and Export Compliance provision. In addition,46* Licensee must cause all Covered Code to which Licensee contributes to47* contain a file documenting the changes Licensee made to create that Covered48* Code and the date of any change. Licensee must include in that file the49* documentation of any changes made by any predecessor Licensee. Licensee50* must include a prominent statement that the modification is derived,51* directly or indirectly, from Original Intel Code.52*53* 3.2. Redistribution of Source with no Rights to Further Distribute Source.54* Redistribution of source code of any substantial portion of the Covered55* Code or modification without rights to further distribute source must56* include the following Disclaimer and Export Compliance provision in the57* documentation and/or other materials provided with distribution. In58* addition, Licensee may not authorize further sublicense of source of any59* portion of the Covered Code, and must include terms to the effect that the60* license from Licensee to its licensee is limited to the intellectual61* property embodied in the software Licensee provides to its licensee, and62* not to intellectual property embodied in modifications its licensee may63* make.64*65* 3.3. Redistribution of Executable. Redistribution in executable form of any66* substantial portion of the Covered Code or modification must reproduce the67* above Copyright Notice, and the following Disclaimer and Export Compliance68* provision in the documentation and/or other materials provided with the69* distribution.70*71* 3.4. Intel retains all right, title, and interest in and to the Original72* Intel Code.73*74* 3.5. Neither the name Intel nor any other trademark owned or controlled by75* Intel shall be used in advertising or otherwise to promote the sale, use or76* other dealings in products derived from or relating to the Covered Code77* without prior written authorization from Intel.78*79* 4. Disclaimer and Export Compliance80*81* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED82* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE83* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,84* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY85* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY86* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A87* PARTICULAR PURPOSE.88*89* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES90* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR91* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,92* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY93* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL94* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS95* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY96* LIMITED REMEDY.97*98* 4.3. Licensee shall not export, either directly or indirectly, any of this99* software or system incorporating such software without first obtaining any100* required license or other approval from the U. S. Department of Commerce or101* any other agency or department of the United States Government. In the102* event Licensee exports any such software from the United States or103* re-exports any such software from a foreign destination, Licensee shall104* ensure that the distribution and export/re-export of the software is in105* compliance with all laws, regulations, orders, or other restrictions of the106* U.S. Export Administration Regulations. Licensee agrees that neither it nor107* any of its subsidiaries will export/re-export any technical data, process,108* software, or service, directly or indirectly, to any country for which the109* United States government or any agency thereof requires an export license,110* other governmental approval, or letter of assurance, without first obtaining111* such license, approval or letter.112*113*****************************************************************************114*115* Alternatively, you may choose to be licensed under the terms of the116* following license:117*118* Redistribution and use in source and binary forms, with or without119* modification, are permitted provided that the following conditions120* are met:121* 1. Redistributions of source code must retain the above copyright122* notice, this list of conditions, and the following disclaimer,123* without modification.124* 2. Redistributions in binary form must reproduce at minimum a disclaimer125* substantially similar to the "NO WARRANTY" disclaimer below126* ("Disclaimer") and any redistribution must be conditioned upon127* including a substantially similar Disclaimer requirement for further128* binary redistribution.129* 3. Neither the names of the above-listed copyright holders nor the names130* of any contributors may be used to endorse or promote products derived131* from this software without specific prior written permission.132*133* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS134* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT135* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR136* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT137* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,138* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT139* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,140* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY141* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT142* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE143* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.144*145* Alternatively, you may choose to be licensed under the terms of the146* GNU General Public License ("GPL") version 2 as published by the Free147* Software Foundation.148*149*****************************************************************************/150151#include <contrib/dev/acpica/include/acpi.h>152#include <contrib/dev/acpica/include/accommon.h>153#include <contrib/dev/acpica/include/acnamesp.h>154#include <contrib/dev/acpica/include/acinterp.h>155#include <contrib/dev/acpica/include/acpredef.h>156#include <contrib/dev/acpica/include/amlresrc.h>157158#define _COMPONENT ACPI_NAMESPACE159ACPI_MODULE_NAME ("nsrepair")160161162/*******************************************************************************163*164* This module attempts to repair or convert objects returned by the165* predefined methods to an object type that is expected, as per the ACPI166* specification. The need for this code is dictated by the many machines that167* return incorrect types for the standard predefined methods. Performing these168* conversions here, in one place, eliminates the need for individual ACPI169* device drivers to do the same. Note: Most of these conversions are different170* than the internal object conversion routines used for implicit object171* conversion.172*173* The following conversions can be performed as necessary:174*175* Integer -> String176* Integer -> Buffer177* String -> Integer178* String -> Buffer179* Buffer -> Integer180* Buffer -> String181* Buffer -> Package of Integers182* Package -> Package of one Package183*184* Additional conversions that are available:185* Convert a null return or zero return value to an EndTag descriptor186* Convert an ASCII string to a Unicode buffer187*188* An incorrect standalone object is wrapped with required outer package189*190* Additional possible repairs:191* Required package elements that are NULL replaced by Integer/String/Buffer192*193******************************************************************************/194195196/* Local prototypes */197198static const ACPI_SIMPLE_REPAIR_INFO *199AcpiNsMatchSimpleRepair (200ACPI_NAMESPACE_NODE *Node,201UINT32 ReturnBtype,202UINT32 PackageIndex);203204205/*206* Special but simple repairs for some names.207*208* 2nd argument: Unexpected types that can be repaired209*/210static const ACPI_SIMPLE_REPAIR_INFO AcpiObjectRepairInfo[] =211{212/* Resource descriptor conversions */213214{ "_CRS", ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER | ACPI_RTYPE_NONE,215ACPI_NOT_PACKAGE_ELEMENT,216AcpiNsConvertToResource },217{ "_DMA", ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER | ACPI_RTYPE_NONE,218ACPI_NOT_PACKAGE_ELEMENT,219AcpiNsConvertToResource },220{ "_PRS", ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER | ACPI_RTYPE_NONE,221ACPI_NOT_PACKAGE_ELEMENT,222AcpiNsConvertToResource },223224/* Object reference conversions */225226{ "_DEP", ACPI_RTYPE_STRING, ACPI_ALL_PACKAGE_ELEMENTS,227AcpiNsConvertToReference },228229/* Unicode conversions */230231{ "_MLS", ACPI_RTYPE_STRING, 1,232AcpiNsConvertToUnicode },233{ "_STR", ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER,234ACPI_NOT_PACKAGE_ELEMENT,235AcpiNsConvertToUnicode },236{ {0,0,0,0}, 0, 0, NULL } /* Table terminator */237};238239240/*******************************************************************************241*242* FUNCTION: AcpiNsSimpleRepair243*244* PARAMETERS: Info - Method execution information block245* ExpectedBtypes - Object types expected246* PackageIndex - Index of object within parent package (if247* applicable - ACPI_NOT_PACKAGE_ELEMENT248* otherwise)249* ReturnObjectPtr - Pointer to the object returned from the250* evaluation of a method or object251*252* RETURN: Status. AE_OK if repair was successful.253*254* DESCRIPTION: Attempt to repair/convert a return object of a type that was255* not expected.256*257******************************************************************************/258259ACPI_STATUS260AcpiNsSimpleRepair (261ACPI_EVALUATE_INFO *Info,262UINT32 ExpectedBtypes,263UINT32 PackageIndex,264ACPI_OPERAND_OBJECT **ReturnObjectPtr)265{266ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr;267ACPI_OPERAND_OBJECT *NewObject = NULL;268ACPI_STATUS Status;269const ACPI_SIMPLE_REPAIR_INFO *Predefined;270271272ACPI_FUNCTION_NAME (NsSimpleRepair);273274275/*276* Special repairs for certain names that are in the repair table.277* Check if this name is in the list of repairable names.278*/279Predefined = AcpiNsMatchSimpleRepair (Info->Node,280Info->ReturnBtype, PackageIndex);281if (Predefined)282{283if (!ReturnObject)284{285ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname,286ACPI_WARN_ALWAYS, "Missing expected return value"));287}288289Status = Predefined->ObjectConverter (Info->Node, ReturnObject,290&NewObject);291if (ACPI_FAILURE (Status))292{293/* A fatal error occurred during a conversion */294295ACPI_EXCEPTION ((AE_INFO, Status,296"During return object analysis"));297return (Status);298}299if (NewObject)300{301goto ObjectRepaired;302}303}304305/*306* Do not perform simple object repair unless the return type is not307* expected.308*/309if (Info->ReturnBtype & ExpectedBtypes)310{311return (AE_OK);312}313314/*315* At this point, we know that the type of the returned object was not316* one of the expected types for this predefined name. Attempt to317* repair the object by converting it to one of the expected object318* types for this predefined name.319*/320321/*322* If there is no return value, check if we require a return value for323* this predefined name. Either one return value is expected, or none,324* for both methods and other objects.325*326* Try to fix if there was no return object. Warning if failed to fix.327*/328if (!ReturnObject)329{330if (ExpectedBtypes)331{332if (!(ExpectedBtypes & ACPI_RTYPE_NONE) &&333PackageIndex != ACPI_NOT_PACKAGE_ELEMENT)334{335ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname,336ACPI_WARN_ALWAYS, "Found unexpected NULL package element"));337338Status = AcpiNsRepairNullElement (Info, ExpectedBtypes,339PackageIndex, ReturnObjectPtr);340if (ACPI_SUCCESS (Status))341{342return (AE_OK); /* Repair was successful */343}344}345346if (ExpectedBtypes != ACPI_RTYPE_NONE)347{348ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname,349ACPI_WARN_ALWAYS,350"Missing expected return value"));351return (AE_AML_NO_RETURN_VALUE);352}353}354}355356if (ExpectedBtypes & ACPI_RTYPE_INTEGER)357{358Status = AcpiNsConvertToInteger (ReturnObject, &NewObject);359if (ACPI_SUCCESS (Status))360{361goto ObjectRepaired;362}363}364if (ExpectedBtypes & ACPI_RTYPE_STRING)365{366Status = AcpiNsConvertToString (ReturnObject, &NewObject);367if (ACPI_SUCCESS (Status))368{369goto ObjectRepaired;370}371}372if (ExpectedBtypes & ACPI_RTYPE_BUFFER)373{374Status = AcpiNsConvertToBuffer (ReturnObject, &NewObject);375if (ACPI_SUCCESS (Status))376{377goto ObjectRepaired;378}379}380if (ExpectedBtypes & ACPI_RTYPE_PACKAGE)381{382/*383* A package is expected. We will wrap the existing object with a384* new package object. It is often the case that if a variable-length385* package is required, but there is only a single object needed, the386* BIOS will return that object instead of wrapping it with a Package387* object. Note: after the wrapping, the package will be validated388* for correct contents (expected object type or types).389*/390Status = AcpiNsWrapWithPackage (Info, ReturnObject, &NewObject);391if (ACPI_SUCCESS (Status))392{393/*394* The original object just had its reference count395* incremented for being inserted into the new package.396*/397*ReturnObjectPtr = NewObject; /* New Package object */398Info->ReturnFlags |= ACPI_OBJECT_REPAIRED;399return (AE_OK);400}401}402403/* We cannot repair this object */404405return (AE_AML_OPERAND_TYPE);406407408ObjectRepaired:409410/* Object was successfully repaired */411412if (PackageIndex != ACPI_NOT_PACKAGE_ELEMENT)413{414/* Update reference count of new object */415416if (!(Info->ReturnFlags & ACPI_OBJECT_WRAPPED))417{418NewObject->Common.ReferenceCount =419ReturnObject->Common.ReferenceCount;420}421422ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,423"%s: Converted %s to expected %s at Package index %u\n",424Info->FullPathname, AcpiUtGetObjectTypeName (ReturnObject),425AcpiUtGetObjectTypeName (NewObject), PackageIndex));426}427else428{429ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,430"%s: Converted %s to expected %s\n",431Info->FullPathname, AcpiUtGetObjectTypeName (ReturnObject),432AcpiUtGetObjectTypeName (NewObject)));433}434435/* Delete old object, install the new return object */436437AcpiUtRemoveReference (ReturnObject);438*ReturnObjectPtr = NewObject;439Info->ReturnFlags |= ACPI_OBJECT_REPAIRED;440return (AE_OK);441}442443444/******************************************************************************445*446* FUNCTION: AcpiNsMatchSimpleRepair447*448* PARAMETERS: Node - Namespace node for the method/object449* ReturnBtype - Object type that was returned450* PackageIndex - Index of object within parent package (if451* applicable - ACPI_NOT_PACKAGE_ELEMENT452* otherwise)453*454* RETURN: Pointer to entry in repair table. NULL indicates not found.455*456* DESCRIPTION: Check an object name against the repairable object list.457*458*****************************************************************************/459460static const ACPI_SIMPLE_REPAIR_INFO *461AcpiNsMatchSimpleRepair (462ACPI_NAMESPACE_NODE *Node,463UINT32 ReturnBtype,464UINT32 PackageIndex)465{466const ACPI_SIMPLE_REPAIR_INFO *ThisName;467468469/* Search info table for a repairable predefined method/object name */470471ThisName = AcpiObjectRepairInfo;472while (ThisName->ObjectConverter)473{474if (ACPI_COMPARE_NAMESEG (Node->Name.Ascii, ThisName->Name))475{476/* Check if we can actually repair this name/type combination */477478if ((ReturnBtype & ThisName->UnexpectedBtypes) &&479(ThisName->PackageIndex == ACPI_ALL_PACKAGE_ELEMENTS ||480PackageIndex == ThisName->PackageIndex))481{482return (ThisName);483}484485return (NULL);486}487488ThisName++;489}490491return (NULL); /* Name was not found in the repair table */492}493494495/*******************************************************************************496*497* FUNCTION: AcpiNsRepairNullElement498*499* PARAMETERS: Info - Method execution information block500* ExpectedBtypes - Object types expected501* PackageIndex - Index of object within parent package (if502* applicable - ACPI_NOT_PACKAGE_ELEMENT503* otherwise)504* ReturnObjectPtr - Pointer to the object returned from the505* evaluation of a method or object506*507* RETURN: Status. AE_OK if repair was successful.508*509* DESCRIPTION: Attempt to repair a NULL element of a returned Package object.510*511******************************************************************************/512513ACPI_STATUS514AcpiNsRepairNullElement (515ACPI_EVALUATE_INFO *Info,516UINT32 ExpectedBtypes,517UINT32 PackageIndex,518ACPI_OPERAND_OBJECT **ReturnObjectPtr)519{520ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr;521ACPI_OPERAND_OBJECT *NewObject;522523524ACPI_FUNCTION_NAME (NsRepairNullElement);525526527/* No repair needed if return object is non-NULL */528529if (ReturnObject)530{531return (AE_OK);532}533534/*535* Attempt to repair a NULL element of a Package object. This applies to536* predefined names that return a fixed-length package and each element537* is required. It does not apply to variable-length packages where NULL538* elements are allowed, especially at the end of the package.539*/540if (ExpectedBtypes & ACPI_RTYPE_INTEGER)541{542/* Need an Integer - create a zero-value integer */543544NewObject = AcpiUtCreateIntegerObject ((UINT64) 0);545}546else if (ExpectedBtypes & ACPI_RTYPE_STRING)547{548/* Need a String - create a NULL string */549550NewObject = AcpiUtCreateStringObject (0);551}552else if (ExpectedBtypes & ACPI_RTYPE_BUFFER)553{554/* Need a Buffer - create a zero-length buffer */555556NewObject = AcpiUtCreateBufferObject (0);557}558else559{560/* Error for all other expected types */561562return (AE_AML_OPERAND_TYPE);563}564565if (!NewObject)566{567return (AE_NO_MEMORY);568}569570/* Set the reference count according to the parent Package object */571572NewObject->Common.ReferenceCount =573Info->ParentPackage->Common.ReferenceCount;574575ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,576"%s: Converted NULL package element to expected %s at index %u\n",577Info->FullPathname, AcpiUtGetObjectTypeName (NewObject),578PackageIndex));579580*ReturnObjectPtr = NewObject;581Info->ReturnFlags |= ACPI_OBJECT_REPAIRED;582return (AE_OK);583}584585586/******************************************************************************587*588* FUNCTION: AcpiNsRemoveNullElements589*590* PARAMETERS: Info - Method execution information block591* PackageType - An AcpiReturnPackageTypes value592* ObjDesc - A Package object593*594* RETURN: None.595*596* DESCRIPTION: Remove all NULL package elements from packages that contain597* a variable number of subpackages. For these types of598* packages, NULL elements can be safely removed.599*600*****************************************************************************/601602void603AcpiNsRemoveNullElements (604ACPI_EVALUATE_INFO *Info,605UINT8 PackageType,606ACPI_OPERAND_OBJECT *ObjDesc)607{608ACPI_OPERAND_OBJECT **Source;609ACPI_OPERAND_OBJECT **Dest;610UINT32 Count;611UINT32 NewCount;612UINT32 i;613614615ACPI_FUNCTION_NAME (NsRemoveNullElements);616617618/*619* We can safely remove all NULL elements from these package types:620* PTYPE1_VAR packages contain a variable number of simple data types.621* PTYPE2 packages contain a variable number of subpackages.622*/623switch (PackageType)624{625case ACPI_PTYPE1_VAR:626case ACPI_PTYPE2:627case ACPI_PTYPE2_COUNT:628case ACPI_PTYPE2_PKG_COUNT:629case ACPI_PTYPE2_FIXED:630case ACPI_PTYPE2_MIN:631case ACPI_PTYPE2_REV_FIXED:632case ACPI_PTYPE2_FIX_VAR:633break;634635default:636case ACPI_PTYPE2_VAR_VAR:637case ACPI_PTYPE1_FIXED:638case ACPI_PTYPE1_OPTION:639return;640}641642Count = ObjDesc->Package.Count;643NewCount = Count;644645Source = ObjDesc->Package.Elements;646Dest = Source;647648/* Examine all elements of the package object, remove nulls */649650for (i = 0; i < Count; i++)651{652if (!*Source)653{654NewCount--;655}656else657{658*Dest = *Source;659Dest++;660}661662Source++;663}664665/* Update parent package if any null elements were removed */666667if (NewCount < Count)668{669ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,670"%s: Found and removed %u NULL elements\n",671Info->FullPathname, (Count - NewCount)));672673/* NULL terminate list and update the package count */674675*Dest = NULL;676ObjDesc->Package.Count = NewCount;677}678}679680681/*******************************************************************************682*683* FUNCTION: AcpiNsWrapWithPackage684*685* PARAMETERS: Info - Method execution information block686* OriginalObject - Pointer to the object to repair.687* ObjDescPtr - The new package object is returned here688*689* RETURN: Status, new object in *ObjDescPtr690*691* DESCRIPTION: Repair a common problem with objects that are defined to692* return a variable-length Package of sub-objects. If there is693* only one sub-object, some BIOS code mistakenly simply declares694* the single object instead of a Package with one sub-object.695* This function attempts to repair this error by wrapping a696* Package object around the original object, creating the697* correct and expected Package with one sub-object.698*699* Names that can be repaired in this manner include:700* _ALR, _CSD, _HPX, _MLS, _PLD, _PRT, _PSS, _TRT, _TSS,701* _BCL, _DOD, _FIX, _Sx702*703******************************************************************************/704705ACPI_STATUS706AcpiNsWrapWithPackage (707ACPI_EVALUATE_INFO *Info,708ACPI_OPERAND_OBJECT *OriginalObject,709ACPI_OPERAND_OBJECT **ObjDescPtr)710{711ACPI_OPERAND_OBJECT *PkgObjDesc;712713714ACPI_FUNCTION_NAME (NsWrapWithPackage);715716717/*718* Create the new outer package and populate it. The new719* package will have a single element, the lone sub-object.720*/721PkgObjDesc = AcpiUtCreatePackageObject (1);722if (!PkgObjDesc)723{724return (AE_NO_MEMORY);725}726727PkgObjDesc->Package.Elements[0] = OriginalObject;728729ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,730"%s: Wrapped %s with expected Package object\n",731Info->FullPathname, AcpiUtGetObjectTypeName (OriginalObject)));732733/* Return the new object in the object pointer */734735*ObjDescPtr = PkgObjDesc;736Info->ReturnFlags |= ACPI_OBJECT_REPAIRED | ACPI_OBJECT_WRAPPED;737return (AE_OK);738}739740741