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