Added 2000 to the copyright in the legal header

date	2000.12.08.20.55.00;	author rmoore1;	state Exp;
This commit is contained in:
aystarik 2005-06-29 16:59:30 +00:00
parent 19444dad12
commit b4c382d204
10 changed files with 1590 additions and 670 deletions

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsfield - Dispatcher field routines
* $Revision: 1.28 $
* $Revision: 1.30 $
*
*****************************************************************************/
@ -9,8 +9,8 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* All rights reserved.
*
* 2. License
*
@ -143,7 +143,7 @@
* FUNCTION: AcpiDsCreateField
*
* PARAMETERS: Op - Op containing the Field definition and args
* RegionNameDesc - Object for the containing Operation Region
* RegionNode - Object for the containing Operation Region
*
* RETURN: Status
*
@ -153,13 +153,13 @@
ACPI_STATUS
AcpiDsCreateField (
ACPI_GENERIC_OP *Op,
ACPI_NAMED_OBJECT *RegionNameDesc,
ACPI_PARSE_OBJECT *Op,
ACPI_NAMESPACE_NODE *RegionNode,
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status = AE_AML_ERROR;
ACPI_GENERIC_OP *Arg;
ACPI_NAMED_OBJECT *NameDesc;
ACPI_PARSE_OBJECT *Arg;
ACPI_NAMESPACE_NODE *Node;
UINT8 FieldFlags;
UINT8 AccessAttribute = 0;
UINT32 FieldBitPosition = 0;
@ -171,12 +171,12 @@ AcpiDsCreateField (
/* First arg is the name of the parent OpRegion */
Arg = Op->Value.Arg;
if (!RegionNameDesc)
if (!RegionNode)
{
Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.Name,
ACPI_TYPE_REGION, IMODE_EXECUTE,
NS_SEARCH_PARENT, WalkState,
&RegionNameDesc);
&RegionNode);
if (ACPI_FAILURE (Status))
{
@ -219,11 +219,11 @@ AcpiDsCreateField (
case AML_NAMEDFIELD_OP:
Status = AcpiNsLookup (WalkState->ScopeInfo,
(NATIVE_CHAR *) &((ACPI_EXTENDED_OP *)Arg)->Name,
(NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Arg)->Name,
INTERNAL_TYPE_DEF_FIELD,
IMODE_LOAD_PASS1,
NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
NULL, &NameDesc);
NULL, &Node);
if (ACPI_FAILURE (Status))
{
@ -231,11 +231,11 @@ AcpiDsCreateField (
}
/*
* Initialize an object for the new Named Object that is on
* Initialize an object for the new Node that is on
* the object stack
*/
Status = AcpiAmlPrepDefFieldValue (NameDesc, RegionNameDesc, FieldFlags,
Status = AcpiAmlPrepDefFieldValue (Node, RegionNode, FieldFlags,
AccessAttribute, FieldBitPosition, Arg->Value.Size);
if (ACPI_FAILURE (Status))
@ -261,7 +261,7 @@ AcpiDsCreateField (
* FUNCTION: AcpiDsCreateBankField
*
* PARAMETERS: Op - Op containing the Field definition and args
* RegionNameDesc - Object for the containing Operation Region
* RegionNode - Object for the containing Operation Region
*
* RETURN: Status
*
@ -271,14 +271,14 @@ AcpiDsCreateField (
ACPI_STATUS
AcpiDsCreateBankField (
ACPI_GENERIC_OP *Op,
ACPI_NAMED_OBJECT *RegionNameDesc,
ACPI_PARSE_OBJECT *Op,
ACPI_NAMESPACE_NODE *RegionNode,
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status = AE_AML_ERROR;
ACPI_GENERIC_OP *Arg;
ACPI_NAMED_OBJECT *BankReg;
ACPI_NAMED_OBJECT *NameDesc;
ACPI_PARSE_OBJECT *Arg;
ACPI_NAMESPACE_NODE *RegisterNode;
ACPI_NAMESPACE_NODE *Node;
UINT32 BankValue;
UINT8 FieldFlags;
UINT8 AccessAttribute = 0;
@ -288,16 +288,15 @@ AcpiDsCreateBankField (
FUNCTION_TRACE_PTR ("DsCreateBankField", Op);
/* First arg is the name of the parent OpRegion */
Arg = Op->Value.Arg;
if (!RegionNameDesc)
if (!RegionNode)
{
Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.Name,
ACPI_TYPE_REGION, IMODE_EXECUTE,
NS_SEARCH_PARENT, WalkState,
&RegionNameDesc);
&RegionNode);
if (ACPI_FAILURE (Status))
{
@ -313,7 +312,7 @@ AcpiDsCreateBankField (
INTERNAL_TYPE_BANK_FIELD_DEFN,
IMODE_LOAD_PASS1,
NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
NULL, &BankReg);
NULL, &RegisterNode);
if (ACPI_FAILURE (Status))
{
@ -361,11 +360,11 @@ AcpiDsCreateBankField (
case AML_NAMEDFIELD_OP:
Status = AcpiNsLookup (WalkState->ScopeInfo,
(NATIVE_CHAR *) &((ACPI_EXTENDED_OP *)Arg)->Name,
(NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Arg)->Name,
INTERNAL_TYPE_DEF_FIELD,
IMODE_LOAD_PASS1,
NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
NULL, &NameDesc);
NULL, &Node);
if (ACPI_FAILURE (Status))
{
@ -373,11 +372,11 @@ AcpiDsCreateBankField (
}
/*
* Initialize an object for the new Named Object that is on
* Initialize an object for the new Node that is on
* the object stack
*/
Status = AcpiAmlPrepBankFieldValue (NameDesc, RegionNameDesc, BankReg,
Status = AcpiAmlPrepBankFieldValue (Node, RegionNode, RegisterNode,
BankValue, FieldFlags, AccessAttribute,
FieldBitPosition, Arg->Value.Size);
@ -405,7 +404,7 @@ AcpiDsCreateBankField (
* FUNCTION: AcpiDsCreateIndexField
*
* PARAMETERS: Op - Op containing the Field definition and args
* RegionNameDesc - Object for the containing Operation Region
* RegionNode - Object for the containing Operation Region
*
* RETURN: Status
*
@ -415,15 +414,15 @@ AcpiDsCreateBankField (
ACPI_STATUS
AcpiDsCreateIndexField (
ACPI_GENERIC_OP *Op,
ACPI_HANDLE RegionNameDesc,
ACPI_PARSE_OBJECT *Op,
ACPI_HANDLE RegionNode,
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status;
ACPI_GENERIC_OP *Arg;
ACPI_NAMED_OBJECT *NameDesc;
ACPI_NAMED_OBJECT *IndexReg;
ACPI_NAMED_OBJECT *DataReg;
ACPI_PARSE_OBJECT *Arg;
ACPI_NAMESPACE_NODE *Node;
ACPI_NAMESPACE_NODE *IndexRegisterNode;
ACPI_NAMESPACE_NODE *DataRegisterNode;
UINT8 FieldFlags;
UINT8 AccessAttribute = 0;
UINT32 FieldBitPosition = 0;
@ -439,7 +438,7 @@ AcpiDsCreateIndexField (
Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String,
ACPI_TYPE_ANY, IMODE_LOAD_PASS1,
NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
NULL, &IndexReg);
NULL, &IndexRegisterNode);
if (ACPI_FAILURE (Status))
{
@ -454,7 +453,7 @@ AcpiDsCreateIndexField (
INTERNAL_TYPE_INDEX_FIELD_DEFN,
IMODE_LOAD_PASS1,
NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
NULL, &DataReg);
NULL, &DataRegisterNode);
if (ACPI_FAILURE (Status))
{
@ -498,11 +497,11 @@ AcpiDsCreateIndexField (
case AML_NAMEDFIELD_OP:
Status = AcpiNsLookup (WalkState->ScopeInfo,
(NATIVE_CHAR *) &((ACPI_EXTENDED_OP *)Arg)->Name,
(NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Arg)->Name,
INTERNAL_TYPE_INDEX_FIELD,
IMODE_LOAD_PASS1,
NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
NULL, &NameDesc);
NULL, &Node);
if (ACPI_FAILURE (Status))
{
@ -510,11 +509,11 @@ AcpiDsCreateIndexField (
}
/*
* Initialize an object for the new Named Object that is on
* Initialize an object for the new Node that is on
* the object stack
*/
Status = AcpiAmlPrepIndexFieldValue (NameDesc, IndexReg, DataReg,
Status = AcpiAmlPrepIndexFieldValue (Node, IndexRegisterNode, DataRegisterNode,
FieldFlags, AccessAttribute,
FieldBitPosition, Arg->Value.Size);

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsmethod - Parser/Interpreter interface - control method parsing
* $Revision: 1.49 $
* $Revision: 1.54 $
*
*****************************************************************************/
@ -9,8 +9,8 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* All rights reserved.
*
* 2. License
*
@ -130,12 +130,11 @@
MODULE_NAME ("dsmethod")
/*******************************************************************************
*
* FUNCTION: AcpiDsParseMethod
*
* PARAMETERS: ObjHandle - Named Object of the method
* PARAMETERS: ObjHandle - Node of the method
* Level - Current nesting level
* Context - Points to a method counter
* ReturnValue - Not used
@ -154,9 +153,9 @@ AcpiDsParseMethod (
ACPI_HANDLE ObjHandle)
{
ACPI_STATUS Status;
ACPI_OBJECT_INTERNAL *ObjDesc;
ACPI_GENERIC_OP *Op;
ACPI_NAMED_OBJECT *NameDesc;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_PARSE_OBJECT *Op;
ACPI_NAMESPACE_NODE *Node;
ACPI_OWNER_ID OwnerId;
@ -172,13 +171,13 @@ AcpiDsParseMethod (
DEBUG_PRINT (ACPI_INFO,
("DsParseMethod: **** Parsing [%4.4s] **** NamedObj=%p\n",
&((ACPI_NAMED_OBJECT*)ObjHandle)->Name, ObjHandle));
&((ACPI_NAMESPACE_NODE *)ObjHandle)->Name, ObjHandle));
/* Extract the method object from the method Named Object */
/* Extract the method object from the method Node */
NameDesc = (ACPI_NAMED_OBJECT*) ObjHandle;
ObjDesc = NameDesc->Object;
Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
ObjDesc = Node->Object;
if (!ObjDesc)
{
return_ACPI_STATUS (AE_NULL_OBJECT);
@ -208,10 +207,10 @@ AcpiDsParseMethod (
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Init new op with the method name and pointer back to the Named Object */
/* Init new op with the method name and pointer back to the Node */
AcpiPsSetName (Op, NameDesc->Name);
Op->AcpiNamedObject = NameDesc;
AcpiPsSetName (Op, Node->Name);
Op->Node = Node;
/*
@ -227,9 +226,9 @@ AcpiDsParseMethod (
*/
Status = AcpiPsParseAml (Op, ObjDesc->Method.Pcode,
ObjDesc->Method.PcodeLength,
ObjDesc->Method.PcodeLength,
ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE,
NameDesc, NULL, NULL,
Node, NULL, NULL,
AcpiDsLoad1BeginOp, AcpiDsLoad1EndOp);
if (ACPI_FAILURE (Status))
@ -242,16 +241,13 @@ AcpiDsParseMethod (
OwnerId = AcpiCmAllocateOwnerId (OWNER_TYPE_METHOD);
ObjDesc->Method.OwningId = OwnerId;
DEBUGGER_EXEC (AcpiDbGenerateStatistics (Op, 1));
DEBUG_PRINT (ACPI_INFO,
("DsParseMethod: **** [%4.4s] Parsed **** NamedObj=%p Op=%p\n",
&((ACPI_NAMED_OBJECT*)ObjHandle)->Name, ObjHandle, Op));
&((ACPI_NAMESPACE_NODE *)ObjHandle)->Name, ObjHandle, Op));
/* Install the parsed tree in the method object */
/* TBD: [Restructure] Obsolete field? */
AcpiPsDeleteParseTree (Op);
@ -263,7 +259,7 @@ AcpiDsParseMethod (
*
* FUNCTION: AcpiDsBeginMethodExecution
*
* PARAMETERS: MethodNameDesc - Named Object of the method
* PARAMETERS: MethodNode - Node of the method
* ObjDesc - The method object
*
* RETURN: Status
@ -278,21 +274,21 @@ AcpiDsParseMethod (
ACPI_STATUS
AcpiDsBeginMethodExecution (
ACPI_NAMED_OBJECT *MethodNameDesc,
ACPI_OBJECT_INTERNAL *ObjDesc)
ACPI_NAMESPACE_NODE *MethodNode,
ACPI_OPERAND_OBJECT *ObjDesc)
{
ACPI_STATUS Status = AE_OK;
FUNCTION_TRACE_PTR ("DsBeginMethodExecution", MethodNameDesc);
FUNCTION_TRACE_PTR ("DsBeginMethodExecution", MethodNode);
if (!MethodNameDesc)
if (!MethodNode)
{
return_ACPI_STATUS (AE_NULL_ENTRY);
}
ObjDesc = AcpiNsGetAttachedObject (MethodNameDesc);
ObjDesc = AcpiNsGetAttachedObject (MethodNode);
if (!ObjDesc)
{
return_ACPI_STATUS (AE_NULL_OBJECT);
@ -343,11 +339,11 @@ ACPI_STATUS
AcpiDsCallControlMethod (
ACPI_WALK_LIST *WalkList,
ACPI_WALK_STATE *ThisWalkState,
ACPI_GENERIC_OP *Op)
ACPI_PARSE_OBJECT *Op)
{
ACPI_STATUS Status;
ACPI_NAMED_OBJECT *MethodNameDesc;
ACPI_OBJECT_INTERNAL *ObjDesc;
ACPI_NAMESPACE_NODE *MethodNode;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_WALK_STATE *NextWalkState;
ACPI_PARSE_STATE *ParserState;
UINT32 i;
@ -363,13 +359,13 @@ AcpiDsCallControlMethod (
* Get the namespace entry for the control method we are about to call
*/
MethodNameDesc = ThisWalkState->MethodCallNameDesc;
if (!MethodNameDesc)
MethodNode = ThisWalkState->MethodCallNode;
if (!MethodNode)
{
return_ACPI_STATUS (AE_NULL_ENTRY);
}
ObjDesc = AcpiNsGetAttachedObject (MethodNameDesc);
ObjDesc = AcpiNsGetAttachedObject (MethodNode);
if (!ObjDesc)
{
return_ACPI_STATUS (AE_NULL_OBJECT);
@ -378,7 +374,7 @@ AcpiDsCallControlMethod (
/* Init for new method, wait on concurrency semaphore */
Status = AcpiDsBeginMethodExecution (MethodNameDesc, ObjDesc);
Status = AcpiDsBeginMethodExecution (MethodNode, ObjDesc);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -387,7 +383,7 @@ AcpiDsCallControlMethod (
/* Create and initialize a new parser state */
ParserState = AcpiPsCreateState (ObjDesc->Method.Pcode,
ParserState = AcpiPsCreateState (ObjDesc->Method.Pcode,
ObjDesc->Method.PcodeLength);
if (!ParserState)
{
@ -395,7 +391,7 @@ AcpiDsCallControlMethod (
}
AcpiPsInitScope (ParserState, NULL);
ParserState->StartEntry = MethodNameDesc;
ParserState->StartNode = MethodNode;
/* Create a new state for the preempting walk */
@ -410,7 +406,7 @@ AcpiDsCallControlMethod (
}
NextWalkState->WalkType = WALK_METHOD;
NextWalkState->MethodNameDesc = MethodNameDesc;
NextWalkState->MethodNode = MethodNode;
NextWalkState->ParserState = ParserState;
NextWalkState->ParseFlags = ThisWalkState->ParseFlags;
NextWalkState->DescendingCallback = ThisWalkState->DescendingCallback;
@ -423,7 +419,7 @@ AcpiDsCallControlMethod (
/* Open a new scope */
Status = AcpiDsScopeStackPush (MethodNameDesc,
Status = AcpiDsScopeStackPush (MethodNode,
ACPI_TYPE_METHOD, NextWalkState);
if (ACPI_FAILURE (Status))
{
@ -439,7 +435,7 @@ AcpiDsCallControlMethod (
*/
Status = AcpiDsMethodDataInitArgs (&ThisWalkState->Operands[0],
ThisWalkState->NumOperands,
ThisWalkState->NumOperands,
NextWalkState);
if (ACPI_FAILURE (Status))
{
@ -447,8 +443,7 @@ AcpiDsCallControlMethod (
}
/* Create and init a root object */
/* Create and init a Root Node */
Op = AcpiPsAllocOp (AML_SCOPE_OP);
if (!Op)
@ -457,14 +452,13 @@ AcpiDsCallControlMethod (
}
Status = AcpiPsParseAml (Op, ObjDesc->Method.Pcode,
ObjDesc->Method.PcodeLength,
ObjDesc->Method.PcodeLength,
ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE,
MethodNameDesc, NULL, NULL,
MethodNode, NULL, NULL,
AcpiDsLoad1BeginOp, AcpiDsLoad1EndOp);
AcpiPsDeleteParseTree (Op);
/*
* Delete the operands on the previous walkstate operand stack
* (they were copied to new objects)
@ -513,7 +507,7 @@ Cleanup:
ACPI_STATUS
AcpiDsRestartControlMethod (
ACPI_WALK_STATE *WalkState,
ACPI_OBJECT_INTERNAL *ReturnDesc)
ACPI_OPERAND_OBJECT *ReturnDesc)
{
ACPI_STATUS Status;
@ -530,14 +524,14 @@ AcpiDsRestartControlMethod (
* NULL if no return value
*/
Status = AcpiDsResultStackPush (ReturnDesc, WalkState);
Status = AcpiDsResultPush (ReturnDesc, WalkState);
if (ACPI_FAILURE (Status))
{
AcpiCmRemoveReference (ReturnDesc);
return_ACPI_STATUS (Status);
}
}
else
{
/*
@ -577,8 +571,8 @@ AcpiDsTerminateControlMethod (
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status;
ACPI_OBJECT_INTERNAL *ObjDesc;
ACPI_NAMED_OBJECT *MethodNameDesc;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_NAMESPACE_NODE *MethodNode;
FUNCTION_TRACE_PTR ("DsTerminateControlMethod", WalkState);
@ -622,17 +616,17 @@ AcpiDsTerminateControlMethod (
* There are no more threads executing this method. Perform
* additional cleanup.
*
* The method Named Object is stored in the walk state
* The method Node is stored in the walk state
*/
MethodNameDesc = WalkState->MethodNameDesc;
MethodNode = WalkState->MethodNode;
/*
* Delete any namespace entries created immediately underneath
* the method
*/
AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE);
if (MethodNameDesc->Child)
if (MethodNode->Child)
{
AcpiNsDeleteNamespaceSubtree (MethodNameDesc);
AcpiNsDeleteNamespaceSubtree (MethodNode);
}
/*

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dsmthdat - control method arguments and local variables
* $Revision: 1.33 $
* $Revision: 1.37 $
*
******************************************************************************/
@ -9,8 +9,8 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* All rights reserved.
*
* 2. License
*
@ -156,8 +156,8 @@ AcpiDsMethodDataInit (
* WalkState fields are initialized to zero by the
* AcpiCmCallocate().
*
* An Named Object is assigned to each argument and local so
* that RefOf() can return a pointer to the Named Object.
* An Node is assigned to each argument and local so
* that RefOf() can return a pointer to the Node.
*/
/* Init the method arguments */
@ -166,10 +166,10 @@ AcpiDsMethodDataInit (
{
MOVE_UNALIGNED32_TO_32 (&WalkState->Arguments[i].Name,
NAMEOF_ARG_NTE);
WalkState->Arguments[i].Name |= (i << 24);
WalkState->Arguments[i].DataType = ACPI_DESC_TYPE_NAMED;
WalkState->Arguments[i].Type = INTERNAL_TYPE_METHOD_ARGUMENT;
WalkState->Arguments[i].Type = ACPI_TYPE_ANY;
WalkState->Arguments[i].Flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG;
}
/* Init the method locals */
@ -181,7 +181,8 @@ AcpiDsMethodDataInit (
WalkState->LocalVariables[i].Name |= (i << 24);
WalkState->LocalVariables[i].DataType = ACPI_DESC_TYPE_NAMED;
WalkState->LocalVariables[i].Type = INTERNAL_TYPE_METHOD_LOCAL_VAR;
WalkState->LocalVariables[i].Type = ACPI_TYPE_ANY;
WalkState->LocalVariables[i].Flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
}
return_ACPI_STATUS (AE_OK);
@ -206,7 +207,7 @@ AcpiDsMethodDataDeleteAll (
ACPI_WALK_STATE *WalkState)
{
UINT32 Index;
ACPI_OBJECT_INTERNAL *Object;
ACPI_OPERAND_OBJECT *Object;
FUNCTION_TRACE ("DsMethodDataDeleteAll");
@ -277,7 +278,7 @@ AcpiDsMethodDataDeleteAll (
ACPI_STATUS
AcpiDsMethodDataInitArgs (
ACPI_OBJECT_INTERNAL **Params,
ACPI_OPERAND_OBJECT **Params,
UINT32 MaxParamCount,
ACPI_WALK_STATE *WalkState)
{
@ -351,7 +352,7 @@ AcpiDsMethodDataGetEntry (
UINT32 Type,
UINT32 Index,
ACPI_WALK_STATE *WalkState,
ACPI_OBJECT_INTERNAL ***Entry)
ACPI_OPERAND_OBJECT ***Entry)
{
FUNCTION_TRACE_U32 ("DsMethodDataGetEntry", Index);
@ -376,7 +377,7 @@ AcpiDsMethodDataGetEntry (
}
*Entry =
(ACPI_OBJECT_INTERNAL **) &WalkState->LocalVariables[Index].Object;
(ACPI_OPERAND_OBJECT **) &WalkState->LocalVariables[Index].Object;
break;
@ -391,7 +392,7 @@ AcpiDsMethodDataGetEntry (
}
*Entry =
(ACPI_OBJECT_INTERNAL **) &WalkState->Arguments[Index].Object;
(ACPI_OPERAND_OBJECT **) &WalkState->Arguments[Index].Object;
break;
@ -425,11 +426,11 @@ ACPI_STATUS
AcpiDsMethodDataSetEntry (
UINT32 Type,
UINT32 Index,
ACPI_OBJECT_INTERNAL *Object,
ACPI_OPERAND_OBJECT *Object,
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status;
ACPI_OBJECT_INTERNAL **Entry;
ACPI_OPERAND_OBJECT **Entry;
FUNCTION_TRACE ("DsMethodDataSetEntry");
@ -474,8 +475,8 @@ AcpiDsMethodDataGetType (
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status;
ACPI_OBJECT_INTERNAL **Entry;
ACPI_OBJECT_INTERNAL *Object;
ACPI_OPERAND_OBJECT **Entry;
ACPI_OPERAND_OBJECT *Object;
FUNCTION_TRACE ("DsMethodDataGetType");
@ -513,23 +514,22 @@ AcpiDsMethodDataGetType (
* Index - Which localVar or argument whose type
* to get
*
* RETURN: Get the Named Object associated with a local or arg.
* RETURN: Get the Node associated with a local or arg.
*
******************************************************************************/
ACPI_NAMED_OBJECT*
ACPI_NAMESPACE_NODE *
AcpiDsMethodDataGetNte (
UINT32 Type,
UINT32 Index,
ACPI_WALK_STATE *WalkState)
{
ACPI_NAMED_OBJECT *NameDesc = NULL;
ACPI_NAMESPACE_NODE *Node = NULL;
FUNCTION_TRACE ("DsMethodDataGetNte");
switch (Type)
{
@ -540,10 +540,10 @@ AcpiDsMethodDataGetNte (
DEBUG_PRINT (ACPI_ERROR,
("DsMethodDataGetEntry: LocalVar index %d is invalid (max %d)\n",
Index, MTH_MAX_LOCAL));
return_PTR (NameDesc);
return_PTR (Node);
}
NameDesc = &WalkState->LocalVariables[Index];
Node = &WalkState->LocalVariables[Index];
break;
@ -554,10 +554,10 @@ AcpiDsMethodDataGetNte (
DEBUG_PRINT (ACPI_ERROR,
("DsMethodDataGetEntry: Argument index %d is invalid (max %d)\n",
Index, MTH_MAX_ARG));
return_PTR (NameDesc);
return_PTR (Node);
}
NameDesc = &WalkState->Arguments[Index];
Node = &WalkState->Arguments[Index];
break;
@ -569,7 +569,7 @@ AcpiDsMethodDataGetNte (
}
return_PTR (NameDesc);
return_PTR (Node);
}
@ -595,11 +595,11 @@ AcpiDsMethodDataGetValue (
UINT32 Type,
UINT32 Index,
ACPI_WALK_STATE *WalkState,
ACPI_OBJECT_INTERNAL **DestDesc)
ACPI_OPERAND_OBJECT **DestDesc)
{
ACPI_STATUS Status;
ACPI_OBJECT_INTERNAL **Entry;
ACPI_OBJECT_INTERNAL *Object;
ACPI_OPERAND_OBJECT **Entry;
ACPI_OPERAND_OBJECT *Object;
FUNCTION_TRACE ("DsMethodDataGetValue");
@ -644,14 +644,14 @@ AcpiDsMethodDataGetValue (
{
case MTH_TYPE_ARG:
DEBUG_PRINT (ACPI_ERROR,
("DsMethodDataGetValue: Uninitialized Arg[%d] at entry %X\n",
("DsMethodDataGetValue: Uninitialized Arg[%d] at entry %p\n",
Index, Entry));
return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG);
break;
case MTH_TYPE_LOCAL:
DEBUG_PRINT (ACPI_ERROR,
("DsMethodDataGetValue: Uninitialized Local[%d] at entry %X\n",
("DsMethodDataGetValue: Uninitialized Local[%d] at entry %p\n",
Index, Entry));
return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);
break;
@ -692,8 +692,8 @@ AcpiDsMethodDataDeleteValue (
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status;
ACPI_OBJECT_INTERNAL **Entry;
ACPI_OBJECT_INTERNAL *Object;
ACPI_OPERAND_OBJECT **Entry;
ACPI_OPERAND_OBJECT *Object;
FUNCTION_TRACE ("DsMethodDataDeleteValue");
@ -714,7 +714,7 @@ AcpiDsMethodDataDeleteValue (
/*
* Undefine the Arg or Local by setting its descriptor
* pointer to NULL. Locals/Args can contain both
* ACPI_OBJECT_INTERNALS and ACPI_NAMED_OBJECTs
* ACPI_OPERAND_OBJECTS and ACPI_NAMESPACE_NODEs
*/
*Entry = NULL;
@ -761,11 +761,11 @@ ACPI_STATUS
AcpiDsMethodDataSetValue (
UINT32 Type,
UINT32 Index,
ACPI_OBJECT_INTERNAL *SrcDesc,
ACPI_OPERAND_OBJECT *SrcDesc,
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status;
ACPI_OBJECT_INTERNAL **Entry;
ACPI_OPERAND_OBJECT **Entry;
FUNCTION_TRACE ("DsMethodDataSetValue");
@ -810,7 +810,7 @@ AcpiDsMethodDataSetValue (
{
/*
* Check for an indirect store if an argument
* contains an object reference (stored as an Named Object).
* contains an object reference (stored as an Node).
* We don't allow this automatic dereferencing for
* locals, since a store to a local should overwrite
* anything there, including an object reference.
@ -829,19 +829,19 @@ AcpiDsMethodDataSetValue (
(VALID_DESCRIPTOR_TYPE (*Entry, ACPI_DESC_TYPE_NAMED)))
{
DEBUG_PRINT (TRACE_EXEC,
("DsMethodDataSetValue: Arg (%p) is an ObjRef(Named Object), storing in %p\n",
("DsMethodDataSetValue: Arg (%p) is an ObjRef(Node), storing in %p\n",
SrcDesc, *Entry));
/* Detach an existing object from the Named Object */
/* Detach an existing object from the Node */
AcpiNsDetachObject ((ACPI_NAMED_OBJECT *) *Entry);
AcpiNsDetachObject ((ACPI_NAMESPACE_NODE *) *Entry);
/*
* Store this object into the Named Object
* Store this object into the Node
* (do the indirect store)
*/
Status = AcpiNsAttachObject ((ACPI_NAMED_OBJECT *) *Entry, SrcDesc,
Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) *Entry, SrcDesc,
SrcDesc->Common.Type);
return_ACPI_STATUS (Status);
}

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsobject - Dispatcher object management routines
* $Revision: 1.42 $
* $Revision: 1.54 $
*
*****************************************************************************/
@ -9,8 +9,8 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* All rights reserved.
*
* 2. License
*
@ -131,7 +131,7 @@
*
* FUNCTION: AcpiDsInitOneObject
*
* PARAMETERS: ObjHandle - Named Object
* PARAMETERS: ObjHandle - Node
* Level - Current nesting level
* Context - Points to a init info struct
* ReturnValue - Not used
@ -156,15 +156,19 @@ AcpiDsInitOneObject (
{
OBJECT_TYPE_INTERNAL Type;
ACPI_STATUS Status;
INIT_WALK_INFO *Info = (INIT_WALK_INFO *) Context;
ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context;
UINT8 TableRevision;
Info->ObjectCount++;
TableRevision = Info->TableDesc->Pointer->Revision;
/*
* We are only interested in objects owned by the table that
* was just loaded
*/
if (((ACPI_NAMED_OBJECT*) ObjHandle)->OwnerId !=
if (((ACPI_NAMESPACE_NODE *) ObjHandle)->OwnerId !=
Info->TableDesc->TableId)
{
return (AE_OK);
@ -192,6 +196,15 @@ AcpiDsInitOneObject (
DEBUG_PRINT_RAW (ACPI_OK, ("."));
/*
* Set the execution data width (32 or 64) based upon the
* revision number of the parent ACPI table.
*/
if (TableRevision == 1)
{
((ACPI_NAMESPACE_NODE *)ObjHandle)->Flags |= ANOBJ_DATA_WIDTH_32;
}
/*
* Always parse methods to detect errors, we may delete
@ -206,21 +219,16 @@ AcpiDsInitOneObject (
{
DEBUG_PRINT (ACPI_ERROR,
("DsInitOneObject: Method %p [%4.4s] parse failed! %s\n",
ObjHandle, &((ACPI_NAMED_OBJECT*)ObjHandle)->Name,
ObjHandle, &((ACPI_NAMESPACE_NODE *)ObjHandle)->Name,
AcpiCmFormatException (Status)));
break;
}
/*
* Keep the parse tree only if we are parsing all methods
* at init time (versus just-in-time)
* Delete the parse tree. We simple re-parse the method
* for every execution since there isn't much overhead
*/
if (AcpiGbl_WhenToParseMethods != METHOD_PARSE_AT_INIT)
{
AcpiNsDeleteNamespaceSubtree (ObjHandle);
}
AcpiNsDeleteNamespaceSubtree (ObjHandle);
break;
default:
@ -243,7 +251,7 @@ AcpiDsInitOneObject (
*
* RETURN: Status
*
* DESCRIPTION: Walk the entire namespace and perform any necessary
* DESCRIPTION: Walk the entire namespace and perform any necessary
* initialization on the objects found therein
*
******************************************************************************/
@ -251,10 +259,10 @@ AcpiDsInitOneObject (
ACPI_STATUS
AcpiDsInitializeObjects (
ACPI_TABLE_DESC *TableDesc,
ACPI_NAMED_OBJECT *StartEntry)
ACPI_NAMESPACE_NODE *StartNode)
{
ACPI_STATUS Status;
INIT_WALK_INFO Info;
ACPI_INIT_WALK_INFO Info;
FUNCTION_TRACE ("DsInitializeObjects");
@ -265,14 +273,15 @@ AcpiDsInitializeObjects (
DEBUG_PRINT_RAW (ACPI_OK, ("Parsing Methods:"));
Info.MethodCount = 0;
Info.OpRegionCount = 0;
Info.TableDesc = TableDesc;
Info.MethodCount = 0;
Info.OpRegionCount = 0;
Info.ObjectCount = 0;
Info.TableDesc = TableDesc;
/* Walk entire namespace from the supplied root */
Status = AcpiWalkNamespace (ACPI_TYPE_ANY, StartEntry,
Status = AcpiWalkNamespace (ACPI_TYPE_ANY, StartNode,
ACPI_UINT32_MAX, AcpiDsInitOneObject,
&Info, NULL);
if (ACPI_FAILURE (Status))
@ -282,7 +291,8 @@ AcpiDsInitializeObjects (
}
DEBUG_PRINT_RAW (ACPI_OK,
("\n%d Control Methods found and parsed\n", Info.MethodCount));
("\n%d Control Methods found and parsed (%d nodes total)\n",
Info.MethodCount, Info.ObjectCount));
DEBUG_PRINT (TRACE_DISPATCH,
("DsInitializeObjects: %d Control Methods found\n", Info.MethodCount));
DEBUG_PRINT (TRACE_DISPATCH,
@ -311,15 +321,15 @@ AcpiDsInitializeObjects (
ACPI_STATUS
AcpiDsInitObjectFromOp (
ACPI_WALK_STATE *WalkState,
ACPI_GENERIC_OP *Op,
ACPI_PARSE_OBJECT *Op,
UINT16 Opcode,
ACPI_OBJECT_INTERNAL **ObjDesc)
ACPI_OPERAND_OBJECT **ObjDesc)
{
ACPI_STATUS Status;
ACPI_GENERIC_OP *Arg;
ACPI_EXTENDED_OP *ByteList;
ACPI_OBJECT_INTERNAL *ArgDesc;
ACPI_OP_INFO *OpInfo;
ACPI_PARSE_OBJECT *Arg;
ACPI_PARSE2_OBJECT *ByteList;
ACPI_OPERAND_OBJECT *ArgDesc;
ACPI_OPCODE_INFO *OpInfo;
OpInfo = AcpiPsGetOpcodeInfo (Opcode);
@ -339,7 +349,7 @@ AcpiDsInitObjectFromOp (
/* First arg is a number */
AcpiDsCreateOperand (WalkState, Op->Value.Arg);
AcpiDsCreateOperand (WalkState, Op->Value.Arg, 0);
ArgDesc = WalkState->Operands [WalkState->NumOperands - 1];
AcpiDsObjStackPop (1, WalkState);
@ -365,17 +375,27 @@ AcpiDsInitObjectFromOp (
/* Get the value, delete the internal object */
(*ObjDesc)->Buffer.Length = ArgDesc->Number.Value;
(*ObjDesc)->Buffer.Length = (UINT32) ArgDesc->Number.Value;
AcpiCmRemoveReference (ArgDesc);
/* Allocate the buffer */
(*ObjDesc)->Buffer.Pointer =
AcpiCmCallocate ((*ObjDesc)->Buffer.Length);
if (!(*ObjDesc)->Buffer.Pointer)
if ((*ObjDesc)->Buffer.Length == 0)
{
return (AE_NO_MEMORY);
(*ObjDesc)->Buffer.Pointer = NULL;
REPORT_WARNING (("Buffer created with zero length in AML\n"));
break;
}
else
{
(*ObjDesc)->Buffer.Pointer =
AcpiCmCallocate ((*ObjDesc)->Buffer.Length);
if (!(*ObjDesc)->Buffer.Pointer)
{
return (AE_NO_MEMORY);
}
}
/*
@ -386,7 +406,7 @@ AcpiDsInitObjectFromOp (
/* skip first arg */
Arg = Op->Value.Arg;
ByteList = (ACPI_EXTENDED_OP *) Arg->Next;
ByteList = (ACPI_PARSE2_OBJECT *) Arg->Next;
if (ByteList)
{
if (ByteList->Opcode != AML_BYTELIST_OP)
@ -404,20 +424,20 @@ AcpiDsInitObjectFromOp (
break;
case ACPI_TYPE_PACKAGE:
case ACPI_TYPE_PACKAGE:
/*
* When called, an internal package object has already
* been built and is pointed to by *ObjDesc.
* AcpiDsBuildInternalObject build another internal
* package object, so remove reference to the original
* been built and is pointed to by *ObjDesc.
* AcpiDsBuildInternalObject build another internal
* package object, so remove reference to the original
* so that it is deleted. Error checking is done
* within the remove reference function.
*/
AcpiCmRemoveReference(*ObjDesc);
Status = AcpiDsBuildInternalObject (WalkState, Op, ObjDesc);
break;
break;
case ACPI_TYPE_NUMBER:
(*ObjDesc)->Number.Value = Op->Value.Integer;
@ -458,9 +478,9 @@ AcpiDsInitObjectFromOp (
if (Op->Opcode == AML_NAMEPATH_OP)
{
/* NameDesc was saved in Op */
/* Node was saved in Op */
(*ObjDesc)->Reference.NameDesc = Op->AcpiNamedObject;
(*ObjDesc)->Reference.Node = Op->Node;
}
(*ObjDesc)->Reference.OpCode = Opcode;
@ -497,15 +517,17 @@ AcpiDsInitObjectFromOp (
*
****************************************************************************/
ACPI_STATUS
static ACPI_STATUS
AcpiDsBuildInternalSimpleObj (
ACPI_WALK_STATE *WalkState,
ACPI_GENERIC_OP *Op,
ACPI_OBJECT_INTERNAL **ObjDescPtr)
ACPI_PARSE_OBJECT *Op,
ACPI_OPERAND_OBJECT **ObjDescPtr)
{
ACPI_OBJECT_INTERNAL *ObjDesc;
ACPI_OPERAND_OBJECT *ObjDesc;
OBJECT_TYPE_INTERNAL Type;
ACPI_STATUS Status;
UINT32 Length;
char *Name;
FUNCTION_TRACE ("DsBuildInternalSimpleObj");
@ -519,17 +541,36 @@ AcpiDsBuildInternalSimpleObj (
* Otherwise, go ahead and look it up now
*/
if (!Op->AcpiNamedObject)
if (!Op->Node)
{
Status = AcpiNsLookup (WalkState->ScopeInfo,
Op->Value.String, ACPI_TYPE_ANY,
IMODE_EXECUTE,
NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE,
NULL,
(ACPI_NAMED_OBJECT**)&(Op->AcpiNamedObject));
(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);
if (Name)
{
REPORT_WARNING (("Reference %s AML %X not found\n",
Name, Op->AmlOffset));
AcpiCmFree (Name);
}
else
{
REPORT_WARNING (("Reference %s AML %X not found\n",
Op->Value.String, Op->AmlOffset));
}
*ObjDescPtr = NULL;
}
return_ACPI_STATUS (Status);
}
}
@ -588,11 +629,11 @@ AcpiDsBuildInternalSimpleObj (
ACPI_STATUS
AcpiDsBuildInternalPackageObj (
ACPI_WALK_STATE *WalkState,
ACPI_GENERIC_OP *Op,
ACPI_OBJECT_INTERNAL **ObjDescPtr)
ACPI_PARSE_OBJECT *Op,
ACPI_OPERAND_OBJECT **ObjDescPtr)
{
ACPI_GENERIC_OP *Arg;
ACPI_OBJECT_INTERNAL *ObjDesc;
ACPI_PARSE_OBJECT *Arg;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_STATUS Status = AE_OK;
@ -624,7 +665,7 @@ AcpiDsBuildInternalPackageObj (
{
/* Package vector allocation failure */
REPORT_ERROR ("DsBuildInternalPackageObj: Package vector allocation failure");
REPORT_ERROR (("DsBuildInternalPackageObj: Package vector allocation failure\n"));
AcpiCmDeleteObjectDesc (ObjDesc);
return_ACPI_STATUS (AE_NO_MEMORY);
@ -677,8 +718,8 @@ AcpiDsBuildInternalPackageObj (
ACPI_STATUS
AcpiDsBuildInternalObject (
ACPI_WALK_STATE *WalkState,
ACPI_GENERIC_OP *Op,
ACPI_OBJECT_INTERNAL **ObjDescPtr)
ACPI_PARSE_OBJECT *Op,
ACPI_OPERAND_OBJECT **ObjDescPtr)
{
ACPI_STATUS Status;
@ -701,7 +742,7 @@ AcpiDsBuildInternalObject (
/*****************************************************************************
*
* FUNCTION: AcpiDsCreateNamedObject
* FUNCTION: AcpiDsCreateNode
*
* PARAMETERS: Op - Parser object to be translated
* ObjDescPtr - Where the ACPI internal object is returned
@ -713,16 +754,16 @@ AcpiDsBuildInternalObject (
****************************************************************************/
ACPI_STATUS
AcpiDsCreateNamedObject (
AcpiDsCreateNode (
ACPI_WALK_STATE *WalkState,
ACPI_NAMED_OBJECT *NameDesc,
ACPI_GENERIC_OP *Op)
ACPI_NAMESPACE_NODE *Node,
ACPI_PARSE_OBJECT *Op)
{
ACPI_STATUS Status;
ACPI_OBJECT_INTERNAL *ObjDesc;
ACPI_OPERAND_OBJECT *ObjDesc;
FUNCTION_TRACE_PTR ("DsCreateNamedObject", Op);
FUNCTION_TRACE_PTR ("DsCreateNode", Op);
if (!Op->Value.Arg)
@ -739,18 +780,18 @@ AcpiDsCreateNamedObject (
Op->Value.Arg, &ObjDesc);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
return_ACPI_STATUS (Status);
}
/* Re-type the object according to it's argument */
NameDesc->Type = ObjDesc->Common.Type;
Node->Type = ObjDesc->Common.Type;
/* Init obj */
Status = AcpiNsAttachObject ((ACPI_HANDLE) NameDesc, ObjDesc,
(UINT8) NameDesc->Type);
Status = AcpiNsAttachObject ((ACPI_HANDLE) Node, ObjDesc,
(UINT8) Node->Type);
if (ACPI_FAILURE (Status))
{
goto Cleanup;

View File

@ -1,8 +1,8 @@
/******************************************************************************
*
* Module Name: dsopcode - Dispatcher Op Region support and handling of
* Module Name: dsopcode - Dispatcher Op Region support and handling of
* "control" opcodes
* $Revision: 1.15 $
* $Revision: 1.29 $
*
*****************************************************************************/
@ -10,8 +10,8 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* All rights reserved.
*
* 2. License
*
@ -132,40 +132,46 @@
/*****************************************************************************
*
* FUNCTION: AcpiDsGetRegionArguments
* FUNCTION: AcpiDsGetFieldUnitArguments
*
* PARAMETERS: RgnDesc - A valid region object
* PARAMETERS: ObjDesc - A valid FieldUnit object
*
* RETURN: Status.
*
* DESCRIPTION: Get region address and length. This implements the late
* evaluation of these region attributes.
* DESCRIPTION: Get FieldUnit Buffer and Index. This implements the late
* evaluation of these field attributes.
*
****************************************************************************/
ACPI_STATUS
AcpiDsGetRegionArguments (
ACPI_OBJECT_INTERNAL *RgnDesc)
AcpiDsGetFieldUnitArguments (
ACPI_OPERAND_OBJECT *ObjDesc)
{
ACPI_OBJECT_INTERNAL *MethodDesc;
ACPI_NAMED_OBJECT *NameDesc;
ACPI_GENERIC_OP *Op;
ACPI_GENERIC_OP *RegionOp;
ACPI_OPERAND_OBJECT *ExtraDesc;
ACPI_NAMESPACE_NODE *Node;
ACPI_PARSE_OBJECT *Op;
ACPI_PARSE_OBJECT *FieldOp;
ACPI_STATUS Status;
ACPI_TABLE_DESC *TableDesc;
FUNCTION_TRACE_PTR ("DsGetRegionArguments", RgnDesc);
FUNCTION_TRACE_PTR ("DsGetFieldUnitArguments", ObjDesc);
if (RgnDesc->Region.RegionFlags & REGION_AGRUMENT_DATA_VALID)
if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
{
return_ACPI_STATUS (AE_OK);
}
MethodDesc = RgnDesc->Region.Method;
NameDesc = RgnDesc->Region.NameDesc;
/* Get the AML pointer (method object) and FieldUnit node */
ExtraDesc = ObjDesc->FieldUnit.Extra;
Node = ObjDesc->FieldUnit.Node;
DEBUG_PRINT (TRACE_EXEC,
("DsGetFieldUnitArguments: [%4.4s] FieldUnit JIT Init\n",
&Node->Name));
/*
@ -179,13 +185,132 @@ AcpiDsGetRegionArguments (
return (AE_NO_MEMORY);
}
/* Save the Named Object for use in AcpiPsParseAml */
/* Save the Node for use in AcpiPsParseAml */
Op->AcpiNamedObject = AcpiNsGetParentObject (NameDesc);
Op->Node = AcpiNsGetParentObject (Node);
/* Get a handle to the parent ACPI table */
Status = AcpiTbHandleToObject (NameDesc->OwnerId, &TableDesc);
Status = AcpiTbHandleToObject (Node->OwnerId, &TableDesc);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Pass1: Parse the entire FieldUnit declaration */
Status = AcpiPsParseAml (Op, ExtraDesc->Extra.Pcode,
ExtraDesc->Extra.PcodeLength, 0,
NULL, NULL, NULL, AcpiDsLoad1BeginOp, AcpiDsLoad1EndOp);
if (ACPI_FAILURE (Status))
{
AcpiPsDeleteParseTree (Op);
return_ACPI_STATUS (Status);
}
/* Get and init the actual FielUnitOp created above */
FieldOp = Op->Value.Arg;
Op->Node = Node;
FieldOp = Op->Value.Arg;
FieldOp->Node = Node;
AcpiPsDeleteParseTree (Op);
/* AcpiEvaluate the address and length arguments for the OpRegion */
Op = AcpiPsAllocOp (AML_SCOPE_OP);
if (!Op)
{
return (AE_NO_MEMORY);
}
Op->Node = AcpiNsGetParentObject (Node);
Status = AcpiPsParseAml (Op, ExtraDesc->Extra.Pcode,
ExtraDesc->Extra.PcodeLength,
ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE,
NULL /*MethodDesc*/, NULL, NULL,
AcpiDsExecBeginOp, AcpiDsExecEndOp);
/* All done with the parse tree, delete it */
AcpiPsDeleteParseTree (Op);
/*
* The pseudo-method object is no longer needed since the region is
* now initialized
*/
AcpiCmRemoveReference (ObjDesc->FieldUnit.Extra);
ObjDesc->FieldUnit.Extra = NULL;
return_ACPI_STATUS (Status);
}
/*****************************************************************************
*
* FUNCTION: AcpiDsGetRegionArguments
*
* PARAMETERS: ObjDesc - A valid region object
*
* RETURN: Status.
*
* DESCRIPTION: Get region address and length. This implements the late
* evaluation of these region attributes.
*
****************************************************************************/
ACPI_STATUS
AcpiDsGetRegionArguments (
ACPI_OPERAND_OBJECT *ObjDesc)
{
ACPI_OPERAND_OBJECT *ExtraDesc = NULL;
ACPI_NAMESPACE_NODE *Node;
ACPI_PARSE_OBJECT *Op;
ACPI_PARSE_OBJECT *RegionOp;
ACPI_STATUS Status;
ACPI_TABLE_DESC *TableDesc;
FUNCTION_TRACE_PTR ("DsGetRegionArguments", ObjDesc);
if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
{
return_ACPI_STATUS (AE_OK);
}
/* Get the AML pointer (method object) and region node */
ExtraDesc = ObjDesc->Region.Extra;
Node = ObjDesc->Region.Node;
DEBUG_PRINT (TRACE_EXEC,
("DsGetRegionArguments: [%4.4s] OpRegion Init at AML %p[%x]\n",
&Node->Name, ExtraDesc->Extra.Pcode, *(UINT32*) ExtraDesc->Extra.Pcode));
/*
* Allocate a new parser op to be the root of the parsed
* OpRegion tree
*/
Op = AcpiPsAllocOp (AML_SCOPE_OP);
if (!Op)
{
return (AE_NO_MEMORY);
}
/* Save the Node for use in AcpiPsParseAml */
Op->Node = AcpiNsGetParentObject (Node);
/* Get a handle to the parent ACPI table */
Status = AcpiTbHandleToObject (Node->OwnerId, &TableDesc);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -193,8 +318,8 @@ AcpiDsGetRegionArguments (
/* Parse the entire OpRegion declaration, creating a parse tree */
Status = AcpiPsParseAml (Op, MethodDesc->Method.Pcode,
MethodDesc->Method.PcodeLength, 0,
Status = AcpiPsParseAml (Op, ExtraDesc->Extra.Pcode,
ExtraDesc->Extra.PcodeLength, 0,
NULL, NULL, NULL, AcpiDsLoad1BeginOp, AcpiDsLoad1EndOp);
if (ACPI_FAILURE (Status))
@ -206,12 +331,12 @@ AcpiDsGetRegionArguments (
/* Get and init the actual RegionOp created above */
/* RegionOp = Op->Value.Arg;
Op->AcpiNamedObject = NameDesc;*/
RegionOp = Op->Value.Arg;
Op->Node = Node;
RegionOp = Op->Value.Arg;
RegionOp->AcpiNamedObject = NameDesc;
RegionOp->Node = Node;
AcpiPsDeleteParseTree (Op);
/* AcpiEvaluate the address and length arguments for the OpRegion */
@ -222,18 +347,14 @@ AcpiDsGetRegionArguments (
return (AE_NO_MEMORY);
}
Op->AcpiNamedObject = AcpiNsGetParentObject (NameDesc);
Op->Node = AcpiNsGetParentObject (Node);
Status = AcpiPsParseAml (Op, MethodDesc->Method.Pcode,
MethodDesc->Method.PcodeLength,
Status = AcpiPsParseAml (Op, ExtraDesc->Extra.Pcode,
ExtraDesc->Extra.PcodeLength,
ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE,
NULL /*MethodDesc*/, NULL, NULL,
AcpiDsExecBeginOp, AcpiDsExecEndOp);
/*
AcpiPsWalkParsedAml (RegionOp, RegionOp, NULL, NULL, NULL,
NULL, TableDesc->TableId,
AcpiDsExecBeginOp, AcpiDsExecEndOp);
*/
/* All done with the parse tree, delete it */
AcpiPsDeleteParseTree (Op);
@ -258,7 +379,7 @@ ACPI_STATUS
AcpiDsInitializeRegion (
ACPI_HANDLE ObjHandle)
{
ACPI_OBJECT_INTERNAL *ObjDesc;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_STATUS Status;
@ -272,6 +393,293 @@ AcpiDsInitializeRegion (
}
/*****************************************************************************
*
* FUNCTION: AcpiDsEvalFieldUnitOperands
*
* PARAMETERS: Op - A valid FieldUnit Op object
*
* RETURN: Status
*
* DESCRIPTION: Get FieldUnit Buffer and Index
* Called from AcpiDsExecEndOp during FieldUnit parse tree walk
*
****************************************************************************/
ACPI_STATUS
AcpiDsEvalFieldUnitOperands (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op)
{
ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *FieldDesc;
ACPI_NAMESPACE_NODE *Node;
ACPI_PARSE_OBJECT *NextOp;
UINT32 Offset;
UINT32 BitOffset;
UINT16 BitCount;
ACPI_OPERAND_OBJECT *ResDesc = NULL;
ACPI_OPERAND_OBJECT *CntDesc = NULL;
ACPI_OPERAND_OBJECT *OffDesc = NULL;
ACPI_OPERAND_OBJECT *SrcDesc = NULL;
UINT32 NumOperands = 3;
FUNCTION_TRACE_PTR ("DsEvalFieldUnitOperands", Op);
/*
* This is where we evaluate the address and length fields of the OpFieldUnit declaration
*/
Node = Op->Node;
/* NextOp points to the op that holds the Buffer */
NextOp = Op->Value.Arg;
/* AcpiEvaluate/create the address and length operands */
Status = AcpiDsCreateOperands (WalkState, NextOp);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
FieldDesc = AcpiNsGetAttachedObject (Node);
if (!FieldDesc)
{
return_ACPI_STATUS (AE_NOT_EXIST);
}
/* Resolve the operands */
Status = AcpiAmlResolveOperands (Op->Opcode, WALK_OPERANDS, WalkState);
DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (Op->Opcode),
NumOperands, "after AcpiAmlResolveOperands");
/* Get the operands */
Status |= AcpiDsObjStackPopObject (&ResDesc, WalkState);
if (AML_CREATE_FIELD_OP == Op->Opcode)
{
NumOperands = 4;
Status |= AcpiDsObjStackPopObject (&CntDesc, WalkState);
}
Status |= AcpiDsObjStackPopObject (&OffDesc, WalkState);
Status |= AcpiDsObjStackPopObject (&SrcDesc, WalkState);
if (ACPI_FAILURE (Status))
{
/* Invalid parameters on object stack */
DEBUG_PRINT (ACPI_ERROR,
("ExecCreateField/%s: bad operand(s) (%X)\n",
AcpiPsGetOpcodeName (Op->Opcode), Status));
goto Cleanup;
}
Offset = (UINT32) OffDesc->Number.Value;
/*
* If ResDesc is a Name, it will be a direct name pointer after
* AcpiAmlResolveOperands()
*/
if (!VALID_DESCRIPTOR_TYPE (ResDesc, ACPI_DESC_TYPE_NAMED))
{
DEBUG_PRINT (ACPI_ERROR,
("AmlExecCreateField (%s): destination must be a Node\n",
AcpiPsGetOpcodeName (Op->Opcode)));
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
}
/*
* Setup the Bit offsets and counts, according to the opcode
*/
switch (Op->Opcode)
{
/* DefCreateBitField */
case AML_BIT_FIELD_OP:
/* Offset is in bits, Field is a bit */
BitOffset = Offset;
BitCount = 1;
break;
/* DefCreateByteField */
case AML_BYTE_FIELD_OP:
/* Offset is in bytes, field is a byte */
BitOffset = 8 * Offset;
BitCount = 8;
break;
/* DefCreateWordField */
case AML_WORD_FIELD_OP:
/* Offset is in bytes, field is a word */
BitOffset = 8 * Offset;
BitCount = 16;
break;
/* DefCreateDWordField */
case AML_DWORD_FIELD_OP:
/* Offset is in bytes, field is a dword */
BitOffset = 8 * Offset;
BitCount = 32;
break;
/* DefCreateField */
case AML_CREATE_FIELD_OP:
/* Offset is in bits, count is in bits */
BitOffset = Offset;
BitCount = (UINT16) CntDesc->Number.Value;
break;
default:
DEBUG_PRINT (ACPI_ERROR,
("AmlExecCreateField: Internal error - unknown field creation opcode %02x\n",
Op->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
}
/*
* Setup field according to the object type
*/
switch (SrcDesc->Common.Type)
{
/* SourceBuff := TermArg=>Buffer */
case ACPI_TYPE_BUFFER:
if (BitOffset + (UINT32) BitCount >
(8 * (UINT32) SrcDesc->Buffer.Length))
{
DEBUG_PRINT (ACPI_ERROR,
("AmlExecCreateField: Field exceeds Buffer %d > %d\n",
BitOffset + (UINT32) BitCount,
8 * (UINT32) SrcDesc->Buffer.Length));
Status = AE_AML_BUFFER_LIMIT;
goto Cleanup;
}
/* Construct the remainder of the field object */
FieldDesc->FieldUnit.Access = (UINT8) ACCESS_ANY_ACC;
FieldDesc->FieldUnit.LockRule = (UINT8) GLOCK_NEVER_LOCK;
FieldDesc->FieldUnit.UpdateRule = (UINT8) UPDATE_PRESERVE;
FieldDesc->FieldUnit.Length = BitCount;
FieldDesc->FieldUnit.BitOffset = (UINT8) (BitOffset % 8);
FieldDesc->FieldUnit.Offset = DIV_8 (BitOffset);
FieldDesc->FieldUnit.Container = SrcDesc;
/* Reference count for SrcDesc inherits FieldDesc count */
SrcDesc->Common.ReferenceCount = (UINT16) (SrcDesc->Common.ReferenceCount +
FieldDesc->Common.ReferenceCount);
break;
/* Improper object type */
default:
if ((SrcDesc->Common.Type > (UINT8) INTERNAL_TYPE_REFERENCE) ||
!AcpiCmValidObjectType (SrcDesc->Common.Type))
{
DEBUG_PRINT (ACPI_ERROR,
("AmlExecCreateField: Tried to create field in invalid object type %X\n",
SrcDesc->Common.Type));
}
else
{
DEBUG_PRINT (ACPI_ERROR,
("AmlExecCreateField: Tried to create field in improper object type - %s\n",
AcpiCmGetTypeName (SrcDesc->Common.Type)));
}
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
}
if (AML_CREATE_FIELD_OP == Op->Opcode)
{
/* Delete object descriptor unique to CreateField */
AcpiCmRemoveReference (CntDesc);
CntDesc = NULL;
}
Cleanup:
/* Always delete the operands */
AcpiCmRemoveReference (OffDesc);
AcpiCmRemoveReference (SrcDesc);
if (AML_CREATE_FIELD_OP == Op->Opcode)
{
AcpiCmRemoveReference (CntDesc);
}
/* On failure, delete the result descriptor */
if (ACPI_FAILURE (Status))
{
AcpiCmRemoveReference (ResDesc); /* Result descriptor */
}
else
{
/* Now the address and length are valid for this opFieldUnit */
FieldDesc->FieldUnit.Flags |= AOPOBJ_DATA_VALID;
}
return_ACPI_STATUS (Status);
}
/*****************************************************************************
*
* FUNCTION: AcpiDsEvalRegionOperands
@ -288,13 +696,13 @@ AcpiDsInitializeRegion (
ACPI_STATUS
AcpiDsEvalRegionOperands (
ACPI_WALK_STATE *WalkState,
ACPI_GENERIC_OP *Op)
ACPI_PARSE_OBJECT *Op)
{
ACPI_STATUS Status;
ACPI_OBJECT_INTERNAL *ObjDesc;
ACPI_OBJECT_INTERNAL *RegionDesc;
ACPI_NAMED_OBJECT *NameDesc;
ACPI_GENERIC_OP *NextOp;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_OPERAND_OBJECT *OperandDesc;
ACPI_NAMESPACE_NODE *Node;
ACPI_PARSE_OBJECT *NextOp;
FUNCTION_TRACE_PTR ("DsEvalRegionOperands", Op);
@ -304,7 +712,7 @@ AcpiDsEvalRegionOperands (
* This is where we evaluate the address and length fields of the OpRegion declaration
*/
NameDesc = Op->AcpiNamedObject;
Node = Op->Node;
/* NextOp points to the op that holds the SpaceID */
NextOp = Op->Value.Arg;
@ -320,36 +728,51 @@ AcpiDsEvalRegionOperands (
return_ACPI_STATUS (Status);
}
RegionDesc = AcpiNsGetAttachedObject (NameDesc);
if (!RegionDesc)
/* Resolve the length and address operands to numbers */
Status = AcpiAmlResolveOperands (Op->Opcode, WALK_OPERANDS, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE,
AcpiPsGetOpcodeName (Op->Opcode),
1, "after AcpiAmlResolveOperands");
ObjDesc = AcpiNsGetAttachedObject (Node);
if (!ObjDesc)
{
return_ACPI_STATUS (AE_NOT_EXIST);
}
/* Get the length and save it */
/*
* Get the length operand and save it
* (at Top of stack)
*/
OperandDesc = WalkState->Operands[WalkState->NumOperands - 1];
/* Top of stack */
ObjDesc = WalkState->Operands[WalkState->NumOperands - 1];
ObjDesc->Region.Length = (UINT32) OperandDesc->Number.Value;
AcpiCmRemoveReference (OperandDesc);
RegionDesc->Region.Length = ObjDesc->Number.Value;
AcpiCmRemoveReference (ObjDesc);
/*
* Get the address and save it
* (at top of stack - 1)
*/
OperandDesc = WalkState->Operands[WalkState->NumOperands - 2];
/* Get the address and save it */
/* Top of stack - 1 */
ObjDesc = WalkState->Operands[WalkState->NumOperands - 2];
RegionDesc->Region.Address = ObjDesc->Number.Value;
AcpiCmRemoveReference (ObjDesc);
ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS) OperandDesc->Number.Value;
AcpiCmRemoveReference (OperandDesc);
DEBUG_PRINT (TRACE_EXEC,
("DsEvalRegionOperands: RgnObj %p Addr %X Len %X\n",
RegionDesc, RegionDesc->Region.Address, RegionDesc->Region.Length));
ObjDesc, ObjDesc->Region.Address, ObjDesc->Region.Length));
/* Now the address and length are valid for this opregion */
RegionDesc->Region.RegionFlags |= REGION_AGRUMENT_DATA_VALID;
ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID;
return_ACPI_STATUS (Status);
}
@ -372,7 +795,7 @@ AcpiDsEvalRegionOperands (
ACPI_STATUS
AcpiDsExecBeginControlOp (
ACPI_WALK_STATE *WalkState,
ACPI_GENERIC_OP *Op)
ACPI_PARSE_OBJECT *Op)
{
ACPI_STATUS Status = AE_OK;
ACPI_GENERIC_STATE *ControlState;
@ -402,12 +825,13 @@ AcpiDsExecBeginControlOp (
AcpiCmPushGenericState (&WalkState->ControlState, ControlState);
/*
/*
* Save a pointer to the predicate for multiple executions
* of a loop
*/
WalkState->ControlState->Control.AmlPredicateStart =
WalkState->ControlState->Control.AmlPredicateStart =
WalkState->ParserState->Aml - 1;
/* TBD: can this be removed? */
/*AcpiPsPkgLengthEncodingSize (GET8 (WalkState->ParserState->Aml));*/
break;
@ -456,7 +880,7 @@ AcpiDsExecBeginControlOp (
ACPI_STATUS
AcpiDsExecEndControlOp (
ACPI_WALK_STATE *WalkState,
ACPI_GENERIC_OP *Op)
ACPI_PARSE_OBJECT *Op)
{
ACPI_STATUS Status = AE_OK;
ACPI_GENERIC_STATE *ControlState;
@ -507,19 +931,17 @@ AcpiDsExecEndControlOp (
Status = AE_CTRL_PENDING;
}
/* else
{*/
DEBUG_PRINT (TRACE_DISPATCH,
("EndControlOp: [WHILE_OP] termination! Op=%p\n", Op));
/* Pop this control state and free it */
DEBUG_PRINT (TRACE_DISPATCH,
("EndControlOp: [WHILE_OP] termination! Op=%p\n", Op));
ControlState =
AcpiCmPopGenericState (&WalkState->ControlState);
/* Pop this control state and free it */
WalkState->AmlLastWhile = ControlState->Control.AmlPredicateStart;
AcpiCmDeleteGenericState (ControlState);
/* }*/
ControlState =
AcpiCmPopGenericState (&WalkState->ControlState);
WalkState->AmlLastWhile = ControlState->Control.AmlPredicateStart;
AcpiCmDeleteGenericState (ControlState);
break;
@ -530,7 +952,7 @@ AcpiDsExecEndControlOp (
("EndControlOp: [RETURN_OP] Op=%p Arg=%p\n",Op, Op->Value.Arg));
/*
/*
* One optional operand -- the return value
* It can be either an immediate operand or a result that
* has been bubbled up the tree
@ -566,23 +988,24 @@ AcpiDsExecEndControlOp (
WalkState->ReturnDesc = WalkState->Operands[0];
}
else if (WalkState->NumResults > 0)
else if ((WalkState->Results) &&
(WalkState->Results->Results.NumResults > 0))
{
/*
* The return value has come from a previous calculation.
*
*
* If value being returned is a Reference (such as
* an arg or local), resolve it now because it may
* cease to exist at the end of the method.
*/
Status = AcpiAmlResolveToValue (&WalkState->Results [0], WalkState);
Status = AcpiAmlResolveToValue (&WalkState->Results->Results.ObjDesc [0], WalkState);
if (ACPI_FAILURE (Status))
{
return (Status);
}
WalkState->ReturnDesc = WalkState->Results [0];
WalkState->ReturnDesc = WalkState->Results->Results.ObjDesc [0];
}
else

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dsutils - Dispatcher utilities
* $Revision: 1.43 $
* $Revision: 1.51 $
*
******************************************************************************/
@ -9,8 +9,8 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* All rights reserved.
*
* 2. License
*
@ -128,7 +128,6 @@
MODULE_NAME ("dsutils")
/*******************************************************************************
*
* FUNCTION: AcpiDsIsResultUsed
@ -145,9 +144,10 @@
BOOLEAN
AcpiDsIsResultUsed (
ACPI_GENERIC_OP *Op)
ACPI_PARSE_OBJECT *Op,
ACPI_WALK_STATE *WalkState)
{
ACPI_OP_INFO *ParentInfo;
ACPI_OPCODE_INFO *ParentInfo;
FUNCTION_TRACE_PTR ("DsIsResultUsed", Op);
@ -182,24 +182,13 @@ AcpiDsIsResultUsed (
if (ACPI_GET_OP_TYPE (ParentInfo) != ACPI_OP_TYPE_OPCODE)
{
DEBUG_PRINT (ACPI_ERROR,
("DsIsResultUsed: Unknown parent opcode. Op=%X\n",
("DsIsResultUsed: Unknown parent opcode. Op=%X\n",
Op));
return_VALUE (FALSE);
}
/* Never delete the return value associated with a return opcode */
if (Op->Parent->Opcode == AML_RETURN_OP)
{
DEBUG_PRINT (TRACE_DISPATCH,
("DsIsResultUsed: Result used, [RETURN] opcode=%X Op=%X\n",
Op->Opcode, Op));
return_VALUE (TRUE);
}
/*
* Decide what to do with the result based on the parent. If
* the parent opcode will not use the result, delete the object.
@ -213,8 +202,63 @@ AcpiDsIsResultUsed (
* In these cases, the parent will never use the return object
*/
case OPTYPE_CONTROL: /* IF, ELSE, WHILE only */
switch (Op->Parent->Opcode)
{
case AML_RETURN_OP:
/* Never delete the return value associated with a return opcode */
DEBUG_PRINT (TRACE_DISPATCH,
("DsIsResultUsed: Result used, [RETURN] opcode=%X Op=%X\n",
Op->Opcode, Op));
return_VALUE (TRUE);
break;
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!
*/
if ((WalkState->ControlState->Common.State == CONTROL_PREDICATE_EXECUTING) &&
(WalkState->ControlState->Control.PredicateOp == Op))
{
DEBUG_PRINT (TRACE_DISPATCH,
("DsIsResultUsed: Result used as a predicate, [IF/WHILE] opcode=%X Op=%X\n",
Op->Opcode, Op));
return_VALUE (TRUE);
}
break;
}
/* Fall through to not used case below */
case OPTYPE_NAMED_OBJECT: /* Scope, method, etc. */
/*
* These opcodes allow TermArg(s) as operands and therefore
* method calls. The result is used.
*/
if ((Op->Parent->Opcode == AML_REGION_OP) ||
(Op->Parent->Opcode == AML_CREATE_FIELD_OP) ||
(Op->Parent->Opcode == AML_BIT_FIELD_OP) ||
(Op->Parent->Opcode == AML_BYTE_FIELD_OP) ||
(Op->Parent->Opcode == AML_WORD_FIELD_OP) ||
(Op->Parent->Opcode == AML_DWORD_FIELD_OP) ||
(Op->Parent->Opcode == AML_QWORD_FIELD_OP))
{
DEBUG_PRINT (TRACE_DISPATCH,
("DsIsResultUsed: Result used, [Region or CreateField] opcode=%X Op=%X\n",
Op->Opcode, Op));
return_VALUE (TRUE);
}
DEBUG_PRINT (TRACE_DISPATCH,
("DsIsResultUsed: Result not used, Parent opcode=%X Op=%X\n",
Op->Opcode, Op));
@ -234,7 +278,6 @@ AcpiDsIsResultUsed (
}
/*******************************************************************************
*
* FUNCTION: AcpiDsDeleteResultIfNotUsed
@ -254,11 +297,11 @@ AcpiDsIsResultUsed (
void
AcpiDsDeleteResultIfNotUsed (
ACPI_GENERIC_OP *Op,
ACPI_OBJECT_INTERNAL *ResultObj,
ACPI_PARSE_OBJECT *Op,
ACPI_OPERAND_OBJECT *ResultObj,
ACPI_WALK_STATE *WalkState)
{
ACPI_OBJECT_INTERNAL *ObjDesc;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_STATUS Status;
@ -279,14 +322,14 @@ AcpiDsDeleteResultIfNotUsed (
}
if (!AcpiDsIsResultUsed (Op))
if (!AcpiDsIsResultUsed (Op, WalkState))
{
/*
* Must pop the result stack (ObjDesc should be equal
* to ResultObj)
*/
Status = AcpiDsResultStackPop (&ObjDesc, WalkState);
Status = AcpiDsResultPop (&ObjDesc, WalkState);
if (ACPI_SUCCESS (Status))
{
AcpiCmRemoveReference (ResultObj);
@ -316,14 +359,15 @@ AcpiDsDeleteResultIfNotUsed (
ACPI_STATUS
AcpiDsCreateOperand (
ACPI_WALK_STATE *WalkState,
ACPI_GENERIC_OP *Arg)
ACPI_PARSE_OBJECT *Arg,
UINT32 ArgIndex)
{
ACPI_STATUS Status = AE_OK;
NATIVE_CHAR *NameString;
UINT32 NameLength;
OBJECT_TYPE_INTERNAL DataType;
ACPI_OBJECT_INTERNAL *ObjDesc;
ACPI_GENERIC_OP *ParentOp;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_PARSE_OBJECT *ParentOp;
UINT16 Opcode;
UINT32 Flags;
OPERATING_MODE InterpreterMode;
@ -365,8 +409,9 @@ AcpiDsCreateOperand (
*/
ParentOp = Arg->Parent;
if ((AcpiPsIsNamedObjectOp (ParentOp->Opcode)) &&
if ((AcpiPsIsNodeOp (ParentOp->Opcode)) &&
(ParentOp->Opcode != AML_METHODCALL_OP) &&
(ParentOp->Opcode != AML_REGION_OP) &&
(ParentOp->Opcode != AML_NAMEPATH_OP))
{
/* Enter name into namespace if not found */
@ -385,7 +430,7 @@ AcpiDsCreateOperand (
ACPI_TYPE_ANY, InterpreterMode,
NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE,
WalkState,
(ACPI_NAMED_OBJECT**) &ObjDesc);
(ACPI_NAMESPACE_NODE **) &ObjDesc);
/* Free the namestring created above */
@ -406,7 +451,7 @@ AcpiDsCreateOperand (
* indicate this to the interpreter, set the
* object to the root
*/
ObjDesc = (ACPI_OBJECT_INTERNAL *) AcpiGbl_RootObject;
ObjDesc = (ACPI_OPERAND_OBJECT *) AcpiGbl_RootNode;
Status = AE_OK;
}
@ -487,7 +532,7 @@ AcpiDsCreateOperand (
* by the evaluation of this argument
*/
Status = AcpiDsResultStackPop (&ObjDesc, WalkState);
Status = AcpiDsResultPopFromBottom (&ObjDesc, WalkState);
if (ACPI_FAILURE (Status))
{
/*
@ -495,7 +540,7 @@ AcpiDsCreateOperand (
* a missing or null operand!
*/
DEBUG_PRINT (ACPI_ERROR,
("DsCreateOperand: Could not pop result\n"));
("DsCreateOperand: Missing or null operand, %s\n", AcpiCmFormatException (Status)));
return_ACPI_STATUS (Status);
}
@ -554,24 +599,21 @@ AcpiDsCreateOperand (
ACPI_STATUS
AcpiDsCreateOperands (
ACPI_WALK_STATE *WalkState,
ACPI_GENERIC_OP *FirstArg)
ACPI_PARSE_OBJECT *FirstArg)
{
ACPI_STATUS Status = AE_OK;
ACPI_GENERIC_OP *Arg;
UINT32 ArgsPushed = 0;
ACPI_PARSE_OBJECT *Arg;
UINT32 ArgCount = 0;
FUNCTION_TRACE_PTR ("DsCreateOperands", FirstArg);
Arg = FirstArg;
/* For all arguments in the list... */
Arg = FirstArg;
while (Arg)
{
Status = AcpiDsCreateOperand (WalkState, Arg);
Status = AcpiDsCreateOperand (WalkState, Arg, ArgCount);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
@ -579,12 +621,12 @@ AcpiDsCreateOperands (
DEBUG_PRINT (TRACE_DISPATCH,
("DsCreateOperands: Arg #%d (%p) done, Arg1=%p\n",
ArgsPushed, Arg, FirstArg));
ArgCount, Arg, FirstArg));
/* Move on to next argument, if any */
Arg = Arg->Next;
ArgsPushed++;
ArgCount++;
}
return_ACPI_STATUS (Status);
@ -597,11 +639,11 @@ Cleanup:
* objects
*/
AcpiDsObjStackPopAndDelete (ArgsPushed, WalkState);
AcpiDsObjStackPopAndDelete (ArgCount, WalkState);
DEBUG_PRINT (ACPI_ERROR,
("DsCreateOperands: Error while creating Arg %d - %s\n",
(ArgsPushed+1), AcpiCmFormatException (Status)));
(ArgCount + 1), AcpiCmFormatException (Status)));
return_ACPI_STATUS (Status);
}
@ -675,7 +717,7 @@ AcpiDsMapOpcodeToDataType (
UINT32 *OutFlags)
{
OBJECT_TYPE_INTERNAL DataType = INTERNAL_TYPE_INVALID;
ACPI_OP_INFO *OpInfo;
ACPI_OPCODE_INFO *OpInfo;
UINT32 Flags = 0;
@ -684,6 +726,10 @@ AcpiDsMapOpcodeToDataType (
{
/* Unknown opcode */
DEBUG_PRINT (ACPI_ERROR,
("MapOpcode: Unknown AML opcode: %x\n",
Opcode));
return (DataType);
}
@ -710,8 +756,13 @@ AcpiDsMapOpcodeToDataType (
case AML_NAMEPATH_OP:
DataType = INTERNAL_TYPE_REFERENCE;
break;
}
default:
DEBUG_PRINT (ACPI_ERROR,
("MapOpcode: Unknown (type LITERAL) AML opcode: %x\n",
Opcode));
break;
}
break;
@ -728,8 +779,13 @@ AcpiDsMapOpcodeToDataType (
DataType = ACPI_TYPE_PACKAGE;
break;
}
default:
DEBUG_PRINT (ACPI_ERROR,
("MapOpcode: Unknown (type DATA_TERM) AML opcode: %x\n",
Opcode));
break;
}
break;
@ -752,21 +808,18 @@ AcpiDsMapOpcodeToDataType (
Flags = OP_HAS_RETURN_VALUE;
DataType = ACPI_TYPE_ANY;
break;
case OPTYPE_METHOD_CALL:
Flags = OP_HAS_RETURN_VALUE;
DataType = ACPI_TYPE_METHOD;
break;
case OPTYPE_NAMED_OBJECT:
DataType = AcpiDsMapNamedOpcodeToDataType (Opcode);
break;

View File

@ -2,7 +2,7 @@
*
* Module Name: dswexec - Dispatcher method execution callbacks;
* dispatch to interpreter.
* $Revision: 1.41 $
* $Revision: 1.51 $
*
*****************************************************************************/
@ -10,8 +10,8 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* All rights reserved.
*
* 2. License
*
@ -130,6 +130,138 @@
MODULE_NAME ("dswexec")
/*****************************************************************************
*
* FUNCTION: AcpiDsGetPredicateValue
*
* PARAMETERS: WalkState - Current state of the parse tree walk
*
* RETURN: Status
*
* DESCRIPTION:
*
****************************************************************************/
ACPI_STATUS
AcpiDsGetPredicateValue (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op,
UINT32 HasResultObj)
{
ACPI_STATUS Status = AE_OK;
ACPI_OPERAND_OBJECT *ObjDesc;
FUNCTION_TRACE_PTR ("DsGetPredicateValue", WalkState);
WalkState->ControlState->Common.State = 0;
if (HasResultObj)
{
Status = AcpiDsResultPop (&ObjDesc, WalkState);
if (ACPI_FAILURE (Status))
{
DEBUG_PRINT (ACPI_ERROR,
("DsGetPredicateValue: Missing or null operand, %s\n",
AcpiCmFormatException (Status)));
return_ACPI_STATUS (Status);
}
}
else
{
Status = AcpiDsCreateOperand (WalkState, Op, 0);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
Status = AcpiAmlResolveToValue (&WalkState->Operands [0], WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
ObjDesc = WalkState->Operands [0];
}
if (!ObjDesc)
{
DEBUG_PRINT (ACPI_ERROR,
("ExecEndOp: No predicate ObjDesc=%X State=%X\n",
ObjDesc, WalkState));
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
/*
* Result of predicate evaluation currently must
* be a number
*/
if (ObjDesc->Common.Type != ACPI_TYPE_NUMBER)
{
DEBUG_PRINT (ACPI_ERROR,
("ExecEndOp: Bad predicate (not a number) ObjDesc=%X State=%X Type=%X\n",
ObjDesc, WalkState, ObjDesc->Common.Type));
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
}
/* TBD: 64/32-bit */
ObjDesc->Number.Value &= (UINT64) 0x00000000FFFFFFFF;
/*
* Save the result of the predicate evaluation on
* the control stack
*/
if (ObjDesc->Number.Value)
{
WalkState->ControlState->Common.Value = TRUE;
}
else
{
/*
* Predicate is FALSE, we will just toss the
* rest of the package
*/
WalkState->ControlState->Common.Value = FALSE;
Status = AE_CTRL_FALSE;
}
Cleanup:
DEBUG_PRINT (TRACE_EXEC,
("ExecEndOp: Completed a predicate eval=%X Op=%X\n",
WalkState->ControlState->Common.Value, Op));
/* Break to debugger to display result */
DEBUGGER_EXEC (AcpiDbDisplayResultObject (ObjDesc, WalkState));
/*
* Delete the predicate result object (we know that
* we don't need it anymore)
*/
AcpiCmRemoveReference (ObjDesc);
WalkState->ControlState->Common.State = CONTROL_NORMAL;
return_ACPI_STATUS (Status);
}
/*****************************************************************************
*
* FUNCTION: AcpiDsExecBeginOp
@ -149,11 +281,11 @@
ACPI_STATUS
AcpiDsExecBeginOp (
UINT16 Opcode,
ACPI_GENERIC_OP *Op,
ACPI_PARSE_OBJECT *Op,
ACPI_WALK_STATE *WalkState,
ACPI_GENERIC_OP **OutOp)
ACPI_PARSE_OBJECT **OutOp)
{
ACPI_OP_INFO *OpInfo;
ACPI_OPCODE_INFO *OpInfo;
ACPI_STATUS Status = AE_OK;
@ -220,6 +352,12 @@ AcpiDsExecBeginOp (
{
case OPTYPE_CONTROL:
Status = AcpiDsResultStackPush (WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
Status = AcpiDsExecBeginControlOp (WalkState, Op);
break;
@ -238,6 +376,34 @@ AcpiDsExecBeginOp (
Status = AcpiDsLoad2BeginOp (Op->Opcode, Op, WalkState, NULL);
}
if (Op->Opcode == AML_REGION_OP)
{
Status = AcpiDsResultStackPush (WalkState);
}
break;
/* most operators with arguments */
case OPTYPE_MONADIC1:
case OPTYPE_DYADIC1:
case OPTYPE_MONADIC2:
case OPTYPE_MONADIC2R:
case OPTYPE_DYADIC2:
case OPTYPE_DYADIC2R:
case OPTYPE_DYADIC2S:
case OPTYPE_RECONFIGURATION:
case OPTYPE_INDEX:
case OPTYPE_MATCH:
case OPTYPE_FATAL:
case OPTYPE_CREATE_FIELD:
/* Start a new result/operand state */
Status = AcpiDsResultStackPush (WalkState);
break;
@ -270,17 +436,16 @@ AcpiDsExecBeginOp (
ACPI_STATUS
AcpiDsExecEndOp (
ACPI_WALK_STATE *WalkState,
ACPI_GENERIC_OP *Op)
ACPI_PARSE_OBJECT *Op)
{
ACPI_STATUS Status = AE_OK;
UINT16 Opcode;
UINT8 Optype;
ACPI_OBJECT_INTERNAL *ObjDesc;
ACPI_GENERIC_OP *NextOp;
ACPI_NAMED_OBJECT *NameDesc;
ACPI_GENERIC_OP *FirstArg;
ACPI_OBJECT_INTERNAL *ResultObj = NULL;
ACPI_OP_INFO *OpInfo;
ACPI_PARSE_OBJECT *NextOp;
ACPI_NAMESPACE_NODE *Node;
ACPI_PARSE_OBJECT *FirstArg;
ACPI_OPERAND_OBJECT *ResultObj = NULL;
ACPI_OPCODE_INFO *OpInfo;
UINT32 OperandIndex;
@ -352,10 +517,11 @@ AcpiDsExecEndOp (
case OPTYPE_RECONFIGURATION:
case OPTYPE_INDEX:
case OPTYPE_MATCH:
case OPTYPE_CREATE_FIELD:
case OPTYPE_FATAL:
/* Build resolved operand stack */
Status = AcpiDsCreateOperands (WalkState, FirstArg);
if (ACPI_FAILURE (Status))
{
@ -364,9 +530,17 @@ AcpiDsExecEndOp (
OperandIndex = WalkState->NumOperands - 1;
/* Done with this result state (Now that operand stack is built) */
Status = AcpiDsResultStackPop (WalkState);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
switch (Optype)
{
case OPTYPE_MONADIC1:
/* 1 Operand, 0 ExternalResult, 0 InternalResult */
@ -380,11 +554,6 @@ AcpiDsExecEndOp (
/* 1 Operand, 0 ExternalResult, 1 InternalResult */
Status = AcpiAmlExecMonadic2 (Opcode, WalkState, &ResultObj);
if (ACPI_SUCCESS (Status))
{
Status = AcpiDsResultStackPush (ResultObj, WalkState);
}
break;
@ -393,11 +562,6 @@ AcpiDsExecEndOp (
/* 1 Operand, 1 ExternalResult, 1 InternalResult */
Status = AcpiAmlExecMonadic2R (Opcode, WalkState, &ResultObj);
if (ACPI_SUCCESS (Status))
{
Status = AcpiDsResultStackPush (ResultObj, WalkState);
}
break;
@ -406,7 +570,6 @@ AcpiDsExecEndOp (
/* 2 Operands, 0 ExternalResult, 0 InternalResult */
Status = AcpiAmlExecDyadic1 (Opcode, WalkState);
break;
@ -415,11 +578,6 @@ AcpiDsExecEndOp (
/* 2 Operands, 0 ExternalResult, 1 InternalResult */
Status = AcpiAmlExecDyadic2 (Opcode, WalkState, &ResultObj);
if (ACPI_SUCCESS (Status))
{
Status = AcpiDsResultStackPush (ResultObj, WalkState);
}
break;
@ -427,18 +585,7 @@ AcpiDsExecEndOp (
/* 2 Operands, 1 or 2 ExternalResults, 1 InternalResult */
/* NEW INTERFACE:
* Pass in WalkState, keep result obj but let interpreter
* push the result
*/
Status = AcpiAmlExecDyadic2R (Opcode, WalkState, &ResultObj);
if (ACPI_SUCCESS (Status))
{
Status = AcpiDsResultStackPush (ResultObj, WalkState);
}
break;
@ -447,11 +594,22 @@ AcpiDsExecEndOp (
/* 2 Operands, 0 ExternalResult, 1 InternalResult */
Status = AcpiAmlExecDyadic2S (Opcode, WalkState, &ResultObj);
if (ACPI_SUCCESS (Status))
{
Status = AcpiDsResultStackPush (ResultObj, WalkState);
}
break;
case OPTYPE_INDEX: /* Type 2 opcode with 3 operands */
/* 3 Operands, 1 ExternalResult, 1 InternalResult */
Status = AcpiAmlExecIndex (WalkState, &ResultObj);
break;
case OPTYPE_MATCH: /* Type 2 opcode with 6 operands */
/* 6 Operands, 0 ExternalResult, 1 InternalResult */
Status = AcpiAmlExecMatch (WalkState, &ResultObj);
break;
@ -463,46 +621,22 @@ AcpiDsExecEndOp (
break;
case OPTYPE_CREATE_FIELD:
/* 3 or 4 Operands, 0 ExternalResult, 0 InternalResult */
Status = AcpiAmlExecCreateField (Opcode, WalkState);
break;
case OPTYPE_FATAL:
/* 3 Operands, 0 ExternalResult, 0 InternalResult */
Status = AcpiAmlExecFatal (WalkState);
break;
}
case OPTYPE_INDEX: /* Type 2 opcode with 3 operands */
/* 3 Operands, 1 ExternalResult, 1 InternalResult */
Status = AcpiAmlExecIndex (WalkState, &ResultObj);
if (ACPI_SUCCESS (Status))
{
Status = AcpiDsResultStackPush (ResultObj, WalkState);
}
break;
case OPTYPE_MATCH: /* Type 2 opcode with 6 operands */
/* 6 Operands, 0 ExternalResult, 1 InternalResult */
Status = AcpiAmlExecMatch (WalkState, &ResultObj);
if (ACPI_SUCCESS (Status))
{
Status = AcpiDsResultStackPush (ResultObj, WalkState);
}
break;
/*
* If a result object was returned from above, push it on the
* current result stack
*/
if (ACPI_SUCCESS (Status) &&
ResultObj)
{
Status = AcpiDsResultPush (ResultObj, WalkState);
}
break;
@ -514,6 +648,7 @@ AcpiDsExecEndOp (
Status = AcpiDsExecEndControlOp (WalkState, Op);
AcpiDsResultStackPop (WalkState);
break;
@ -523,21 +658,21 @@ AcpiDsExecEndOp (
("ExecEndOp: Method invocation, Op=%X\n", Op));
/*
* (AML_METHODCALL) Op->Value->Arg->AcpiNamedObject contains
* the method Named Object pointer
* (AML_METHODCALL) Op->Value->Arg->Node contains
* the method Node pointer
*/
/* NextOp points to the op that holds the method name */
NextOp = FirstArg;
NameDesc = NextOp->AcpiNamedObject;
Node = NextOp->Node;
/* NextOp points to first argument op */
NextOp = NextOp->Next;
NextOp = NextOp->Next;
/*
* Get the method's arguments and put them on the operand stack
*/
Status = AcpiDsCreateOperands (WalkState, NextOp);
if (ACPI_FAILURE (Status))
{
@ -557,48 +692,43 @@ AcpiDsExecEndOp (
break;
}
/* Open new scope on the scope stack */
/*
Status = AcpiNsScopeStackPushEntry (NameDesc);
if (ACPI_FAILURE (Status))
{
DEBUG_PRINT (ACPI_ERROR,
("ExecEndOp: Could not push Scope Stack\n"));
break;
}
*/
/* Tell the walk loop to preempt this running method and
execute the new method */
/*
* Tell the walk loop to preempt this running method and
* execute the new method
*/
Status = AE_CTRL_TRANSFER;
/* Return now; we don't want to disturb anything,
especially the operand count! */
/*
* Return now; we don't want to disturb anything,
* especially the operand count!
*/
return_ACPI_STATUS (Status);
break;
case OPTYPE_NAMED_OBJECT:
case OPTYPE_CREATE_FIELD:
DEBUG_PRINT (TRACE_EXEC,
("ExecEndOp: Executing CreateField Buffer/Index Op=%X\n",
Op));
Status = AcpiDsLoad2EndOp (WalkState, Op);
if (ACPI_FAILURE (Status))
{
break;
}
/*
if ((WalkState->Origin->Opcode == AML_METHOD_OP) &&
(WalkState->Origin != Op))
Status = AcpiDsEvalFieldUnitOperands (WalkState, Op);
break;
case OPTYPE_NAMED_OBJECT:
Status = AcpiDsLoad2EndOp (WalkState, Op);
if (ACPI_FAILURE (Status))
{
Status = AcpiDsLoad2EndOp (WalkState, Op);
if (ACPI_FAILURE (Status))
{
break;
}
break;
}
*/
switch (Op->Opcode)
{
@ -609,12 +739,16 @@ AcpiDsExecEndOp (
Op));
Status = AcpiDsEvalRegionOperands (WalkState, Op);
if (ACPI_FAILURE (Status))
{
break;
}
Status = AcpiDsResultStackPop (WalkState);
break;
case AML_METHOD_OP:
break;
@ -645,6 +779,12 @@ AcpiDsExecEndOp (
}
/*
* ACPI 2.0 support for 64-bit integers:
* Truncate numeric result value if we are executing from a 32-bit ACPI table
*/
AcpiAmlTruncateFor32bitTable (ResultObj, WalkState);
/*
* Check if we just completed the evaluation of a
* conditional predicate
@ -655,91 +795,12 @@ AcpiDsExecEndOp (
CONTROL_PREDICATE_EXECUTING) &&
(WalkState->ControlState->Control.PredicateOp == Op))
{
/* Completed the predicate, the result must be a number */
WalkState->ControlState->Common.State = 0;
if (ResultObj)
{
Status = AcpiDsResultStackPop (&ObjDesc, WalkState);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
}
else
{
Status = AcpiDsCreateOperand (WalkState, Op);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
Status = AcpiAmlResolveToValue (&WalkState->Operands [0], WalkState);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
ObjDesc = WalkState->Operands [0];
}
if (!ObjDesc)
{
DEBUG_PRINT (ACPI_ERROR,
("ExecEndOp: No predicate ObjDesc=%X State=%X\n",
ObjDesc, WalkState));
Status = AE_AML_NO_OPERAND;
goto Cleanup;
}
if (ObjDesc->Common.Type != ACPI_TYPE_NUMBER)
{
DEBUG_PRINT (ACPI_ERROR,
("ExecEndOp: Bad predicate (not a number) ObjDesc=%X State=%X Type=%X\n",
ObjDesc, WalkState, ObjDesc->Common.Type));
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
}
/* Save the result of the predicate evaluation on
the control stack */
if (ObjDesc->Number.Value)
{
WalkState->ControlState->Common.Value = TRUE;
}
else
{
/* Predicate is FALSE, we will just toss the
rest of the package */
WalkState->ControlState->Common.Value = FALSE;
Status = AE_CTRL_FALSE;
}
DEBUG_PRINT (TRACE_EXEC,
("ExecEndOp: Completed a predicate eval=%X Op=%X\n",
WalkState->ControlState->Common.Value, Op));
/* Break to debugger to display result */
DEBUGGER_EXEC (AcpiDbDisplayResultObject (ObjDesc, WalkState));
/* Delete the predicate result object (we know that
we don't need it anymore) and cleanup the stack */
AcpiCmRemoveReference (ObjDesc);
Status = AcpiDsGetPredicateValue (WalkState, Op, (UINT32) ResultObj);
ResultObj = NULL;
WalkState->ControlState->Common.State = CONTROL_NORMAL;
}
Cleanup:
if (ResultObj)
{
/* Break to debugger to display result */

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswload - Dispatcher namespace load callbacks
* $Revision: 1.18 $
* $Revision: 1.25 $
*
*****************************************************************************/
@ -9,8 +9,8 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* All rights reserved.
*
* 2. License
*
@ -146,11 +146,11 @@
ACPI_STATUS
AcpiDsLoad1BeginOp (
UINT16 Opcode,
ACPI_GENERIC_OP *Op,
ACPI_PARSE_OBJECT *Op,
ACPI_WALK_STATE *WalkState,
ACPI_GENERIC_OP **OutOp)
ACPI_PARSE_OBJECT **OutOp)
{
ACPI_NAMED_OBJECT *NameDesc;
ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
OBJECT_TYPE_INTERNAL DataType;
NATIVE_CHAR *Path;
@ -171,7 +171,7 @@ AcpiDsLoad1BeginOp (
/* Check if this object has already been installed in the namespace */
if (Op && Op->AcpiNamedObject)
if (Op && Op->Node)
{
*OutOp = Op;
return (AE_OK);
@ -188,6 +188,12 @@ AcpiDsLoad1BeginOp (
("Load1BeginOp: State=%p Op=%p Type=%x\n", WalkState, Op, DataType));
if (Opcode == AML_SCOPE_OP)
{
DEBUG_PRINT (TRACE_DISPATCH,
("Load1BeginOp: State=%p Op=%p Type=%x\n", WalkState, Op, DataType));
}
/*
* Enter the named type into the internal namespace. We enter the name
* as we go downward in the parse tree. Any necessary subobjects that involve
@ -195,7 +201,7 @@ AcpiDsLoad1BeginOp (
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, Path,
DataType, IMODE_LOAD_PASS1,
NS_NO_UPSEARCH, WalkState, &(NameDesc));
NS_NO_UPSEARCH, WalkState, &(Node));
if (ACPI_FAILURE (Status))
{
@ -215,13 +221,13 @@ AcpiDsLoad1BeginOp (
/* Initialize */
((ACPI_EXTENDED_OP *)Op)->Name = NameDesc->Name;
((ACPI_PARSE2_OBJECT *)Op)->Name = Node->Name;
/*
* Put the Named Object in the "op" object that the parser uses, so we
* Put the Node in the "op" object that the parser uses, so we
* can get it again quickly when this scope is closed
*/
Op->AcpiNamedObject = NameDesc;
Op->Node = Node;
AcpiPsAppendArg (AcpiPsGetParentScope (WalkState->ParserState), Op);
@ -250,7 +256,7 @@ AcpiDsLoad1BeginOp (
ACPI_STATUS
AcpiDsLoad1EndOp (
ACPI_WALK_STATE *WalkState,
ACPI_GENERIC_OP *Op)
ACPI_PARSE_OBJECT *Op)
{
OBJECT_TYPE_INTERNAL DataType;
@ -278,7 +284,7 @@ AcpiDsLoad1EndOp (
{
DataType = AcpiDsMapOpcodeToDataType (
(Op->Value.Arg)->Opcode, NULL);
((ACPI_NAMED_OBJECT*)Op->AcpiNamedObject)->Type =
((ACPI_NAMESPACE_NODE *)Op->Node)->Type =
(UINT8) DataType;
}
}
@ -317,11 +323,11 @@ AcpiDsLoad1EndOp (
ACPI_STATUS
AcpiDsLoad2BeginOp (
UINT16 Opcode,
ACPI_GENERIC_OP *Op,
ACPI_PARSE_OBJECT *Op,
ACPI_WALK_STATE *WalkState,
ACPI_GENERIC_OP **OutOp)
ACPI_PARSE_OBJECT **OutOp)
{
ACPI_NAMED_OBJECT *NewEntry;
ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
OBJECT_TYPE_INTERNAL DataType;
NATIVE_CHAR *BufferPtr;
@ -370,7 +376,7 @@ AcpiDsLoad2BeginOp (
{
/* Get name from the op */
BufferPtr = (NATIVE_CHAR *) &((ACPI_EXTENDED_OP *)Op)->Name;
BufferPtr = (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Op)->Name;
}
}
@ -392,7 +398,7 @@ AcpiDsLoad2BeginOp (
Opcode == AML_BANK_FIELD_OP ||
Opcode == AML_INDEX_FIELD_OP)
{
NewEntry = NULL;
Node = NULL;
Status = AE_OK;
}
@ -405,19 +411,19 @@ AcpiDsLoad2BeginOp (
Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr,
DataType, IMODE_EXECUTE,
NS_SEARCH_PARENT, WalkState,
&(NewEntry));
&(Node));
}
else
{
if (Op && Op->AcpiNamedObject)
if (Op && Op->Node)
{
Original = Op->AcpiNamedObject;
NewEntry = Op->AcpiNamedObject;
Original = Op->Node;
Node = Op->Node;
if (AcpiNsOpensScope (DataType))
{
Status = AcpiDsScopeStackPush (NewEntry,
Status = AcpiDsScopeStackPush (Node,
DataType,
WalkState);
if (ACPI_FAILURE (Status))
@ -437,7 +443,7 @@ AcpiDsLoad2BeginOp (
Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr,
DataType, IMODE_EXECUTE,
NS_NO_UPSEARCH, WalkState,
&(NewEntry));
&(Node));
}
if (ACPI_SUCCESS (Status))
@ -454,26 +460,26 @@ AcpiDsLoad2BeginOp (
/* Initialize */
((ACPI_EXTENDED_OP *)Op)->Name = NewEntry->Name;
((ACPI_PARSE2_OBJECT *)Op)->Name = Node->Name;
*OutOp = Op;
}
/*
* Put the Named Object in the "op" object that the parser uses, so we
* Put the Node in the "op" object that the parser uses, so we
* can get it again quickly when this scope is closed
*/
Op->AcpiNamedObject = NewEntry;
Op->Node = Node;
if (Original)
{
DEBUG_PRINT (ACPI_INFO,
("Lookup: old %p new %p\n", Original, NewEntry));
("Lookup: old %p new %p\n", Original, Node));
if (Original != NewEntry)
if (Original != Node)
{
DEBUG_PRINT (ACPI_INFO,
("Lookup match error: old %p new %p\n", Original, NewEntry));
("Lookup match error: old %p new %p\n", Original, Node));
}
}
}
@ -501,13 +507,13 @@ AcpiDsLoad2BeginOp (
ACPI_STATUS
AcpiDsLoad2EndOp (
ACPI_WALK_STATE *WalkState,
ACPI_GENERIC_OP *Op)
ACPI_PARSE_OBJECT *Op)
{
ACPI_STATUS Status = AE_OK;
OBJECT_TYPE_INTERNAL DataType;
ACPI_NAMED_OBJECT *NameDesc;
ACPI_GENERIC_OP *Arg;
ACPI_NAMED_OBJECT *NewEntry;
ACPI_NAMESPACE_NODE *Node;
ACPI_PARSE_OBJECT *Arg;
ACPI_NAMESPACE_NODE *NewNode;
DEBUG_PRINT (TRACE_DISPATCH, ("Load2EndOp: Op=%p State=%p\n", Op, WalkState));
@ -522,7 +528,7 @@ AcpiDsLoad2EndOp (
DEBUG_PRINT (TRACE_DISPATCH,
("Load2EndOp: ending scope Op=%p State=%p\n", Op, WalkState));
if (((ACPI_EXTENDED_OP *)Op)->Name == -1)
if (((ACPI_PARSE2_OBJECT *)Op)->Name == -1)
{
DEBUG_PRINT (ACPI_ERROR,
("Load2EndOp: Un-named scope! Op=%p State=%p\n", Op,
@ -535,17 +541,17 @@ AcpiDsLoad2EndOp (
DataType = AcpiDsMapNamedOpcodeToDataType (Op->Opcode);
/*
* Get the Named Object/name from the earlier lookup
* Get the Node/name from the earlier lookup
* (It was saved in the *op structure)
*/
NameDesc = Op->AcpiNamedObject;
Node = Op->Node;
/*
* Put the Named Object on the object stack (Contains the ACPI Name of
* Put the Node on the object stack (Contains the ACPI Name of
* this object)
*/
WalkState->Operands[0] = (void *) NameDesc;
WalkState->Operands[0] = (void *) Node;
WalkState->NumOperands = 1;
/* Pop the scope stack */
@ -600,9 +606,14 @@ AcpiDsLoad2EndOp (
case AML_WORD_FIELD_OP:
case AML_DWORD_FIELD_OP:
/*
* Create the field object, but the field buffer and index must
* be evaluated later during the execution phase
*/
DEBUG_PRINT (TRACE_DISPATCH,
("LOADING-CreateXxxField: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, NameDesc));
WalkState, Op, Node));
/* Get the NameString argument */
@ -626,27 +637,34 @@ AcpiDsLoad2EndOp (
INTERNAL_TYPE_DEF_ANY,
IMODE_LOAD_PASS1,
NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
WalkState, &(NewEntry));
WalkState, &(NewNode));
if (ACPI_SUCCESS (Status))
{
/* We could put the returned object (Named Object) on the object stack for later, but
/* We could put the returned object (Node) on the object stack for later, but
* for now, we will put it in the "op" object that the parser uses, so we
* can get it again at the end of this scope
*/
Op->AcpiNamedObject = NewEntry;
Op->Node = NewNode;
/*
* If this is NOT a control method, we need to evaluate this opcode now.
* If there is no object attached to the node, this node was just created and
* we need to create the field object. Otherwise, this was a lookup of an
* existing node and we don't want to create the field object again.
*/
/* THIS WON"T WORK. Must execute all operands like Add(). => Must do an execute pass
if (!WalkState->MethodDesc)
if (!NewNode->Object)
{
Status = AcpiDsExecEndOp (WalkState, Op);
/*
* The Field definition is not fully parsed at this time.
* (We must save the address of the AML for the buffer and index operands)
*/
Status = AcpiAmlExecCreateField (((ACPI_PARSE2_OBJECT *) Op)->Data,
((ACPI_PARSE2_OBJECT *) Op)->Length,
NewNode, WalkState);
}
*/
}
break;
@ -654,16 +672,16 @@ AcpiDsLoad2EndOp (
DEBUG_PRINT (TRACE_DISPATCH,
("RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, NameDesc));
WalkState, Op, Node));
/*
* Lookup the method name and save the Named Object
* Lookup the method name and save the Node
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String,
ACPI_TYPE_ANY, IMODE_LOAD_PASS2,
NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE,
WalkState, &(NewEntry));
WalkState, &(NewNode));
if (ACPI_SUCCESS (Status))
{
@ -673,11 +691,11 @@ AcpiDsLoad2EndOp (
/* TBD: [Restructure] Make sure that what we found is indeed a method! */
/* We didn't search for a method on purpose, to see if the name would resolve! */
/* We could put the returned object (Named Object) on the object stack for later, but
/* We could put the returned object (Node) on the object stack for later, but
* for now, we will put it in the "op" object that the parser uses, so we
* can get it again at the end of this scope
*/
Op->AcpiNamedObject = NewEntry;
Op->Node = NewNode;
}
@ -690,9 +708,9 @@ AcpiDsLoad2EndOp (
DEBUG_PRINT (TRACE_DISPATCH,
("LOADING-Processor: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, NameDesc));
WalkState, Op, Node));
Status = AcpiAmlExecCreateProcessor (Op, (ACPI_HANDLE) NameDesc);
Status = AcpiAmlExecCreateProcessor (Op, (ACPI_HANDLE) Node);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
@ -700,7 +718,7 @@ AcpiDsLoad2EndOp (
DEBUG_PRINT (TRACE_DISPATCH,
("Completed Processor Init, Op=%p State=%p entry=%p\n",
Op, WalkState, NameDesc));
Op, WalkState, Node));
break;
@ -710,9 +728,9 @@ AcpiDsLoad2EndOp (
DEBUG_PRINT (TRACE_DISPATCH,
("LOADING-PowerResource: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, NameDesc));
WalkState, Op, Node));
Status = AcpiAmlExecCreatePowerResource (Op, (ACPI_HANDLE) NameDesc);
Status = AcpiAmlExecCreatePowerResource (Op, (ACPI_HANDLE) Node);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
@ -720,7 +738,7 @@ AcpiDsLoad2EndOp (
DEBUG_PRINT (TRACE_DISPATCH,
("Completed PowerResource Init, Op=%p State=%p entry=%p\n",
Op, WalkState, NameDesc));
Op, WalkState, Node));
break;
@ -730,7 +748,7 @@ AcpiDsLoad2EndOp (
DEBUG_PRINT (TRACE_DISPATCH,
("LOADING-ThermalZone: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, NameDesc));
WalkState, Op, Node));
break;
@ -738,12 +756,12 @@ AcpiDsLoad2EndOp (
DEBUG_PRINT (TRACE_DISPATCH,
("LOADING-Field: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, NameDesc));
WalkState, Op, Node));
Arg = Op->Value.Arg;
Status = AcpiDsCreateField (Op,
Arg->AcpiNamedObject,
Arg->Node,
WalkState);
break;
@ -752,12 +770,12 @@ AcpiDsLoad2EndOp (
DEBUG_PRINT (TRACE_DISPATCH,
("LOADING-IndexField: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, NameDesc));
WalkState, Op, Node));
Arg = Op->Value.Arg;
Status = AcpiDsCreateIndexField (Op,
(ACPI_HANDLE) Arg->AcpiNamedObject,
(ACPI_HANDLE) Arg->Node,
WalkState);
break;
@ -766,11 +784,11 @@ AcpiDsLoad2EndOp (
DEBUG_PRINT (TRACE_DISPATCH,
("LOADING-BankField: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, NameDesc));
WalkState, Op, Node));
Arg = Op->Value.Arg;
Status = AcpiDsCreateBankField (Op,
Arg->AcpiNamedObject,
Arg->Node,
WalkState);
break;
@ -782,13 +800,13 @@ AcpiDsLoad2EndOp (
DEBUG_PRINT (TRACE_DISPATCH,
("LOADING-Method: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, NameDesc));
WalkState, Op, Node));
if (!NameDesc->Object)
if (!Node->Object)
{
Status = AcpiAmlExecCreateMethod (((ACPI_EXTENDED_OP *) Op)->Data,
((ACPI_EXTENDED_OP *) Op)->Length,
Arg->Value.Integer, (ACPI_HANDLE) NameDesc);
Status = AcpiAmlExecCreateMethod (((ACPI_PARSE2_OBJECT *) Op)->Data,
((ACPI_PARSE2_OBJECT *) Op)->Length,
Arg->Value.Integer, (ACPI_HANDLE) Node);
}
break;
@ -826,13 +844,13 @@ AcpiDsLoad2EndOp (
case AML_REGION_OP:
if (NameDesc->Object)
if (Node->Object)
{
break;
}
DEBUG_PRINT (TRACE_DISPATCH,
("LOADING-Opregion: Op=%p State=%p NamedObj=%p\n", Op, WalkState, NameDesc));
("LOADING-Opregion: Op=%p State=%p NamedObj=%p\n", Op, WalkState, Node));
/*
@ -840,13 +858,14 @@ AcpiDsLoad2EndOp (
* (We must save the address of the AML of the address and length operands)
*/
Status = AcpiAmlExecCreateRegion (((ACPI_EXTENDED_OP *) Op)->Data,
((ACPI_EXTENDED_OP *) Op)->Length,
Arg->Value.Integer, WalkState);
Status = AcpiAmlExecCreateRegion (((ACPI_PARSE2_OBJECT *) Op)->Data,
((ACPI_PARSE2_OBJECT *) Op)->Length,
(ACPI_ADDRESS_SPACE_TYPE) Arg->Value.Integer,
WalkState);
DEBUG_PRINT (TRACE_DISPATCH,
("Completed OpRegion Init, Op=%p State=%p entry=%p\n",
Op, WalkState, NameDesc));
Op, WalkState, Node));
break;
@ -872,7 +891,16 @@ AcpiDsLoad2EndOp (
DEBUG_PRINT (TRACE_DISPATCH,
("LOADING-Name: Op=%p State=%p\n", Op, WalkState));
Status = AcpiDsCreateNamedObject (WalkState, NameDesc, Op);
/*
* Because of the execution pass through the non-control-method
* parts of the table, we can arrive here twice. Only init
* the named object node the first time through
*/
if (!Node->Object)
{
Status = AcpiDsCreateNode (WalkState, Node, Op);
}
break;
@ -881,7 +909,7 @@ AcpiDsLoad2EndOp (
DEBUG_PRINT (TRACE_DISPATCH,
("LOADING-NamePath object: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, NameDesc));
WalkState, Op, Node));
break;
@ -890,12 +918,12 @@ AcpiDsLoad2EndOp (
}
Cleanup:
/* Remove the Named Object pushed at the very beginning */
/* Remove the Node pushed at the very beginning */
AcpiDsObjStackPop (1, WalkState);
return (Status);
}

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswscope - Scope stack manipulation
* $Revision: 1.37 $
* $Revision: 1.41 $
*
*****************************************************************************/
@ -9,8 +9,8 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* All rights reserved.
*
* 2. License
*
@ -154,7 +154,7 @@ AcpiDsScopeStackClear (
WalkState->ScopeInfo = ScopeInfo->Scope.Next;
DEBUG_PRINT (TRACE_EXEC,
("Popped object type 0x%X\n", ScopeInfo->Common.Value));
("Popped object type %X\n", ScopeInfo->Common.Value));
AcpiCmDeleteGenericState (ScopeInfo);
}
}
@ -164,17 +164,17 @@ AcpiDsScopeStackClear (
*
* FUNCTION: AcpiDsScopeStackPush
*
* PARAMETERS: *NewScope, - Name to be made current
* Type, - Type of frame being pushed
* PARAMETERS: *Node, - Name to be made current
* Type, - Type of frame being pushed
*
* DESCRIPTION: Push the current scope on the scope stack, and make the
* passed Named Object current.
* passed Node current.
*
***************************************************************************/
ACPI_STATUS
AcpiDsScopeStackPush (
ACPI_NAMED_OBJECT *NewScope,
ACPI_NAMESPACE_NODE *Node,
OBJECT_TYPE_INTERNAL Type,
ACPI_WALK_STATE *WalkState)
{
@ -184,11 +184,11 @@ AcpiDsScopeStackPush (
FUNCTION_TRACE ("DsScopeStackPush");
if (!NewScope)
if (!Node)
{
/* invalid scope */
REPORT_ERROR ("DsScopeStackPush: null scope passed");
REPORT_ERROR (("DsScopeStackPush: null scope passed\n"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
@ -196,7 +196,7 @@ AcpiDsScopeStackPush (
if (!AcpiAmlValidateObjectType (Type))
{
REPORT_WARNING ("DsScopeStackPush: type code out of range");
REPORT_WARNING (("DsScopeStackPush: type code out of range\n"));
}
@ -210,7 +210,7 @@ AcpiDsScopeStackPush (
/* Init new scope object */
ScopeInfo->Scope.NameTable = NewScope;
ScopeInfo->Scope.Node = Node;
ScopeInfo->Common.Value = (UINT16) Type;
/* Push new scope object onto stack */
@ -258,7 +258,7 @@ AcpiDsScopeStackPop (
}
DEBUG_PRINT (TRACE_EXEC,
("Popped object type 0x%X\n", ScopeInfo->Common.Value));
("Popped object type %X\n", ScopeInfo->Common.Value));
AcpiCmDeleteGenericState (ScopeInfo);

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswstate - Dispatcher parse tree walk management routines
* $Revision: 1.30 $
* $Revision: 1.36 $
*
*****************************************************************************/
@ -9,8 +9,8 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
* Some or all of this work - Copyright (c) 1999, 2000, Intel Corp.
* All rights reserved.
*
* 2. License
*
@ -142,12 +142,336 @@
******************************************************************************/
ACPI_STATUS
AcpiDsResultStackClear (
xxxAcpiDsResultStackClear (
ACPI_WALK_STATE *WalkState)
{
/*
WalkState->NumResults = 0;
WalkState->CurrentResult = 0;
*/
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDsResultInsert
*
* PARAMETERS: Object - Object to push
* WalkState - Current Walk state
*
* RETURN: Status
*
* DESCRIPTION: Push an object onto this walk's result stack
*
******************************************************************************/
ACPI_STATUS
AcpiDsResultInsert (
void *Object,
UINT32 Index,
ACPI_WALK_STATE *WalkState)
{
ACPI_GENERIC_STATE *State;
State = WalkState->Results;
if (!State)
{
DEBUG_PRINT (ACPI_ERROR,
("DsResultInsert: No result object pushed! State=%p\n",
WalkState));
return (AE_NOT_EXIST);
}
if (Index >= OBJ_NUM_OPERANDS)
{
DEBUG_PRINT (ACPI_ERROR,
("DsResultInsert: Index out of range: %X Obj=%p State=%p Num=%X\n",
Index, Object, WalkState, State->Results.NumResults));
return (AE_BAD_PARAMETER);
}
if (!Object)
{
DEBUG_PRINT (ACPI_ERROR,
("DsResultInsert: Null Object! Index=%X Obj=%p State=%p Num=%X\n",
Index, Object, WalkState, State->Results.NumResults));
return (AE_BAD_PARAMETER);
}
State->Results.ObjDesc [Index] = Object;
State->Results.NumResults++;
DEBUG_PRINT (TRACE_EXEC,
("DsResultStackPush: Obj=%p [%s] State=%p Num=%X Cur=%X\n",
Object, Object ? AcpiCmGetTypeName (((ACPI_OPERAND_OBJECT *) Object)->Common.Type) : "NULL",
WalkState, State->Results.NumResults, WalkState->CurrentResult));
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDsResultRemove
*
* PARAMETERS: Object - Where to return the popped object
* WalkState - Current Walk state
*
* RETURN: Status
*
* DESCRIPTION: Pop an object off the bottom of this walk's result stack. In
* other words, this is a FIFO.
*
******************************************************************************/
ACPI_STATUS
AcpiDsResultRemove (
ACPI_OPERAND_OBJECT **Object,
UINT32 Index,
ACPI_WALK_STATE *WalkState)
{
ACPI_GENERIC_STATE *State;
State = WalkState->Results;
if (!State)
{
DEBUG_PRINT (ACPI_ERROR,
("DsResultRemove: No result object pushed! State=%p\n",
WalkState));
return (AE_NOT_EXIST);
}
if (Index >= OBJ_NUM_OPERANDS)
{
DEBUG_PRINT (ACPI_ERROR,
("DsResultRemove: Index out of range: %X State=%p Num=%X\n",
Index, WalkState, State->Results.NumResults));
}
/* Check for a valid result object */
if (!State->Results.ObjDesc [Index])
{
DEBUG_PRINT (ACPI_ERROR,
("DsResultStackRemove: Null operand! State=%p #Ops=%X, Index=%X\n",
WalkState, State->Results.NumResults, Index));
return (AE_AML_NO_OPERAND);
}
/* Remove the object */
State->Results.NumResults--;
*Object = State->Results.ObjDesc [Index];
State->Results.ObjDesc [Index] = NULL;
DEBUG_PRINT (TRACE_EXEC,
("DsResultStackRemove: Obj=%p [%s] Index=%X State=%p Num=%X\n",
*Object, (*Object) ? AcpiCmGetTypeName ((*Object)->Common.Type) : "NULL",
Index, WalkState, State->Results.NumResults));
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDsResultPop
*
* PARAMETERS: Object - Where to return the popped object
* WalkState - Current Walk state
*
* RETURN: Status
*
* DESCRIPTION: Pop an object off the bottom of this walk's result stack. In
* other words, this is a FIFO.
*
******************************************************************************/
ACPI_STATUS
AcpiDsResultPop (
ACPI_OPERAND_OBJECT **Object,
ACPI_WALK_STATE *WalkState)
{
UINT32 Index;
ACPI_GENERIC_STATE *State;
State = WalkState->Results;
if (!State)
{
return (AE_OK);
}
if (!State->Results.NumResults)
{
DEBUG_PRINT (ACPI_ERROR,
("DsResultPop: No result objects! State=%p\n",
WalkState));
return (AE_STACK_UNDERFLOW);
}
/* Remove top element */
State->Results.NumResults--;
for (Index = OBJ_NUM_OPERANDS; Index; Index--)
{
/* Check for a valid result object */
if (State->Results.ObjDesc [Index -1])
{
*Object = State->Results.ObjDesc [Index -1];
State->Results.ObjDesc [Index -1] = NULL;
DEBUG_PRINT (TRACE_EXEC,
("DsResultStackRemove: Obj=%p [%s] Index=%X State=%p Num=%X\n",
*Object, (*Object) ? AcpiCmGetTypeName ((*Object)->Common.Type) : "NULL",
Index -1, WalkState, State->Results.NumResults));
return (AE_OK);
}
}
DEBUG_PRINT (ACPI_ERROR,
("DsResultPop: No result objects! State=%p\n",
WalkState));
return (AE_STACK_UNDERFLOW);
}
/*******************************************************************************
*
* FUNCTION: AcpiDsResultPop
*
* PARAMETERS: Object - Where to return the popped object
* WalkState - Current Walk state
*
* RETURN: Status
*
* DESCRIPTION: Pop an object off the bottom of this walk's result stack. In
* other words, this is a FIFO.
*
******************************************************************************/
ACPI_STATUS
AcpiDsResultPopFromBottom (
ACPI_OPERAND_OBJECT **Object,
ACPI_WALK_STATE *WalkState)
{
UINT32 Index;
ACPI_GENERIC_STATE *State;
State = WalkState->Results;
if (!State)
{
DEBUG_PRINT (ACPI_ERROR,
("DsResultPopFromBottom: Warning: No result object pushed! State=%p\n",
WalkState));
return (AE_NOT_EXIST);
}
if (!State->Results.NumResults)
{
DEBUG_PRINT (ACPI_ERROR,
("DsResultPopFromBottom: No result objects! State=%p\n",
WalkState));
return (AE_STACK_UNDERFLOW);
}
/* Remove Bottom element */
*Object = State->Results.ObjDesc [0];
/* Push entire stack down one element */
for (Index = 0; Index < State->Results.NumResults; Index++)
{
State->Results.ObjDesc [Index] = State->Results.ObjDesc [Index + 1];
}
State->Results.NumResults--;
/* Check for a valid result object */
if (!*Object)
{
DEBUG_PRINT (ACPI_ERROR,
("DsResultPopFromBottom: Null operand! State=%p #Ops=%X, Index=%X\n",
WalkState, State->Results.NumResults, Index));
return (AE_AML_NO_OPERAND);
}
DEBUG_PRINT (TRACE_EXEC,
("DsResultPopFromBottom: Obj=%p [%s], Results=%p State=%p\n",
*Object, (*Object) ? AcpiCmGetTypeName ((*Object)->Common.Type) : "NULL",
State, WalkState));
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDsResultPop
*
* PARAMETERS: Object - Where to return the popped object
* WalkState - Current Walk state
*
* RETURN: Status
*
* DESCRIPTION: Pop an object off the bottom of this walk's result stack. In
* other words, this is a FIFO.
*
******************************************************************************/
ACPI_STATUS
AcpiDsResultPush (
ACPI_OPERAND_OBJECT *Object,
ACPI_WALK_STATE *WalkState)
{
ACPI_GENERIC_STATE *State;
State = WalkState->Results;
if (!State)
{
return (AE_OK);
}
if (State->Results.NumResults == OBJ_NUM_OPERANDS)
{
DEBUG_PRINT (ACPI_ERROR,
("DsResultPush: Result stack overflow: Obj=%p State=%p Num=%X\n",
Object, WalkState, State->Results.NumResults));
return (AE_STACK_OVERFLOW);
}
if (!Object)
{
DEBUG_PRINT (ACPI_ERROR,
("DsResultPush: Null Object! Obj=%p State=%p Num=%X\n",
Object, WalkState, State->Results.NumResults));
return (AE_BAD_PARAMETER);
}
State->Results.ObjDesc [State->Results.NumResults] = Object;
State->Results.NumResults++;
DEBUG_PRINT (TRACE_EXEC,
("DsResultPush: Obj=%p [%s] State=%p Num=%X Cur=%X\n",
Object, Object ? AcpiCmGetTypeName (((ACPI_OPERAND_OBJECT *) Object)->Common.Type) : "NULL",
WalkState, State->Results.NumResults, WalkState->CurrentResult));
return (AE_OK);
}
@ -162,31 +486,28 @@ AcpiDsResultStackClear (
*
* RETURN: Status
*
* DESCRIPTION: Push an object onto this walk's result stack
* DESCRIPTION:
*
******************************************************************************/
ACPI_STATUS
AcpiDsResultStackPush (
void *Object,
ACPI_WALK_STATE *WalkState)
{
ACPI_GENERIC_STATE *State;
if (WalkState->NumResults >= OBJ_NUM_OPERANDS)
State = AcpiCmCreateGenericState ();
if (!State)
{
DEBUG_PRINT (ACPI_ERROR,
("DsResultStackPush: overflow! Obj=%p State=%p Num=%X\n",
Object, WalkState, WalkState->NumResults));
return (AE_STACK_OVERFLOW);
return (AE_NO_MEMORY);
}
WalkState->Results [WalkState->NumResults] = Object;
WalkState->NumResults++;
AcpiCmPushGenericState (&WalkState->Results, State);
DEBUG_PRINT (TRACE_EXEC,
("DsResultStackPush: Obj=%p State=%p Num=%X Cur=%X\n",
Object, WalkState, WalkState->NumResults, WalkState->CurrentResult));
("DsResultStackPush: Results=%p State=%p\n",
State, WalkState));
return (AE_OK);
}
@ -196,54 +517,39 @@ AcpiDsResultStackPush (
*
* FUNCTION: AcpiDsResultStackPop
*
* PARAMETERS: Object - Where to return the popped object
* WalkState - Current Walk state
* PARAMETERS: WalkState - Current Walk state
*
* RETURN: Status
*
* DESCRIPTION: Pop an object off the bottom of this walk's result stack. In
* other words, this is a FIFO.
* DESCRIPTION:
*
******************************************************************************/
ACPI_STATUS
AcpiDsResultStackPop (
ACPI_OBJECT_INTERNAL **Object,
ACPI_WALK_STATE *WalkState)
{
ACPI_GENERIC_STATE *State;
/* Check for stack underflow */
if (WalkState->NumResults == 0)
if (WalkState->Results == NULL)
{
DEBUG_PRINT (ACPI_ERROR,
("DsResultStackPop: Underflow! State=%p Cur=%X Num=%X\n",
WalkState, WalkState->CurrentResult, WalkState->NumResults));
DEBUG_PRINT (TRACE_EXEC,
("DsResultStackPop: Underflow - State=%p\n",
WalkState));
return (AE_AML_NO_OPERAND);
}
/* Pop the stack */
WalkState->NumResults--;
/* Check for a valid result object */
if (!WalkState->Results [WalkState->NumResults])
{
DEBUG_PRINT (ACPI_ERROR,
("DsResultStackPop: Null operand! State=%p #Ops=%X\n",
WalkState, WalkState->NumResults));
return (AE_AML_NO_OPERAND);
}
*Object = WalkState->Results [WalkState->NumResults];
WalkState->Results [WalkState->NumResults] = NULL;
State = AcpiCmPopGenericState (&WalkState->Results);
DEBUG_PRINT (TRACE_EXEC,
("DsResultStackPop: Obj=%p State=%p Num=%X Cur=%X\n",
*Object, WalkState, WalkState->NumResults, WalkState->CurrentResult));
("DsResultStackPop: Result=%p RemainingResults=%X State=%p\n",
State, State->Results.NumResults, WalkState));
AcpiCmDeleteGenericState (State);
return (AE_OK);
}
@ -322,8 +628,9 @@ AcpiDsObjStackPush (
WalkState->Operands [WalkState->NumOperands] = Object;
WalkState->NumOperands++;
DEBUG_PRINT (TRACE_EXEC, ("DsObjStackPush: Obj=%p State=%p #Ops=%X\n",
Object, WalkState, WalkState->NumOperands));
DEBUG_PRINT (TRACE_EXEC, ("DsObjStackPush: Obj=%p [%s] State=%p #Ops=%X\n",
Object, AcpiCmGetTypeName (((ACPI_OPERAND_OBJECT *) Object)->Common.Type),
WalkState, WalkState->NumOperands));
return (AE_OK);
}
@ -345,7 +652,7 @@ AcpiDsObjStackPush (
ACPI_STATUS
AcpiDsObjStackPopObject (
ACPI_OBJECT_INTERNAL **Object,
ACPI_OPERAND_OBJECT **Object,
ACPI_WALK_STATE *WalkState)
{
@ -380,7 +687,8 @@ AcpiDsObjStackPopObject (
*Object = WalkState->Operands [WalkState->NumOperands];
WalkState->Operands [WalkState->NumOperands] = NULL;
DEBUG_PRINT (TRACE_EXEC, ("DsObjStackPopObject: State=%p #Ops=%X\n",
DEBUG_PRINT (TRACE_EXEC, ("DsObjStackPopObject: Obj=%p [%s] State=%p #Ops=%X\n",
*Object, AcpiCmGetTypeName ((*Object)->Common.Type),
WalkState, WalkState->NumOperands));
return (AE_OK);
@ -454,7 +762,7 @@ AcpiDsObjStackPopAndDelete (
ACPI_WALK_STATE *WalkState)
{
UINT32 i;
ACPI_OBJECT_INTERNAL *ObjDesc;
ACPI_OPERAND_OBJECT *ObjDesc;
for (i = 0; i < PopCount; i++)
@ -574,7 +882,7 @@ AcpiDsGetCurrentWalkState (
*
******************************************************************************/
void
static void
AcpiDsPushWalkState (
ACPI_WALK_STATE *WalkState,
ACPI_WALK_LIST *WalkList)
@ -651,8 +959,8 @@ AcpiDsPopWalkState (
ACPI_WALK_STATE *
AcpiDsCreateWalkState (
ACPI_OWNER_ID OwnerId,
ACPI_GENERIC_OP *Origin,
ACPI_OBJECT_INTERNAL *MthDesc,
ACPI_PARSE_OBJECT *Origin,
ACPI_OPERAND_OBJECT *MthDesc,
ACPI_WALK_LIST *WalkList)
{
ACPI_WALK_STATE *WalkState;
@ -677,7 +985,7 @@ AcpiDsCreateWalkState (
AcpiGbl_WalkStateCacheDepth--;
DEBUG_PRINT (TRACE_EXEC, ("DsCreateWalkState: State %p from cache\n", WalkState));
AcpiCmReleaseMutex (ACPI_MTX_CACHES);
}
@ -703,7 +1011,9 @@ AcpiDsCreateWalkState (
/* Init the method args/local */
#ifndef _ACPI_ASL_COMPILER
AcpiDsMethodDataInit (WalkState);
#endif
/* Put the new state at the head of the walk list */
@ -747,6 +1057,7 @@ AcpiDsDeleteWalkState (
return;
}
/* Always must free any linked control states */
while (WalkState->ControlState)
@ -757,7 +1068,6 @@ AcpiDsDeleteWalkState (
AcpiCmDeleteGenericState (State);
}
/* Always must free any linked parse states */
while (WalkState->ScopeInfo)
@ -768,6 +1078,17 @@ AcpiDsDeleteWalkState (
AcpiCmDeleteGenericState (State);
}
/* Always must free any stacked result states */
while (WalkState->Results)
{
State = WalkState->Results;
WalkState->Results = State->Common.Next;
AcpiCmDeleteGenericState (State);
}
/* If walk cache is full, just free this wallkstate object */
if (AcpiGbl_WalkStateCacheDepth >= MAX_WALK_CACHE_DEPTH)