summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/exoparg1.c
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>2001-11-28 04:29:40 +0000
committermsmith <msmith@FreeBSD.org>2001-11-28 04:29:40 +0000
commitfe76969b7da935c578de24725d0e86947a339135 (patch)
tree6b8691c238dc2893608d45924156125021b3fddb /sys/contrib/dev/acpica/exoparg1.c
parent3699168fb0ef62ab72780ca4cada6b30936b1b4f (diff)
downloadFreeBSD-src-fe76969b7da935c578de24725d0e86947a339135.zip
FreeBSD-src-fe76969b7da935c578de24725d0e86947a339135.tar.gz
Vendor import of the Intel ACPI CA 20011120 snapshot.
Diffstat (limited to 'sys/contrib/dev/acpica/exoparg1.c')
-rw-r--r--sys/contrib/dev/acpica/exoparg1.c130
1 files changed, 58 insertions, 72 deletions
diff --git a/sys/contrib/dev/acpica/exoparg1.c b/sys/contrib/dev/acpica/exoparg1.c
index 123c6d3..baa2534 100644
--- a/sys/contrib/dev/acpica/exoparg1.c
+++ b/sys/contrib/dev/acpica/exoparg1.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg1 - AML execution - opcodes with 1 argument
- * $Revision: 120 $
+ * $Revision: 124 $
*
*****************************************************************************/
@@ -138,21 +138,20 @@
*
* AcpiExOpcode_xA_yT_zR
*
- * Where:
+ * Where:
*
- * xA - ARGUMENTS: The number of arguments (input operands) that are
+ * xA - ARGUMENTS: The number of arguments (input operands) that are
* required for this opcode type (1 through 6 args).
- * yT - TARGETS: The number of targets (output operands) that are required
+ * yT - TARGETS: The number of targets (output operands) that are required
* for this opcode type (0, 1, or 2 targets).
- * zR - RETURN VALUE: Indicates whether this opcode type returns a value
+ * zR - RETURN VALUE: Indicates whether this opcode type returns a value
* as the function return (0 or 1).
*
- * The AcpiExOpcode* functions are called via the Dispatcher component with
+ * The AcpiExOpcode* functions are called via the Dispatcher component with
* fully resolved operands.
!*/
-
/*******************************************************************************
*
* FUNCTION: AcpiExOpcode_1A_0T_0R
@@ -177,9 +176,9 @@ AcpiExOpcode_1A_0T_0R (
FUNCTION_TRACE_STR ("ExOpcode_1A_0T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
- /* Examine the opcode */
+ /* Examine the AML opcode */
- switch (WalkState->Opcode)
+ switch (WalkState->Opcode)
{
case AML_RELEASE_OP: /* Release (MutexObject) */
@@ -253,9 +252,10 @@ AcpiExOpcode_1A_1T_0R (
FUNCTION_TRACE_STR ("ExOpcode_1A_1T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
+ /* Examine the AML opcode */
+
switch (WalkState->Opcode)
{
-
case AML_LOAD_OP:
Status = AcpiExLoadOp (Operand[0], Operand[1]);
@@ -327,6 +327,7 @@ AcpiExOpcode_1A_1T_1R (
break;
}
+ /* Examine the AML opcode */
switch (WalkState->Opcode)
{
@@ -339,7 +340,6 @@ AcpiExOpcode_1A_1T_1R (
case AML_FIND_SET_LEFT_BIT_OP: /* FindSetLeftBit (Operand, Result) */
-
ReturnDesc->Integer.Value = Operand[0]->Integer.Value;
/*
@@ -357,7 +357,6 @@ AcpiExOpcode_1A_1T_1R (
case AML_FIND_SET_RIGHT_BIT_OP: /* FindSetRightBit (Operand, Result) */
-
ReturnDesc->Integer.Value = Operand[0]->Integer.Value;
/*
@@ -543,13 +542,12 @@ AcpiExOpcode_1A_1T_1R (
break;
- /*
- * These are two obsolete opcodes
- */
case AML_SHIFT_LEFT_BIT_OP: /* ShiftLeftBit (Source, BitNum) */
case AML_SHIFT_RIGHT_BIT_OP: /* ShiftRightBit (Source, BitNum) */
-
+ /*
+ * These are two obsolete opcodes
+ */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s is obsolete and not implemented\n",
AcpiPsGetOpcodeName (WalkState->Opcode)));
Status = AE_SUPPORT;
@@ -565,9 +563,8 @@ AcpiExOpcode_1A_1T_1R (
goto Cleanup;
}
-
/*
- * Store the return value computed above into the target object
+ * Store the return value computed above into the target object
*/
Status = AcpiExStore (ReturnDesc, Operand[1], WalkState);
@@ -614,12 +611,10 @@ AcpiExOpcode_1A_0T_1R (
FUNCTION_TRACE_STR ("ExOpcode_1A_0T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
-
- /* Get the operand and decode the opcode */
+ /* Examine the AML opcode */
switch (WalkState->Opcode)
{
-
case AML_LNOT_OP: /* LNot (Operand) */
ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
@@ -661,9 +656,9 @@ AcpiExOpcode_1A_0T_1R (
goto Cleanup;
}
- /*
+ /*
* ReturnDesc is now guaranteed to be an Integer object
- * Do the actual increment or decrement
+ * Do the actual increment or decrement
*/
if (AML_INCREMENT_OP == WalkState->Opcode)
{
@@ -703,7 +698,7 @@ AcpiExOpcode_1A_0T_1R (
case AML_DEBUG_OP:
- /* Per 1.0b spec, Debug object is of type "DebugObject" */
+ /* The Debug Object is of type "DebugObject" */
Type = ACPI_TYPE_DEBUG_OBJECT;
break;
@@ -723,7 +718,6 @@ AcpiExOpcode_1A_0T_1R (
*/
Type = (*(Operand[0]->Reference.Where))->Common.Type;
}
-
break;
@@ -743,7 +737,6 @@ AcpiExOpcode_1A_0T_1R (
goto Cleanup;
}
}
-
else
{
/*
@@ -789,9 +782,13 @@ AcpiExOpcode_1A_0T_1R (
{
Value = 0;
}
-
else
{
+ /*
+ * Type is guaranteed to be a buffer, string, or package at this
+ * point (even if the original operand was an object reference, it
+ * will be resolved and typechecked during operand resolution.)
+ */
switch (TempDesc->Common.Type)
{
case ACPI_TYPE_BUFFER:
@@ -806,16 +803,9 @@ AcpiExOpcode_1A_0T_1R (
Value = TempDesc->Package.Count;
break;
- case INTERNAL_TYPE_REFERENCE:
-
- /* TBD: this must be a reference to a buf/str/pkg?? */
-
- Value = 4;
- break;
-
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Not Buf/Str/Pkg - found type %X\n",
- TempDesc->Common.Type));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "SizeOf, Not Buf/Str/Pkg - found type %s\n",
+ AcpiUtGetTypeName (TempDesc->Common.Type)));
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
}
@@ -857,11 +847,11 @@ AcpiExOpcode_1A_0T_1R (
*/
switch (Operand[0]->Reference.Opcode)
{
- /* Set Operand[0] to the value of the local/arg */
-
case AML_LOCAL_OP:
case AML_ARG_OP:
+ /* Set Operand[0] to the value of the local/arg */
+
AcpiDsMethodDataGetValue (Operand[0]->Reference.Opcode,
Operand[0]->Reference.Offset, WalkState, &TempDesc);
@@ -875,53 +865,40 @@ AcpiExOpcode_1A_0T_1R (
default:
- /* Index op - handled below */
+ /* Must be an Index op - handled below */
break;
}
}
-
/* Operand[0] may have changed from the code above */
if (VALID_DESCRIPTOR_TYPE (Operand[0], ACPI_DESC_TYPE_NAMED))
{
/* Get the actual object from the Node (This is the dereference) */
- ReturnDesc = ((ACPI_NAMESPACE_NODE *) Operand[0])->Object;
+ ReturnDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) Operand[0]);
/* Returning a pointer to the object, add another reference! */
AcpiUtAddReference (ReturnDesc);
}
-
else
{
/*
- * This must be a reference object produced by the Index
- * ASL operation -- check internal opcode
+ * This must be a reference produced by either the Index() or
+ * RefOf() operator
*/
- if ((Operand[0]->Reference.Opcode != AML_INDEX_OP) &&
- (Operand[0]->Reference.Opcode != AML_REF_OF_OP))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode in ref(%p) - %X\n",
- Operand[0], Operand[0]->Reference.Opcode));
-
- Status = AE_TYPE;
- goto Cleanup;
- }
-
-
switch (Operand[0]->Reference.Opcode)
{
case AML_INDEX_OP:
/*
- * Supported target types for the Index operator are
- * 1) A Buffer
- * 2) A Package
+ * The target type for the Index operator must be
+ * either a Buffer or a Package
*/
- if (Operand[0]->Reference.TargetType == ACPI_TYPE_BUFFER_FIELD)
+ switch (Operand[0]->Reference.TargetType)
{
+ case ACPI_TYPE_BUFFER_FIELD:
/*
* The target is a buffer, we must create a new object that
* contains one element of the buffer, the element pointed
@@ -938,17 +915,19 @@ AcpiExOpcode_1A_0T_1R (
goto Cleanup;
}
+ /*
+ * Since we are returning the value of the buffer at the
+ * indexed location, we don't need to add an additional
+ * reference to the buffer itself.
+ */
TempDesc = Operand[0]->Reference.Object;
ReturnDesc->Integer.Value =
TempDesc->Buffer.Pointer[Operand[0]->Reference.Offset];
+ break;
+
- /* TBD: [Investigate] (see below) Don't add an additional
- * ref!
- */
- }
+ case ACPI_TYPE_PACKAGE:
- else if (Operand[0]->Reference.TargetType == ACPI_TYPE_PACKAGE)
- {
/*
* The target is a package, we want to return the referenced
* element of the package. We must add another reference to
@@ -962,7 +941,6 @@ AcpiExOpcode_1A_0T_1R (
* an uninitialized package element and is thus a
* severe error.
*/
-
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "NULL package element obj %p\n",
Operand[0]));
Status = AE_AML_UNINITIALIZED_ELEMENT;
@@ -970,16 +948,16 @@ AcpiExOpcode_1A_0T_1R (
}
AcpiUtAddReference (ReturnDesc);
- }
+ break;
- else
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown TargetType %X in obj %p\n",
+
+ default:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Index TargetType %X in obj %p\n",
Operand[0]->Reference.TargetType, Operand[0]));
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
}
-
break;
@@ -991,9 +969,17 @@ AcpiExOpcode_1A_0T_1R (
AcpiUtAddReference (ReturnDesc);
break;
+
+
+ default:
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode in ref(%p) - %X\n",
+ Operand[0], Operand[0]->Reference.Opcode));
+
+ Status = AE_TYPE;
+ goto Cleanup;
+ break;
}
}
-
break;
OpenPOWER on IntegriCloud