Home | History | Annotate | Line # | Download | only in executer
exresop.c revision 1.1.1.15.6.1
      1           1.1    jruoho /******************************************************************************
      2           1.1    jruoho  *
      3           1.1    jruoho  * Module Name: exresop - AML Interpreter operand/object resolution
      4           1.1    jruoho  *
      5           1.1    jruoho  *****************************************************************************/
      6           1.1    jruoho 
      7  1.1.1.15.6.1  perseant /******************************************************************************
      8  1.1.1.15.6.1  perseant  *
      9  1.1.1.15.6.1  perseant  * 1. Copyright Notice
     10  1.1.1.15.6.1  perseant  *
     11  1.1.1.15.6.1  perseant  * Some or all of this work - Copyright (c) 1999 - 2024, Intel Corp.
     12           1.1    jruoho  * All rights reserved.
     13           1.1    jruoho  *
     14  1.1.1.15.6.1  perseant  * 2. License
     15  1.1.1.15.6.1  perseant  *
     16  1.1.1.15.6.1  perseant  * 2.1. This is your license from Intel Corp. under its intellectual property
     17  1.1.1.15.6.1  perseant  * rights. You may have additional license terms from the party that provided
     18  1.1.1.15.6.1  perseant  * you this software, covering your right to use that party's intellectual
     19  1.1.1.15.6.1  perseant  * property rights.
     20  1.1.1.15.6.1  perseant  *
     21  1.1.1.15.6.1  perseant  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
     22  1.1.1.15.6.1  perseant  * copy of the source code appearing in this file ("Covered Code") an
     23  1.1.1.15.6.1  perseant  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
     24  1.1.1.15.6.1  perseant  * base code distributed originally by Intel ("Original Intel Code") to copy,
     25  1.1.1.15.6.1  perseant  * make derivatives, distribute, use and display any portion of the Covered
     26  1.1.1.15.6.1  perseant  * Code in any form, with the right to sublicense such rights; and
     27  1.1.1.15.6.1  perseant  *
     28  1.1.1.15.6.1  perseant  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
     29  1.1.1.15.6.1  perseant  * license (with the right to sublicense), under only those claims of Intel
     30  1.1.1.15.6.1  perseant  * patents that are infringed by the Original Intel Code, to make, use, sell,
     31  1.1.1.15.6.1  perseant  * offer to sell, and import the Covered Code and derivative works thereof
     32  1.1.1.15.6.1  perseant  * solely to the minimum extent necessary to exercise the above copyright
     33  1.1.1.15.6.1  perseant  * license, and in no event shall the patent license extend to any additions
     34  1.1.1.15.6.1  perseant  * to or modifications of the Original Intel Code. No other license or right
     35  1.1.1.15.6.1  perseant  * is granted directly or by implication, estoppel or otherwise;
     36  1.1.1.15.6.1  perseant  *
     37  1.1.1.15.6.1  perseant  * The above copyright and patent license is granted only if the following
     38  1.1.1.15.6.1  perseant  * conditions are met:
     39  1.1.1.15.6.1  perseant  *
     40  1.1.1.15.6.1  perseant  * 3. Conditions
     41  1.1.1.15.6.1  perseant  *
     42  1.1.1.15.6.1  perseant  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
     43  1.1.1.15.6.1  perseant  * Redistribution of source code of any substantial portion of the Covered
     44  1.1.1.15.6.1  perseant  * Code or modification with rights to further distribute source must include
     45  1.1.1.15.6.1  perseant  * the above Copyright Notice, the above License, this list of Conditions,
     46  1.1.1.15.6.1  perseant  * and the following Disclaimer and Export Compliance provision. In addition,
     47  1.1.1.15.6.1  perseant  * Licensee must cause all Covered Code to which Licensee contributes to
     48  1.1.1.15.6.1  perseant  * contain a file documenting the changes Licensee made to create that Covered
     49  1.1.1.15.6.1  perseant  * Code and the date of any change. Licensee must include in that file the
     50  1.1.1.15.6.1  perseant  * documentation of any changes made by any predecessor Licensee. Licensee
     51  1.1.1.15.6.1  perseant  * must include a prominent statement that the modification is derived,
     52  1.1.1.15.6.1  perseant  * directly or indirectly, from Original Intel Code.
     53  1.1.1.15.6.1  perseant  *
     54  1.1.1.15.6.1  perseant  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
     55  1.1.1.15.6.1  perseant  * Redistribution of source code of any substantial portion of the Covered
     56  1.1.1.15.6.1  perseant  * Code or modification without rights to further distribute source must
     57  1.1.1.15.6.1  perseant  * include the following Disclaimer and Export Compliance provision in the
     58  1.1.1.15.6.1  perseant  * documentation and/or other materials provided with distribution. In
     59  1.1.1.15.6.1  perseant  * addition, Licensee may not authorize further sublicense of source of any
     60  1.1.1.15.6.1  perseant  * portion of the Covered Code, and must include terms to the effect that the
     61  1.1.1.15.6.1  perseant  * license from Licensee to its licensee is limited to the intellectual
     62  1.1.1.15.6.1  perseant  * property embodied in the software Licensee provides to its licensee, and
     63  1.1.1.15.6.1  perseant  * not to intellectual property embodied in modifications its licensee may
     64  1.1.1.15.6.1  perseant  * make.
     65  1.1.1.15.6.1  perseant  *
     66  1.1.1.15.6.1  perseant  * 3.3. Redistribution of Executable. Redistribution in executable form of any
     67  1.1.1.15.6.1  perseant  * substantial portion of the Covered Code or modification must reproduce the
     68  1.1.1.15.6.1  perseant  * above Copyright Notice, and the following Disclaimer and Export Compliance
     69  1.1.1.15.6.1  perseant  * provision in the documentation and/or other materials provided with the
     70  1.1.1.15.6.1  perseant  * distribution.
     71  1.1.1.15.6.1  perseant  *
     72  1.1.1.15.6.1  perseant  * 3.4. Intel retains all right, title, and interest in and to the Original
     73  1.1.1.15.6.1  perseant  * Intel Code.
     74  1.1.1.15.6.1  perseant  *
     75  1.1.1.15.6.1  perseant  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
     76  1.1.1.15.6.1  perseant  * Intel shall be used in advertising or otherwise to promote the sale, use or
     77  1.1.1.15.6.1  perseant  * other dealings in products derived from or relating to the Covered Code
     78  1.1.1.15.6.1  perseant  * without prior written authorization from Intel.
     79  1.1.1.15.6.1  perseant  *
     80  1.1.1.15.6.1  perseant  * 4. Disclaimer and Export Compliance
     81  1.1.1.15.6.1  perseant  *
     82  1.1.1.15.6.1  perseant  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
     83  1.1.1.15.6.1  perseant  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
     84  1.1.1.15.6.1  perseant  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
     85  1.1.1.15.6.1  perseant  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
     86  1.1.1.15.6.1  perseant  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
     87  1.1.1.15.6.1  perseant  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
     88  1.1.1.15.6.1  perseant  * PARTICULAR PURPOSE.
     89  1.1.1.15.6.1  perseant  *
     90  1.1.1.15.6.1  perseant  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
     91  1.1.1.15.6.1  perseant  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
     92  1.1.1.15.6.1  perseant  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
     93  1.1.1.15.6.1  perseant  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
     94  1.1.1.15.6.1  perseant  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
     95  1.1.1.15.6.1  perseant  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
     96  1.1.1.15.6.1  perseant  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
     97  1.1.1.15.6.1  perseant  * LIMITED REMEDY.
     98  1.1.1.15.6.1  perseant  *
     99  1.1.1.15.6.1  perseant  * 4.3. Licensee shall not export, either directly or indirectly, any of this
    100  1.1.1.15.6.1  perseant  * software or system incorporating such software without first obtaining any
    101  1.1.1.15.6.1  perseant  * required license or other approval from the U. S. Department of Commerce or
    102  1.1.1.15.6.1  perseant  * any other agency or department of the United States Government. In the
    103  1.1.1.15.6.1  perseant  * event Licensee exports any such software from the United States or
    104  1.1.1.15.6.1  perseant  * re-exports any such software from a foreign destination, Licensee shall
    105  1.1.1.15.6.1  perseant  * ensure that the distribution and export/re-export of the software is in
    106  1.1.1.15.6.1  perseant  * compliance with all laws, regulations, orders, or other restrictions of the
    107  1.1.1.15.6.1  perseant  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
    108  1.1.1.15.6.1  perseant  * any of its subsidiaries will export/re-export any technical data, process,
    109  1.1.1.15.6.1  perseant  * software, or service, directly or indirectly, to any country for which the
    110  1.1.1.15.6.1  perseant  * United States government or any agency thereof requires an export license,
    111  1.1.1.15.6.1  perseant  * other governmental approval, or letter of assurance, without first obtaining
    112  1.1.1.15.6.1  perseant  * such license, approval or letter.
    113  1.1.1.15.6.1  perseant  *
    114  1.1.1.15.6.1  perseant  *****************************************************************************
    115  1.1.1.15.6.1  perseant  *
    116  1.1.1.15.6.1  perseant  * Alternatively, you may choose to be licensed under the terms of the
    117  1.1.1.15.6.1  perseant  * following license:
    118  1.1.1.15.6.1  perseant  *
    119       1.1.1.2    jruoho  * Redistribution and use in source and binary forms, with or without
    120       1.1.1.2    jruoho  * modification, are permitted provided that the following conditions
    121       1.1.1.2    jruoho  * are met:
    122       1.1.1.2    jruoho  * 1. Redistributions of source code must retain the above copyright
    123       1.1.1.2    jruoho  *    notice, this list of conditions, and the following disclaimer,
    124       1.1.1.2    jruoho  *    without modification.
    125       1.1.1.2    jruoho  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
    126       1.1.1.2    jruoho  *    substantially similar to the "NO WARRANTY" disclaimer below
    127       1.1.1.2    jruoho  *    ("Disclaimer") and any redistribution must be conditioned upon
    128       1.1.1.2    jruoho  *    including a substantially similar Disclaimer requirement for further
    129       1.1.1.2    jruoho  *    binary redistribution.
    130       1.1.1.2    jruoho  * 3. Neither the names of the above-listed copyright holders nor the names
    131       1.1.1.2    jruoho  *    of any contributors may be used to endorse or promote products derived
    132       1.1.1.2    jruoho  *    from this software without specific prior written permission.
    133       1.1.1.2    jruoho  *
    134       1.1.1.2    jruoho  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    135       1.1.1.2    jruoho  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    136      1.1.1.13  christos  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    137       1.1.1.2    jruoho  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    138  1.1.1.15.6.1  perseant  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    139  1.1.1.15.6.1  perseant  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    140  1.1.1.15.6.1  perseant  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    141  1.1.1.15.6.1  perseant  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    142  1.1.1.15.6.1  perseant  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    143  1.1.1.15.6.1  perseant  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    144  1.1.1.15.6.1  perseant  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    145  1.1.1.15.6.1  perseant  *
    146  1.1.1.15.6.1  perseant  * Alternatively, you may choose to be licensed under the terms of the
    147  1.1.1.15.6.1  perseant  * GNU General Public License ("GPL") version 2 as published by the Free
    148  1.1.1.15.6.1  perseant  * Software Foundation.
    149  1.1.1.15.6.1  perseant  *
    150  1.1.1.15.6.1  perseant  *****************************************************************************/
    151           1.1    jruoho 
    152           1.1    jruoho #include "acpi.h"
    153           1.1    jruoho #include "accommon.h"
    154           1.1    jruoho #include "amlcode.h"
    155           1.1    jruoho #include "acparser.h"
    156           1.1    jruoho #include "acinterp.h"
    157           1.1    jruoho #include "acnamesp.h"
    158           1.1    jruoho 
    159           1.1    jruoho 
    160           1.1    jruoho #define _COMPONENT          ACPI_EXECUTER
    161           1.1    jruoho         ACPI_MODULE_NAME    ("exresop")
    162           1.1    jruoho 
    163           1.1    jruoho /* Local prototypes */
    164           1.1    jruoho 
    165           1.1    jruoho static ACPI_STATUS
    166           1.1    jruoho AcpiExCheckObjectType (
    167           1.1    jruoho     ACPI_OBJECT_TYPE        TypeNeeded,
    168           1.1    jruoho     ACPI_OBJECT_TYPE        ThisType,
    169           1.1    jruoho     void                    *Object);
    170           1.1    jruoho 
    171           1.1    jruoho 
    172           1.1    jruoho /*******************************************************************************
    173           1.1    jruoho  *
    174           1.1    jruoho  * FUNCTION:    AcpiExCheckObjectType
    175           1.1    jruoho  *
    176           1.1    jruoho  * PARAMETERS:  TypeNeeded          Object type needed
    177           1.1    jruoho  *              ThisType            Actual object type
    178           1.1    jruoho  *              Object              Object pointer
    179           1.1    jruoho  *
    180           1.1    jruoho  * RETURN:      Status
    181           1.1    jruoho  *
    182           1.1    jruoho  * DESCRIPTION: Check required type against actual type
    183           1.1    jruoho  *
    184           1.1    jruoho  ******************************************************************************/
    185           1.1    jruoho 
    186           1.1    jruoho static ACPI_STATUS
    187           1.1    jruoho AcpiExCheckObjectType (
    188           1.1    jruoho     ACPI_OBJECT_TYPE        TypeNeeded,
    189           1.1    jruoho     ACPI_OBJECT_TYPE        ThisType,
    190           1.1    jruoho     void                    *Object)
    191           1.1    jruoho {
    192           1.1    jruoho     ACPI_FUNCTION_ENTRY ();
    193           1.1    jruoho 
    194           1.1    jruoho 
    195           1.1    jruoho     if (TypeNeeded == ACPI_TYPE_ANY)
    196           1.1    jruoho     {
    197           1.1    jruoho         /* All types OK, so we don't perform any typechecks */
    198           1.1    jruoho 
    199           1.1    jruoho         return (AE_OK);
    200           1.1    jruoho     }
    201           1.1    jruoho 
    202           1.1    jruoho     if (TypeNeeded == ACPI_TYPE_LOCAL_REFERENCE)
    203           1.1    jruoho     {
    204           1.1    jruoho         /*
    205           1.1    jruoho          * Allow the AML "Constant" opcodes (Zero, One, etc.) to be reference
    206       1.1.1.3  christos          * objects and thus allow them to be targets. (As per the ACPI
    207           1.1    jruoho          * specification, a store to a constant is a noop.)
    208           1.1    jruoho          */
    209           1.1    jruoho         if ((ThisType == ACPI_TYPE_INTEGER) &&
    210       1.1.1.6  christos             (((ACPI_OPERAND_OBJECT *) Object)->Common.Flags &
    211       1.1.1.6  christos                 AOPOBJ_AML_CONSTANT))
    212           1.1    jruoho         {
    213           1.1    jruoho             return (AE_OK);
    214           1.1    jruoho         }
    215           1.1    jruoho     }
    216           1.1    jruoho 
    217           1.1    jruoho     if (TypeNeeded != ThisType)
    218           1.1    jruoho     {
    219           1.1    jruoho         ACPI_ERROR ((AE_INFO,
    220           1.1    jruoho             "Needed type [%s], found [%s] %p",
    221           1.1    jruoho             AcpiUtGetTypeName (TypeNeeded),
    222           1.1    jruoho             AcpiUtGetTypeName (ThisType), Object));
    223           1.1    jruoho 
    224           1.1    jruoho         return (AE_AML_OPERAND_TYPE);
    225           1.1    jruoho     }
    226           1.1    jruoho 
    227           1.1    jruoho     return (AE_OK);
    228           1.1    jruoho }
    229           1.1    jruoho 
    230           1.1    jruoho 
    231           1.1    jruoho /*******************************************************************************
    232           1.1    jruoho  *
    233           1.1    jruoho  * FUNCTION:    AcpiExResolveOperands
    234           1.1    jruoho  *
    235           1.1    jruoho  * PARAMETERS:  Opcode              - Opcode being interpreted
    236           1.1    jruoho  *              StackPtr            - Pointer to the operand stack to be
    237           1.1    jruoho  *                                    resolved
    238           1.1    jruoho  *              WalkState           - Current state
    239           1.1    jruoho  *
    240           1.1    jruoho  * RETURN:      Status
    241           1.1    jruoho  *
    242           1.1    jruoho  * DESCRIPTION: Convert multiple input operands to the types required by the
    243           1.1    jruoho  *              target operator.
    244           1.1    jruoho  *
    245           1.1    jruoho  *      Each 5-bit group in ArgTypes represents one required
    246           1.1    jruoho  *      operand and indicates the required Type. The corresponding operand
    247           1.1    jruoho  *      will be converted to the required type if possible, otherwise we
    248           1.1    jruoho  *      abort with an exception.
    249           1.1    jruoho  *
    250           1.1    jruoho  ******************************************************************************/
    251           1.1    jruoho 
    252           1.1    jruoho ACPI_STATUS
    253           1.1    jruoho AcpiExResolveOperands (
    254           1.1    jruoho     UINT16                  Opcode,
    255           1.1    jruoho     ACPI_OPERAND_OBJECT     **StackPtr,
    256           1.1    jruoho     ACPI_WALK_STATE         *WalkState)
    257           1.1    jruoho {
    258           1.1    jruoho     ACPI_OPERAND_OBJECT     *ObjDesc;
    259           1.1    jruoho     ACPI_STATUS             Status = AE_OK;
    260           1.1    jruoho     UINT8                   ObjectType;
    261           1.1    jruoho     UINT32                  ArgTypes;
    262           1.1    jruoho     const ACPI_OPCODE_INFO  *OpInfo;
    263           1.1    jruoho     UINT32                  ThisArgType;
    264           1.1    jruoho     ACPI_OBJECT_TYPE        TypeNeeded;
    265           1.1    jruoho     UINT16                  TargetOp = 0;
    266           1.1    jruoho 
    267           1.1    jruoho 
    268           1.1    jruoho     ACPI_FUNCTION_TRACE_U32 (ExResolveOperands, Opcode);
    269           1.1    jruoho 
    270           1.1    jruoho 
    271           1.1    jruoho     OpInfo = AcpiPsGetOpcodeInfo (Opcode);
    272           1.1    jruoho     if (OpInfo->Class == AML_CLASS_UNKNOWN)
    273           1.1    jruoho     {
    274           1.1    jruoho         return_ACPI_STATUS (AE_AML_BAD_OPCODE);
    275           1.1    jruoho     }
    276           1.1    jruoho 
    277           1.1    jruoho     ArgTypes = OpInfo->RuntimeArgs;
    278           1.1    jruoho     if (ArgTypes == ARGI_INVALID_OPCODE)
    279           1.1    jruoho     {
    280           1.1    jruoho         ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
    281           1.1    jruoho             Opcode));
    282           1.1    jruoho 
    283           1.1    jruoho         return_ACPI_STATUS (AE_AML_INTERNAL);
    284           1.1    jruoho     }
    285           1.1    jruoho 
    286           1.1    jruoho     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
    287           1.1    jruoho         "Opcode %X [%s] RequiredOperandTypes=%8.8X\n",
    288           1.1    jruoho         Opcode, OpInfo->Name, ArgTypes));
    289           1.1    jruoho 
    290           1.1    jruoho     /*
    291           1.1    jruoho      * Normal exit is with (ArgTypes == 0) at end of argument list.
    292           1.1    jruoho      * Function will return an exception from within the loop upon
    293           1.1    jruoho      * finding an entry which is not (or cannot be converted
    294           1.1    jruoho      * to) the required type; if stack underflows; or upon
    295           1.1    jruoho      * finding a NULL stack entry (which should not happen).
    296           1.1    jruoho      */
    297           1.1    jruoho     while (GET_CURRENT_ARG_TYPE (ArgTypes))
    298           1.1    jruoho     {
    299           1.1    jruoho         if (!StackPtr || !*StackPtr)
    300           1.1    jruoho         {
    301           1.1    jruoho             ACPI_ERROR ((AE_INFO, "Null stack entry at %p",
    302           1.1    jruoho                 StackPtr));
    303           1.1    jruoho 
    304           1.1    jruoho             return_ACPI_STATUS (AE_AML_INTERNAL);
    305           1.1    jruoho         }
    306           1.1    jruoho 
    307           1.1    jruoho         /* Extract useful items */
    308           1.1    jruoho 
    309           1.1    jruoho         ObjDesc = *StackPtr;
    310           1.1    jruoho 
    311           1.1    jruoho         /* Decode the descriptor type */
    312           1.1    jruoho 
    313           1.1    jruoho         switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
    314           1.1    jruoho         {
    315           1.1    jruoho         case ACPI_DESC_TYPE_NAMED:
    316           1.1    jruoho 
    317           1.1    jruoho             /* Namespace Node */
    318           1.1    jruoho 
    319           1.1    jruoho             ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
    320           1.1    jruoho 
    321           1.1    jruoho             /*
    322           1.1    jruoho              * Resolve an alias object. The construction of these objects
    323           1.1    jruoho              * guarantees that there is only one level of alias indirection;
    324           1.1    jruoho              * thus, the attached object is always the aliased namespace node
    325           1.1    jruoho              */
    326           1.1    jruoho             if (ObjectType == ACPI_TYPE_LOCAL_ALIAS)
    327           1.1    jruoho             {
    328       1.1.1.6  christos                 ObjDesc = AcpiNsGetAttachedObject (
    329       1.1.1.6  christos                     (ACPI_NAMESPACE_NODE *) ObjDesc);
    330           1.1    jruoho                 *StackPtr = ObjDesc;
    331           1.1    jruoho                 ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
    332           1.1    jruoho             }
    333           1.1    jruoho             break;
    334           1.1    jruoho 
    335           1.1    jruoho         case ACPI_DESC_TYPE_OPERAND:
    336           1.1    jruoho 
    337           1.1    jruoho             /* ACPI internal object */
    338           1.1    jruoho 
    339           1.1    jruoho             ObjectType = ObjDesc->Common.Type;
    340           1.1    jruoho 
    341           1.1    jruoho             /* Check for bad ACPI_OBJECT_TYPE */
    342           1.1    jruoho 
    343           1.1    jruoho             if (!AcpiUtValidObjectType (ObjectType))
    344           1.1    jruoho             {
    345           1.1    jruoho                 ACPI_ERROR ((AE_INFO,
    346           1.1    jruoho                     "Bad operand object type [0x%X]", ObjectType));
    347           1.1    jruoho 
    348           1.1    jruoho                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
    349           1.1    jruoho             }
    350           1.1    jruoho 
    351           1.1    jruoho             if (ObjectType == (UINT8) ACPI_TYPE_LOCAL_REFERENCE)
    352           1.1    jruoho             {
    353           1.1    jruoho                 /* Validate the Reference */
    354           1.1    jruoho 
    355           1.1    jruoho                 switch (ObjDesc->Reference.Class)
    356           1.1    jruoho                 {
    357           1.1    jruoho                 case ACPI_REFCLASS_DEBUG:
    358           1.1    jruoho 
    359           1.1    jruoho                     TargetOp = AML_DEBUG_OP;
    360           1.1    jruoho 
    361      1.1.1.13  christos                     ACPI_FALLTHROUGH;
    362           1.1    jruoho 
    363           1.1    jruoho                 case ACPI_REFCLASS_ARG:
    364           1.1    jruoho                 case ACPI_REFCLASS_LOCAL:
    365           1.1    jruoho                 case ACPI_REFCLASS_INDEX:
    366           1.1    jruoho                 case ACPI_REFCLASS_REFOF:
    367           1.1    jruoho                 case ACPI_REFCLASS_TABLE:    /* DdbHandle from LOAD_OP or LOAD_TABLE_OP */
    368           1.1    jruoho                 case ACPI_REFCLASS_NAME:     /* Reference to a named object */
    369           1.1    jruoho 
    370           1.1    jruoho                     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
    371           1.1    jruoho                         "Operand is a Reference, Class [%s] %2.2X\n",
    372           1.1    jruoho                         AcpiUtGetReferenceName (ObjDesc),
    373           1.1    jruoho                         ObjDesc->Reference.Class));
    374           1.1    jruoho                     break;
    375           1.1    jruoho 
    376           1.1    jruoho                 default:
    377           1.1    jruoho 
    378           1.1    jruoho                     ACPI_ERROR ((AE_INFO,
    379           1.1    jruoho                         "Unknown Reference Class 0x%2.2X in %p",
    380           1.1    jruoho                         ObjDesc->Reference.Class, ObjDesc));
    381           1.1    jruoho 
    382           1.1    jruoho                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
    383           1.1    jruoho                 }
    384           1.1    jruoho             }
    385           1.1    jruoho             break;
    386           1.1    jruoho 
    387           1.1    jruoho         default:
    388           1.1    jruoho 
    389           1.1    jruoho             /* Invalid descriptor */
    390           1.1    jruoho 
    391           1.1    jruoho             ACPI_ERROR ((AE_INFO, "Invalid descriptor %p [%s]",
    392           1.1    jruoho                 ObjDesc, AcpiUtGetDescriptorName (ObjDesc)));
    393           1.1    jruoho 
    394           1.1    jruoho             return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
    395           1.1    jruoho         }
    396           1.1    jruoho 
    397           1.1    jruoho         /* Get one argument type, point to the next */
    398           1.1    jruoho 
    399           1.1    jruoho         ThisArgType = GET_CURRENT_ARG_TYPE (ArgTypes);
    400           1.1    jruoho         INCREMENT_ARG_LIST (ArgTypes);
    401           1.1    jruoho 
    402           1.1    jruoho         /*
    403           1.1    jruoho          * Handle cases where the object does not need to be
    404           1.1    jruoho          * resolved to a value
    405           1.1    jruoho          */
    406           1.1    jruoho         switch (ThisArgType)
    407           1.1    jruoho         {
    408           1.1    jruoho         case ARGI_REF_OR_STRING:        /* Can be a String or Reference */
    409           1.1    jruoho 
    410       1.1.1.6  christos             if ((ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) ==
    411       1.1.1.6  christos                 ACPI_DESC_TYPE_OPERAND) &&
    412           1.1    jruoho                 (ObjDesc->Common.Type == ACPI_TYPE_STRING))
    413           1.1    jruoho             {
    414           1.1    jruoho                 /*
    415           1.1    jruoho                  * String found - the string references a named object and
    416           1.1    jruoho                  * must be resolved to a node
    417           1.1    jruoho                  */
    418           1.1    jruoho                 goto NextOperand;
    419           1.1    jruoho             }
    420           1.1    jruoho 
    421           1.1    jruoho             /*
    422           1.1    jruoho              * Else not a string - fall through to the normal Reference
    423           1.1    jruoho              * case below
    424           1.1    jruoho              */
    425      1.1.1.13  christos             ACPI_FALLTHROUGH;
    426           1.1    jruoho 
    427           1.1    jruoho         case ARGI_REFERENCE:            /* References: */
    428           1.1    jruoho         case ARGI_INTEGER_REF:
    429           1.1    jruoho         case ARGI_OBJECT_REF:
    430           1.1    jruoho         case ARGI_DEVICE_REF:
    431           1.1    jruoho         case ARGI_TARGETREF:     /* Allows implicit conversion rules before store */
    432      1.1.1.10  christos         case ARGI_FIXED_TARGET:  /* No implicit conversion before store to target */
    433           1.1    jruoho         case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion  */
    434       1.1.1.6  christos         case ARGI_STORE_TARGET:
    435       1.1.1.6  christos 
    436           1.1    jruoho             /*
    437           1.1    jruoho              * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
    438           1.1    jruoho              * A Namespace Node is OK as-is
    439           1.1    jruoho              */
    440           1.1    jruoho             if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
    441           1.1    jruoho             {
    442           1.1    jruoho                 goto NextOperand;
    443           1.1    jruoho             }
    444           1.1    jruoho 
    445       1.1.1.6  christos             Status = AcpiExCheckObjectType (
    446       1.1.1.6  christos                 ACPI_TYPE_LOCAL_REFERENCE, ObjectType, ObjDesc);
    447           1.1    jruoho             if (ACPI_FAILURE (Status))
    448           1.1    jruoho             {
    449           1.1    jruoho                 return_ACPI_STATUS (Status);
    450           1.1    jruoho             }
    451           1.1    jruoho             goto NextOperand;
    452           1.1    jruoho 
    453           1.1    jruoho         case ARGI_DATAREFOBJ:  /* Store operator only */
    454           1.1    jruoho             /*
    455           1.1    jruoho              * We don't want to resolve IndexOp reference objects during
    456           1.1    jruoho              * a store because this would be an implicit DeRefOf operation.
    457           1.1    jruoho              * Instead, we just want to store the reference object.
    458           1.1    jruoho              * -- All others must be resolved below.
    459           1.1    jruoho              */
    460           1.1    jruoho             if ((Opcode == AML_STORE_OP) &&
    461           1.1    jruoho                 ((*StackPtr)->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
    462           1.1    jruoho                 ((*StackPtr)->Reference.Class == ACPI_REFCLASS_INDEX))
    463           1.1    jruoho             {
    464           1.1    jruoho                 goto NextOperand;
    465           1.1    jruoho             }
    466           1.1    jruoho             break;
    467           1.1    jruoho 
    468           1.1    jruoho         default:
    469       1.1.1.3  christos 
    470           1.1    jruoho             /* All cases covered above */
    471       1.1.1.3  christos 
    472           1.1    jruoho             break;
    473           1.1    jruoho         }
    474           1.1    jruoho 
    475           1.1    jruoho         /*
    476           1.1    jruoho          * Resolve this object to a value
    477           1.1    jruoho          */
    478           1.1    jruoho         Status = AcpiExResolveToValue (StackPtr, WalkState);
    479           1.1    jruoho         if (ACPI_FAILURE (Status))
    480           1.1    jruoho         {
    481           1.1    jruoho             return_ACPI_STATUS (Status);
    482           1.1    jruoho         }
    483           1.1    jruoho 
    484           1.1    jruoho         /* Get the resolved object */
    485           1.1    jruoho 
    486           1.1    jruoho         ObjDesc = *StackPtr;
    487           1.1    jruoho 
    488           1.1    jruoho         /*
    489           1.1    jruoho          * Check the resulting object (value) type
    490           1.1    jruoho          */
    491           1.1    jruoho         switch (ThisArgType)
    492           1.1    jruoho         {
    493           1.1    jruoho         /*
    494           1.1    jruoho          * For the simple cases, only one type of resolved object
    495           1.1    jruoho          * is allowed
    496           1.1    jruoho          */
    497           1.1    jruoho         case ARGI_MUTEX:
    498           1.1    jruoho 
    499           1.1    jruoho             /* Need an operand of type ACPI_TYPE_MUTEX */
    500           1.1    jruoho 
    501           1.1    jruoho             TypeNeeded = ACPI_TYPE_MUTEX;
    502           1.1    jruoho             break;
    503           1.1    jruoho 
    504           1.1    jruoho         case ARGI_EVENT:
    505           1.1    jruoho 
    506           1.1    jruoho             /* Need an operand of type ACPI_TYPE_EVENT */
    507           1.1    jruoho 
    508           1.1    jruoho             TypeNeeded = ACPI_TYPE_EVENT;
    509           1.1    jruoho             break;
    510           1.1    jruoho 
    511           1.1    jruoho         case ARGI_PACKAGE:   /* Package */
    512           1.1    jruoho 
    513           1.1    jruoho             /* Need an operand of type ACPI_TYPE_PACKAGE */
    514           1.1    jruoho 
    515           1.1    jruoho             TypeNeeded = ACPI_TYPE_PACKAGE;
    516           1.1    jruoho             break;
    517           1.1    jruoho 
    518           1.1    jruoho         case ARGI_ANYTYPE:
    519           1.1    jruoho 
    520           1.1    jruoho             /* Any operand type will do */
    521           1.1    jruoho 
    522           1.1    jruoho             TypeNeeded = ACPI_TYPE_ANY;
    523           1.1    jruoho             break;
    524           1.1    jruoho 
    525           1.1    jruoho         case ARGI_DDBHANDLE:
    526           1.1    jruoho 
    527           1.1    jruoho             /* Need an operand of type ACPI_TYPE_DDB_HANDLE */
    528           1.1    jruoho 
    529           1.1    jruoho             TypeNeeded = ACPI_TYPE_LOCAL_REFERENCE;
    530           1.1    jruoho             break;
    531           1.1    jruoho 
    532           1.1    jruoho 
    533           1.1    jruoho         /*
    534           1.1    jruoho          * The more complex cases allow multiple resolved object types
    535           1.1    jruoho          */
    536           1.1    jruoho         case ARGI_INTEGER:
    537           1.1    jruoho 
    538           1.1    jruoho             /*
    539       1.1.1.7  christos              * Need an operand of type ACPI_TYPE_INTEGER, but we can
    540       1.1.1.7  christos              * implicitly convert from a STRING or BUFFER.
    541       1.1.1.7  christos              *
    542       1.1.1.7  christos              * Known as "Implicit Source Operand Conversion"
    543           1.1    jruoho              */
    544       1.1.1.7  christos             Status = AcpiExConvertToInteger (ObjDesc, StackPtr,
    545       1.1.1.9  christos                 ACPI_IMPLICIT_CONVERSION);
    546           1.1    jruoho             if (ACPI_FAILURE (Status))
    547           1.1    jruoho             {
    548           1.1    jruoho                 if (Status == AE_TYPE)
    549           1.1    jruoho                 {
    550           1.1    jruoho                     ACPI_ERROR ((AE_INFO,
    551           1.1    jruoho                         "Needed [Integer/String/Buffer], found [%s] %p",
    552           1.1    jruoho                         AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
    553           1.1    jruoho 
    554           1.1    jruoho                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
    555           1.1    jruoho                 }
    556           1.1    jruoho 
    557           1.1    jruoho                 return_ACPI_STATUS (Status);
    558           1.1    jruoho             }
    559           1.1    jruoho 
    560           1.1    jruoho             if (ObjDesc != *StackPtr)
    561           1.1    jruoho             {
    562           1.1    jruoho                 AcpiUtRemoveReference (ObjDesc);
    563           1.1    jruoho             }
    564           1.1    jruoho             goto NextOperand;
    565           1.1    jruoho 
    566           1.1    jruoho         case ARGI_BUFFER:
    567           1.1    jruoho             /*
    568           1.1    jruoho              * Need an operand of type ACPI_TYPE_BUFFER,
    569           1.1    jruoho              * But we can implicitly convert from a STRING or INTEGER
    570           1.1    jruoho              * Aka - "Implicit Source Operand Conversion"
    571           1.1    jruoho              */
    572           1.1    jruoho             Status = AcpiExConvertToBuffer (ObjDesc, StackPtr);
    573           1.1    jruoho             if (ACPI_FAILURE (Status))
    574           1.1    jruoho             {
    575           1.1    jruoho                 if (Status == AE_TYPE)
    576           1.1    jruoho                 {
    577           1.1    jruoho                     ACPI_ERROR ((AE_INFO,
    578           1.1    jruoho                         "Needed [Integer/String/Buffer], found [%s] %p",
    579           1.1    jruoho                         AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
    580           1.1    jruoho 
    581           1.1    jruoho                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
    582           1.1    jruoho                 }
    583           1.1    jruoho 
    584           1.1    jruoho                 return_ACPI_STATUS (Status);
    585           1.1    jruoho             }
    586           1.1    jruoho 
    587           1.1    jruoho             if (ObjDesc != *StackPtr)
    588           1.1    jruoho             {
    589           1.1    jruoho                 AcpiUtRemoveReference (ObjDesc);
    590           1.1    jruoho             }
    591           1.1    jruoho             goto NextOperand;
    592           1.1    jruoho 
    593           1.1    jruoho         case ARGI_STRING:
    594           1.1    jruoho             /*
    595           1.1    jruoho              * Need an operand of type ACPI_TYPE_STRING,
    596           1.1    jruoho              * But we can implicitly convert from a BUFFER or INTEGER
    597           1.1    jruoho              * Aka - "Implicit Source Operand Conversion"
    598           1.1    jruoho              */
    599       1.1.1.6  christos             Status = AcpiExConvertToString (
    600       1.1.1.6  christos                 ObjDesc, StackPtr, ACPI_IMPLICIT_CONVERT_HEX);
    601           1.1    jruoho             if (ACPI_FAILURE (Status))
    602           1.1    jruoho             {
    603           1.1    jruoho                 if (Status == AE_TYPE)
    604           1.1    jruoho                 {
    605           1.1    jruoho                     ACPI_ERROR ((AE_INFO,
    606           1.1    jruoho                         "Needed [Integer/String/Buffer], found [%s] %p",
    607           1.1    jruoho                         AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
    608           1.1    jruoho 
    609           1.1    jruoho                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
    610           1.1    jruoho                 }
    611           1.1    jruoho 
    612           1.1    jruoho                 return_ACPI_STATUS (Status);
    613           1.1    jruoho             }
    614           1.1    jruoho 
    615           1.1    jruoho             if (ObjDesc != *StackPtr)
    616           1.1    jruoho             {
    617           1.1    jruoho                 AcpiUtRemoveReference (ObjDesc);
    618           1.1    jruoho             }
    619           1.1    jruoho             goto NextOperand;
    620           1.1    jruoho 
    621           1.1    jruoho         case ARGI_COMPUTEDATA:
    622           1.1    jruoho 
    623           1.1    jruoho             /* Need an operand of type INTEGER, STRING or BUFFER */
    624           1.1    jruoho 
    625           1.1    jruoho             switch (ObjDesc->Common.Type)
    626           1.1    jruoho             {
    627           1.1    jruoho             case ACPI_TYPE_INTEGER:
    628           1.1    jruoho             case ACPI_TYPE_STRING:
    629           1.1    jruoho             case ACPI_TYPE_BUFFER:
    630           1.1    jruoho 
    631           1.1    jruoho                 /* Valid operand */
    632           1.1    jruoho                break;
    633           1.1    jruoho 
    634           1.1    jruoho             default:
    635           1.1    jruoho                 ACPI_ERROR ((AE_INFO,
    636           1.1    jruoho                     "Needed [Integer/String/Buffer], found [%s] %p",
    637           1.1    jruoho                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
    638           1.1    jruoho 
    639           1.1    jruoho                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
    640           1.1    jruoho             }
    641           1.1    jruoho             goto NextOperand;
    642           1.1    jruoho 
    643           1.1    jruoho         case ARGI_BUFFER_OR_STRING:
    644           1.1    jruoho 
    645           1.1    jruoho             /* Need an operand of type STRING or BUFFER */
    646           1.1    jruoho 
    647           1.1    jruoho             switch (ObjDesc->Common.Type)
    648           1.1    jruoho             {
    649           1.1    jruoho             case ACPI_TYPE_STRING:
    650           1.1    jruoho             case ACPI_TYPE_BUFFER:
    651           1.1    jruoho 
    652           1.1    jruoho                 /* Valid operand */
    653           1.1    jruoho                break;
    654           1.1    jruoho 
    655           1.1    jruoho             case ACPI_TYPE_INTEGER:
    656           1.1    jruoho 
    657           1.1    jruoho                 /* Highest priority conversion is to type Buffer */
    658           1.1    jruoho 
    659           1.1    jruoho                 Status = AcpiExConvertToBuffer (ObjDesc, StackPtr);
    660           1.1    jruoho                 if (ACPI_FAILURE (Status))
    661           1.1    jruoho                 {
    662           1.1    jruoho                     return_ACPI_STATUS (Status);
    663           1.1    jruoho                 }
    664           1.1    jruoho 
    665           1.1    jruoho                 if (ObjDesc != *StackPtr)
    666           1.1    jruoho                 {
    667           1.1    jruoho                     AcpiUtRemoveReference (ObjDesc);
    668           1.1    jruoho                 }
    669           1.1    jruoho                 break;
    670           1.1    jruoho 
    671           1.1    jruoho             default:
    672           1.1    jruoho                 ACPI_ERROR ((AE_INFO,
    673           1.1    jruoho                     "Needed [Integer/String/Buffer], found [%s] %p",
    674           1.1    jruoho                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
    675           1.1    jruoho 
    676           1.1    jruoho                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
    677           1.1    jruoho             }
    678           1.1    jruoho             goto NextOperand;
    679           1.1    jruoho 
    680           1.1    jruoho         case ARGI_DATAOBJECT:
    681           1.1    jruoho             /*
    682           1.1    jruoho              * ARGI_DATAOBJECT is only used by the SizeOf operator.
    683           1.1    jruoho              * Need a buffer, string, package, or RefOf reference.
    684           1.1    jruoho              *
    685           1.1    jruoho              * The only reference allowed here is a direct reference to
    686           1.1    jruoho              * a namespace node.
    687           1.1    jruoho              */
    688           1.1    jruoho             switch (ObjDesc->Common.Type)
    689           1.1    jruoho             {
    690           1.1    jruoho             case ACPI_TYPE_PACKAGE:
    691           1.1    jruoho             case ACPI_TYPE_STRING:
    692           1.1    jruoho             case ACPI_TYPE_BUFFER:
    693           1.1    jruoho             case ACPI_TYPE_LOCAL_REFERENCE:
    694           1.1    jruoho 
    695           1.1    jruoho                 /* Valid operand */
    696           1.1    jruoho                 break;
    697           1.1    jruoho 
    698           1.1    jruoho             default:
    699       1.1.1.3  christos 
    700           1.1    jruoho                 ACPI_ERROR ((AE_INFO,
    701           1.1    jruoho                     "Needed [Buffer/String/Package/Reference], found [%s] %p",
    702           1.1    jruoho                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
    703           1.1    jruoho 
    704           1.1    jruoho                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
    705           1.1    jruoho             }
    706           1.1    jruoho             goto NextOperand;
    707           1.1    jruoho 
    708           1.1    jruoho         case ARGI_COMPLEXOBJ:
    709           1.1    jruoho 
    710           1.1    jruoho             /* Need a buffer or package or (ACPI 2.0) String */
    711           1.1    jruoho 
    712           1.1    jruoho             switch (ObjDesc->Common.Type)
    713           1.1    jruoho             {
    714           1.1    jruoho             case ACPI_TYPE_PACKAGE:
    715           1.1    jruoho             case ACPI_TYPE_STRING:
    716           1.1    jruoho             case ACPI_TYPE_BUFFER:
    717           1.1    jruoho 
    718           1.1    jruoho                 /* Valid operand */
    719           1.1    jruoho                 break;
    720           1.1    jruoho 
    721           1.1    jruoho             default:
    722       1.1.1.3  christos 
    723           1.1    jruoho                 ACPI_ERROR ((AE_INFO,
    724           1.1    jruoho                     "Needed [Buffer/String/Package], found [%s] %p",
    725           1.1    jruoho                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
    726           1.1    jruoho 
    727           1.1    jruoho                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
    728           1.1    jruoho             }
    729           1.1    jruoho             goto NextOperand;
    730           1.1    jruoho 
    731           1.1    jruoho         case ARGI_REGION_OR_BUFFER: /* Used by Load() only */
    732           1.1    jruoho 
    733       1.1.1.6  christos             /*
    734       1.1.1.6  christos              * Need an operand of type REGION or a BUFFER
    735       1.1.1.6  christos              * (which could be a resolved region field)
    736       1.1.1.6  christos              */
    737           1.1    jruoho             switch (ObjDesc->Common.Type)
    738           1.1    jruoho             {
    739           1.1    jruoho             case ACPI_TYPE_BUFFER:
    740           1.1    jruoho             case ACPI_TYPE_REGION:
    741           1.1    jruoho 
    742           1.1    jruoho                 /* Valid operand */
    743           1.1    jruoho                 break;
    744           1.1    jruoho 
    745           1.1    jruoho             default:
    746       1.1.1.3  christos 
    747           1.1    jruoho                 ACPI_ERROR ((AE_INFO,
    748           1.1    jruoho                     "Needed [Region/Buffer], found [%s] %p",
    749           1.1    jruoho                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
    750           1.1    jruoho 
    751           1.1    jruoho                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
    752           1.1    jruoho             }
    753           1.1    jruoho             goto NextOperand;
    754           1.1    jruoho 
    755           1.1    jruoho         case ARGI_DATAREFOBJ:
    756           1.1    jruoho 
    757           1.1    jruoho             /* Used by the Store() operator only */
    758           1.1    jruoho 
    759           1.1    jruoho             switch (ObjDesc->Common.Type)
    760           1.1    jruoho             {
    761           1.1    jruoho             case ACPI_TYPE_INTEGER:
    762           1.1    jruoho             case ACPI_TYPE_PACKAGE:
    763           1.1    jruoho             case ACPI_TYPE_STRING:
    764           1.1    jruoho             case ACPI_TYPE_BUFFER:
    765           1.1    jruoho             case ACPI_TYPE_BUFFER_FIELD:
    766           1.1    jruoho             case ACPI_TYPE_LOCAL_REFERENCE:
    767           1.1    jruoho             case ACPI_TYPE_LOCAL_REGION_FIELD:
    768           1.1    jruoho             case ACPI_TYPE_LOCAL_BANK_FIELD:
    769           1.1    jruoho             case ACPI_TYPE_LOCAL_INDEX_FIELD:
    770           1.1    jruoho             case ACPI_TYPE_DDB_HANDLE:
    771           1.1    jruoho 
    772           1.1    jruoho                 /* Valid operand */
    773           1.1    jruoho                 break;
    774           1.1    jruoho 
    775           1.1    jruoho             default:
    776           1.1    jruoho 
    777           1.1    jruoho                 if (AcpiGbl_EnableInterpreterSlack)
    778           1.1    jruoho                 {
    779           1.1    jruoho                     /*
    780       1.1.1.6  christos                      * Enable original behavior of Store(), allowing any
    781       1.1.1.6  christos                      * and all objects as the source operand. The ACPI
    782       1.1.1.6  christos                      * spec does not allow this, however.
    783           1.1    jruoho                      */
    784           1.1    jruoho                     break;
    785           1.1    jruoho                 }
    786           1.1    jruoho 
    787           1.1    jruoho                 if (TargetOp == AML_DEBUG_OP)
    788           1.1    jruoho                 {
    789           1.1    jruoho                     /* Allow store of any object to the Debug object */
    790           1.1    jruoho 
    791           1.1    jruoho                     break;
    792           1.1    jruoho                 }
    793           1.1    jruoho 
    794           1.1    jruoho                 ACPI_ERROR ((AE_INFO,
    795       1.1.1.6  christos                     "Needed Integer/Buffer/String/Package/Ref/Ddb]"
    796       1.1.1.6  christos                     ", found [%s] %p",
    797           1.1    jruoho                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
    798           1.1    jruoho 
    799           1.1    jruoho                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
    800           1.1    jruoho             }
    801           1.1    jruoho             goto NextOperand;
    802           1.1    jruoho 
    803           1.1    jruoho         default:
    804           1.1    jruoho 
    805           1.1    jruoho             /* Unknown type */
    806           1.1    jruoho 
    807           1.1    jruoho             ACPI_ERROR ((AE_INFO,
    808           1.1    jruoho                 "Internal - Unknown ARGI (required operand) type 0x%X",
    809           1.1    jruoho                 ThisArgType));
    810           1.1    jruoho 
    811           1.1    jruoho             return_ACPI_STATUS (AE_BAD_PARAMETER);
    812           1.1    jruoho         }
    813           1.1    jruoho 
    814           1.1    jruoho         /*
    815           1.1    jruoho          * Make sure that the original object was resolved to the
    816           1.1    jruoho          * required object type (Simple cases only).
    817           1.1    jruoho          */
    818       1.1.1.6  christos         Status = AcpiExCheckObjectType (
    819       1.1.1.6  christos             TypeNeeded, (*StackPtr)->Common.Type, *StackPtr);
    820           1.1    jruoho         if (ACPI_FAILURE (Status))
    821           1.1    jruoho         {
    822           1.1    jruoho             return_ACPI_STATUS (Status);
    823           1.1    jruoho         }
    824           1.1    jruoho 
    825           1.1    jruoho NextOperand:
    826           1.1    jruoho         /*
    827           1.1    jruoho          * If more operands needed, decrement StackPtr to point
    828           1.1    jruoho          * to next operand on stack
    829           1.1    jruoho          */
    830           1.1    jruoho         if (GET_CURRENT_ARG_TYPE (ArgTypes))
    831           1.1    jruoho         {
    832           1.1    jruoho             StackPtr--;
    833           1.1    jruoho         }
    834           1.1    jruoho     }
    835           1.1    jruoho 
    836           1.1    jruoho     ACPI_DUMP_OPERANDS (WalkState->Operands,
    837           1.1    jruoho         AcpiPsGetOpcodeName (Opcode), WalkState->NumOperands);
    838           1.1    jruoho 
    839           1.1    jruoho     return_ACPI_STATUS (Status);
    840           1.1    jruoho }
    841