summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/exoparg2.c
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2005-11-01 22:11:18 +0000
committerjkim <jkim@FreeBSD.org>2005-11-01 22:11:18 +0000
commit5f6a2493ddea1cf36a4dcd58b865c4148427e0a2 (patch)
tree4450b2c84d749dd8a8425a8feb88b084809f6ef0 /sys/contrib/dev/acpica/exoparg2.c
parent50133a977cb75b3f52603d4b351a8cf45bb556c8 (diff)
downloadFreeBSD-src-5f6a2493ddea1cf36a4dcd58b865c4148427e0a2.zip
FreeBSD-src-5f6a2493ddea1cf36a4dcd58b865c4148427e0a2.tar.gz
Vendor import of Intel ACPI-CA 20051021
Diffstat (limited to 'sys/contrib/dev/acpica/exoparg2.c')
-rw-r--r--sys/contrib/dev/acpica/exoparg2.c79
1 files changed, 44 insertions, 35 deletions
diff --git a/sys/contrib/dev/acpica/exoparg2.c b/sys/contrib/dev/acpica/exoparg2.c
index bb8befb..880a45c 100644
--- a/sys/contrib/dev/acpica/exoparg2.c
+++ b/sys/contrib/dev/acpica/exoparg2.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exoparg2 - AML execution - opcodes with 2 arguments
- * $Revision: 129 $
+ * $Revision: 1.134 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -194,7 +194,7 @@ AcpiExOpcode_2A_0T_0R (
Value = (UINT32) Operand[1]->Integer.Value;
- /* Notifies allowed on this object? */
+ /* Are notifies allowed on this object? */
if (!AcpiEvIsNotifyObject (Node))
{
@@ -282,12 +282,13 @@ AcpiExOpcode_2A_2T_1R (
AcpiPsGetOpcodeName (WalkState->Opcode));
- /*
- * Execute the opcode
- */
+ /* Execute the opcode */
+
switch (WalkState->Opcode)
{
- case AML_DIVIDE_OP: /* Divide (Dividend, Divisor, RemainderResult QuotientResult) */
+ case AML_DIVIDE_OP:
+
+ /* Divide (Dividend, Divisor, RemainderResult QuotientResult) */
ReturnDesc1 = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
if (!ReturnDesc1)
@@ -324,7 +325,6 @@ AcpiExOpcode_2A_2T_1R (
goto Cleanup;
}
-
/* Store the results to the target reference operands */
Status = AcpiExStore (ReturnDesc2, Operand[2], WalkState);
@@ -381,7 +381,7 @@ AcpiExOpcode_2A_1T_1R (
{
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
- UINT32 Index;
+ ACPI_INTEGER Index;
ACPI_STATUS Status = AE_OK;
ACPI_SIZE Length;
@@ -390,9 +390,8 @@ AcpiExOpcode_2A_1T_1R (
AcpiPsGetOpcodeName (WalkState->Opcode));
- /*
- * Execute the opcode
- */
+ /* Execute the opcode */
+
if (WalkState->OpInfo->Flags & AML_MATH)
{
/* All simple math opcodes (add, etc.) */
@@ -410,10 +409,9 @@ AcpiExOpcode_2A_1T_1R (
goto StoreResultToTarget;
}
-
switch (WalkState->Opcode)
{
- case AML_MOD_OP: /* Mod (Dividend, Divisor, RemainderResult (ACPI 2.0) */
+ case AML_MOD_OP: /* Mod (Dividend, Divisor, RemainderResult (ACPI 2.0) */
ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
if (!ReturnDesc)
@@ -431,18 +429,19 @@ AcpiExOpcode_2A_1T_1R (
break;
- case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */
+ case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */
Status = AcpiExDoConcatenate (Operand[0], Operand[1],
&ReturnDesc, WalkState);
break;
- case AML_TO_STRING_OP: /* ToString (Buffer, Length, Result) (ACPI 2.0) */
+ case AML_TO_STRING_OP: /* ToString (Buffer, Length, Result) (ACPI 2.0) */
/*
* Input object is guaranteed to be a buffer at this point (it may have
- * been converted.) Copy the raw buffer data to a new object of type String.
+ * been converted.) Copy the raw buffer data to a new object of
+ * type String.
*/
/*
@@ -476,14 +475,16 @@ AcpiExOpcode_2A_1T_1R (
goto Cleanup;
}
- /* Copy the raw buffer data with no transform. NULL terminated already. */
+ /* Copy the raw buffer data with no transform. NULL terminated already*/
ACPI_MEMCPY (ReturnDesc->String.Pointer,
Operand[0]->Buffer.Pointer, Length);
break;
- case AML_CONCAT_RES_OP: /* ConcatenateResTemplate (Buffer, Buffer, Result) (ACPI 2.0) */
+ case AML_CONCAT_RES_OP:
+
+ /* ConcatenateResTemplate (Buffer, Buffer, Result) (ACPI 2.0) */
Status = AcpiExConcatTemplate (Operand[0], Operand[1],
&ReturnDesc, WalkState);
@@ -501,11 +502,10 @@ AcpiExOpcode_2A_1T_1R (
goto Cleanup;
}
- Index = (UINT32) Operand[1]->Integer.Value;
+ Index = Operand[1]->Integer.Value;
+
+ /* At this point, the Source operand is a Package, Buffer, or String */
- /*
- * At this point, the Source operand is a Package, Buffer, or String
- */
if (ACPI_GET_OBJECT_TYPE (Operand[0]) == ACPI_TYPE_PACKAGE)
{
/* Object to be indexed is a Package */
@@ -513,15 +513,16 @@ AcpiExOpcode_2A_1T_1R (
if (Index >= Operand[0]->Package.Count)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Index value (%X) beyond package end (%X)\n",
- Index, Operand[0]->Package.Count));
+ "Index value (%X%8.8X) beyond package end (%X)\n",
+ ACPI_FORMAT_UINT64 (Index), Operand[0]->Package.Count));
Status = AE_AML_PACKAGE_LIMIT;
goto Cleanup;
}
ReturnDesc->Reference.TargetType = ACPI_TYPE_PACKAGE;
ReturnDesc->Reference.Object = Operand[0];
- ReturnDesc->Reference.Where = &Operand[0]->Package.Elements [Index];
+ ReturnDesc->Reference.Where = &Operand[0]->Package.Elements [
+ Index];
}
else
{
@@ -530,8 +531,8 @@ AcpiExOpcode_2A_1T_1R (
if (Index >= Operand[0]->Buffer.Length)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Index value (%X) beyond end of buffer (%X)\n",
- Index, Operand[0]->Buffer.Length));
+ "Index value (%X%8.8X) beyond end of buffer (%X)\n",
+ ACPI_FORMAT_UINT64 (Index), Operand[0]->Buffer.Length));
Status = AE_AML_BUFFER_LIMIT;
goto Cleanup;
}
@@ -540,10 +541,16 @@ AcpiExOpcode_2A_1T_1R (
ReturnDesc->Reference.Object = Operand[0];
}
+ /*
+ * Add a reference to the target package/buffer/string for the life
+ * of the index.
+ */
+ AcpiUtAddReference (Operand[0]);
+
/* Complete the Index reference object */
ReturnDesc->Reference.Opcode = AML_INDEX_OP;
- ReturnDesc->Reference.Offset = Index;
+ ReturnDesc->Reference.Offset = (UINT32) Index;
/* Store the reference to the Target */
@@ -633,24 +640,26 @@ AcpiExOpcode_2A_0T_1R (
goto Cleanup;
}
- /*
- * Execute the Opcode
- */
- if (WalkState->OpInfo->Flags & AML_LOGICAL_NUMERIC) /* LogicalOp (Operand0, Operand1) */
+ /* Execute the Opcode */
+
+ if (WalkState->OpInfo->Flags & AML_LOGICAL_NUMERIC)
{
+ /* LogicalOp (Operand0, Operand1) */
+
Status = AcpiExDoLogicalNumericOp (WalkState->Opcode,
Operand[0]->Integer.Value, Operand[1]->Integer.Value,
&LogicalResult);
goto StoreLogicalResult;
}
- else if (WalkState->OpInfo->Flags & AML_LOGICAL) /* LogicalOp (Operand0, Operand1) */
+ else if (WalkState->OpInfo->Flags & AML_LOGICAL)
{
+ /* LogicalOp (Operand0, Operand1) */
+
Status = AcpiExDoLogicalOp (WalkState->Opcode, Operand[0],
Operand[1], &LogicalResult);
goto StoreLogicalResult;
}
-
switch (WalkState->Opcode)
{
case AML_ACQUIRE_OP: /* Acquire (MutexObject, Timeout) */
OpenPOWER on IntegriCloud