mirror of
https://github.com/acpica/acpica/
synced 2025-01-21 00:42:02 +03:00
Merged WALK_STATE and PARSE_STATE; new common function for
initialization of WALK_STATE date 2001.09.11.20.10.00; author rmoore1; state Exp;
This commit is contained in:
parent
d06af2abe4
commit
a8aa0d0907
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: dswload - Dispatcher namespace load callbacks
|
||||
* $Revision: 1.38 $
|
||||
* $Revision: 1.46 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -145,11 +145,10 @@
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiDsLoad1BeginOp (
|
||||
UINT16 Opcode,
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
ACPI_PARSE_OBJECT **OutOp)
|
||||
{
|
||||
ACPI_PARSE_OBJECT *Op;
|
||||
ACPI_NAMESPACE_NODE *Node;
|
||||
ACPI_STATUS Status;
|
||||
ACPI_OBJECT_TYPE8 DataType;
|
||||
@ -157,41 +156,45 @@ AcpiDsLoad1BeginOp (
|
||||
|
||||
|
||||
PROC_NAME ("DsLoad1BeginOp");
|
||||
DEBUG_PRINTP (TRACE_DISPATCH, ("Op=%p State=%p\n", Op, WalkState));
|
||||
|
||||
Op = WalkState->Op;
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
|
||||
|
||||
|
||||
/* We are only interested in opcodes that have an associated name */
|
||||
|
||||
if (!AcpiPsIsNamedOp (Opcode))
|
||||
if (WalkState->Op)
|
||||
{
|
||||
*OutOp = Op;
|
||||
return (AE_OK);
|
||||
if (!(WalkState->OpInfo->Flags & AML_NAMED))
|
||||
{
|
||||
*OutOp = Op;
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
/* Check if this object has already been installed in the namespace */
|
||||
|
||||
if (Op->Node)
|
||||
{
|
||||
*OutOp = Op;
|
||||
return (AE_OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Check if this object has already been installed in the namespace */
|
||||
|
||||
if (Op && Op->Node)
|
||||
{
|
||||
*OutOp = Op;
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
Path = AcpiPsGetNextNamestring (WalkState->ParserState);
|
||||
Path = AcpiPsGetNextNamestring (&WalkState->ParserState);
|
||||
|
||||
/* Map the raw opcode into an internal object type */
|
||||
|
||||
DataType = AcpiDsMapNamedOpcodeToDataType (Opcode);
|
||||
DataType = AcpiDsMapNamedOpcodeToDataType (WalkState->Opcode);
|
||||
|
||||
|
||||
DEBUG_PRINTP (TRACE_DISPATCH,
|
||||
("State=%p Op=%p Type=%x\n", WalkState, Op, DataType));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
||||
"State=%p Op=%p Type=%x\n", WalkState, Op, DataType));
|
||||
|
||||
|
||||
if (Opcode == AML_SCOPE_OP)
|
||||
if (WalkState->Opcode == AML_SCOPE_OP)
|
||||
{
|
||||
DEBUG_PRINTP (TRACE_DISPATCH,
|
||||
("State=%p Op=%p Type=%x\n", WalkState, Op, DataType));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
||||
"State=%p Op=%p Type=%x\n", WalkState, Op, DataType));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -199,7 +202,7 @@ AcpiDsLoad1BeginOp (
|
||||
* as we go downward in the parse tree. Any necessary subobjects that involve
|
||||
* arguments to the opcode must be created as we go back up the parse tree later.
|
||||
*/
|
||||
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, DataType,
|
||||
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, DataType,
|
||||
IMODE_LOAD_PASS1, NS_NO_UPSEARCH, WalkState, &(Node));
|
||||
|
||||
if (ACPI_FAILURE (Status))
|
||||
@ -211,7 +214,7 @@ AcpiDsLoad1BeginOp (
|
||||
{
|
||||
/* Create a new op */
|
||||
|
||||
Op = AcpiPsAllocOp (Opcode);
|
||||
Op = AcpiPsAllocOp (WalkState->Opcode);
|
||||
if (!Op)
|
||||
{
|
||||
return (AE_NO_MEMORY);
|
||||
@ -227,12 +230,9 @@ AcpiDsLoad1BeginOp (
|
||||
* can get it again quickly when this scope is closed
|
||||
*/
|
||||
Op->Node = Node;
|
||||
|
||||
|
||||
AcpiPsAppendArg (AcpiPsGetParentScope (WalkState->ParserState), Op);
|
||||
AcpiPsAppendArg (AcpiPsGetParentScope (&WalkState->ParserState), Op);
|
||||
|
||||
*OutOp = Op;
|
||||
|
||||
return (Status);
|
||||
}
|
||||
|
||||
@ -254,23 +254,25 @@ AcpiDsLoad1BeginOp (
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiDsLoad1EndOp (
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
ACPI_PARSE_OBJECT *Op)
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
ACPI_PARSE_OBJECT *Op;
|
||||
ACPI_OBJECT_TYPE8 DataType;
|
||||
|
||||
|
||||
PROC_NAME ("DsLoad1EndOp");
|
||||
DEBUG_PRINT (TRACE_DISPATCH, ("Op=%p State=%p\n", Op, WalkState));
|
||||
|
||||
Op = WalkState->Op;
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
|
||||
|
||||
|
||||
/* We are only interested in opcodes that have an associated name */
|
||||
|
||||
if (!AcpiPsIsNamedOp (Op->Opcode))
|
||||
if (!(WalkState->OpInfo->Flags & AML_NAMED))
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/* Get the type to determine if we should pop the scope */
|
||||
|
||||
DataType = AcpiDsMapNamedOpcodeToDataType (Op->Opcode);
|
||||
@ -288,19 +290,17 @@ AcpiDsLoad1EndOp (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Pop the scope stack */
|
||||
|
||||
if (AcpiNsOpensScope (DataType))
|
||||
{
|
||||
DEBUG_PRINTP (TRACE_DISPATCH, ("(%s): Popping scope for Op %p\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n",
|
||||
AcpiUtGetTypeName (DataType), Op));
|
||||
|
||||
AcpiDsScopeStackPop (WalkState);
|
||||
}
|
||||
|
||||
return (AE_OK);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -320,11 +320,10 @@ AcpiDsLoad1EndOp (
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiDsLoad2BeginOp (
|
||||
UINT16 Opcode,
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
ACPI_PARSE_OBJECT **OutOp)
|
||||
{
|
||||
ACPI_PARSE_OBJECT *Op;
|
||||
ACPI_NAMESPACE_NODE *Node;
|
||||
ACPI_STATUS Status;
|
||||
ACPI_OBJECT_TYPE8 DataType;
|
||||
@ -333,31 +332,32 @@ AcpiDsLoad2BeginOp (
|
||||
|
||||
|
||||
PROC_NAME ("DsLoad2BeginOp");
|
||||
DEBUG_PRINTP (TRACE_DISPATCH, ("Op=%p State=%p\n", Op, WalkState));
|
||||
|
||||
Op = WalkState->Op;
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
|
||||
|
||||
/* We only care about Namespace opcodes here */
|
||||
|
||||
if (!AcpiPsIsNamespaceOp (Opcode) &&
|
||||
Opcode != AML_INT_NAMEPATH_OP)
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/* Temp! same code as in psparse */
|
||||
|
||||
if (!AcpiPsIsNamedOp (Opcode))
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
if (Op)
|
||||
{
|
||||
/* We only care about Namespace opcodes here */
|
||||
|
||||
if (!(WalkState->OpInfo->Flags & AML_NSOPCODE) &&
|
||||
WalkState->Opcode != AML_INT_NAMEPATH_OP)
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
/* TBD: [Restructure] Temp! same code as in psparse */
|
||||
|
||||
if (!(WalkState->OpInfo->Flags & AML_NAMED))
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the name we are going to enter or lookup in the namespace
|
||||
*/
|
||||
if (Opcode == AML_INT_NAMEPATH_OP)
|
||||
if (WalkState->Opcode == AML_INT_NAMEPATH_OP)
|
||||
{
|
||||
/* For Namepath op, get the path string */
|
||||
|
||||
@ -380,36 +380,34 @@ AcpiDsLoad2BeginOp (
|
||||
|
||||
else
|
||||
{
|
||||
BufferPtr = AcpiPsGetNextNamestring (WalkState->ParserState);
|
||||
BufferPtr = AcpiPsGetNextNamestring (&WalkState->ParserState);
|
||||
}
|
||||
|
||||
|
||||
/* Map the raw opcode into an internal object type */
|
||||
|
||||
DataType = AcpiDsMapNamedOpcodeToDataType (Opcode);
|
||||
DataType = AcpiDsMapNamedOpcodeToDataType (WalkState->Opcode);
|
||||
|
||||
DEBUG_PRINTP (TRACE_DISPATCH,
|
||||
("State=%p Op=%p Type=%x\n", WalkState, Op, DataType));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
||||
"State=%p Op=%p Type=%x\n", WalkState, Op, DataType));
|
||||
|
||||
|
||||
if (Opcode == AML_FIELD_OP ||
|
||||
Opcode == AML_BANK_FIELD_OP ||
|
||||
Opcode == AML_INDEX_FIELD_OP)
|
||||
if (WalkState->Opcode == AML_FIELD_OP ||
|
||||
WalkState->Opcode == AML_BANK_FIELD_OP ||
|
||||
WalkState->Opcode == AML_INDEX_FIELD_OP)
|
||||
{
|
||||
Node = NULL;
|
||||
Status = AE_OK;
|
||||
}
|
||||
|
||||
else if (Opcode == AML_INT_NAMEPATH_OP)
|
||||
else if (WalkState->Opcode == AML_INT_NAMEPATH_OP)
|
||||
{
|
||||
/*
|
||||
* The NamePath is an object reference to an existing object. Don't enter the
|
||||
* name into the namespace, but look it up for use later
|
||||
*/
|
||||
Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr,
|
||||
DataType, IMODE_EXECUTE,
|
||||
NS_SEARCH_PARENT, WalkState,
|
||||
&(Node));
|
||||
Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, DataType,
|
||||
IMODE_EXECUTE, NS_SEARCH_PARENT, WalkState, &(Node));
|
||||
}
|
||||
|
||||
else
|
||||
@ -421,9 +419,7 @@ AcpiDsLoad2BeginOp (
|
||||
|
||||
if (AcpiNsOpensScope (DataType))
|
||||
{
|
||||
Status = AcpiDsScopeStackPush (Node,
|
||||
DataType,
|
||||
WalkState);
|
||||
Status = AcpiDsScopeStackPush (Node, DataType, WalkState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
@ -438,7 +434,7 @@ AcpiDsLoad2BeginOp (
|
||||
* as we go downward in the parse tree. Any necessary subobjects that involve
|
||||
* arguments to the opcode must be created as we go back up the parse tree later.
|
||||
*/
|
||||
Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, DataType,
|
||||
Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, DataType,
|
||||
IMODE_EXECUTE, NS_NO_UPSEARCH, WalkState, &(Node));
|
||||
}
|
||||
|
||||
@ -448,7 +444,7 @@ AcpiDsLoad2BeginOp (
|
||||
{
|
||||
/* Create a new op */
|
||||
|
||||
Op = AcpiPsAllocOp (Opcode);
|
||||
Op = AcpiPsAllocOp (WalkState->Opcode);
|
||||
if (!Op)
|
||||
{
|
||||
return (AE_NO_MEMORY);
|
||||
@ -460,7 +456,6 @@ AcpiDsLoad2BeginOp (
|
||||
*OutOp = Op;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Put the Node in the "op" object that the parser uses, so we
|
||||
* can get it again quickly when this scope is closed
|
||||
@ -469,12 +464,12 @@ AcpiDsLoad2BeginOp (
|
||||
|
||||
if (Original)
|
||||
{
|
||||
DEBUG_PRINTP (ACPI_INFO, ("old %p new %p\n", Original, Node));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "old %p new %p\n", Original, Node));
|
||||
|
||||
if (Original != Node)
|
||||
{
|
||||
DEBUG_PRINTP (ACPI_INFO,
|
||||
("Lookup match error: old %p new %p\n", Original, Node));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
||||
"Lookup match error: old %p new %p\n", Original, Node));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -500,32 +495,37 @@ AcpiDsLoad2BeginOp (
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiDsLoad2EndOp (
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
ACPI_PARSE_OBJECT *Op)
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
ACPI_PARSE_OBJECT *Op;
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
ACPI_OBJECT_TYPE8 DataType;
|
||||
ACPI_OBJECT_TYPE8 DataType;
|
||||
ACPI_NAMESPACE_NODE *Node;
|
||||
ACPI_PARSE_OBJECT *Arg;
|
||||
ACPI_NAMESPACE_NODE *NewNode;
|
||||
|
||||
|
||||
PROC_NAME ("DsLoad2EndOp");
|
||||
DEBUG_PRINTP (TRACE_DISPATCH, ("Op=%p State=%p\n", Op, WalkState));
|
||||
|
||||
if (!AcpiPsIsNamespaceObjectOp (Op->Opcode))
|
||||
Op = WalkState->Op;
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
|
||||
|
||||
|
||||
/* Only interested in opcodes that have namespace objects */
|
||||
|
||||
if (!(WalkState->OpInfo->Flags & AML_NSOBJECT))
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
if (Op->Opcode == AML_SCOPE_OP)
|
||||
{
|
||||
DEBUG_PRINTP (TRACE_DISPATCH,
|
||||
("Ending scope Op=%p State=%p\n", Op, WalkState));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
||||
"Ending scope Op=%p State=%p\n", Op, WalkState));
|
||||
|
||||
if (((ACPI_PARSE2_OBJECT *)Op)->Name == -1)
|
||||
{
|
||||
DEBUG_PRINTP (ACPI_ERROR, ("Unnamed scope! Op=%p State=%p\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unnamed scope! Op=%p State=%p\n",
|
||||
Op, WalkState));
|
||||
return (AE_OK);
|
||||
}
|
||||
@ -544,7 +544,6 @@ AcpiDsLoad2EndOp (
|
||||
* Put the Node on the object stack (Contains the ACPI Name of
|
||||
* this object)
|
||||
*/
|
||||
|
||||
WalkState->Operands[0] = (void *) Node;
|
||||
WalkState->NumOperands = 1;
|
||||
|
||||
@ -553,12 +552,11 @@ AcpiDsLoad2EndOp (
|
||||
if (AcpiNsOpensScope (DataType))
|
||||
{
|
||||
|
||||
DEBUG_PRINTP (TRACE_DISPATCH, ("(%s) Popping scope for Op %p\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n",
|
||||
AcpiUtGetTypeName (DataType), Op));
|
||||
AcpiDsScopeStackPop (WalkState);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Named operations are as follows:
|
||||
*
|
||||
@ -605,9 +603,8 @@ AcpiDsLoad2EndOp (
|
||||
* Create the field object, but the field buffer and index must
|
||||
* be evaluated later during the execution phase
|
||||
*/
|
||||
|
||||
DEBUG_PRINTP (TRACE_DISPATCH,
|
||||
("CreateXxxField: State=%p Op=%p NamedObj=%p\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
||||
"CreateXxxField: State=%p Op=%p NamedObj=%p\n",
|
||||
WalkState, Op, Node));
|
||||
|
||||
/* Get the NameString argument */
|
||||
@ -667,22 +664,19 @@ AcpiDsLoad2EndOp (
|
||||
|
||||
case AML_INT_METHODCALL_OP:
|
||||
|
||||
DEBUG_PRINTP (TRACE_DISPATCH,
|
||||
("RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
||||
"RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n",
|
||||
WalkState, Op, Node));
|
||||
|
||||
/*
|
||||
* 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, &(NewNode));
|
||||
|
||||
if (ACPI_SUCCESS (Status))
|
||||
{
|
||||
|
||||
/* TBD: has name already been resolved by here ??*/
|
||||
|
||||
/* TBD: [Restructure] Make sure that what we found is indeed a method! */
|
||||
@ -703,8 +697,8 @@ AcpiDsLoad2EndOp (
|
||||
|
||||
/* Nothing to do other than enter object into namespace */
|
||||
|
||||
DEBUG_PRINTP (TRACE_DISPATCH,
|
||||
("LOADING-Processor: State=%p Op=%p NamedObj=%p\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
||||
"LOADING-Processor: State=%p Op=%p NamedObj=%p\n",
|
||||
WalkState, Op, Node));
|
||||
|
||||
Status = AcpiExCreateProcessor (Op, Node);
|
||||
@ -713,8 +707,8 @@ AcpiDsLoad2EndOp (
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
DEBUG_PRINT (TRACE_DISPATCH,
|
||||
("Completed Processor Init, Op=%p State=%p entry=%p\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
||||
"Completed Processor Init, Op=%p State=%p entry=%p\n",
|
||||
Op, WalkState, Node));
|
||||
break;
|
||||
|
||||
@ -723,8 +717,8 @@ AcpiDsLoad2EndOp (
|
||||
|
||||
/* Nothing to do other than enter object into namespace */
|
||||
|
||||
DEBUG_PRINTP (TRACE_DISPATCH,
|
||||
("LOADING-PowerResource: State=%p Op=%p NamedObj=%p\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
||||
"LOADING-PowerResource: State=%p Op=%p NamedObj=%p\n",
|
||||
WalkState, Op, Node));
|
||||
|
||||
Status = AcpiExCreatePowerResource (Op, Node);
|
||||
@ -733,8 +727,8 @@ AcpiDsLoad2EndOp (
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
DEBUG_PRINT (TRACE_DISPATCH,
|
||||
("Completed PowerResource Init, Op=%p State=%p entry=%p\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
||||
"Completed PowerResource Init, Op=%p State=%p entry=%p\n",
|
||||
Op, WalkState, Node));
|
||||
break;
|
||||
|
||||
@ -743,16 +737,16 @@ AcpiDsLoad2EndOp (
|
||||
|
||||
/* Nothing to do other than enter object into namespace */
|
||||
|
||||
DEBUG_PRINTP (TRACE_DISPATCH,
|
||||
("LOADING-ThermalZone: State=%p Op=%p NamedObj=%p\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
||||
"LOADING-ThermalZone: State=%p Op=%p NamedObj=%p\n",
|
||||
WalkState, Op, Node));
|
||||
break;
|
||||
|
||||
|
||||
case AML_FIELD_OP:
|
||||
|
||||
DEBUG_PRINTP (TRACE_DISPATCH,
|
||||
("LOADING-Field: State=%p Op=%p NamedObj=%p\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
||||
"LOADING-Field: State=%p Op=%p NamedObj=%p\n",
|
||||
WalkState, Op, Node));
|
||||
|
||||
Arg = Op->Value.Arg;
|
||||
@ -763,8 +757,8 @@ AcpiDsLoad2EndOp (
|
||||
|
||||
case AML_INDEX_FIELD_OP:
|
||||
|
||||
DEBUG_PRINTP (TRACE_DISPATCH,
|
||||
("LOADING-IndexField: State=%p Op=%p NamedObj=%p\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
||||
"LOADING-IndexField: State=%p Op=%p NamedObj=%p\n",
|
||||
WalkState, Op, Node));
|
||||
|
||||
Arg = Op->Value.Arg;
|
||||
@ -776,8 +770,8 @@ AcpiDsLoad2EndOp (
|
||||
|
||||
case AML_BANK_FIELD_OP:
|
||||
|
||||
DEBUG_PRINTP (TRACE_DISPATCH,
|
||||
("LOADING-BankField: State=%p Op=%p NamedObj=%p\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
||||
"LOADING-BankField: State=%p Op=%p NamedObj=%p\n",
|
||||
WalkState, Op, Node));
|
||||
|
||||
Arg = Op->Value.Arg;
|
||||
@ -790,8 +784,8 @@ AcpiDsLoad2EndOp (
|
||||
*/
|
||||
case AML_METHOD_OP:
|
||||
|
||||
DEBUG_PRINTP (TRACE_DISPATCH,
|
||||
("LOADING-Method: State=%p Op=%p NamedObj=%p\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
||||
"LOADING-Method: State=%p Op=%p NamedObj=%p\n",
|
||||
WalkState, Op, Node));
|
||||
|
||||
if (!Node->Object)
|
||||
@ -805,8 +799,8 @@ AcpiDsLoad2EndOp (
|
||||
|
||||
case AML_MUTEX_OP:
|
||||
|
||||
DEBUG_PRINTP (TRACE_DISPATCH,
|
||||
("LOADING-Mutex: Op=%p State=%p\n", Op, WalkState));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
||||
"LOADING-Mutex: Op=%p State=%p\n", Op, WalkState));
|
||||
|
||||
Status = AcpiDsCreateOperands (WalkState, Arg);
|
||||
if (ACPI_FAILURE (Status))
|
||||
@ -820,8 +814,8 @@ AcpiDsLoad2EndOp (
|
||||
|
||||
case AML_EVENT_OP:
|
||||
|
||||
DEBUG_PRINTP (TRACE_DISPATCH,
|
||||
("LOADING-Event: Op=%p State=%p\n", Op, WalkState));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
||||
"LOADING-Event: Op=%p State=%p\n", Op, WalkState));
|
||||
|
||||
Status = AcpiDsCreateOperands (WalkState, Arg);
|
||||
if (ACPI_FAILURE (Status))
|
||||
@ -840,8 +834,8 @@ AcpiDsLoad2EndOp (
|
||||
break;
|
||||
}
|
||||
|
||||
DEBUG_PRINTP (TRACE_DISPATCH,
|
||||
("LOADING-Opregion: Op=%p State=%p NamedObj=%p\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
||||
"LOADING-Opregion: Op=%p State=%p NamedObj=%p\n",
|
||||
Op, WalkState, Node));
|
||||
|
||||
/*
|
||||
@ -852,8 +846,8 @@ AcpiDsLoad2EndOp (
|
||||
((ACPI_PARSE2_OBJECT *) Op)->Length,
|
||||
(ACPI_ADR_SPACE_TYPE) Arg->Value.Integer, WalkState);
|
||||
|
||||
DEBUG_PRINT (TRACE_DISPATCH,
|
||||
("Completed OpRegion Init, Op=%p State=%p entry=%p\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
||||
"Completed OpRegion Init, Op=%p State=%p entry=%p\n",
|
||||
Op, WalkState, Node));
|
||||
break;
|
||||
|
||||
@ -862,8 +856,8 @@ AcpiDsLoad2EndOp (
|
||||
|
||||
case AML_ALIAS_OP:
|
||||
|
||||
DEBUG_PRINTP (TRACE_DISPATCH,
|
||||
("LOADING-Alias: Op=%p State=%p\n", Op, WalkState));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
||||
"LOADING-Alias: Op=%p State=%p\n", Op, WalkState));
|
||||
|
||||
Status = AcpiDsCreateOperands (WalkState, Arg);
|
||||
if (ACPI_FAILURE (Status))
|
||||
@ -877,15 +871,14 @@ AcpiDsLoad2EndOp (
|
||||
|
||||
case AML_NAME_OP:
|
||||
|
||||
DEBUG_PRINTP (TRACE_DISPATCH,
|
||||
("LOADING-Name: Op=%p State=%p\n", Op, WalkState));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
||||
"LOADING-Name: Op=%p State=%p\n", Op, WalkState));
|
||||
|
||||
/*
|
||||
* 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);
|
||||
@ -896,8 +889,8 @@ AcpiDsLoad2EndOp (
|
||||
|
||||
case AML_INT_NAMEPATH_OP:
|
||||
|
||||
DEBUG_PRINTP (TRACE_DISPATCH,
|
||||
("LOADING-NamePath object: State=%p Op=%p NamedObj=%p\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
||||
"LOADING-NamePath object: State=%p Op=%p NamedObj=%p\n",
|
||||
WalkState, Op, Node));
|
||||
break;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: dswscope - Scope stack manipulation
|
||||
* $Revision: 1.39 $
|
||||
* $Revision: 1.49 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -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, 2001, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
@ -121,7 +121,7 @@
|
||||
#include "acdispat.h"
|
||||
|
||||
|
||||
#define _COMPONENT NAMESPACE
|
||||
#define _COMPONENT ACPI_DISPATCHER
|
||||
MODULE_NAME ("dswscope")
|
||||
|
||||
|
||||
@ -145,6 +145,8 @@ AcpiDsScopeStackClear (
|
||||
{
|
||||
ACPI_GENERIC_STATE *ScopeInfo;
|
||||
|
||||
PROC_NAME ("DsScopeStackClear");
|
||||
|
||||
|
||||
while (WalkState->ScopeInfo)
|
||||
{
|
||||
@ -153,9 +155,9 @@ AcpiDsScopeStackClear (
|
||||
ScopeInfo = WalkState->ScopeInfo;
|
||||
WalkState->ScopeInfo = ScopeInfo->Scope.Next;
|
||||
|
||||
DEBUG_PRINT (TRACE_EXEC,
|
||||
("Popped object type 0x%X\n", ScopeInfo->Common.Value));
|
||||
AcpiCmDeleteGenericState (ScopeInfo);
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
||||
"Popped object type %X\n", ScopeInfo->Common.Value));
|
||||
AcpiUtDeleteGenericState (ScopeInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,7 +177,7 @@ AcpiDsScopeStackClear (
|
||||
ACPI_STATUS
|
||||
AcpiDsScopeStackPush (
|
||||
ACPI_NAMESPACE_NODE *Node,
|
||||
OBJECT_TYPE_INTERNAL Type,
|
||||
ACPI_OBJECT_TYPE8 Type,
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
ACPI_GENERIC_STATE *ScopeInfo;
|
||||
@ -186,7 +188,7 @@ AcpiDsScopeStackPush (
|
||||
|
||||
if (!Node)
|
||||
{
|
||||
/* invalid scope */
|
||||
/* Invalid scope */
|
||||
|
||||
REPORT_ERROR (("DsScopeStackPush: null scope passed\n"));
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
@ -194,7 +196,7 @@ AcpiDsScopeStackPush (
|
||||
|
||||
/* Make sure object type is valid */
|
||||
|
||||
if (!AcpiAmlValidateObjectType (Type))
|
||||
if (!AcpiExValidateObjectType (Type))
|
||||
{
|
||||
REPORT_WARNING (("DsScopeStackPush: type code out of range\n"));
|
||||
}
|
||||
@ -202,7 +204,7 @@ AcpiDsScopeStackPush (
|
||||
|
||||
/* Allocate a new scope object */
|
||||
|
||||
ScopeInfo = AcpiCmCreateGenericState ();
|
||||
ScopeInfo = AcpiUtCreateGenericState ();
|
||||
if (!ScopeInfo)
|
||||
{
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
@ -210,12 +212,13 @@ AcpiDsScopeStackPush (
|
||||
|
||||
/* Init new scope object */
|
||||
|
||||
ScopeInfo->Scope.Node = Node;
|
||||
ScopeInfo->Common.Value = (UINT16) Type;
|
||||
ScopeInfo->Common.DataType = ACPI_DESC_TYPE_STATE_WSCOPE;
|
||||
ScopeInfo->Scope.Node = Node;
|
||||
ScopeInfo->Common.Value = (UINT16) Type;
|
||||
|
||||
/* Push new scope object onto stack */
|
||||
|
||||
AcpiCmPushGenericState (&WalkState->ScopeInfo, ScopeInfo);
|
||||
AcpiUtPushGenericState (&WalkState->ScopeInfo, ScopeInfo);
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
@ -247,20 +250,20 @@ AcpiDsScopeStackPop (
|
||||
|
||||
FUNCTION_TRACE ("DsScopeStackPop");
|
||||
|
||||
|
||||
/*
|
||||
* Pop scope info object off the stack.
|
||||
*/
|
||||
|
||||
ScopeInfo = AcpiCmPopGenericState (&WalkState->ScopeInfo);
|
||||
ScopeInfo = AcpiUtPopGenericState (&WalkState->ScopeInfo);
|
||||
if (!ScopeInfo)
|
||||
{
|
||||
return_ACPI_STATUS (AE_STACK_UNDERFLOW);
|
||||
}
|
||||
|
||||
DEBUG_PRINT (TRACE_EXEC,
|
||||
("Popped object type 0x%X\n", ScopeInfo->Common.Value));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
||||
"Popped object type %X\n", ScopeInfo->Common.Value));
|
||||
|
||||
AcpiCmDeleteGenericState (ScopeInfo);
|
||||
AcpiUtDeleteGenericState (ScopeInfo);
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: dswstate - Dispatcher parse tree walk management routines
|
||||
* $Revision: 1.52 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -8,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, 2001, Intel Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
@ -123,30 +124,328 @@
|
||||
#include "acnamesp.h"
|
||||
#include "acinterp.h"
|
||||
|
||||
#define _COMPONENT DISPATCHER
|
||||
MODULE_NAME ("dswstate");
|
||||
#define _COMPONENT ACPI_DISPATCHER
|
||||
MODULE_NAME ("dswstate")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDsResultStackClear
|
||||
* FUNCTION: AcpiDsResultInsert
|
||||
*
|
||||
* PARAMETERS: WalkState - Current Walk state
|
||||
* PARAMETERS: Object - Object to push
|
||||
* WalkState - Current Walk state
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Reset this walk's result stack pointers to zero, thus setting
|
||||
* the stack to zero.
|
||||
* DESCRIPTION: Push an object onto this walk's result stack
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiDsResultStackClear (
|
||||
AcpiDsResultInsert (
|
||||
void *Object,
|
||||
UINT32 Index,
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
ACPI_GENERIC_STATE *State;
|
||||
|
||||
WalkState->NumResults = 0;
|
||||
WalkState->CurrentResult = 0;
|
||||
|
||||
PROC_NAME ("DsResultInsert");
|
||||
|
||||
|
||||
State = WalkState->Results;
|
||||
if (!State)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n",
|
||||
WalkState));
|
||||
return (AE_NOT_EXIST);
|
||||
}
|
||||
|
||||
if (Index >= OBJ_NUM_OPERANDS)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Index out of range: %X Obj=%p State=%p Num=%X\n",
|
||||
Index, Object, WalkState, State->Results.NumResults));
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
if (!Object)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"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++;
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
||||
"Obj=%p [%s] State=%p Num=%X Cur=%X\n",
|
||||
Object, Object ? AcpiUtGetTypeName (((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;
|
||||
|
||||
|
||||
PROC_NAME ("DsResultRemove");
|
||||
|
||||
|
||||
State = WalkState->Results;
|
||||
if (!State)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n",
|
||||
WalkState));
|
||||
return (AE_NOT_EXIST);
|
||||
}
|
||||
|
||||
if (Index >= OBJ_NUM_OPERANDS)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"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])
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Null operand! State=%p #Ops=%X, Index=%X\n",
|
||||
WalkState, State->Results.NumResults, Index));
|
||||
return (AE_AML_NO_RETURN_VALUE);
|
||||
}
|
||||
|
||||
/* Remove the object */
|
||||
|
||||
State->Results.NumResults--;
|
||||
|
||||
*Object = State->Results.ObjDesc [Index];
|
||||
State->Results.ObjDesc [Index] = NULL;
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
||||
"Obj=%p [%s] Index=%X State=%p Num=%X\n",
|
||||
*Object, (*Object) ? AcpiUtGetTypeName ((*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;
|
||||
|
||||
|
||||
PROC_NAME ("DsResultPop");
|
||||
|
||||
|
||||
State = WalkState->Results;
|
||||
if (!State)
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
if (!State->Results.NumResults)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Result stack is empty! State=%p\n",
|
||||
WalkState));
|
||||
return (AE_AML_NO_RETURN_VALUE);
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Index=%X State=%p Num=%X\n",
|
||||
*Object, (*Object) ? AcpiUtGetTypeName ((*Object)->Common.Type) : "NULL",
|
||||
Index -1, WalkState, State->Results.NumResults));
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", WalkState));
|
||||
return (AE_AML_NO_RETURN_VALUE);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDsResultPopFromBottom
|
||||
*
|
||||
* 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;
|
||||
|
||||
|
||||
PROC_NAME ("DsResultPopFromBottom");
|
||||
|
||||
|
||||
State = WalkState->Results;
|
||||
if (!State)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Warning: No result object pushed! State=%p\n", WalkState));
|
||||
return (AE_NOT_EXIST);
|
||||
}
|
||||
|
||||
|
||||
if (!State->Results.NumResults)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", WalkState));
|
||||
return (AE_AML_NO_RETURN_VALUE);
|
||||
}
|
||||
|
||||
/* 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)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null operand! State=%p #Ops=%X, Index=%X\n",
|
||||
WalkState, State->Results.NumResults, Index));
|
||||
return (AE_AML_NO_RETURN_VALUE);
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s], Results=%p State=%p\n",
|
||||
*Object, (*Object) ? AcpiUtGetTypeName ((*Object)->Common.Type) : "NULL",
|
||||
State, WalkState));
|
||||
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDsResultPush
|
||||
*
|
||||
* PARAMETERS: Object - Where to return the popped object
|
||||
* WalkState - Current Walk state
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Push an object onto the current result stack
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiDsResultPush (
|
||||
ACPI_OPERAND_OBJECT *Object,
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
ACPI_GENERIC_STATE *State;
|
||||
|
||||
|
||||
PROC_NAME ("DsResultPush");
|
||||
|
||||
|
||||
State = WalkState->Results;
|
||||
if (!State)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result stack frame\n"));
|
||||
return (AE_AML_INTERNAL);
|
||||
}
|
||||
|
||||
if (State->Results.NumResults == OBJ_NUM_OPERANDS)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Result stack overflow: Obj=%p State=%p Num=%X\n",
|
||||
Object, WalkState, State->Results.NumResults));
|
||||
return (AE_STACK_OVERFLOW);
|
||||
}
|
||||
|
||||
if (!Object)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "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++;
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n",
|
||||
Object, Object ? AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *) Object)->Common.Type) : "NULL",
|
||||
WalkState, State->Results.NumResults, WalkState->CurrentResult));
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
@ -161,31 +460,30 @@ 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;
|
||||
|
||||
PROC_NAME ("DsResultStackPush");
|
||||
|
||||
|
||||
if (WalkState->NumResults >= OBJ_NUM_OPERANDS)
|
||||
State = AcpiUtCreateGenericState ();
|
||||
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++;
|
||||
State->Common.DataType = ACPI_DESC_TYPE_STATE_RESULT;
|
||||
AcpiUtPushGenericState (&WalkState->Results, State);
|
||||
|
||||
DEBUG_PRINT (TRACE_EXEC,
|
||||
("DsResultStackPush: Obj=%p State=%p Num=%X Cur=%X\n",
|
||||
Object, WalkState, WalkState->NumResults, WalkState->CurrentResult));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Results=%p State=%p\n",
|
||||
State, WalkState));
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
@ -195,54 +493,40 @@ 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;
|
||||
|
||||
PROC_NAME ("DsResultStackPop");
|
||||
|
||||
|
||||
/* 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));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Underflow - State=%p\n",
|
||||
WalkState));
|
||||
return (AE_AML_NO_OPERAND);
|
||||
}
|
||||
|
||||
|
||||
/* Pop the stack */
|
||||
State = AcpiUtPopGenericState (&WalkState->Results);
|
||||
|
||||
WalkState->NumResults--;
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
||||
"Result=%p RemainingResults=%X State=%p\n",
|
||||
State, State->Results.NumResults, WalkState));
|
||||
|
||||
/* 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;
|
||||
|
||||
DEBUG_PRINT (TRACE_EXEC,
|
||||
("DsResultStackPop: Obj=%p State=%p Num=%X Cur=%X\n",
|
||||
*Object, WalkState, WalkState->NumResults, WalkState->CurrentResult));
|
||||
AcpiUtDeleteGenericState (State);
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
@ -277,7 +561,7 @@ AcpiDsObjStackDeleteAll (
|
||||
{
|
||||
if (WalkState->Operands[i])
|
||||
{
|
||||
AcpiCmRemoveReference (WalkState->Operands[i]);
|
||||
AcpiUtRemoveReference (WalkState->Operands[i]);
|
||||
WalkState->Operands[i] = NULL;
|
||||
}
|
||||
}
|
||||
@ -304,14 +588,15 @@ AcpiDsObjStackPush (
|
||||
void *Object,
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
PROC_NAME ("DsObjStackPush");
|
||||
|
||||
|
||||
/* Check for stack overflow */
|
||||
|
||||
if (WalkState->NumOperands >= OBJ_NUM_OPERANDS)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("DsObjStackPush: overflow! Obj=%p State=%p #Ops=%X\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"overflow! Obj=%p State=%p #Ops=%X\n",
|
||||
Object, WalkState, WalkState->NumOperands));
|
||||
return (AE_STACK_OVERFLOW);
|
||||
}
|
||||
@ -321,13 +606,15 @@ AcpiDsObjStackPush (
|
||||
WalkState->Operands [WalkState->NumOperands] = Object;
|
||||
WalkState->NumOperands++;
|
||||
|
||||
DEBUG_PRINT (TRACE_EXEC, ("DsObjStackPush: Obj=%p State=%p #Ops=%X\n",
|
||||
Object, WalkState, WalkState->NumOperands));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
|
||||
Object, AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *) Object)->Common.Type),
|
||||
WalkState, WalkState->NumOperands));
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDsObjStackPopObject
|
||||
@ -344,22 +631,23 @@ AcpiDsObjStackPush (
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiDsObjStackPopObject (
|
||||
ACPI_OBJECT_INTERNAL **Object,
|
||||
ACPI_OPERAND_OBJECT **Object,
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
PROC_NAME ("DsObjStackPopObject");
|
||||
|
||||
|
||||
/* Check for stack underflow */
|
||||
|
||||
if (WalkState->NumOperands == 0)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("DsObjStackPop: Missing operand/stack empty! State=%p #Ops=%X\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Missing operand/stack empty! State=%p #Ops=%X\n",
|
||||
WalkState, WalkState->NumOperands));
|
||||
*Object = NULL;
|
||||
return (AE_AML_NO_OPERAND);
|
||||
}
|
||||
|
||||
|
||||
/* Pop the stack */
|
||||
|
||||
WalkState->NumOperands--;
|
||||
@ -368,9 +656,10 @@ AcpiDsObjStackPopObject (
|
||||
|
||||
if (!WalkState->Operands [WalkState->NumOperands])
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("DsObjStackPop: Null operand! State=%p #Ops=%X\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Null operand! State=%p #Ops=%X\n",
|
||||
WalkState, WalkState->NumOperands));
|
||||
*Object = NULL;
|
||||
return (AE_AML_NO_OPERAND);
|
||||
}
|
||||
|
||||
@ -379,12 +668,13 @@ AcpiDsObjStackPopObject (
|
||||
*Object = WalkState->Operands [WalkState->NumOperands];
|
||||
WalkState->Operands [WalkState->NumOperands] = NULL;
|
||||
|
||||
DEBUG_PRINT (TRACE_EXEC, ("DsObjStackPopObject: State=%p #Ops=%X\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
|
||||
*Object, AcpiUtGetTypeName ((*Object)->Common.Type),
|
||||
WalkState, WalkState->NumOperands));
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
@ -407,6 +697,8 @@ AcpiDsObjStackPop (
|
||||
{
|
||||
UINT32 i;
|
||||
|
||||
PROC_NAME ("DsObjStackPop");
|
||||
|
||||
|
||||
for (i = 0; i < PopCount; i++)
|
||||
{
|
||||
@ -414,8 +706,8 @@ AcpiDsObjStackPop (
|
||||
|
||||
if (WalkState->NumOperands == 0)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("DsObjStackPop: Underflow! Count=%X State=%p #Ops=%X\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Underflow! Count=%X State=%p #Ops=%X\n",
|
||||
PopCount, WalkState, WalkState->NumOperands));
|
||||
return (AE_STACK_UNDERFLOW);
|
||||
}
|
||||
@ -426,7 +718,7 @@ AcpiDsObjStackPop (
|
||||
WalkState->Operands [WalkState->NumOperands] = NULL;
|
||||
}
|
||||
|
||||
DEBUG_PRINT (TRACE_EXEC, ("DsObjStackPop: Count=%X State=%p #Ops=%X\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n",
|
||||
PopCount, WalkState, WalkState->NumOperands));
|
||||
|
||||
return (AE_OK);
|
||||
@ -453,7 +745,9 @@ AcpiDsObjStackPopAndDelete (
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
UINT32 i;
|
||||
ACPI_OBJECT_INTERNAL *ObjDesc;
|
||||
ACPI_OPERAND_OBJECT *ObjDesc;
|
||||
|
||||
PROC_NAME ("DsObjStackPopAndDelete");
|
||||
|
||||
|
||||
for (i = 0; i < PopCount; i++)
|
||||
@ -462,8 +756,8 @@ AcpiDsObjStackPopAndDelete (
|
||||
|
||||
if (WalkState->NumOperands == 0)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("DsObjStackPop: Underflow! Count=%X State=%p #Ops=%X\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Underflow! Count=%X State=%p #Ops=%X\n",
|
||||
PopCount, WalkState, WalkState->NumOperands));
|
||||
return (AE_STACK_UNDERFLOW);
|
||||
}
|
||||
@ -474,12 +768,12 @@ AcpiDsObjStackPopAndDelete (
|
||||
ObjDesc = WalkState->Operands [WalkState->NumOperands];
|
||||
if (ObjDesc)
|
||||
{
|
||||
AcpiCmRemoveReference (WalkState->Operands [WalkState->NumOperands]);
|
||||
AcpiUtRemoveReference (WalkState->Operands [WalkState->NumOperands]);
|
||||
WalkState->Operands [WalkState->NumOperands] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_PRINT (TRACE_EXEC, ("DsObjStackPop: Count=%X State=%p #Ops=%X\n",
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n",
|
||||
PopCount, WalkState, WalkState->NumOperands));
|
||||
|
||||
return (AE_OK);
|
||||
@ -514,14 +808,14 @@ AcpiDsObjStackGetValue (
|
||||
|
||||
if (WalkState->NumOperands == 0)
|
||||
{
|
||||
return_VALUE (NULL);
|
||||
return_PTR (NULL);
|
||||
}
|
||||
|
||||
/* or if the index is past the top of the stack */
|
||||
|
||||
if (Index > (WalkState->NumOperands - (UINT32) 1))
|
||||
{
|
||||
return_VALUE (NULL);
|
||||
return_PTR (NULL);
|
||||
}
|
||||
|
||||
|
||||
@ -548,8 +842,11 @@ AcpiDsGetCurrentWalkState (
|
||||
ACPI_WALK_LIST *WalkList)
|
||||
|
||||
{
|
||||
PROC_NAME ("DsGetCurrentWalkState");
|
||||
|
||||
DEBUG_PRINT (TRACE_PARSE, ("DsGetCurrentWalkState, =%p\n", WalkList->WalkState));
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "DsGetCurrentWalkState, =%p\n",
|
||||
WalkList->WalkState));
|
||||
|
||||
if (!WalkList)
|
||||
{
|
||||
@ -578,8 +875,6 @@ AcpiDsPushWalkState (
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
ACPI_WALK_LIST *WalkList)
|
||||
{
|
||||
|
||||
|
||||
FUNCTION_TRACE ("DsPushWalkState");
|
||||
|
||||
|
||||
@ -650,68 +945,165 @@ 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;
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("DsCreateWalkState");
|
||||
|
||||
|
||||
AcpiCmAcquireMutex (ACPI_MTX_CACHES);
|
||||
AcpiGbl_WalkStateCacheRequests++;
|
||||
|
||||
/* Check the cache first */
|
||||
|
||||
if (AcpiGbl_WalkStateCache)
|
||||
WalkState = AcpiUtAcquireFromCache (ACPI_MEM_LIST_WALK);
|
||||
if (!WalkState)
|
||||
{
|
||||
/* There is an object available, use it */
|
||||
|
||||
WalkState = AcpiGbl_WalkStateCache;
|
||||
AcpiGbl_WalkStateCache = WalkState->Next;
|
||||
|
||||
AcpiGbl_WalkStateCacheHits++;
|
||||
AcpiGbl_WalkStateCacheDepth--;
|
||||
|
||||
DEBUG_PRINT (TRACE_EXEC, ("DsCreateWalkState: State %p from cache\n", WalkState));
|
||||
|
||||
AcpiCmReleaseMutex (ACPI_MTX_CACHES);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/* The cache is empty, create a new object */
|
||||
|
||||
/* Avoid deadlock with AcpiCmCallocate */
|
||||
|
||||
AcpiCmReleaseMutex (ACPI_MTX_CACHES);
|
||||
|
||||
WalkState = AcpiCmCallocate (sizeof (ACPI_WALK_STATE));
|
||||
if (!WalkState)
|
||||
{
|
||||
return_VALUE (NULL);
|
||||
}
|
||||
return_PTR (NULL);
|
||||
}
|
||||
|
||||
WalkState->DataType = ACPI_DESC_TYPE_WALK;
|
||||
WalkState->OwnerId = OwnerId;
|
||||
WalkState->Origin = Origin;
|
||||
WalkState->MethodDesc = MthDesc;
|
||||
WalkState->WalkList = WalkList;
|
||||
|
||||
/* Init the method args/local */
|
||||
|
||||
#ifndef _ACPI_ASL_COMPILER
|
||||
AcpiDsMethodDataInit (WalkState);
|
||||
#endif
|
||||
|
||||
/* Create an initial result stack entry */
|
||||
|
||||
Status = AcpiDsResultStackPush (WalkState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_PTR (NULL);
|
||||
}
|
||||
|
||||
/* Put the new state at the head of the walk list */
|
||||
|
||||
AcpiDsPushWalkState (WalkState, WalkList);
|
||||
if (WalkList)
|
||||
{
|
||||
AcpiDsPushWalkState (WalkState, WalkList);
|
||||
}
|
||||
|
||||
return_PTR (WalkState);
|
||||
}
|
||||
|
||||
|
||||
#ifndef _ACPI_ASL_COMPILER
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDsInitAmlWalk
|
||||
*
|
||||
* PARAMETERS: WalkState - New state to be initialized
|
||||
*
|
||||
* RETURN: None
|
||||
*
|
||||
* DESCRIPTION: Initialize a walk state for a pass 1 or 2 parse tree walk
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiDsInitAmlWalk (
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
ACPI_PARSE_OBJECT *Op,
|
||||
ACPI_NAMESPACE_NODE *MethodNode,
|
||||
UINT8 *AmlStart,
|
||||
UINT32 AmlLength,
|
||||
UINT32 PassNumber)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_PARSE_STATE *ParserState = &WalkState->ParserState;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("DsInitAmlWalk");
|
||||
|
||||
|
||||
WalkState->ParserState.Aml =
|
||||
WalkState->ParserState.AmlStart = AmlStart;
|
||||
WalkState->ParserState.AmlEnd =
|
||||
WalkState->ParserState.PkgEnd = AmlStart + AmlLength;
|
||||
|
||||
/* The NextOp of the NextWalk will be the beginning of the method */
|
||||
/* TBD: [Restructure] -- obsolete? */
|
||||
|
||||
WalkState->NextOp = NULL;
|
||||
|
||||
Status = AcpiPsInitScope (&WalkState->ParserState, Op);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
if (MethodNode)
|
||||
{
|
||||
WalkState->ParserState.StartNode = MethodNode;
|
||||
WalkState->WalkType = WALK_METHOD;
|
||||
WalkState->MethodNode = MethodNode;
|
||||
WalkState->MethodDesc = AcpiNsGetAttachedObject (MethodNode);
|
||||
|
||||
|
||||
/* Push start scope on scope stack and make it current */
|
||||
|
||||
Status = AcpiDsScopeStackPush (MethodNode, ACPI_TYPE_METHOD, WalkState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/* Setup the current scope */
|
||||
|
||||
ParserState->StartNode = ParserState->StartOp->Node;
|
||||
if (ParserState->StartNode)
|
||||
{
|
||||
/* Push start scope on scope stack and make it current */
|
||||
|
||||
Status = AcpiDsScopeStackPush (ParserState->StartNode,
|
||||
ParserState->StartNode->Type, WalkState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch (PassNumber)
|
||||
{
|
||||
case 1:
|
||||
WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE;
|
||||
WalkState->DescendingCallback = AcpiDsLoad1BeginOp;
|
||||
WalkState->AscendingCallback = AcpiDsLoad1EndOp;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE;
|
||||
WalkState->DescendingCallback = AcpiDsLoad2BeginOp;
|
||||
WalkState->AscendingCallback = AcpiDsLoad2EndOp;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
WalkState->ParseFlags |= ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE;
|
||||
WalkState->DescendingCallback = AcpiDsExecBeginOp;
|
||||
WalkState->AscendingCallback = AcpiDsExecEndOp;
|
||||
break;
|
||||
|
||||
default:
|
||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
||||
break;
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiDsDeleteWalkState
|
||||
@ -741,22 +1133,26 @@ AcpiDsDeleteWalkState (
|
||||
|
||||
if (WalkState->DataType != ACPI_DESC_TYPE_WALK)
|
||||
{
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("DsDeleteWalkState: **** %p not a valid walk state\n", WalkState));
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p is not a valid walk state\n", WalkState));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Always must free any linked control states */
|
||||
|
||||
if (WalkState->ParserState.Scope)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n", WalkState));
|
||||
}
|
||||
|
||||
/* Always must free any linked control states */
|
||||
|
||||
while (WalkState->ControlState)
|
||||
{
|
||||
State = WalkState->ControlState;
|
||||
WalkState->ControlState = State->Common.Next;
|
||||
|
||||
AcpiCmDeleteGenericState (State);
|
||||
AcpiUtDeleteGenericState (State);
|
||||
}
|
||||
|
||||
|
||||
/* Always must free any linked parse states */
|
||||
|
||||
while (WalkState->ScopeInfo)
|
||||
@ -764,37 +1160,20 @@ AcpiDsDeleteWalkState (
|
||||
State = WalkState->ScopeInfo;
|
||||
WalkState->ScopeInfo = State->Common.Next;
|
||||
|
||||
AcpiCmDeleteGenericState (State);
|
||||
AcpiUtDeleteGenericState (State);
|
||||
}
|
||||
|
||||
/* If walk cache is full, just free this wallkstate object */
|
||||
/* Always must free any stacked result states */
|
||||
|
||||
if (AcpiGbl_WalkStateCacheDepth >= MAX_WALK_CACHE_DEPTH)
|
||||
while (WalkState->Results)
|
||||
{
|
||||
AcpiCmFree (WalkState);
|
||||
}
|
||||
|
||||
/* Otherwise put this object back into the cache */
|
||||
|
||||
else
|
||||
{
|
||||
AcpiCmAcquireMutex (ACPI_MTX_CACHES);
|
||||
|
||||
/* Clear the state */
|
||||
|
||||
MEMSET (WalkState, 0, sizeof (ACPI_WALK_STATE));
|
||||
WalkState->DataType = ACPI_DESC_TYPE_WALK;
|
||||
|
||||
/* Put the object at the head of the global cache list */
|
||||
|
||||
WalkState->Next = AcpiGbl_WalkStateCache;
|
||||
AcpiGbl_WalkStateCache = WalkState;
|
||||
AcpiGbl_WalkStateCacheDepth++;
|
||||
|
||||
|
||||
AcpiCmReleaseMutex (ACPI_MTX_CACHES);
|
||||
State = WalkState->Results;
|
||||
WalkState->Results = State->Common.Next;
|
||||
|
||||
AcpiUtDeleteGenericState (State);
|
||||
}
|
||||
|
||||
AcpiUtReleaseToCache (ACPI_MEM_LIST_WALK, WalkState);
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
@ -816,24 +1195,10 @@ void
|
||||
AcpiDsDeleteWalkStateCache (
|
||||
void)
|
||||
{
|
||||
ACPI_WALK_STATE *Next;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("DsDeleteWalkStateCache");
|
||||
|
||||
|
||||
/* Traverse the global cache list */
|
||||
|
||||
while (AcpiGbl_WalkStateCache)
|
||||
{
|
||||
/* Delete one cached state object */
|
||||
|
||||
Next = AcpiGbl_WalkStateCache->Next;
|
||||
AcpiCmFree (AcpiGbl_WalkStateCache);
|
||||
AcpiGbl_WalkStateCache = Next;
|
||||
AcpiGbl_WalkStateCacheDepth--;
|
||||
}
|
||||
|
||||
AcpiUtDeleteGenericCache (ACPI_MEM_LIST_WALK);
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user