Update to opcode names and typenames for fields

date	2001.03.30.18.16.00;	author rmoore1;	state Exp;
This commit is contained in:
aystarik 2005-06-29 17:07:14 +00:00
parent 970e7b2962
commit 29fc542291
3 changed files with 243 additions and 161 deletions

View File

@ -2,7 +2,7 @@
* *
* Module Name: dsopcode - Dispatcher Op Region support and handling of * Module Name: dsopcode - Dispatcher Op Region support and handling of
* "control" opcodes * "control" opcodes
* $Revision: 1.35 $ * $Revision: 1.39 $
* *
*****************************************************************************/ *****************************************************************************/
@ -126,7 +126,7 @@
#include "acevents.h" #include "acevents.h"
#include "actables.h" #include "actables.h"
#define _COMPONENT DISPATCHER #define _COMPONENT ACPI_DISPATCHER
MODULE_NAME ("dsopcode") MODULE_NAME ("dsopcode")
@ -420,7 +420,7 @@ AcpiDsEvalFieldUnitOperands (
ACPI_PARSE_OBJECT *NextOp; ACPI_PARSE_OBJECT *NextOp;
UINT32 Offset; UINT32 Offset;
UINT32 BitOffset; UINT32 BitOffset;
UINT16 BitCount; UINT32 BitCount;
ACPI_OPERAND_OBJECT *ResDesc = NULL; ACPI_OPERAND_OBJECT *ResDesc = NULL;
@ -516,7 +516,7 @@ AcpiDsEvalFieldUnitOperands (
/* DefCreateBitField */ /* DefCreateBitField */
case AML_BIT_FIELD_OP: case AML_CREATE_BIT_FIELD_OP:
/* Offset is in bits, Field is a bit */ /* Offset is in bits, Field is a bit */
@ -527,7 +527,7 @@ AcpiDsEvalFieldUnitOperands (
/* DefCreateByteField */ /* DefCreateByteField */
case AML_BYTE_FIELD_OP: case AML_CREATE_BYTE_FIELD_OP:
/* Offset is in bytes, field is a byte */ /* Offset is in bytes, field is a byte */
@ -538,7 +538,7 @@ AcpiDsEvalFieldUnitOperands (
/* DefCreateWordField */ /* DefCreateWordField */
case AML_WORD_FIELD_OP: case AML_CREATE_WORD_FIELD_OP:
/* Offset is in bytes, field is a word */ /* Offset is in bytes, field is a word */
@ -549,7 +549,7 @@ AcpiDsEvalFieldUnitOperands (
/* DefCreateDWordField */ /* DefCreateDWordField */
case AML_DWORD_FIELD_OP: case AML_CREATE_DWORD_FIELD_OP:
/* Offset is in bytes, field is a dword */ /* Offset is in bytes, field is a dword */
@ -558,6 +558,17 @@ AcpiDsEvalFieldUnitOperands (
break; break;
/* DefCreateQWordField */
case AML_CREATE_QWORD_FIELD_OP:
/* Offset is in bytes, field is a dword */
BitOffset = 8 * Offset;
BitCount = 64;
break;
/* DefCreateField */ /* DefCreateField */
case AML_CREATE_FIELD_OP: case AML_CREATE_FIELD_OP:
@ -565,7 +576,7 @@ AcpiDsEvalFieldUnitOperands (
/* Offset is in bits, count is in bits */ /* Offset is in bits, count is in bits */
BitOffset = Offset; BitOffset = Offset;
BitCount = (UINT16) CntDesc->Integer.Value; BitCount = (UINT32) CntDesc->Integer.Value;
break; break;
@ -590,12 +601,12 @@ AcpiDsEvalFieldUnitOperands (
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
if (BitOffset + (UINT32) BitCount > if ((BitOffset + BitCount) >
(8 * (UINT32) SrcDesc->Buffer.Length)) (8 * (UINT32) SrcDesc->Buffer.Length))
{ {
DEBUG_PRINT (ACPI_ERROR, DEBUG_PRINT (ACPI_ERROR,
("AmlExecCreateField: Field exceeds Buffer %d > %d\n", ("AmlExecCreateField: Field exceeds Buffer %d > %d\n",
BitOffset + (UINT32) BitCount, BitOffset + BitCount,
8 * (UINT32) SrcDesc->Buffer.Length)); 8 * (UINT32) SrcDesc->Buffer.Length));
Status = AE_AML_BUFFER_LIMIT; Status = AE_AML_BUFFER_LIMIT;
goto Cleanup; goto Cleanup;
@ -607,10 +618,10 @@ AcpiDsEvalFieldUnitOperands (
FieldDesc->FieldUnit.Access = (UINT8) ACCESS_ANY_ACC; FieldDesc->FieldUnit.Access = (UINT8) ACCESS_ANY_ACC;
FieldDesc->FieldUnit.LockRule = (UINT8) GLOCK_NEVER_LOCK; FieldDesc->FieldUnit.LockRule = (UINT8) GLOCK_NEVER_LOCK;
FieldDesc->FieldUnit.UpdateRule = (UINT8) UPDATE_PRESERVE; FieldDesc->FieldUnit.UpdateRule = (UINT8) UPDATE_PRESERVE;
FieldDesc->FieldUnit.Length = BitCount; FieldDesc->FieldUnit.Length = (UINT16) BitCount;
FieldDesc->FieldUnit.BitOffset = (UINT8) (BitOffset % 8); FieldDesc->FieldUnit.BitOffset = (UINT8) (BitOffset % 8);
FieldDesc->FieldUnit.Offset = DIV_8 (BitOffset); FieldDesc->FieldUnit.Offset = DIV_8 (BitOffset);
FieldDesc->FieldUnit.Container = SrcDesc; FieldDesc->FieldUnit.ContainerObj = SrcDesc;
/* Reference count for SrcDesc inherits FieldDesc count */ /* Reference count for SrcDesc inherits FieldDesc count */
@ -626,7 +637,7 @@ AcpiDsEvalFieldUnitOperands (
if ((SrcDesc->Common.Type > (UINT8) INTERNAL_TYPE_REFERENCE) || !AcpiCmValidObjectType (SrcDesc->Common.Type)) /* TBD: This line MUST be a single line until AcpiSrc can handle it (block deletion) */ if ((SrcDesc->Common.Type > (UINT8) INTERNAL_TYPE_REFERENCE) || !AcpiCmValidObjectType (SrcDesc->Common.Type)) /* TBD: This line MUST be a single line until AcpiSrc can handle it (block deletion) */
{ {
DEBUG_PRINT (ACPI_ERROR, DEBUG_PRINT (ACPI_ERROR,
("AmlExecCreateField: Tried to create field in invalid object type %X\n", ("AmlExecCreateField: Tried to create field in invalid object type %X\n",

View File

@ -1,7 +1,7 @@
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dsutils - Dispatcher utilities * Module Name: dsutils - Dispatcher utilities
* $Revision: 1.48 $ * $Revision: 1.54 $
* *
******************************************************************************/ ******************************************************************************/
@ -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
* *
@ -124,7 +124,7 @@
#include "acnamesp.h" #include "acnamesp.h"
#include "acdebug.h" #include "acdebug.h"
#define _COMPONENT PARSER #define _COMPONENT ACPI_DISPATCHER
MODULE_NAME ("dsutils") MODULE_NAME ("dsutils")
@ -241,6 +241,24 @@ AcpiDsIsResultUsed (
case OPTYPE_NAMED_OBJECT: /* Scope, method, etc. */ 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_CREATE_BIT_FIELD_OP) ||
(Op->Parent->Opcode == AML_CREATE_BYTE_FIELD_OP) ||
(Op->Parent->Opcode == AML_CREATE_WORD_FIELD_OP) ||
(Op->Parent->Opcode == AML_CREATE_DWORD_FIELD_OP) ||
(Op->Parent->Opcode == AML_CREATE_QWORD_FIELD_OP))
{
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, DEBUG_PRINT (TRACE_DISPATCH,
("DsIsResultUsed: Result not used, Parent opcode=%X Op=%X\n", ("DsIsResultUsed: Result not used, Parent opcode=%X Op=%X\n",
Op->Opcode, Op)); Op->Opcode, Op));
@ -311,7 +329,7 @@ AcpiDsDeleteResultIfNotUsed (
* to ResultObj) * to ResultObj)
*/ */
Status = AcpiDsResultStackPop (&ObjDesc, WalkState); Status = AcpiDsResultPop (&ObjDesc, WalkState);
if (ACPI_SUCCESS (Status)) if (ACPI_SUCCESS (Status))
{ {
AcpiCmRemoveReference (ResultObj); AcpiCmRemoveReference (ResultObj);
@ -341,7 +359,8 @@ AcpiDsDeleteResultIfNotUsed (
ACPI_STATUS ACPI_STATUS
AcpiDsCreateOperand ( AcpiDsCreateOperand (
ACPI_WALK_STATE *WalkState, ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Arg) ACPI_PARSE_OBJECT *Arg,
UINT32 ArgIndex)
{ {
ACPI_STATUS Status = AE_OK; ACPI_STATUS Status = AE_OK;
NATIVE_CHAR *NameString; NATIVE_CHAR *NameString;
@ -513,7 +532,7 @@ AcpiDsCreateOperand (
* by the evaluation of this argument * by the evaluation of this argument
*/ */
Status = AcpiDsResultStackPop (&ObjDesc, WalkState); Status = AcpiDsResultPopFromBottom (&ObjDesc, WalkState);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
/* /*
@ -584,20 +603,17 @@ AcpiDsCreateOperands (
{ {
ACPI_STATUS Status = AE_OK; ACPI_STATUS Status = AE_OK;
ACPI_PARSE_OBJECT *Arg; ACPI_PARSE_OBJECT *Arg;
UINT32 ArgsPushed = 0; UINT32 ArgCount = 0;
FUNCTION_TRACE_PTR ("DsCreateOperands", FirstArg); FUNCTION_TRACE_PTR ("DsCreateOperands", FirstArg);
Arg = FirstArg;
/* For all arguments in the list... */ /* For all arguments in the list... */
Arg = FirstArg;
while (Arg) while (Arg)
{ {
Status = AcpiDsCreateOperand (WalkState, Arg, ArgCount);
Status = AcpiDsCreateOperand (WalkState, Arg);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
goto Cleanup; goto Cleanup;
@ -605,12 +621,12 @@ AcpiDsCreateOperands (
DEBUG_PRINT (TRACE_DISPATCH, DEBUG_PRINT (TRACE_DISPATCH,
("DsCreateOperands: Arg #%d (%p) done, Arg1=%p\n", ("DsCreateOperands: Arg #%d (%p) done, Arg1=%p\n",
ArgsPushed, Arg, FirstArg)); ArgCount, Arg, FirstArg));
/* Move on to next argument, if any */ /* Move on to next argument, if any */
Arg = Arg->Next; Arg = Arg->Next;
ArgsPushed++; ArgCount++;
} }
return_ACPI_STATUS (Status); return_ACPI_STATUS (Status);
@ -623,11 +639,11 @@ Cleanup:
* objects * objects
*/ */
AcpiDsObjStackPopAndDelete (ArgsPushed, WalkState); AcpiDsObjStackPopAndDelete (ArgCount, WalkState);
DEBUG_PRINT (ACPI_ERROR, DEBUG_PRINT (ACPI_ERROR,
("DsCreateOperands: Error while creating Arg %d - %s\n", ("DsCreateOperands: Error while creating Arg %d - %s\n",
(ArgsPushed+1), AcpiCmFormatException (Status))); (ArgCount + 1), AcpiCmFormatException (Status)));
return_ACPI_STATUS (Status); return_ACPI_STATUS (Status);
} }
@ -728,7 +744,7 @@ AcpiDsMapOpcodeToDataType (
case AML_WORD_OP: case AML_WORD_OP:
case AML_DWORD_OP: case AML_DWORD_OP:
DataType = ACPI_TYPE_NUMBER; DataType = ACPI_TYPE_INTEGER;
break; break;
@ -882,8 +898,8 @@ AcpiDsMapNamedOpcodeToDataType (
DataType = ACPI_TYPE_PROCESSOR; DataType = ACPI_TYPE_PROCESSOR;
break; break;
case AML_DEF_FIELD_OP: /* DefFieldOp */ case AML_FIELD_OP: /* FieldOp */
DataType = INTERNAL_TYPE_DEF_FIELD_DEFN; DataType = INTERNAL_TYPE_FIELD_DEFN;
break; break;
case AML_INDEX_FIELD_OP: /* IndexFieldOp */ case AML_INDEX_FIELD_OP: /* IndexFieldOp */

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: dswload - Dispatcher namespace load callbacks * Module Name: dswload - Dispatcher namespace load callbacks
* $Revision: 1.31 $
* *
*****************************************************************************/ *****************************************************************************/
@ -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
* *
@ -125,11 +125,11 @@
#include "acevents.h" #include "acevents.h"
#define _COMPONENT DISPATCHER #define _COMPONENT ACPI_DISPATCHER
MODULE_NAME ("dswload"); MODULE_NAME ("dswload")
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: AcpiDsLoad1BeginOp * FUNCTION: AcpiDsLoad1BeginOp
* *
@ -141,19 +141,19 @@
* *
* 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, UINT16 Opcode,
ACPI_GENERIC_OP *Op, ACPI_PARSE_OBJECT *Op,
ACPI_WALK_STATE *WalkState, ACPI_WALK_STATE *WalkState,
ACPI_GENERIC_OP **OutOp) ACPI_PARSE_OBJECT **OutOp)
{ {
ACPI_NAMED_OBJECT *Entry; ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status; ACPI_STATUS Status;
OBJECT_TYPE_INTERNAL DataType; OBJECT_TYPE_INTERNAL DataType;
INT8 *Path; NATIVE_CHAR *Path;
DEBUG_PRINT (TRACE_DISPATCH, DEBUG_PRINT (TRACE_DISPATCH,
@ -164,15 +164,17 @@ AcpiDsLoad1BeginOp (
if (!AcpiPsIsNamedOp (Opcode)) if (!AcpiPsIsNamedOp (Opcode))
{ {
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 && Op->AcpiNamedObject) if (Op && Op->Node)
{ {
return AE_OK; *OutOp = Op;
return (AE_OK);
} }
Path = AcpiPsGetNextNamestring (WalkState->ParserState); Path = AcpiPsGetNextNamestring (WalkState->ParserState);
@ -186,6 +188,12 @@ AcpiDsLoad1BeginOp (
("Load1BeginOp: State=%p Op=%p Type=%x\n", WalkState, Op, DataType)); ("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 * 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
@ -193,7 +201,7 @@ AcpiDsLoad1BeginOp (
*/ */
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, Status = AcpiNsLookup (WalkState->ScopeInfo, Path,
DataType, IMODE_LOAD_PASS1, DataType, IMODE_LOAD_PASS1,
NS_NO_UPSEARCH, WalkState, &(Entry)); NS_NO_UPSEARCH, WalkState, &(Node));
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
@ -213,13 +221,13 @@ AcpiDsLoad1BeginOp (
/* Initialize */ /* Initialize */
((ACPI_NAMED_OP *)Op)->Name = Entry->Name; ((ACPI_PARSE2_OBJECT *)Op)->Name = Node->Name;
/* /*
* 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->AcpiNamedObject = Entry; Op->Node = Node;
AcpiPsAppendArg (AcpiPsGetParentScope (WalkState->ParserState), Op); AcpiPsAppendArg (AcpiPsGetParentScope (WalkState->ParserState), Op);
@ -230,7 +238,7 @@ AcpiDsLoad1BeginOp (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: AcpiDsLoad1EndOp * FUNCTION: AcpiDsLoad1EndOp
* *
@ -243,12 +251,12 @@ 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; OBJECT_TYPE_INTERNAL DataType;
@ -260,7 +268,7 @@ AcpiDsLoad1EndOp (
if (!AcpiPsIsNamedOp (Op->Opcode)) if (!AcpiPsIsNamedOp (Op->Opcode))
{ {
return AE_OK; return (AE_OK);
} }
@ -276,7 +284,7 @@ AcpiDsLoad1EndOp (
{ {
DataType = AcpiDsMapOpcodeToDataType ( DataType = AcpiDsMapOpcodeToDataType (
(Op->Value.Arg)->Opcode, NULL); (Op->Value.Arg)->Opcode, NULL);
((ACPI_NAMED_OBJECT*)Op->AcpiNamedObject)->Type = ((ACPI_NAMESPACE_NODE *)Op->Node)->Type =
(UINT8) DataType; (UINT8) DataType;
} }
} }
@ -293,12 +301,12 @@ AcpiDsLoad1EndOp (
AcpiDsScopeStackPop (WalkState); AcpiDsScopeStackPop (WalkState);
} }
return AE_OK; return (AE_OK);
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: AcpiDsLoad2BeginOp * FUNCTION: AcpiDsLoad2BeginOp
* *
@ -310,19 +318,19 @@ 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, UINT16 Opcode,
ACPI_GENERIC_OP *Op, ACPI_PARSE_OBJECT *Op,
ACPI_WALK_STATE *WalkState, ACPI_WALK_STATE *WalkState,
ACPI_GENERIC_OP **OutOp) ACPI_PARSE_OBJECT **OutOp)
{ {
ACPI_NAMED_OBJECT *NewEntry; ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status; ACPI_STATUS Status;
OBJECT_TYPE_INTERNAL DataType; OBJECT_TYPE_INTERNAL DataType;
INT8 *BufferPtr; NATIVE_CHAR *BufferPtr;
void *Original = NULL; void *Original = NULL;
@ -335,10 +343,17 @@ AcpiDsLoad2BeginOp (
if (!AcpiPsIsNamespaceOp (Opcode) && if (!AcpiPsIsNamespaceOp (Opcode) &&
Opcode != AML_NAMEPATH_OP) Opcode != AML_NAMEPATH_OP)
{ {
return AE_OK; return (AE_OK);
} }
/* Temp! same code as in psparse */
if (!AcpiPsIsNamedOp (Opcode))
{
return (AE_OK);
}
if (Op) if (Op)
{ {
/* /*
@ -353,7 +368,7 @@ AcpiDsLoad2BeginOp (
{ {
/* No name, just exit */ /* No name, just exit */
return AE_OK; return (AE_OK);
} }
} }
@ -361,7 +376,7 @@ AcpiDsLoad2BeginOp (
{ {
/* Get name from the op */ /* Get name from the op */
BufferPtr = (INT8 *) &((ACPI_NAMED_OP *)Op)->Name; BufferPtr = (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Op)->Name;
} }
} }
@ -379,11 +394,11 @@ AcpiDsLoad2BeginOp (
("Load2BeginOp: State=%p Op=%p Type=%x\n", WalkState, Op, DataType)); ("Load2BeginOp: State=%p Op=%p Type=%x\n", WalkState, Op, DataType));
if (Opcode == AML_DEF_FIELD_OP || if (Opcode == AML_FIELD_OP ||
Opcode == AML_BANK_FIELD_OP || Opcode == AML_BANK_FIELD_OP ||
Opcode == AML_INDEX_FIELD_OP) Opcode == AML_INDEX_FIELD_OP)
{ {
NewEntry = NULL; Node = NULL;
Status = AE_OK; Status = AE_OK;
} }
@ -396,19 +411,19 @@ AcpiDsLoad2BeginOp (
Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr,
DataType, IMODE_EXECUTE, DataType, IMODE_EXECUTE,
NS_SEARCH_PARENT, WalkState, NS_SEARCH_PARENT, WalkState,
&(NewEntry)); &(Node));
} }
else else
{ {
if (Op && Op->AcpiNamedObject) if (Op && Op->Node)
{ {
Original = Op->AcpiNamedObject; Original = Op->Node;
NewEntry = Op->AcpiNamedObject; Node = Op->Node;
if (AcpiNsOpensScope (DataType)) if (AcpiNsOpensScope (DataType))
{ {
Status = AcpiDsScopeStackPush (NewEntry->ChildTable, Status = AcpiDsScopeStackPush (Node,
DataType, DataType,
WalkState); WalkState);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
@ -417,7 +432,7 @@ AcpiDsLoad2BeginOp (
} }
} }
return AE_OK; return (AE_OK);
} }
/* /*
@ -428,7 +443,7 @@ AcpiDsLoad2BeginOp (
Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr,
DataType, IMODE_EXECUTE, DataType, IMODE_EXECUTE,
NS_NO_UPSEARCH, WalkState, NS_NO_UPSEARCH, WalkState,
&(NewEntry)); &(Node));
} }
if (ACPI_SUCCESS (Status)) if (ACPI_SUCCESS (Status))
@ -445,26 +460,26 @@ AcpiDsLoad2BeginOp (
/* Initialize */ /* Initialize */
((ACPI_NAMED_OP *)Op)->Name = NewEntry->Name; ((ACPI_PARSE2_OBJECT *)Op)->Name = Node->Name;
*OutOp = Op; *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->AcpiNamedObject = NewEntry; Op->Node = Node;
if (Original) if (Original)
{ {
DEBUG_PRINT (ACPI_INFO, 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, DEBUG_PRINT (ACPI_INFO,
("Lookup match error: old %p new %p\n", Original, NewEntry)); ("Lookup match error: old %p new %p\n", Original, Node));
} }
} }
} }
@ -474,7 +489,7 @@ AcpiDsLoad2BeginOp (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: AcpiDsLoad2EndOp * FUNCTION: AcpiDsLoad2EndOp
* *
@ -487,25 +502,26 @@ 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; OBJECT_TYPE_INTERNAL DataType;
ACPI_NAMED_OBJECT *Entry; ACPI_NAMESPACE_NODE *Node;
ACPI_GENERIC_OP *Arg; ACPI_PARSE_OBJECT *Arg;
ACPI_NAMED_OBJECT *NewEntry; ACPI_NAMESPACE_NODE *NewNode;
DEBUG_PRINT (TRACE_DISPATCH, ("Load2EndOp: Op=%p State=%p\n", Op, WalkState)); DEBUG_PRINT (TRACE_DISPATCH,
("Load2EndOp: Op=%p State=%p\n", Op, WalkState));
if (!AcpiPsIsNamespaceObjectOp (Op->Opcode)) if (!AcpiPsIsNamespaceObjectOp (Op->Opcode))
{ {
return AE_OK; return (AE_OK);
} }
if (Op->Opcode == AML_SCOPE_OP) if (Op->Opcode == AML_SCOPE_OP)
@ -513,12 +529,12 @@ AcpiDsLoad2EndOp (
DEBUG_PRINT (TRACE_DISPATCH, DEBUG_PRINT (TRACE_DISPATCH,
("Load2EndOp: ending scope Op=%p State=%p\n", Op, WalkState)); ("Load2EndOp: ending scope Op=%p State=%p\n", Op, WalkState));
if (((ACPI_NAMED_OP *)Op)->Name == -1) if (((ACPI_PARSE2_OBJECT *)Op)->Name == -1)
{ {
DEBUG_PRINT (ACPI_ERROR, DEBUG_PRINT (ACPI_ERROR,
("Load2EndOp: Un-named scope! Op=%p State=%p\n", Op, ("Load2EndOp: Un-named scope! Op=%p State=%p\n", Op,
WalkState)); WalkState));
return AE_OK; return (AE_OK);
} }
} }
@ -526,17 +542,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->AcpiNamedObject; Node = Op->Node;
/* /*
* Put the NTE on the object stack (Contains the ACPI Name of * Put the Node on the object stack (Contains the ACPI Name of
* this object) * 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 */
@ -574,6 +590,7 @@ AcpiDsLoad2EndOp (
* AML_CREATEBYTEFIELD * AML_CREATEBYTEFIELD
* AML_CREATEWORDFIELD * AML_CREATEWORDFIELD
* AML_CREATEDWORDFIELD * AML_CREATEDWORDFIELD
* AML_CREATEQWORDFIELD
* AML_METHODCALL * AML_METHODCALL
*/ */
@ -586,14 +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:
/*
* Create the field object, but the field buffer and index must
* be evaluated later during the execution phase
*/
DEBUG_PRINT (TRACE_DISPATCH, DEBUG_PRINT (TRACE_DISPATCH,
("LOADING-CreateXxxField: State=%p Op=%p nte=%p\n", ("LOADING-CreateXxxField: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, Entry)); WalkState, Op, Node));
/* Get the NameString argument */ /* Get the NameString argument */
@ -608,57 +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, INTERNAL_TYPE_DEF_ANY, IMODE_LOAD_PASS1,
Arg->Value.String,
INTERNAL_TYPE_DEF_ANY,
IMODE_LOAD_PASS1,
NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
WalkState, &(NewEntry)); WalkState, &(NewNode));
if (ACPI_FAILURE (Status))
if (ACPI_SUCCESS (Status))
{ {
/* We could put the returned object (NTE) on the object stack for later, but goto Cleanup;
* 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;
} }
/* 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->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 = AcpiAmlExecCreateField (((ACPI_PARSE2_OBJECT *) Op)->Data,
((ACPI_PARSE2_OBJECT *) Op)->Length,
NewNode, WalkState);
}
break; break;
case AML_METHODCALL_OP: case AML_METHODCALL_OP:
DEBUG_PRINT (TRACE_DISPATCH, DEBUG_PRINT (TRACE_DISPATCH,
("RESOLVING-MethodCall: State=%p Op=%p nte=%p\n", ("RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, Entry)); 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, Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String,
ACPI_TYPE_ANY, IMODE_LOAD_PASS2, ACPI_TYPE_ANY, IMODE_LOAD_PASS2,
NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE,
WalkState, &(NewEntry)); 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->AcpiNamedObject = NewEntry; Op->Node = NewNode;
} }
@ -670,10 +712,10 @@ AcpiDsLoad2EndOp (
/* Nothing to do other than enter object into namespace */ /* Nothing to do other than enter object into namespace */
DEBUG_PRINT (TRACE_DISPATCH, DEBUG_PRINT (TRACE_DISPATCH,
("LOADING-Processor: State=%p Op=%p nte=%p\n", ("LOADING-Processor: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, Entry)); WalkState, Op, Node));
Status = AcpiAmlExecCreateProcessor (Op, (ACPI_HANDLE) Entry); Status = AcpiAmlExecCreateProcessor (Op, Node);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
goto Cleanup; goto Cleanup;
@ -681,7 +723,7 @@ AcpiDsLoad2EndOp (
DEBUG_PRINT (TRACE_DISPATCH, DEBUG_PRINT (TRACE_DISPATCH,
("Completed Processor Init, Op=%p State=%p entry=%p\n", ("Completed Processor Init, Op=%p State=%p entry=%p\n",
Op, WalkState, Entry)); Op, WalkState, Node));
break; break;
@ -690,10 +732,10 @@ AcpiDsLoad2EndOp (
/* Nothing to do other than enter object into namespace */ /* Nothing to do other than enter object into namespace */
DEBUG_PRINT (TRACE_DISPATCH, DEBUG_PRINT (TRACE_DISPATCH,
("LOADING-PowerResource: State=%p Op=%p nte=%p\n", ("LOADING-PowerResource: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, Entry)); WalkState, Op, Node));
Status = AcpiAmlExecCreatePowerResource (Op, (ACPI_HANDLE) Entry); Status = AcpiAmlExecCreatePowerResource (Op, Node);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
goto Cleanup; goto Cleanup;
@ -701,7 +743,7 @@ AcpiDsLoad2EndOp (
DEBUG_PRINT (TRACE_DISPATCH, DEBUG_PRINT (TRACE_DISPATCH,
("Completed PowerResource Init, Op=%p State=%p entry=%p\n", ("Completed PowerResource Init, Op=%p State=%p entry=%p\n",
Op, WalkState, Entry)); Op, WalkState, Node));
break; break;
@ -710,35 +752,32 @@ AcpiDsLoad2EndOp (
/* Nothing to do other than enter object into namespace */ /* Nothing to do other than enter object into namespace */
DEBUG_PRINT (TRACE_DISPATCH, DEBUG_PRINT (TRACE_DISPATCH,
("LOADING-ThermalZone: State=%p Op=%p nte=%p\n", ("LOADING-ThermalZone: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, Entry)); WalkState, Op, Node));
break; break;
case AML_DEF_FIELD_OP: case AML_FIELD_OP:
DEBUG_PRINT (TRACE_DISPATCH, DEBUG_PRINT (TRACE_DISPATCH,
("LOADING-Field: State=%p Op=%p nte=%p\n", ("LOADING-Field: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, Entry)); WalkState, Op, Node));
Arg = Op->Value.Arg; Arg = Op->Value.Arg;
Status = AcpiDsCreateField (Op, Status = AcpiDsCreateField (Op, Arg->Node, WalkState);
(ACPI_HANDLE) Arg->AcpiNamedObject,
WalkState);
break; break;
case AML_INDEX_FIELD_OP: case AML_INDEX_FIELD_OP:
DEBUG_PRINT (TRACE_DISPATCH, DEBUG_PRINT (TRACE_DISPATCH,
("LOADING-IndexField: State=%p Op=%p nte=%p\n", ("LOADING-IndexField: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, Entry)); WalkState, Op, Node));
Arg = Op->Value.Arg; Arg = Op->Value.Arg;
Status = AcpiDsCreateIndexField (Op, Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->Node,
(ACPI_HANDLE) Arg->AcpiNamedObject,
WalkState); WalkState);
break; break;
@ -746,13 +785,11 @@ AcpiDsLoad2EndOp (
case AML_BANK_FIELD_OP: case AML_BANK_FIELD_OP:
DEBUG_PRINT (TRACE_DISPATCH, DEBUG_PRINT (TRACE_DISPATCH,
("LOADING-BankField: State=%p Op=%p nte=%p\n", ("LOADING-BankField: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, Entry)); WalkState, Op, Node));
Arg = Op->Value.Arg; Arg = Op->Value.Arg;
Status = AcpiDsCreateBankField (Op, Status = AcpiDsCreateBankField (Op, Arg->Node, WalkState);
(ACPI_HANDLE) Arg->AcpiNamedObject,
WalkState);
break; break;
@ -762,14 +799,14 @@ AcpiDsLoad2EndOp (
case AML_METHOD_OP: case AML_METHOD_OP:
DEBUG_PRINT (TRACE_DISPATCH, DEBUG_PRINT (TRACE_DISPATCH,
("LOADING-Method: State=%p Op=%p nte=%p\n", ("LOADING-Method: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, Entry)); WalkState, Op, Node));
if (!Entry->Object) if (!Node->Object)
{ {
Status = AcpiAmlExecCreateMethod (((ACPI_DEFERRED_OP *) Op)->Body, Status = AcpiAmlExecCreateMethod (((ACPI_PARSE2_OBJECT *) Op)->Data,
((ACPI_DEFERRED_OP *) Op)->BodyLength, ((ACPI_PARSE2_OBJECT *) Op)->Length,
Arg->Value.Integer, (ACPI_HANDLE) Entry); Arg->Value.Integer, Node);
} }
break; break;
@ -807,8 +844,13 @@ AcpiDsLoad2EndOp (
case AML_REGION_OP: case AML_REGION_OP:
if (Node->Object)
{
break;
}
DEBUG_PRINT (TRACE_DISPATCH, DEBUG_PRINT (TRACE_DISPATCH,
("LOADING-Opregion: Op=%p State=%p Nte=%p\n", Op, WalkState, Entry)); ("LOADING-Opregion: Op=%p State=%p NamedObj=%p\n", Op, WalkState, Node));
/* /*
@ -816,13 +858,14 @@ AcpiDsLoad2EndOp (
* (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 = AcpiAmlExecCreateRegion (((ACPI_DEFERRED_OP *) Op)->Body, Status = AcpiAmlExecCreateRegion (((ACPI_PARSE2_OBJECT *) Op)->Data,
((ACPI_DEFERRED_OP *) Op)->BodyLength, ((ACPI_PARSE2_OBJECT *) Op)->Length,
Arg->Value.Integer, WalkState); (ACPI_ADDRESS_SPACE_TYPE) Arg->Value.Integer,
WalkState);
DEBUG_PRINT (TRACE_DISPATCH, DEBUG_PRINT (TRACE_DISPATCH,
("Completed OpRegion Init, Op=%p State=%p entry=%p\n", ("Completed OpRegion Init, Op=%p State=%p entry=%p\n",
Op, WalkState, Entry)); Op, WalkState, Node));
break; break;
@ -848,7 +891,16 @@ AcpiDsLoad2EndOp (
DEBUG_PRINT (TRACE_DISPATCH, DEBUG_PRINT (TRACE_DISPATCH,
("LOADING-Name: Op=%p State=%p\n", Op, WalkState)); ("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;
@ -856,8 +908,8 @@ AcpiDsLoad2EndOp (
case AML_NAMEPATH_OP: case AML_NAMEPATH_OP:
DEBUG_PRINT (TRACE_DISPATCH, DEBUG_PRINT (TRACE_DISPATCH,
("LOADING-NamePath object: State=%p Op=%p nte=%p\n", ("LOADING-NamePath object: State=%p Op=%p NamedObj=%p\n",
WalkState, Op, Entry)); WalkState, Op, Node));
break; break;
@ -867,8 +919,11 @@ AcpiDsLoad2EndOp (
Cleanup: Cleanup:
/* Remove the NTE pushed at the very beginning */
/* Remove the Node pushed at the very beginning */
AcpiDsObjStackPop (1, WalkState); AcpiDsObjStackPop (1, WalkState);
return (Status); return (Status);
} }