*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp.
* All rights reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
- * rights. You may have additional license terms from the party that provided
+ * rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
- * to or modifications of the Original Intel Code. No other license or right
+ * to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
- * and the following Disclaimer and Export Compliance provision. In addition,
+ * and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
- * Code and the date of any change. Licensee must include in that file the
- * documentation of any changes made by any predecessor Licensee. Licensee
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
- * documentation and/or other materials provided with distribution. In
+ * documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
- * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
- * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
- * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
- * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
- * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
- * any other agency or department of the United States Government. In the
+ * any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
#include "acnamesp.h"
#include "acinterp.h"
#include "acpredef.h"
+#include "amlresrc.h"
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsrepair")
* Buffer -> Package of Integers
* Package -> Package of one Package
*
- * Additional possible repairs:
+ * Additional conversions that are available:
+ * Convert a null return or zero return value to an EndTag descriptor
+ * Convert an ASCII string to a Unicode buffer
+ *
+ * An incorrect standalone object is wrapped with required outer package
*
+ * Additional possible repairs:
* Required package elements that are NULL replaced by Integer/String/Buffer
- * Incorrect standalone package wrapped with required outer package
*
******************************************************************************/
/* Local prototypes */
-static ACPI_STATUS
-AcpiNsConvertToInteger (
- ACPI_OPERAND_OBJECT *OriginalObject,
- ACPI_OPERAND_OBJECT **ReturnObject);
+static const ACPI_SIMPLE_REPAIR_INFO *
+AcpiNsMatchSimpleRepair (
+ ACPI_NAMESPACE_NODE *Node,
+ UINT32 ReturnBtype,
+ UINT32 PackageIndex);
-static ACPI_STATUS
-AcpiNsConvertToString (
- ACPI_OPERAND_OBJECT *OriginalObject,
- ACPI_OPERAND_OBJECT **ReturnObject);
-static ACPI_STATUS
-AcpiNsConvertToBuffer (
- ACPI_OPERAND_OBJECT *OriginalObject,
- ACPI_OPERAND_OBJECT **ReturnObject);
+/*
+ * Special but simple repairs for some names.
+ *
+ * 2nd argument: Unexpected types that can be repaired
+ */
+static const ACPI_SIMPLE_REPAIR_INFO AcpiObjectRepairInfo[] =
+{
+ /* Resource descriptor conversions */
-static ACPI_STATUS
-AcpiNsConvertToPackage (
- ACPI_OPERAND_OBJECT *OriginalObject,
- ACPI_OPERAND_OBJECT **ReturnObject);
+ { "_CRS", ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER | ACPI_RTYPE_NONE,
+ ACPI_NOT_PACKAGE_ELEMENT,
+ AcpiNsConvertToResource },
+ { "_DMA", ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER | ACPI_RTYPE_NONE,
+ ACPI_NOT_PACKAGE_ELEMENT,
+ AcpiNsConvertToResource },
+ { "_PRS", ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER | ACPI_RTYPE_NONE,
+ ACPI_NOT_PACKAGE_ELEMENT,
+ AcpiNsConvertToResource },
+
+ /* Unicode conversions */
+
+ { "_MLS", ACPI_RTYPE_STRING, 1,
+ AcpiNsConvertToUnicode },
+ { "_STR", ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER,
+ ACPI_NOT_PACKAGE_ELEMENT,
+ AcpiNsConvertToUnicode },
+ { {0,0,0,0}, 0, 0, NULL } /* Table terminator */
+};
/*******************************************************************************
*
- * FUNCTION: AcpiNsRepairObject
+ * FUNCTION: AcpiNsSimpleRepair
*
- * PARAMETERS: Data - Pointer to validation data structure
+ * PARAMETERS: Info - Method execution information block
* ExpectedBtypes - Object types expected
* PackageIndex - Index of object within parent package (if
* applicable - ACPI_NOT_PACKAGE_ELEMENT
******************************************************************************/
ACPI_STATUS
-AcpiNsRepairObject (
- ACPI_PREDEFINED_DATA *Data,
+AcpiNsSimpleRepair (
+ ACPI_EVALUATE_INFO *Info,
UINT32 ExpectedBtypes,
UINT32 PackageIndex,
ACPI_OPERAND_OBJECT **ReturnObjectPtr)
{
ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr;
- ACPI_OPERAND_OBJECT *NewObject;
+ ACPI_OPERAND_OBJECT *NewObject = NULL;
ACPI_STATUS Status;
+ const ACPI_SIMPLE_REPAIR_INFO *Predefined;
+
+
+ ACPI_FUNCTION_NAME (NsSimpleRepair);
+
+ /*
+ * Special repairs for certain names that are in the repair table.
+ * Check if this name is in the list of repairable names.
+ */
+ Predefined = AcpiNsMatchSimpleRepair (Info->Node,
+ Info->ReturnBtype, PackageIndex);
+ if (Predefined)
+ {
+ if (!ReturnObject)
+ {
+ ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname,
+ ACPI_WARN_ALWAYS, "Missing expected return value"));
+ }
- ACPI_FUNCTION_NAME (NsRepairObject);
+ Status = Predefined->ObjectConverter (ReturnObject, &NewObject);
+ if (ACPI_FAILURE (Status))
+ {
+ /* A fatal error occurred during a conversion */
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "During return object analysis"));
+ return (Status);
+ }
+ if (NewObject)
+ {
+ goto ObjectRepaired;
+ }
+ }
+
+ /*
+ * Do not perform simple object repair unless the return type is not
+ * expected.
+ */
+ if (Info->ReturnBtype & ExpectedBtypes)
+ {
+ return (AE_OK);
+ }
/*
* At this point, we know that the type of the returned object was not
* repair the object by converting it to one of the expected object
* types for this predefined name.
*/
+
+ /*
+ * If there is no return value, check if we require a return value for
+ * this predefined name. Either one return value is expected, or none,
+ * for both methods and other objects.
+ *
+ * Try to fix if there was no return object. Warning if failed to fix.
+ */
+ if (!ReturnObject)
+ {
+ if (ExpectedBtypes && (!(ExpectedBtypes & ACPI_RTYPE_NONE)))
+ {
+ if (PackageIndex != ACPI_NOT_PACKAGE_ELEMENT)
+ {
+ ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname,
+ ACPI_WARN_ALWAYS, "Found unexpected NULL package element"));
+
+ Status = AcpiNsRepairNullElement (Info, ExpectedBtypes,
+ PackageIndex, ReturnObjectPtr);
+ if (ACPI_SUCCESS (Status))
+ {
+ return (AE_OK); /* Repair was successful */
+ }
+ }
+ else
+ {
+ ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname,
+ ACPI_WARN_ALWAYS, "Missing expected return value"));
+ }
+
+ return (AE_AML_NO_RETURN_VALUE);
+ }
+ }
+
if (ExpectedBtypes & ACPI_RTYPE_INTEGER)
{
Status = AcpiNsConvertToInteger (ReturnObject, &NewObject);
}
if (ExpectedBtypes & ACPI_RTYPE_PACKAGE)
{
- Status = AcpiNsConvertToPackage (ReturnObject, &NewObject);
+ /*
+ * A package is expected. We will wrap the existing object with a
+ * new package object. It is often the case that if a variable-length
+ * package is required, but there is only a single object needed, the
+ * BIOS will return that object instead of wrapping it with a Package
+ * object. Note: after the wrapping, the package will be validated
+ * for correct contents (expected object type or types).
+ */
+ Status = AcpiNsWrapWithPackage (Info, ReturnObject, &NewObject);
if (ACPI_SUCCESS (Status))
{
- goto ObjectRepaired;
+ /*
+ * The original object just had its reference count
+ * incremented for being inserted into the new package.
+ */
+ *ReturnObjectPtr = NewObject; /* New Package object */
+ Info->ReturnFlags |= ACPI_OBJECT_REPAIRED;
+ return (AE_OK);
}
}
/* Object was successfully repaired */
- /*
- * If the original object is a package element, we need to:
- * 1. Set the reference count of the new object to match the
- * reference count of the old object.
- * 2. Decrement the reference count of the original object.
- */
if (PackageIndex != ACPI_NOT_PACKAGE_ELEMENT)
{
- NewObject->Common.ReferenceCount =
- ReturnObject->Common.ReferenceCount;
-
- if (ReturnObject->Common.ReferenceCount > 1)
+ /*
+ * The original object is a package element. We need to
+ * decrement the reference count of the original object,
+ * for removing it from the package.
+ *
+ * However, if the original object was just wrapped with a
+ * package object as part of the repair, we don't need to
+ * change the reference count.
+ */
+ if (!(Info->ReturnFlags & ACPI_OBJECT_WRAPPED))
{
- ReturnObject->Common.ReferenceCount--;
+ NewObject->Common.ReferenceCount =
+ ReturnObject->Common.ReferenceCount;
+
+ if (ReturnObject->Common.ReferenceCount > 1)
+ {
+ ReturnObject->Common.ReferenceCount--;
+ }
}
ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
- "%s: Converted %s to expected %s at index %u\n",
- Data->Pathname, AcpiUtGetObjectTypeName (ReturnObject),
+ "%s: Converted %s to expected %s at Package index %u\n",
+ Info->FullPathname, AcpiUtGetObjectTypeName (ReturnObject),
AcpiUtGetObjectTypeName (NewObject), PackageIndex));
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
"%s: Converted %s to expected %s\n",
- Data->Pathname, AcpiUtGetObjectTypeName (ReturnObject),
+ Info->FullPathname, AcpiUtGetObjectTypeName (ReturnObject),
AcpiUtGetObjectTypeName (NewObject)));
}
AcpiUtRemoveReference (ReturnObject);
*ReturnObjectPtr = NewObject;
- Data->Flags |= ACPI_OBJECT_REPAIRED;
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiNsConvertToInteger
- *
- * PARAMETERS: OriginalObject - Object to be converted
- * ReturnObject - Where the new converted object is returned
- *
- * RETURN: Status. AE_OK if conversion was successful.
- *
- * DESCRIPTION: Attempt to convert a String/Buffer object to an Integer.
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiNsConvertToInteger (
- ACPI_OPERAND_OBJECT *OriginalObject,
- ACPI_OPERAND_OBJECT **ReturnObject)
-{
- ACPI_OPERAND_OBJECT *NewObject;
- ACPI_STATUS Status;
- UINT64 Value = 0;
- UINT32 i;
-
-
- switch (OriginalObject->Common.Type)
- {
- case ACPI_TYPE_STRING:
-
- /* String-to-Integer conversion */
-
- Status = AcpiUtStrtoul64 (OriginalObject->String.Pointer,
- ACPI_ANY_BASE, &Value);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
- break;
-
- case ACPI_TYPE_BUFFER:
-
- /* Buffer-to-Integer conversion. Max buffer size is 64 bits. */
-
- if (OriginalObject->Buffer.Length > 8)
- {
- return (AE_AML_OPERAND_TYPE);
- }
-
- /* Extract each buffer byte to create the integer */
-
- for (i = 0; i < OriginalObject->Buffer.Length; i++)
- {
- Value |= ((UINT64) OriginalObject->Buffer.Pointer[i] << (i * 8));
- }
- break;
-
- default:
- return (AE_AML_OPERAND_TYPE);
- }
-
- NewObject = AcpiUtCreateIntegerObject (Value);
- if (!NewObject)
- {
- return (AE_NO_MEMORY);
- }
-
- *ReturnObject = NewObject;
+ Info->ReturnFlags |= ACPI_OBJECT_REPAIRED;
return (AE_OK);
}
-/*******************************************************************************
+/******************************************************************************
*
- * FUNCTION: AcpiNsConvertToString
+ * FUNCTION: AcpiNsMatchSimpleRepair
*
- * PARAMETERS: OriginalObject - Object to be converted
- * ReturnObject - Where the new converted object is returned
+ * PARAMETERS: Node - Namespace node for the method/object
+ * ReturnBtype - Object type that was returned
+ * PackageIndex - Index of object within parent package (if
+ * applicable - ACPI_NOT_PACKAGE_ELEMENT
+ * otherwise)
*
- * RETURN: Status. AE_OK if conversion was successful.
+ * RETURN: Pointer to entry in repair table. NULL indicates not found.
*
- * DESCRIPTION: Attempt to convert a Integer/Buffer object to a String.
+ * DESCRIPTION: Check an object name against the repairable object list.
*
- ******************************************************************************/
+ *****************************************************************************/
-static ACPI_STATUS
-AcpiNsConvertToString (
- ACPI_OPERAND_OBJECT *OriginalObject,
- ACPI_OPERAND_OBJECT **ReturnObject)
+static const ACPI_SIMPLE_REPAIR_INFO *
+AcpiNsMatchSimpleRepair (
+ ACPI_NAMESPACE_NODE *Node,
+ UINT32 ReturnBtype,
+ UINT32 PackageIndex)
{
- ACPI_OPERAND_OBJECT *NewObject;
- ACPI_SIZE Length;
- ACPI_STATUS Status;
-
-
- switch (OriginalObject->Common.Type)
- {
- case ACPI_TYPE_INTEGER:
- /*
- * Integer-to-String conversion. Commonly, convert
- * an integer of value 0 to a NULL string. The last element of
- * _BIF and _BIX packages occasionally need this fix.
- */
- if (OriginalObject->Integer.Value == 0)
- {
- /* Allocate a new NULL string object */
-
- NewObject = AcpiUtCreateStringObject (0);
- if (!NewObject)
- {
- return (AE_NO_MEMORY);
- }
- }
- else
- {
- Status = AcpiExConvertToString (OriginalObject, &NewObject,
- ACPI_IMPLICIT_CONVERT_HEX);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
- }
- break;
-
- case ACPI_TYPE_BUFFER:
- /*
- * Buffer-to-String conversion. Use a ToString
- * conversion, no transform performed on the buffer data. The best
- * example of this is the _BIF method, where the string data from
- * the battery is often (incorrectly) returned as buffer object(s).
- */
- Length = 0;
- while ((Length < OriginalObject->Buffer.Length) &&
- (OriginalObject->Buffer.Pointer[Length]))
- {
- Length++;
- }
-
- /* Allocate a new string object */
-
- NewObject = AcpiUtCreateStringObject (Length);
- if (!NewObject)
- {
- return (AE_NO_MEMORY);
- }
-
- /*
- * Copy the raw buffer data with no transform. String is already NULL
- * terminated at Length+1.
- */
- ACPI_MEMCPY (NewObject->String.Pointer,
- OriginalObject->Buffer.Pointer, Length);
- break;
-
- default:
- return (AE_AML_OPERAND_TYPE);
- }
-
- *ReturnObject = NewObject;
- return (AE_OK);
-}
-
+ const ACPI_SIMPLE_REPAIR_INFO *ThisName;
-/*******************************************************************************
- *
- * FUNCTION: AcpiNsConvertToBuffer
- *
- * PARAMETERS: OriginalObject - Object to be converted
- * ReturnObject - Where the new converted object is returned
- *
- * RETURN: Status. AE_OK if conversion was successful.
- *
- * DESCRIPTION: Attempt to convert a Integer/String/Package object to a Buffer.
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiNsConvertToBuffer (
- ACPI_OPERAND_OBJECT *OriginalObject,
- ACPI_OPERAND_OBJECT **ReturnObject)
-{
- ACPI_OPERAND_OBJECT *NewObject;
- ACPI_STATUS Status;
- ACPI_OPERAND_OBJECT **Elements;
- UINT32 *DwordBuffer;
- UINT32 Count;
- UINT32 i;
+ /* Search info table for a repairable predefined method/object name */
- switch (OriginalObject->Common.Type)
+ ThisName = AcpiObjectRepairInfo;
+ while (ThisName->ObjectConverter)
{
- case ACPI_TYPE_INTEGER:
- /*
- * Integer-to-Buffer conversion.
- * Convert the Integer to a packed-byte buffer. _MAT and other
- * objects need this sometimes, if a read has been performed on a
- * Field object that is less than or equal to the global integer
- * size (32 or 64 bits).
- */
- Status = AcpiExConvertToBuffer (OriginalObject, &NewObject);
- if (ACPI_FAILURE (Status))
+ if (ACPI_COMPARE_NAME (Node->Name.Ascii, ThisName->Name))
{
- return (Status);
- }
- break;
-
- case ACPI_TYPE_STRING:
-
- /* String-to-Buffer conversion. Simple data copy */
-
- NewObject = AcpiUtCreateBufferObject (OriginalObject->String.Length);
- if (!NewObject)
- {
- return (AE_NO_MEMORY);
- }
-
- ACPI_MEMCPY (NewObject->Buffer.Pointer,
- OriginalObject->String.Pointer, OriginalObject->String.Length);
- break;
-
- case ACPI_TYPE_PACKAGE:
- /*
- * This case is often seen for predefined names that must return a
- * Buffer object with multiple DWORD integers within. For example,
- * _FDE and _GTM. The Package can be converted to a Buffer.
- */
-
- /* All elements of the Package must be integers */
-
- Elements = OriginalObject->Package.Elements;
- Count = OriginalObject->Package.Count;
+ /* Check if we can actually repair this name/type combination */
- for (i = 0; i < Count; i++)
- {
- if ((!*Elements) ||
- ((*Elements)->Common.Type != ACPI_TYPE_INTEGER))
+ if ((ReturnBtype & ThisName->UnexpectedBtypes) &&
+ (PackageIndex == ThisName->PackageIndex))
{
- return (AE_AML_OPERAND_TYPE);
+ return (ThisName);
}
- Elements++;
- }
-
- /* Create the new buffer object to replace the Package */
-
- NewObject = AcpiUtCreateBufferObject (ACPI_MUL_4 (Count));
- if (!NewObject)
- {
- return (AE_NO_MEMORY);
- }
-
- /* Copy the package elements (integers) to the buffer as DWORDs */
-
- Elements = OriginalObject->Package.Elements;
- DwordBuffer = ACPI_CAST_PTR (UINT32, NewObject->Buffer.Pointer);
-
- for (i = 0; i < Count; i++)
- {
- *DwordBuffer = (UINT32) (*Elements)->Integer.Value;
- DwordBuffer++;
- Elements++;
- }
- break;
-
- default:
- return (AE_AML_OPERAND_TYPE);
- }
-
- *ReturnObject = NewObject;
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiNsConvertToPackage
- *
- * PARAMETERS: OriginalObject - Object to be converted
- * ReturnObject - Where the new converted object is returned
- *
- * RETURN: Status. AE_OK if conversion was successful.
- *
- * DESCRIPTION: Attempt to convert a Buffer object to a Package. Each byte of
- * the buffer is converted to a single integer package element.
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiNsConvertToPackage (
- ACPI_OPERAND_OBJECT *OriginalObject,
- ACPI_OPERAND_OBJECT **ReturnObject)
-{
- ACPI_OPERAND_OBJECT *NewObject;
- ACPI_OPERAND_OBJECT **Elements;
- UINT32 Length;
- UINT8 *Buffer;
-
-
- switch (OriginalObject->Common.Type)
- {
- case ACPI_TYPE_BUFFER:
-
- /* Buffer-to-Package conversion */
-
- Length = OriginalObject->Buffer.Length;
- NewObject = AcpiUtCreatePackageObject (Length);
- if (!NewObject)
- {
- return (AE_NO_MEMORY);
- }
-
- /* Convert each buffer byte to an integer package element */
-
- Elements = NewObject->Package.Elements;
- Buffer = OriginalObject->Buffer.Pointer;
- while (Length--)
- {
- *Elements = AcpiUtCreateIntegerObject ((UINT64) *Buffer);
- if (!*Elements)
- {
- AcpiUtRemoveReference (NewObject);
- return (AE_NO_MEMORY);
- }
- Elements++;
- Buffer++;
+ return (NULL);
}
- break;
-
- default:
- return (AE_AML_OPERAND_TYPE);
+ ThisName++;
}
- *ReturnObject = NewObject;
- return (AE_OK);
+ return (NULL); /* Name was not found in the repair table */
}
*
* FUNCTION: AcpiNsRepairNullElement
*
- * PARAMETERS: Data - Pointer to validation data structure
+ * PARAMETERS: Info - Method execution information block
* ExpectedBtypes - Object types expected
* PackageIndex - Index of object within parent package (if
* applicable - ACPI_NOT_PACKAGE_ELEMENT
ACPI_STATUS
AcpiNsRepairNullElement (
- ACPI_PREDEFINED_DATA *Data,
+ ACPI_EVALUATE_INFO *Info,
UINT32 ExpectedBtypes,
UINT32 PackageIndex,
ACPI_OPERAND_OBJECT **ReturnObjectPtr)
/* Set the reference count according to the parent Package object */
- NewObject->Common.ReferenceCount = Data->ParentPackage->Common.ReferenceCount;
+ NewObject->Common.ReferenceCount = Info->ParentPackage->Common.ReferenceCount;
ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
"%s: Converted NULL package element to expected %s at index %u\n",
- Data->Pathname, AcpiUtGetObjectTypeName (NewObject), PackageIndex));
+ Info->FullPathname, AcpiUtGetObjectTypeName (NewObject), PackageIndex));
*ReturnObjectPtr = NewObject;
- Data->Flags |= ACPI_OBJECT_REPAIRED;
+ Info->ReturnFlags |= ACPI_OBJECT_REPAIRED;
return (AE_OK);
}
*
* FUNCTION: AcpiNsRemoveNullElements
*
- * PARAMETERS: Data - Pointer to validation data structure
+ * PARAMETERS: Info - Method execution information block
* PackageType - An AcpiReturnPackageTypes value
* ObjDesc - A Package object
*
* RETURN: None.
*
* DESCRIPTION: Remove all NULL package elements from packages that contain
- * a variable number of sub-packages. For these types of
+ * a variable number of subpackages. For these types of
* packages, NULL elements can be safely removed.
*
*****************************************************************************/
void
AcpiNsRemoveNullElements (
- ACPI_PREDEFINED_DATA *Data,
+ ACPI_EVALUATE_INFO *Info,
UINT8 PackageType,
ACPI_OPERAND_OBJECT *ObjDesc)
{
/*
* We can safely remove all NULL elements from these package types:
* PTYPE1_VAR packages contain a variable number of simple data types.
- * PTYPE2 packages contain a variable number of sub-packages.
+ * PTYPE2 packages contain a variable number of subpackages.
*/
switch (PackageType)
{
case ACPI_PTYPE2_FIXED:
case ACPI_PTYPE2_MIN:
case ACPI_PTYPE2_REV_FIXED:
+ case ACPI_PTYPE2_FIX_VAR:
+
break;
default:
{
ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
"%s: Found and removed %u NULL elements\n",
- Data->Pathname, (Count - NewCount)));
+ Info->FullPathname, (Count - NewCount)));
/* NULL terminate list and update the package count */
/*******************************************************************************
*
- * FUNCTION: AcpiNsRepairPackageList
+ * FUNCTION: AcpiNsWrapWithPackage
*
- * PARAMETERS: Data - Pointer to validation data structure
- * ObjDescPtr - Pointer to the object to repair. The new
- * package object is returned here,
- * overwriting the old object.
+ * PARAMETERS: Info - Method execution information block
+ * OriginalObject - Pointer to the object to repair.
+ * ObjDescPtr - The new package object is returned here
*
* RETURN: Status, new object in *ObjDescPtr
*
- * DESCRIPTION: Repair a common problem with objects that are defined to return
- * a variable-length Package of Packages. If the variable-length
- * is one, some BIOS code mistakenly simply declares a single
- * Package instead of a Package with one sub-Package. This
- * function attempts to repair this error by wrapping a Package
- * object around the original Package, creating the correct
- * Package with one sub-Package.
+ * DESCRIPTION: Repair a common problem with objects that are defined to
+ * return a variable-length Package of sub-objects. If there is
+ * only one sub-object, some BIOS code mistakenly simply declares
+ * the single object instead of a Package with one sub-object.
+ * This function attempts to repair this error by wrapping a
+ * Package object around the original object, creating the
+ * correct and expected Package with one sub-object.
*
* Names that can be repaired in this manner include:
- * _ALR, _CSD, _HPX, _MLS, _PRT, _PSS, _TRT, TSS
+ * _ALR, _CSD, _HPX, _MLS, _PLD, _PRT, _PSS, _TRT, _TSS,
+ * _BCL, _DOD, _FIX, _Sx
*
******************************************************************************/
ACPI_STATUS
-AcpiNsRepairPackageList (
- ACPI_PREDEFINED_DATA *Data,
+AcpiNsWrapWithPackage (
+ ACPI_EVALUATE_INFO *Info,
+ ACPI_OPERAND_OBJECT *OriginalObject,
ACPI_OPERAND_OBJECT **ObjDescPtr)
{
ACPI_OPERAND_OBJECT *PkgObjDesc;
- ACPI_FUNCTION_NAME (NsRepairPackageList);
+ ACPI_FUNCTION_NAME (NsWrapWithPackage);
/*
* Create the new outer package and populate it. The new package will
- * have a single element, the lone subpackage.
+ * have a single element, the lone sub-object.
*/
PkgObjDesc = AcpiUtCreatePackageObject (1);
if (!PkgObjDesc)
return (AE_NO_MEMORY);
}
- PkgObjDesc->Package.Elements[0] = *ObjDescPtr;
+ PkgObjDesc->Package.Elements[0] = OriginalObject;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
+ "%s: Wrapped %s with expected Package object\n",
+ Info->FullPathname, AcpiUtGetObjectTypeName (OriginalObject)));
/* Return the new object in the object pointer */
*ObjDescPtr = PkgObjDesc;
- Data->Flags |= ACPI_OBJECT_REPAIRED;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
- "%s: Repaired incorrectly formed Package\n", Data->Pathname));
-
+ Info->ReturnFlags |= ACPI_OBJECT_REPAIRED | ACPI_OBJECT_WRAPPED;
return (AE_OK);
}