aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib/dev/acpica/Subsystem/Interpreter/amutils.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/Subsystem/Interpreter/amutils.c')
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Interpreter/amutils.c59
1 files changed, 40 insertions, 19 deletions
diff --git a/sys/contrib/dev/acpica/Subsystem/Interpreter/amutils.c b/sys/contrib/dev/acpica/Subsystem/Interpreter/amutils.c
index 56dbc673799d..3e044b5baad3 100644
--- a/sys/contrib/dev/acpica/Subsystem/Interpreter/amutils.c
+++ b/sys/contrib/dev/acpica/Subsystem/Interpreter/amutils.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: amutils - interpreter/scanner utilities
- * $Revision: 56 $
+ * $Revision: 63 $
*
*****************************************************************************/
@@ -227,24 +227,45 @@ AcpiAmlValidateObjectType (
/*******************************************************************************
*
- * FUNCTION: AcpiAmlBufSeq
+ * FUNCTION: AcpiAmlTruncateFor32bitTable
*
- * RETURN: The next buffer descriptor sequence number
+ * PARAMETERS: ObjDesc - Object to be truncated
+ * WalkState - Current walk state
+ * (A method must be executing)
*
- * DESCRIPTION: Provide a unique sequence number for each Buffer descriptor
- * allocated during the interpreter's existence. These numbers
- * are used to relate FieldUnit descriptors to the Buffers
- * within which the fields are defined.
+ * RETURN: none
*
- * Just increment the global counter and return it.
+ * DESCRIPTION: Truncate a number to 32-bits if the currently executing method
+ * belongs to a 32-bit ACPI table.
*
******************************************************************************/
-UINT32
-AcpiAmlBufSeq (void)
+void
+AcpiAmlTruncateFor32bitTable (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_WALK_STATE *WalkState)
{
- return (++AcpiGbl_BufSeq);
+ /*
+ * Object must be a valid number and we must be executing
+ * a control method
+ */
+
+ if ((!ObjDesc) ||
+ (ObjDesc->Common.Type != ACPI_TYPE_NUMBER) ||
+ (!WalkState->MethodNode))
+ {
+ return;
+ }
+
+ if (WalkState->MethodNode->Flags & ANOBJ_DATA_WIDTH_32)
+ {
+ /*
+ * We are running a method that exists in a 32-bit ACPI table.
+ * Truncate the value to 32 bits by zeroing out the upper 32-bit field
+ */
+ ObjDesc->Number.Value &= (UINT64) ACPI_UINT32_MAX;
+ }
}
@@ -371,7 +392,7 @@ AcpiAmlDigitsNeeded (
else
{
- for (NumDigits = 1 + (val < 0) ; val /= base ; ++NumDigits)
+ for (NumDigits = 1 + (val < 0); (val = ACPI_DIVIDE (val,base)); ++NumDigits)
{ ; }
}
@@ -389,7 +410,7 @@ AcpiAmlDigitsNeeded (
*
******************************************************************************/
-UINT32
+static UINT32
_ntohl (
UINT32 Value)
{
@@ -478,8 +499,8 @@ AcpiAmlUnsignedIntegerToString (
for (Count = DigitsNeeded; Count > 0; Count--)
{
- OutString[Count-1] = (NATIVE_CHAR) ('0' + (Value % 10));
- Value /= 10;
+ OutString[Count-1] = (NATIVE_CHAR) ('0' + (ACPI_MODULO (Value, 10)));
+ Value = ACPI_DIVIDE (Value, 10);
}
return (AE_OK);
@@ -530,8 +551,8 @@ AcpiAmlBuildCopyInternalPackageObject (
LevelPtr = &CopyLevel[0];
CurrentDepth = 0;
- DestObj->Common.Type = SourceObj->Common.Type;
- DestObj->Package.Count = SourceObj->Package.Count;
+ DestObj->Common.Type = SourceObj->Common.Type;
+ DestObj->Package.Count = SourceObj->Package.Count;
/*
@@ -556,8 +577,8 @@ AcpiAmlBuildCopyInternalPackageObject (
while (1)
{
ThisIndex = LevelPtr->Index;
- ThisDestObj = (ACPI_OPERAND_OBJECT *) LevelPtr->DestObj->Package.Elements[ThisIndex];
- ThisSourceObj = (ACPI_OPERAND_OBJECT *) LevelPtr->SourceObj->Package.Elements[ThisIndex];
+ ThisDestObj = (ACPI_OPERAND_OBJECT *) LevelPtr->DestObj->Package.Elements[ThisIndex];
+ ThisSourceObj = (ACPI_OPERAND_OBJECT *) LevelPtr->SourceObj->Package.Elements[ThisIndex];
if (IS_THIS_OBJECT_TYPE (ThisSourceObj, ACPI_TYPE_PACKAGE))
{