diff --git a/source/components/dispatcher/dsutils.c b/source/components/dispatcher/dsutils.c index a16f4ed25..44a2ca6c3 100644 --- a/source/components/dispatcher/dsutils.c +++ b/source/components/dispatcher/dsutils.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dsutils - Dispatcher utilities - * $Revision: 1.97 $ + * $Revision: 1.98 $ * ******************************************************************************/ @@ -445,7 +445,7 @@ AcpiDsCreateOperand ( UINT32 ArgIndex) { ACPI_STATUS Status = AE_OK; - NATIVE_CHAR *NameString; + char *NameString; UINT32 NameLength; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_PARSE_OBJECT *ParentOp; diff --git a/source/components/dispatcher/dswload.c b/source/components/dispatcher/dswload.c index 400afac27..c33db9503 100644 --- a/source/components/dispatcher/dswload.c +++ b/source/components/dispatcher/dswload.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dswload - Dispatcher namespace load callbacks - * $Revision: 1.56 $ + * $Revision: 1.82 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp. * All rights reserved. * * 2. License @@ -126,7 +126,7 @@ #define _COMPONENT ACPI_DISPATCHER - MODULE_NAME ("dswload") + ACPI_MODULE_NAME ("dswload") /******************************************************************************* @@ -163,9 +163,11 @@ AcpiDsInitCallbacks ( break; case 3: +#ifndef ACPI_NO_METHOD_EXECUTION WalkState->ParseFlags |= ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE; WalkState->DescendingCallback = AcpiDsExecBeginOp; WalkState->AscendingCallback = AcpiDsExecEndOp; +#endif break; default: @@ -198,34 +200,39 @@ AcpiDsLoad1BeginOp ( ACPI_PARSE_OBJECT *Op; ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; - ACPI_OBJECT_TYPE8 ObjectType; - NATIVE_CHAR *Path; + ACPI_OBJECT_TYPE ObjectType; + char *Path; + UINT32 Flags; - PROC_NAME ("DsLoad1BeginOp"); + ACPI_FUNCTION_NAME ("DsLoad1BeginOp"); + Op = WalkState->Op; ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); - - if (Op && (Op->Opcode == AML_INT_NAMEDFIELD_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 (WalkState->Op) + if (Op) { - if (!(WalkState->OpInfo->Flags & AML_NAMED)) + if (!(WalkState->OpInfo->Flags & AML_NAMED)) { +#if 0 + if ((WalkState->OpInfo->Class == AML_CLASS_EXECUTE) || + (WalkState->OpInfo->Class == AML_CLASS_CONTROL)) + { + AcpiOsPrintf ("\n\n***EXECUTABLE OPCODE %s***\n\n", WalkState->OpInfo->Name); + *OutOp = Op; + return (AE_CTRL_SKIP); + } +#endif *OutOp = Op; return (AE_OK); } /* Check if this object has already been installed in the namespace */ - if (Op->Node) + if (Op->Common.Node) { *OutOp = Op; return (AE_OK); @@ -239,21 +246,120 @@ AcpiDsLoad1BeginOp ( ObjectType = WalkState->OpInfo->ObjectType; ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "State=%p Op=%p Type=%x\n", WalkState, Op, ObjectType)); + "State=%p Op=%p [%s] ", WalkState, Op, AcpiUtGetTypeName (ObjectType))); - /* - * 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 - * arguments to the opcode must be created as we go back up the parse tree later. - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, - IMODE_LOAD_PASS1, NS_NO_UPSEARCH, WalkState, &(Node)); - - if (ACPI_FAILURE (Status)) + switch (WalkState->Opcode) { - return (Status); + case AML_SCOPE_OP: + + /* + * The target name of the Scope() operator must exist at this point so + * that we can actually open the scope to enter new names underneath it. + * Allow search-to-root for single namesegs. + */ + Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, + ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node)); + if (ACPI_FAILURE (Status)) + { + ACPI_REPORT_NSERROR (Path, Status); + return (Status); + } + + /* + * Check to make sure that the target is + * one of the opcodes that actually opens a scope + */ + switch (Node->Type) + { + case ACPI_TYPE_LOCAL_SCOPE: /* Scope */ + case ACPI_TYPE_DEVICE: + case ACPI_TYPE_POWER: + case ACPI_TYPE_PROCESSOR: + case ACPI_TYPE_THERMAL: + + /* These are acceptable types */ + break; + + case ACPI_TYPE_INTEGER: + case ACPI_TYPE_STRING: + case ACPI_TYPE_BUFFER: + + /* + * These types we will allow, but we will change the type. This + * enables some existing code of the form: + * + * Name (DEB, 0) + * Scope (DEB) { ... } + * + * Note: silently change the type here. On the second pass, we will report a warning + */ + + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", + Path, AcpiUtGetTypeName (Node->Type))); + + Node->Type = ACPI_TYPE_ANY; + WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY; + break; + + default: + + /* All other types are an error */ + + ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n", + AcpiUtGetTypeName (Node->Type), Path)); + + return (AE_AML_OPERAND_TYPE); + } + break; + + + default: + + /* + * For all other named opcodes, we will enter the name into the namespace. + * + * Setup the search flags. + * Since we are entering a name into the namespace, we do not want to + * enable the search-to-root upsearch. + * + * There are only two conditions where it is acceptable that the name + * already exists: + * 1) the Scope() operator can reopen a scoping object that was + * previously defined (Scope, Method, Device, etc.) + * 2) Whenever we are parsing a deferred opcode (OpRegion, Buffer, + * BufferField, or Package), the name of the object is already + * in the namespace. + */ + Flags = ACPI_NS_NO_UPSEARCH; + if ((WalkState->Opcode != AML_SCOPE_OP) && + (!(WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP))) + { + Flags |= ACPI_NS_ERROR_IF_FOUND; + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "Cannot already exist\n")); + } + else + { + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "Both Find or Create allowed\n")); + } + + /* + * 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 + * arguments to the opcode must be created as we go back up the parse tree later. + */ + Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, + ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &(Node)); + if (ACPI_FAILURE (Status)) + { + ACPI_REPORT_NSERROR (Path, Status); + return (Status); + } + break; } + + /* Common exit */ + if (!Op) { /* Create a new op */ @@ -267,13 +373,18 @@ AcpiDsLoad1BeginOp ( /* Initialize */ - ((ACPI_PARSE2_OBJECT *)Op)->Name = Node->Name; + Op->Named.Name = Node->Name.Integer; + +#if (defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)) + Op->Named.Path = (UINT8 *) Path; +#endif + /* * 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; + Op->Common.Node = Node; AcpiPsAppendArg (AcpiPsGetParentScope (&WalkState->ParserState), Op); *OutOp = Op; @@ -301,15 +412,16 @@ AcpiDsLoad1EndOp ( ACPI_WALK_STATE *WalkState) { ACPI_PARSE_OBJECT *Op; - ACPI_OBJECT_TYPE8 ObjectType; + ACPI_OBJECT_TYPE ObjectType; + ACPI_STATUS Status = AE_OK; - PROC_NAME ("DsLoad1EndOp"); + ACPI_FUNCTION_NAME ("DsLoad1EndOp"); + 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 (!(WalkState->OpInfo->Flags & (AML_NAMED | AML_FIELD))) @@ -321,33 +433,73 @@ AcpiDsLoad1EndOp ( ObjectType = WalkState->OpInfo->ObjectType; +#ifndef ACPI_NO_METHOD_EXECUTION if (WalkState->OpInfo->Flags & AML_FIELD) { if (WalkState->Opcode == AML_FIELD_OP || WalkState->Opcode == AML_BANK_FIELD_OP || WalkState->Opcode == AML_INDEX_FIELD_OP) { - AcpiDsInitFieldObjects (Op, WalkState); + Status = AcpiDsInitFieldObjects (Op, WalkState); } - return (AE_OK); + return (Status); } - if (Op->Opcode == AML_REGION_OP) + if (Op->Common.AmlOpcode == AML_REGION_OP) { - /*Status = */AcpiExCreateRegion (((ACPI_PARSE2_OBJECT *) Op)->Data, - ((ACPI_PARSE2_OBJECT *) Op)->Length, - (ACPI_ADR_SPACE_TYPE) ((Op->Value.Arg)->Value.Integer), WalkState); + Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, + (ACPI_ADR_SPACE_TYPE) ((Op->Common.Value.Arg)->Common.Value.Integer), WalkState); + if (ACPI_FAILURE (Status)) + { + return (Status); + } } +#endif - if (Op->Opcode == AML_NAME_OP) + if (Op->Common.AmlOpcode == AML_NAME_OP) { /* For Name opcode, get the object type from the argument */ - if (Op->Value.Arg) + if (Op->Common.Value.Arg) { - ObjectType = (AcpiPsGetOpcodeInfo ((Op->Value.Arg)->Opcode))->ObjectType; - Op->Node->Type = (UINT8) ObjectType; + ObjectType = (AcpiPsGetOpcodeInfo ((Op->Common.Value.Arg)->Common.AmlOpcode))->ObjectType; + Op->Common.Node->Type = (UINT8) ObjectType; + } + } + + if (Op->Common.AmlOpcode == AML_METHOD_OP) + { + /* + * MethodOp PkgLength NameString MethodFlags TermList + * + * Note: We must create the method node/object pair as soon as we + * see the method declaration. This allows later pass1 parsing + * of invocations of the method (need to know the number of + * arguments.) + */ + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "LOADING-Method: State=%p Op=%p NamedObj=%p\n", + WalkState, Op, Op->Named.Node)); + + if (!AcpiNsGetAttachedObject (Op->Named.Node)) + { + WalkState->Operands[0] = (void *) Op->Named.Node; + WalkState->NumOperands = 1; + + Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg); + if (ACPI_SUCCESS (Status)) + { + Status = AcpiExCreateMethod (Op->Named.Data, + Op->Named.Length, WalkState); + } + WalkState->Operands[0] = NULL; + WalkState->NumOperands = 0; + + if (ACPI_FAILURE (Status)) + { + return (Status); + } } } @@ -358,10 +510,10 @@ AcpiDsLoad1EndOp ( ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n", AcpiUtGetTypeName (ObjectType), Op)); - AcpiDsScopeStackPop (WalkState); + Status = AcpiDsScopeStackPop (WalkState); } - return (AE_OK); + return (Status); } @@ -387,32 +539,24 @@ AcpiDsLoad2BeginOp ( ACPI_PARSE_OBJECT *Op; ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; - ACPI_OBJECT_TYPE8 ObjectType; - NATIVE_CHAR *BufferPtr; - void *Original = NULL; + ACPI_OBJECT_TYPE ObjectType; + char *BufferPtr; - PROC_NAME ("DsLoad2BeginOp"); + ACPI_FUNCTION_TRACE ("DsLoad2BeginOp"); + Op = WalkState->Op; ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); - if (Op) { /* We only care about Namespace opcodes here */ - if (!(WalkState->OpInfo->Flags & AML_NSOPCODE) && - WalkState->Opcode != AML_INT_NAMEPATH_OP) + if ((!(WalkState->OpInfo->Flags & AML_NSOPCODE) && (WalkState->Opcode != AML_INT_NAMEPATH_OP)) || + (!(WalkState->OpInfo->Flags & AML_NAMED))) { - return (AE_OK); - } - - /* TBD: [Restructure] Temp! same code as in psparse */ - - if (!(WalkState->OpInfo->Flags & AML_NAMED)) - { - return (AE_OK); + return_ACPI_STATUS (AE_OK); } /* @@ -422,70 +566,134 @@ AcpiDsLoad2BeginOp ( { /* For Namepath op, get the path string */ - BufferPtr = Op->Value.String; + BufferPtr = Op->Common.Value.String; if (!BufferPtr) { /* No name, just exit */ - return (AE_OK); + return_ACPI_STATUS (AE_OK); } } else { /* Get name from the op */ - BufferPtr = (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Op)->Name; + BufferPtr = (char *) &Op->Named.Name; } } else { + /* Get the namestring from the raw AML */ + BufferPtr = AcpiPsGetNextNamestring (&WalkState->ParserState); } - - /* Map the raw opcode into an internal object type */ + /* Map the opcode into an internal object type */ ObjectType = WalkState->OpInfo->ObjectType; ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "State=%p Op=%p Type=%x\n", WalkState, Op, ObjectType)); + "State=%p Op=%p Type=%X\n", WalkState, Op, ObjectType)); - if (WalkState->Opcode == AML_FIELD_OP || - WalkState->Opcode == AML_BANK_FIELD_OP || - WalkState->Opcode == AML_INDEX_FIELD_OP) + switch (WalkState->Opcode) { + case AML_FIELD_OP: + case AML_BANK_FIELD_OP: + case AML_INDEX_FIELD_OP: + Node = NULL; Status = AE_OK; - } + break; + + case 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, ObjectType, - IMODE_EXECUTE, NS_SEARCH_PARENT, WalkState, &(Node)); - } + ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node)); + break; - else - { - if (Op && Op->Node) + case AML_SCOPE_OP: + + /* + * The Path 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, ObjectType, + ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node)); + if (ACPI_FAILURE (Status)) { - Original = Op->Node; - Node = Op->Node; + ACPI_REPORT_NSERROR (BufferPtr, Status); + return_ACPI_STATUS (Status); + } + /* + * We must check to make sure that the target is + * one of the opcodes that actually opens a scope + */ + switch (Node->Type) + { + case ACPI_TYPE_LOCAL_SCOPE: /* Scope */ + case ACPI_TYPE_DEVICE: + case ACPI_TYPE_POWER: + case ACPI_TYPE_PROCESSOR: + case ACPI_TYPE_THERMAL: + + /* These are acceptable types */ + break; + + case ACPI_TYPE_INTEGER: + case ACPI_TYPE_STRING: + case ACPI_TYPE_BUFFER: + + /* + * These types we will allow, but we will change the type. This + * enables some existing code of the form: + * + * Name (DEB, 0) + * Scope (DEB) { ... } + */ + + ACPI_REPORT_WARNING (("Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", + BufferPtr, AcpiUtGetTypeName (Node->Type))); + + Node->Type = ACPI_TYPE_ANY; + WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY; + break; + + default: + + /* All other types are an error */ + + ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s]\n", + AcpiUtGetTypeName (Node->Type), BufferPtr)); + + return (AE_AML_OPERAND_TYPE); + } + break; + + default: + + /* All other opcodes */ + + if (Op && Op->Common.Node) + { + /* This op/node was previously entered into the namespace */ + + Node = Op->Common.Node; if (AcpiNsOpensScope (ObjectType)) { Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } } - return (AE_OK); + return_ACPI_STATUS (AE_OK); } /* @@ -494,46 +702,46 @@ AcpiDsLoad2BeginOp ( * arguments to the opcode must be created as we go back up the parse tree later. */ Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, - IMODE_EXECUTE, NS_NO_UPSEARCH, WalkState, &(Node)); + ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, WalkState, &(Node)); + break; } - if (ACPI_SUCCESS (Status)) + if (ACPI_FAILURE (Status)) { + ACPI_REPORT_NSERROR (BufferPtr, Status); + return_ACPI_STATUS (Status); + } + + + if (!Op) + { + /* Create a new op */ + + Op = AcpiPsAllocOp (WalkState->Opcode); if (!Op) { - /* Create a new op */ - - Op = AcpiPsAllocOp (WalkState->Opcode); - if (!Op) - { - return (AE_NO_MEMORY); - } - - /* Initialize */ - - ((ACPI_PARSE2_OBJECT *)Op)->Name = Node->Name; - *OutOp = Op; + return_ACPI_STATUS (AE_NO_MEMORY); } - /* - * 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; + /* Initialize the new op */ - if (Original) + if (Node) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "old %p new %p\n", Original, Node)); - - if (Original != Node) - { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Lookup match error: old %p new %p\n", Original, Node)); - } + Op->Named.Name = Node->Name.Integer; + } + if (OutOp) + { + *OutOp = Op; } } - return (Status); + /* + * Put the Node in the "op" object that the parser uses, so we + * can get it again quickly when this scope is closed + */ + Op->Common.Node = Node; + + return_ACPI_STATUS (Status); } @@ -558,37 +766,32 @@ AcpiDsLoad2EndOp ( { ACPI_PARSE_OBJECT *Op; ACPI_STATUS Status = AE_OK; - ACPI_OBJECT_TYPE8 ObjectType; + ACPI_OBJECT_TYPE ObjectType; ACPI_NAMESPACE_NODE *Node; ACPI_PARSE_OBJECT *Arg; ACPI_NAMESPACE_NODE *NewNode; +#ifndef ACPI_NO_METHOD_EXECUTION UINT32 i; +#endif - PROC_NAME ("DsLoad2EndOp"); + ACPI_FUNCTION_TRACE ("DsLoad2EndOp"); Op = WalkState->Op; - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%4.4X] Op %p State %p\n", - Op->Opcode, Op, WalkState)); + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", + WalkState->OpInfo->Name, Op, WalkState)); /* Only interested in opcodes that have namespace objects */ if (!(WalkState->OpInfo->Flags & AML_NSOBJECT)) { - return (AE_OK); + return_ACPI_STATUS (AE_OK); } - if (Op->Opcode == AML_SCOPE_OP) + if (Op->Common.AmlOpcode == AML_SCOPE_OP) { ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Ending scope Op=%p State=%p\n", Op, WalkState)); - - if (((ACPI_PARSE2_OBJECT *)Op)->Name == ACPI_UINT16_MAX) - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unnamed scope! Op=%p State=%p\n", - Op, WalkState)); - return (AE_OK); - } } @@ -598,7 +801,7 @@ AcpiDsLoad2EndOp ( * Get the Node/name from the earlier lookup * (It was saved in the *op structure) */ - Node = Op->Node; + Node = Op->Common.Node; /* * Put the Node on the object stack (Contains the ACPI Name of @@ -609,11 +812,16 @@ AcpiDsLoad2EndOp ( /* Pop the scope stack */ - if (AcpiNsOpensScope (ObjectType)) + if (AcpiNsOpensScope (ObjectType) && (Op->Common.AmlOpcode != AML_INT_METHODCALL_OP)) { ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", AcpiUtGetTypeName (ObjectType), Op)); - AcpiDsScopeStackPop (WalkState); + + Status = AcpiDsScopeStackPop (WalkState); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } } /* @@ -646,14 +854,16 @@ AcpiDsLoad2EndOp ( ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Create-Load [%s] State=%p Op=%p NamedObj=%p\n", - AcpiPsGetOpcodeName (Op->Opcode), WalkState, Op, Node)); + AcpiPsGetOpcodeName (Op->Common.AmlOpcode), WalkState, Op, Node)); /* Decode the opcode */ - Arg = Op->Value.Arg; + Arg = Op->Common.Value.Arg; switch (WalkState->OpInfo->Type) { +#ifndef ACPI_NO_METHOD_EXECUTION + case AML_TYPE_CREATE_FIELD: /* @@ -666,22 +876,26 @@ AcpiDsLoad2EndOp ( case AML_TYPE_NAMED_FIELD: - switch (Op->Opcode) + switch (Op->Common.AmlOpcode) { case AML_INDEX_FIELD_OP: - Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->Node, + Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->Common.Node, WalkState); break; case AML_BANK_FIELD_OP: - Status = AcpiDsCreateBankField (Op, Arg->Node, WalkState); + Status = AcpiDsCreateBankField (Op, Arg->Common.Node, WalkState); break; case AML_FIELD_OP: - Status = AcpiDsCreateField (Op, Arg->Node, WalkState); + Status = AcpiDsCreateField (Op, Arg->Common.Node, WalkState); + break; + + default: + /* All NAMED_FIELD opcodes must be handled above */ break; } break; @@ -695,7 +909,7 @@ AcpiDsLoad2EndOp ( goto Cleanup; } - switch (Op->Opcode) + switch (Op->Common.AmlOpcode) { case AML_PROCESSOR_OP: @@ -743,35 +957,13 @@ AcpiDsLoad2EndOp ( } break; - +#endif /* ACPI_NO_METHOD_EXECUTION */ case AML_TYPE_NAMED_COMPLEX: - switch (Op->Opcode) + switch (Op->Common.AmlOpcode) { - case AML_METHOD_OP: - /* - * MethodOp PkgLength NameString MethodFlags TermList - */ - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "LOADING-Method: State=%p Op=%p NamedObj=%p\n", - WalkState, Op, Node)); - - if (!AcpiNsGetAttachedObject (Node)) - { - Status = AcpiDsCreateOperands (WalkState, Arg); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - Status = AcpiExCreateMethod (((ACPI_PARSE2_OBJECT *) Op)->Data, - ((ACPI_PARSE2_OBJECT *) Op)->Length, - WalkState); - } - break; - - +#ifndef ACPI_NO_METHOD_EXECUTION case AML_REGION_OP: /* * The OpRegion is not fully parsed at this time. Only valid argument is the SpaceId. @@ -801,6 +993,13 @@ AcpiDsLoad2EndOp ( Status = AcpiDsCreateNode (WalkState, Node, Op); break; +#endif /* ACPI_NO_METHOD_EXECUTION */ + + + default: + /* All NAMED_COMPLEX opcodes must be handled above */ + /* Note: Method objects were already created in Pass 1 */ + break; } break; @@ -820,13 +1019,13 @@ AcpiDsLoad2EndOp ( /* * 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, + Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, + ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2, + ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(NewNode)); if (ACPI_SUCCESS (Status)) { - /* + /* * 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 */ @@ -839,9 +1038,12 @@ AcpiDsLoad2EndOp ( * 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; + Op->Common.Node = NewNode; + } + else + { + ACPI_REPORT_NSERROR (Arg->Common.Value.String, Status); } - break; @@ -849,14 +1051,13 @@ AcpiDsLoad2EndOp ( break; } - Cleanup: /* Remove the Node pushed at the very beginning */ WalkState->Operands[0] = NULL; WalkState->NumOperands = 0; - return (Status); + return_ACPI_STATUS (Status); }