Support for late evaluation of Buffer and Package operands (They may

contain TermArgs).


date	2002.03.13.18.13.00;	author rmoore1;	state Exp;
This commit is contained in:
aystarik 2005-06-29 17:02:16 +00:00
parent b741f08c1d
commit 66dc416943
7 changed files with 1564 additions and 1906 deletions

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsmethod - Parser/Interpreter interface - control method parsing
* $Revision: 1.79 $
* $Revision: 1.80 $
*
*****************************************************************************/
@ -208,7 +208,7 @@ AcpiDsParseMethod (
/* Init new op with the method name and pointer back to the Node */
AcpiPsSetName (Op, Node->Name);
AcpiPsSetName (Op, Node->Name.Integer);
Op->Node = Node;
/*

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsobject - Dispatcher object management routines
* $Revision: 1.81 $
* $Revision: 1.91 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@ -124,7 +124,7 @@
#include "acnamesp.h"
#define _COMPONENT ACPI_DISPATCHER
MODULE_NAME ("dsobject")
ACPI_MODULE_NAME ("dsobject")
/*******************************************************************************
@ -139,11 +139,11 @@
* RETURN: Status
*
* DESCRIPTION: Callback from AcpiWalkNamespace. Invoked for every object
* within the namespace.
* within the namespace.
*
* Currently, the only objects that require initialization are:
* 1) Methods
* 2) Op Regions
* 2) Operation Regions
*
******************************************************************************/
@ -154,13 +154,13 @@ AcpiDsInitOneObject (
void *Context,
void **ReturnValue)
{
ACPI_OBJECT_TYPE8 Type;
ACPI_OBJECT_TYPE Type;
ACPI_STATUS Status;
ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context;
UINT8 TableRevision;
PROC_NAME ("DsInitOneObject");
ACPI_FUNCTION_NAME ("DsInitOneObject");
Info->ObjectCount++;
@ -176,14 +176,12 @@ AcpiDsInitOneObject (
return (AE_OK);
}
/* And even then, we are only interested in a few object types */
Type = AcpiNsGetType (ObjHandle);
switch (Type)
{
case ACPI_TYPE_REGION:
AcpiDsInitializeRegion (ObjHandle);
@ -218,7 +216,7 @@ AcpiDsInitOneObject (
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Method %p [%4.4s] - parse failure, %s\n",
ObjHandle, (char*)&((ACPI_NAMESPACE_NODE *)ObjHandle)->Name,
ObjHandle, (char *) &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name,
AcpiFormatException (Status)));
/* This parse failed, but we will continue parsing more methods */
@ -231,6 +229,7 @@ AcpiDsInitOneObject (
* for every execution since there isn't much overhead
*/
AcpiNsDeleteNamespaceSubtree (ObjHandle);
AcpiNsDeleteNamespaceByOwner (((ACPI_NAMESPACE_NODE *) ObjHandle)->Object->Method.OwningId);
break;
default:
@ -249,12 +248,13 @@ AcpiDsInitOneObject (
*
* FUNCTION: AcpiDsInitializeObjects
*
* PARAMETERS: None
* PARAMETERS: TableDesc - Descriptor for parent ACPI table
* StartNode - Root of subtree to be initialized.
*
* RETURN: Status
*
* DESCRIPTION: Walk the entire namespace and perform any necessary
* initialization on the objects found therein
* DESCRIPTION: Walk the namespace starting at "StartNode" and perform any
* necessary initialization on the objects found therein
*
******************************************************************************/
@ -267,7 +267,7 @@ AcpiDsInitializeObjects (
ACPI_INIT_WALK_INFO Info;
FUNCTION_TRACE ("DsInitializeObjects");
ACPI_FUNCTION_TRACE ("DsInitializeObjects");
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
@ -280,7 +280,6 @@ AcpiDsInitializeObjects (
Info.ObjectCount = 0;
Info.TableDesc = TableDesc;
/* Walk entire namespace from the supplied root */
Status = AcpiWalkNamespace (ACPI_TYPE_ANY, StartNode, ACPI_UINT32_MAX,
@ -306,9 +305,10 @@ AcpiDsInitializeObjects (
*
* FUNCTION: AcpiDsInitObjectFromOp
*
* PARAMETERS: Op - Parser op used to init the internal object
* PARAMETERS: WalkState - Current walk state
* Op - Parser op used to init the internal object
* Opcode - AML opcode associated with the object
* ObjDesc - Namespace object to be initialized
* RetObjDesc - Namespace object to be initialized
*
* RETURN: Status
*
@ -325,15 +325,11 @@ AcpiDsInitObjectFromOp (
UINT16 Opcode,
ACPI_OPERAND_OBJECT **RetObjDesc)
{
ACPI_STATUS Status;
ACPI_PARSE_OBJECT *Arg;
ACPI_PARSE2_OBJECT *ByteList;
ACPI_OPERAND_OBJECT *ArgDesc;
const ACPI_OPCODE_INFO *OpInfo;
ACPI_OPERAND_OBJECT *ObjDesc;
PROC_NAME ("DsInitObjectFromOp");
ACPI_FUNCTION_NAME ("DsInitObjectFromOp");
ObjDesc = *RetObjDesc;
@ -345,114 +341,48 @@ AcpiDsInitObjectFromOp (
return (AE_TYPE);
}
/* Get and prepare the first argument */
/* Perform per-object initialization */
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_BUFFER:
/* First arg is a number */
AcpiDsCreateOperand (WalkState, Op->Value.Arg, 0);
ArgDesc = WalkState->Operands [WalkState->NumOperands - 1];
AcpiDsObjStackPop (1, WalkState);
/* Resolve the object (could be an arg or local) */
Status = AcpiExResolveToValue (&ArgDesc, WalkState);
if (ACPI_FAILURE (Status))
{
AcpiUtRemoveReference (ArgDesc);
return (Status);
}
/* We are expecting a number */
if (ArgDesc->Common.Type != ACPI_TYPE_INTEGER)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Expecting number, got obj: %p type %X\n",
ArgDesc, ArgDesc->Common.Type));
AcpiUtRemoveReference (ArgDesc);
return (AE_TYPE);
}
/* Get the value, delete the internal object */
ObjDesc->Buffer.Length = (UINT32) ArgDesc->Integer.Value;
AcpiUtRemoveReference (ArgDesc);
/* Allocate the buffer */
if (ObjDesc->Buffer.Length == 0)
{
ObjDesc->Buffer.Pointer = NULL;
REPORT_WARNING (("Buffer created with zero length in AML\n"));
break;
}
else
{
ObjDesc->Buffer.Pointer = ACPI_MEM_CALLOCATE (
ObjDesc->Buffer.Length);
if (!ObjDesc->Buffer.Pointer)
{
return (AE_NO_MEMORY);
}
}
/*
* Second arg is the buffer data (optional) ByteList can be either
* individual bytes or a string initializer.
* Defer evaluation of Buffer TermArg operand
*/
Arg = Op->Value.Arg; /* skip first arg */
ByteList = (ACPI_PARSE2_OBJECT *) Arg->Next;
if (ByteList)
{
if (ByteList->Opcode != AML_INT_BYTELIST_OP)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Expecting bytelist, got: %p\n",
ByteList));
return (AE_TYPE);
}
MEMCPY (ObjDesc->Buffer.Pointer, ByteList->Data,
ObjDesc->Buffer.Length);
}
ObjDesc->Buffer.Node = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0];
ObjDesc->Buffer.AmlStart = ((ACPI_PARSE2_OBJECT *) Op)->Data;
ObjDesc->Buffer.AmlLength = ((ACPI_PARSE2_OBJECT *) Op)->Length;
break;
case ACPI_TYPE_PACKAGE:
/*
* When called, an internal package object has already been built and
* is pointed to by ObjDesc. AcpiDsBuildInternalObject builds another
* internal package object, so remove reference to the original so
* that it is deleted. Error checking is done within the remove
* reference function.
* Defer evaluation of Package TermArg operand
*/
AcpiUtRemoveReference (ObjDesc);
Status = AcpiDsBuildInternalObject (WalkState, Op, RetObjDesc);
ObjDesc->Package.Node = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0];
ObjDesc->Package.AmlStart = ((ACPI_PARSE2_OBJECT *) Op)->Data;
ObjDesc->Package.AmlLength = ((ACPI_PARSE2_OBJECT *) Op)->Length;
break;
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_INTEGER:
ObjDesc->Integer.Value = Op->Value.Integer;
break;
case ACPI_TYPE_STRING:
ObjDesc->String.Pointer = Op->Value.String;
ObjDesc->String.Length = STRLEN (Op->Value.String);
/*
ObjDesc->String.Pointer = Op->Value.String;
ObjDesc->String.Length = ACPI_STRLEN (Op->Value.String);
/*
* The string is contained in the ACPI table, don't ever try
* to delete it
*/
ObjDesc->Common.Flags |= AOPOBJ_STATIC_POINTER;
ObjDesc->Common.Flags |= AOPOBJ_STATIC_POINTER;
break;
@ -494,7 +424,6 @@ AcpiDsInitObjectFromOp (
ObjDesc->Reference.Opcode = Opcode;
break;
}
break;
@ -512,9 +441,10 @@ AcpiDsInitObjectFromOp (
/*****************************************************************************
*
* FUNCTION: AcpiDsBuildInternalSimpleObj
* FUNCTION: AcpiDsBuildInternalObject
*
* PARAMETERS: Op - Parser object to be translated
* PARAMETERS: WalkState - Current walk state
* Op - Parser object to be translated
* ObjDescPtr - Where the ACPI internal object is returned
*
* RETURN: Status
@ -524,85 +454,66 @@ AcpiDsInitObjectFromOp (
*
****************************************************************************/
static ACPI_STATUS
AcpiDsBuildInternalSimpleObj (
ACPI_STATUS
AcpiDsBuildInternalObject (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op,
ACPI_OPERAND_OBJECT **ObjDescPtr)
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_OBJECT_TYPE8 Type;
ACPI_STATUS Status;
UINT32 Length;
char *Name;
FUNCTION_TRACE ("DsBuildInternalSimpleObj");
ACPI_FUNCTION_TRACE ("DsBuildInternalObject");
if (Op->Opcode == AML_INT_NAMEPATH_OP)
{
/*
* This is an object reference. If The name was
* previously looked up in the NS, it is stored in this op.
* This is an object reference. If this name was
* previously looked up in the namespace, it was stored in this op.
* Otherwise, go ahead and look it up now
*/
if (!Op->Node)
{
Status = AcpiNsLookup (WalkState->ScopeInfo,
Op->Value.String, ACPI_TYPE_ANY,
IMODE_EXECUTE,
NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE,
NULL,
(ACPI_NAMESPACE_NODE **)&(Op->Node));
Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Value.String,
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL,
(ACPI_NAMESPACE_NODE **) &(Op->Node));
if (ACPI_FAILURE (Status))
{
if (Status == AE_NOT_FOUND)
{
Name = NULL;
AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Value.String, &Length, &Name);
AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Value.String, NULL, &Name);
if (Name)
{
REPORT_WARNING (("Reference %s at AML %X not found\n",
ACPI_REPORT_WARNING (("Reference %s at AML %X not found\n",
Name, Op->AmlOffset));
ACPI_MEM_FREE (Name);
}
else
{
REPORT_WARNING (("Reference %s at AML %X not found\n",
ACPI_REPORT_WARNING (("Reference %s at AML %X not found\n",
Op->Value.String, Op->AmlOffset));
}
*ObjDescPtr = NULL;
}
else
{
return_ACPI_STATUS (Status);
}
}
}
/*
* The reference will be a Reference
* TBD: [Restructure] unless we really need a separate
* type of INTERNAL_TYPE_REFERENCE change
* AcpiDsMapOpcodeToDataType to handle this case
*/
Type = INTERNAL_TYPE_REFERENCE;
}
else
{
Type = AcpiDsMapOpcodeToDataType (Op->Opcode, NULL);
}
/* Create and init the internal ACPI object */
ObjDesc = AcpiUtCreateInternalObject (Type);
ObjDesc = AcpiUtCreateInternalObject ((AcpiPsGetOpcodeInfo (Op->Opcode))->ObjectType);
if (!ObjDesc)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@ -616,7 +527,121 @@ AcpiDsBuildInternalSimpleObj (
}
*ObjDescPtr = ObjDesc;
return_ACPI_STATUS (AE_OK);
}
/*****************************************************************************
*
* FUNCTION: AcpiDsBuildInternalBufferObj
*
* PARAMETERS: Op - Parser object to be translated
* ObjDescPtr - Where the ACPI internal object is returned
*
* RETURN: Status
*
* DESCRIPTION: Translate a parser Op package object to the equivalent
* namespace object
*
****************************************************************************/
ACPI_STATUS
AcpiDsBuildInternalBufferObj (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op,
UINT32 BufferLength,
ACPI_OPERAND_OBJECT **ObjDescPtr)
{
ACPI_PARSE_OBJECT *Arg;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_PARSE2_OBJECT *ByteList;
UINT32 ByteListLength = 0;
ACPI_FUNCTION_TRACE ("DsBuildInternalBufferObj");
ObjDesc = *ObjDescPtr;
if (ObjDesc)
{
/*
* We are evaluating a Named buffer object "Name (xxxx, Buffer)".
* The buffer object already exists (from the NS node)
*/
}
else
{
/* Create a new buffer object */
ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER);
*ObjDescPtr = ObjDesc;
if (!ObjDesc)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
}
/*
* Second arg is the buffer data (optional) ByteList can be either
* individual bytes or a string initializer. In either case, a
* ByteList appears in the AML.
*/
Arg = Op->Value.Arg; /* skip first arg */
ByteList = (ACPI_PARSE2_OBJECT *) Arg->Next;
if (ByteList)
{
if (ByteList->Opcode != AML_INT_BYTELIST_OP)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Expecting bytelist, got AML opcode %X in op %p\n",
ByteList->Opcode, ByteList));
AcpiUtRemoveReference (ObjDesc);
return (AE_TYPE);
}
ByteListLength = ByteList->Value.Integer32;
}
/*
* The buffer length (number of bytes) will be the larger of:
* 1) The specified buffer length and
* 2) The length of the initializer byte list
*/
ObjDesc->Buffer.Length = BufferLength;
if (ByteListLength > BufferLength)
{
ObjDesc->Buffer.Length = ByteListLength;
}
/* Allocate the buffer */
if (ObjDesc->Buffer.Length == 0)
{
ObjDesc->Buffer.Pointer = NULL;
ACPI_REPORT_WARNING (("Buffer created with zero length in AML\n"));
return_ACPI_STATUS (AE_OK);
}
ObjDesc->Buffer.Pointer = ACPI_MEM_CALLOCATE (
ObjDesc->Buffer.Length);
if (!ObjDesc->Buffer.Pointer)
{
AcpiUtDeleteObjectDesc (ObjDesc);
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Initialize buffer from the ByteList (if present) */
if (ByteList)
{
ACPI_MEMCPY (ObjDesc->Buffer.Pointer, ByteList->Data,
ByteListLength);
}
ObjDesc->Buffer.Flags |= AOPOBJ_DATA_VALID;
Op->Node = (ACPI_NAMESPACE_NODE *) ObjDesc;
return_ACPI_STATUS (AE_OK);
}
@ -639,39 +664,75 @@ ACPI_STATUS
AcpiDsBuildInternalPackageObj (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op,
UINT32 PackageLength,
ACPI_OPERAND_OBJECT **ObjDescPtr)
{
ACPI_PARSE_OBJECT *Arg;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_PARSE_OBJECT *Parent;
ACPI_OPERAND_OBJECT *ObjDesc = NULL;
UINT32 PackageListLength;
ACPI_STATUS Status = AE_OK;
UINT32 i;
FUNCTION_TRACE ("DsBuildInternalPackageObj");
ACPI_FUNCTION_TRACE ("DsBuildInternalPackageObj");
ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_PACKAGE);
*ObjDescPtr = ObjDesc;
if (!ObjDesc)
/* Find the parent of a possibly nested package */
Parent = Op->Parent;
while ((Parent->Opcode == AML_PACKAGE_OP) ||
(Parent->Opcode == AML_VAR_PACKAGE_OP))
{
return_ACPI_STATUS (AE_NO_MEMORY);
Parent = Parent->Parent;
}
if (Op->Opcode == AML_VAR_PACKAGE_OP)
ObjDesc = *ObjDescPtr;
if (ObjDesc)
{
/*
* Variable length package parameters are evaluated JIT
* We are evaluating a Named package object "Name (xxxx, Package)".
* Get the existing package object from the NS node
*/
return_ACPI_STATUS (AE_OK);
}
else
{
ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_PACKAGE);
*ObjDescPtr = ObjDesc;
if (!ObjDesc)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
ObjDesc->Package.Node = Parent->Node;
}
/* The first argument must be the package length */
ObjDesc->Package.Count = PackageLength;
/* Count the number of items in the package list */
PackageListLength = 0;
Arg = Op->Value.Arg;
ObjDesc->Package.Count = Arg->Value.Integer32;
Arg = Arg->Next;
while (Arg)
{
PackageListLength++;
Arg = Arg->Next;
}
/*
* Allocate the array of pointers (ptrs to the
* individual objects) Add an extra pointer slot so
* The package length (number of elements) will be the greater
* of the specified length and the length of the initializer list
*/
if (PackageListLength > PackageLength)
{
ObjDesc->Package.Count = PackageListLength;
}
/*
* Allocate the pointer array (array of pointers to the
* individual objects). Add an extra pointer slot so
* that the list is always null terminated.
*/
ObjDesc->Package.Elements = ACPI_MEM_CALLOCATE (
@ -683,77 +744,36 @@ AcpiDsBuildInternalPackageObj (
return_ACPI_STATUS (AE_NO_MEMORY);
}
ObjDesc->Package.NextElement = ObjDesc->Package.Elements;
/*
* Now init the elements of the package
*/
i = 0;
Arg = Op->Value.Arg;
Arg = Arg->Next;
while (Arg)
{
if (Arg->Opcode == AML_PACKAGE_OP)
if (Arg->Opcode == AML_INT_RETURN_VALUE_OP)
{
Status = AcpiDsBuildInternalPackageObj (WalkState, Arg,
ObjDesc->Package.NextElement);
}
/* Object (package or buffer) is already built */
ObjDesc->Package.Elements[i] = (ACPI_OPERAND_OBJECT *) Arg->Node;
}
else
{
Status = AcpiDsBuildInternalSimpleObj (WalkState, Arg,
ObjDesc->Package.NextElement);
Status = AcpiDsBuildInternalObject (WalkState, Arg,
&ObjDesc->Package.Elements[i]);
}
ObjDesc->Package.NextElement++;
i++;
Arg = Arg->Next;
}
ObjDesc->Package.Flags |= AOPOBJ_DATA_VALID;
Op->Node = (ACPI_NAMESPACE_NODE *) ObjDesc;
return_ACPI_STATUS (Status);
}
/*****************************************************************************
*
* FUNCTION: AcpiDsBuildInternalObject
*
* PARAMETERS: Op - Parser object to be translated
* ObjDescPtr - Where the ACPI internal object is returned
*
* RETURN: Status
*
* DESCRIPTION: Translate a parser Op object to the equivalent namespace
* object
*
****************************************************************************/
ACPI_STATUS
AcpiDsBuildInternalObject (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op,
ACPI_OPERAND_OBJECT **ObjDescPtr)
{
ACPI_STATUS Status;
switch (Op->Opcode)
{
case AML_PACKAGE_OP:
case AML_VAR_PACKAGE_OP:
Status = AcpiDsBuildInternalPackageObj (WalkState, Op, ObjDescPtr);
break;
default:
Status = AcpiDsBuildInternalSimpleObj (WalkState, Op, ObjDescPtr);
break;
}
return (Status);
}
/*****************************************************************************
*
* FUNCTION: AcpiDsCreateNode
@ -777,7 +797,7 @@ AcpiDsCreateNode (
ACPI_OPERAND_OBJECT *ObjDesc;
FUNCTION_TRACE_PTR ("DsCreateNode", Op);
ACPI_FUNCTION_TRACE_PTR ("DsCreateNode", Op);
/*
@ -785,7 +805,7 @@ AcpiDsCreateNode (
* parts of the table, we can arrive here twice. Only init
* the named object node the first time through
*/
if (Node->Object)
if (AcpiNsGetAttachedObject (Node))
{
return_ACPI_STATUS (AE_OK);
}
@ -809,9 +829,9 @@ AcpiDsCreateNode (
Node->Type = ObjDesc->Common.Type;
/* Init obj */
/* Attach obj to node */
Status = AcpiNsAttachObject (Node, ObjDesc, (UINT8) Node->Type);
Status = AcpiNsAttachObject (Node, ObjDesc, Node->Type);
/* Remove local reference to the object */

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dsutils - Dispatcher utilities
* $Revision: 1.80 $
* $Revision: 1.89 $
*
******************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@ -125,7 +125,7 @@
#include "acdebug.h"
#define _COMPONENT ACPI_DISPATCHER
MODULE_NAME ("dsutils")
ACPI_MODULE_NAME ("dsutils")
/*******************************************************************************
@ -150,7 +150,7 @@ AcpiDsIsResultUsed (
const ACPI_OPCODE_INFO *ParentInfo;
FUNCTION_TRACE_PTR ("DsIsResultUsed", Op);
ACPI_FUNCTION_TRACE_PTR ("DsIsResultUsed", Op);
/* Must have both an Op and a Result Object */
@ -161,7 +161,6 @@ AcpiDsIsResultUsed (
return_VALUE (TRUE);
}
/*
* If there is no parent, the result can't possibly be used!
* (An executing method typically has no parent, since each
@ -173,11 +172,9 @@ AcpiDsIsResultUsed (
return_VALUE (FALSE);
}
/*
* Get info on the parent. The root Op is AML_SCOPE
*/
ParentInfo = AcpiPsGetOpcodeInfo (Op->Parent->Opcode);
if (ParentInfo->Class == AML_CLASS_UNKNOWN)
{
@ -185,7 +182,6 @@ AcpiDsIsResultUsed (
return_VALUE (FALSE);
}
/*
* Decide what to do with the result based on the parent. If
* the parent opcode will not use the result, delete the object.
@ -194,10 +190,7 @@ AcpiDsIsResultUsed (
*/
switch (ParentInfo->Class)
{
/*
* In these cases, the parent will never use the return object
*/
case AML_CLASS_CONTROL: /* IF, ELSE, WHILE only */
case AML_CLASS_CONTROL:
switch (Op->Parent->Opcode)
{
@ -205,70 +198,80 @@ AcpiDsIsResultUsed (
/* Never delete the return value associated with a return opcode */
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Result used, [RETURN] opcode=%X Op=%p\n", Op->Opcode, Op));
return_VALUE (TRUE);
break;
goto ResultUsed;
case AML_IF_OP:
case AML_WHILE_OP:
/*
* If we are executing the predicate AND this is the predicate op,
* we will use the return value!
* we will use the return value
*/
if ((WalkState->ControlState->Common.State == CONTROL_PREDICATE_EXECUTING) &&
if ((WalkState->ControlState->Common.State == ACPI_CONTROL_PREDICATE_EXECUTING) &&
(WalkState->ControlState->Control.PredicateOp == Op))
{
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Result used as a predicate, [IF/WHILE] opcode=%X Op=%p\n",
Op->Opcode, Op));
return_VALUE (TRUE);
goto ResultUsed;
}
break;
}
/* The general control opcode returns no result */
/* Fall through to not used case below */
goto ResultNotUsed;
case AML_CLASS_NAMED_OBJECT: /* Scope, method, etc. */
case AML_CLASS_CREATE:
/*
* These opcodes allow TermArg(s) as operands and therefore
* method calls. The result is used.
* the operands can be method calls. The result is used.
*/
if ((Op->Parent->Opcode == AML_REGION_OP) ||
(Op->Parent->Opcode == AML_CREATE_FIELD_OP) ||
(Op->Parent->Opcode == AML_CREATE_BIT_FIELD_OP) ||
(Op->Parent->Opcode == AML_CREATE_BYTE_FIELD_OP) ||
(Op->Parent->Opcode == AML_CREATE_WORD_FIELD_OP) ||
(Op->Parent->Opcode == AML_CREATE_DWORD_FIELD_OP) ||
(Op->Parent->Opcode == AML_CREATE_QWORD_FIELD_OP))
goto ResultUsed;
case AML_CLASS_NAMED_OBJECT:
if ((Op->Parent->Opcode == AML_REGION_OP) ||
(Op->Parent->Opcode == AML_DATA_REGION_OP) ||
(Op->Parent->Opcode == AML_PACKAGE_OP) ||
(Op->Parent->Opcode == AML_VAR_PACKAGE_OP) ||
(Op->Parent->Opcode == AML_BUFFER_OP) ||
(Op->Parent->Opcode == AML_INT_EVAL_SUBTREE_OP))
{
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Result used, [Region or CreateField] opcode=%X Op=%p\n",
Op->Opcode, Op));
return_VALUE (TRUE);
/*
* These opcodes allow TermArg(s) as operands and therefore
* the operands can be method calls. The result is used.
*/
goto ResultUsed;
}
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Result not used, Parent opcode=%X Op=%p\n", Op->Opcode, Op));
goto ResultNotUsed;
return_VALUE (FALSE);
break;
/*
* In all other cases. the parent will actually use the return
* object, so keep it.
*/
default:
break;
/*
* In all other cases. the parent will actually use the return
* object, so keep it.
*/
goto ResultUsed;
}
ResultUsed:
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] used by Parent [%s] Op=%p\n",
AcpiPsGetOpcodeName (Op->Opcode),
AcpiPsGetOpcodeName (Op->Parent->Opcode), Op));
return_VALUE (TRUE);
ResultNotUsed:
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] not used by Parent [%s] Op=%p\n",
AcpiPsGetOpcodeName (Op->Opcode),
AcpiPsGetOpcodeName (Op->Parent->Opcode), Op));
return_VALUE (FALSE);
}
@ -299,7 +302,7 @@ AcpiDsDeleteResultIfNotUsed (
ACPI_STATUS Status;
FUNCTION_TRACE_PTR ("DsDeleteResultIfNotUsed", ResultObj);
ACPI_FUNCTION_TRACE_PTR ("DsDeleteResultIfNotUsed", ResultObj);
if (!Op)
@ -355,16 +358,15 @@ AcpiDsCreateOperand (
ACPI_STATUS Status = AE_OK;
NATIVE_CHAR *NameString;
UINT32 NameLength;
ACPI_OBJECT_TYPE8 DataType;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_PARSE_OBJECT *ParentOp;
UINT16 Opcode;
UINT32 Flags;
OPERATING_MODE InterpreterMode;
ACPI_INTERPRETER_MODE InterpreterMode;
const ACPI_OPCODE_INFO *OpInfo;
char *Name;
FUNCTION_TRACE_PTR ("DsCreateOperand", Arg);
ACPI_FUNCTION_TRACE_PTR ("DsCreateOperand", Arg);
/* A valid name must be looked up in the namespace */
@ -404,26 +406,21 @@ AcpiDsCreateOperand (
{
/* Enter name into namespace if not found */
InterpreterMode = IMODE_LOAD_PASS2;
InterpreterMode = ACPI_IMODE_LOAD_PASS2;
}
else
{
/* Return a failure if name not found */
InterpreterMode = IMODE_EXECUTE;
InterpreterMode = ACPI_IMODE_EXECUTE;
}
Status = AcpiNsLookup (WalkState->ScopeInfo, NameString,
ACPI_TYPE_ANY, InterpreterMode,
NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE,
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
WalkState,
(ACPI_NAMESPACE_NODE **) &ObjDesc);
/* Free the namestring created above */
ACPI_MEM_FREE (NameString);
/*
* The only case where we pass through (ignore) a NOT_FOUND
* error is for the CondRefOf opcode.
@ -450,13 +447,18 @@ AcpiDsCreateOperand (
*/
Status = AE_AML_NAME_NOT_FOUND;
/* TBD: Externalize NameString and print */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Object name was not found in namespace\n"));
Name = NULL;
AcpiNsExternalizeName (ACPI_UINT32_MAX, NameString, NULL, &Name);
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Object name [%s] was not found in namespace\n", Name));
ACPI_MEM_FREE (Name);
}
}
/* Free the namestring created above */
ACPI_MEM_FREE (NameString);
/* Check status from the lookup */
if (ACPI_FAILURE (Status))
@ -471,7 +473,7 @@ AcpiDsCreateOperand (
{
return_ACPI_STATUS (Status);
}
DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (ObjDesc, WalkState));
ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (ObjDesc, WalkState));
}
@ -490,11 +492,6 @@ AcpiDsCreateOperand (
Opcode = AML_ZERO_OP; /* Has no arguments! */
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Null namepath: Arg=%p\n", Arg));
/*
* TBD: [Investigate] anything else needed for the
* zero op lvalue?
*/
}
else
@ -502,21 +499,21 @@ AcpiDsCreateOperand (
Opcode = Arg->Opcode;
}
/* Get the object type of the argument */
/* Get the data type of the argument */
DataType = AcpiDsMapOpcodeToDataType (Opcode, &Flags);
if (DataType == INTERNAL_TYPE_INVALID)
OpInfo = AcpiPsGetOpcodeInfo (Opcode);
if (OpInfo->ObjectType == INTERNAL_TYPE_INVALID)
{
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
}
if (Flags & OP_HAS_RETURN_VALUE)
if (OpInfo->Flags & AML_HAS_RETVAL)
{
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Argument previously created, already stacked \n"));
DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (WalkState->Operands [WalkState->NumOperands - 1], WalkState));
ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (
WalkState->Operands [WalkState->NumOperands - 1], WalkState));
/*
* Use value that was already previously returned
@ -533,14 +530,13 @@ AcpiDsCreateOperand (
AcpiFormatException (Status)));
return_ACPI_STATUS (Status);
}
}
else
{
/* Create an ACPI_INTERNAL_OBJECT for the argument */
ObjDesc = AcpiUtCreateInternalObject (DataType);
ObjDesc = AcpiUtCreateInternalObject (OpInfo->ObjectType);
if (!ObjDesc)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@ -565,7 +561,7 @@ AcpiDsCreateOperand (
return_ACPI_STATUS (Status);
}
DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (ObjDesc, WalkState));
ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (ObjDesc, WalkState));
}
return_ACPI_STATUS (AE_OK);
@ -596,7 +592,7 @@ AcpiDsCreateOperands (
UINT32 ArgCount = 0;
FUNCTION_TRACE_PTR ("DsCreateOperands", FirstArg);
ACPI_FUNCTION_TRACE_PTR ("DsCreateOperands", FirstArg);
/* For all arguments in the list... */
@ -658,18 +654,13 @@ AcpiDsResolveOperands (
ACPI_STATUS Status = AE_OK;
FUNCTION_TRACE_PTR ("DsResolveOperands", WalkState);
ACPI_FUNCTION_TRACE_PTR ("DsResolveOperands", WalkState);
/*
* Attempt to resolve each of the valid operands
* Method arguments are passed by value, not by reference
*/
/*
* TBD: [Investigate] Note from previous parser:
* RefOf problem with AcpiExResolveToValue() conversion.
*/
for (i = 0; i < WalkState->NumOperands; i++)
{
Status = AcpiExResolveToValue (&WalkState->Operands[i], WalkState);
@ -682,269 +673,3 @@ AcpiDsResolveOperands (
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiDsMapOpcodeToDataType
*
* PARAMETERS: Opcode - AML opcode to map
* OutFlags - Additional info about the opcode
*
* RETURN: The ACPI type associated with the opcode
*
* DESCRIPTION: Convert a raw AML opcode to the associated ACPI data type,
* if any. If the opcode returns a value as part of the
* intepreter execution, a flag is returned in OutFlags.
*
******************************************************************************/
ACPI_OBJECT_TYPE8
AcpiDsMapOpcodeToDataType (
UINT16 Opcode,
UINT32 *OutFlags)
{
ACPI_OBJECT_TYPE8 DataType = INTERNAL_TYPE_INVALID;
const ACPI_OPCODE_INFO *OpInfo;
UINT32 Flags = 0;
PROC_NAME ("DsMapOpcodeToDataType");
OpInfo = AcpiPsGetOpcodeInfo (Opcode);
if (OpInfo->Class == AML_CLASS_UNKNOWN)
{
/* Unknown opcode */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown AML opcode: %x\n", Opcode));
return (DataType);
}
/*
* TBD: Use op class
*/
switch (OpInfo->Type)
{
case AML_TYPE_LITERAL:
switch (Opcode)
{
case AML_BYTE_OP:
case AML_WORD_OP:
case AML_DWORD_OP:
case AML_QWORD_OP:
DataType = ACPI_TYPE_INTEGER;
break;
case AML_STRING_OP:
DataType = ACPI_TYPE_STRING;
break;
case AML_INT_NAMEPATH_OP:
DataType = INTERNAL_TYPE_REFERENCE;
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unknown (type LITERAL) AML opcode: %x\n", Opcode));
break;
}
break;
case AML_TYPE_DATA_TERM:
switch (Opcode)
{
case AML_BUFFER_OP:
DataType = ACPI_TYPE_BUFFER;
break;
case AML_PACKAGE_OP:
case AML_VAR_PACKAGE_OP:
DataType = ACPI_TYPE_PACKAGE;
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unknown (type DATA_TERM) AML opcode: %x\n", Opcode));
break;
}
break;
case AML_TYPE_CONSTANT:
case AML_TYPE_METHOD_ARGUMENT:
case AML_TYPE_LOCAL_VARIABLE:
DataType = INTERNAL_TYPE_REFERENCE;
break;
case AML_TYPE_EXEC_1A_0T_1R:
case AML_TYPE_EXEC_1A_1T_1R:
case AML_TYPE_EXEC_2A_0T_1R:
case AML_TYPE_EXEC_2A_1T_1R:
case AML_TYPE_EXEC_2A_2T_1R:
case AML_TYPE_EXEC_3A_1T_1R:
case AML_TYPE_EXEC_6A_0T_1R:
case AML_TYPE_RETURN:
Flags = OP_HAS_RETURN_VALUE;
DataType = ACPI_TYPE_ANY;
break;
case AML_TYPE_METHOD_CALL:
Flags = OP_HAS_RETURN_VALUE;
DataType = ACPI_TYPE_METHOD;
break;
case AML_TYPE_NAMED_FIELD:
case AML_TYPE_NAMED_SIMPLE:
case AML_TYPE_NAMED_COMPLEX:
case AML_TYPE_NAMED_NO_OBJ:
DataType = AcpiDsMapNamedOpcodeToDataType (Opcode);
break;
case AML_TYPE_EXEC_1A_0T_0R:
case AML_TYPE_EXEC_2A_0T_0R:
case AML_TYPE_EXEC_3A_0T_0R:
case AML_TYPE_EXEC_1A_1T_0R:
case AML_TYPE_CONTROL:
/* No mapping needed at this time */
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unimplemented data type opcode: %x\n", Opcode));
break;
}
/* Return flags to caller if requested */
if (OutFlags)
{
*OutFlags = Flags;
}
return (DataType);
}
/*******************************************************************************
*
* FUNCTION: AcpiDsMapNamedOpcodeToDataType
*
* PARAMETERS: Opcode - The Named AML opcode to map
*
* RETURN: The ACPI type associated with the named opcode
*
* DESCRIPTION: Convert a raw Named AML opcode to the associated data type.
* Named opcodes are a subsystem of the AML opcodes.
*
******************************************************************************/
ACPI_OBJECT_TYPE8
AcpiDsMapNamedOpcodeToDataType (
UINT16 Opcode)
{
ACPI_OBJECT_TYPE8 DataType;
FUNCTION_ENTRY ();
/* Decode Opcode */
switch (Opcode)
{
case AML_SCOPE_OP:
DataType = INTERNAL_TYPE_SCOPE;
break;
case AML_DEVICE_OP:
DataType = ACPI_TYPE_DEVICE;
break;
case AML_THERMAL_ZONE_OP:
DataType = ACPI_TYPE_THERMAL;
break;
case AML_METHOD_OP:
DataType = ACPI_TYPE_METHOD;
break;
case AML_POWER_RES_OP:
DataType = ACPI_TYPE_POWER;
break;
case AML_PROCESSOR_OP:
DataType = ACPI_TYPE_PROCESSOR;
break;
case AML_FIELD_OP: /* FieldOp */
DataType = INTERNAL_TYPE_FIELD_DEFN;
break;
case AML_INDEX_FIELD_OP: /* IndexFieldOp */
DataType = INTERNAL_TYPE_INDEX_FIELD_DEFN;
break;
case AML_BANK_FIELD_OP: /* BankFieldOp */
DataType = INTERNAL_TYPE_BANK_FIELD_DEFN;
break;
case AML_INT_NAMEDFIELD_OP: /* NO CASE IN ORIGINAL */
DataType = ACPI_TYPE_ANY;
break;
case AML_NAME_OP: /* NameOp - special code in original */
case AML_INT_NAMEPATH_OP:
DataType = ACPI_TYPE_ANY;
break;
case AML_ALIAS_OP:
DataType = INTERNAL_TYPE_ALIAS;
break;
case AML_MUTEX_OP:
DataType = ACPI_TYPE_MUTEX;
break;
case AML_EVENT_OP:
DataType = ACPI_TYPE_EVENT;
break;
case AML_DATA_REGION_OP:
case AML_REGION_OP:
DataType = ACPI_TYPE_REGION;
break;
default:
DataType = ACPI_TYPE_ANY;
break;
}
return (DataType);
}

View File

@ -2,7 +2,7 @@
*
* Module Name: dswexec - Dispatcher method execution callbacks;
* dispatch to interpreter.
* $Revision: 1.79 $
* $Revision: 1.90 $
*
*****************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@ -127,10 +127,10 @@
#define _COMPONENT ACPI_DISPATCHER
MODULE_NAME ("dswexec")
ACPI_MODULE_NAME ("dswexec")
/*
* Dispatch tables for opcode classes
* Dispatch table for opcode classes
*/
ACPI_EXECUTE_OP AcpiGbl_OpTypeDispatch [] = {
AcpiExOpcode_1A_0T_0R,
@ -160,18 +160,18 @@ ACPI_EXECUTE_OP AcpiGbl_OpTypeDispatch [] = {
ACPI_STATUS
AcpiDsGetPredicateValue (
ACPI_WALK_STATE *WalkState,
UINT32 HasResultObj)
ACPI_OPERAND_OBJECT *ResultObj)
{
ACPI_STATUS Status = AE_OK;
ACPI_OPERAND_OBJECT *ObjDesc;
FUNCTION_TRACE_PTR ("DsGetPredicateValue", WalkState);
ACPI_FUNCTION_TRACE_PTR ("DsGetPredicateValue", WalkState);
WalkState->ControlState->Common.State = 0;
if (HasResultObj)
if (ResultObj)
{
Status = AcpiDsResultPop (&ObjDesc, WalkState);
if (ACPI_FAILURE (Status))
@ -183,7 +183,6 @@ AcpiDsGetPredicateValue (
return_ACPI_STATUS (Status);
}
}
else
{
Status = AcpiDsCreateOperand (WalkState, WalkState->Op, 0);
@ -209,7 +208,6 @@ AcpiDsGetPredicateValue (
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
/*
* Result of predicate evaluation currently must
* be a number
@ -224,7 +222,6 @@ AcpiDsGetPredicateValue (
goto Cleanup;
}
/* Truncate the predicate to 32-bits if necessary */
AcpiExTruncateFor32bitTable (ObjDesc, WalkState);
@ -237,7 +234,6 @@ AcpiDsGetPredicateValue (
{
WalkState->ControlState->Common.Value = TRUE;
}
else
{
/*
@ -251,12 +247,12 @@ AcpiDsGetPredicateValue (
Cleanup:
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%pn",
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n",
WalkState->ControlState->Common.Value, WalkState->Op));
/* Break to debugger to display result */
DEBUGGER_EXEC (AcpiDbDisplayResultObject (ObjDesc, WalkState));
ACPI_DEBUGGER_EXEC (AcpiDbDisplayResultObject (ObjDesc, WalkState));
/*
* Delete the predicate result object (we know that
@ -264,7 +260,7 @@ Cleanup:
*/
AcpiUtRemoveReference (ObjDesc);
WalkState->ControlState->Common.State = CONTROL_NORMAL;
WalkState->ControlState->Common.State = ACPI_CONTROL_NORMAL;
return_ACPI_STATUS (Status);
}
@ -294,7 +290,7 @@ AcpiDsExecBeginOp (
UINT32 OpcodeClass;
FUNCTION_TRACE_PTR ("DsExecBeginOp", WalkState);
ACPI_FUNCTION_TRACE_PTR ("DsExecBeginOp", WalkState);
Op = WalkState->Op;
@ -310,6 +306,13 @@ AcpiDsExecBeginOp (
WalkState->Op = Op;
WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode);
WalkState->Opcode = Op->Opcode;
if (AcpiNsOpensScope (WalkState->OpInfo->ObjectType))
{
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n",
AcpiUtGetTypeName (WalkState->OpInfo->ObjectType), Op));
AcpiDsScopeStackPop (WalkState);
}
}
if (Op == WalkState->Origin)
@ -329,12 +332,12 @@ AcpiDsExecBeginOp (
*/
if ((WalkState->ControlState) &&
(WalkState->ControlState->Common.State ==
CONTROL_CONDITIONAL_EXECUTING))
ACPI_CONTROL_CONDITIONAL_EXECUTING))
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Exec predicate Op=%p State=%p\n",
Op, WalkState));
WalkState->ControlState->Common.State = CONTROL_PREDICATE_EXECUTING;
WalkState->ControlState->Common.State = ACPI_CONTROL_PREDICATE_EXECUTING;
/* Save start of predicate */
@ -370,7 +373,7 @@ AcpiDsExecBeginOp (
case AML_CLASS_NAMED_OBJECT:
if (WalkState->WalkType == WALK_METHOD)
if (WalkState->WalkType == ACPI_WALK_METHOD)
{
/*
* Found a named object declaration during method
@ -382,20 +385,17 @@ AcpiDsExecBeginOp (
Status = AcpiDsLoad2BeginOp (WalkState, NULL);
}
if (Op->Opcode == AML_REGION_OP)
{
Status = AcpiDsResultStackPush (WalkState);
}
break;
/* most operators with arguments */
case AML_CLASS_EXECUTE:
case AML_CLASS_CREATE:
/* most operators with arguments */
/* Start a new result/operand state */
Status = AcpiDsResultStackPush (WalkState);
@ -412,6 +412,7 @@ AcpiDsExecBeginOp (
}
/*****************************************************************************
*
* FUNCTION: AcpiDsExecEndOp
@ -441,7 +442,7 @@ AcpiDsExecEndOp (
UINT32 i;
FUNCTION_TRACE_PTR ("DsExecEndOp", WalkState);
ACPI_FUNCTION_TRACE_PTR ("DsExecEndOp", WalkState);
Op = WalkState->Op;
@ -462,23 +463,20 @@ AcpiDsExecEndOp (
WalkState->ReturnDesc = NULL;
WalkState->ResultObj = NULL;
/* Call debugger for single step support (DEBUG build only) */
DEBUGGER_EXEC (Status = AcpiDbSingleStep (WalkState, Op, OpClass));
DEBUGGER_EXEC (if (ACPI_FAILURE (Status)) {return_ACPI_STATUS (Status);});
ACPI_DEBUGGER_EXEC (Status = AcpiDbSingleStep (WalkState, Op, OpClass));
ACPI_DEBUGGER_EXEC (if (ACPI_FAILURE (Status)) {return_ACPI_STATUS (Status);});
/* Decode the Opcode Class */
switch (OpClass)
{
/* Decode the Opcode Class */
case AML_CLASS_ARGUMENT: /* constants, literals, etc. do nothing */
case AML_CLASS_ARGUMENT: /* constants, literals, etc. -- do nothing */
break;
/* most operators with arguments */
case AML_CLASS_EXECUTE:
case AML_CLASS_EXECUTE: /* most operators with arguments */
/* Build resolved operand stack */
@ -498,53 +496,41 @@ AcpiDsExecEndOp (
/* Resolve all operands */
Status = AcpiExResolveOperands (WalkState->Opcode,
&(WalkState->Operands [WalkState->NumOperands -1]),
Status = AcpiExResolveOperands (WalkState->Opcode,
&(WalkState->Operands [WalkState->NumOperands -1]),
WalkState);
if (ACPI_FAILURE (Status))
if (ACPI_SUCCESS (Status))
{
/* TBD: must pop and delete operands */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "[%s]: Could not resolve operands, %s\n",
AcpiPsGetOpcodeName (WalkState->Opcode), AcpiFormatException (Status)));
ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
AcpiPsGetOpcodeName (WalkState->Opcode),
WalkState->NumOperands, "after ExResolveOperands");
/*
* On error, we must delete all the operands and clear the
* operand stack
* Dispatch the request to the appropriate interpreter handler
* routine. There is one routine per opcode "type" based upon the
* number of opcode arguments and return type.
*/
for (i = 0; i < WalkState->NumOperands; i++)
{
AcpiUtRemoveReference (WalkState->Operands[i]);
WalkState->Operands[i] = NULL;
}
WalkState->NumOperands = 0;
goto Cleanup;
Status = AcpiGbl_OpTypeDispatch [OpType] (WalkState);
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"[%s]: Could not resolve operands, %s\n",
AcpiPsGetOpcodeName (WalkState->Opcode),
AcpiFormatException (Status)));
}
DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (WalkState->Opcode),
WalkState->NumOperands, "after ExResolveOperands");
/*
* Dispatch the request to the appropriate interpreter handler
* routine. There is one routine per opcode "type" based upon the
* number of opcode arguments and return type.
*/
Status = AcpiGbl_OpTypeDispatch [OpType] (WalkState);
/* Delete argument objects and clear the operand stack */
/* Always delete the argument objects and clear the operand stack */
for (i = 0; i < WalkState->NumOperands; i++)
{
/*
* Remove a reference to all operands, including both
* Remove a reference to all operands, including both
* "Arguments" and "Targets".
*/
AcpiUtRemoveReference (WalkState->Operands[i]);
WalkState->Operands[i] = NULL;
}
WalkState->NumOperands = 0;
/*
@ -600,10 +586,9 @@ AcpiDsExecEndOp (
}
/*
* Since the operands will be passed to another
* control method, we must resolve all local
* references here (Local variables, arguments
* to *this* method, etc.)
* Since the operands will be passed to another control method,
* we must resolve all local references here (Local variables,
* arguments to *this* method, etc.)
*/
Status = AcpiDsResolveOperands (WalkState);
if (ACPI_FAILURE (Status))
@ -622,7 +607,6 @@ AcpiDsExecEndOp (
* especially the operand count!
*/
return_ACPI_STATUS (Status);
break;
case AML_TYPE_CREATE_FIELD:
@ -640,9 +624,57 @@ AcpiDsExecEndOp (
break;
case AML_TYPE_CREATE_OBJECT:
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Executing CreateObject (Buffer/Package) Op=%p\n", Op));
switch (Op->Parent->Opcode)
{
case AML_NAME_OP:
/*
* Put the Node on the object stack (Contains the ACPI Name of
* this object)
*/
WalkState->Operands[0] = (void *) Op->Parent->Node;
WalkState->NumOperands = 1;
Status = AcpiDsCreateNode (WalkState, Op->Parent->Node, Op->Parent);
if (ACPI_FAILURE (Status))
{
break;
}
/* Fall through */
case AML_INT_EVAL_SUBTREE_OP:
Status = AcpiDsEvalDataObjectOperands (WalkState, Op, AcpiNsGetAttachedObject (Op->Parent->Node));
break;
default:
Status = AcpiDsEvalDataObjectOperands (WalkState, Op, NULL);
break;
}
/*
* If a result object was returned from above, push it on the
* current result stack
*/
if (ACPI_SUCCESS (Status) &&
WalkState->ResultObj)
{
Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
}
break;
case AML_TYPE_NAMED_FIELD:
case AML_TYPE_NAMED_COMPLEX:
case AML_TYPE_NAMED_SIMPLE:
case AML_TYPE_NAMED_NO_OBJ:
Status = AcpiDsLoad2EndOp (WalkState);
if (ACPI_FAILURE (Status))
@ -666,18 +698,21 @@ AcpiDsExecEndOp (
break;
case AML_TYPE_UNDEFINED:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Undefined opcode type Op=%p\n", Op));
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
break;
case AML_TYPE_BOGUS:
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Internal opcode=%X type Op=%p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Internal opcode=%X type Op=%p\n",
WalkState->Opcode, Op));
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
@ -690,8 +725,8 @@ AcpiDsExecEndOp (
}
/*
* ACPI 2.0 support for 64-bit integers:
* Truncate numeric result value if we are executing from a 32-bit ACPI table
* ACPI 2.0 support for 64-bit integers: Truncate numeric
* result value if we are executing from a 32-bit ACPI table
*/
AcpiExTruncateFor32bitTable (WalkState->ResultObj, WalkState);
@ -702,10 +737,10 @@ AcpiDsExecEndOp (
if ((WalkState->ControlState) &&
(WalkState->ControlState->Common.State ==
CONTROL_PREDICATE_EXECUTING) &&
ACPI_CONTROL_PREDICATE_EXECUTING) &&
(WalkState->ControlState->Control.PredicateOp == Op))
{
Status = AcpiDsGetPredicateValue (WalkState, (UINT32) WalkState->ResultObj);
Status = AcpiDsGetPredicateValue (WalkState, WalkState->ResultObj);
WalkState->ResultObj = NULL;
}
@ -715,7 +750,7 @@ Cleanup:
{
/* Break to debugger to display result */
DEBUGGER_EXEC (AcpiDbDisplayResultObject (WalkState->ResultObj, WalkState));
ACPI_DEBUGGER_EXEC (AcpiDbDisplayResultObject (WalkState->ResultObj, WalkState));
/*
* Delete the result op if and only if:
@ -727,10 +762,7 @@ Cleanup:
/* Always clear the object stack */
/* TBD: [Investigate] Clear stack of return value,
but don't delete it */
WalkState->NumOperands = 0;
return_ACPI_STATUS (Status);
}

File diff suppressed because it is too large Load Diff