Home | History | Annotate | Line # | Download | only in namespace
nseval.c revision 1.19.6.1
      1       1.1    jruoho /*******************************************************************************
      2       1.1    jruoho  *
      3       1.1    jruoho  * Module Name: nseval - Object evaluation, includes control method execution
      4       1.1    jruoho  *
      5       1.1    jruoho  ******************************************************************************/
      6       1.1    jruoho 
      7  1.19.6.1  perseant /******************************************************************************
      8  1.19.6.1  perseant  *
      9  1.19.6.1  perseant  * 1. Copyright Notice
     10  1.19.6.1  perseant  *
     11  1.19.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.19.6.1  perseant  * 2. License
     15  1.19.6.1  perseant  *
     16  1.19.6.1  perseant  * 2.1. This is your license from Intel Corp. under its intellectual property
     17  1.19.6.1  perseant  * rights. You may have additional license terms from the party that provided
     18  1.19.6.1  perseant  * you this software, covering your right to use that party's intellectual
     19  1.19.6.1  perseant  * property rights.
     20  1.19.6.1  perseant  *
     21  1.19.6.1  perseant  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
     22  1.19.6.1  perseant  * copy of the source code appearing in this file ("Covered Code") an
     23  1.19.6.1  perseant  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
     24  1.19.6.1  perseant  * base code distributed originally by Intel ("Original Intel Code") to copy,
     25  1.19.6.1  perseant  * make derivatives, distribute, use and display any portion of the Covered
     26  1.19.6.1  perseant  * Code in any form, with the right to sublicense such rights; and
     27  1.19.6.1  perseant  *
     28  1.19.6.1  perseant  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
     29  1.19.6.1  perseant  * license (with the right to sublicense), under only those claims of Intel
     30  1.19.6.1  perseant  * patents that are infringed by the Original Intel Code, to make, use, sell,
     31  1.19.6.1  perseant  * offer to sell, and import the Covered Code and derivative works thereof
     32  1.19.6.1  perseant  * solely to the minimum extent necessary to exercise the above copyright
     33  1.19.6.1  perseant  * license, and in no event shall the patent license extend to any additions
     34  1.19.6.1  perseant  * to or modifications of the Original Intel Code. No other license or right
     35  1.19.6.1  perseant  * is granted directly or by implication, estoppel or otherwise;
     36  1.19.6.1  perseant  *
     37  1.19.6.1  perseant  * The above copyright and patent license is granted only if the following
     38  1.19.6.1  perseant  * conditions are met:
     39  1.19.6.1  perseant  *
     40  1.19.6.1  perseant  * 3. Conditions
     41  1.19.6.1  perseant  *
     42  1.19.6.1  perseant  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
     43  1.19.6.1  perseant  * Redistribution of source code of any substantial portion of the Covered
     44  1.19.6.1  perseant  * Code or modification with rights to further distribute source must include
     45  1.19.6.1  perseant  * the above Copyright Notice, the above License, this list of Conditions,
     46  1.19.6.1  perseant  * and the following Disclaimer and Export Compliance provision. In addition,
     47  1.19.6.1  perseant  * Licensee must cause all Covered Code to which Licensee contributes to
     48  1.19.6.1  perseant  * contain a file documenting the changes Licensee made to create that Covered
     49  1.19.6.1  perseant  * Code and the date of any change. Licensee must include in that file the
     50  1.19.6.1  perseant  * documentation of any changes made by any predecessor Licensee. Licensee
     51  1.19.6.1  perseant  * must include a prominent statement that the modification is derived,
     52  1.19.6.1  perseant  * directly or indirectly, from Original Intel Code.
     53  1.19.6.1  perseant  *
     54  1.19.6.1  perseant  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
     55  1.19.6.1  perseant  * Redistribution of source code of any substantial portion of the Covered
     56  1.19.6.1  perseant  * Code or modification without rights to further distribute source must
     57  1.19.6.1  perseant  * include the following Disclaimer and Export Compliance provision in the
     58  1.19.6.1  perseant  * documentation and/or other materials provided with distribution. In
     59  1.19.6.1  perseant  * addition, Licensee may not authorize further sublicense of source of any
     60  1.19.6.1  perseant  * portion of the Covered Code, and must include terms to the effect that the
     61  1.19.6.1  perseant  * license from Licensee to its licensee is limited to the intellectual
     62  1.19.6.1  perseant  * property embodied in the software Licensee provides to its licensee, and
     63  1.19.6.1  perseant  * not to intellectual property embodied in modifications its licensee may
     64  1.19.6.1  perseant  * make.
     65  1.19.6.1  perseant 
     66  1.19.6.1  perseant  *
     67  1.19.6.1  perseant  * 3.3. Redistribution of Executable. Redistribution in executable form of any
     68  1.19.6.1  perseant  * substantial portion of the Covered Code or modification must reproduce the
     69  1.19.6.1  perseant  * above Copyright Notice, and the following Disclaimer and Export Compliance
     70  1.19.6.1  perseant  * provision in the documentation and/or other materials provided with the
     71  1.19.6.1  perseant  * distribution.
     72  1.19.6.1  perseant  *
     73  1.19.6.1  perseant  * 3.4. Intel retains all right, title, and interest in and to the Original
     74  1.19.6.1  perseant  * Intel Code.
     75  1.19.6.1  perseant  *
     76  1.19.6.1  perseant  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
     77  1.19.6.1  perseant  * Intel shall be used in advertising or otherwise to promote the sale, use or
     78  1.19.6.1  perseant  * other dealings in products derived from or relating to the Covered Code
     79  1.19.6.1  perseant  * without prior written authorization from Intel.
     80  1.19.6.1  perseant  *
     81  1.19.6.1  perseant  * 4. Disclaimer and Export Compliance
     82  1.19.6.1  perseant  *
     83  1.19.6.1  perseant  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
     84  1.19.6.1  perseant  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
     85  1.19.6.1  perseant  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
     86  1.19.6.1  perseant  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
     87  1.19.6.1  perseant  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
     88  1.19.6.1  perseant  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
     89  1.19.6.1  perseant  * PARTICULAR PURPOSE.
     90  1.19.6.1  perseant  *
     91  1.19.6.1  perseant  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
     92  1.19.6.1  perseant  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
     93  1.19.6.1  perseant  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
     94  1.19.6.1  perseant  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
     95  1.19.6.1  perseant  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
     96  1.19.6.1  perseant  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
     97  1.19.6.1  perseant  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
     98  1.19.6.1  perseant  * LIMITED REMEDY.
     99  1.19.6.1  perseant  *
    100  1.19.6.1  perseant  * 4.3. Licensee shall not export, either directly or indirectly, any of this
    101  1.19.6.1  perseant  * software or system incorporating such software without first obtaining any
    102  1.19.6.1  perseant  * required license or other approval from the U. S. Department of Commerce or
    103  1.19.6.1  perseant  * any other agency or department of the United States Government. In the
    104  1.19.6.1  perseant  * event Licensee exports any such software from the United States or
    105  1.19.6.1  perseant  * re-exports any such software from a foreign destination, Licensee shall
    106  1.19.6.1  perseant  * ensure that the distribution and export/re-export of the software is in
    107  1.19.6.1  perseant  * compliance with all laws, regulations, orders, or other restrictions of the
    108  1.19.6.1  perseant  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
    109  1.19.6.1  perseant  * any of its subsidiaries will export/re-export any technical data, process,
    110  1.19.6.1  perseant  * software, or service, directly or indirectly, to any country for which the
    111  1.19.6.1  perseant  * United States government or any agency thereof requires an export license,
    112  1.19.6.1  perseant  * other governmental approval, or letter of assurance, without first obtaining
    113  1.19.6.1  perseant  * such license, approval or letter.
    114  1.19.6.1  perseant  *
    115  1.19.6.1  perseant  *****************************************************************************
    116  1.19.6.1  perseant  *
    117  1.19.6.1  perseant  * Alternatively, you may choose to be licensed under the terms of the
    118  1.19.6.1  perseant  * following license:
    119  1.19.6.1  perseant  *
    120       1.3    jruoho  * Redistribution and use in source and binary forms, with or without
    121       1.3    jruoho  * modification, are permitted provided that the following conditions
    122       1.3    jruoho  * are met:
    123       1.3    jruoho  * 1. Redistributions of source code must retain the above copyright
    124       1.3    jruoho  *    notice, this list of conditions, and the following disclaimer,
    125       1.3    jruoho  *    without modification.
    126       1.3    jruoho  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
    127       1.3    jruoho  *    substantially similar to the "NO WARRANTY" disclaimer below
    128       1.3    jruoho  *    ("Disclaimer") and any redistribution must be conditioned upon
    129       1.3    jruoho  *    including a substantially similar Disclaimer requirement for further
    130       1.3    jruoho  *    binary redistribution.
    131       1.3    jruoho  * 3. Neither the names of the above-listed copyright holders nor the names
    132       1.3    jruoho  *    of any contributors may be used to endorse or promote products derived
    133       1.3    jruoho  *    from this software without specific prior written permission.
    134       1.3    jruoho  *
    135       1.3    jruoho  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    136       1.3    jruoho  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    137      1.17  christos  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    138       1.3    jruoho  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    139  1.19.6.1  perseant  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    140  1.19.6.1  perseant  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    141  1.19.6.1  perseant  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    142  1.19.6.1  perseant  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    143  1.19.6.1  perseant  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    144  1.19.6.1  perseant  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    145  1.19.6.1  perseant  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    146  1.19.6.1  perseant  *
    147  1.19.6.1  perseant  * Alternatively, you may choose to be licensed under the terms of the
    148  1.19.6.1  perseant  * GNU General Public License ("GPL") version 2 as published by the Free
    149  1.19.6.1  perseant  * Software Foundation.
    150  1.19.6.1  perseant  *
    151  1.19.6.1  perseant  *****************************************************************************/
    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 "acinterp.h"
    157       1.1    jruoho #include "acnamesp.h"
    158       1.1    jruoho 
    159       1.1    jruoho 
    160       1.1    jruoho #define _COMPONENT          ACPI_NAMESPACE
    161       1.1    jruoho         ACPI_MODULE_NAME    ("nseval")
    162       1.1    jruoho 
    163       1.1    jruoho 
    164       1.1    jruoho /*******************************************************************************
    165       1.1    jruoho  *
    166       1.1    jruoho  * FUNCTION:    AcpiNsEvaluate
    167       1.1    jruoho  *
    168       1.7  christos  * PARAMETERS:  Info            - Evaluation info block, contains these fields
    169       1.7  christos  *                                and more:
    170       1.1    jruoho  *                  PrefixNode      - Prefix or Method/Object Node to execute
    171       1.4  christos  *                  RelativePath    - Name of method to execute, If NULL, the
    172       1.1    jruoho  *                                    Node is the object to execute
    173       1.1    jruoho  *                  Parameters      - List of parameters to pass to the method,
    174       1.1    jruoho  *                                    terminated by NULL. Params itself may be
    175       1.1    jruoho  *                                    NULL if no parameters are being passed.
    176       1.1    jruoho  *                  ParameterType   - Type of Parameter list
    177       1.1    jruoho  *                  ReturnObject    - Where to put method's return value (if
    178       1.1    jruoho  *                                    any). If NULL, no value is returned.
    179       1.1    jruoho  *                  Flags           - ACPI_IGNORE_RETURN_VALUE to delete return
    180       1.1    jruoho  *
    181       1.1    jruoho  * RETURN:      Status
    182       1.1    jruoho  *
    183       1.1    jruoho  * DESCRIPTION: Execute a control method or return the current value of an
    184       1.1    jruoho  *              ACPI namespace object.
    185       1.1    jruoho  *
    186       1.1    jruoho  * MUTEX:       Locks interpreter
    187       1.1    jruoho  *
    188       1.1    jruoho  ******************************************************************************/
    189       1.1    jruoho 
    190       1.1    jruoho ACPI_STATUS
    191       1.1    jruoho AcpiNsEvaluate (
    192       1.1    jruoho     ACPI_EVALUATE_INFO      *Info)
    193       1.1    jruoho {
    194       1.1    jruoho     ACPI_STATUS             Status;
    195       1.1    jruoho 
    196       1.1    jruoho 
    197       1.1    jruoho     ACPI_FUNCTION_TRACE (NsEvaluate);
    198       1.1    jruoho 
    199       1.1    jruoho 
    200       1.1    jruoho     if (!Info)
    201       1.1    jruoho     {
    202       1.1    jruoho         return_ACPI_STATUS (AE_BAD_PARAMETER);
    203       1.1    jruoho     }
    204       1.1    jruoho 
    205       1.4  christos     if (!Info->Node)
    206       1.4  christos     {
    207       1.4  christos         /*
    208       1.4  christos          * Get the actual namespace node for the target object if we
    209       1.4  christos          * need to. Handles these cases:
    210       1.4  christos          *
    211       1.4  christos          * 1) Null node, valid pathname from root (absolute path)
    212       1.4  christos          * 2) Node and valid pathname (path relative to Node)
    213       1.4  christos          * 3) Node, Null pathname
    214       1.4  christos          */
    215       1.4  christos         Status = AcpiNsGetNode (Info->PrefixNode, Info->RelativePathname,
    216       1.4  christos             ACPI_NS_NO_UPSEARCH, &Info->Node);
    217       1.4  christos         if (ACPI_FAILURE (Status))
    218       1.4  christos         {
    219       1.4  christos             return_ACPI_STATUS (Status);
    220       1.4  christos         }
    221       1.4  christos     }
    222       1.4  christos 
    223       1.4  christos     /*
    224       1.4  christos      * For a method alias, we must grab the actual method node so that
    225       1.4  christos      * proper scoping context will be established before execution.
    226       1.4  christos      */
    227       1.4  christos     if (AcpiNsGetType (Info->Node) == ACPI_TYPE_LOCAL_METHOD_ALIAS)
    228       1.4  christos     {
    229       1.4  christos         Info->Node = ACPI_CAST_PTR (
    230       1.4  christos             ACPI_NAMESPACE_NODE, Info->Node->Object);
    231       1.4  christos     }
    232       1.4  christos 
    233       1.4  christos     /* Complete the info block initialization */
    234       1.1    jruoho 
    235       1.1    jruoho     Info->ReturnObject = NULL;
    236       1.4  christos     Info->NodeFlags = Info->Node->Flags;
    237       1.4  christos     Info->ObjDesc = AcpiNsGetAttachedObject (Info->Node);
    238       1.4  christos 
    239       1.4  christos     ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n",
    240       1.4  christos         Info->RelativePathname, Info->Node,
    241       1.4  christos         AcpiNsGetAttachedObject (Info->Node)));
    242       1.4  christos 
    243       1.4  christos     /* Get info if we have a predefined name (_HID, etc.) */
    244       1.4  christos 
    245       1.4  christos     Info->Predefined = AcpiUtMatchPredefinedMethod (Info->Node->Name.Ascii);
    246       1.4  christos 
    247       1.4  christos     /* Get the full pathname to the object, for use in warning messages */
    248       1.4  christos 
    249       1.8  christos     Info->FullPathname = AcpiNsGetNormalizedPathname (Info->Node, TRUE);
    250       1.4  christos     if (!Info->FullPathname)
    251       1.4  christos     {
    252       1.4  christos         return_ACPI_STATUS (AE_NO_MEMORY);
    253       1.4  christos     }
    254       1.4  christos 
    255      1.13  christos     /* Optional object evaluation log */
    256      1.13  christos 
    257      1.13  christos     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EVALUATION,
    258      1.13  christos         "%-26s:  %s (%s)\n", "   Enter evaluation",
    259      1.13  christos         &Info->FullPathname[1], AcpiUtGetTypeName (Info->Node->Type)));
    260      1.13  christos 
    261       1.4  christos     /* Count the number of arguments being passed in */
    262       1.4  christos 
    263       1.1    jruoho     Info->ParamCount = 0;
    264       1.4  christos     if (Info->Parameters)
    265       1.4  christos     {
    266       1.4  christos         while (Info->Parameters[Info->ParamCount])
    267       1.4  christos         {
    268       1.4  christos             Info->ParamCount++;
    269       1.4  christos         }
    270       1.4  christos 
    271       1.4  christos         /* Warn on impossible argument count */
    272       1.4  christos 
    273       1.4  christos         if (Info->ParamCount > ACPI_METHOD_NUM_ARGS)
    274       1.4  christos         {
    275       1.4  christos             ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, ACPI_WARN_ALWAYS,
    276       1.4  christos                 "Excess arguments (%u) - using only %u",
    277       1.4  christos                 Info->ParamCount, ACPI_METHOD_NUM_ARGS));
    278       1.4  christos 
    279       1.4  christos             Info->ParamCount = ACPI_METHOD_NUM_ARGS;
    280       1.4  christos         }
    281       1.4  christos     }
    282       1.1    jruoho 
    283       1.1    jruoho     /*
    284       1.4  christos      * For predefined names: Check that the declared argument count
    285       1.4  christos      * matches the ACPI spec -- otherwise this is a BIOS error.
    286       1.1    jruoho      */
    287       1.4  christos     AcpiNsCheckAcpiCompliance (Info->FullPathname, Info->Node,
    288       1.4  christos         Info->Predefined);
    289       1.1    jruoho 
    290       1.1    jruoho     /*
    291       1.4  christos      * For all names: Check that the incoming argument count for
    292       1.4  christos      * this method/object matches the actual ASL/AML definition.
    293       1.1    jruoho      */
    294       1.4  christos     AcpiNsCheckArgumentCount (Info->FullPathname, Info->Node,
    295       1.4  christos         Info->ParamCount, Info->Predefined);
    296       1.1    jruoho 
    297       1.4  christos     /* For predefined names: Typecheck all incoming arguments */
    298       1.1    jruoho 
    299       1.4  christos     AcpiNsCheckArgumentTypes (Info);
    300       1.1    jruoho 
    301       1.1    jruoho     /*
    302       1.4  christos      * Three major evaluation cases:
    303       1.1    jruoho      *
    304       1.4  christos      * 1) Object types that cannot be evaluated by definition
    305       1.4  christos      * 2) The object is a control method -- execute it
    306       1.4  christos      * 3) The object is not a method -- just return it's current value
    307       1.1    jruoho      */
    308       1.4  christos     switch (AcpiNsGetType (Info->Node))
    309       1.1    jruoho     {
    310      1.11  christos     case ACPI_TYPE_ANY:
    311       1.4  christos     case ACPI_TYPE_DEVICE:
    312       1.4  christos     case ACPI_TYPE_EVENT:
    313       1.4  christos     case ACPI_TYPE_MUTEX:
    314       1.4  christos     case ACPI_TYPE_REGION:
    315       1.4  christos     case ACPI_TYPE_THERMAL:
    316       1.4  christos     case ACPI_TYPE_LOCAL_SCOPE:
    317       1.1    jruoho         /*
    318      1.11  christos          * 1) Disallow evaluation of these object types. For these,
    319      1.11  christos          *    object evaluation is undefined.
    320       1.4  christos          */
    321       1.4  christos         ACPI_ERROR ((AE_INFO,
    322      1.11  christos             "%s: This object type [%s] "
    323      1.11  christos             "never contains data and cannot be evaluated",
    324      1.11  christos             Info->FullPathname, AcpiUtGetTypeName (Info->Node->Type)));
    325       1.4  christos 
    326       1.4  christos         Status = AE_TYPE;
    327       1.4  christos         goto Cleanup;
    328       1.4  christos 
    329       1.4  christos     case ACPI_TYPE_METHOD:
    330       1.4  christos         /*
    331       1.4  christos          * 2) Object is a control method - execute it
    332       1.1    jruoho          */
    333       1.1    jruoho 
    334       1.1    jruoho         /* Verify that there is a method object associated with this node */
    335       1.1    jruoho 
    336       1.1    jruoho         if (!Info->ObjDesc)
    337       1.1    jruoho         {
    338       1.4  christos             ACPI_ERROR ((AE_INFO, "%s: Method has no attached sub-object",
    339       1.4  christos                 Info->FullPathname));
    340       1.4  christos             Status = AE_NULL_OBJECT;
    341       1.4  christos             goto Cleanup;
    342       1.1    jruoho         }
    343       1.1    jruoho 
    344       1.1    jruoho         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
    345       1.4  christos             "**** Execute method [%s] at AML address %p length %X\n",
    346       1.4  christos             Info->FullPathname,
    347       1.1    jruoho             Info->ObjDesc->Method.AmlStart + 1,
    348       1.1    jruoho             Info->ObjDesc->Method.AmlLength - 1));
    349       1.1    jruoho 
    350       1.1    jruoho         /*
    351       1.1    jruoho          * Any namespace deletion must acquire both the namespace and
    352       1.1    jruoho          * interpreter locks to ensure that no thread is using the portion of
    353       1.1    jruoho          * the namespace that is being deleted.
    354       1.1    jruoho          *
    355       1.1    jruoho          * Execute the method via the interpreter. The interpreter is locked
    356       1.1    jruoho          * here before calling into the AML parser
    357       1.1    jruoho          */
    358       1.1    jruoho         AcpiExEnterInterpreter ();
    359       1.1    jruoho         Status = AcpiPsExecuteMethod (Info);
    360       1.1    jruoho         AcpiExExitInterpreter ();
    361       1.4  christos         break;
    362       1.4  christos 
    363       1.4  christos     default:
    364       1.1    jruoho         /*
    365       1.4  christos          * 3) All other non-method objects -- get the current object value
    366       1.1    jruoho          */
    367       1.1    jruoho 
    368       1.1    jruoho         /*
    369       1.4  christos          * Some objects require additional resolution steps (e.g., the Node
    370       1.4  christos          * may be a field that must be read, etc.) -- we can't just grab
    371       1.4  christos          * the object out of the node.
    372       1.1    jruoho          *
    373       1.1    jruoho          * Use ResolveNodeToValue() to get the associated value.
    374       1.1    jruoho          *
    375       1.1    jruoho          * NOTE: we can get away with passing in NULL for a walk state because
    376       1.4  christos          * the Node is guaranteed to not be a reference to either a method
    377       1.1    jruoho          * local or a method argument (because this interface is never called
    378       1.1    jruoho          * from a running method.)
    379       1.1    jruoho          *
    380       1.1    jruoho          * Even though we do not directly invoke the interpreter for object
    381       1.4  christos          * resolution, we must lock it because we could access an OpRegion.
    382       1.4  christos          * The OpRegion access code assumes that the interpreter is locked.
    383       1.1    jruoho          */
    384       1.1    jruoho         AcpiExEnterInterpreter ();
    385       1.1    jruoho 
    386       1.4  christos         /* TBD: ResolveNodeToValue has a strange interface, fix */
    387       1.4  christos 
    388       1.4  christos         Info->ReturnObject = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Info->Node);
    389       1.1    jruoho 
    390       1.4  christos         Status = AcpiExResolveNodeToValue (ACPI_CAST_INDIRECT_PTR (
    391       1.4  christos             ACPI_NAMESPACE_NODE, &Info->ReturnObject), NULL);
    392       1.1    jruoho         AcpiExExitInterpreter ();
    393       1.1    jruoho 
    394       1.4  christos         if (ACPI_FAILURE (Status))
    395       1.1    jruoho         {
    396       1.8  christos             Info->ReturnObject = NULL;
    397       1.4  christos             goto Cleanup;
    398       1.1    jruoho         }
    399       1.4  christos 
    400       1.4  christos         ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returned object %p [%s]\n",
    401       1.4  christos             Info->ReturnObject,
    402       1.4  christos             AcpiUtGetObjectTypeName (Info->ReturnObject)));
    403       1.4  christos 
    404       1.4  christos         Status = AE_CTRL_RETURN_VALUE; /* Always has a "return value" */
    405       1.4  christos         break;
    406       1.1    jruoho     }
    407       1.1    jruoho 
    408       1.1    jruoho     /*
    409       1.4  christos      * For predefined names, check the return value against the ACPI
    410       1.4  christos      * specification. Some incorrect return value types are repaired.
    411       1.1    jruoho      */
    412       1.4  christos     (void) AcpiNsCheckReturnValue (Info->Node, Info, Info->ParamCount,
    413       1.4  christos         Status, &Info->ReturnObject);
    414       1.1    jruoho 
    415       1.1    jruoho     /* Check if there is a return value that must be dealt with */
    416       1.1    jruoho 
    417       1.1    jruoho     if (Status == AE_CTRL_RETURN_VALUE)
    418       1.1    jruoho     {
    419       1.1    jruoho         /* If caller does not want the return value, delete it */
    420       1.1    jruoho 
    421       1.1    jruoho         if (Info->Flags & ACPI_IGNORE_RETURN_VALUE)
    422       1.1    jruoho         {
    423       1.1    jruoho             AcpiUtRemoveReference (Info->ReturnObject);
    424       1.1    jruoho             Info->ReturnObject = NULL;
    425       1.1    jruoho         }
    426       1.1    jruoho 
    427       1.1    jruoho         /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */
    428       1.1    jruoho 
    429       1.1    jruoho         Status = AE_OK;
    430       1.1    jruoho     }
    431      1.12  christos     else if (ACPI_FAILURE(Status))
    432      1.11  christos     {
    433      1.11  christos         /* If ReturnObject exists, delete it */
    434      1.11  christos 
    435      1.12  christos         if (Info->ReturnObject)
    436      1.11  christos         {
    437      1.11  christos             AcpiUtRemoveReference (Info->ReturnObject);
    438      1.11  christos             Info->ReturnObject = NULL;
    439      1.11  christos         }
    440      1.11  christos     }
    441       1.1    jruoho 
    442       1.1    jruoho     ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
    443       1.4  christos         "*** Completed evaluation of object %s ***\n",
    444       1.4  christos         Info->RelativePathname));
    445       1.1    jruoho 
    446       1.4  christos Cleanup:
    447      1.13  christos     /* Optional object evaluation log */
    448      1.13  christos 
    449      1.13  christos     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EVALUATION,
    450      1.13  christos         "%-26s:  %s\n", "   Exit evaluation",
    451      1.13  christos         &Info->FullPathname[1]));
    452      1.13  christos 
    453       1.1    jruoho     /*
    454       1.1    jruoho      * Namespace was unlocked by the handling AcpiNs* function, so we
    455       1.4  christos      * just free the pathname and return
    456       1.1    jruoho      */
    457       1.4  christos     ACPI_FREE (Info->FullPathname);
    458       1.4  christos     Info->FullPathname = NULL;
    459       1.1    jruoho     return_ACPI_STATUS (Status);
    460       1.1    jruoho }
    461