Home | History | Annotate | Line # | Download | only in dispatcher
dswexec.c revision 1.1.1.16
      1 /******************************************************************************
      2  *
      3  * Module Name: dswexec - Dispatcher method execution callbacks;
      4  *                        dispatch to interpreter.
      5  *
      6  *****************************************************************************/
      7 
      8 /*
      9  * Copyright (C) 2000 - 2022, Intel Corp.
     10  * All rights reserved.
     11  *
     12  * Redistribution and use in source and binary forms, with or without
     13  * modification, are permitted provided that the following conditions
     14  * are met:
     15  * 1. Redistributions of source code must retain the above copyright
     16  *    notice, this list of conditions, and the following disclaimer,
     17  *    without modification.
     18  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     19  *    substantially similar to the "NO WARRANTY" disclaimer below
     20  *    ("Disclaimer") and any redistribution must be conditioned upon
     21  *    including a substantially similar Disclaimer requirement for further
     22  *    binary redistribution.
     23  * 3. Neither the names of the above-listed copyright holders nor the names
     24  *    of any contributors may be used to endorse or promote products derived
     25  *    from this software without specific prior written permission.
     26  *
     27  * Alternatively, this software may be distributed under the terms of the
     28  * GNU General Public License ("GPL") version 2 as published by the Free
     29  * Software Foundation.
     30  *
     31  * NO WARRANTY
     32  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     33  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     34  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     35  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     36  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     37  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     38  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     39  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     40  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     41  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     42  * POSSIBILITY OF SUCH DAMAGES.
     43  */
     44 
     45 #include "acpi.h"
     46 #include "accommon.h"
     47 #include "acparser.h"
     48 #include "amlcode.h"
     49 #include "acdispat.h"
     50 #include "acinterp.h"
     51 #include "acnamesp.h"
     52 #include "acdebug.h"
     53 #ifdef ACPI_EXEC_APP
     54 #include "aecommon.h"
     55 #endif
     56 
     57 #define _COMPONENT          ACPI_DISPATCHER
     58         ACPI_MODULE_NAME    ("dswexec")
     59 
     60 /*
     61  * Dispatch table for opcode classes
     62  */
     63 static ACPI_EXECUTE_OP      AcpiGbl_OpTypeDispatch [] =
     64 {
     65     AcpiExOpcode_0A_0T_1R,
     66     AcpiExOpcode_1A_0T_0R,
     67     AcpiExOpcode_1A_0T_1R,
     68     NULL,   /* Was: AcpiExOpcode_1A_0T_0R (Was for Load operator) */
     69     AcpiExOpcode_1A_1T_1R,
     70     AcpiExOpcode_2A_0T_0R,
     71     AcpiExOpcode_2A_0T_1R,
     72     AcpiExOpcode_2A_1T_1R,
     73     AcpiExOpcode_2A_2T_1R,
     74     AcpiExOpcode_3A_0T_0R,
     75     AcpiExOpcode_3A_1T_1R,
     76     AcpiExOpcode_6A_0T_1R
     77 };
     78 
     79 
     80 /*****************************************************************************
     81  *
     82  * FUNCTION:    AcpiDsGetPredicateValue
     83  *
     84  * PARAMETERS:  WalkState       - Current state of the parse tree walk
     85  *              ResultObj       - if non-zero, pop result from result stack
     86  *
     87  * RETURN:      Status
     88  *
     89  * DESCRIPTION: Get the result of a predicate evaluation
     90  *
     91  ****************************************************************************/
     92 
     93 ACPI_STATUS
     94 AcpiDsGetPredicateValue (
     95     ACPI_WALK_STATE         *WalkState,
     96     ACPI_OPERAND_OBJECT     *ResultObj)
     97 {
     98     ACPI_STATUS             Status = AE_OK;
     99     ACPI_OPERAND_OBJECT     *ObjDesc;
    100     ACPI_OPERAND_OBJECT     *LocalObjDesc = NULL;
    101 
    102 
    103     ACPI_FUNCTION_TRACE_PTR (DsGetPredicateValue, WalkState);
    104 
    105 
    106     WalkState->ControlState->Common.State = 0;
    107 
    108     if (ResultObj)
    109     {
    110         Status = AcpiDsResultPop (&ObjDesc, WalkState);
    111         if (ACPI_FAILURE (Status))
    112         {
    113             ACPI_EXCEPTION ((AE_INFO, Status,
    114                 "Could not get result from predicate evaluation"));
    115 
    116             return_ACPI_STATUS (Status);
    117         }
    118     }
    119     else
    120     {
    121         Status = AcpiDsCreateOperand (WalkState, WalkState->Op, 0);
    122         if (ACPI_FAILURE (Status))
    123         {
    124             return_ACPI_STATUS (Status);
    125         }
    126 
    127         Status = AcpiExResolveToValue (&WalkState->Operands [0], WalkState);
    128         if (ACPI_FAILURE (Status))
    129         {
    130             return_ACPI_STATUS (Status);
    131         }
    132 
    133         ObjDesc = WalkState->Operands [0];
    134     }
    135 
    136     if (!ObjDesc)
    137     {
    138         ACPI_ERROR ((AE_INFO,
    139             "No predicate ObjDesc=%p State=%p",
    140             ObjDesc, WalkState));
    141 
    142         return_ACPI_STATUS (AE_AML_NO_OPERAND);
    143     }
    144 
    145     /*
    146      * Result of predicate evaluation must be an Integer
    147      * object. Implicitly convert the argument if necessary.
    148      */
    149     Status = AcpiExConvertToInteger (ObjDesc, &LocalObjDesc,
    150         ACPI_IMPLICIT_CONVERSION);
    151     if (ACPI_FAILURE (Status))
    152     {
    153         goto Cleanup;
    154     }
    155 
    156     if (LocalObjDesc->Common.Type != ACPI_TYPE_INTEGER)
    157     {
    158         ACPI_ERROR ((AE_INFO,
    159             "Bad predicate (not an integer) ObjDesc=%p State=%p Type=0x%X",
    160             ObjDesc, WalkState, ObjDesc->Common.Type));
    161 
    162         Status = AE_AML_OPERAND_TYPE;
    163         goto Cleanup;
    164     }
    165 
    166     /* Truncate the predicate to 32-bits if necessary */
    167 
    168     (void) AcpiExTruncateFor32bitTable (LocalObjDesc);
    169 
    170     /*
    171      * Save the result of the predicate evaluation on
    172      * the control stack
    173      */
    174     if (LocalObjDesc->Integer.Value)
    175     {
    176         WalkState->ControlState->Common.Value = TRUE;
    177     }
    178     else
    179     {
    180         /*
    181          * Predicate is FALSE, we will just toss the
    182          * rest of the package
    183          */
    184         WalkState->ControlState->Common.Value = FALSE;
    185         Status = AE_CTRL_FALSE;
    186     }
    187 
    188     /* Predicate can be used for an implicit return value */
    189 
    190     (void) AcpiDsDoImplicitReturn (LocalObjDesc, WalkState, TRUE);
    191 
    192 
    193 Cleanup:
    194 
    195     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
    196         "Completed a predicate eval=%X Op=%p\n",
    197         WalkState->ControlState->Common.Value, WalkState->Op));
    198 
    199     /* Break to debugger to display result */
    200 
    201     AcpiDbDisplayResultObject (LocalObjDesc, WalkState);
    202 
    203     /*
    204      * Delete the predicate result object (we know that
    205      * we don't need it anymore)
    206      */
    207     if (LocalObjDesc != ObjDesc)
    208     {
    209         AcpiUtRemoveReference (LocalObjDesc);
    210     }
    211     AcpiUtRemoveReference (ObjDesc);
    212 
    213     WalkState->ControlState->Common.State = ACPI_CONTROL_NORMAL;
    214     return_ACPI_STATUS (Status);
    215 }
    216 
    217 
    218 /*****************************************************************************
    219  *
    220  * FUNCTION:    AcpiDsExecBeginOp
    221  *
    222  * PARAMETERS:  WalkState       - Current state of the parse tree walk
    223  *              OutOp           - Where to return op if a new one is created
    224  *
    225  * RETURN:      Status
    226  *
    227  * DESCRIPTION: Descending callback used during the execution of control
    228  *              methods. This is where most operators and operands are
    229  *              dispatched to the interpreter.
    230  *
    231  ****************************************************************************/
    232 
    233 ACPI_STATUS
    234 AcpiDsExecBeginOp (
    235     ACPI_WALK_STATE         *WalkState,
    236     ACPI_PARSE_OBJECT       **OutOp)
    237 {
    238     ACPI_PARSE_OBJECT       *Op;
    239     ACPI_STATUS             Status = AE_OK;
    240     UINT32                  OpcodeClass;
    241 
    242 
    243     ACPI_FUNCTION_TRACE_PTR (DsExecBeginOp, WalkState);
    244 
    245 
    246     Op = WalkState->Op;
    247     if (!Op)
    248     {
    249         Status = AcpiDsLoad2BeginOp (WalkState, OutOp);
    250         if (ACPI_FAILURE (Status))
    251         {
    252             goto ErrorExit;
    253         }
    254 
    255         Op = *OutOp;
    256         WalkState->Op = Op;
    257         WalkState->Opcode = Op->Common.AmlOpcode;
    258         WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
    259 
    260         if (AcpiNsOpensScope (WalkState->OpInfo->ObjectType))
    261         {
    262             ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
    263                 "(%s) Popping scope for Op %p\n",
    264                 AcpiUtGetTypeName (WalkState->OpInfo->ObjectType), Op));
    265 
    266             Status = AcpiDsScopeStackPop (WalkState);
    267             if (ACPI_FAILURE (Status))
    268             {
    269                 goto ErrorExit;
    270             }
    271         }
    272     }
    273 
    274     if (Op == WalkState->Origin)
    275     {
    276         if (OutOp)
    277         {
    278             *OutOp = Op;
    279         }
    280 
    281         return_ACPI_STATUS (AE_OK);
    282     }
    283 
    284     /*
    285      * If the previous opcode was a conditional, this opcode
    286      * must be the beginning of the associated predicate.
    287      * Save this knowledge in the current scope descriptor
    288      */
    289     if ((WalkState->ControlState) &&
    290         (WalkState->ControlState->Common.State ==
    291             ACPI_CONTROL_CONDITIONAL_EXECUTING))
    292     {
    293         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
    294             "Exec predicate Op=%p State=%p\n",
    295             Op, WalkState));
    296 
    297         WalkState->ControlState->Common.State =
    298             ACPI_CONTROL_PREDICATE_EXECUTING;
    299 
    300         /* Save start of predicate */
    301 
    302         WalkState->ControlState->Control.PredicateOp = Op;
    303     }
    304 
    305 
    306     OpcodeClass = WalkState->OpInfo->Class;
    307 
    308     /* We want to send namepaths to the load code */
    309 
    310     if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
    311     {
    312         OpcodeClass = AML_CLASS_NAMED_OBJECT;
    313     }
    314 
    315     /*
    316      * Handle the opcode based upon the opcode type
    317      */
    318     switch (OpcodeClass)
    319     {
    320     case AML_CLASS_CONTROL:
    321 
    322         Status = AcpiDsExecBeginControlOp (WalkState, Op);
    323         break;
    324 
    325     case AML_CLASS_NAMED_OBJECT:
    326 
    327         if (WalkState->WalkType & ACPI_WALK_METHOD)
    328         {
    329             /*
    330              * Found a named object declaration during method execution;
    331              * we must enter this object into the namespace. The created
    332              * object is temporary and will be deleted upon completion of
    333              * the execution of this method.
    334              *
    335              * Note 10/2010: Except for the Scope() op. This opcode does
    336              * not actually create a new object, it refers to an existing
    337              * object. However, for Scope(), we want to indeed open a
    338              * new scope.
    339              */
    340             if (Op->Common.AmlOpcode != AML_SCOPE_OP)
    341             {
    342                 Status = AcpiDsLoad2BeginOp (WalkState, NULL);
    343             }
    344             else
    345             {
    346                 Status = AcpiDsScopeStackPush (
    347                     Op->Named.Node, Op->Named.Node->Type, WalkState);
    348                 if (ACPI_FAILURE (Status))
    349                 {
    350                     return_ACPI_STATUS (Status);
    351                 }
    352             }
    353         }
    354         break;
    355 
    356     case AML_CLASS_EXECUTE:
    357     case AML_CLASS_CREATE:
    358 
    359         break;
    360 
    361     default:
    362 
    363         break;
    364     }
    365 
    366     /* Nothing to do here during method execution */
    367 
    368     return_ACPI_STATUS (Status);
    369 
    370 
    371 ErrorExit:
    372     Status = AcpiDsMethodError (Status, WalkState);
    373     return_ACPI_STATUS (Status);
    374 }
    375 
    376 
    377 /*****************************************************************************
    378  *
    379  * FUNCTION:    AcpiDsExecEndOp
    380  *
    381  * PARAMETERS:  WalkState       - Current state of the parse tree walk
    382  *
    383  * RETURN:      Status
    384  *
    385  * DESCRIPTION: Ascending callback used during the execution of control
    386  *              methods. The only thing we really need to do here is to
    387  *              notice the beginning of IF, ELSE, and WHILE blocks.
    388  *
    389  ****************************************************************************/
    390 
    391 ACPI_STATUS
    392 AcpiDsExecEndOp (
    393     ACPI_WALK_STATE         *WalkState)
    394 {
    395     ACPI_PARSE_OBJECT       *Op;
    396     ACPI_STATUS             Status = AE_OK;
    397     UINT32                  OpType;
    398     UINT32                  OpClass;
    399     ACPI_PARSE_OBJECT       *NextOp;
    400     ACPI_PARSE_OBJECT       *FirstArg;
    401 #ifdef ACPI_EXEC_APP
    402     char                    *Namepath;
    403     ACPI_OPERAND_OBJECT     *ObjDesc;
    404 #endif
    405 
    406     ACPI_FUNCTION_TRACE_PTR (DsExecEndOp, WalkState);
    407 
    408 
    409     Op = WalkState->Op;
    410     OpType = WalkState->OpInfo->Type;
    411     OpClass = WalkState->OpInfo->Class;
    412 
    413     if (OpClass == AML_CLASS_UNKNOWN)
    414     {
    415         ACPI_ERROR ((AE_INFO, "Unknown opcode 0x%X", Op->Common.AmlOpcode));
    416         return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
    417     }
    418 
    419     FirstArg = Op->Common.Value.Arg;
    420 
    421     /* Init the walk state */
    422 
    423     WalkState->NumOperands = 0;
    424     WalkState->OperandIndex = 0;
    425     WalkState->ReturnDesc = NULL;
    426     WalkState->ResultObj = NULL;
    427 
    428     /* Call debugger for single step support (DEBUG build only) */
    429 
    430     Status = AcpiDbSingleStep (WalkState, Op, OpClass);
    431     if (ACPI_FAILURE (Status))
    432     {
    433         return_ACPI_STATUS (Status);
    434     }
    435 
    436     /* Decode the Opcode Class */
    437 
    438     switch (OpClass)
    439     {
    440     case AML_CLASS_ARGUMENT:    /* Constants, literals, etc. */
    441 
    442         if (WalkState->Opcode == AML_INT_NAMEPATH_OP)
    443         {
    444             Status = AcpiDsEvaluateNamePath (WalkState);
    445             if (ACPI_FAILURE (Status))
    446             {
    447                 goto Cleanup;
    448             }
    449         }
    450         break;
    451 
    452     case AML_CLASS_EXECUTE:     /* Most operators with arguments */
    453 
    454         /* Build resolved operand stack */
    455 
    456         Status = AcpiDsCreateOperands (WalkState, FirstArg);
    457         if (ACPI_FAILURE (Status))
    458         {
    459             goto Cleanup;
    460         }
    461 
    462         /*
    463          * All opcodes require operand resolution, with the only exceptions
    464          * being the ObjectType and SizeOf operators.
    465          */
    466         if (!(WalkState->OpInfo->Flags & AML_NO_OPERAND_RESOLVE))
    467         {
    468             /* Resolve all operands */
    469 
    470             Status = AcpiExResolveOperands (WalkState->Opcode,
    471                 &(WalkState->Operands [WalkState->NumOperands -1]),
    472                 WalkState);
    473         }
    474 
    475         if (ACPI_SUCCESS (Status))
    476         {
    477             /*
    478              * Dispatch the request to the appropriate interpreter handler
    479              * routine. There is one routine per opcode "type" based upon the
    480              * number of opcode arguments and return type.
    481              */
    482             Status = AcpiGbl_OpTypeDispatch[OpType] (WalkState);
    483         }
    484         else
    485         {
    486             /*
    487              * Treat constructs of the form "Store(LocalX,LocalX)" as noops when the
    488              * Local is uninitialized.
    489              */
    490             if  ((Status == AE_AML_UNINITIALIZED_LOCAL) &&
    491                 (WalkState->Opcode == AML_STORE_OP) &&
    492                 (WalkState->Operands[0]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
    493                 (WalkState->Operands[1]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
    494                 (WalkState->Operands[0]->Reference.Class ==
    495                  WalkState->Operands[1]->Reference.Class) &&
    496                 (WalkState->Operands[0]->Reference.Value ==
    497                  WalkState->Operands[1]->Reference.Value))
    498             {
    499                 Status = AE_OK;
    500             }
    501             else
    502             {
    503                 ACPI_EXCEPTION ((AE_INFO, Status,
    504                     "While resolving operands for [%s]",
    505                     AcpiPsGetOpcodeName (WalkState->Opcode)));
    506             }
    507         }
    508 
    509         /* Always delete the argument objects and clear the operand stack */
    510 
    511         AcpiDsClearOperands (WalkState);
    512 
    513         /*
    514          * If a result object was returned from above, push it on the
    515          * current result stack
    516          */
    517         if (ACPI_SUCCESS (Status) &&
    518             WalkState->ResultObj)
    519         {
    520             Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
    521         }
    522         break;
    523 
    524     default:
    525 
    526         switch (OpType)
    527         {
    528         case AML_TYPE_CONTROL:    /* Type 1 opcode, IF/ELSE/WHILE/NOOP */
    529 
    530             /* 1 Operand, 0 ExternalResult, 0 InternalResult */
    531 
    532             Status = AcpiDsExecEndControlOp (WalkState, Op);
    533 
    534             break;
    535 
    536         case AML_TYPE_METHOD_CALL:
    537             /*
    538              * If the method is referenced from within a package
    539              * declaration, it is not a invocation of the method, just
    540              * a reference to it.
    541              */
    542             if ((Op->Asl.Parent) &&
    543                ((Op->Asl.Parent->Asl.AmlOpcode == AML_PACKAGE_OP) ||
    544                 (Op->Asl.Parent->Asl.AmlOpcode == AML_VARIABLE_PACKAGE_OP)))
    545             {
    546                 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
    547                     "Method Reference in a Package, Op=%p\n", Op));
    548 
    549                 Op->Common.Node = (ACPI_NAMESPACE_NODE *)
    550                     Op->Asl.Value.Arg->Asl.Node;
    551                 AcpiUtAddReference (Op->Asl.Value.Arg->Asl.Node->Object);
    552                 return_ACPI_STATUS (AE_OK);
    553             }
    554 
    555             ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
    556                 "Method invocation, Op=%p\n", Op));
    557 
    558             /*
    559              * (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains
    560              * the method Node pointer
    561              */
    562             /* NextOp points to the op that holds the method name */
    563 
    564             NextOp = FirstArg;
    565 
    566             /* NextOp points to first argument op */
    567 
    568             NextOp = NextOp->Common.Next;
    569 
    570             /*
    571              * Get the method's arguments and put them on the operand stack
    572              */
    573             Status = AcpiDsCreateOperands (WalkState, NextOp);
    574             if (ACPI_FAILURE (Status))
    575             {
    576                 break;
    577             }
    578 
    579             /*
    580              * Since the operands will be passed to another control method,
    581              * we must resolve all local references here (Local variables,
    582              * arguments to *this* method, etc.)
    583              */
    584             Status = AcpiDsResolveOperands (WalkState);
    585             if (ACPI_FAILURE (Status))
    586             {
    587                 /* On error, clear all resolved operands */
    588 
    589                 AcpiDsClearOperands (WalkState);
    590                 break;
    591             }
    592 
    593             /*
    594              * Tell the walk loop to preempt this running method and
    595              * execute the new method
    596              */
    597             Status = AE_CTRL_TRANSFER;
    598 
    599             /*
    600              * Return now; we don't want to disturb anything,
    601              * especially the operand count!
    602              */
    603             return_ACPI_STATUS (Status);
    604 
    605         case AML_TYPE_CREATE_FIELD:
    606 
    607             ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
    608                 "Executing CreateField Buffer/Index Op=%p\n", Op));
    609 
    610             Status = AcpiDsLoad2EndOp (WalkState);
    611             if (ACPI_FAILURE (Status))
    612             {
    613                 break;
    614             }
    615 
    616             Status = AcpiDsEvalBufferFieldOperands (WalkState, Op);
    617             if (ACPI_FAILURE (Status))
    618             {
    619                 break;
    620             }
    621 
    622 #ifdef ACPI_EXEC_APP
    623             /*
    624              * AcpiExec support for namespace initialization file (initialize
    625              * BufferFields in this code.)
    626              */
    627             Namepath = AcpiNsGetExternalPathname (Op->Common.Node);
    628             Status = AeLookupInitFileEntry (Namepath, &ObjDesc);
    629             if (ACPI_SUCCESS (Status))
    630             {
    631                 Status = AcpiExWriteDataToField (ObjDesc, Op->Common.Node->Object, NULL);
    632                 if (ACPI_FAILURE (Status))
    633                 {
    634                     ACPI_EXCEPTION ((AE_INFO, Status, "While writing to buffer field"));
    635                 }
    636             }
    637             ACPI_FREE (Namepath);
    638             Status = AE_OK;
    639 #endif
    640             break;
    641 
    642 
    643         case AML_TYPE_CREATE_OBJECT:
    644 
    645             ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
    646                 "Executing CreateObject (Buffer/Package) Op=%p Child=%p ParentOpcode=%4.4X\n",
    647                 Op, Op->Named.Value.Arg, Op->Common.Parent->Common.AmlOpcode));
    648 
    649             switch (Op->Common.Parent->Common.AmlOpcode)
    650             {
    651             case AML_NAME_OP:
    652                 /*
    653                  * Put the Node on the object stack (Contains the ACPI Name
    654                  * of this object)
    655                  */
    656                 WalkState->Operands[0] = (void *)
    657                     Op->Common.Parent->Common.Node;
    658                 WalkState->NumOperands = 1;
    659 
    660                 Status = AcpiDsCreateNode (WalkState,
    661                     Op->Common.Parent->Common.Node, Op->Common.Parent);
    662                 if (ACPI_FAILURE (Status))
    663                 {
    664                     break;
    665                 }
    666 
    667                 ACPI_FALLTHROUGH;
    668 
    669             case AML_INT_EVAL_SUBTREE_OP:
    670 
    671                 Status = AcpiDsEvalDataObjectOperands (WalkState, Op,
    672                     AcpiNsGetAttachedObject (Op->Common.Parent->Common.Node));
    673                 break;
    674 
    675             default:
    676 
    677                 Status = AcpiDsEvalDataObjectOperands (WalkState, Op, NULL);
    678                 break;
    679             }
    680 
    681             /*
    682              * If a result object was returned from above, push it on the
    683              * current result stack
    684              */
    685             if (WalkState->ResultObj)
    686             {
    687                 Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
    688             }
    689             break;
    690 
    691         case AML_TYPE_NAMED_FIELD:
    692         case AML_TYPE_NAMED_COMPLEX:
    693         case AML_TYPE_NAMED_SIMPLE:
    694         case AML_TYPE_NAMED_NO_OBJ:
    695 
    696             Status = AcpiDsLoad2EndOp (WalkState);
    697             if (ACPI_FAILURE (Status))
    698             {
    699                 break;
    700             }
    701 
    702             if (Op->Common.AmlOpcode == AML_REGION_OP)
    703             {
    704                 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
    705                     "Executing OpRegion Address/Length Op=%p\n", Op));
    706 
    707                 Status = AcpiDsEvalRegionOperands (WalkState, Op);
    708                 if (ACPI_FAILURE (Status))
    709                 {
    710                     break;
    711                 }
    712             }
    713             else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP)
    714             {
    715                 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
    716                     "Executing DataTableRegion Strings Op=%p\n", Op));
    717 
    718                 Status = AcpiDsEvalTableRegionOperands (WalkState, Op);
    719                 if (ACPI_FAILURE (Status))
    720                 {
    721                     break;
    722                 }
    723             }
    724             else if (Op->Common.AmlOpcode == AML_BANK_FIELD_OP)
    725             {
    726                 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
    727                     "Executing BankField Op=%p\n", Op));
    728 
    729                 Status = AcpiDsEvalBankFieldOperands (WalkState, Op);
    730                 if (ACPI_FAILURE (Status))
    731                 {
    732                     break;
    733                 }
    734             }
    735             break;
    736 
    737         case AML_TYPE_UNDEFINED:
    738 
    739             ACPI_ERROR ((AE_INFO,
    740                 "Undefined opcode type Op=%p", Op));
    741             return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
    742 
    743         case AML_TYPE_BOGUS:
    744 
    745             ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
    746                 "Internal opcode=%X type Op=%p\n",
    747                 WalkState->Opcode, Op));
    748             break;
    749 
    750         default:
    751 
    752             ACPI_ERROR ((AE_INFO,
    753                 "Unimplemented opcode, class=0x%X "
    754                 "type=0x%X Opcode=0x%X Op=%p",
    755                 OpClass, OpType, Op->Common.AmlOpcode, Op));
    756 
    757             Status = AE_NOT_IMPLEMENTED;
    758             break;
    759         }
    760     }
    761 
    762     /*
    763      * ACPI 2.0 support for 64-bit integers: Truncate numeric
    764      * result value if we are executing from a 32-bit ACPI table
    765      */
    766     (void) AcpiExTruncateFor32bitTable (WalkState->ResultObj);
    767 
    768     /*
    769      * Check if we just completed the evaluation of a
    770      * conditional predicate
    771      */
    772     if ((ACPI_SUCCESS (Status)) &&
    773         (WalkState->ControlState) &&
    774         (WalkState->ControlState->Common.State ==
    775             ACPI_CONTROL_PREDICATE_EXECUTING) &&
    776         (WalkState->ControlState->Control.PredicateOp == Op))
    777     {
    778         Status = AcpiDsGetPredicateValue (WalkState, WalkState->ResultObj);
    779         WalkState->ResultObj = NULL;
    780     }
    781 
    782 
    783 Cleanup:
    784 
    785     if (WalkState->ResultObj)
    786     {
    787         /* Break to debugger to display result */
    788 
    789         AcpiDbDisplayResultObject (WalkState->ResultObj,WalkState);
    790 
    791         /*
    792          * Delete the result op if and only if:
    793          * Parent will not use the result -- such as any
    794          * non-nested type2 op in a method (parent will be method)
    795          */
    796         AcpiDsDeleteResultIfNotUsed (Op, WalkState->ResultObj, WalkState);
    797     }
    798 
    799 #ifdef _UNDER_DEVELOPMENT
    800 
    801     if (WalkState->ParserState.Aml == WalkState->ParserState.AmlEnd)
    802     {
    803         AcpiDbMethodEnd (WalkState);
    804     }
    805 #endif
    806 
    807     /* Invoke exception handler on error */
    808 
    809     if (ACPI_FAILURE (Status))
    810     {
    811         Status = AcpiDsMethodError (Status, WalkState);
    812     }
    813 
    814     /* Always clear the object stack */
    815 
    816     WalkState->NumOperands = 0;
    817     return_ACPI_STATUS (Status);
    818 }
    819