Reimplemented inefficient opcode type checking with flags in opcode

info table


date	2001.08.22.16.56.00;	author rmoore1;	state Exp;
This commit is contained in:
aystarik 2005-06-29 17:09:44 +00:00
parent dbe3ac70c7
commit 2af11ea087
2 changed files with 348 additions and 201 deletions

View File

@ -1,7 +1,7 @@
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dsutils - Dispatcher utilities * Module Name: dsutils - Dispatcher utilities
* $Revision: 1.68 $ * $Revision: 1.69 $
* *
******************************************************************************/ ******************************************************************************/
@ -362,6 +362,7 @@ AcpiDsCreateOperand (
UINT16 Opcode; UINT16 Opcode;
UINT32 Flags; UINT32 Flags;
OPERATING_MODE InterpreterMode; OPERATING_MODE InterpreterMode;
ACPI_OPCODE_INFO *OpInfo;
FUNCTION_TRACE_PTR ("DsCreateOperand", Arg); FUNCTION_TRACE_PTR ("DsCreateOperand", Arg);
@ -396,7 +397,8 @@ AcpiDsCreateOperand (
* namespace objects during the execution of control methods. * namespace objects during the execution of control methods.
*/ */
ParentOp = Arg->Parent; ParentOp = Arg->Parent;
if ((AcpiPsIsNodeOp (ParentOp->Opcode)) && OpInfo = AcpiPsGetOpcodeInfo (ParentOp->Opcode);
if ((OpInfo->Flags & AML_NSNODE) &&
(ParentOp->Opcode != AML_INT_METHODCALL_OP) && (ParentOp->Opcode != AML_INT_METHODCALL_OP) &&
(ParentOp->Opcode != AML_REGION_OP) && (ParentOp->Opcode != AML_REGION_OP) &&
(ParentOp->Opcode != AML_INT_NAMEPATH_OP)) (ParentOp->Opcode != AML_INT_NAMEPATH_OP))

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: dswload - Dispatcher namespace load callbacks * Module Name: dswload - Dispatcher namespace load callbacks
* $Revision: 1.41 $
* *
*****************************************************************************/ *****************************************************************************/
@ -9,8 +9,8 @@
* *
* 1. Copyright Notice * 1. Copyright Notice
* *
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* reserved. * All rights reserved.
* *
* 2. License * 2. License
* *
@ -117,20 +117,19 @@
#define __DSWLOAD_C__ #define __DSWLOAD_C__
#include "acpi.h" #include "acpi.h"
#include "parser.h" #include "acparser.h"
#include "amlcode.h" #include "amlcode.h"
#include "dispatch.h" #include "acdispat.h"
#include "interp.h" #include "acinterp.h"
#include "namesp.h" #include "acnamesp.h"
#include "events.h" #include "acevents.h"
#define _COMPONENT DISPATCHER #define _COMPONENT ACPI_DISPATCHER
MODULE_NAME ("dswload"); MODULE_NAME ("dswload")
/*******************************************************************************
/*****************************************************************************
* *
* FUNCTION: AcpiDsLoad1BeginOp * FUNCTION: AcpiDsLoad1BeginOp
* *
@ -142,79 +141,105 @@
* *
* DESCRIPTION: Descending callback used during the loading of ACPI tables. * DESCRIPTION: Descending callback used during the loading of ACPI tables.
* *
****************************************************************************/ ******************************************************************************/
ACPI_STATUS ACPI_STATUS
AcpiDsLoad1BeginOp ( AcpiDsLoad1BeginOp (
UINT16 Opcode,
ACPI_PARSE_OBJECT *Op,
ACPI_WALK_STATE *WalkState, ACPI_WALK_STATE *WalkState,
ACPI_GENERIC_OP *Op) ACPI_PARSE_OBJECT **OutOp)
{ {
NAME_TABLE_ENTRY *NewEntry; ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status; ACPI_STATUS Status;
OBJECT_TYPE_INTERNAL DataType; ACPI_OBJECT_TYPE8 DataType;
NATIVE_CHAR *Path;
ACPI_OPCODE_INFO *OpInfo;
DEBUG_PRINT (TRACE_DISPATCH, ("Load1BeginOp: Op=%p State=%p\n", Op, WalkState)); PROC_NAME ("DsLoad1BeginOp");
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
/* We are only interested in opcodes that have an associated name */ /* We are only interested in opcodes that have an associated name */
if (!AcpiPsIsNamedOp (Op->Opcode)) OpInfo = AcpiPsGetOpcodeInfo (Opcode);
if (!(OpInfo->Flags & AML_NAMED))
{ {
return AE_OK; *OutOp = Op;
return (AE_OK);
} }
/* Check if this object has already been installed in the namespace */ /* Check if this object has already been installed in the namespace */
if (Op->NameTableEntry) if (Op && Op->Node)
{ {
return AE_OK; *OutOp = Op;
return (AE_OK);
} }
Path = AcpiPsGetNextNamestring (WalkState->ParserState);
/* Map the raw opcode into an internal object type */ /* Map the raw opcode into an internal object type */
DataType = AcpiDsMapNamedOpcodeToDataType (Op->Opcode); DataType = AcpiDsMapNamedOpcodeToDataType (Opcode);
/* Attempt to type a NAME opcode by examining the argument */
/* TBD: [Investigate] is this the right place to do this? */ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"State=%p Op=%p Type=%x\n", WalkState, Op, DataType));
if (Op->Opcode == AML_NAME_OP)
if (Opcode == AML_SCOPE_OP)
{ {
if (Op->Value.Arg) ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
{ "State=%p Op=%p Type=%x\n", WalkState, Op, DataType));
DataType = AcpiDsMapOpcodeToDataType ((Op->Value.Arg)->Opcode, NULL);
} }
}
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 * 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 * 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. * arguments to the opcode must be created as we go back up the parse tree later.
*/ */
Status = AcpiNsLookup (WalkState->ScopeInfo, (char *) &((ACPI_NAMED_OP *)Op)->Name, DataType, IMODE_LOAD_PASS1, Status = AcpiNsLookup (WalkState->ScopeInfo, Path, DataType,
NS_NO_UPSEARCH, WalkState, &(NewEntry)); IMODE_LOAD_PASS1, NS_NO_UPSEARCH, WalkState, &(Node));
if (ACPI_SUCCESS (Status)) if (ACPI_FAILURE (Status))
{ {
/* return (Status);
* Put the NTE in the "op" object that the parser uses, so we
* can get it again quickly when this scope is closed
*/
Op->NameTableEntry = NewEntry;
} }
if (!Op)
{
/* Create a new op */
Op = AcpiPsAllocOp (Opcode);
if (!Op)
{
return (AE_NO_MEMORY);
}
}
/* Initialize */
((ACPI_PARSE2_OBJECT *)Op)->Name = Node->Name;
/*
* Put the Node in the "op" object that the parser uses, so we
* can get it again quickly when this scope is closed
*/
Op->Node = Node;
AcpiPsAppendArg (AcpiPsGetParentScope (WalkState->ParserState), Op);
*OutOp = Op;
return (Status); return (Status);
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: AcpiDsLoad1EndOp * FUNCTION: AcpiDsLoad1EndOp
* *
@ -227,57 +252,64 @@ AcpiDsLoad1BeginOp (
* DESCRIPTION: Ascending callback used during the loading of the namespace, * DESCRIPTION: Ascending callback used during the loading of the namespace,
* both control methods and everything else. * both control methods and everything else.
* *
****************************************************************************/ ******************************************************************************/
ACPI_STATUS ACPI_STATUS
AcpiDsLoad1EndOp ( AcpiDsLoad1EndOp (
ACPI_WALK_STATE *WalkState, ACPI_WALK_STATE *WalkState,
ACPI_GENERIC_OP *Op) ACPI_PARSE_OBJECT *Op)
{ {
OBJECT_TYPE_INTERNAL DataType; ACPI_OBJECT_TYPE8 DataType;
ACPI_OPCODE_INFO *OpInfo;
PROC_NAME ("DsLoad1EndOp");
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
DEBUG_PRINT (TRACE_DISPATCH, ("Load1EndOp: Op=%p State=%p\n", Op, WalkState));
/* We are only interested in opcodes that have an associated name */ /* We are only interested in opcodes that have an associated name */
if (!AcpiPsIsNamedOp (Op->Opcode)) OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode);
if (!(OpInfo->Flags & AML_NAMED))
{ {
return AE_OK; return (AE_OK);
} }
/* TBD: [Investigate] can this be removed? */
if (Op->Opcode == AML_SCOPE_OP)
{
DEBUG_PRINT (TRACE_DISPATCH, ("Load1EndOp: ending scope Op=%p State=%p\n", Op, WalkState));
if (((ACPI_NAMED_OP *)Op)->Name == -1)
{
DEBUG_PRINT (ACPI_ERROR, ("Load1EndOp: Un-named scope! Op=%p State=%p\n", Op, WalkState));
return AE_OK;
}
}
/* Get the type to determine if we should pop the scope */
DataType = AcpiDsMapNamedOpcodeToDataType (Op->Opcode); DataType = AcpiDsMapNamedOpcodeToDataType (Op->Opcode);
if (Op->Opcode == AML_NAME_OP)
{
/* For Name opcode, check the argument */
if (Op->Value.Arg)
{
DataType = AcpiDsMapOpcodeToDataType (
(Op->Value.Arg)->Opcode, NULL);
((ACPI_NAMESPACE_NODE *)Op->Node)->Type =
(UINT8) DataType;
}
}
/* Pop the scope stack */ /* Pop the scope stack */
if (AcpiNsOpensScope (DataType)) if (AcpiNsOpensScope (DataType))
{ {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n",
AcpiUtGetTypeName (DataType), Op));
DEBUG_PRINT (TRACE_DISPATCH, ("AmlEndNamespaceScope/%s: Popping scope for Op %p\n",
AcpiCmGetTypeName (DataType), Op));
AcpiDsScopeStackPop (WalkState); AcpiDsScopeStackPop (WalkState);
} }
return AE_OK; return (AE_OK);
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: AcpiDsLoad2BeginOp * FUNCTION: AcpiDsLoad2BeginOp
* *
@ -289,46 +321,59 @@ AcpiDsLoad1EndOp (
* *
* DESCRIPTION: Descending callback used during the loading of ACPI tables. * DESCRIPTION: Descending callback used during the loading of ACPI tables.
* *
****************************************************************************/ ******************************************************************************/
ACPI_STATUS ACPI_STATUS
AcpiDsLoad2BeginOp ( AcpiDsLoad2BeginOp (
UINT16 Opcode,
ACPI_PARSE_OBJECT *Op,
ACPI_WALK_STATE *WalkState, ACPI_WALK_STATE *WalkState,
ACPI_GENERIC_OP *Op) ACPI_PARSE_OBJECT **OutOp)
{ {
NAME_TABLE_ENTRY *NewEntry; ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status; ACPI_STATUS Status;
OBJECT_TYPE_INTERNAL DataType; ACPI_OBJECT_TYPE8 DataType;
char *BufferPtr; NATIVE_CHAR *BufferPtr;
void *Original = NULL; void *Original = NULL;
ACPI_OPCODE_INFO *OpInfo;
PROC_NAME ("DsLoad2BeginOp");
DEBUG_PRINT (TRACE_DISPATCH, ("Load2BeginOp: Op=%p State=%p\n", Op, WalkState)); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
/* We only care about Namespace opcodes here */ /* We only care about Namespace opcodes here */
if (!AcpiPsIsNamespaceOp (Op->Opcode) && OpInfo = AcpiPsGetOpcodeInfo (Opcode);
Op->Opcode != AML_NAMEPATH_OP) if (!(OpInfo->Flags & AML_NSOPCODE) &&
Opcode != AML_INT_NAMEPATH_OP)
{ {
return AE_OK; return (AE_OK);
} }
/* TBD: [Restructure] Temp! same code as in psparse */
if (!(OpInfo->Flags & AML_NAMED))
{
return (AE_OK);
}
if (Op)
{
/* /*
* Get the name we are going to enter or lookup in the namespace * Get the name we are going to enter or lookup in the namespace
*/ */
if (Op->Opcode == AML_NAMEPATH_OP) if (Opcode == AML_INT_NAMEPATH_OP)
{ {
/* For Namepath op , get the path string */ /* For Namepath op, get the path string */
BufferPtr = Op->Value.String; BufferPtr = Op->Value.String;
if (!BufferPtr) if (!BufferPtr)
{ {
/* No name, just exit */ /* No name, just exit */
return AE_OK; return (AE_OK);
} }
} }
@ -336,52 +381,59 @@ AcpiDsLoad2BeginOp (
{ {
/* Get name from the op */ /* Get name from the op */
BufferPtr = (char *) &((ACPI_NAMED_OP *)Op)->Name; BufferPtr = (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Op)->Name;
}
}
else
{
BufferPtr = AcpiPsGetNextNamestring (WalkState->ParserState);
} }
/* Map the raw opcode into an internal object type */ /* Map the raw opcode into an internal object type */
DataType = AcpiDsMapNamedOpcodeToDataType (Op->Opcode); DataType = AcpiDsMapNamedOpcodeToDataType (Opcode);
DEBUG_PRINT (TRACE_DISPATCH, ("Load2BeginOp: 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 (Op->Opcode == AML_DEF_FIELD_OP || if (Opcode == AML_FIELD_OP ||
Op->Opcode == AML_BANK_FIELD_OP || Opcode == AML_BANK_FIELD_OP ||
Op->Opcode == AML_INDEX_FIELD_OP) Opcode == AML_INDEX_FIELD_OP)
{ {
NewEntry = NULL; Node = NULL;
Status = AE_OK; Status = AE_OK;
} }
else if (Op->Opcode == AML_NAMEPATH_OP) else if (Opcode == AML_INT_NAMEPATH_OP)
{ {
/* /*
* The NamePath is an object reference to an existing object. Don't enter the * 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 * name into the namespace, but look it up for use later
*/ */
Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, DataType, IMODE_EXECUTE, Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, DataType,
NS_SEARCH_PARENT, WalkState, &(NewEntry)); IMODE_EXECUTE, NS_SEARCH_PARENT, WalkState, &(Node));
} }
else else
{ {
if (Op->NameTableEntry) if (Op && Op->Node)
{ {
Original = Op->NameTableEntry; Original = Op->Node;
NewEntry = Op->NameTableEntry; Node = Op->Node;
if (AcpiNsOpensScope (DataType)) if (AcpiNsOpensScope (DataType))
{ {
Status = AcpiDsScopeStackPush (NewEntry->Scope, DataType, WalkState); Status = AcpiDsScopeStackPush (Node, DataType, WalkState);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
return (Status); return (Status);
} }
} }
return AE_OK; return (AE_OK);
} }
/* /*
@ -389,34 +441,52 @@ AcpiDsLoad2BeginOp (
* as we go downward in the parse tree. Any necessary subobjects that involve * 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. * arguments to the opcode must be created as we go back up the parse tree later.
*/ */
Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, DataType, IMODE_EXECUTE, Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, DataType,
NS_NO_UPSEARCH, WalkState, &(NewEntry)); IMODE_EXECUTE, NS_NO_UPSEARCH, WalkState, &(Node));
} }
if (ACPI_SUCCESS (Status)) if (ACPI_SUCCESS (Status))
{ {
if (!Op)
{
/* Create a new op */
Op = AcpiPsAllocOp (Opcode);
if (!Op)
{
return (AE_NO_MEMORY);
}
/* Initialize */
((ACPI_PARSE2_OBJECT *)Op)->Name = Node->Name;
*OutOp = Op;
}
/* /*
* Put the NTE 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 * can get it again quickly when this scope is closed
*/ */
Op->NameTableEntry = NewEntry; Op->Node = Node;
if (Original) if (Original)
{ {
DEBUG_PRINT (ACPI_INFO, ("Lookup: old %p new %p\n", Original, NewEntry)); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "old %p new %p\n", Original, Node));
if (Original != NewEntry)
{
DEBUG_PRINT (ACPI_INFO, ("Lookup match error: old %p new %p\n", Original, NewEntry));
}
}
}
if (Original != Node)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Lookup match error: old %p new %p\n", Original, Node));
}
}
}
return (Status); return (Status);
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: AcpiDsLoad2EndOp * FUNCTION: AcpiDsLoad2EndOp
* *
@ -429,35 +499,43 @@ AcpiDsLoad2BeginOp (
* DESCRIPTION: Ascending callback used during the loading of the namespace, * DESCRIPTION: Ascending callback used during the loading of the namespace,
* both control methods and everything else. * both control methods and everything else.
* *
****************************************************************************/ ******************************************************************************/
ACPI_STATUS ACPI_STATUS
AcpiDsLoad2EndOp ( AcpiDsLoad2EndOp (
ACPI_WALK_STATE *WalkState, ACPI_WALK_STATE *WalkState,
ACPI_GENERIC_OP *Op) ACPI_PARSE_OBJECT *Op)
{ {
ACPI_STATUS Status = AE_OK; ACPI_STATUS Status = AE_OK;
OBJECT_TYPE_INTERNAL DataType; ACPI_OBJECT_TYPE8 DataType;
NAME_TABLE_ENTRY *Entry; ACPI_NAMESPACE_NODE *Node;
ACPI_GENERIC_OP *Arg; ACPI_PARSE_OBJECT *Arg;
NAME_TABLE_ENTRY *NewEntry; ACPI_NAMESPACE_NODE *NewNode;
ACPI_OPCODE_INFO *OpInfo;
PROC_NAME ("DsLoad2EndOp");
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
DEBUG_PRINT (TRACE_DISPATCH, ("Load2EndOp: Op=%p State=%p\n", Op, WalkState));
if (!AcpiPsIsNamespaceObjectOp (Op->Opcode)) /* Only interested in opcodes that have namespace objects */
OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode);
if (!(OpInfo->Flags & AML_NSOBJECT))
{ {
return AE_OK; return (AE_OK);
} }
if (Op->Opcode == AML_SCOPE_OP) if (Op->Opcode == AML_SCOPE_OP)
{ {
DEBUG_PRINT (TRACE_DISPATCH, ("Load2EndOp: ending scope Op=%p State=%p\n", Op, WalkState)); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
if (((ACPI_NAMED_OP *)Op)->Name == -1) "Ending scope Op=%p State=%p\n", Op, WalkState));
if (((ACPI_PARSE2_OBJECT *)Op)->Name == -1)
{ {
DEBUG_PRINT (ACPI_ERROR, ("Load2EndOp: Un-named scope! Op=%p State=%p\n", Op, WalkState)); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unnamed scope! Op=%p State=%p\n",
return AE_OK; Op, WalkState));
return (AE_OK);
} }
} }
@ -465,14 +543,17 @@ AcpiDsLoad2EndOp (
DataType = AcpiDsMapNamedOpcodeToDataType (Op->Opcode); DataType = AcpiDsMapNamedOpcodeToDataType (Op->Opcode);
/* /*
* Get the NTE/name from the earlier lookup * Get the Node/name from the earlier lookup
* (It was saved in the *op structure) * (It was saved in the *op structure)
*/ */
Entry = Op->NameTableEntry; Node = Op->Node;
/* Put the NTE on the object stack (Contains the ACPI Name of this object) */ /*
* Put the Node on the object stack (Contains the ACPI Name of
* this object)
*/
WalkState->Operands[0] = (void *) Entry; WalkState->Operands[0] = (void *) Node;
WalkState->NumOperands = 1; WalkState->NumOperands = 1;
/* Pop the scope stack */ /* Pop the scope stack */
@ -480,13 +561,12 @@ AcpiDsLoad2EndOp (
if (AcpiNsOpensScope (DataType)) if (AcpiNsOpensScope (DataType))
{ {
DEBUG_PRINT (TRACE_DISPATCH, ("AmlEndNamespaceScope/%s: Popping scope for Op %p\n", ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n",
AcpiCmGetTypeName (DataType), Op)); AcpiUtGetTypeName (DataType), Op));
AcpiDsScopeStackPop (WalkState); AcpiDsScopeStackPop (WalkState);
} }
/* /*
* Named operations are as follows: * Named operations are as follows:
* *
@ -510,6 +590,7 @@ AcpiDsLoad2EndOp (
* AML_CREATEBYTEFIELD * AML_CREATEBYTEFIELD
* AML_CREATEWORDFIELD * AML_CREATEWORDFIELD
* AML_CREATEDWORDFIELD * AML_CREATEDWORDFIELD
* AML_CREATEQWORDFIELD
* AML_METHODCALL * AML_METHODCALL
*/ */
@ -522,13 +603,20 @@ AcpiDsLoad2EndOp (
{ {
case AML_CREATE_FIELD_OP: case AML_CREATE_FIELD_OP:
case AML_BIT_FIELD_OP: case AML_CREATE_BIT_FIELD_OP:
case AML_BYTE_FIELD_OP: case AML_CREATE_BYTE_FIELD_OP:
case AML_WORD_FIELD_OP: case AML_CREATE_WORD_FIELD_OP:
case AML_DWORD_FIELD_OP: case AML_CREATE_DWORD_FIELD_OP:
case AML_CREATE_QWORD_FIELD_OP:
DEBUG_PRINT (TRACE_DISPATCH, ("LOADING-CreateXxxField: State=%p Op=%p nte=%p\n", /*
WalkState, Op, Entry)); * Create the field object, but the field buffer and index must
* be evaluated later during the execution phase
*/
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"CreateXxxField: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, Node));
/* Get the NameString argument */ /* Get the NameString argument */
@ -543,48 +631,76 @@ AcpiDsLoad2EndOp (
Arg = AcpiPsGetArg (Op, 2); Arg = AcpiPsGetArg (Op, 2);
} }
if (!Arg)
{
Status = AE_AML_NO_OPERAND;
goto Cleanup;
}
/* /*
* Enter the NameString into the namespace * Enter the NameString into the namespace
*/ */
Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String,
Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String, INTERNAL_TYPE_DEF_ANY, IMODE_LOAD_PASS1, INTERNAL_TYPE_DEF_ANY, IMODE_LOAD_PASS1,
NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, WalkState, &(NewEntry)); NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
if (ACPI_SUCCESS (Status)) WalkState, &(NewNode));
if (ACPI_FAILURE (Status))
{ {
/* We could put the returned object (NTE) on the object stack for later, but goto Cleanup;
}
/* 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 * 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 * can get it again at the end of this scope
*/ */
Op->NameTableEntry = NewEntry; Op->Node = NewNode;
}
/*
* 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.
*/
if (!NewNode->Object)
{
/*
* 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 = AcpiExCreateBufferField (((ACPI_PARSE2_OBJECT *) Op)->Data,
((ACPI_PARSE2_OBJECT *) Op)->Length,
NewNode, WalkState);
}
break; break;
case AML_METHODCALL_OP: case AML_INT_METHODCALL_OP:
DEBUG_PRINT (TRACE_DISPATCH, ("RESOLVING-MethodCall: State=%p Op=%p nte=%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
WalkState, Op, Entry)); "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, Node));
/* /*
* Lookup the method name and save the NTE * Lookup the method name and save the Node
*/ */
Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String, ACPI_TYPE_ANY, IMODE_LOAD_PASS2, Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String,
NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, WalkState, &(NewEntry)); ACPI_TYPE_ANY, IMODE_LOAD_PASS2,
NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE,
WalkState, &(NewNode));
if (ACPI_SUCCESS (Status)) if (ACPI_SUCCESS (Status))
{ {
/* has name already been resolved by here ??*/ /* TBD: has name already been resolved by here ??*/
/* TBD: [Restructure] Make sure that what we found is indeed a method! */ /* 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 didn't search for a method on purpose, to see if the name would resolve! */
/* We could put the returned object (NTE) 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 * 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 * can get it again at the end of this scope
*/ */
Op->NameTableEntry = NewEntry; Op->Node = NewNode;
} }
@ -595,16 +711,19 @@ AcpiDsLoad2EndOp (
/* Nothing to do other than enter object into namespace */ /* Nothing to do other than enter object into namespace */
DEBUG_PRINT (TRACE_DISPATCH, ("LOADING-Processor: State=%p Op=%p nte=%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
WalkState, Op, Entry)); "LOADING-Processor: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, Node));
Status = AcpiAmlExecCreateProcessor (Op, (ACPI_HANDLE) Entry); Status = AcpiExCreateProcessor (Op, Node);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
goto Cleanup; goto Cleanup;
} }
DEBUG_PRINT (TRACE_DISPATCH, ("Completed Processor Init, Op=%p State=%p entry=%p\n", Op, WalkState, Entry)); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Completed Processor Init, Op=%p State=%p entry=%p\n",
Op, WalkState, Node));
break; break;
@ -612,16 +731,19 @@ AcpiDsLoad2EndOp (
/* Nothing to do other than enter object into namespace */ /* Nothing to do other than enter object into namespace */
DEBUG_PRINT (TRACE_DISPATCH, ("LOADING-PowerResource: State=%p Op=%p nte=%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
WalkState, Op, Entry)); "LOADING-PowerResource: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, Node));
Status = AcpiAmlExecCreatePowerResource (Op, (ACPI_HANDLE) Entry); Status = AcpiExCreatePowerResource (Op, Node);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
goto Cleanup; goto Cleanup;
} }
DEBUG_PRINT (TRACE_DISPATCH, ("Completed PowerResource Init, Op=%p State=%p entry=%p\n", Op, WalkState, Entry)); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Completed PowerResource Init, Op=%p State=%p entry=%p\n",
Op, WalkState, Node));
break; break;
@ -629,47 +751,45 @@ AcpiDsLoad2EndOp (
/* Nothing to do other than enter object into namespace */ /* Nothing to do other than enter object into namespace */
DEBUG_PRINT (TRACE_DISPATCH, ("LOADING-ThermalZone: State=%p Op=%p nte=%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
WalkState, Op, Entry)); "LOADING-ThermalZone: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, Node));
break; break;
case AML_DEF_FIELD_OP: case AML_FIELD_OP:
DEBUG_PRINT (TRACE_DISPATCH, ("LOADING-Field: State=%p Op=%p nte=%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
WalkState, Op, Entry)); "LOADING-Field: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, Node));
Arg = Op->Value.Arg; Arg = Op->Value.Arg;
if (!Arg->NameTableEntry)
{
DEBUG_PRINT (TRACE_DISPATCH, ("LOADING-Field: State=%p Op=%p nte=%p\n",
WalkState, Op, Entry));
} Status = AcpiDsCreateField (Op, Arg->Node, WalkState);
Status = AcpiDsCreateField (Op, (ACPI_HANDLE) Arg->NameTableEntry, WalkState);
break; break;
case AML_INDEX_FIELD_OP: case AML_INDEX_FIELD_OP:
DEBUG_PRINT (TRACE_DISPATCH, ("LOADING-IndexField: State=%p Op=%p nte=%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
WalkState, Op, Entry)); "LOADING-IndexField: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, Node));
Arg = Op->Value.Arg; Arg = Op->Value.Arg;
Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->NameTableEntry, WalkState); Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->Node,
WalkState);
break; break;
case AML_BANK_FIELD_OP: case AML_BANK_FIELD_OP:
DEBUG_PRINT (TRACE_DISPATCH, ("LOADING-BankField: State=%p Op=%p nte=%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
WalkState, Op, Entry)); "LOADING-BankField: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, Node));
Arg = Op->Value.Arg; Arg = Op->Value.Arg;
Status = AcpiDsCreateBankField (Op, (ACPI_HANDLE) Arg->NameTableEntry, WalkState); Status = AcpiDsCreateBankField (Op, Arg->Node, WalkState);
break; break;
@ -678,21 +798,23 @@ AcpiDsLoad2EndOp (
*/ */
case AML_METHOD_OP: case AML_METHOD_OP:
DEBUG_PRINT (TRACE_DISPATCH, ("LOADING-Method: State=%p Op=%p nte=%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
WalkState, Op, Entry)); "LOADING-Method: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, Node));
if (!Entry->Object) if (!Node->Object)
{ {
Status = AcpiAmlExecCreateMethod (((ACPI_DEFERRED_OP *) Op)->Body, ((ACPI_DEFERRED_OP *) Op)->BodyLength, Status = AcpiExCreateMethod (((ACPI_PARSE2_OBJECT *) Op)->Data,
Arg->Value.Integer, (ACPI_HANDLE) Entry); ((ACPI_PARSE2_OBJECT *) Op)->Length,
Arg->Value.Integer32, Node);
} }
break; break;
case AML_MUTEX_OP: case AML_MUTEX_OP:
DEBUG_PRINT (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); Status = AcpiDsCreateOperands (WalkState, Arg);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
@ -700,13 +822,14 @@ AcpiDsLoad2EndOp (
goto Cleanup; goto Cleanup;
} }
Status = AcpiAmlExecCreateMutex (WalkState); Status = AcpiExCreateMutex (WalkState);
break; break;
case AML_EVENT_OP: case AML_EVENT_OP:
DEBUG_PRINT (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); Status = AcpiDsCreateOperands (WalkState, Arg);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
@ -714,24 +837,32 @@ AcpiDsLoad2EndOp (
goto Cleanup; goto Cleanup;
} }
Status = AcpiAmlExecCreateEvent (WalkState); Status = AcpiExCreateEvent (WalkState);
break; break;
case AML_REGION_OP: case AML_REGION_OP:
DEBUG_PRINT (TRACE_DISPATCH, ("LOADING-Opregion: Op=%p State=%p Nte=%p\n", Op, WalkState, Entry)); if (Node->Object)
{
break;
}
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"LOADING-Opregion: Op=%p State=%p NamedObj=%p\n",
Op, WalkState, Node));
/* /*
* The OpRegion is not fully parsed at this time. Only valid argument is the SpaceId. * The OpRegion is not fully parsed at this time. Only valid argument is the SpaceId.
* (We must save the address of the AML of the address and length operands) * (We must save the address of the AML of the address and length operands)
*/ */
Status = AcpiExCreateRegion (((ACPI_PARSE2_OBJECT *) Op)->Data,
((ACPI_PARSE2_OBJECT *) Op)->Length,
(ACPI_ADR_SPACE_TYPE) Arg->Value.Integer, WalkState);
Status = AcpiAmlExecCreateRegion (((ACPI_DEFERRED_OP *) Op)->Body, ((ACPI_DEFERRED_OP *) Op)->BodyLength, ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
Arg->Value.Integer, WalkState); "Completed OpRegion Init, Op=%p State=%p entry=%p\n",
Op, WalkState, Node));
DEBUG_PRINT (TRACE_DISPATCH, ("Completed OpRegion Init, Op=%p State=%p entry=%p\n", Op, WalkState, Entry));
break; break;
@ -739,7 +870,8 @@ AcpiDsLoad2EndOp (
case AML_ALIAS_OP: case AML_ALIAS_OP:
DEBUG_PRINT (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); Status = AcpiDsCreateOperands (WalkState, Arg);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
@ -747,23 +879,33 @@ AcpiDsLoad2EndOp (
goto Cleanup; goto Cleanup;
} }
Status = AcpiAmlExecCreateAlias (WalkState); Status = AcpiExCreateAlias (WalkState);
break; break;
case AML_NAME_OP: case AML_NAME_OP:
DEBUG_PRINT (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));
Status = AcpiDsCreateNamedObject (WalkState, Entry, 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; break;
case AML_NAMEPATH_OP: case AML_INT_NAMEPATH_OP:
DEBUG_PRINT (TRACE_DISPATCH, ("LOADING-NamePath object: State=%p Op=%p nte=%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
WalkState, Op, Entry)); "LOADING-NamePath object: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, Node));
break; break;
@ -774,7 +916,10 @@ AcpiDsLoad2EndOp (
Cleanup: Cleanup:
AcpiDsObjStackPop (1, WalkState); /* Remove the NTE pushed at the very beginning */ /* Remove the Node pushed at the very beginning */
AcpiDsObjStackPop (1, WalkState);
return (Status); return (Status);
} }