Home | History | Annotate | Line # | Download | only in disassembler
dmwalk.c revision 1.16.6.1
      1       1.1    jruoho /*******************************************************************************
      2       1.1    jruoho  *
      3       1.1    jruoho  * Module Name: dmwalk - AML disassembly tree walk
      4       1.1    jruoho  *
      5       1.1    jruoho  ******************************************************************************/
      6       1.1    jruoho 
      7  1.16.6.1  perseant /******************************************************************************
      8  1.16.6.1  perseant  *
      9  1.16.6.1  perseant  * 1. Copyright Notice
     10  1.16.6.1  perseant  *
     11  1.16.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.16.6.1  perseant  * 2. License
     15  1.16.6.1  perseant  *
     16  1.16.6.1  perseant  * 2.1. This is your license from Intel Corp. under its intellectual property
     17  1.16.6.1  perseant  * rights. You may have additional license terms from the party that provided
     18  1.16.6.1  perseant  * you this software, covering your right to use that party's intellectual
     19  1.16.6.1  perseant  * property rights.
     20  1.16.6.1  perseant  *
     21  1.16.6.1  perseant  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
     22  1.16.6.1  perseant  * copy of the source code appearing in this file ("Covered Code") an
     23  1.16.6.1  perseant  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
     24  1.16.6.1  perseant  * base code distributed originally by Intel ("Original Intel Code") to copy,
     25  1.16.6.1  perseant  * make derivatives, distribute, use and display any portion of the Covered
     26  1.16.6.1  perseant  * Code in any form, with the right to sublicense such rights; and
     27  1.16.6.1  perseant  *
     28  1.16.6.1  perseant  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
     29  1.16.6.1  perseant  * license (with the right to sublicense), under only those claims of Intel
     30  1.16.6.1  perseant  * patents that are infringed by the Original Intel Code, to make, use, sell,
     31  1.16.6.1  perseant  * offer to sell, and import the Covered Code and derivative works thereof
     32  1.16.6.1  perseant  * solely to the minimum extent necessary to exercise the above copyright
     33  1.16.6.1  perseant  * license, and in no event shall the patent license extend to any additions
     34  1.16.6.1  perseant  * to or modifications of the Original Intel Code. No other license or right
     35  1.16.6.1  perseant  * is granted directly or by implication, estoppel or otherwise;
     36  1.16.6.1  perseant  *
     37  1.16.6.1  perseant  * The above copyright and patent license is granted only if the following
     38  1.16.6.1  perseant  * conditions are met:
     39  1.16.6.1  perseant  *
     40  1.16.6.1  perseant  * 3. Conditions
     41  1.16.6.1  perseant  *
     42  1.16.6.1  perseant  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
     43  1.16.6.1  perseant  * Redistribution of source code of any substantial portion of the Covered
     44  1.16.6.1  perseant  * Code or modification with rights to further distribute source must include
     45  1.16.6.1  perseant  * the above Copyright Notice, the above License, this list of Conditions,
     46  1.16.6.1  perseant  * and the following Disclaimer and Export Compliance provision. In addition,
     47  1.16.6.1  perseant  * Licensee must cause all Covered Code to which Licensee contributes to
     48  1.16.6.1  perseant  * contain a file documenting the changes Licensee made to create that Covered
     49  1.16.6.1  perseant  * Code and the date of any change. Licensee must include in that file the
     50  1.16.6.1  perseant  * documentation of any changes made by any predecessor Licensee. Licensee
     51  1.16.6.1  perseant  * must include a prominent statement that the modification is derived,
     52  1.16.6.1  perseant  * directly or indirectly, from Original Intel Code.
     53  1.16.6.1  perseant  *
     54  1.16.6.1  perseant  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
     55  1.16.6.1  perseant  * Redistribution of source code of any substantial portion of the Covered
     56  1.16.6.1  perseant  * Code or modification without rights to further distribute source must
     57  1.16.6.1  perseant  * include the following Disclaimer and Export Compliance provision in the
     58  1.16.6.1  perseant  * documentation and/or other materials provided with distribution. In
     59  1.16.6.1  perseant  * addition, Licensee may not authorize further sublicense of source of any
     60  1.16.6.1  perseant  * portion of the Covered Code, and must include terms to the effect that the
     61  1.16.6.1  perseant  * license from Licensee to its licensee is limited to the intellectual
     62  1.16.6.1  perseant  * property embodied in the software Licensee provides to its licensee, and
     63  1.16.6.1  perseant  * not to intellectual property embodied in modifications its licensee may
     64  1.16.6.1  perseant  * make.
     65  1.16.6.1  perseant  *
     66  1.16.6.1  perseant  * 3.3. Redistribution of Executable. Redistribution in executable form of any
     67  1.16.6.1  perseant  * substantial portion of the Covered Code or modification must reproduce the
     68  1.16.6.1  perseant  * above Copyright Notice, and the following Disclaimer and Export Compliance
     69  1.16.6.1  perseant  * provision in the documentation and/or other materials provided with the
     70  1.16.6.1  perseant  * distribution.
     71  1.16.6.1  perseant  *
     72  1.16.6.1  perseant  * 3.4. Intel retains all right, title, and interest in and to the Original
     73  1.16.6.1  perseant  * Intel Code.
     74  1.16.6.1  perseant  *
     75  1.16.6.1  perseant  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
     76  1.16.6.1  perseant  * Intel shall be used in advertising or otherwise to promote the sale, use or
     77  1.16.6.1  perseant  * other dealings in products derived from or relating to the Covered Code
     78  1.16.6.1  perseant  * without prior written authorization from Intel.
     79  1.16.6.1  perseant  *
     80  1.16.6.1  perseant  * 4. Disclaimer and Export Compliance
     81  1.16.6.1  perseant  *
     82  1.16.6.1  perseant  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
     83  1.16.6.1  perseant  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
     84  1.16.6.1  perseant  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
     85  1.16.6.1  perseant  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
     86  1.16.6.1  perseant  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
     87  1.16.6.1  perseant  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
     88  1.16.6.1  perseant  * PARTICULAR PURPOSE.
     89  1.16.6.1  perseant  *
     90  1.16.6.1  perseant  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
     91  1.16.6.1  perseant  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
     92  1.16.6.1  perseant  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
     93  1.16.6.1  perseant  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
     94  1.16.6.1  perseant  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
     95  1.16.6.1  perseant  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
     96  1.16.6.1  perseant  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
     97  1.16.6.1  perseant  * LIMITED REMEDY.
     98  1.16.6.1  perseant  *
     99  1.16.6.1  perseant  * 4.3. Licensee shall not export, either directly or indirectly, any of this
    100  1.16.6.1  perseant  * software or system incorporating such software without first obtaining any
    101  1.16.6.1  perseant  * required license or other approval from the U. S. Department of Commerce or
    102  1.16.6.1  perseant  * any other agency or department of the United States Government. In the
    103  1.16.6.1  perseant  * event Licensee exports any such software from the United States or
    104  1.16.6.1  perseant  * re-exports any such software from a foreign destination, Licensee shall
    105  1.16.6.1  perseant  * ensure that the distribution and export/re-export of the software is in
    106  1.16.6.1  perseant  * compliance with all laws, regulations, orders, or other restrictions of the
    107  1.16.6.1  perseant  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
    108  1.16.6.1  perseant  * any of its subsidiaries will export/re-export any technical data, process,
    109  1.16.6.1  perseant  * software, or service, directly or indirectly, to any country for which the
    110  1.16.6.1  perseant  * United States government or any agency thereof requires an export license,
    111  1.16.6.1  perseant  * other governmental approval, or letter of assurance, without first obtaining
    112  1.16.6.1  perseant  * such license, approval or letter.
    113  1.16.6.1  perseant  *
    114  1.16.6.1  perseant  *****************************************************************************
    115  1.16.6.1  perseant  *
    116  1.16.6.1  perseant  * Alternatively, you may choose to be licensed under the terms of the
    117  1.16.6.1  perseant  * following license:
    118  1.16.6.1  perseant  *
    119       1.2  christos  * Redistribution and use in source and binary forms, with or without
    120       1.2  christos  * modification, are permitted provided that the following conditions
    121       1.2  christos  * are met:
    122       1.2  christos  * 1. Redistributions of source code must retain the above copyright
    123       1.2  christos  *    notice, this list of conditions, and the following disclaimer,
    124       1.2  christos  *    without modification.
    125       1.2  christos  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
    126       1.2  christos  *    substantially similar to the "NO WARRANTY" disclaimer below
    127       1.2  christos  *    ("Disclaimer") and any redistribution must be conditioned upon
    128       1.2  christos  *    including a substantially similar Disclaimer requirement for further
    129       1.2  christos  *    binary redistribution.
    130       1.2  christos  * 3. Neither the names of the above-listed copyright holders nor the names
    131       1.2  christos  *    of any contributors may be used to endorse or promote products derived
    132       1.2  christos  *    from this software without specific prior written permission.
    133       1.2  christos  *
    134       1.2  christos  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    135       1.2  christos  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    136      1.14  christos  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    137       1.2  christos  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    138  1.16.6.1  perseant  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    139  1.16.6.1  perseant  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    140  1.16.6.1  perseant  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    141  1.16.6.1  perseant  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    142  1.16.6.1  perseant  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    143  1.16.6.1  perseant  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    144  1.16.6.1  perseant  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    145  1.16.6.1  perseant  *
    146  1.16.6.1  perseant  * Alternatively, you may choose to be licensed under the terms of the
    147  1.16.6.1  perseant  * GNU General Public License ("GPL") version 2 as published by the Free
    148  1.16.6.1  perseant  * Software Foundation.
    149  1.16.6.1  perseant  *
    150  1.16.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 "acparser.h"
    155       1.1    jruoho #include "amlcode.h"
    156       1.1    jruoho #include "acdebug.h"
    157       1.8  christos #include "acconvert.h"
    158       1.1    jruoho 
    159       1.1    jruoho 
    160       1.1    jruoho #define _COMPONENT          ACPI_CA_DEBUGGER
    161       1.1    jruoho         ACPI_MODULE_NAME    ("dmwalk")
    162       1.1    jruoho 
    163       1.1    jruoho 
    164       1.1    jruoho /* Stub for non-compiler code */
    165       1.1    jruoho 
    166       1.1    jruoho #ifndef ACPI_ASL_COMPILER
    167       1.1    jruoho void
    168       1.1    jruoho AcpiDmEmitExternals (
    169       1.1    jruoho     void)
    170       1.1    jruoho {
    171       1.1    jruoho     return;
    172       1.1    jruoho }
    173       1.8  christos 
    174       1.8  christos void
    175       1.8  christos AcpiDmEmitExternal (
    176       1.8  christos     ACPI_PARSE_OBJECT       *NameOp,
    177       1.8  christos     ACPI_PARSE_OBJECT       *TypeOp)
    178       1.8  christos {
    179       1.8  christos     return;
    180       1.8  christos }
    181       1.1    jruoho #endif
    182       1.1    jruoho 
    183       1.1    jruoho /* Local prototypes */
    184       1.1    jruoho 
    185       1.1    jruoho static ACPI_STATUS
    186       1.1    jruoho AcpiDmDescendingOp (
    187       1.1    jruoho     ACPI_PARSE_OBJECT       *Op,
    188       1.1    jruoho     UINT32                  Level,
    189       1.1    jruoho     void                    *Context);
    190       1.1    jruoho 
    191       1.1    jruoho static ACPI_STATUS
    192       1.1    jruoho AcpiDmAscendingOp (
    193       1.1    jruoho     ACPI_PARSE_OBJECT       *Op,
    194       1.1    jruoho     UINT32                  Level,
    195       1.1    jruoho     void                    *Context);
    196       1.1    jruoho 
    197       1.1    jruoho 
    198       1.1    jruoho /*******************************************************************************
    199       1.1    jruoho  *
    200       1.1    jruoho  * FUNCTION:    AcpiDmDisassemble
    201       1.1    jruoho  *
    202       1.1    jruoho  * PARAMETERS:  WalkState       - Current state
    203       1.1    jruoho  *              Origin          - Starting object
    204       1.1    jruoho  *              NumOpcodes      - Max number of opcodes to be displayed
    205       1.1    jruoho  *
    206       1.1    jruoho  * RETURN:      None
    207       1.1    jruoho  *
    208       1.2  christos  * DESCRIPTION: Disassemble parser object and its children. This is the
    209       1.1    jruoho  *              main entry point of the disassembler.
    210       1.1    jruoho  *
    211       1.1    jruoho  ******************************************************************************/
    212       1.1    jruoho 
    213       1.1    jruoho void
    214       1.1    jruoho AcpiDmDisassemble (
    215       1.1    jruoho     ACPI_WALK_STATE         *WalkState,
    216       1.1    jruoho     ACPI_PARSE_OBJECT       *Origin,
    217       1.1    jruoho     UINT32                  NumOpcodes)
    218       1.1    jruoho {
    219       1.1    jruoho     ACPI_PARSE_OBJECT       *Op = Origin;
    220       1.1    jruoho     ACPI_OP_WALK_INFO       Info;
    221       1.1    jruoho 
    222       1.1    jruoho 
    223       1.1    jruoho     if (!Op)
    224       1.1    jruoho     {
    225       1.1    jruoho         return;
    226       1.1    jruoho     }
    227       1.1    jruoho 
    228       1.4  christos     memset (&Info, 0, sizeof (ACPI_OP_WALK_INFO));
    229       1.1    jruoho     Info.WalkState = WalkState;
    230       1.4  christos     Info.StartAml = Op->Common.Aml - sizeof (ACPI_TABLE_HEADER);
    231       1.4  christos     Info.AmlOffset = Op->Common.Aml - Info.StartAml;
    232       1.4  christos 
    233       1.1    jruoho     AcpiDmWalkParseTree (Op, AcpiDmDescendingOp, AcpiDmAscendingOp, &Info);
    234       1.1    jruoho     return;
    235       1.1    jruoho }
    236       1.1    jruoho 
    237       1.1    jruoho 
    238       1.1    jruoho /*******************************************************************************
    239       1.1    jruoho  *
    240       1.1    jruoho  * FUNCTION:    AcpiDmWalkParseTree
    241       1.1    jruoho  *
    242       1.1    jruoho  * PARAMETERS:  Op                      - Root Op object
    243       1.1    jruoho  *              DescendingCallback      - Called during tree descent
    244       1.1    jruoho  *              AscendingCallback       - Called during tree ascent
    245       1.1    jruoho  *              Context                 - To be passed to the callbacks
    246       1.1    jruoho  *
    247       1.1    jruoho  * RETURN:      Status from callback(s)
    248       1.1    jruoho  *
    249       1.1    jruoho  * DESCRIPTION: Walk the entire parse tree.
    250       1.1    jruoho  *
    251       1.1    jruoho  ******************************************************************************/
    252       1.1    jruoho 
    253       1.1    jruoho void
    254       1.1    jruoho AcpiDmWalkParseTree (
    255       1.1    jruoho     ACPI_PARSE_OBJECT       *Op,
    256       1.1    jruoho     ASL_WALK_CALLBACK       DescendingCallback,
    257       1.1    jruoho     ASL_WALK_CALLBACK       AscendingCallback,
    258       1.1    jruoho     void                    *Context)
    259       1.1    jruoho {
    260       1.1    jruoho     BOOLEAN                 NodePreviouslyVisited;
    261       1.1    jruoho     ACPI_PARSE_OBJECT       *StartOp = Op;
    262       1.1    jruoho     ACPI_STATUS             Status;
    263       1.1    jruoho     ACPI_PARSE_OBJECT       *Next;
    264       1.1    jruoho     ACPI_OP_WALK_INFO       *Info = Context;
    265       1.1    jruoho 
    266       1.1    jruoho 
    267       1.1    jruoho     Info->Level = 0;
    268       1.1    jruoho     NodePreviouslyVisited = FALSE;
    269       1.1    jruoho 
    270       1.1    jruoho     while (Op)
    271       1.1    jruoho     {
    272       1.1    jruoho         if (NodePreviouslyVisited)
    273       1.1    jruoho         {
    274       1.1    jruoho             if (AscendingCallback)
    275       1.1    jruoho             {
    276       1.1    jruoho                 Status = AscendingCallback (Op, Info->Level, Context);
    277       1.1    jruoho                 if (ACPI_FAILURE (Status))
    278       1.1    jruoho                 {
    279       1.1    jruoho                     return;
    280       1.1    jruoho                 }
    281       1.1    jruoho             }
    282       1.1    jruoho         }
    283       1.1    jruoho         else
    284       1.1    jruoho         {
    285       1.1    jruoho             /* Let the callback process the node */
    286       1.1    jruoho 
    287       1.1    jruoho             Status = DescendingCallback (Op, Info->Level, Context);
    288       1.1    jruoho             if (ACPI_SUCCESS (Status))
    289       1.1    jruoho             {
    290       1.1    jruoho                 /* Visit children first, once */
    291       1.1    jruoho 
    292       1.1    jruoho                 Next = AcpiPsGetArg (Op, 0);
    293       1.1    jruoho                 if (Next)
    294       1.1    jruoho                 {
    295       1.1    jruoho                     Info->Level++;
    296       1.1    jruoho                     Op = Next;
    297       1.1    jruoho                     continue;
    298       1.1    jruoho                 }
    299       1.1    jruoho             }
    300       1.1    jruoho             else if (Status != AE_CTRL_DEPTH)
    301       1.1    jruoho             {
    302       1.1    jruoho                 /* Exit immediately on any error */
    303       1.1    jruoho 
    304       1.1    jruoho                 return;
    305       1.1    jruoho             }
    306       1.1    jruoho         }
    307       1.1    jruoho 
    308       1.1    jruoho         /* Terminate walk at start op */
    309       1.1    jruoho 
    310       1.1    jruoho         if (Op == StartOp)
    311       1.1    jruoho         {
    312       1.1    jruoho             break;
    313       1.1    jruoho         }
    314       1.1    jruoho 
    315       1.1    jruoho         /* No more children, re-visit this node */
    316       1.1    jruoho 
    317       1.1    jruoho         if (!NodePreviouslyVisited)
    318       1.1    jruoho         {
    319       1.1    jruoho             NodePreviouslyVisited = TRUE;
    320       1.1    jruoho             continue;
    321       1.1    jruoho         }
    322       1.1    jruoho 
    323       1.1    jruoho         /* No more children, visit peers */
    324       1.1    jruoho 
    325       1.1    jruoho         if (Op->Common.Next)
    326       1.1    jruoho         {
    327       1.1    jruoho             Op = Op->Common.Next;
    328       1.1    jruoho             NodePreviouslyVisited = FALSE;
    329       1.1    jruoho         }
    330       1.1    jruoho         else
    331       1.1    jruoho         {
    332       1.1    jruoho             /* No peers, re-visit parent */
    333       1.1    jruoho 
    334       1.1    jruoho             if (Info->Level != 0 )
    335       1.1    jruoho             {
    336       1.1    jruoho                 Info->Level--;
    337       1.1    jruoho             }
    338       1.1    jruoho 
    339       1.1    jruoho             Op = Op->Common.Parent;
    340       1.1    jruoho             NodePreviouslyVisited = TRUE;
    341       1.1    jruoho         }
    342       1.1    jruoho     }
    343       1.1    jruoho 
    344       1.1    jruoho     /* If we get here, the walk completed with no errors */
    345       1.1    jruoho 
    346       1.1    jruoho     return;
    347       1.1    jruoho }
    348       1.1    jruoho 
    349       1.1    jruoho 
    350       1.1    jruoho /*******************************************************************************
    351       1.1    jruoho  *
    352       1.1    jruoho  * FUNCTION:    AcpiDmBlockType
    353       1.1    jruoho  *
    354       1.1    jruoho  * PARAMETERS:  Op              - Object to be examined
    355       1.1    jruoho  *
    356       1.1    jruoho  * RETURN:      BlockType - not a block, parens, braces, or even both.
    357       1.1    jruoho  *
    358       1.1    jruoho  * DESCRIPTION: Type of block for this op (parens or braces)
    359       1.1    jruoho  *
    360       1.1    jruoho  ******************************************************************************/
    361       1.1    jruoho 
    362       1.8  christos UINT32
    363       1.1    jruoho AcpiDmBlockType (
    364       1.1    jruoho     ACPI_PARSE_OBJECT       *Op)
    365       1.1    jruoho {
    366       1.1    jruoho     const ACPI_OPCODE_INFO  *OpInfo;
    367       1.1    jruoho 
    368       1.1    jruoho 
    369       1.1    jruoho     if (!Op)
    370       1.1    jruoho     {
    371       1.1    jruoho         return (BLOCK_NONE);
    372       1.1    jruoho     }
    373       1.1    jruoho 
    374       1.1    jruoho     switch (Op->Common.AmlOpcode)
    375       1.1    jruoho     {
    376       1.1    jruoho     case AML_ELSE_OP:
    377       1.1    jruoho 
    378       1.1    jruoho         return (BLOCK_BRACE);
    379       1.1    jruoho 
    380       1.1    jruoho     case AML_METHOD_OP:
    381       1.1    jruoho     case AML_DEVICE_OP:
    382       1.1    jruoho     case AML_SCOPE_OP:
    383       1.1    jruoho     case AML_PROCESSOR_OP:
    384       1.8  christos     case AML_POWER_RESOURCE_OP:
    385       1.1    jruoho     case AML_THERMAL_ZONE_OP:
    386       1.1    jruoho     case AML_IF_OP:
    387       1.1    jruoho     case AML_WHILE_OP:
    388       1.1    jruoho     case AML_FIELD_OP:
    389       1.1    jruoho     case AML_INDEX_FIELD_OP:
    390       1.1    jruoho     case AML_BANK_FIELD_OP:
    391       1.1    jruoho 
    392       1.1    jruoho         return (BLOCK_PAREN | BLOCK_BRACE);
    393       1.1    jruoho 
    394       1.1    jruoho     case AML_BUFFER_OP:
    395       1.1    jruoho 
    396       1.2  christos         if ((Op->Common.DisasmOpcode == ACPI_DASM_UNICODE) ||
    397       1.2  christos             (Op->Common.DisasmOpcode == ACPI_DASM_UUID) ||
    398       1.2  christos             (Op->Common.DisasmOpcode == ACPI_DASM_PLD_METHOD))
    399       1.1    jruoho         {
    400       1.1    jruoho             return (BLOCK_NONE);
    401       1.1    jruoho         }
    402       1.1    jruoho 
    403      1.14  christos         ACPI_FALLTHROUGH;
    404       1.1    jruoho 
    405       1.1    jruoho     case AML_PACKAGE_OP:
    406       1.8  christos     case AML_VARIABLE_PACKAGE_OP:
    407       1.1    jruoho 
    408       1.1    jruoho         return (BLOCK_PAREN | BLOCK_BRACE);
    409       1.1    jruoho 
    410       1.1    jruoho     case AML_EVENT_OP:
    411       1.1    jruoho 
    412       1.1    jruoho         return (BLOCK_PAREN);
    413       1.1    jruoho 
    414       1.2  christos     case AML_INT_METHODCALL_OP:
    415       1.2  christos 
    416       1.2  christos         if (Op->Common.Parent &&
    417       1.2  christos             ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
    418       1.8  christos              (Op->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP)))
    419       1.2  christos         {
    420       1.2  christos             /* This is a reference to a method, not an invocation */
    421       1.2  christos 
    422       1.2  christos             return (BLOCK_NONE);
    423       1.2  christos         }
    424       1.2  christos 
    425      1.14  christos         ACPI_FALLTHROUGH;
    426       1.2  christos 
    427       1.1    jruoho     default:
    428       1.1    jruoho 
    429       1.1    jruoho         OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
    430       1.1    jruoho         if (OpInfo->Flags & AML_HAS_ARGS)
    431       1.1    jruoho         {
    432       1.1    jruoho             return (BLOCK_PAREN);
    433       1.1    jruoho         }
    434       1.1    jruoho 
    435       1.1    jruoho         return (BLOCK_NONE);
    436       1.1    jruoho     }
    437       1.1    jruoho }
    438       1.1    jruoho 
    439       1.1    jruoho 
    440       1.1    jruoho /*******************************************************************************
    441       1.1    jruoho  *
    442       1.1    jruoho  * FUNCTION:    AcpiDmListType
    443       1.1    jruoho  *
    444       1.1    jruoho  * PARAMETERS:  Op              - Object to be examined
    445       1.1    jruoho  *
    446       1.1    jruoho  * RETURN:      ListType - has commas or not.
    447       1.1    jruoho  *
    448       1.1    jruoho  * DESCRIPTION: Type of block for this op (parens or braces)
    449       1.1    jruoho  *
    450       1.1    jruoho  ******************************************************************************/
    451       1.1    jruoho 
    452       1.1    jruoho UINT32
    453       1.1    jruoho AcpiDmListType (
    454       1.1    jruoho     ACPI_PARSE_OBJECT       *Op)
    455       1.1    jruoho {
    456       1.1    jruoho     const ACPI_OPCODE_INFO  *OpInfo;
    457       1.1    jruoho 
    458       1.1    jruoho 
    459       1.1    jruoho     if (!Op)
    460       1.1    jruoho     {
    461       1.1    jruoho         return (BLOCK_NONE);
    462       1.1    jruoho     }
    463       1.1    jruoho 
    464       1.1    jruoho     switch (Op->Common.AmlOpcode)
    465       1.1    jruoho     {
    466       1.1    jruoho 
    467       1.1    jruoho     case AML_ELSE_OP:
    468       1.1    jruoho     case AML_METHOD_OP:
    469       1.1    jruoho     case AML_DEVICE_OP:
    470       1.1    jruoho     case AML_SCOPE_OP:
    471       1.8  christos     case AML_POWER_RESOURCE_OP:
    472       1.1    jruoho     case AML_PROCESSOR_OP:
    473       1.1    jruoho     case AML_THERMAL_ZONE_OP:
    474       1.1    jruoho     case AML_IF_OP:
    475       1.1    jruoho     case AML_WHILE_OP:
    476       1.1    jruoho     case AML_FIELD_OP:
    477       1.1    jruoho     case AML_INDEX_FIELD_OP:
    478       1.1    jruoho     case AML_BANK_FIELD_OP:
    479       1.1    jruoho 
    480       1.1    jruoho         return (BLOCK_NONE);
    481       1.1    jruoho 
    482       1.1    jruoho     case AML_BUFFER_OP:
    483       1.1    jruoho     case AML_PACKAGE_OP:
    484       1.8  christos     case AML_VARIABLE_PACKAGE_OP:
    485       1.1    jruoho 
    486       1.1    jruoho         return (BLOCK_COMMA_LIST);
    487       1.1    jruoho 
    488       1.1    jruoho     default:
    489       1.1    jruoho 
    490       1.1    jruoho         OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
    491       1.1    jruoho         if (OpInfo->Flags & AML_HAS_ARGS)
    492       1.1    jruoho         {
    493       1.1    jruoho             return (BLOCK_COMMA_LIST);
    494       1.1    jruoho         }
    495       1.1    jruoho 
    496       1.1    jruoho         return (BLOCK_NONE);
    497       1.1    jruoho     }
    498       1.1    jruoho }
    499       1.1    jruoho 
    500       1.1    jruoho 
    501       1.1    jruoho /*******************************************************************************
    502       1.1    jruoho  *
    503       1.1    jruoho  * FUNCTION:    AcpiDmDescendingOp
    504       1.1    jruoho  *
    505       1.1    jruoho  * PARAMETERS:  ASL_WALK_CALLBACK
    506       1.1    jruoho  *
    507       1.1    jruoho  * RETURN:      Status
    508       1.1    jruoho  *
    509       1.1    jruoho  * DESCRIPTION: First visitation of a parse object during tree descent.
    510       1.1    jruoho  *              Decode opcode name and begin parameter list(s), if any.
    511       1.1    jruoho  *
    512       1.1    jruoho  ******************************************************************************/
    513       1.1    jruoho 
    514       1.1    jruoho static ACPI_STATUS
    515       1.1    jruoho AcpiDmDescendingOp (
    516       1.1    jruoho     ACPI_PARSE_OBJECT       *Op,
    517       1.1    jruoho     UINT32                  Level,
    518       1.1    jruoho     void                    *Context)
    519       1.1    jruoho {
    520       1.1    jruoho     ACPI_OP_WALK_INFO       *Info = Context;
    521       1.1    jruoho     const ACPI_OPCODE_INFO  *OpInfo;
    522       1.1    jruoho     UINT32                  Name;
    523       1.1    jruoho     ACPI_PARSE_OBJECT       *NextOp;
    524       1.5  christos     ACPI_PARSE_OBJECT       *NextOp2;
    525       1.3  christos     UINT32                  AmlOffset;
    526       1.1    jruoho 
    527       1.1    jruoho 
    528       1.8  christos     /* Determine which file this parse node is contained in. */
    529       1.8  christos 
    530      1.10  christos     if (AcpiGbl_CaptureComments)
    531       1.8  christos     {
    532       1.8  christos         ASL_CV_LABEL_FILENODE (Op);
    533       1.8  christos 
    534       1.8  christos         if (Level != 0 && ASL_CV_FILE_HAS_SWITCHED (Op))
    535       1.8  christos         {
    536       1.8  christos             ASL_CV_SWITCH_FILES (Level, Op);
    537       1.8  christos         }
    538       1.8  christos 
    539       1.8  christos         /* If this parse node has regular comments, print them here. */
    540       1.8  christos 
    541       1.8  christos         ASL_CV_PRINT_ONE_COMMENT (Op, AML_COMMENT_STANDARD, NULL, Level);
    542       1.8  christos     }
    543       1.8  christos 
    544       1.4  christos     OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
    545       1.4  christos 
    546       1.4  christos     /* Listing support to dump the AML code after the ASL statement */
    547       1.4  christos 
    548       1.4  christos     if (AcpiGbl_DmOpt_Listing)
    549       1.3  christos     {
    550       1.4  christos         /* We only care about these classes of objects */
    551       1.3  christos 
    552       1.4  christos         if ((OpInfo->Class == AML_CLASS_NAMED_OBJECT) ||
    553       1.4  christos             (OpInfo->Class == AML_CLASS_CONTROL) ||
    554       1.4  christos             (OpInfo->Class == AML_CLASS_CREATE) ||
    555       1.4  christos             ((OpInfo->Class == AML_CLASS_EXECUTE) && (!Op->Common.Next)))
    556       1.3  christos         {
    557       1.4  christos             if (AcpiGbl_DmOpt_Listing && Info->PreviousAml)
    558       1.4  christos             {
    559       1.4  christos                 /* Dump the AML byte code for the previous Op */
    560       1.4  christos 
    561       1.4  christos                 if (Op->Common.Aml > Info->PreviousAml)
    562       1.4  christos                 {
    563       1.4  christos                     AcpiOsPrintf ("\n");
    564       1.4  christos                     AcpiUtDumpBuffer (
    565       1.4  christos                         (Info->StartAml + Info->AmlOffset),
    566       1.4  christos                         (Op->Common.Aml - Info->PreviousAml),
    567       1.5  christos                         DB_BYTE_DISPLAY, Info->AmlOffset);
    568       1.4  christos                     AcpiOsPrintf ("\n");
    569       1.4  christos                 }
    570       1.4  christos 
    571       1.4  christos                 Info->AmlOffset = (Op->Common.Aml - Info->StartAml);
    572       1.4  christos             }
    573       1.4  christos 
    574       1.4  christos             Info->PreviousAml = Op->Common.Aml;
    575       1.3  christos         }
    576       1.3  christos     }
    577       1.3  christos 
    578       1.1    jruoho     if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE)
    579       1.1    jruoho     {
    580       1.1    jruoho         /* Ignore this op -- it was handled elsewhere */
    581       1.1    jruoho 
    582       1.1    jruoho         return (AE_CTRL_DEPTH);
    583       1.1    jruoho     }
    584       1.1    jruoho 
    585       1.7  christos     if (Op->Common.DisasmOpcode == ACPI_DASM_IGNORE_SINGLE)
    586       1.7  christos     {
    587       1.7  christos         /* Ignore this op, but not it's children */
    588       1.7  christos 
    589       1.7  christos         return (AE_OK);
    590       1.7  christos     }
    591       1.7  christos 
    592       1.5  christos     if (Op->Common.AmlOpcode == AML_IF_OP)
    593       1.5  christos     {
    594       1.5  christos         NextOp = AcpiPsGetDepthNext (NULL, Op);
    595       1.5  christos         if (NextOp)
    596       1.5  christos         {
    597       1.5  christos             NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
    598       1.5  christos 
    599       1.6  christos             /* Don't emit the actual embedded externals unless asked */
    600       1.6  christos 
    601       1.6  christos             if (!AcpiGbl_DmEmitExternalOpcodes)
    602       1.5  christos             {
    603       1.6  christos                 /*
    604       1.6  christos                  * A Zero predicate indicates the possibility of one or more
    605       1.6  christos                  * External() opcodes within the If() block.
    606       1.6  christos                  */
    607       1.6  christos                 if (NextOp->Common.AmlOpcode == AML_ZERO_OP)
    608       1.6  christos                 {
    609       1.6  christos                     NextOp2 = NextOp->Common.Next;
    610       1.5  christos 
    611       1.6  christos                     if (NextOp2 &&
    612       1.6  christos                         (NextOp2->Common.AmlOpcode == AML_EXTERNAL_OP))
    613       1.6  christos                     {
    614       1.6  christos                         /* Ignore the If 0 block and all children */
    615       1.5  christos 
    616       1.6  christos                         Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
    617       1.6  christos                         return (AE_CTRL_DEPTH);
    618       1.6  christos                     }
    619       1.5  christos                 }
    620       1.5  christos             }
    621       1.5  christos         }
    622       1.5  christos     }
    623       1.5  christos 
    624       1.1    jruoho     /* Level 0 is at the Definition Block level */
    625       1.1    jruoho 
    626       1.1    jruoho     if (Level == 0)
    627       1.1    jruoho     {
    628       1.1    jruoho         /* In verbose mode, print the AML offset, opcode and depth count */
    629       1.1    jruoho 
    630       1.1    jruoho         if (Info->WalkState)
    631       1.1    jruoho         {
    632       1.3  christos             AmlOffset = (UINT32) ACPI_PTR_DIFF (Op->Common.Aml,
    633       1.4  christos                 Info->WalkState->ParserState.AmlStart);
    634       1.4  christos             if (AcpiGbl_DmOpt_Verbose)
    635       1.4  christos             {
    636       1.9  christos                 if (AcpiGbl_CmSingleStep)
    637       1.9  christos                 {
    638       1.9  christos                     AcpiOsPrintf ("%5.5X/%4.4X: ",
    639       1.9  christos                         AmlOffset, (UINT32) Op->Common.AmlOpcode);
    640       1.9  christos                 }
    641       1.9  christos                 else
    642       1.9  christos                 {
    643       1.9  christos                     AcpiOsPrintf ("AML Offset %5.5X, Opcode %4.4X: ",
    644       1.9  christos                         AmlOffset, (UINT32) Op->Common.AmlOpcode);
    645       1.9  christos                 }
    646       1.4  christos             }
    647       1.1    jruoho         }
    648       1.1    jruoho 
    649       1.1    jruoho         if (Op->Common.AmlOpcode == AML_SCOPE_OP)
    650       1.1    jruoho         {
    651       1.1    jruoho             /* This is the beginning of the Definition Block */
    652       1.1    jruoho 
    653       1.1    jruoho             AcpiOsPrintf ("{\n");
    654       1.1    jruoho 
    655       1.1    jruoho             /* Emit all External() declarations here */
    656       1.1    jruoho 
    657       1.8  christos             if (!AcpiGbl_DmEmitExternalOpcodes)
    658       1.8  christos             {
    659       1.8  christos                 AcpiDmEmitExternals ();
    660       1.8  christos             }
    661       1.8  christos 
    662       1.1    jruoho             return (AE_OK);
    663       1.1    jruoho         }
    664       1.1    jruoho     }
    665       1.1    jruoho     else if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
    666       1.5  christos          (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST)) &&
    667       1.4  christos          (!(Op->Common.DisasmFlags & ACPI_PARSEOP_ELSEIF)) &&
    668       1.4  christos          (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
    669       1.1    jruoho     {
    670       1.4  christos         /*
    671       1.4  christos          * This is a first-level element of a term list,
    672       1.4  christos          * indent a new line
    673       1.4  christos          */
    674       1.4  christos         switch (Op->Common.AmlOpcode)
    675       1.4  christos         {
    676       1.4  christos         case AML_NOOP_OP:
    677       1.1    jruoho             /*
    678       1.4  christos              * Optionally just ignore this opcode. Some tables use
    679       1.4  christos              * NoOp opcodes for "padding" out packages that the BIOS
    680       1.4  christos              * changes dynamically. This can leave hundreds or
    681       1.4  christos              * thousands of NoOp opcodes that if disassembled,
    682       1.4  christos              * cannot be compiled because they are syntactically
    683       1.4  christos              * incorrect.
    684       1.1    jruoho              */
    685       1.4  christos             if (AcpiGbl_IgnoreNoopOperator)
    686       1.2  christos             {
    687       1.4  christos                 Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
    688       1.4  christos                 return (AE_OK);
    689       1.4  christos             }
    690       1.2  christos 
    691      1.14  christos             ACPI_FALLTHROUGH;
    692       1.2  christos 
    693       1.4  christos         default:
    694       1.2  christos 
    695       1.4  christos             AcpiDmIndent (Level);
    696       1.4  christos             break;
    697       1.4  christos         }
    698       1.2  christos 
    699       1.4  christos         Info->LastLevel = Level;
    700       1.4  christos         Info->Count = 0;
    701       1.1    jruoho     }
    702       1.1    jruoho 
    703       1.1    jruoho     /*
    704       1.1    jruoho      * This is an inexpensive mechanism to try and keep lines from getting
    705       1.1    jruoho      * too long. When the limit is hit, start a new line at the previous
    706       1.1    jruoho      * indent plus one. A better but more expensive mechanism would be to
    707       1.1    jruoho      * keep track of the current column.
    708       1.1    jruoho      */
    709       1.1    jruoho     Info->Count++;
    710       1.2  christos     if (Info->Count /* +Info->LastLevel */ > 12)
    711       1.1    jruoho     {
    712       1.1    jruoho         Info->Count = 0;
    713       1.1    jruoho         AcpiOsPrintf ("\n");
    714       1.1    jruoho         AcpiDmIndent (Info->LastLevel + 1);
    715       1.1    jruoho     }
    716       1.1    jruoho 
    717       1.2  christos     /* If ASL+ is enabled, check for a C-style operator */
    718       1.2  christos 
    719       1.2  christos     if (AcpiDmCheckForSymbolicOpcode (Op, Info))
    720       1.2  christos     {
    721       1.2  christos         return (AE_OK);
    722       1.2  christos     }
    723       1.2  christos 
    724       1.1    jruoho     /* Print the opcode name */
    725       1.1    jruoho 
    726       1.1    jruoho     AcpiDmDisassembleOneOp (NULL, Info, Op);
    727       1.1    jruoho 
    728       1.2  christos     if ((Op->Common.DisasmOpcode == ACPI_DASM_LNOT_PREFIX) ||
    729       1.2  christos         (Op->Common.AmlOpcode == AML_INT_CONNECTION_OP))
    730       1.1    jruoho     {
    731       1.1    jruoho         return (AE_OK);
    732       1.1    jruoho     }
    733       1.1    jruoho 
    734       1.1    jruoho     if ((Op->Common.AmlOpcode == AML_NAME_OP) ||
    735       1.1    jruoho         (Op->Common.AmlOpcode == AML_RETURN_OP))
    736       1.1    jruoho     {
    737       1.1    jruoho         Info->Level--;
    738       1.1    jruoho     }
    739       1.1    jruoho 
    740       1.8  christos     if (Op->Common.AmlOpcode == AML_EXTERNAL_OP)
    741       1.8  christos     {
    742       1.8  christos         Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
    743       1.8  christos         return (AE_CTRL_DEPTH);
    744       1.8  christos     }
    745       1.8  christos 
    746       1.1    jruoho     /* Start the opcode argument list if necessary */
    747       1.1    jruoho 
    748       1.1    jruoho     if ((OpInfo->Flags & AML_HAS_ARGS) ||
    749       1.1    jruoho         (Op->Common.AmlOpcode == AML_EVENT_OP))
    750       1.1    jruoho     {
    751       1.1    jruoho         /* This opcode has an argument list */
    752       1.1    jruoho 
    753       1.1    jruoho         if (AcpiDmBlockType (Op) & BLOCK_PAREN)
    754       1.1    jruoho         {
    755       1.1    jruoho             AcpiOsPrintf (" (");
    756       1.8  christos             if (!(AcpiDmBlockType (Op) & BLOCK_BRACE))
    757       1.8  christos             {
    758       1.8  christos                 ASL_CV_PRINT_ONE_COMMENT (Op, AMLCOMMENT_INLINE, " ", 0);
    759       1.8  christos             }
    760       1.1    jruoho         }
    761       1.1    jruoho 
    762       1.1    jruoho         /* If this is a named opcode, print the associated name value */
    763       1.1    jruoho 
    764       1.1    jruoho         if (OpInfo->Flags & AML_NAMED)
    765       1.1    jruoho         {
    766       1.1    jruoho             switch (Op->Common.AmlOpcode)
    767       1.1    jruoho             {
    768       1.1    jruoho             case AML_ALIAS_OP:
    769       1.1    jruoho 
    770       1.1    jruoho                 NextOp = AcpiPsGetDepthNext (NULL, Op);
    771       1.1    jruoho                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
    772       1.1    jruoho                 AcpiDmNamestring (NextOp->Common.Value.Name);
    773       1.1    jruoho                 AcpiOsPrintf (", ");
    774       1.1    jruoho 
    775      1.14  christos                 ACPI_FALLTHROUGH;
    776       1.1    jruoho 
    777       1.1    jruoho             default:
    778       1.1    jruoho 
    779       1.1    jruoho                 Name = AcpiPsGetName (Op);
    780       1.1    jruoho                 if (Op->Named.Path)
    781       1.1    jruoho                 {
    782       1.9  christos                     AcpiDmNamestring (Op->Named.Path);
    783       1.1    jruoho                 }
    784       1.1    jruoho                 else
    785       1.1    jruoho                 {
    786       1.1    jruoho                     AcpiDmDumpName (Name);
    787       1.1    jruoho                 }
    788       1.1    jruoho 
    789       1.1    jruoho                 if (Op->Common.AmlOpcode != AML_INT_NAMEDFIELD_OP)
    790       1.1    jruoho                 {
    791       1.4  christos                     if (AcpiGbl_DmOpt_Verbose)
    792       1.1    jruoho                     {
    793       1.1    jruoho                         (void) AcpiPsDisplayObjectPathname (NULL, Op);
    794       1.1    jruoho                     }
    795       1.1    jruoho                 }
    796       1.1    jruoho                 break;
    797       1.1    jruoho             }
    798       1.1    jruoho 
    799       1.1    jruoho             switch (Op->Common.AmlOpcode)
    800       1.1    jruoho             {
    801       1.1    jruoho             case AML_METHOD_OP:
    802       1.1    jruoho 
    803       1.1    jruoho                 AcpiDmMethodFlags (Op);
    804       1.8  christos                 ASL_CV_CLOSE_PAREN (Op, Level);
    805       1.2  christos 
    806       1.2  christos                 /* Emit description comment for Method() with a predefined ACPI name */
    807       1.2  christos 
    808       1.2  christos                 AcpiDmPredefinedDescription (Op);
    809       1.1    jruoho                 break;
    810       1.1    jruoho 
    811       1.1    jruoho             case AML_NAME_OP:
    812       1.1    jruoho 
    813       1.1    jruoho                 /* Check for _HID and related EISAID() */
    814       1.1    jruoho 
    815       1.2  christos                 AcpiDmCheckForHardwareId (Op);
    816       1.1    jruoho                 AcpiOsPrintf (", ");
    817       1.8  christos                 ASL_CV_PRINT_ONE_COMMENT (Op, AML_NAMECOMMENT, NULL, 0);
    818       1.1    jruoho                 break;
    819       1.1    jruoho 
    820       1.1    jruoho             case AML_REGION_OP:
    821       1.1    jruoho 
    822       1.1    jruoho                 AcpiDmRegionFlags (Op);
    823       1.1    jruoho                 break;
    824       1.1    jruoho 
    825       1.8  christos             case AML_POWER_RESOURCE_OP:
    826       1.1    jruoho 
    827       1.1    jruoho                 /* Mark the next two Ops as part of the parameter list */
    828       1.1    jruoho 
    829       1.1    jruoho                 AcpiOsPrintf (", ");
    830       1.1    jruoho                 NextOp = AcpiPsGetDepthNext (NULL, Op);
    831       1.5  christos                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
    832       1.1    jruoho 
    833       1.1    jruoho                 NextOp = NextOp->Common.Next;
    834       1.5  christos                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
    835       1.1    jruoho                 return (AE_OK);
    836       1.1    jruoho 
    837       1.1    jruoho             case AML_PROCESSOR_OP:
    838       1.1    jruoho 
    839       1.1    jruoho                 /* Mark the next three Ops as part of the parameter list */
    840       1.1    jruoho 
    841       1.1    jruoho                 AcpiOsPrintf (", ");
    842       1.1    jruoho                 NextOp = AcpiPsGetDepthNext (NULL, Op);
    843       1.5  christos                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
    844       1.1    jruoho 
    845       1.1    jruoho                 NextOp = NextOp->Common.Next;
    846       1.5  christos                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
    847       1.1    jruoho 
    848       1.1    jruoho                 NextOp = NextOp->Common.Next;
    849       1.5  christos                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
    850       1.1    jruoho                 return (AE_OK);
    851       1.1    jruoho 
    852       1.1    jruoho             case AML_MUTEX_OP:
    853       1.1    jruoho             case AML_DATA_REGION_OP:
    854       1.1    jruoho 
    855       1.1    jruoho                 AcpiOsPrintf (", ");
    856       1.1    jruoho                 return (AE_OK);
    857       1.1    jruoho 
    858       1.1    jruoho             case AML_EVENT_OP:
    859       1.1    jruoho             case AML_ALIAS_OP:
    860       1.1    jruoho 
    861       1.1    jruoho                 return (AE_OK);
    862       1.1    jruoho 
    863       1.1    jruoho             case AML_SCOPE_OP:
    864       1.1    jruoho             case AML_DEVICE_OP:
    865       1.1    jruoho             case AML_THERMAL_ZONE_OP:
    866       1.1    jruoho 
    867       1.8  christos                 ASL_CV_CLOSE_PAREN (Op, Level);
    868       1.1    jruoho                 break;
    869       1.1    jruoho 
    870       1.1    jruoho             default:
    871       1.1    jruoho 
    872       1.2  christos                 AcpiOsPrintf ("*** Unhandled named opcode %X\n",
    873       1.2  christos                     Op->Common.AmlOpcode);
    874       1.1    jruoho                 break;
    875       1.1    jruoho             }
    876       1.1    jruoho         }
    877       1.1    jruoho 
    878       1.1    jruoho         else switch (Op->Common.AmlOpcode)
    879       1.1    jruoho         {
    880       1.1    jruoho         case AML_FIELD_OP:
    881       1.1    jruoho         case AML_BANK_FIELD_OP:
    882       1.1    jruoho         case AML_INDEX_FIELD_OP:
    883       1.1    jruoho 
    884       1.1    jruoho             Info->BitOffset = 0;
    885       1.1    jruoho 
    886       1.1    jruoho             /* Name of the parent OperationRegion */
    887       1.1    jruoho 
    888       1.1    jruoho             NextOp = AcpiPsGetDepthNext (NULL, Op);
    889       1.1    jruoho             AcpiDmNamestring (NextOp->Common.Value.Name);
    890       1.1    jruoho             AcpiOsPrintf (", ");
    891       1.1    jruoho             NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
    892       1.1    jruoho 
    893       1.1    jruoho             switch (Op->Common.AmlOpcode)
    894       1.1    jruoho             {
    895       1.1    jruoho             case AML_BANK_FIELD_OP:
    896       1.1    jruoho 
    897       1.1    jruoho                 /* Namestring - Bank Name */
    898       1.1    jruoho 
    899       1.1    jruoho                 NextOp = AcpiPsGetDepthNext (NULL, NextOp);
    900       1.1    jruoho                 AcpiDmNamestring (NextOp->Common.Value.Name);
    901       1.1    jruoho                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
    902       1.1    jruoho                 AcpiOsPrintf (", ");
    903       1.1    jruoho 
    904       1.1    jruoho                 /*
    905       1.1    jruoho                  * Bank Value. This is a TermArg in the middle of the parameter
    906       1.1    jruoho                  * list, must handle it here.
    907       1.1    jruoho                  *
    908       1.5  christos                  * Disassemble the TermArg parse tree. ACPI_PARSEOP_PARAMETER_LIST
    909       1.1    jruoho                  * eliminates newline in the output.
    910       1.1    jruoho                  */
    911       1.1    jruoho                 NextOp = NextOp->Common.Next;
    912       1.1    jruoho 
    913       1.5  christos                 Info->Flags = ACPI_PARSEOP_PARAMETER_LIST;
    914       1.2  christos                 AcpiDmWalkParseTree (NextOp, AcpiDmDescendingOp,
    915       1.2  christos                     AcpiDmAscendingOp, Info);
    916       1.1    jruoho                 Info->Flags = 0;
    917       1.1    jruoho                 Info->Level = Level;
    918       1.1    jruoho 
    919       1.1    jruoho                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
    920       1.1    jruoho                 AcpiOsPrintf (", ");
    921       1.1    jruoho                 break;
    922       1.1    jruoho 
    923       1.1    jruoho             case AML_INDEX_FIELD_OP:
    924       1.1    jruoho 
    925       1.1    jruoho                 /* Namestring - Data Name */
    926       1.1    jruoho 
    927       1.1    jruoho                 NextOp = AcpiPsGetDepthNext (NULL, NextOp);
    928       1.1    jruoho                 AcpiDmNamestring (NextOp->Common.Value.Name);
    929       1.1    jruoho                 AcpiOsPrintf (", ");
    930       1.1    jruoho                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
    931       1.1    jruoho                 break;
    932       1.1    jruoho 
    933       1.1    jruoho             default:
    934       1.1    jruoho 
    935       1.1    jruoho                 break;
    936       1.1    jruoho             }
    937       1.1    jruoho 
    938       1.1    jruoho             AcpiDmFieldFlags (NextOp);
    939       1.1    jruoho             break;
    940       1.1    jruoho 
    941       1.1    jruoho         case AML_BUFFER_OP:
    942       1.1    jruoho 
    943       1.1    jruoho             /* The next op is the size parameter */
    944       1.1    jruoho 
    945       1.1    jruoho             NextOp = AcpiPsGetDepthNext (NULL, Op);
    946       1.1    jruoho             if (!NextOp)
    947       1.1    jruoho             {
    948       1.1    jruoho                 /* Single-step support */
    949       1.1    jruoho 
    950       1.1    jruoho                 return (AE_OK);
    951       1.1    jruoho             }
    952       1.1    jruoho 
    953       1.1    jruoho             if (Op->Common.DisasmOpcode == ACPI_DASM_RESOURCE)
    954       1.1    jruoho             {
    955       1.1    jruoho                 /*
    956       1.2  christos                  * We have a resource list. Don't need to output
    957       1.2  christos                  * the buffer size Op. Open up a new block
    958       1.1    jruoho                  */
    959       1.1    jruoho                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
    960       1.8  christos                 ASL_CV_CLOSE_PAREN (Op, Level);
    961       1.2  christos 
    962      1.15  christos                 if (Op->Asl.Parent->Common.AmlOpcode == AML_NAME_OP)
    963      1.15  christos                 {
    964      1.15  christos                     /*
    965      1.15  christos                      * Emit description comment showing the full ACPI name
    966      1.15  christos                      * of the ResourceTemplate only if it was defined using a
    967      1.15  christos                      * Name statement.
    968      1.15  christos                      */
    969      1.15  christos                      AcpiDmPredefinedDescription (Op->Asl.Parent);
    970      1.15  christos                 }
    971       1.2  christos 
    972       1.2  christos                 AcpiDmPredefinedDescription (Op->Asl.Parent);
    973       1.2  christos 
    974       1.2  christos                 AcpiOsPrintf ("\n");
    975       1.1    jruoho                 AcpiDmIndent (Info->Level);
    976       1.1    jruoho                 AcpiOsPrintf ("{\n");
    977       1.1    jruoho                 return (AE_OK);
    978       1.1    jruoho             }
    979       1.1    jruoho 
    980       1.1    jruoho             /* Normal Buffer, mark size as in the parameter list */
    981       1.1    jruoho 
    982       1.5  christos             NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
    983       1.1    jruoho             return (AE_OK);
    984       1.1    jruoho 
    985       1.5  christos         case AML_IF_OP:
    986       1.8  christos         case AML_VARIABLE_PACKAGE_OP:
    987       1.1    jruoho         case AML_WHILE_OP:
    988       1.1    jruoho 
    989       1.1    jruoho             /* The next op is the size or predicate parameter */
    990       1.1    jruoho 
    991       1.1    jruoho             NextOp = AcpiPsGetDepthNext (NULL, Op);
    992       1.1    jruoho             if (NextOp)
    993       1.1    jruoho             {
    994       1.5  christos                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
    995       1.1    jruoho             }
    996       1.1    jruoho             return (AE_OK);
    997       1.1    jruoho 
    998       1.1    jruoho         case AML_PACKAGE_OP:
    999       1.1    jruoho 
   1000       1.2  christos             /* The next op is the size parameter */
   1001       1.1    jruoho 
   1002       1.1    jruoho             NextOp = AcpiPsGetDepthNext (NULL, Op);
   1003       1.1    jruoho             if (NextOp)
   1004       1.1    jruoho             {
   1005       1.5  christos                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
   1006       1.1    jruoho             }
   1007       1.1    jruoho             return (AE_OK);
   1008       1.1    jruoho 
   1009       1.1    jruoho         case AML_MATCH_OP:
   1010       1.1    jruoho 
   1011       1.1    jruoho             AcpiDmMatchOp (Op);
   1012       1.1    jruoho             break;
   1013       1.1    jruoho 
   1014       1.1    jruoho         default:
   1015       1.1    jruoho 
   1016       1.1    jruoho             break;
   1017       1.1    jruoho         }
   1018       1.1    jruoho 
   1019       1.1    jruoho         if (AcpiDmBlockType (Op) & BLOCK_BRACE)
   1020       1.1    jruoho         {
   1021       1.1    jruoho             AcpiOsPrintf ("\n");
   1022       1.1    jruoho             AcpiDmIndent (Level);
   1023       1.1    jruoho             AcpiOsPrintf ("{\n");
   1024       1.1    jruoho         }
   1025       1.1    jruoho     }
   1026       1.1    jruoho 
   1027       1.1    jruoho     return (AE_OK);
   1028       1.1    jruoho }
   1029       1.1    jruoho 
   1030       1.1    jruoho 
   1031       1.1    jruoho /*******************************************************************************
   1032       1.1    jruoho  *
   1033       1.1    jruoho  * FUNCTION:    AcpiDmAscendingOp
   1034       1.1    jruoho  *
   1035       1.1    jruoho  * PARAMETERS:  ASL_WALK_CALLBACK
   1036       1.1    jruoho  *
   1037       1.1    jruoho  * RETURN:      Status
   1038       1.1    jruoho  *
   1039       1.1    jruoho  * DESCRIPTION: Second visitation of a parse object, during ascent of parse
   1040       1.2  christos  *              tree. Close out any parameter lists and complete the opcode.
   1041       1.1    jruoho  *
   1042       1.1    jruoho  ******************************************************************************/
   1043       1.1    jruoho 
   1044       1.1    jruoho static ACPI_STATUS
   1045       1.1    jruoho AcpiDmAscendingOp (
   1046       1.1    jruoho     ACPI_PARSE_OBJECT       *Op,
   1047       1.1    jruoho     UINT32                  Level,
   1048       1.1    jruoho     void                    *Context)
   1049       1.1    jruoho {
   1050       1.1    jruoho     ACPI_OP_WALK_INFO       *Info = Context;
   1051       1.2  christos     ACPI_PARSE_OBJECT       *ParentOp;
   1052       1.1    jruoho 
   1053       1.1    jruoho 
   1054       1.8  christos     /* Point the Op's filename pointer to the proper file */
   1055       1.8  christos 
   1056      1.10  christos     if (AcpiGbl_CaptureComments)
   1057       1.8  christos     {
   1058       1.8  christos         ASL_CV_LABEL_FILENODE (Op);
   1059       1.8  christos 
   1060       1.8  christos         /* Switch the output of these files if necessary */
   1061       1.8  christos 
   1062       1.8  christos         if (ASL_CV_FILE_HAS_SWITCHED (Op))
   1063       1.8  christos         {
   1064       1.8  christos             ASL_CV_SWITCH_FILES (Level, Op);
   1065       1.8  christos         }
   1066       1.8  christos     }
   1067       1.8  christos 
   1068       1.7  christos     if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE ||
   1069       1.7  christos         Op->Common.DisasmOpcode == ACPI_DASM_IGNORE_SINGLE)
   1070       1.1    jruoho     {
   1071       1.1    jruoho         /* Ignore this op -- it was handled elsewhere */
   1072       1.1    jruoho 
   1073       1.1    jruoho         return (AE_OK);
   1074       1.1    jruoho     }
   1075       1.1    jruoho 
   1076       1.1    jruoho     if ((Level == 0) && (Op->Common.AmlOpcode == AML_SCOPE_OP))
   1077       1.1    jruoho     {
   1078       1.1    jruoho         /* Indicates the end of the current descriptor block (table) */
   1079       1.1    jruoho 
   1080       1.8  christos         ASL_CV_CLOSE_BRACE (Op, Level);
   1081       1.8  christos 
   1082       1.8  christos         /* Print any comments that are at the end of the file here */
   1083       1.8  christos 
   1084      1.10  christos         if (AcpiGbl_CaptureComments && AcpiGbl_LastListHead)
   1085       1.8  christos         {
   1086       1.8  christos             AcpiOsPrintf ("\n");
   1087       1.8  christos             ASL_CV_PRINT_ONE_COMMENT_LIST (AcpiGbl_LastListHead, 0);
   1088       1.8  christos         }
   1089       1.8  christos         AcpiOsPrintf ("\n\n");
   1090       1.8  christos 
   1091       1.1    jruoho         return (AE_OK);
   1092       1.1    jruoho     }
   1093       1.1    jruoho 
   1094       1.1    jruoho     switch (AcpiDmBlockType (Op))
   1095       1.1    jruoho     {
   1096       1.1    jruoho     case BLOCK_PAREN:
   1097       1.1    jruoho 
   1098       1.2  christos         /* Completed an op that has arguments, add closing paren if needed */
   1099       1.2  christos 
   1100       1.2  christos         AcpiDmCloseOperator (Op);
   1101       1.2  christos 
   1102       1.2  christos         if (Op->Common.AmlOpcode == AML_NAME_OP)
   1103       1.2  christos         {
   1104       1.2  christos             /* Emit description comment for Name() with a predefined ACPI name */
   1105       1.2  christos 
   1106       1.2  christos             AcpiDmPredefinedDescription (Op);
   1107       1.2  christos         }
   1108       1.2  christos         else
   1109       1.2  christos         {
   1110       1.2  christos             /* For Create* operators, attempt to emit resource tag description */
   1111       1.2  christos 
   1112       1.2  christos             AcpiDmFieldPredefinedDescription (Op);
   1113       1.2  christos         }
   1114       1.2  christos 
   1115       1.2  christos         /* Decode Notify() values */
   1116       1.2  christos 
   1117       1.2  christos         if (Op->Common.AmlOpcode == AML_NOTIFY_OP)
   1118       1.2  christos         {
   1119       1.2  christos             AcpiDmNotifyDescription (Op);
   1120       1.2  christos         }
   1121       1.1    jruoho 
   1122       1.2  christos         AcpiDmDisplayTargetPathname (Op);
   1123       1.1    jruoho 
   1124       1.1    jruoho         /* Could be a nested operator, check if comma required */
   1125       1.1    jruoho 
   1126       1.1    jruoho         if (!AcpiDmCommaIfListMember (Op))
   1127       1.1    jruoho         {
   1128       1.1    jruoho             if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
   1129       1.5  christos                  (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST)) &&
   1130       1.4  christos                  (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
   1131       1.1    jruoho             {
   1132       1.1    jruoho                 /*
   1133       1.1    jruoho                  * This is a first-level element of a term list
   1134       1.1    jruoho                  * start a new line
   1135       1.1    jruoho                  */
   1136       1.5  christos                 if (!(Info->Flags & ACPI_PARSEOP_PARAMETER_LIST))
   1137       1.1    jruoho                 {
   1138       1.1    jruoho                     AcpiOsPrintf ("\n");
   1139       1.1    jruoho                 }
   1140       1.1    jruoho             }
   1141       1.1    jruoho         }
   1142       1.1    jruoho         break;
   1143       1.1    jruoho 
   1144       1.1    jruoho     case BLOCK_BRACE:
   1145       1.1    jruoho     case (BLOCK_BRACE | BLOCK_PAREN):
   1146       1.1    jruoho 
   1147       1.1    jruoho         /* Completed an op that has a term list, add closing brace */
   1148       1.1    jruoho 
   1149       1.1    jruoho         if (Op->Common.DisasmFlags & ACPI_PARSEOP_EMPTY_TERMLIST)
   1150       1.1    jruoho         {
   1151       1.8  christos             ASL_CV_CLOSE_BRACE (Op, Level);
   1152       1.1    jruoho         }
   1153       1.1    jruoho         else
   1154       1.1    jruoho         {
   1155       1.1    jruoho             AcpiDmIndent (Level);
   1156       1.8  christos             ASL_CV_CLOSE_BRACE (Op, Level);
   1157       1.1    jruoho         }
   1158       1.1    jruoho 
   1159       1.1    jruoho         AcpiDmCommaIfListMember (Op);
   1160       1.1    jruoho 
   1161       1.1    jruoho         if (AcpiDmBlockType (Op->Common.Parent) != BLOCK_PAREN)
   1162       1.1    jruoho         {
   1163       1.1    jruoho             AcpiOsPrintf ("\n");
   1164       1.1    jruoho             if (!(Op->Common.DisasmFlags & ACPI_PARSEOP_EMPTY_TERMLIST))
   1165       1.1    jruoho             {
   1166       1.1    jruoho                 if ((Op->Common.AmlOpcode == AML_IF_OP)  &&
   1167       1.1    jruoho                     (Op->Common.Next) &&
   1168       1.1    jruoho                     (Op->Common.Next->Common.AmlOpcode == AML_ELSE_OP))
   1169       1.1    jruoho                 {
   1170       1.1    jruoho                     break;
   1171       1.1    jruoho                 }
   1172       1.1    jruoho 
   1173       1.1    jruoho                 if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
   1174       1.1    jruoho                     (!Op->Common.Next))
   1175       1.1    jruoho                 {
   1176       1.1    jruoho                     break;
   1177       1.1    jruoho                 }
   1178       1.1    jruoho                 AcpiOsPrintf ("\n");
   1179       1.1    jruoho             }
   1180       1.1    jruoho         }
   1181       1.1    jruoho         break;
   1182       1.1    jruoho 
   1183       1.1    jruoho     case BLOCK_NONE:
   1184       1.1    jruoho     default:
   1185       1.1    jruoho 
   1186       1.1    jruoho         /* Could be a nested operator, check if comma required */
   1187       1.1    jruoho 
   1188       1.1    jruoho         if (!AcpiDmCommaIfListMember (Op))
   1189       1.1    jruoho         {
   1190       1.1    jruoho             if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
   1191       1.5  christos                  (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST)) &&
   1192       1.4  christos                  (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
   1193       1.1    jruoho             {
   1194       1.1    jruoho                 /*
   1195       1.1    jruoho                  * This is a first-level element of a term list
   1196       1.1    jruoho                  * start a new line
   1197       1.1    jruoho                  */
   1198       1.1    jruoho                 AcpiOsPrintf ("\n");
   1199       1.1    jruoho             }
   1200       1.1    jruoho         }
   1201       1.1    jruoho         else if (Op->Common.Parent)
   1202       1.1    jruoho         {
   1203       1.1    jruoho             switch (Op->Common.Parent->Common.AmlOpcode)
   1204       1.1    jruoho             {
   1205       1.1    jruoho             case AML_PACKAGE_OP:
   1206       1.8  christos             case AML_VARIABLE_PACKAGE_OP:
   1207       1.1    jruoho 
   1208       1.5  christos                 if (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST))
   1209       1.1    jruoho                 {
   1210       1.1    jruoho                     AcpiOsPrintf ("\n");
   1211       1.1    jruoho                 }
   1212       1.1    jruoho                 break;
   1213       1.1    jruoho 
   1214       1.1    jruoho             default:
   1215       1.1    jruoho 
   1216       1.1    jruoho                 break;
   1217       1.1    jruoho             }
   1218       1.1    jruoho         }
   1219       1.1    jruoho         break;
   1220       1.1    jruoho     }
   1221       1.1    jruoho 
   1222       1.5  christos     if (Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST)
   1223       1.1    jruoho     {
   1224       1.1    jruoho         if ((Op->Common.Next) &&
   1225       1.5  christos             (Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST))
   1226       1.1    jruoho         {
   1227       1.1    jruoho             return (AE_OK);
   1228       1.1    jruoho         }
   1229       1.1    jruoho 
   1230       1.1    jruoho         /*
   1231       1.2  christos          * The parent Op is guaranteed to be valid because of the flag
   1232       1.5  christos          * ACPI_PARSEOP_PARAMETER_LIST -- which means that this op is part of
   1233       1.2  christos          * a parameter list and thus has a valid parent.
   1234       1.2  christos          */
   1235       1.2  christos         ParentOp = Op->Common.Parent;
   1236       1.2  christos 
   1237       1.2  christos         /*
   1238       1.1    jruoho          * Just completed a parameter node for something like "Buffer (param)".
   1239       1.7  christos          * Close the paren and open up the term list block with a brace.
   1240       1.7  christos          *
   1241       1.7  christos          * Switch predicates don't have a Next node but require a closing paren
   1242       1.7  christos          * and opening brace.
   1243       1.1    jruoho          */
   1244       1.7  christos         if (Op->Common.Next || Op->Common.DisasmOpcode == ACPI_DASM_SWITCH_PREDICATE)
   1245       1.1    jruoho         {
   1246       1.8  christos             ASL_CV_CLOSE_PAREN (Op, Level);
   1247       1.2  christos 
   1248       1.2  christos             /*
   1249       1.2  christos              * Emit a description comment for a Name() operator that is a
   1250       1.2  christos              * predefined ACPI name. Must check the grandparent.
   1251       1.2  christos              */
   1252       1.2  christos             ParentOp = ParentOp->Common.Parent;
   1253       1.2  christos             if (ParentOp &&
   1254       1.2  christos                 (ParentOp->Asl.AmlOpcode == AML_NAME_OP))
   1255       1.2  christos             {
   1256       1.2  christos                 AcpiDmPredefinedDescription (ParentOp);
   1257       1.2  christos             }
   1258       1.2  christos 
   1259       1.7  christos             /* Correct the indentation level for Switch and Case predicates */
   1260       1.7  christos 
   1261       1.7  christos             if (Op->Common.DisasmOpcode == ACPI_DASM_SWITCH_PREDICATE)
   1262       1.7  christos             {
   1263       1.7  christos                 --Level;
   1264       1.7  christos             }
   1265       1.7  christos 
   1266       1.2  christos             AcpiOsPrintf ("\n");
   1267       1.1    jruoho             AcpiDmIndent (Level - 1);
   1268       1.1    jruoho             AcpiOsPrintf ("{\n");
   1269       1.1    jruoho         }
   1270       1.1    jruoho         else
   1271       1.1    jruoho         {
   1272       1.2  christos             ParentOp->Common.DisasmFlags |= ACPI_PARSEOP_EMPTY_TERMLIST;
   1273       1.8  christos             ASL_CV_CLOSE_PAREN (Op, Level);
   1274       1.8  christos             AcpiOsPrintf ("{");
   1275       1.1    jruoho         }
   1276       1.1    jruoho     }
   1277       1.1    jruoho 
   1278       1.1    jruoho     if ((Op->Common.AmlOpcode == AML_NAME_OP) ||
   1279       1.1    jruoho         (Op->Common.AmlOpcode == AML_RETURN_OP))
   1280       1.1    jruoho     {
   1281       1.1    jruoho         Info->Level++;
   1282       1.1    jruoho     }
   1283       1.2  christos 
   1284       1.2  christos     /*
   1285       1.2  christos      * For ASL+, check for and emit a C-style symbol. If valid, the
   1286       1.2  christos      * symbol string has been deferred until after the first operand
   1287       1.2  christos      */
   1288       1.2  christos     if (AcpiGbl_CstyleDisassembly)
   1289       1.2  christos     {
   1290       1.2  christos         if (Op->Asl.OperatorSymbol)
   1291       1.2  christos         {
   1292       1.2  christos             AcpiOsPrintf ("%s", Op->Asl.OperatorSymbol);
   1293       1.2  christos             Op->Asl.OperatorSymbol = NULL;
   1294       1.2  christos         }
   1295       1.2  christos     }
   1296       1.2  christos 
   1297       1.1    jruoho     return (AE_OK);
   1298       1.1    jruoho }
   1299