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