1*11225SDana.Myers@Sun.COM /****************************************************************************** 2*11225SDana.Myers@Sun.COM * 3*11225SDana.Myers@Sun.COM * Module Name: nsrepair - Repair for objects returned by predefined methods 4*11225SDana.Myers@Sun.COM * 5*11225SDana.Myers@Sun.COM *****************************************************************************/ 6*11225SDana.Myers@Sun.COM 7*11225SDana.Myers@Sun.COM /****************************************************************************** 8*11225SDana.Myers@Sun.COM * 9*11225SDana.Myers@Sun.COM * 1. Copyright Notice 10*11225SDana.Myers@Sun.COM * 11*11225SDana.Myers@Sun.COM * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. 12*11225SDana.Myers@Sun.COM * All rights reserved. 13*11225SDana.Myers@Sun.COM * 14*11225SDana.Myers@Sun.COM * 2. License 15*11225SDana.Myers@Sun.COM * 16*11225SDana.Myers@Sun.COM * 2.1. This is your license from Intel Corp. under its intellectual property 17*11225SDana.Myers@Sun.COM * rights. You may have additional license terms from the party that provided 18*11225SDana.Myers@Sun.COM * you this software, covering your right to use that party's intellectual 19*11225SDana.Myers@Sun.COM * property rights. 20*11225SDana.Myers@Sun.COM * 21*11225SDana.Myers@Sun.COM * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 22*11225SDana.Myers@Sun.COM * copy of the source code appearing in this file ("Covered Code") an 23*11225SDana.Myers@Sun.COM * irrevocable, perpetual, worldwide license under Intel's copyrights in the 24*11225SDana.Myers@Sun.COM * base code distributed originally by Intel ("Original Intel Code") to copy, 25*11225SDana.Myers@Sun.COM * make derivatives, distribute, use and display any portion of the Covered 26*11225SDana.Myers@Sun.COM * Code in any form, with the right to sublicense such rights; and 27*11225SDana.Myers@Sun.COM * 28*11225SDana.Myers@Sun.COM * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 29*11225SDana.Myers@Sun.COM * license (with the right to sublicense), under only those claims of Intel 30*11225SDana.Myers@Sun.COM * patents that are infringed by the Original Intel Code, to make, use, sell, 31*11225SDana.Myers@Sun.COM * offer to sell, and import the Covered Code and derivative works thereof 32*11225SDana.Myers@Sun.COM * solely to the minimum extent necessary to exercise the above copyright 33*11225SDana.Myers@Sun.COM * license, and in no event shall the patent license extend to any additions 34*11225SDana.Myers@Sun.COM * to or modifications of the Original Intel Code. No other license or right 35*11225SDana.Myers@Sun.COM * is granted directly or by implication, estoppel or otherwise; 36*11225SDana.Myers@Sun.COM * 37*11225SDana.Myers@Sun.COM * The above copyright and patent license is granted only if the following 38*11225SDana.Myers@Sun.COM * conditions are met: 39*11225SDana.Myers@Sun.COM * 40*11225SDana.Myers@Sun.COM * 3. Conditions 41*11225SDana.Myers@Sun.COM * 42*11225SDana.Myers@Sun.COM * 3.1. Redistribution of Source with Rights to Further Distribute Source. 43*11225SDana.Myers@Sun.COM * Redistribution of source code of any substantial portion of the Covered 44*11225SDana.Myers@Sun.COM * Code or modification with rights to further distribute source must include 45*11225SDana.Myers@Sun.COM * the above Copyright Notice, the above License, this list of Conditions, 46*11225SDana.Myers@Sun.COM * and the following Disclaimer and Export Compliance provision. In addition, 47*11225SDana.Myers@Sun.COM * Licensee must cause all Covered Code to which Licensee contributes to 48*11225SDana.Myers@Sun.COM * contain a file documenting the changes Licensee made to create that Covered 49*11225SDana.Myers@Sun.COM * Code and the date of any change. Licensee must include in that file the 50*11225SDana.Myers@Sun.COM * documentation of any changes made by any predecessor Licensee. Licensee 51*11225SDana.Myers@Sun.COM * must include a prominent statement that the modification is derived, 52*11225SDana.Myers@Sun.COM * directly or indirectly, from Original Intel Code. 53*11225SDana.Myers@Sun.COM * 54*11225SDana.Myers@Sun.COM * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 55*11225SDana.Myers@Sun.COM * Redistribution of source code of any substantial portion of the Covered 56*11225SDana.Myers@Sun.COM * Code or modification without rights to further distribute source must 57*11225SDana.Myers@Sun.COM * include the following Disclaimer and Export Compliance provision in the 58*11225SDana.Myers@Sun.COM * documentation and/or other materials provided with distribution. In 59*11225SDana.Myers@Sun.COM * addition, Licensee may not authorize further sublicense of source of any 60*11225SDana.Myers@Sun.COM * portion of the Covered Code, and must include terms to the effect that the 61*11225SDana.Myers@Sun.COM * license from Licensee to its licensee is limited to the intellectual 62*11225SDana.Myers@Sun.COM * property embodied in the software Licensee provides to its licensee, and 63*11225SDana.Myers@Sun.COM * not to intellectual property embodied in modifications its licensee may 64*11225SDana.Myers@Sun.COM * make. 65*11225SDana.Myers@Sun.COM * 66*11225SDana.Myers@Sun.COM * 3.3. Redistribution of Executable. Redistribution in executable form of any 67*11225SDana.Myers@Sun.COM * substantial portion of the Covered Code or modification must reproduce the 68*11225SDana.Myers@Sun.COM * above Copyright Notice, and the following Disclaimer and Export Compliance 69*11225SDana.Myers@Sun.COM * provision in the documentation and/or other materials provided with the 70*11225SDana.Myers@Sun.COM * distribution. 71*11225SDana.Myers@Sun.COM * 72*11225SDana.Myers@Sun.COM * 3.4. Intel retains all right, title, and interest in and to the Original 73*11225SDana.Myers@Sun.COM * Intel Code. 74*11225SDana.Myers@Sun.COM * 75*11225SDana.Myers@Sun.COM * 3.5. Neither the name Intel nor any other trademark owned or controlled by 76*11225SDana.Myers@Sun.COM * Intel shall be used in advertising or otherwise to promote the sale, use or 77*11225SDana.Myers@Sun.COM * other dealings in products derived from or relating to the Covered Code 78*11225SDana.Myers@Sun.COM * without prior written authorization from Intel. 79*11225SDana.Myers@Sun.COM * 80*11225SDana.Myers@Sun.COM * 4. Disclaimer and Export Compliance 81*11225SDana.Myers@Sun.COM * 82*11225SDana.Myers@Sun.COM * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 83*11225SDana.Myers@Sun.COM * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 84*11225SDana.Myers@Sun.COM * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 85*11225SDana.Myers@Sun.COM * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 86*11225SDana.Myers@Sun.COM * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 87*11225SDana.Myers@Sun.COM * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 88*11225SDana.Myers@Sun.COM * PARTICULAR PURPOSE. 89*11225SDana.Myers@Sun.COM * 90*11225SDana.Myers@Sun.COM * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 91*11225SDana.Myers@Sun.COM * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 92*11225SDana.Myers@Sun.COM * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 93*11225SDana.Myers@Sun.COM * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 94*11225SDana.Myers@Sun.COM * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 95*11225SDana.Myers@Sun.COM * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 96*11225SDana.Myers@Sun.COM * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 97*11225SDana.Myers@Sun.COM * LIMITED REMEDY. 98*11225SDana.Myers@Sun.COM * 99*11225SDana.Myers@Sun.COM * 4.3. Licensee shall not export, either directly or indirectly, any of this 100*11225SDana.Myers@Sun.COM * software or system incorporating such software without first obtaining any 101*11225SDana.Myers@Sun.COM * required license or other approval from the U. S. Department of Commerce or 102*11225SDana.Myers@Sun.COM * any other agency or department of the United States Government. In the 103*11225SDana.Myers@Sun.COM * event Licensee exports any such software from the United States or 104*11225SDana.Myers@Sun.COM * re-exports any such software from a foreign destination, Licensee shall 105*11225SDana.Myers@Sun.COM * ensure that the distribution and export/re-export of the software is in 106*11225SDana.Myers@Sun.COM * compliance with all laws, regulations, orders, or other restrictions of the 107*11225SDana.Myers@Sun.COM * U.S. Export Administration Regulations. Licensee agrees that neither it nor 108*11225SDana.Myers@Sun.COM * any of its subsidiaries will export/re-export any technical data, process, 109*11225SDana.Myers@Sun.COM * software, or service, directly or indirectly, to any country for which the 110*11225SDana.Myers@Sun.COM * United States government or any agency thereof requires an export license, 111*11225SDana.Myers@Sun.COM * other governmental approval, or letter of assurance, without first obtaining 112*11225SDana.Myers@Sun.COM * such license, approval or letter. 113*11225SDana.Myers@Sun.COM * 114*11225SDana.Myers@Sun.COM *****************************************************************************/ 115*11225SDana.Myers@Sun.COM 116*11225SDana.Myers@Sun.COM #define __NSREPAIR_C__ 117*11225SDana.Myers@Sun.COM 118*11225SDana.Myers@Sun.COM #include "acpi.h" 119*11225SDana.Myers@Sun.COM #include "accommon.h" 120*11225SDana.Myers@Sun.COM #include "acnamesp.h" 121*11225SDana.Myers@Sun.COM #include "acinterp.h" 122*11225SDana.Myers@Sun.COM #include "acpredef.h" 123*11225SDana.Myers@Sun.COM 124*11225SDana.Myers@Sun.COM #define _COMPONENT ACPI_NAMESPACE 125*11225SDana.Myers@Sun.COM ACPI_MODULE_NAME ("nsrepair") 126*11225SDana.Myers@Sun.COM 127*11225SDana.Myers@Sun.COM 128*11225SDana.Myers@Sun.COM /******************************************************************************* 129*11225SDana.Myers@Sun.COM * 130*11225SDana.Myers@Sun.COM * FUNCTION: AcpiNsRepairObject 131*11225SDana.Myers@Sun.COM * 132*11225SDana.Myers@Sun.COM * PARAMETERS: Data - Pointer to validation data structure 133*11225SDana.Myers@Sun.COM * ExpectedBtypes - Object types expected 134*11225SDana.Myers@Sun.COM * PackageIndex - Index of object within parent package (if 135*11225SDana.Myers@Sun.COM * applicable - ACPI_NOT_PACKAGE_ELEMENT 136*11225SDana.Myers@Sun.COM * otherwise) 137*11225SDana.Myers@Sun.COM * ReturnObjectPtr - Pointer to the object returned from the 138*11225SDana.Myers@Sun.COM * evaluation of a method or object 139*11225SDana.Myers@Sun.COM * 140*11225SDana.Myers@Sun.COM * RETURN: Status. AE_OK if repair was successful. 141*11225SDana.Myers@Sun.COM * 142*11225SDana.Myers@Sun.COM * DESCRIPTION: Attempt to repair/convert a return object of a type that was 143*11225SDana.Myers@Sun.COM * not expected. 144*11225SDana.Myers@Sun.COM * 145*11225SDana.Myers@Sun.COM ******************************************************************************/ 146*11225SDana.Myers@Sun.COM 147*11225SDana.Myers@Sun.COM ACPI_STATUS 148*11225SDana.Myers@Sun.COM AcpiNsRepairObject ( 149*11225SDana.Myers@Sun.COM ACPI_PREDEFINED_DATA *Data, 150*11225SDana.Myers@Sun.COM UINT32 ExpectedBtypes, 151*11225SDana.Myers@Sun.COM UINT32 PackageIndex, 152*11225SDana.Myers@Sun.COM ACPI_OPERAND_OBJECT **ReturnObjectPtr) 153*11225SDana.Myers@Sun.COM { 154*11225SDana.Myers@Sun.COM ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; 155*11225SDana.Myers@Sun.COM ACPI_OPERAND_OBJECT *NewObject; 156*11225SDana.Myers@Sun.COM ACPI_SIZE Length; 157*11225SDana.Myers@Sun.COM ACPI_STATUS Status; 158*11225SDana.Myers@Sun.COM 159*11225SDana.Myers@Sun.COM 160*11225SDana.Myers@Sun.COM /* 161*11225SDana.Myers@Sun.COM * At this point, we know that the type of the returned object was not 162*11225SDana.Myers@Sun.COM * one of the expected types for this predefined name. Attempt to 163*11225SDana.Myers@Sun.COM * repair the object. Only a limited number of repairs are possible. 164*11225SDana.Myers@Sun.COM */ 165*11225SDana.Myers@Sun.COM switch (ReturnObject->Common.Type) 166*11225SDana.Myers@Sun.COM { 167*11225SDana.Myers@Sun.COM case ACPI_TYPE_BUFFER: 168*11225SDana.Myers@Sun.COM 169*11225SDana.Myers@Sun.COM /* Does the method/object legally return a string? */ 170*11225SDana.Myers@Sun.COM 171*11225SDana.Myers@Sun.COM if (!(ExpectedBtypes & ACPI_RTYPE_STRING)) 172*11225SDana.Myers@Sun.COM { 173*11225SDana.Myers@Sun.COM return (AE_AML_OPERAND_TYPE); 174*11225SDana.Myers@Sun.COM } 175*11225SDana.Myers@Sun.COM 176*11225SDana.Myers@Sun.COM /* 177*11225SDana.Myers@Sun.COM * Have a Buffer, expected a String, convert. Use a ToString 178*11225SDana.Myers@Sun.COM * conversion, no transform performed on the buffer data. The best 179*11225SDana.Myers@Sun.COM * example of this is the _BIF method, where the string data from 180*11225SDana.Myers@Sun.COM * the battery is often (incorrectly) returned as buffer object(s). 181*11225SDana.Myers@Sun.COM */ 182*11225SDana.Myers@Sun.COM Length = 0; 183*11225SDana.Myers@Sun.COM while ((Length < ReturnObject->Buffer.Length) && 184*11225SDana.Myers@Sun.COM (ReturnObject->Buffer.Pointer[Length])) 185*11225SDana.Myers@Sun.COM { 186*11225SDana.Myers@Sun.COM Length++; 187*11225SDana.Myers@Sun.COM } 188*11225SDana.Myers@Sun.COM 189*11225SDana.Myers@Sun.COM /* Allocate a new string object */ 190*11225SDana.Myers@Sun.COM 191*11225SDana.Myers@Sun.COM NewObject = AcpiUtCreateStringObject (Length); 192*11225SDana.Myers@Sun.COM if (!NewObject) 193*11225SDana.Myers@Sun.COM { 194*11225SDana.Myers@Sun.COM return (AE_NO_MEMORY); 195*11225SDana.Myers@Sun.COM } 196*11225SDana.Myers@Sun.COM 197*11225SDana.Myers@Sun.COM /* 198*11225SDana.Myers@Sun.COM * Copy the raw buffer data with no transform. String is already NULL 199*11225SDana.Myers@Sun.COM * terminated at Length+1. 200*11225SDana.Myers@Sun.COM */ 201*11225SDana.Myers@Sun.COM ACPI_MEMCPY (NewObject->String.Pointer, 202*11225SDana.Myers@Sun.COM ReturnObject->Buffer.Pointer, Length); 203*11225SDana.Myers@Sun.COM break; 204*11225SDana.Myers@Sun.COM 205*11225SDana.Myers@Sun.COM 206*11225SDana.Myers@Sun.COM case ACPI_TYPE_INTEGER: 207*11225SDana.Myers@Sun.COM 208*11225SDana.Myers@Sun.COM /* 1) Does the method/object legally return a buffer? */ 209*11225SDana.Myers@Sun.COM 210*11225SDana.Myers@Sun.COM if (ExpectedBtypes & ACPI_RTYPE_BUFFER) 211*11225SDana.Myers@Sun.COM { 212*11225SDana.Myers@Sun.COM /* 213*11225SDana.Myers@Sun.COM * Convert the Integer to a packed-byte buffer. _MAT needs 214*11225SDana.Myers@Sun.COM * this sometimes, if a read has been performed on a Field 215*11225SDana.Myers@Sun.COM * object that is less than or equal to the global integer 216*11225SDana.Myers@Sun.COM * size (32 or 64 bits). 217*11225SDana.Myers@Sun.COM */ 218*11225SDana.Myers@Sun.COM Status = AcpiExConvertToBuffer (ReturnObject, &NewObject); 219*11225SDana.Myers@Sun.COM if (ACPI_FAILURE (Status)) 220*11225SDana.Myers@Sun.COM { 221*11225SDana.Myers@Sun.COM return (Status); 222*11225SDana.Myers@Sun.COM } 223*11225SDana.Myers@Sun.COM } 224*11225SDana.Myers@Sun.COM 225*11225SDana.Myers@Sun.COM /* 2) Does the method/object legally return a string? */ 226*11225SDana.Myers@Sun.COM 227*11225SDana.Myers@Sun.COM else if (ExpectedBtypes & ACPI_RTYPE_STRING) 228*11225SDana.Myers@Sun.COM { 229*11225SDana.Myers@Sun.COM /* 230*11225SDana.Myers@Sun.COM * The only supported Integer-to-String conversion is to convert 231*11225SDana.Myers@Sun.COM * an integer of value 0 to a NULL string. The last element of 232*11225SDana.Myers@Sun.COM * _BIF and _BIX packages occasionally need this fix. 233*11225SDana.Myers@Sun.COM */ 234*11225SDana.Myers@Sun.COM if (ReturnObject->Integer.Value != 0) 235*11225SDana.Myers@Sun.COM { 236*11225SDana.Myers@Sun.COM return (AE_AML_OPERAND_TYPE); 237*11225SDana.Myers@Sun.COM } 238*11225SDana.Myers@Sun.COM 239*11225SDana.Myers@Sun.COM /* Allocate a new NULL string object */ 240*11225SDana.Myers@Sun.COM 241*11225SDana.Myers@Sun.COM NewObject = AcpiUtCreateStringObject (0); 242*11225SDana.Myers@Sun.COM if (!NewObject) 243*11225SDana.Myers@Sun.COM { 244*11225SDana.Myers@Sun.COM return (AE_NO_MEMORY); 245*11225SDana.Myers@Sun.COM } 246*11225SDana.Myers@Sun.COM } 247*11225SDana.Myers@Sun.COM else 248*11225SDana.Myers@Sun.COM { 249*11225SDana.Myers@Sun.COM return (AE_AML_OPERAND_TYPE); 250*11225SDana.Myers@Sun.COM } 251*11225SDana.Myers@Sun.COM break; 252*11225SDana.Myers@Sun.COM 253*11225SDana.Myers@Sun.COM 254*11225SDana.Myers@Sun.COM default: 255*11225SDana.Myers@Sun.COM 256*11225SDana.Myers@Sun.COM /* We cannot repair this object */ 257*11225SDana.Myers@Sun.COM 258*11225SDana.Myers@Sun.COM return (AE_AML_OPERAND_TYPE); 259*11225SDana.Myers@Sun.COM } 260*11225SDana.Myers@Sun.COM 261*11225SDana.Myers@Sun.COM /* Object was successfully repaired */ 262*11225SDana.Myers@Sun.COM 263*11225SDana.Myers@Sun.COM /* 264*11225SDana.Myers@Sun.COM * If the original object is a package element, we need to: 265*11225SDana.Myers@Sun.COM * 1. Set the reference count of the new object to match the 266*11225SDana.Myers@Sun.COM * reference count of the old object. 267*11225SDana.Myers@Sun.COM * 2. Decrement the reference count of the original object. 268*11225SDana.Myers@Sun.COM */ 269*11225SDana.Myers@Sun.COM if (PackageIndex != ACPI_NOT_PACKAGE_ELEMENT) 270*11225SDana.Myers@Sun.COM { 271*11225SDana.Myers@Sun.COM NewObject->Common.ReferenceCount = 272*11225SDana.Myers@Sun.COM ReturnObject->Common.ReferenceCount; 273*11225SDana.Myers@Sun.COM 274*11225SDana.Myers@Sun.COM if (ReturnObject->Common.ReferenceCount > 1) 275*11225SDana.Myers@Sun.COM { 276*11225SDana.Myers@Sun.COM ReturnObject->Common.ReferenceCount--; 277*11225SDana.Myers@Sun.COM } 278*11225SDana.Myers@Sun.COM 279*11225SDana.Myers@Sun.COM ACPI_INFO_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, 280*11225SDana.Myers@Sun.COM "Converted %s to expected %s at index %u", 281*11225SDana.Myers@Sun.COM AcpiUtGetObjectTypeName (ReturnObject), 282*11225SDana.Myers@Sun.COM AcpiUtGetObjectTypeName (NewObject), PackageIndex)); 283*11225SDana.Myers@Sun.COM } 284*11225SDana.Myers@Sun.COM else 285*11225SDana.Myers@Sun.COM { 286*11225SDana.Myers@Sun.COM ACPI_INFO_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, 287*11225SDana.Myers@Sun.COM "Converted %s to expected %s", 288*11225SDana.Myers@Sun.COM AcpiUtGetObjectTypeName (ReturnObject), 289*11225SDana.Myers@Sun.COM AcpiUtGetObjectTypeName (NewObject))); 290*11225SDana.Myers@Sun.COM } 291*11225SDana.Myers@Sun.COM 292*11225SDana.Myers@Sun.COM /* Delete old object, install the new return object */ 293*11225SDana.Myers@Sun.COM 294*11225SDana.Myers@Sun.COM AcpiUtRemoveReference (ReturnObject); 295*11225SDana.Myers@Sun.COM *ReturnObjectPtr = NewObject; 296*11225SDana.Myers@Sun.COM Data->Flags |= ACPI_OBJECT_REPAIRED; 297*11225SDana.Myers@Sun.COM return (AE_OK); 298*11225SDana.Myers@Sun.COM } 299*11225SDana.Myers@Sun.COM 300*11225SDana.Myers@Sun.COM 301*11225SDana.Myers@Sun.COM /******************************************************************************* 302*11225SDana.Myers@Sun.COM * 303*11225SDana.Myers@Sun.COM * FUNCTION: AcpiNsRepairPackageList 304*11225SDana.Myers@Sun.COM * 305*11225SDana.Myers@Sun.COM * PARAMETERS: Data - Pointer to validation data structure 306*11225SDana.Myers@Sun.COM * ObjDescPtr - Pointer to the object to repair. The new 307*11225SDana.Myers@Sun.COM * package object is returned here, 308*11225SDana.Myers@Sun.COM * overwriting the old object. 309*11225SDana.Myers@Sun.COM * 310*11225SDana.Myers@Sun.COM * RETURN: Status, new object in *ObjDescPtr 311*11225SDana.Myers@Sun.COM * 312*11225SDana.Myers@Sun.COM * DESCRIPTION: Repair a common problem with objects that are defined to return 313*11225SDana.Myers@Sun.COM * a variable-length Package of Packages. If the variable-length 314*11225SDana.Myers@Sun.COM * is one, some BIOS code mistakenly simply declares a single 315*11225SDana.Myers@Sun.COM * Package instead of a Package with one sub-Package. This 316*11225SDana.Myers@Sun.COM * function attempts to repair this error by wrapping a Package 317*11225SDana.Myers@Sun.COM * object around the original Package, creating the correct 318*11225SDana.Myers@Sun.COM * Package with one sub-Package. 319*11225SDana.Myers@Sun.COM * 320*11225SDana.Myers@Sun.COM * Names that can be repaired in this manner include: 321*11225SDana.Myers@Sun.COM * _ALR, _CSD, _HPX, _MLS, _PRT, _PSS, _TRT, TSS 322*11225SDana.Myers@Sun.COM * 323*11225SDana.Myers@Sun.COM ******************************************************************************/ 324*11225SDana.Myers@Sun.COM 325*11225SDana.Myers@Sun.COM ACPI_STATUS 326*11225SDana.Myers@Sun.COM AcpiNsRepairPackageList ( 327*11225SDana.Myers@Sun.COM ACPI_PREDEFINED_DATA *Data, 328*11225SDana.Myers@Sun.COM ACPI_OPERAND_OBJECT **ObjDescPtr) 329*11225SDana.Myers@Sun.COM { 330*11225SDana.Myers@Sun.COM ACPI_OPERAND_OBJECT *PkgObjDesc; 331*11225SDana.Myers@Sun.COM 332*11225SDana.Myers@Sun.COM 333*11225SDana.Myers@Sun.COM /* 334*11225SDana.Myers@Sun.COM * Create the new outer package and populate it. The new package will 335*11225SDana.Myers@Sun.COM * have a single element, the lone subpackage. 336*11225SDana.Myers@Sun.COM */ 337*11225SDana.Myers@Sun.COM PkgObjDesc = AcpiUtCreatePackageObject (1); 338*11225SDana.Myers@Sun.COM if (!PkgObjDesc) 339*11225SDana.Myers@Sun.COM { 340*11225SDana.Myers@Sun.COM return (AE_NO_MEMORY); 341*11225SDana.Myers@Sun.COM } 342*11225SDana.Myers@Sun.COM 343*11225SDana.Myers@Sun.COM PkgObjDesc->Package.Elements[0] = *ObjDescPtr; 344*11225SDana.Myers@Sun.COM 345*11225SDana.Myers@Sun.COM /* Return the new object in the object pointer */ 346*11225SDana.Myers@Sun.COM 347*11225SDana.Myers@Sun.COM *ObjDescPtr = PkgObjDesc; 348*11225SDana.Myers@Sun.COM Data->Flags |= ACPI_OBJECT_REPAIRED; 349*11225SDana.Myers@Sun.COM 350*11225SDana.Myers@Sun.COM ACPI_INFO_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, 351*11225SDana.Myers@Sun.COM "Repaired Incorrectly formed Package")); 352*11225SDana.Myers@Sun.COM 353*11225SDana.Myers@Sun.COM return (AE_OK); 354*11225SDana.Myers@Sun.COM } 355