summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/exresop.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/exresop.c')
-rw-r--r--sys/contrib/dev/acpica/exresop.c148
1 files changed, 115 insertions, 33 deletions
diff --git a/sys/contrib/dev/acpica/exresop.c b/sys/contrib/dev/acpica/exresop.c
index e1d5b04..505d2e1 100644
--- a/sys/contrib/dev/acpica/exresop.c
+++ b/sys/contrib/dev/acpica/exresop.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresop - AML Interpreter operand/object resolution
- * $Revision: 70 $
+ * $Revision: 1.86 $
*
*****************************************************************************/
@@ -10,7 +10,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
@@ -126,6 +126,14 @@
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exresop")
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiExCheckObjectType (
+ ACPI_OBJECT_TYPE TypeNeeded,
+ ACPI_OBJECT_TYPE ThisType,
+ void *Object);
+
/*******************************************************************************
*
@@ -141,7 +149,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiExCheckObjectType (
ACPI_OBJECT_TYPE TypeNeeded,
ACPI_OBJECT_TYPE ThisType,
@@ -220,6 +228,7 @@ AcpiExResolveOperands (
const ACPI_OPCODE_INFO *OpInfo;
UINT32 ThisArgType;
ACPI_OBJECT_TYPE TypeNeeded;
+ UINT16 TargetOp = 0;
ACPI_FUNCTION_TRACE_U32 ("ExResolveOperands", Opcode);
@@ -240,7 +249,8 @@ AcpiExResolveOperands (
return_ACPI_STATUS (AE_AML_INTERNAL);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode %X [%s] RequiredOperandTypes=%8.8X \n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Opcode %X [%s] RequiredOperandTypes=%8.8X\n",
Opcode, OpInfo->Name, ArgTypes));
/*
@@ -270,7 +280,7 @@ AcpiExResolveOperands (
{
case ACPI_DESC_TYPE_NAMED:
- /* Node */
+ /* Namespace Node */
ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
break;
@@ -286,7 +296,8 @@ AcpiExResolveOperands (
if (!AcpiUtValidObjectType (ObjectType))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad operand object type [%X]\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Bad operand object type [%X]\n",
ObjectType));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -294,9 +305,8 @@ AcpiExResolveOperands (
if (ObjectType == (UINT8) ACPI_TYPE_LOCAL_REFERENCE)
{
- /*
- * Decode the Reference
- */
+ /* Decode the Reference */
+
OpInfo = AcpiPsGetOpcodeInfo (Opcode);
if (OpInfo->Class == AML_CLASS_UNKNOWN)
{
@@ -306,12 +316,17 @@ AcpiExResolveOperands (
switch (ObjDesc->Reference.Opcode)
{
case AML_DEBUG_OP:
+ TargetOp = AML_DEBUG_OP;
+
+ /*lint -fallthrough */
+
case AML_NAME_OP:
case AML_INDEX_OP:
case AML_REF_OF_OP:
case AML_ARG_OP:
case AML_LOCAL_OP:
- case AML_LOAD_OP: /* DdbHandle from LOAD_OP or LOAD_TABLE_OP */
+ case AML_LOAD_OP: /* DdbHandle from LOAD_OP or LOAD_TABLE_OP */
+ case AML_INT_NAMEPATH_OP: /* Reference to a named object */
ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Operand is a Reference, RefOpcode [%s]\n",
@@ -341,10 +356,8 @@ AcpiExResolveOperands (
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
+ /* Get one argument type, point to the next */
- /*
- * Get one argument type, point to the next
- */
ThisArgType = GET_CURRENT_ARG_TYPE (ArgTypes);
INCREMENT_ARG_LIST (ArgTypes);
@@ -360,26 +373,31 @@ AcpiExResolveOperands (
(ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_STRING))
{
/*
- * String found - the string references a named object and must be
- * resolved to a node
+ * String found - the string references a named object and
+ * must be resolved to a node
*/
goto NextOperand;
}
- /* Else not a string - fall through to the normal Reference case below */
+ /*
+ * Else not a string - fall through to the normal Reference
+ * case below
+ */
/*lint -fallthrough */
case ARGI_REFERENCE: /* References: */
case ARGI_INTEGER_REF:
case ARGI_OBJECT_REF:
case ARGI_DEVICE_REF:
- case ARGI_TARGETREF: /* Allows implicit conversion rules before store */
- case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */
- case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */
-
- /* Need an operand of type ACPI_TYPE_LOCAL_REFERENCE */
+ case ARGI_TARGETREF: /* Allows implicit conversion rules before store */
+ case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */
+ case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */
- if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED) /* Node (name) ptr OK as-is */
+ /*
+ * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
+ * A Namespace Node is OK as-is
+ */
+ if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
{
goto NextOperand;
}
@@ -391,12 +409,10 @@ AcpiExResolveOperands (
return_ACPI_STATUS (Status);
}
- if (AML_NAME_OP == ObjDesc->Reference.Opcode)
+ if (ObjDesc->Reference.Opcode == AML_NAME_OP)
{
- /*
- * Convert an indirect name ptr to direct name ptr and put
- * it on the stack
- */
+ /* Convert a named reference to the actual named object */
+
TempNode = ObjDesc->Reference.Object;
AcpiUtRemoveReference (ObjDesc);
(*StackPtr) = TempNode;
@@ -404,7 +420,7 @@ AcpiExResolveOperands (
goto NextOperand;
- case ARGI_ANYTYPE:
+ case ARGI_DATAREFOBJ: /* Store operator only */
/*
* We don't want to resolve IndexOp reference objects during
@@ -425,7 +441,6 @@ AcpiExResolveOperands (
break;
}
-
/*
* Resolve this object to a value
*/
@@ -487,7 +502,7 @@ AcpiExResolveOperands (
/*
* The more complex cases allow multiple resolved object types
*/
- case ARGI_INTEGER: /* Number */
+ case ARGI_INTEGER:
/*
* Need an operand of type ACPI_TYPE_INTEGER,
@@ -508,6 +523,11 @@ AcpiExResolveOperands (
return_ACPI_STATUS (Status);
}
+
+ if (ObjDesc != *StackPtr)
+ {
+ AcpiUtRemoveReference (ObjDesc);
+ }
goto NextOperand;
@@ -532,6 +552,11 @@ AcpiExResolveOperands (
return_ACPI_STATUS (Status);
}
+
+ if (ObjDesc != *StackPtr)
+ {
+ AcpiUtRemoveReference (ObjDesc);
+ }
goto NextOperand;
@@ -557,6 +582,11 @@ AcpiExResolveOperands (
return_ACPI_STATUS (Status);
}
+
+ if (ObjDesc != *StackPtr)
+ {
+ AcpiUtRemoveReference (ObjDesc);
+ }
goto NextOperand;
@@ -604,6 +634,11 @@ AcpiExResolveOperands (
{
return_ACPI_STATUS (Status);
}
+
+ if (ObjDesc != *StackPtr)
+ {
+ AcpiUtRemoveReference (ObjDesc);
+ }
break;
default:
@@ -669,7 +704,7 @@ AcpiExResolveOperands (
case ARGI_REGION_OR_FIELD:
- /* Need an operand of type ACPI_TYPE_REGION or a FIELD in a region */
+ /* Need an operand of type REGION or a FIELD in a region */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
{
@@ -691,6 +726,54 @@ AcpiExResolveOperands (
goto NextOperand;
+ case ARGI_DATAREFOBJ:
+
+ /* Used by the Store() operator only */
+
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_INTEGER:
+ case ACPI_TYPE_PACKAGE:
+ case ACPI_TYPE_STRING:
+ case ACPI_TYPE_BUFFER:
+ case ACPI_TYPE_BUFFER_FIELD:
+ case ACPI_TYPE_LOCAL_REFERENCE:
+ case ACPI_TYPE_LOCAL_REGION_FIELD:
+ case ACPI_TYPE_LOCAL_BANK_FIELD:
+ case ACPI_TYPE_LOCAL_INDEX_FIELD:
+ case ACPI_TYPE_DDB_HANDLE:
+
+ /* Valid operand */
+ break;
+
+ default:
+
+ if (AcpiGbl_EnableInterpreterSlack)
+ {
+ /*
+ * Enable original behavior of Store(), allowing any and all
+ * objects as the source operand. The ACPI spec does not
+ * allow this, however.
+ */
+ break;
+ }
+
+ if (TargetOp == AML_DEBUG_OP)
+ {
+ /* Allow store of any object to the Debug object */
+
+ break;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n",
+ AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
+
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+ goto NextOperand;
+
+
default:
/* Unknown type */
@@ -722,8 +805,7 @@ NextOperand:
{
StackPtr--;
}
-
- } /* while (*Types) */
+ }
return_ACPI_STATUS (Status);
}
OpenPOWER on IntegriCloud