From 59ecaf870fefcfa2da933988cb444bc327ef0360 Mon Sep 17 00:00:00 2001 From: aystarik Date: Wed, 29 Jun 2005 17:09:01 +0000 Subject: [PATCH] Remove non-ANSI (//) Comments date 2000.06.19.21.46.00; author rmoore1; state Exp; --- source/components/dispatcher/dsutils.c | 264 ++++---- source/components/dispatcher/dswexec.c | 218 ++++--- source/components/dispatcher/dswload.c | 848 +++++++++++-------------- source/components/executer/exconfig.c | 76 +-- 4 files changed, 652 insertions(+), 754 deletions(-) diff --git a/source/components/dispatcher/dsutils.c b/source/components/dispatcher/dsutils.c index 8e1fe3727..95af928b2 100644 --- a/source/components/dispatcher/dsutils.c +++ b/source/components/dispatcher/dsutils.c @@ -1,6 +1,6 @@ /****************************************************************************** - * + * * Module Name: dsutils - Dispatcher utilities * *****************************************************************************/ @@ -38,9 +38,9 @@ * The above copyright and patent license is granted only if the following * conditions are met: * - * 3. Conditions + * 3. Conditions * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * 3.1. Redistribution of Source with Rights to Further Distribute Source. * Redistribution of source code of any substantial portion of the Covered * Code or modification with rights to further distribute source must include * the above Copyright Notice, the above License, this list of Conditions, @@ -48,11 +48,11 @@ * Licensee must cause all Covered Code to which Licensee contributes to * contain a file documenting the changes Licensee made to create that Covered * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee + * documentation of any changes made by any predecessor Licensee. Licensee * must include a prominent statement that the modification is derived, * directly or indirectly, from Original Intel Code. * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. * Redistribution of source code of any substantial portion of the Covered * Code or modification without rights to further distribute source must * include the following Disclaimer and Export Compliance provision in the @@ -86,7 +86,7 @@ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. + * PARTICULAR PURPOSE. * * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR @@ -116,13 +116,13 @@ #define __DSUTILS_C__ -#include -#include -#include -#include -#include -#include -#include +#include "acpi.h" +#include "parser.h" +#include "amlcode.h" +#include "dispatch.h" +#include "interp.h" +#include "namesp.h" +#include "debugger.h" #define _COMPONENT PARSER MODULE_NAME ("dsutils"); @@ -131,7 +131,7 @@ /***************************************************************************** * - * FUNCTION: DsDeleteResultIfNotUsed + * FUNCTION: AcpiDsDeleteResultIfNotUsed * * PARAMETERS: Op * ResultObj @@ -141,13 +141,13 @@ * * DESCRIPTION: Used after interpretation of an opcode. If there is an internal * result descriptor, check if the parent opcode will actually use - * this result. If not, delete the result now so that it will + * this result. If not, delete the result now so that it will * not become orphaned. * ****************************************************************************/ void -DsDeleteResultIfNotUsed ( +AcpiDsDeleteResultIfNotUsed ( ACPI_GENERIC_OP *Op, ACPI_OBJECT_INTERNAL *ResultObj, ACPI_WALK_STATE *WalkState) @@ -174,30 +174,30 @@ DsDeleteResultIfNotUsed ( if (!Op->Parent) { - /* + /* * If there is no parent, the result can't possibly be used! * (An executing method typically has no parent, since each method is parsed separately */ /* Must pop the result stack (ObjDesc should be equal to ResultObj) */ - Status = DsResultStackPop (&ObjDesc, WalkState); + Status = AcpiDsResultStackPop (&ObjDesc, WalkState); if (ACPI_FAILURE (Status)) { return; } - CmDeleteInternalObject (ResultObj); + AcpiCmRemoveReference (ResultObj); return_VOID; } /* - * Get info on the parent. The root Op is AML_Scope + * Get info on the parent. The root Op is AML_SCOPE */ - ParentInfo = PsGetOpcodeInfo (Op->Parent->Opcode); + ParentInfo = AcpiPsGetOpcodeInfo (Op->Parent->Opcode); if (!ParentInfo) { DEBUG_PRINT (ACPI_ERROR, ("DsDeleteResultIfNotUsed: Unknown parent opcode. Op=%X\n", @@ -209,7 +209,7 @@ DsDeleteResultIfNotUsed ( /* Never delete the return value associated with a return opcode */ - if (Op->Parent->Opcode == AML_ReturnOp) + if (Op->Parent->Opcode == AML_RETURN_OP) { DEBUG_PRINT (TRACE_DISPATCH, ("DsDeleteResultIfNotUsed: No delete, [RETURN] opcode=%X Op=%X\n", Op->Opcode, Op)); @@ -226,7 +226,7 @@ DsDeleteResultIfNotUsed ( switch (ParentInfo->Flags & OP_INFO_TYPE) { /* - * In these cases, the parent will never use the return object, so delete it + * In these cases, the parent will never use the return object, so delete it * here and now. */ case OPTYPE_CONTROL: /* IF, ELSE, WHILE only */ @@ -237,16 +237,16 @@ DsDeleteResultIfNotUsed ( /* Must pop the result stack (ObjDesc should be equal to ResultObj) */ - Status = DsResultStackPop (&ObjDesc, WalkState); + Status = AcpiDsResultStackPop (&ObjDesc, WalkState); if (ACPI_FAILURE (Status)) { return_VOID; } - CmDeleteInternalObject (ResultObj); + AcpiCmRemoveReference (ResultObj); break; - /* + /* * In all other cases. the parent will actually use the return object, so keep it. */ default: @@ -261,7 +261,7 @@ DsDeleteResultIfNotUsed ( /***************************************************************************** * - * FUNCTION: DsCreateOperand + * FUNCTION: AcpiDsCreateOperand * * PARAMETERS: WalkState * Arg @@ -276,14 +276,14 @@ DsDeleteResultIfNotUsed ( ****************************************************************************/ ACPI_STATUS -DsCreateOperand ( +AcpiDsCreateOperand ( ACPI_WALK_STATE *WalkState, ACPI_GENERIC_OP *Arg) { ACPI_STATUS Status = AE_OK; char *NameString; UINT32 NameLength; - ACPI_OBJECT_TYPE DataType; + OBJECT_TYPE_INTERNAL DataType; ACPI_OBJECT_INTERNAL *ObjDesc; ACPI_GENERIC_OP *ParentOp; UINT16 Opcode; @@ -303,7 +303,7 @@ DsCreateOperand ( /* Get the entire name string from the AML stream */ - Status = AmlGetNameString (ACPI_TYPE_Any, Arg->Value.Buffer, &NameString, &NameLength); + Status = AcpiAmlGetNameString (ACPI_TYPE_ANY, Arg->Value.Buffer, &NameString, &NameLength); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -312,49 +312,49 @@ DsCreateOperand ( /* All prefixes have been handled, and the name is in NameString */ /* - * Differentiate between a namespace "create" operation versus a "lookup" operation - * (IMODE_LoadPass2 vs. IMODE_Execute) in order to support the creation of namespace + * Differentiate between a namespace "create" operation versus a "lookup" operation + * (IMODE_LOAD_PASS2 vs. IMODE_EXECUTE) in order to support the creation of namespace * objects during the execution of control methods. */ ParentOp = Arg->Parent; - if ((PsIsNamedObjectOp (ParentOp->Opcode)) && + if ((AcpiPsIsNamedObjectOp (ParentOp->Opcode)) && (ParentOp->Opcode != AML_METHODCALL_OP) && (ParentOp->Opcode != AML_NAMEPATH_OP)) { /* Enter name into namespace if not found */ - InterpreterMode = IMODE_LoadPass2; + InterpreterMode = IMODE_LOAD_PASS2; } else { /* Return a failure if name not found */ - InterpreterMode = IMODE_Execute; + InterpreterMode = IMODE_EXECUTE; } - Status = NsLookup (WalkState->ScopeInfo, NameString, ACPI_TYPE_Any, InterpreterMode, + Status = AcpiNsLookup (WalkState->ScopeInfo, NameString, ACPI_TYPE_ANY, InterpreterMode, NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, WalkState, (NAME_TABLE_ENTRY **) &ObjDesc); /* Free the namestring created above */ - CmFree (NameString); + AcpiCmFree (NameString); /* - * The only case where we pass through (ignore) a NOT_FOUND error is for the + * The only case where we pass through (ignore) a NOT_FOUND error is for the * CondRefOf opcode. */ - if (Status == AE_NOT_FOUND) + if (Status == AE_NOT_FOUND) { - if (ParentOp->Opcode == AML_CondRefOfOp) + if (ParentOp->Opcode == AML_COND_REF_OF_OP) { /* * For the Conditional Reference op, it's OK if the name is not found; We * just need a way to indicate this to the interpreter, set the object to the root */ - ObjDesc = (ACPI_OBJECT_INTERNAL *) Gbl_RootObject; + ObjDesc = (ACPI_OBJECT_INTERNAL *) AcpiGbl_RootObject; Status = AE_OK; } @@ -367,7 +367,7 @@ DsCreateOperand ( } /* Check status from the lookup */ - + if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -375,12 +375,12 @@ DsCreateOperand ( /* Put the resulting object onto the current object stack */ - Status = DsObjStackPush (ObjDesc, WalkState); + Status = AcpiDsObjStackPush (ObjDesc, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - DEBUG_EXEC (DbDisplayArgumentObject (ObjDesc)); + DEBUG_EXEC (AcpiDbDisplayArgumentObject (ObjDesc)); } @@ -392,13 +392,13 @@ DsCreateOperand ( { /* * If the name is null, this means that this is an optional result parameter that was - * not specified in the original ASL. Create an Lvalue for a placeholder + * not specified in the original ASL. Create an Reference for a placeholder */ - Opcode = AML_ZeroOp; /* Has no arguments! */ + Opcode = AML_ZERO_OP; /* Has no arguments! */ DEBUG_PRINT (TRACE_DISPATCH, ("DsCreateOperand: Null namepath: Arg=%p\n", Arg)); - /* TBD: anything else needed for the zero op lvalue? */ + /* TBD: [Investigate] anything else needed for the zero op lvalue? */ } else @@ -409,8 +409,8 @@ DsCreateOperand ( /* Get the data type of the argument */ - DataType = DsMapOpcodeToDataType (Opcode, &Flags); - if (DataType == INTERNAL_TYPE_Invalid) + DataType = AcpiDsMapOpcodeToDataType (Opcode, &Flags); + if (DataType == INTERNAL_TYPE_INVALID) { return_ACPI_STATUS (AE_NOT_IMPLEMENTED); } @@ -418,14 +418,13 @@ DsCreateOperand ( if (Flags & OP_HAS_RETURN_VALUE) { DEBUG_PRINT (TRACE_DISPATCH, ("DsCreateOperand: Argument previously created, already stacked \n")); + DEBUG_EXEC (AcpiDbDisplayArgumentObject (WalkState->Operands [WalkState->NumOperands - 1])); -// DEBUG_EXEC (DbDisplayArgumentObject (WalkState->Operands [WalkState->NumOperands - 1])); - - /* + /* * Use value that was already previously returned by the evaluation of this argument */ - Status = DsResultStackPop (&ObjDesc, WalkState); + Status = AcpiDsResultStackPop (&ObjDesc, WalkState); if (ACPI_FAILURE (Status)) { /* @@ -441,7 +440,7 @@ DsCreateOperand ( { /* Create an ACPI_INTERNAL_OBJECT for the argument */ - ObjDesc = CmCreateInternalObject (DataType); + ObjDesc = AcpiCmCreateInternalObject (DataType); if (!ObjDesc) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -449,23 +448,23 @@ DsCreateOperand ( /* Initialize the new object */ - Status = DsInitObjectFromOp (WalkState, Arg, Opcode, ObjDesc); + Status = AcpiDsInitObjectFromOp (WalkState, Arg, Opcode, ObjDesc); if (ACPI_FAILURE (Status)) { - CmFree (ObjDesc); + AcpiCmFree (ObjDesc); return_ACPI_STATUS (Status); } } /* Put the operand object on the object stack */ - Status = DsObjStackPush (ObjDesc, WalkState); + Status = AcpiDsObjStackPush (ObjDesc, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - DEBUG_EXEC (DbDisplayArgumentObject (ObjDesc)); + DEBUG_EXEC (AcpiDbDisplayArgumentObject (ObjDesc)); } @@ -477,7 +476,7 @@ DsCreateOperand ( /***************************************************************************** * - * FUNCTION: DsCreateOperands + * FUNCTION: AcpiDsCreateOperands * * PARAMETERS: FirstArg - First argument of a parser argument tree * @@ -490,14 +489,14 @@ DsCreateOperand ( ****************************************************************************/ ACPI_STATUS -DsCreateOperands ( +AcpiDsCreateOperands ( ACPI_WALK_STATE *WalkState, ACPI_GENERIC_OP *FirstArg) { ACPI_STATUS Status = AE_OK; ACPI_GENERIC_OP *Arg; UINT32 ArgsPushed = 0; - + FUNCTION_TRACE_PTR ("DsCreateOperands", FirstArg); @@ -509,13 +508,13 @@ DsCreateOperands ( while (Arg) { - Status = DsCreateOperand (WalkState, Arg); + Status = AcpiDsCreateOperand (WalkState, Arg); if (ACPI_FAILURE (Status)) { goto Cleanup; } - DEBUG_PRINT (TRACE_DISPATCH, ("DsCreateOperands: Arg #%d (%p) done, Arg1=%p\n", + DEBUG_PRINT (TRACE_DISPATCH, ("DsCreateOperands: Arg #%d (%p) done, Arg1=%p\n", ArgsPushed, Arg, FirstArg)); /* Move on to next argument, if any */ @@ -528,22 +527,22 @@ DsCreateOperands ( Cleanup: - /* + /* * We must undo everything done above; meaning that we must pop everything off - * of the operand stack and delete those objects + * of the operand stack and delete those objects */ - DsObjStackPopAndDelete (ArgsPushed, WalkState); + AcpiDsObjStackPopAndDelete (ArgsPushed, WalkState); DEBUG_PRINT (ACPI_ERROR, ("DsCreateOperands: Error while creating Arg %d - %s\n", - (ArgsPushed+1), CmFormatException (Status))); + (ArgsPushed+1), AcpiCmFormatException (Status))); return_ACPI_STATUS (Status); } /***************************************************************************** * - * FUNCTION: DsResolveOperands + * FUNCTION: AcpiDsResolveOperands * * PARAMETERS: WalkState - Current walk state with operands on stack * @@ -555,30 +554,29 @@ Cleanup: ****************************************************************************/ ACPI_STATUS -DsResolveOperands ( +AcpiDsResolveOperands ( ACPI_WALK_STATE *WalkState) { UINT32 i; ACPI_STATUS Status = AE_OK; - + FUNCTION_TRACE_PTR ("DsResolveOperands", WalkState); - /* - * Attempt to resolve each of the valid operands + /* + * Attempt to resolve each of the valid operands * Method arguments are passed by value, not by reference */ - + /* - * TBD: Note from previous parser: - * - * TBD: RefOf problem with AmlGetRvalue() conversion. + * TBD: [Investigate] Note from previous parser: + * RefOf problem with AcpiAmlResolveToValue() conversion. */ for (i = 0; i < WalkState->NumOperands; i++) { - Status = AmlGetRvalue (&WalkState->Operands[i]); + Status = AcpiAmlResolveToValue (&WalkState->Operands[i]); if (ACPI_FAILURE (Status)) { break; @@ -591,7 +589,7 @@ DsResolveOperands ( /***************************************************************************** * - * FUNCTION: DsMapOpcodeToDataType + * FUNCTION: AcpiDsMapOpcodeToDataType * * PARAMETERS: Opcode - AML opcode to map * OutFlags - Additional info about the opcode @@ -599,22 +597,22 @@ DsResolveOperands ( * RETURN: The ACPI type associated with the opcode * * DESCRIPTION: Convert a raw AML opcode to the associated ACPI data type, - * if any. If the opcode returns a value as part of the + * if any. If the opcode returns a value as part of the * intepreter execution, a flag is returned in OutFlags. * ****************************************************************************/ -ACPI_OBJECT_TYPE -DsMapOpcodeToDataType ( +OBJECT_TYPE_INTERNAL +AcpiDsMapOpcodeToDataType ( UINT16 Opcode, UINT32 *OutFlags) { - ACPI_OBJECT_TYPE DataType = INTERNAL_TYPE_Invalid; + OBJECT_TYPE_INTERNAL DataType = INTERNAL_TYPE_INVALID; ACPI_OP_INFO *OpInfo; UINT32 Flags = 0; - OpInfo = PsGetOpcodeInfo (Opcode); + OpInfo = AcpiPsGetOpcodeInfo (Opcode); if (!OpInfo) { /* Unknown opcode */ @@ -629,21 +627,21 @@ DsMapOpcodeToDataType ( switch (Opcode) { - case AML_ByteOp: - case AML_WordOp: - case AML_DWordOp: + case AML_BYTE_OP: + case AML_WORD_OP: + case AML_DWORD_OP: - DataType = ACPI_TYPE_Number; + DataType = ACPI_TYPE_NUMBER; break; - case AML_StringOp: + case AML_STRING_OP: - DataType = ACPI_TYPE_String; + DataType = ACPI_TYPE_STRING; break; case AML_NAMEPATH_OP: - DataType = INTERNAL_TYPE_Reference; + DataType = INTERNAL_TYPE_REFERENCE; break; } @@ -654,14 +652,14 @@ DsMapOpcodeToDataType ( switch (Opcode) { - case AML_BufferOp: + case AML_BUFFER_OP: - DataType = ACPI_TYPE_Buffer; + DataType = ACPI_TYPE_BUFFER; break; - case AML_PackageOp: + case AML_PACKAGE_OP: - DataType = ACPI_TYPE_Package; + DataType = ACPI_TYPE_PACKAGE; break; } @@ -672,7 +670,7 @@ DsMapOpcodeToDataType ( case OPTYPE_METHOD_ARGUMENT: case OPTYPE_LOCAL_VARIABLE: - DataType = INTERNAL_TYPE_Lvalue; + DataType = INTERNAL_TYPE_REFERENCE; break; @@ -685,21 +683,21 @@ DsMapOpcodeToDataType ( case OPTYPE_MATCH: Flags = OP_HAS_RETURN_VALUE; - DataType = ACPI_TYPE_Any; + DataType = ACPI_TYPE_ANY; break; case OPTYPE_METHOD_CALL: Flags = OP_HAS_RETURN_VALUE; - DataType = ACPI_TYPE_Method; + DataType = ACPI_TYPE_METHOD; break; case OPTYPE_NAMED_OBJECT: - DataType = DsMapNamedOpcodeToDataType (Opcode); + DataType = AcpiDsMapNamedOpcodeToDataType (Opcode); break; @@ -732,7 +730,7 @@ DsMapOpcodeToDataType ( /***************************************************************************** * - * FUNCTION: DsMapNamedOpcodeToDataType + * FUNCTION: AcpiDsMapNamedOpcodeToDataType * * PARAMETERS: Opcode - The Named AML opcode to map * @@ -743,81 +741,81 @@ DsMapOpcodeToDataType ( * ****************************************************************************/ -ACPI_OBJECT_TYPE -DsMapNamedOpcodeToDataType ( +OBJECT_TYPE_INTERNAL +AcpiDsMapNamedOpcodeToDataType ( UINT16 Opcode) { - ACPI_OBJECT_TYPE DataType; + OBJECT_TYPE_INTERNAL DataType; /* Decode Opcode */ switch (Opcode) { - case AML_ScopeOp: - DataType = INTERNAL_TYPE_Scope; + case AML_SCOPE_OP: + DataType = INTERNAL_TYPE_SCOPE; break; - case AML_DeviceOp: - DataType = ACPI_TYPE_Device; + case AML_DEVICE_OP: + DataType = ACPI_TYPE_DEVICE; break; - case AML_ThermalZoneOp: - DataType = ACPI_TYPE_Thermal; + case AML_THERMAL_ZONE_OP: + DataType = ACPI_TYPE_THERMAL; break; - case AML_MethodOp: - DataType = ACPI_TYPE_Method; + case AML_METHOD_OP: + DataType = ACPI_TYPE_METHOD; break; - case AML_PowerResOp: - DataType = ACPI_TYPE_Power; + case AML_POWER_RES_OP: + DataType = ACPI_TYPE_POWER; break; - case AML_ProcessorOp: - DataType = ACPI_TYPE_Processor; + case AML_PROCESSOR_OP: + DataType = ACPI_TYPE_PROCESSOR; break; - case AML_DefFieldOp: /* DefFieldOp */ - DataType = INTERNAL_TYPE_DefFieldDefn; + case AML_DEF_FIELD_OP: /* DefFieldOp */ + DataType = INTERNAL_TYPE_DEF_FIELD_DEFN; break; - case AML_IndexFieldOp: /* IndexFieldOp */ - DataType = INTERNAL_TYPE_IndexFieldDefn; + case AML_INDEX_FIELD_OP: /* IndexFieldOp */ + DataType = INTERNAL_TYPE_INDEX_FIELD_DEFN; break; - case AML_BankFieldOp: /* BankFieldOp */ - DataType = INTERNAL_TYPE_BankFieldDefn; + case AML_BANK_FIELD_OP: /* BankFieldOp */ + DataType = INTERNAL_TYPE_BANK_FIELD_DEFN; break; case AML_NAMEDFIELD_OP: /* NO CASE IN ORIGINAL */ - DataType = ACPI_TYPE_Any; + DataType = ACPI_TYPE_ANY; break; - case AML_NameOp: /* NameOp - special code in original */ - case AML_NAMEPATH_OP: - DataType = ACPI_TYPE_Any; + case AML_NAME_OP: /* NameOp - special code in original */ + case AML_NAMEPATH_OP: + DataType = ACPI_TYPE_ANY; break; - case AML_AliasOp: - DataType = INTERNAL_TYPE_Alias; + case AML_ALIAS_OP: + DataType = INTERNAL_TYPE_ALIAS; break; - case AML_MutexOp: - DataType = ACPI_TYPE_Mutex; + case AML_MUTEX_OP: + DataType = ACPI_TYPE_MUTEX; break; - case AML_EventOp: - DataType = ACPI_TYPE_Event; + case AML_EVENT_OP: + DataType = ACPI_TYPE_EVENT; break; - case AML_RegionOp: - DataType = ACPI_TYPE_Region; + case AML_REGION_OP: + DataType = ACPI_TYPE_REGION; break; default: - DataType = ACPI_TYPE_Any; + DataType = ACPI_TYPE_ANY; break; } diff --git a/source/components/dispatcher/dswexec.c b/source/components/dispatcher/dswexec.c index 464061d99..5d6242151 100644 --- a/source/components/dispatcher/dswexec.c +++ b/source/components/dispatcher/dswexec.c @@ -1,7 +1,7 @@ /****************************************************************************** - * - * Module Name: dswexec - Dispatcher method execution callbacks; + * + * Module Name: dswexec - Dispatcher method execution callbacks; * Dispatch to interpreter. * *****************************************************************************/ @@ -39,9 +39,9 @@ * The above copyright and patent license is granted only if the following * conditions are met: * - * 3. Conditions + * 3. Conditions * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * 3.1. Redistribution of Source with Rights to Further Distribute Source. * Redistribution of source code of any substantial portion of the Covered * Code or modification with rights to further distribute source must include * the above Copyright Notice, the above License, this list of Conditions, @@ -49,11 +49,11 @@ * Licensee must cause all Covered Code to which Licensee contributes to * contain a file documenting the changes Licensee made to create that Covered * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee + * documentation of any changes made by any predecessor Licensee. Licensee * must include a prominent statement that the modification is derived, * directly or indirectly, from Original Intel Code. * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. * Redistribution of source code of any substantial portion of the Covered * Code or modification without rights to further distribute source must * include the following Disclaimer and Export Compliance provision in the @@ -87,7 +87,7 @@ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. + * PARTICULAR PURPOSE. * * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR @@ -117,13 +117,13 @@ #define __DSWEXEC_C__ -#include -#include -#include -#include -#include -#include -#include +#include "acpi.h" +#include "parser.h" +#include "amlcode.h" +#include "dispatch.h" +#include "interp.h" +#include "namesp.h" +#include "debugger.h" #define _COMPONENT DISPATCHER @@ -134,7 +134,7 @@ /***************************************************************************** * - * FUNCTION: DsExecBeginOp + * FUNCTION: AcpiDsExecBeginOp * * PARAMETERS: WalkState - Current state of the parse tree walk * Op - Op that has been just been reached in the @@ -143,13 +143,13 @@ * RETURN: Status * * DESCRIPTION: Descending callback used during the execution of control - * methods. This is where most operators and operands are + * methods. This is where most operators and operands are * dispatched to the interpreter. * ****************************************************************************/ ACPI_STATUS -DsExecBeginOp ( +AcpiDsExecBeginOp ( ACPI_WALK_STATE *WalkState, ACPI_GENERIC_OP *Op) { @@ -164,7 +164,7 @@ DsExecBeginOp ( { return_ACPI_STATUS (AE_OK); } - + /* * If the previous opcode was a conditional, this opcode * must be the beginning of the associated predicate. @@ -172,54 +172,53 @@ DsExecBeginOp ( */ if ((WalkState->ControlState) && - (WalkState->ControlState->Exec == CONTROL_CONDITIONAL_EXECUTING)) + (WalkState->ControlState->Common.State == CONTROL_CONDITIONAL_EXECUTING)) { DEBUG_PRINT (TRACE_EXEC, ("BeginOp: Exec predicate Op=%X State=%X\n", Op, WalkState)); - WalkState->ControlState->Exec = CONTROL_PREDICATE_EXECUTING; - WalkState->ControlState->PredicateOp = Op; /* Save start of predicate */ + WalkState->ControlState->Common.State = CONTROL_PREDICATE_EXECUTING; + WalkState->ControlState->Control.PredicateOp = Op; /* Save start of predicate */ } -/* - if (Op->Opcode != AML_MethodOp) - { - return_ACPI_STATUS (AE_OK); - } - -*/ - OpInfo = PsGetOpcodeInfo (Op->Opcode); + OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode); - /* We want to send name paths to the load code */ + /* We want to send namepaths to the load code */ if (Op->Opcode == AML_NAMEPATH_OP) { OpInfo->Flags = OPTYPE_NAMED_OBJECT; } + + /* + * Handle the opcode based upon the opcode type + */ + switch (OpInfo->Flags & OP_INFO_TYPE) { case OPTYPE_CONTROL: - Status = DsExecBeginControlOp (WalkState, Op); + Status = AcpiDsExecBeginControlOp (WalkState, Op); break; + case OPTYPE_NAMED_OBJECT: - if (WalkState->Origin->Opcode == AML_MethodOp) + if (WalkState->Origin->Opcode == AML_METHOD_OP) { /* * Found a named object declaration during method execution; we must enter - * this object into the namespace. - * - * TBD: make this a temporary namespace object + * this object into the namespace. The created object is temporary and + * will be deleted upon completion of the execution of this method. */ - Status = DsLoad2BeginOp (WalkState, Op); + Status = AcpiDsLoad2BeginOp (WalkState, Op); } break; + default: break; } @@ -232,7 +231,7 @@ DsExecBeginOp ( /***************************************************************************** * - * FUNCTION: DsExecEndOp + * FUNCTION: AcpiDsExecEndOp * * PARAMETERS: WalkState - Current state of the parse tree walk * Op - Op that has been just been completed in the @@ -241,13 +240,13 @@ DsExecBeginOp ( * RETURN: Status * * DESCRIPTION: Ascending callback used during the execution of control - * methods. The only thing we really need to do here is to + * methods. The only thing we really need to do here is to * notice the beginning of IF, ELSE, and WHILE blocks. * ****************************************************************************/ ACPI_STATUS -DsExecEndOp ( +AcpiDsExecEndOp ( ACPI_WALK_STATE *WalkState, ACPI_GENERIC_OP *Op) { @@ -269,7 +268,7 @@ DsExecEndOp ( Opcode = (UINT16) Op->Opcode; - OpInfo = PsGetOpcodeInfo (Op->Opcode); + OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode); if (!OpInfo) { DEBUG_PRINT (ACPI_ERROR, ("ExecEndOp: Unknown opcode. Op=%X\n", @@ -289,7 +288,7 @@ DsExecEndOp ( /* Call debugger for single step support (DEBUG build only) */ - DEBUG_EXEC (Status = DbSingleStep (WalkState, Op, Optype)); + DEBUG_EXEC (Status = AcpiDbSingleStep (WalkState, Op, Optype)); DEBUG_EXEC (if (Status != AE_OK) {return_ACPI_STATUS (Status);}); @@ -327,12 +326,13 @@ DsExecEndOp ( case OPTYPE_DYADIC2: case OPTYPE_DYADIC2R: case OPTYPE_DYADIC2S: + case OPTYPE_RECONFIGURATION: case OPTYPE_INDEX: case OPTYPE_MATCH: case OPTYPE_CREATE_FIELD: case OPTYPE_FATAL: - Status = DsCreateOperands (WalkState, FirstArg); + Status = AcpiDsCreateOperands (WalkState, FirstArg); if (ACPI_FAILURE (Status)) { goto Cleanup; @@ -347,7 +347,7 @@ DsExecEndOp ( /* 1 Operand, 0 ExternalResult, 0 InternalResult */ - Status = AmlExecMonadic1 (Opcode, WalkState); + Status = AcpiAmlExecMonadic1 (Opcode, WalkState); break; @@ -355,10 +355,10 @@ DsExecEndOp ( /* 1 Operand, 0 ExternalResult, 1 InternalResult */ - Status = AmlExecMonadic2 (Opcode, WalkState, &ResultObj); + Status = AcpiAmlExecMonadic2 (Opcode, WalkState, &ResultObj); if (ACPI_SUCCESS (Status)) { - Status = DsResultStackPush (ResultObj, WalkState); + Status = AcpiDsResultStackPush (ResultObj, WalkState); } break; @@ -368,10 +368,10 @@ DsExecEndOp ( /* 1 Operand, 1 ExternalResult, 1 InternalResult */ - Status = AmlExecMonadic2R (Opcode, WalkState, &ResultObj); + Status = AcpiAmlExecMonadic2R (Opcode, WalkState, &ResultObj); if (ACPI_SUCCESS (Status)) { - Status = DsResultStackPush (ResultObj, WalkState); + Status = AcpiDsResultStackPush (ResultObj, WalkState); } break; @@ -381,7 +381,7 @@ DsExecEndOp ( /* 2 Operands, 0 ExternalResult, 0 InternalResult */ - Status = AmlExecDyadic1 (Opcode, WalkState); + Status = AcpiAmlExecDyadic1 (Opcode, WalkState); break; @@ -390,10 +390,10 @@ DsExecEndOp ( /* 2 Operands, 0 ExternalResult, 1 InternalResult */ - Status = AmlExecDyadic2 (Opcode, WalkState, &ResultObj); + Status = AcpiAmlExecDyadic2 (Opcode, WalkState, &ResultObj); if (ACPI_SUCCESS (Status)) { - Status = DsResultStackPush (ResultObj, WalkState); + Status = AcpiDsResultStackPush (ResultObj, WalkState); } break; @@ -407,10 +407,10 @@ DsExecEndOp ( /* NEW INTERFACE: * Pass in WalkState, keep result obj but let interpreter push the result */ - Status = AmlExecDyadic2R (Opcode, WalkState, &ResultObj); + Status = AcpiAmlExecDyadic2R (Opcode, WalkState, &ResultObj); if (ACPI_SUCCESS (Status)) { - Status = DsResultStackPush (ResultObj, WalkState); + Status = AcpiDsResultStackPush (ResultObj, WalkState); } break; @@ -420,21 +420,28 @@ DsExecEndOp ( /* 2 Operands, 0 ExternalResult, 1 InternalResult */ - Status = AmlExecDyadic2S (Opcode, WalkState, &ResultObj); + Status = AcpiAmlExecDyadic2S (Opcode, WalkState, &ResultObj); if (ACPI_SUCCESS (Status)) { - Status = DsResultStackPush (ResultObj, WalkState); + Status = AcpiDsResultStackPush (ResultObj, WalkState); } break; + case OPTYPE_RECONFIGURATION: + + /* 1 or 2 operands, 0 Internal Result */ + + Status = AcpiAmlExecReconfiguration (Opcode, WalkState); + break; + + case OPTYPE_CREATE_FIELD: /* 3 or 4 Operands, 0 ExternalResult, 0 InternalResult */ - Status = AmlExecCreateField (Opcode, WalkState); - + Status = AcpiAmlExecCreateField (Opcode, WalkState); break; @@ -442,7 +449,7 @@ DsExecEndOp ( /* 3 Operands, 0 ExternalResult, 0 InternalResult */ - Status = AmlExecFatal (WalkState); + Status = AcpiAmlExecFatal (WalkState); break; @@ -450,10 +457,10 @@ DsExecEndOp ( /* 3 Operands, 1 ExternalResult, 1 InternalResult */ - Status = AmlExecIndex (WalkState, &ResultObj); + Status = AcpiAmlExecIndex (WalkState, &ResultObj); if (ACPI_SUCCESS (Status)) { - Status = DsResultStackPush (ResultObj, WalkState); + Status = AcpiDsResultStackPush (ResultObj, WalkState); } break; @@ -463,10 +470,10 @@ DsExecEndOp ( /* 6 Operands, 0 ExternalResult, 1 InternalResult */ - Status = AmlExecMatch (WalkState, &ResultObj); + Status = AcpiAmlExecMatch (WalkState, &ResultObj); if (ACPI_SUCCESS (Status)) { - Status = DsResultStackPush (ResultObj, WalkState); + Status = AcpiDsResultStackPush (ResultObj, WalkState); } break; @@ -480,12 +487,12 @@ DsExecEndOp ( /* 1 Operand, 0 ExternalResult, 0 InternalResult */ - Status = DsExecEndControlOp (WalkState, Op); + Status = AcpiDsExecEndControlOp (WalkState, Op); break; - case OPTYPE_METHOD_CALL: + case OPTYPE_METHOD_CALL: DEBUG_PRINT (TRACE_DISPATCH, ("ExecEndOp: Method invocation, Op=%X\n", Op)); @@ -502,7 +509,7 @@ DsExecEndOp ( * Get the method's arguments and put them on the operand stack */ - Status = DsCreateOperands (WalkState, NextOp); + Status = AcpiDsCreateOperands (WalkState, NextOp); if (ACPI_FAILURE (Status)) { break; @@ -513,7 +520,7 @@ DsExecEndOp ( * resolve all local references here (Local variables, arguments to *this* method, etc.) */ - Status = DsResolveOperands (WalkState); + Status = AcpiDsResolveOperands (WalkState); if (ACPI_FAILURE (Status)) { break; @@ -521,7 +528,7 @@ DsExecEndOp ( /* Open new scope on the scope stack */ /* - Status = NsScopeStackPushEntry (Entry); + Status = AcpiNsScopeStackPushEntry (Entry); if (ACPI_FAILURE (Status)) { DEBUG_PRINT (ACPI_ERROR, ("ExecEndOp: Could not push Scope Stack\n")); @@ -531,7 +538,7 @@ DsExecEndOp ( /* Tell the walk loop to preempt this running method and execute the new method */ - Status = AE_PENDING; + Status = AE_CTRL_PENDING; /* Return now; we don't want to disturb anything, especially the operand count! */ @@ -539,45 +546,37 @@ DsExecEndOp ( break; - case OPTYPE_RECONFIGURATION: - - DEBUG_PRINT (ACPI_ERROR, ("ExecEndOp: Unimplemented reconfig opcode=%X Op=%X\n", - Op->Opcode, Op)); - - Status = AE_NOT_IMPLEMENTED; - break; - - case OPTYPE_NAMED_OBJECT: - if ((WalkState->Origin->Opcode == AML_MethodOp) && + if ((WalkState->Origin->Opcode == AML_METHOD_OP) && (WalkState->Origin != Op)) { - DsLoad2EndOp (WalkState, Op); + Status = AcpiDsLoad2EndOp (WalkState, Op); + if (ACPI_FAILURE (Status)) + { + break; + } } switch (Op->Opcode) { - case AML_RegionOp: + case AML_REGION_OP: DEBUG_PRINT (TRACE_EXEC, ("ExecEndOp: Executing OpRegion Address/Length Op=%X\n", Op)); - Status = DsEvalRegionOperands (WalkState, Op); - + Status = AcpiDsEvalRegionOperands (WalkState, Op); break; - case AML_MethodOp: - - /* End of execution, nothing else to do */ + case AML_METHOD_OP: break; - case AML_AliasOp: + case AML_ALIAS_OP: /* Alias creation was already handled by call to psxload above */ @@ -585,12 +584,12 @@ DsExecEndOp ( default: - /* TBD: Nothing to do here at this time */ + /* Nothing needs to be done */ Status = AE_OK; break; } - + break; default: @@ -605,22 +604,20 @@ DsExecEndOp ( /* - * Check if we just completed the evaluation of a conditional predicate + * Check if we just completed the evaluation of a conditional predicate */ if ((WalkState->ControlState) && - (WalkState->ControlState->Exec == CONTROL_PREDICATE_EXECUTING) && - (WalkState->ControlState->PredicateOp == Op)) + (WalkState->ControlState->Common.State == CONTROL_PREDICATE_EXECUTING) && + (WalkState->ControlState->Control.PredicateOp == Op)) { /* Completed the predicate, the result must be a number */ - WalkState->ControlState->Exec = 0; - -/* TBD: REDO now that we have the resultobj mechanism */ + WalkState->ControlState->Common.State = 0; if (ResultObj) { - Status = DsResultStackPop (&ObjDesc, WalkState); + Status = AcpiDsResultStackPop (&ObjDesc, WalkState); if (ACPI_FAILURE (Status)) { goto Cleanup; @@ -629,13 +626,13 @@ DsExecEndOp ( else { - Status = DsCreateOperand (WalkState, Op); + Status = AcpiDsCreateOperand (WalkState, Op); if (ACPI_FAILURE (Status)) { goto Cleanup; } - Status = AmlGetRvalue (&WalkState->Operands [0]); + Status = AcpiAmlResolveToValue (&WalkState->Operands [0]); if (ACPI_FAILURE (Status)) { goto Cleanup; @@ -653,7 +650,7 @@ DsExecEndOp ( goto Cleanup; } - if (ObjDesc->Common.Type != ACPI_TYPE_Number) + if (ObjDesc->Common.Type != ACPI_TYPE_NUMBER) { DEBUG_PRINT (ACPI_ERROR, ("ExecEndOp: Bad predicate ObjDesc=%X State=%X\n", ObjDesc, WalkState)); @@ -665,31 +662,29 @@ DsExecEndOp ( if (ObjDesc->Number.Value) { - WalkState->ControlState->Predicate = TRUE; + WalkState->ControlState->Common.Value = TRUE; } else { /* Predicate is FALSE, we will just toss the rest of the package */ - WalkState->ControlState->Predicate = FALSE; - Status = AE_FALSE; + WalkState->ControlState->Common.Value = FALSE; + Status = AE_CTRL_FALSE; } DEBUG_PRINT (TRACE_EXEC, ("ExecEndOp: Completed a predicate eval=%X Op=%X\n", - WalkState->ControlState->Predicate, Op)); + WalkState->ControlState->Common.Value, Op)); /* Break to debugger to display result */ - DEBUG_EXEC (DbDisplayResultObject (ObjDesc)); + DEBUG_EXEC (AcpiDbDisplayResultObject (ObjDesc)); /* Delete the predicate result object (we know that we don't need it anymore) and cleanup the stack */ - CmDeleteInternalObject (ObjDesc); + AcpiCmRemoveReference (ObjDesc); ResultObj = NULL; - //DsObjStackPop (1, WalkState); - - WalkState->ControlState->Exec = CONTROL_NORMAL; + WalkState->ControlState->Common.State = CONTROL_NORMAL; } @@ -699,18 +694,19 @@ Cleanup: { /* Break to debugger to display result */ - DEBUG_EXEC (DbDisplayResultObject (ResultObj)); + DEBUG_EXEC (AcpiDbDisplayResultObject (ResultObj)); - /* Delete the result op IFF: + /* + * Delete the result op if and only if: * Parent will not use the result -- such as any non-nested type2 op in a method (parent will be method) */ - DsDeleteResultIfNotUsed (Op, ResultObj, WalkState); + AcpiDsDeleteResultIfNotUsed (Op, ResultObj, WalkState); } /* Always clear the object stack */ - WalkState->NumOperands = 0; /* TBD Clear stack of return value, but don't delete it */ - + WalkState->NumOperands = 0; /* TBD: [Investigate] Clear stack of return value, but don't delete it */ + return_ACPI_STATUS (Status); } diff --git a/source/components/dispatcher/dswload.c b/source/components/dispatcher/dswload.c index ce5c352a6..c0b744add 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.54 $ * *****************************************************************************/ @@ -9,8 +9,8 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. - * All rights reserved. + * Some or all of this work - Copyright (c) 1999, Intel Corp. All rights + * reserved. * * 2. License * @@ -117,67 +117,20 @@ #define __DSWLOAD_C__ #include "acpi.h" -#include "acparser.h" +#include "parser.h" #include "amlcode.h" -#include "acdispat.h" -#include "acinterp.h" -#include "acnamesp.h" -#include "acevents.h" +#include "dispatch.h" +#include "interp.h" +#include "namesp.h" +#include "events.h" -#define _COMPONENT ACPI_DISPATCHER - MODULE_NAME ("dswload") +#define _COMPONENT DISPATCHER + MODULE_NAME ("dswload"); -/******************************************************************************* - * - * FUNCTION: AcpiDsInitCallbacks - * - * PARAMETERS: WalkState - Current state of the parse tree walk - * PassNumber - 1, 2, or 3 - * - * RETURN: Status - * - * DESCRIPTION: Init walk state callbacks - * - ******************************************************************************/ -ACPI_STATUS -AcpiDsInitCallbacks ( - ACPI_WALK_STATE *WalkState, - UINT32 PassNumber) -{ - - 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 (AE_BAD_PARAMETER); - break; - } - - return (AE_OK); -} - - -/******************************************************************************* +/***************************************************************************** * * FUNCTION: AcpiDsLoad1BeginOp * @@ -189,100 +142,79 @@ AcpiDsInitCallbacks ( * * DESCRIPTION: Descending callback used during the loading of ACPI tables. * - ******************************************************************************/ + ****************************************************************************/ ACPI_STATUS AcpiDsLoad1BeginOp ( ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT **OutOp) + ACPI_GENERIC_OP *Op) { - ACPI_PARSE_OBJECT *Op; - ACPI_NAMESPACE_NODE *Node; + NAME_TABLE_ENTRY *NewEntry; ACPI_STATUS Status; - ACPI_OBJECT_TYPE8 ObjectType; - NATIVE_CHAR *Path; + OBJECT_TYPE_INTERNAL DataType; - PROC_NAME ("DsLoad1BeginOp"); + DEBUG_PRINT (TRACE_DISPATCH, ("Load1BeginOp: Op=%p State=%p\n", Op, WalkState)); - 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 (!AcpiPsIsNamedOp (Op->Opcode)) { - 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); - } + return AE_OK; } - Path = AcpiPsGetNextNamestring (&WalkState->ParserState); + + /* Check if this object has already been installed in the namespace */ + + if (Op->NameTableEntry) + { + return AE_OK; + } /* Map the raw opcode into an internal object type */ - ObjectType = WalkState->OpInfo->ObjectType; + DataType = AcpiDsMapNamedOpcodeToDataType (Op->Opcode); + + /* Attempt to type a NAME opcode by examining the argument */ + + /* TBD: [Investigate] is this the right place to do this? */ + + if (Op->Opcode == AML_NAME_OP) + { + if (Op->Value.Arg) + { + + DataType = AcpiDsMapOpcodeToDataType ((Op->Value.Arg)->Opcode, NULL); + } + } + + DEBUG_PRINT (TRACE_DISPATCH, ("Load1BeginOp: 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, 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)); + Status = AcpiNsLookup (WalkState->ScopeInfo, (char *) &((ACPI_NAMED_OP *)Op)->Name, DataType, IMODE_LOAD_PASS1, + NS_NO_UPSEARCH, WalkState, &(NewEntry)); - if (ACPI_FAILURE (Status)) + if (ACPI_SUCCESS (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 (WalkState->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); } -/******************************************************************************* +/***************************************************************************** * * FUNCTION: AcpiDsLoad1EndOp * @@ -295,78 +227,57 @@ AcpiDsLoad1BeginOp ( * DESCRIPTION: Ascending callback used during the loading of the namespace, * both control methods and everything else. * - ******************************************************************************/ + ****************************************************************************/ ACPI_STATUS AcpiDsLoad1EndOp ( - ACPI_WALK_STATE *WalkState) + ACPI_WALK_STATE *WalkState, + ACPI_GENERIC_OP *Op) { - ACPI_PARSE_OBJECT *Op; - ACPI_OBJECT_TYPE8 ObjectType; + OBJECT_TYPE_INTERNAL DataType; - PROC_NAME ("DsLoad1EndOp"); - - Op = WalkState->Op; - 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 */ - if (!(WalkState->OpInfo->Flags & (AML_NAMED | AML_FIELD))) + if (!AcpiPsIsNamedOp (Op->Opcode)) { - return (AE_OK); + return AE_OK; } - /* Get the object type to determine if we should pop the scope */ + /* TBD: [Investigate] can this be removed? */ - ObjectType = WalkState->OpInfo->ObjectType; - - if (WalkState->OpInfo->Flags & AML_FIELD) + if (Op->Opcode == AML_SCOPE_OP) { - if (WalkState->Opcode == AML_FIELD_OP || - WalkState->Opcode == AML_BANK_FIELD_OP || - WalkState->Opcode == AML_INDEX_FIELD_OP) + DEBUG_PRINT (TRACE_DISPATCH, ("Load1EndOp: ending scope Op=%p State=%p\n", Op, WalkState)); + if (((ACPI_NAMED_OP *)Op)->Name == -1) { - AcpiDsInitFieldObjects (Op, WalkState); - } - return (AE_OK); - } - - - if (Op->Opcode == 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); - } - - if (Op->Opcode == AML_NAME_OP) - { - /* For Name opcode, get the object type from the argument */ - - if (Op->Value.Arg) - { - ObjectType = (AcpiPsGetOpcodeInfo ((Op->Value.Arg)->Opcode))->ObjectType; - Op->Node->Type = (UINT8) ObjectType; + DEBUG_PRINT (ACPI_ERROR, ("Load1EndOp: Un-named scope! Op=%p State=%p\n", Op, WalkState)); + return AE_OK; } } + + DataType = AcpiDsMapNamedOpcodeToDataType (Op->Opcode); + /* Pop the scope stack */ - if (AcpiNsOpensScope (ObjectType)) + if (AcpiNsOpensScope (DataType)) { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n", - AcpiUtGetTypeName (ObjectType), Op)); + DEBUG_PRINT (TRACE_DISPATCH, ("AmlEndNamespaceScope/%s: Popping scope for Op %p\n", + AcpiCmGetTypeName (DataType), Op)); AcpiDsScopeStackPop (WalkState); } - return (AE_OK); + return AE_OK; + } -/******************************************************************************* +/***************************************************************************** * * FUNCTION: AcpiDsLoad2BeginOp * @@ -378,115 +289,99 @@ AcpiDsLoad1EndOp ( * * DESCRIPTION: Descending callback used during the loading of ACPI tables. * - ******************************************************************************/ + ****************************************************************************/ ACPI_STATUS AcpiDsLoad2BeginOp ( ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT **OutOp) + ACPI_GENERIC_OP *Op) { - ACPI_PARSE_OBJECT *Op; - ACPI_NAMESPACE_NODE *Node; + NAME_TABLE_ENTRY *NewEntry; ACPI_STATUS Status; - ACPI_OBJECT_TYPE8 ObjectType; - NATIVE_CHAR *BufferPtr; + OBJECT_TYPE_INTERNAL DataType; + char *BufferPtr; void *Original = NULL; - PROC_NAME ("DsLoad2BeginOp"); - Op = WalkState->Op; - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); + DEBUG_PRINT (TRACE_DISPATCH, ("Load2BeginOp: Op=%p State=%p\n", Op, WalkState)); - if (Op) + /* We only care about Namespace opcodes here */ + + if (!AcpiPsIsNamespaceOp (Op->Opcode) && + Op->Opcode != AML_NAMEPATH_OP) { - /* We only care about Namespace opcodes here */ + return AE_OK; + } - if (!(WalkState->OpInfo->Flags & AML_NSOPCODE) && - WalkState->Opcode != AML_INT_NAMEPATH_OP) + + /* + * Get the name we are going to enter or lookup in the namespace + */ + if (Op->Opcode == AML_NAMEPATH_OP) + { + /* For Namepath op , get the path string */ + + BufferPtr = Op->Value.String; + if (!BufferPtr) { - return (AE_OK); - } + /* No name, just exit */ - /* 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 (WalkState->Opcode == AML_INT_NAMEPATH_OP) - { - /* For Namepath op, get the path string */ - - BufferPtr = Op->Value.String; - if (!BufferPtr) - { - /* No name, just exit */ - - return (AE_OK); - } - } - else - { - /* Get name from the op */ - - BufferPtr = (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Op)->Name; + return AE_OK; } } + else { - BufferPtr = AcpiPsGetNextNamestring (&WalkState->ParserState); + /* Get name from the op */ + + BufferPtr = (char *) &((ACPI_NAMED_OP *)Op)->Name; } /* Map the raw opcode into an internal object type */ - ObjectType = WalkState->OpInfo->ObjectType; + DataType = AcpiDsMapNamedOpcodeToDataType (Op->Opcode); - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "State=%p Op=%p Type=%x\n", WalkState, Op, ObjectType)); + DEBUG_PRINT (TRACE_DISPATCH, ("Load2BeginOp: State=%p Op=%p Type=%x\n", WalkState, Op, DataType)); - if (WalkState->Opcode == AML_FIELD_OP || - WalkState->Opcode == AML_BANK_FIELD_OP || - WalkState->Opcode == AML_INDEX_FIELD_OP) + if (Op->Opcode == AML_DEF_FIELD_OP || + Op->Opcode == AML_BANK_FIELD_OP || + Op->Opcode == AML_INDEX_FIELD_OP) { - Node = NULL; + NewEntry = NULL; Status = AE_OK; } - else if (WalkState->Opcode == AML_INT_NAMEPATH_OP) + else if (Op->Opcode == AML_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)); + Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, DataType, IMODE_EXECUTE, + NS_SEARCH_PARENT, WalkState, &(NewEntry)); } else { - if (Op && Op->Node) + if (Op->NameTableEntry) { - Original = Op->Node; - Node = Op->Node; + Original = Op->NameTableEntry; + NewEntry = Op->NameTableEntry; - if (AcpiNsOpensScope (ObjectType)) + if (AcpiNsOpensScope (DataType)) { - Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); + Status = AcpiDsScopeStackPush (NewEntry->Scope, DataType, WalkState); if (ACPI_FAILURE (Status)) { return (Status); } } - return (AE_OK); + return AE_OK; } /* @@ -494,51 +389,34 @@ 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, ObjectType, - IMODE_EXECUTE, NS_NO_UPSEARCH, WalkState, &(Node)); + Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, DataType, IMODE_EXECUTE, + NS_NO_UPSEARCH, WalkState, &(NewEntry)); } if (ACPI_SUCCESS (Status)) { - 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; - } - /* - * Put the Node in the "op" object that the parser uses, so we + * Put the NTE in the "op" object that the parser uses, so we * can get it again quickly when this scope is closed */ - Op->Node = Node; + Op->NameTableEntry = NewEntry; if (Original) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "old %p new %p\n", Original, Node)); - - if (Original != Node) + DEBUG_PRINT (ACPI_INFO, ("Lookup: old %p new %p\n", Original, NewEntry)); + if (Original != NewEntry) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Lookup match error: old %p new %p\n", Original, Node)); + DEBUG_PRINT (ACPI_INFO, ("Lookup match error: old %p new %p\n", Original, NewEntry)); } } } + return (Status); } -/******************************************************************************* +/***************************************************************************** * * FUNCTION: AcpiDsLoad2EndOp * @@ -551,144 +429,270 @@ AcpiDsLoad2BeginOp ( * DESCRIPTION: Ascending callback used during the loading of the namespace, * both control methods and everything else. * - ******************************************************************************/ + ****************************************************************************/ ACPI_STATUS AcpiDsLoad2EndOp ( - ACPI_WALK_STATE *WalkState) + ACPI_WALK_STATE *WalkState, + ACPI_GENERIC_OP *Op) { - ACPI_PARSE_OBJECT *Op; ACPI_STATUS Status = AE_OK; - ACPI_OBJECT_TYPE8 ObjectType; - ACPI_NAMESPACE_NODE *Node; - ACPI_PARSE_OBJECT *Arg; - ACPI_NAMESPACE_NODE *NewNode; - UINT32 i; + OBJECT_TYPE_INTERNAL DataType; + NAME_TABLE_ENTRY *Entry; + ACPI_GENERIC_OP *Arg; + NAME_TABLE_ENTRY *NewEntry; - PROC_NAME ("DsLoad2EndOp"); - Op = WalkState->Op; - 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)); - - /* Only interested in opcodes that have namespace objects */ - - if (!(WalkState->OpInfo->Flags & AML_NSOBJECT)) + if (!AcpiPsIsNamespaceObjectOp (Op->Opcode)) { - return (AE_OK); + return AE_OK; } if (Op->Opcode == AML_SCOPE_OP) { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Ending scope Op=%p State=%p\n", Op, WalkState)); - - if (((ACPI_PARSE2_OBJECT *)Op)->Name == -1) + DEBUG_PRINT (TRACE_DISPATCH, ("Load2EndOp: ending scope Op=%p State=%p\n", Op, WalkState)); + if (((ACPI_NAMED_OP *)Op)->Name == -1) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unnamed scope! Op=%p State=%p\n", - Op, WalkState)); - return (AE_OK); + DEBUG_PRINT (ACPI_ERROR, ("Load2EndOp: Un-named scope! Op=%p State=%p\n", Op, WalkState)); + return AE_OK; } } - ObjectType = WalkState->OpInfo->ObjectType; + DataType = AcpiDsMapNamedOpcodeToDataType (Op->Opcode); /* - * Get the Node/name from the earlier lookup + * Get the NTE/name from the earlier lookup * (It was saved in the *op structure) */ - Node = Op->Node; + Entry = Op->NameTableEntry; - /* - * Put the Node on the object stack (Contains the ACPI Name of - * this object) - */ - WalkState->Operands[0] = (void *) Node; + /* Put the NTE on the object stack (Contains the ACPI Name of this object) */ + + WalkState->Operands[0] = (void *) Entry; WalkState->NumOperands = 1; /* Pop the scope stack */ - if (AcpiNsOpensScope (ObjectType)) + if (AcpiNsOpensScope (DataType)) { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", - AcpiUtGetTypeName (ObjectType), Op)); + + DEBUG_PRINT (TRACE_DISPATCH, ("AmlEndNamespaceScope/%s: Popping scope for Op %p\n", + AcpiCmGetTypeName (DataType), Op)); AcpiDsScopeStackPop (WalkState); } + + /* * Named operations are as follows: * - * AML_ALIAS - * AML_BANKFIELD - * AML_CREATEBITFIELD - * AML_CREATEBYTEFIELD - * AML_CREATEDWORDFIELD - * AML_CREATEFIELD - * AML_CREATEQWORDFIELD - * AML_CREATEWORDFIELD - * AML_DATA_REGION + * AML_SCOPE * AML_DEVICE - * AML_EVENT - * AML_FIELD - * AML_INDEXFIELD + * AML_THERMALZONE * AML_METHOD - * AML_METHODCALL - * AML_MUTEX - * AML_NAME - * AML_NAMEDFIELD - * AML_OPREGION * AML_POWERRES * AML_PROCESSOR - * AML_SCOPE - * AML_THERMALZONE + * AML_FIELD + * AML_INDEXFIELD + * AML_BANKFIELD + * AML_NAMEDFIELD + * AML_NAME + * AML_ALIAS + * AML_MUTEX + * AML_EVENT + * AML_OPREGION + * AML_CREATEFIELD + * AML_CREATEBITFIELD + * AML_CREATEBYTEFIELD + * AML_CREATEWORDFIELD + * AML_CREATEDWORDFIELD + * AML_METHODCALL */ - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Create-Load [%s] State=%p Op=%p NamedObj=%p\n", - AcpiPsGetOpcodeName (Op->Opcode), WalkState, Op, Node)); /* Decode the opcode */ Arg = Op->Value.Arg; - switch (WalkState->OpInfo->Type) + switch (Op->Opcode) { - case AML_TYPE_CREATE_FIELD: + + case AML_CREATE_FIELD_OP: + case AML_BIT_FIELD_OP: + case AML_BYTE_FIELD_OP: + case AML_WORD_FIELD_OP: + case AML_DWORD_FIELD_OP: + + DEBUG_PRINT (TRACE_DISPATCH, ("LOADING-CreateXxxField: State=%p Op=%p nte=%p\n", + WalkState, Op, Entry)); + + /* Get the NameString argument */ + + if (Op->Opcode == AML_CREATE_FIELD_OP) + { + Arg = AcpiPsGetArg (Op, 3); + } + else + { + /* Create Bit/Byte/Word/Dword field */ + + Arg = AcpiPsGetArg (Op, 2); + } /* - * Create the field object, but the field buffer and index must - * be evaluated later during the execution phase + * Enter the NameString into the namespace */ - Status = AcpiDsCreateBufferField (Op, WalkState); - break; - - case AML_TYPE_NAMED_FIELD: - - switch (Op->Opcode) + Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String, INTERNAL_TYPE_DEF_ANY, IMODE_LOAD_PASS1, + NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, WalkState, &(NewEntry)); + if (ACPI_SUCCESS (Status)) { - case AML_INDEX_FIELD_OP: - - Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->Node, - WalkState); - break; - - case AML_BANK_FIELD_OP: - - Status = AcpiDsCreateBankField (Op, Arg->Node, WalkState); - break; - - case AML_FIELD_OP: - - Status = AcpiDsCreateField (Op, Arg->Node, WalkState); - break; + /* We could put the returned object (NTE) 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->NameTableEntry = NewEntry; } + break; - case AML_TYPE_NAMED_SIMPLE: + case AML_METHODCALL_OP: + + DEBUG_PRINT (TRACE_DISPATCH, ("RESOLVING-MethodCall: State=%p Op=%p nte=%p\n", + WalkState, Op, Entry)); + + /* + * Lookup the method name and save the NTE + */ + + Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String, ACPI_TYPE_ANY, IMODE_LOAD_PASS2, + NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, WalkState, &(NewEntry)); + if (ACPI_SUCCESS (Status)) + { + +/* has name already been resolved by here ??*/ + + /* TBD: [Restructure] Make sure that what we found is indeed a method! */ + /* We didn't search for a method on purpose, to see if the name would resolve! */ + + /* We could put the returned object (NTE) 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->NameTableEntry = NewEntry; + } + + + break; + + + case AML_PROCESSOR_OP: + + /* Nothing to do other than enter object into namespace */ + + DEBUG_PRINT (TRACE_DISPATCH, ("LOADING-Processor: State=%p Op=%p nte=%p\n", + WalkState, Op, Entry)); + + Status = AcpiAmlExecCreateProcessor (Op, (ACPI_HANDLE) Entry); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } + + DEBUG_PRINT (TRACE_DISPATCH, ("Completed Processor Init, Op=%p State=%p entry=%p\n", Op, WalkState, Entry)); + break; + + + case AML_POWER_RES_OP: + + /* Nothing to do other than enter object into namespace */ + + DEBUG_PRINT (TRACE_DISPATCH, ("LOADING-PowerResource: State=%p Op=%p nte=%p\n", + WalkState, Op, Entry)); + + Status = AcpiAmlExecCreatePowerResource (Op, (ACPI_HANDLE) Entry); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } + + DEBUG_PRINT (TRACE_DISPATCH, ("Completed PowerResource Init, Op=%p State=%p entry=%p\n", Op, WalkState, Entry)); + break; + + + case AML_THERMAL_ZONE_OP: + + /* Nothing to do other than enter object into namespace */ + + DEBUG_PRINT (TRACE_DISPATCH, ("LOADING-ThermalZone: State=%p Op=%p nte=%p\n", + WalkState, Op, Entry)); + + break; + + + case AML_DEF_FIELD_OP: + + DEBUG_PRINT (TRACE_DISPATCH, ("LOADING-Field: State=%p Op=%p nte=%p\n", + WalkState, Op, Entry)); + + 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, (ACPI_HANDLE) Arg->NameTableEntry, WalkState); + break; + + + case AML_INDEX_FIELD_OP: + + DEBUG_PRINT (TRACE_DISPATCH, ("LOADING-IndexField: State=%p Op=%p nte=%p\n", + WalkState, Op, Entry)); + + Arg = Op->Value.Arg; + + Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->NameTableEntry, WalkState); + break; + + + case AML_BANK_FIELD_OP: + + DEBUG_PRINT (TRACE_DISPATCH, ("LOADING-BankField: State=%p Op=%p nte=%p\n", + WalkState, Op, Entry)); + + Arg = Op->Value.Arg; + Status = AcpiDsCreateBankField (Op, (ACPI_HANDLE) Arg->NameTableEntry, WalkState); + break; + + + /* + * MethodOp PkgLength NamesString MethodFlags TermList + */ + case AML_METHOD_OP: + + DEBUG_PRINT (TRACE_DISPATCH, ("LOADING-Method: State=%p Op=%p nte=%p\n", + WalkState, Op, Entry)); + + if (!Entry->Object) + { + Status = AcpiAmlExecCreateMethod (((ACPI_DEFERRED_OP *) Op)->Body, ((ACPI_DEFERRED_OP *) Op)->BodyLength, + Arg->Value.Integer, (ACPI_HANDLE) Entry); + } + + break; + + + case AML_MUTEX_OP: + + DEBUG_PRINT (TRACE_DISPATCH, ("LOADING-Mutex: Op=%p State=%p\n", Op, WalkState)); Status = AcpiDsCreateOperands (WalkState, Arg); if (ACPI_FAILURE (Status)) @@ -696,154 +700,70 @@ AcpiDsLoad2EndOp ( goto Cleanup; } - switch (Op->Opcode) + Status = AcpiAmlExecCreateMutex (WalkState); + break; + + + case AML_EVENT_OP: + + DEBUG_PRINT (TRACE_DISPATCH, ("LOADING-Event: Op=%p State=%p\n", Op, WalkState)); + + Status = AcpiDsCreateOperands (WalkState, Arg); + if (ACPI_FAILURE (Status)) { - case AML_PROCESSOR_OP: - - Status = AcpiExCreateProcessor (WalkState); - break; - - case AML_POWER_RES_OP: - - Status = AcpiExCreatePowerResource (WalkState); - break; - - case AML_MUTEX_OP: - - Status = AcpiExCreateMutex (WalkState); - break; - - case AML_EVENT_OP: - - Status = AcpiExCreateEvent (WalkState); - break; - - case AML_DATA_REGION_OP: - - Status = AcpiExCreateTableRegion (WalkState); - break; - - case AML_ALIAS_OP: - - Status = AcpiExCreateAlias (WalkState); - break; - - default: - /* Unknown opcode */ - - Status = AE_OK; goto Cleanup; - break; - } - - /* Delete operands */ - - for (i = 1; i < WalkState->NumOperands; i++) - { - AcpiUtRemoveReference (WalkState->Operands[i]); - WalkState->Operands[i] = NULL; } + Status = AcpiAmlExecCreateEvent (WalkState); break; - case AML_TYPE_NAMED_COMPLEX: + case AML_REGION_OP: - switch (Op->Opcode) - { - 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)); + DEBUG_PRINT (TRACE_DISPATCH, ("LOADING-Opregion: Op=%p State=%p Nte=%p\n", Op, WalkState, Entry)); - 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; - - - case AML_REGION_OP: - /* - * 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) - */ - /* - * If we have a valid region, initialize it - * Namespace is NOT locked at this point. - */ - Status = AcpiEvInitializeRegion (AcpiNsGetAttachedObject (Node), FALSE); - if (ACPI_FAILURE (Status)) - { - /* - * If AE_NOT_EXIST is returned, it is not fatal - * because many regions get created before a handler - * is installed for said region. - */ - if (AE_NOT_EXIST == Status) - { - Status = AE_OK; - } - } - break; - - - case AML_NAME_OP: - - Status = AcpiDsCreateNode (WalkState, Node, Op); - break; - } - break; - - - case AML_CLASS_INTERNAL: - - /* case AML_INT_NAMEPATH_OP: */ - break; - - - case AML_CLASS_METHOD_CALL: - - 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 + * 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) */ - 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)) - { - /* - * 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 - */ - if (NewNode->Type != ACPI_TYPE_METHOD) - { - Status = AE_AML_OPERAND_TYPE; - } - /* 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; + Status = AcpiAmlExecCreateRegion (((ACPI_DEFERRED_OP *) Op)->Body, ((ACPI_DEFERRED_OP *) Op)->BodyLength, + Arg->Value.Integer, WalkState); + + DEBUG_PRINT (TRACE_DISPATCH, ("Completed OpRegion Init, Op=%p State=%p entry=%p\n", Op, WalkState, Entry)); + break; + + + /* Namespace Modifier Opcodes */ + + case AML_ALIAS_OP: + + DEBUG_PRINT (TRACE_DISPATCH, ("LOADING-Alias: Op=%p State=%p\n", Op, WalkState)); + + Status = AcpiDsCreateOperands (WalkState, Arg); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; } + Status = AcpiAmlExecCreateAlias (WalkState); + break; + + + case AML_NAME_OP: + + DEBUG_PRINT (TRACE_DISPATCH, ("LOADING-Name: Op=%p State=%p\n", Op, WalkState)); + + Status = AcpiDsCreateNamedObject (WalkState, Entry, Op); + + break; + + + case AML_NAMEPATH_OP: + + DEBUG_PRINT (TRACE_DISPATCH, ("LOADING-NamePath object: State=%p Op=%p nte=%p\n", + WalkState, Op, Entry)); break; @@ -854,11 +774,7 @@ AcpiDsLoad2EndOp ( Cleanup: - /* Remove the Node pushed at the very beginning */ - - WalkState->Operands[0] = NULL; - WalkState->NumOperands = 0; + AcpiDsObjStackPop (1, WalkState); /* Remove the NTE pushed at the very beginning */ return (Status); } - diff --git a/source/components/executer/exconfig.c b/source/components/executer/exconfig.c index 3365dd575..0a4284e6c 100644 --- a/source/components/executer/exconfig.c +++ b/source/components/executer/exconfig.c @@ -118,19 +118,20 @@ #define __AMCONFIG_C__ #include "acpi.h" -#include "acparser.h" -#include "acinterp.h" +#include "parser.h" +#include "interp.h" #include "amlcode.h" -#include "acnamesp.h" -#include "acevents.h" -#include "actables.h" -#include "acdispat.h" +#include "namesp.h" +#include "events.h" +#include "tables.h" +#include "dispatch.h" #define _COMPONENT INTERPRETER MODULE_NAME ("amconfig"); + /***************************************************************************** * * FUNCTION: AcpiAmlExecLoadTable @@ -151,8 +152,8 @@ AcpiAmlExecLoadTable ( { ACPI_STATUS Status; ACPI_OBJECT_INTERNAL *TableDesc = NULL; - INT8 *TablePtr; - INT8 *TableDataPtr; + char *TablePtr; + char *TableDataPtr; ACPI_TABLE_HEADER TableHeader; ACPI_TABLE_DESC TableInfo; UINT32 i; @@ -168,8 +169,8 @@ AcpiAmlExecLoadTable ( TableHeader.Length = 0; for (i = 0; i < sizeof (ACPI_TABLE_HEADER); i++) { - Status = AcpiEvAddressSpaceDispatch (RgnDesc, ADDRESS_SPACE_READ, - i, 8, (UINT32 *) ((INT8 *) &TableHeader + i)); + Status = AcpiEvAddressSpaceDispatch (RgnDesc, ADDRESS_SPACE_READ, i, 8, + (UINT32 *) ((char *) &TableHeader + i)); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -194,8 +195,8 @@ AcpiAmlExecLoadTable ( for (i = 0; i < TableHeader.Length; i++) { - Status = AcpiEvAddressSpaceDispatch (RgnDesc, ADDRESS_SPACE_READ, - i, 8, (UINT32 *) (TableDataPtr + i)); + Status = AcpiEvAddressSpaceDispatch (RgnDesc, ADDRESS_SPACE_READ, i, 8, + (UINT32 *) (TableDataPtr + i)); if (ACPI_FAILURE (Status)) { goto Cleanup; @@ -205,16 +206,10 @@ AcpiAmlExecLoadTable ( /* Table must be either an SSDT or a PSDT */ - if ((!STRNCMP (TableHeader.Signature, - AcpiGbl_AcpiTableData[ACPI_TABLE_PSDT].Signature, - AcpiGbl_AcpiTableData[ACPI_TABLE_PSDT].SigLength)) && - (!STRNCMP (TableHeader.Signature, - AcpiGbl_AcpiTableData[ACPI_TABLE_SSDT].Signature, - AcpiGbl_AcpiTableData[ACPI_TABLE_SSDT].SigLength))) + if ((!STRNCMP (TableHeader.Signature, AcpiGbl_AcpiTableData[TABLE_PSDT].Signature, AcpiGbl_AcpiTableData[TABLE_PSDT].SigLength)) && + (!STRNCMP (TableHeader.Signature, AcpiGbl_AcpiTableData[TABLE_SSDT].Signature, AcpiGbl_AcpiTableData[TABLE_SSDT].SigLength))) { - DEBUG_PRINT (ACPI_ERROR, - ("Table has invalid signature [%4.4s], must be SSDT or PSDT\n", - TableHeader.Signature)); + DEBUG_PRINT (ACPI_ERROR, ("Table has invalid signature [%4.4s], must be SSDT or PSDT\n", TableHeader.Signature)); Status = AE_BAD_SIGNATURE; goto Cleanup; } @@ -301,9 +296,8 @@ AcpiAmlExecUnloadTable ( /* TBD: [Errors] Wasn't this done earlier? */ if ((!DdbHandle) || - (!VALID_DESCRIPTOR_TYPE (DdbHandle, ACPI_DESC_TYPE_INTERNAL)) || - (((ACPI_OBJECT_INTERNAL *)DdbHandle)->Common.Type != - INTERNAL_TYPE_REFERENCE)) + (!VALID_DESCRIPTOR_TYPE (DdbHandle, DESC_TYPE_ACPI_OBJ)) || + (((ACPI_OBJECT_INTERNAL *)DdbHandle)->Common.Type != INTERNAL_TYPE_REFERENCE)) { return_ACPI_STATUS (AE_BAD_PARAMETER); } @@ -365,13 +359,11 @@ AcpiAmlExecReconfiguration ( /* Resolve the operands */ Status = AcpiAmlResolveOperands (Opcode, WALK_OPERANDS); - DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (Opcode), - 2, "after AcpiAmlResolveOperands"); + DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (Opcode), 2, "after AcpiAmlResolveOperands"); /* Get the table handle, common for both opcodes */ - Status |= AcpiDsObjStackPopObject ((ACPI_OBJECT_INTERNAL **) &DdbHandle, - WalkState); + Status |= AcpiDsObjStackPopObject ((ACPI_OBJECT_INTERNAL **) &DdbHandle, WalkState); switch (Opcode) { @@ -381,29 +373,22 @@ AcpiAmlExecReconfiguration ( /* Get the region or field descriptor */ Status |= AcpiDsObjStackPopObject (&RegionDesc, WalkState); - if (ACPI_FAILURE (Status)) + if (Status != AE_OK) { - DEBUG_PRINT (ACPI_ERROR, - ("ExecReconfiguration/AML_LOAD_OP: bad operand(s) (0x%X)\n", - Status)); - - AcpiCmRemoveReference (RegionDesc); - return_ACPI_STATUS (Status); + AcpiAmlAppendOperandDiag (_THIS_MODULE, __LINE__, Opcode, WALK_OPERANDS, 2); + goto Cleanup2; } Status = AcpiAmlExecLoadTable (RegionDesc, DdbHandle); break; - case AML_UNLOAD_OP: + case AML_UN_LOAD_OP: - if (ACPI_FAILURE (Status)) + if (Status != AE_OK) { - DEBUG_PRINT (ACPI_ERROR, - ("ExecReconfiguration/AML_UNLOAD_OP: bad operand(s) (0x%X)\n", - Status)); - - return_ACPI_STATUS (Status); + AcpiAmlAppendOperandDiag (_THIS_MODULE, __LINE__, Opcode, WALK_OPERANDS, 1); + goto Cleanup1; } Status = AcpiAmlExecUnloadTable (DdbHandle); @@ -412,14 +397,17 @@ AcpiAmlExecReconfiguration ( default: - DEBUG_PRINT (ACPI_ERROR, ("AmlExecReconfiguration: bad opcode=%X\n", - Opcode)); + DEBUG_PRINT (ACPI_ERROR, ("AmlExecReconfiguration: bad opcode=%X\n", Opcode)); Status = AE_AML_BAD_OPCODE; break; } +Cleanup2: + AcpiCmRemoveReference (RegionDesc); + +Cleanup1: return_ACPI_STATUS (Status); }