Home | History | Annotate | Line # | Download | only in disassembler
dmwalk.c revision 1.1.1.21
      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.1.1.21  christos /******************************************************************************
      8  1.1.1.21  christos  *
      9  1.1.1.21  christos  * 1. Copyright Notice
     10  1.1.1.21  christos  *
     11  1.1.1.21  christos  * Some or all of this work - Copyright (c) 1999 - 2024, Intel Corp.
     12       1.1    jruoho  * All rights reserved.
     13       1.1    jruoho  *
     14  1.1.1.21  christos  * 2. License
     15  1.1.1.21  christos  *
     16  1.1.1.21  christos  * 2.1. This is your license from Intel Corp. under its intellectual property
     17  1.1.1.21  christos  * rights. You may have additional license terms from the party that provided
     18  1.1.1.21  christos  * you this software, covering your right to use that party's intellectual
     19  1.1.1.21  christos  * property rights.
     20  1.1.1.21  christos  *
     21  1.1.1.21  christos  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
     22  1.1.1.21  christos  * copy of the source code appearing in this file ("Covered Code") an
     23  1.1.1.21  christos  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
     24  1.1.1.21  christos  * base code distributed originally by Intel ("Original Intel Code") to copy,
     25  1.1.1.21  christos  * make derivatives, distribute, use and display any portion of the Covered
     26  1.1.1.21  christos  * Code in any form, with the right to sublicense such rights; and
     27  1.1.1.21  christos  *
     28  1.1.1.21  christos  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
     29  1.1.1.21  christos  * license (with the right to sublicense), under only those claims of Intel
     30  1.1.1.21  christos  * patents that are infringed by the Original Intel Code, to make, use, sell,
     31  1.1.1.21  christos  * offer to sell, and import the Covered Code and derivative works thereof
     32  1.1.1.21  christos  * solely to the minimum extent necessary to exercise the above copyright
     33  1.1.1.21  christos  * license, and in no event shall the patent license extend to any additions
     34  1.1.1.21  christos  * to or modifications of the Original Intel Code. No other license or right
     35  1.1.1.21  christos  * is granted directly or by implication, estoppel or otherwise;
     36  1.1.1.21  christos  *
     37  1.1.1.21  christos  * The above copyright and patent license is granted only if the following
     38  1.1.1.21  christos  * conditions are met:
     39  1.1.1.21  christos  *
     40  1.1.1.21  christos  * 3. Conditions
     41  1.1.1.21  christos  *
     42  1.1.1.21  christos  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
     43  1.1.1.21  christos  * Redistribution of source code of any substantial portion of the Covered
     44  1.1.1.21  christos  * Code or modification with rights to further distribute source must include
     45  1.1.1.21  christos  * the above Copyright Notice, the above License, this list of Conditions,
     46  1.1.1.21  christos  * and the following Disclaimer and Export Compliance provision. In addition,
     47  1.1.1.21  christos  * Licensee must cause all Covered Code to which Licensee contributes to
     48  1.1.1.21  christos  * contain a file documenting the changes Licensee made to create that Covered
     49  1.1.1.21  christos  * Code and the date of any change. Licensee must include in that file the
     50  1.1.1.21  christos  * documentation of any changes made by any predecessor Licensee. Licensee
     51  1.1.1.21  christos  * must include a prominent statement that the modification is derived,
     52  1.1.1.21  christos  * directly or indirectly, from Original Intel Code.
     53  1.1.1.21  christos  *
     54  1.1.1.21  christos  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
     55  1.1.1.21  christos  * Redistribution of source code of any substantial portion of the Covered
     56  1.1.1.21  christos  * Code or modification without rights to further distribute source must
     57  1.1.1.21  christos  * include the following Disclaimer and Export Compliance provision in the
     58  1.1.1.21  christos  * documentation and/or other materials provided with distribution. In
     59  1.1.1.21  christos  * addition, Licensee may not authorize further sublicense of source of any
     60  1.1.1.21  christos  * portion of the Covered Code, and must include terms to the effect that the
     61  1.1.1.21  christos  * license from Licensee to its licensee is limited to the intellectual
     62  1.1.1.21  christos  * property embodied in the software Licensee provides to its licensee, and
     63  1.1.1.21  christos  * not to intellectual property embodied in modifications its licensee may
     64  1.1.1.21  christos  * make.
     65  1.1.1.21  christos  *
     66  1.1.1.21  christos  * 3.3. Redistribution of Executable. Redistribution in executable form of any
     67  1.1.1.21  christos  * substantial portion of the Covered Code or modification must reproduce the
     68  1.1.1.21  christos  * above Copyright Notice, and the following Disclaimer and Export Compliance
     69  1.1.1.21  christos  * provision in the documentation and/or other materials provided with the
     70  1.1.1.21  christos  * distribution.
     71  1.1.1.21  christos  *
     72  1.1.1.21  christos  * 3.4. Intel retains all right, title, and interest in and to the Original
     73  1.1.1.21  christos  * Intel Code.
     74  1.1.1.21  christos  *
     75  1.1.1.21  christos  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
     76  1.1.1.21  christos  * Intel shall be used in advertising or otherwise to promote the sale, use or
     77  1.1.1.21  christos  * other dealings in products derived from or relating to the Covered Code
     78  1.1.1.21  christos  * without prior written authorization from Intel.
     79  1.1.1.21  christos  *
     80  1.1.1.21  christos  * 4. Disclaimer and Export Compliance
     81  1.1.1.21  christos  *
     82  1.1.1.21  christos  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
     83  1.1.1.21  christos  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
     84  1.1.1.21  christos  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
     85  1.1.1.21  christos  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
     86  1.1.1.21  christos  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
     87  1.1.1.21  christos  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
     88  1.1.1.21  christos  * PARTICULAR PURPOSE.
     89  1.1.1.21  christos  *
     90  1.1.1.21  christos  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
     91  1.1.1.21  christos  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
     92  1.1.1.21  christos  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
     93  1.1.1.21  christos  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
     94  1.1.1.21  christos  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
     95  1.1.1.21  christos  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
     96  1.1.1.21  christos  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
     97  1.1.1.21  christos  * LIMITED REMEDY.
     98  1.1.1.21  christos  *
     99  1.1.1.21  christos  * 4.3. Licensee shall not export, either directly or indirectly, any of this
    100  1.1.1.21  christos  * software or system incorporating such software without first obtaining any
    101  1.1.1.21  christos  * required license or other approval from the U. S. Department of Commerce or
    102  1.1.1.21  christos  * any other agency or department of the United States Government. In the
    103  1.1.1.21  christos  * event Licensee exports any such software from the United States or
    104  1.1.1.21  christos  * re-exports any such software from a foreign destination, Licensee shall
    105  1.1.1.21  christos  * ensure that the distribution and export/re-export of the software is in
    106  1.1.1.21  christos  * compliance with all laws, regulations, orders, or other restrictions of the
    107  1.1.1.21  christos  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
    108  1.1.1.21  christos  * any of its subsidiaries will export/re-export any technical data, process,
    109  1.1.1.21  christos  * software, or service, directly or indirectly, to any country for which the
    110  1.1.1.21  christos  * United States government or any agency thereof requires an export license,
    111  1.1.1.21  christos  * other governmental approval, or letter of assurance, without first obtaining
    112  1.1.1.21  christos  * such license, approval or letter.
    113  1.1.1.21  christos  *
    114  1.1.1.21  christos  *****************************************************************************
    115  1.1.1.21  christos  *
    116  1.1.1.21  christos  * Alternatively, you may choose to be licensed under the terms of the
    117  1.1.1.21  christos  * following license:
    118  1.1.1.21  christos  *
    119   1.1.1.2    jruoho  * Redistribution and use in source and binary forms, with or without
    120   1.1.1.2    jruoho  * modification, are permitted provided that the following conditions
    121   1.1.1.2    jruoho  * are met:
    122   1.1.1.2    jruoho  * 1. Redistributions of source code must retain the above copyright
    123   1.1.1.2    jruoho  *    notice, this list of conditions, and the following disclaimer,
    124   1.1.1.2    jruoho  *    without modification.
    125   1.1.1.2    jruoho  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
    126   1.1.1.2    jruoho  *    substantially similar to the "NO WARRANTY" disclaimer below
    127   1.1.1.2    jruoho  *    ("Disclaimer") and any redistribution must be conditioned upon
    128   1.1.1.2    jruoho  *    including a substantially similar Disclaimer requirement for further
    129   1.1.1.2    jruoho  *    binary redistribution.
    130   1.1.1.2    jruoho  * 3. Neither the names of the above-listed copyright holders nor the names
    131   1.1.1.2    jruoho  *    of any contributors may be used to endorse or promote products derived
    132   1.1.1.2    jruoho  *    from this software without specific prior written permission.
    133   1.1.1.2    jruoho  *
    134   1.1.1.2    jruoho  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    135   1.1.1.2    jruoho  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    136  1.1.1.17  christos  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    137   1.1.1.2    jruoho  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    138  1.1.1.21  christos  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    139  1.1.1.21  christos  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    140  1.1.1.21  christos  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    141  1.1.1.21  christos  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    142  1.1.1.21  christos  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    143  1.1.1.21  christos  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    144  1.1.1.21  christos  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    145  1.1.1.21  christos  *
    146  1.1.1.21  christos  * Alternatively, you may choose to be licensed under the terms of the
    147  1.1.1.21  christos  * GNU General Public License ("GPL") version 2 as published by the Free
    148  1.1.1.21  christos  * Software Foundation.
    149  1.1.1.21  christos  *
    150  1.1.1.21  christos  *****************************************************************************/
    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.1.1.11  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.1.1.11  christos 
    174  1.1.1.11  christos void
    175  1.1.1.11  christos AcpiDmEmitExternal (
    176  1.1.1.11  christos     ACPI_PARSE_OBJECT       *NameOp,
    177  1.1.1.11  christos     ACPI_PARSE_OBJECT       *TypeOp)
    178  1.1.1.11  christos {
    179  1.1.1.11  christos     return;
    180  1.1.1.11  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.1.1.3  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.1.1.7  christos     memset (&Info, 0, sizeof (ACPI_OP_WALK_INFO));
    229       1.1    jruoho     Info.WalkState = WalkState;
    230   1.1.1.7  christos     Info.StartAml = Op->Common.Aml - sizeof (ACPI_TABLE_HEADER);
    231   1.1.1.7  christos     Info.AmlOffset = Op->Common.Aml - Info.StartAml;
    232   1.1.1.7  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.1.1.11  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.1.1.11  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.1.1.4  christos         if ((Op->Common.DisasmOpcode == ACPI_DASM_UNICODE) ||
    397   1.1.1.5  christos             (Op->Common.DisasmOpcode == ACPI_DASM_UUID) ||
    398   1.1.1.5  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.1.1.17  christos         ACPI_FALLTHROUGH;
    404       1.1    jruoho 
    405       1.1    jruoho     case AML_PACKAGE_OP:
    406  1.1.1.11  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.1.1.5  christos     case AML_INT_METHODCALL_OP:
    415   1.1.1.5  christos 
    416   1.1.1.5  christos         if (Op->Common.Parent &&
    417   1.1.1.5  christos             ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
    418  1.1.1.11  christos              (Op->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP)))
    419   1.1.1.5  christos         {
    420   1.1.1.5  christos             /* This is a reference to a method, not an invocation */
    421   1.1.1.5  christos 
    422   1.1.1.5  christos             return (BLOCK_NONE);
    423   1.1.1.5  christos         }
    424   1.1.1.5  christos 
    425  1.1.1.17  christos         ACPI_FALLTHROUGH;
    426   1.1.1.6  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.1.1.11  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.1.1.11  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.1.1.8  christos     ACPI_PARSE_OBJECT       *NextOp2;
    525   1.1.1.6  christos     UINT32                  AmlOffset;
    526   1.1.1.6  christos 
    527       1.1    jruoho 
    528  1.1.1.11  christos     /* Determine which file this parse node is contained in. */
    529  1.1.1.11  christos 
    530  1.1.1.13  christos     if (AcpiGbl_CaptureComments)
    531  1.1.1.11  christos     {
    532  1.1.1.11  christos         ASL_CV_LABEL_FILENODE (Op);
    533  1.1.1.11  christos 
    534  1.1.1.11  christos         if (Level != 0 && ASL_CV_FILE_HAS_SWITCHED (Op))
    535  1.1.1.11  christos         {
    536  1.1.1.11  christos             ASL_CV_SWITCH_FILES (Level, Op);
    537  1.1.1.11  christos         }
    538  1.1.1.11  christos 
    539  1.1.1.11  christos         /* If this parse node has regular comments, print them here. */
    540  1.1.1.11  christos 
    541  1.1.1.11  christos         ASL_CV_PRINT_ONE_COMMENT (Op, AML_COMMENT_STANDARD, NULL, Level);
    542  1.1.1.11  christos     }
    543  1.1.1.11  christos 
    544   1.1.1.7  christos     OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
    545   1.1.1.7  christos 
    546   1.1.1.7  christos     /* Listing support to dump the AML code after the ASL statement */
    547   1.1.1.7  christos 
    548   1.1.1.7  christos     if (AcpiGbl_DmOpt_Listing)
    549   1.1.1.6  christos     {
    550   1.1.1.7  christos         /* We only care about these classes of objects */
    551   1.1.1.6  christos 
    552   1.1.1.7  christos         if ((OpInfo->Class == AML_CLASS_NAMED_OBJECT) ||
    553   1.1.1.7  christos             (OpInfo->Class == AML_CLASS_CONTROL) ||
    554   1.1.1.7  christos             (OpInfo->Class == AML_CLASS_CREATE) ||
    555   1.1.1.7  christos             ((OpInfo->Class == AML_CLASS_EXECUTE) && (!Op->Common.Next)))
    556   1.1.1.6  christos         {
    557   1.1.1.7  christos             if (AcpiGbl_DmOpt_Listing && Info->PreviousAml)
    558   1.1.1.7  christos             {
    559   1.1.1.7  christos                 /* Dump the AML byte code for the previous Op */
    560   1.1.1.7  christos 
    561   1.1.1.7  christos                 if (Op->Common.Aml > Info->PreviousAml)
    562   1.1.1.7  christos                 {
    563   1.1.1.7  christos                     AcpiOsPrintf ("\n");
    564   1.1.1.7  christos                     AcpiUtDumpBuffer (
    565   1.1.1.7  christos                         (Info->StartAml + Info->AmlOffset),
    566   1.1.1.7  christos                         (Op->Common.Aml - Info->PreviousAml),
    567   1.1.1.8  christos                         DB_BYTE_DISPLAY, Info->AmlOffset);
    568   1.1.1.7  christos                     AcpiOsPrintf ("\n");
    569   1.1.1.7  christos                 }
    570   1.1.1.7  christos 
    571   1.1.1.7  christos                 Info->AmlOffset = (Op->Common.Aml - Info->StartAml);
    572   1.1.1.7  christos             }
    573   1.1.1.7  christos 
    574   1.1.1.7  christos             Info->PreviousAml = Op->Common.Aml;
    575   1.1.1.6  christos         }
    576   1.1.1.6  christos     }
    577       1.1    jruoho 
    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.1.1.10  christos     if (Op->Common.DisasmOpcode == ACPI_DASM_IGNORE_SINGLE)
    586  1.1.1.10  christos     {
    587  1.1.1.10  christos         /* Ignore this op, but not it's children */
    588  1.1.1.10  christos 
    589  1.1.1.10  christos         return (AE_OK);
    590  1.1.1.10  christos     }
    591  1.1.1.10  christos 
    592   1.1.1.8  christos     if (Op->Common.AmlOpcode == AML_IF_OP)
    593   1.1.1.8  christos     {
    594   1.1.1.8  christos         NextOp = AcpiPsGetDepthNext (NULL, Op);
    595   1.1.1.8  christos         if (NextOp)
    596   1.1.1.8  christos         {
    597   1.1.1.8  christos             NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
    598   1.1.1.8  christos 
    599   1.1.1.9  christos             /* Don't emit the actual embedded externals unless asked */
    600   1.1.1.8  christos 
    601   1.1.1.9  christos             if (!AcpiGbl_DmEmitExternalOpcodes)
    602   1.1.1.9  christos             {
    603   1.1.1.9  christos                 /*
    604   1.1.1.9  christos                  * A Zero predicate indicates the possibility of one or more
    605   1.1.1.9  christos                  * External() opcodes within the If() block.
    606   1.1.1.9  christos                  */
    607   1.1.1.9  christos                 if (NextOp->Common.AmlOpcode == AML_ZERO_OP)
    608   1.1.1.8  christos                 {
    609   1.1.1.9  christos                     NextOp2 = NextOp->Common.Next;
    610   1.1.1.9  christos 
    611   1.1.1.9  christos                     if (NextOp2 &&
    612   1.1.1.9  christos                         (NextOp2->Common.AmlOpcode == AML_EXTERNAL_OP))
    613   1.1.1.9  christos                     {
    614   1.1.1.9  christos                         /* Ignore the If 0 block and all children */
    615   1.1.1.8  christos 
    616   1.1.1.9  christos                         Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
    617   1.1.1.9  christos                         return (AE_CTRL_DEPTH);
    618   1.1.1.9  christos                     }
    619   1.1.1.8  christos                 }
    620   1.1.1.8  christos             }
    621   1.1.1.8  christos         }
    622   1.1.1.8  christos     }
    623   1.1.1.8  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.1.1.6  christos             AmlOffset = (UINT32) ACPI_PTR_DIFF (Op->Common.Aml,
    633   1.1.1.7  christos                 Info->WalkState->ParserState.AmlStart);
    634   1.1.1.7  christos             if (AcpiGbl_DmOpt_Verbose)
    635   1.1.1.7  christos             {
    636  1.1.1.12  christos                 if (AcpiGbl_CmSingleStep)
    637  1.1.1.12  christos                 {
    638  1.1.1.12  christos                     AcpiOsPrintf ("%5.5X/%4.4X: ",
    639  1.1.1.12  christos                         AmlOffset, (UINT32) Op->Common.AmlOpcode);
    640  1.1.1.12  christos                 }
    641  1.1.1.12  christos                 else
    642  1.1.1.12  christos                 {
    643  1.1.1.12  christos                     AcpiOsPrintf ("AML Offset %5.5X, Opcode %4.4X: ",
    644  1.1.1.12  christos                         AmlOffset, (UINT32) Op->Common.AmlOpcode);
    645  1.1.1.12  christos                 }
    646   1.1.1.7  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.1.1.11  christos             if (!AcpiGbl_DmEmitExternalOpcodes)
    658  1.1.1.11  christos             {
    659  1.1.1.11  christos                 AcpiDmEmitExternals ();
    660  1.1.1.11  christos             }
    661  1.1.1.11  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.1.1.8  christos          (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST)) &&
    667   1.1.1.7  christos          (!(Op->Common.DisasmFlags & ACPI_PARSEOP_ELSEIF)) &&
    668   1.1.1.7  christos          (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
    669       1.1    jruoho     {
    670   1.1.1.7  christos         /*
    671   1.1.1.7  christos          * This is a first-level element of a term list,
    672   1.1.1.7  christos          * indent a new line
    673   1.1.1.7  christos          */
    674   1.1.1.7  christos         switch (Op->Common.AmlOpcode)
    675   1.1.1.7  christos         {
    676   1.1.1.7  christos         case AML_NOOP_OP:
    677       1.1    jruoho             /*
    678   1.1.1.7  christos              * Optionally just ignore this opcode. Some tables use
    679   1.1.1.7  christos              * NoOp opcodes for "padding" out packages that the BIOS
    680   1.1.1.7  christos              * changes dynamically. This can leave hundreds or
    681   1.1.1.7  christos              * thousands of NoOp opcodes that if disassembled,
    682   1.1.1.7  christos              * cannot be compiled because they are syntactically
    683   1.1.1.7  christos              * incorrect.
    684       1.1    jruoho              */
    685   1.1.1.7  christos             if (AcpiGbl_IgnoreNoopOperator)
    686   1.1.1.3  christos             {
    687   1.1.1.7  christos                 Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
    688   1.1.1.7  christos                 return (AE_OK);
    689   1.1.1.7  christos             }
    690   1.1.1.3  christos 
    691  1.1.1.17  christos             ACPI_FALLTHROUGH;
    692   1.1.1.3  christos 
    693   1.1.1.7  christos         default:
    694   1.1.1.3  christos 
    695   1.1.1.7  christos             AcpiDmIndent (Level);
    696   1.1.1.7  christos             break;
    697   1.1.1.7  christos         }
    698   1.1.1.3  christos 
    699   1.1.1.7  christos         Info->LastLevel = Level;
    700   1.1.1.7  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.1.1.5  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.1.1.5  christos     /* If ASL+ is enabled, check for a C-style operator */
    718   1.1.1.5  christos 
    719   1.1.1.5  christos     if (AcpiDmCheckForSymbolicOpcode (Op, Info))
    720   1.1.1.5  christos     {
    721   1.1.1.5  christos         return (AE_OK);
    722   1.1.1.5  christos     }
    723   1.1.1.5  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.1.1.3  christos     if ((Op->Common.DisasmOpcode == ACPI_DASM_LNOT_PREFIX) ||
    729   1.1.1.3  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.1.1.11  christos     if (Op->Common.AmlOpcode == AML_EXTERNAL_OP)
    741  1.1.1.11  christos     {
    742  1.1.1.11  christos         Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
    743  1.1.1.11  christos         return (AE_CTRL_DEPTH);
    744  1.1.1.11  christos     }
    745  1.1.1.11  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.1.1.11  christos             if (!(AcpiDmBlockType (Op) & BLOCK_BRACE))
    757  1.1.1.11  christos             {
    758  1.1.1.11  christos                 ASL_CV_PRINT_ONE_COMMENT (Op, AMLCOMMENT_INLINE, " ", 0);
    759  1.1.1.11  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.1.1.17  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.1.1.12  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.1.1.7  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.1.1.11  christos                 ASL_CV_CLOSE_PAREN (Op, Level);
    805   1.1.1.3  christos 
    806   1.1.1.3  christos                 /* Emit description comment for Method() with a predefined ACPI name */
    807   1.1.1.3  christos 
    808   1.1.1.3  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.1.1.4  christos                 AcpiDmCheckForHardwareId (Op);
    816       1.1    jruoho                 AcpiOsPrintf (", ");
    817  1.1.1.11  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.1.1.11  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.1.1.8  christos                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
    832       1.1    jruoho 
    833       1.1    jruoho                 NextOp = NextOp->Common.Next;
    834   1.1.1.8  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.1.1.8  christos                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
    844       1.1    jruoho 
    845       1.1    jruoho                 NextOp = NextOp->Common.Next;
    846   1.1.1.8  christos                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
    847       1.1    jruoho 
    848       1.1    jruoho                 NextOp = NextOp->Common.Next;
    849   1.1.1.8  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.1.1.11  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.1.1.3  christos                 AcpiOsPrintf ("*** Unhandled named opcode %X\n",
    873   1.1.1.3  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.1.1.8  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.1.1.8  christos                 Info->Flags = ACPI_PARSEOP_PARAMETER_LIST;
    914   1.1.1.3  christos                 AcpiDmWalkParseTree (NextOp, AcpiDmDescendingOp,
    915   1.1.1.3  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.1.1.3  christos                  * We have a resource list. Don't need to output
    957   1.1.1.3  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.1.1.11  christos                 ASL_CV_CLOSE_PAREN (Op, Level);
    961   1.1.1.3  christos 
    962  1.1.1.18  christos                 if (Op->Asl.Parent->Common.AmlOpcode == AML_NAME_OP)
    963  1.1.1.18  christos                 {
    964  1.1.1.18  christos                     /*
    965  1.1.1.18  christos                      * Emit description comment showing the full ACPI name
    966  1.1.1.18  christos                      * of the ResourceTemplate only if it was defined using a
    967  1.1.1.18  christos                      * Name statement.
    968  1.1.1.18  christos                      */
    969  1.1.1.18  christos                      AcpiDmPredefinedDescription (Op->Asl.Parent);
    970  1.1.1.18  christos                 }
    971   1.1.1.3  christos 
    972   1.1.1.3  christos                 AcpiOsPrintf ("\n");
    973       1.1    jruoho                 AcpiDmIndent (Info->Level);
    974       1.1    jruoho                 AcpiOsPrintf ("{\n");
    975       1.1    jruoho                 return (AE_OK);
    976       1.1    jruoho             }
    977       1.1    jruoho 
    978       1.1    jruoho             /* Normal Buffer, mark size as in the parameter list */
    979       1.1    jruoho 
    980   1.1.1.8  christos             NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
    981       1.1    jruoho             return (AE_OK);
    982       1.1    jruoho 
    983       1.1    jruoho         case AML_IF_OP:
    984  1.1.1.11  christos         case AML_VARIABLE_PACKAGE_OP:
    985       1.1    jruoho         case AML_WHILE_OP:
    986       1.1    jruoho 
    987       1.1    jruoho             /* The next op is the size or predicate parameter */
    988       1.1    jruoho 
    989       1.1    jruoho             NextOp = AcpiPsGetDepthNext (NULL, Op);
    990       1.1    jruoho             if (NextOp)
    991       1.1    jruoho             {
    992   1.1.1.8  christos                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
    993       1.1    jruoho             }
    994       1.1    jruoho             return (AE_OK);
    995       1.1    jruoho 
    996       1.1    jruoho         case AML_PACKAGE_OP:
    997       1.1    jruoho 
    998   1.1.1.3  christos             /* The next op is the size parameter */
    999       1.1    jruoho 
   1000       1.1    jruoho             NextOp = AcpiPsGetDepthNext (NULL, Op);
   1001       1.1    jruoho             if (NextOp)
   1002       1.1    jruoho             {
   1003   1.1.1.8  christos                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
   1004       1.1    jruoho             }
   1005       1.1    jruoho             return (AE_OK);
   1006       1.1    jruoho 
   1007       1.1    jruoho         case AML_MATCH_OP:
   1008       1.1    jruoho 
   1009       1.1    jruoho             AcpiDmMatchOp (Op);
   1010       1.1    jruoho             break;
   1011       1.1    jruoho 
   1012       1.1    jruoho         default:
   1013       1.1    jruoho 
   1014       1.1    jruoho             break;
   1015       1.1    jruoho         }
   1016       1.1    jruoho 
   1017       1.1    jruoho         if (AcpiDmBlockType (Op) & BLOCK_BRACE)
   1018       1.1    jruoho         {
   1019       1.1    jruoho             AcpiOsPrintf ("\n");
   1020       1.1    jruoho             AcpiDmIndent (Level);
   1021       1.1    jruoho             AcpiOsPrintf ("{\n");
   1022       1.1    jruoho         }
   1023       1.1    jruoho     }
   1024       1.1    jruoho 
   1025       1.1    jruoho     return (AE_OK);
   1026       1.1    jruoho }
   1027       1.1    jruoho 
   1028       1.1    jruoho 
   1029       1.1    jruoho /*******************************************************************************
   1030       1.1    jruoho  *
   1031       1.1    jruoho  * FUNCTION:    AcpiDmAscendingOp
   1032       1.1    jruoho  *
   1033       1.1    jruoho  * PARAMETERS:  ASL_WALK_CALLBACK
   1034       1.1    jruoho  *
   1035       1.1    jruoho  * RETURN:      Status
   1036       1.1    jruoho  *
   1037       1.1    jruoho  * DESCRIPTION: Second visitation of a parse object, during ascent of parse
   1038   1.1.1.3  christos  *              tree. Close out any parameter lists and complete the opcode.
   1039       1.1    jruoho  *
   1040       1.1    jruoho  ******************************************************************************/
   1041       1.1    jruoho 
   1042       1.1    jruoho static ACPI_STATUS
   1043       1.1    jruoho AcpiDmAscendingOp (
   1044       1.1    jruoho     ACPI_PARSE_OBJECT       *Op,
   1045       1.1    jruoho     UINT32                  Level,
   1046       1.1    jruoho     void                    *Context)
   1047       1.1    jruoho {
   1048       1.1    jruoho     ACPI_OP_WALK_INFO       *Info = Context;
   1049   1.1.1.3  christos     ACPI_PARSE_OBJECT       *ParentOp;
   1050       1.1    jruoho 
   1051       1.1    jruoho 
   1052  1.1.1.11  christos     /* Point the Op's filename pointer to the proper file */
   1053  1.1.1.11  christos 
   1054  1.1.1.13  christos     if (AcpiGbl_CaptureComments)
   1055  1.1.1.11  christos     {
   1056  1.1.1.11  christos         ASL_CV_LABEL_FILENODE (Op);
   1057  1.1.1.11  christos 
   1058  1.1.1.11  christos         /* Switch the output of these files if necessary */
   1059  1.1.1.11  christos 
   1060  1.1.1.11  christos         if (ASL_CV_FILE_HAS_SWITCHED (Op))
   1061  1.1.1.11  christos         {
   1062  1.1.1.11  christos             ASL_CV_SWITCH_FILES (Level, Op);
   1063  1.1.1.11  christos         }
   1064  1.1.1.11  christos     }
   1065  1.1.1.11  christos 
   1066  1.1.1.10  christos     if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE ||
   1067  1.1.1.10  christos         Op->Common.DisasmOpcode == ACPI_DASM_IGNORE_SINGLE)
   1068       1.1    jruoho     {
   1069       1.1    jruoho         /* Ignore this op -- it was handled elsewhere */
   1070       1.1    jruoho 
   1071       1.1    jruoho         return (AE_OK);
   1072       1.1    jruoho     }
   1073       1.1    jruoho 
   1074       1.1    jruoho     if ((Level == 0) && (Op->Common.AmlOpcode == AML_SCOPE_OP))
   1075       1.1    jruoho     {
   1076       1.1    jruoho         /* Indicates the end of the current descriptor block (table) */
   1077       1.1    jruoho 
   1078  1.1.1.11  christos         ASL_CV_CLOSE_BRACE (Op, Level);
   1079  1.1.1.11  christos 
   1080  1.1.1.11  christos         /* Print any comments that are at the end of the file here */
   1081  1.1.1.11  christos 
   1082  1.1.1.13  christos         if (AcpiGbl_CaptureComments && AcpiGbl_LastListHead)
   1083  1.1.1.11  christos         {
   1084  1.1.1.11  christos             AcpiOsPrintf ("\n");
   1085  1.1.1.11  christos             ASL_CV_PRINT_ONE_COMMENT_LIST (AcpiGbl_LastListHead, 0);
   1086  1.1.1.11  christos         }
   1087  1.1.1.11  christos         AcpiOsPrintf ("\n\n");
   1088  1.1.1.11  christos 
   1089       1.1    jruoho         return (AE_OK);
   1090       1.1    jruoho     }
   1091       1.1    jruoho 
   1092       1.1    jruoho     switch (AcpiDmBlockType (Op))
   1093       1.1    jruoho     {
   1094       1.1    jruoho     case BLOCK_PAREN:
   1095       1.1    jruoho 
   1096   1.1.1.5  christos         /* Completed an op that has arguments, add closing paren if needed */
   1097       1.1    jruoho 
   1098   1.1.1.5  christos         AcpiDmCloseOperator (Op);
   1099       1.1    jruoho 
   1100   1.1.1.3  christos         if (Op->Common.AmlOpcode == AML_NAME_OP)
   1101   1.1.1.3  christos         {
   1102   1.1.1.3  christos             /* Emit description comment for Name() with a predefined ACPI name */
   1103   1.1.1.3  christos 
   1104   1.1.1.3  christos             AcpiDmPredefinedDescription (Op);
   1105   1.1.1.3  christos         }
   1106   1.1.1.3  christos         else
   1107   1.1.1.3  christos         {
   1108   1.1.1.3  christos             /* For Create* operators, attempt to emit resource tag description */
   1109   1.1.1.3  christos 
   1110   1.1.1.3  christos             AcpiDmFieldPredefinedDescription (Op);
   1111   1.1.1.3  christos         }
   1112   1.1.1.3  christos 
   1113   1.1.1.4  christos         /* Decode Notify() values */
   1114   1.1.1.4  christos 
   1115   1.1.1.4  christos         if (Op->Common.AmlOpcode == AML_NOTIFY_OP)
   1116   1.1.1.4  christos         {
   1117   1.1.1.4  christos             AcpiDmNotifyDescription (Op);
   1118   1.1.1.4  christos         }
   1119   1.1.1.4  christos 
   1120   1.1.1.4  christos         AcpiDmDisplayTargetPathname (Op);
   1121   1.1.1.4  christos 
   1122       1.1    jruoho         /* Could be a nested operator, check if comma required */
   1123       1.1    jruoho 
   1124       1.1    jruoho         if (!AcpiDmCommaIfListMember (Op))
   1125       1.1    jruoho         {
   1126       1.1    jruoho             if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
   1127   1.1.1.8  christos                  (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST)) &&
   1128   1.1.1.7  christos                  (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
   1129       1.1    jruoho             {
   1130       1.1    jruoho                 /*
   1131       1.1    jruoho                  * This is a first-level element of a term list
   1132       1.1    jruoho                  * start a new line
   1133       1.1    jruoho                  */
   1134   1.1.1.8  christos                 if (!(Info->Flags & ACPI_PARSEOP_PARAMETER_LIST))
   1135       1.1    jruoho                 {
   1136       1.1    jruoho                     AcpiOsPrintf ("\n");
   1137       1.1    jruoho                 }
   1138       1.1    jruoho             }
   1139       1.1    jruoho         }
   1140       1.1    jruoho         break;
   1141       1.1    jruoho 
   1142       1.1    jruoho     case BLOCK_BRACE:
   1143       1.1    jruoho     case (BLOCK_BRACE | BLOCK_PAREN):
   1144       1.1    jruoho 
   1145       1.1    jruoho         /* Completed an op that has a term list, add closing brace */
   1146       1.1    jruoho 
   1147       1.1    jruoho         if (Op->Common.DisasmFlags & ACPI_PARSEOP_EMPTY_TERMLIST)
   1148       1.1    jruoho         {
   1149  1.1.1.11  christos             ASL_CV_CLOSE_BRACE (Op, Level);
   1150       1.1    jruoho         }
   1151       1.1    jruoho         else
   1152       1.1    jruoho         {
   1153       1.1    jruoho             AcpiDmIndent (Level);
   1154  1.1.1.11  christos             ASL_CV_CLOSE_BRACE (Op, Level);
   1155       1.1    jruoho         }
   1156       1.1    jruoho 
   1157       1.1    jruoho         AcpiDmCommaIfListMember (Op);
   1158       1.1    jruoho 
   1159       1.1    jruoho         if (AcpiDmBlockType (Op->Common.Parent) != BLOCK_PAREN)
   1160       1.1    jruoho         {
   1161       1.1    jruoho             AcpiOsPrintf ("\n");
   1162       1.1    jruoho             if (!(Op->Common.DisasmFlags & ACPI_PARSEOP_EMPTY_TERMLIST))
   1163       1.1    jruoho             {
   1164       1.1    jruoho                 if ((Op->Common.AmlOpcode == AML_IF_OP)  &&
   1165       1.1    jruoho                     (Op->Common.Next) &&
   1166       1.1    jruoho                     (Op->Common.Next->Common.AmlOpcode == AML_ELSE_OP))
   1167       1.1    jruoho                 {
   1168       1.1    jruoho                     break;
   1169       1.1    jruoho                 }
   1170       1.1    jruoho 
   1171       1.1    jruoho                 if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
   1172       1.1    jruoho                     (!Op->Common.Next))
   1173       1.1    jruoho                 {
   1174       1.1    jruoho                     break;
   1175       1.1    jruoho                 }
   1176       1.1    jruoho                 AcpiOsPrintf ("\n");
   1177       1.1    jruoho             }
   1178       1.1    jruoho         }
   1179       1.1    jruoho         break;
   1180       1.1    jruoho 
   1181       1.1    jruoho     case BLOCK_NONE:
   1182       1.1    jruoho     default:
   1183       1.1    jruoho 
   1184       1.1    jruoho         /* Could be a nested operator, check if comma required */
   1185       1.1    jruoho 
   1186       1.1    jruoho         if (!AcpiDmCommaIfListMember (Op))
   1187       1.1    jruoho         {
   1188       1.1    jruoho             if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
   1189   1.1.1.8  christos                  (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST)) &&
   1190   1.1.1.7  christos                  (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
   1191       1.1    jruoho             {
   1192       1.1    jruoho                 /*
   1193       1.1    jruoho                  * This is a first-level element of a term list
   1194       1.1    jruoho                  * start a new line
   1195       1.1    jruoho                  */
   1196       1.1    jruoho                 AcpiOsPrintf ("\n");
   1197       1.1    jruoho             }
   1198       1.1    jruoho         }
   1199       1.1    jruoho         else if (Op->Common.Parent)
   1200       1.1    jruoho         {
   1201       1.1    jruoho             switch (Op->Common.Parent->Common.AmlOpcode)
   1202       1.1    jruoho             {
   1203       1.1    jruoho             case AML_PACKAGE_OP:
   1204  1.1.1.11  christos             case AML_VARIABLE_PACKAGE_OP:
   1205       1.1    jruoho 
   1206   1.1.1.8  christos                 if (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST))
   1207       1.1    jruoho                 {
   1208       1.1    jruoho                     AcpiOsPrintf ("\n");
   1209       1.1    jruoho                 }
   1210       1.1    jruoho                 break;
   1211       1.1    jruoho 
   1212       1.1    jruoho             default:
   1213       1.1    jruoho 
   1214       1.1    jruoho                 break;
   1215       1.1    jruoho             }
   1216       1.1    jruoho         }
   1217       1.1    jruoho         break;
   1218       1.1    jruoho     }
   1219       1.1    jruoho 
   1220   1.1.1.8  christos     if (Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST)
   1221       1.1    jruoho     {
   1222       1.1    jruoho         if ((Op->Common.Next) &&
   1223   1.1.1.8  christos             (Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST))
   1224       1.1    jruoho         {
   1225       1.1    jruoho             return (AE_OK);
   1226       1.1    jruoho         }
   1227       1.1    jruoho 
   1228       1.1    jruoho         /*
   1229   1.1.1.4  christos          * The parent Op is guaranteed to be valid because of the flag
   1230   1.1.1.8  christos          * ACPI_PARSEOP_PARAMETER_LIST -- which means that this op is part of
   1231   1.1.1.4  christos          * a parameter list and thus has a valid parent.
   1232   1.1.1.4  christos          */
   1233   1.1.1.4  christos         ParentOp = Op->Common.Parent;
   1234   1.1.1.4  christos 
   1235   1.1.1.4  christos         /*
   1236       1.1    jruoho          * Just completed a parameter node for something like "Buffer (param)".
   1237  1.1.1.10  christos          * Close the paren and open up the term list block with a brace.
   1238  1.1.1.10  christos          *
   1239  1.1.1.10  christos          * Switch predicates don't have a Next node but require a closing paren
   1240  1.1.1.10  christos          * and opening brace.
   1241       1.1    jruoho          */
   1242  1.1.1.10  christos         if (Op->Common.Next || Op->Common.DisasmOpcode == ACPI_DASM_SWITCH_PREDICATE)
   1243       1.1    jruoho         {
   1244  1.1.1.11  christos             ASL_CV_CLOSE_PAREN (Op, Level);
   1245   1.1.1.3  christos 
   1246   1.1.1.4  christos             /*
   1247   1.1.1.4  christos              * Emit a description comment for a Name() operator that is a
   1248   1.1.1.4  christos              * predefined ACPI name. Must check the grandparent.
   1249   1.1.1.4  christos              */
   1250   1.1.1.4  christos             ParentOp = ParentOp->Common.Parent;
   1251   1.1.1.4  christos             if (ParentOp &&
   1252   1.1.1.4  christos                 (ParentOp->Asl.AmlOpcode == AML_NAME_OP))
   1253   1.1.1.3  christos             {
   1254   1.1.1.4  christos                 AcpiDmPredefinedDescription (ParentOp);
   1255   1.1.1.3  christos             }
   1256   1.1.1.4  christos 
   1257  1.1.1.10  christos             /* Correct the indentation level for Switch and Case predicates */
   1258  1.1.1.10  christos 
   1259  1.1.1.10  christos             if (Op->Common.DisasmOpcode == ACPI_DASM_SWITCH_PREDICATE)
   1260  1.1.1.10  christos             {
   1261  1.1.1.10  christos                 --Level;
   1262  1.1.1.10  christos             }
   1263  1.1.1.10  christos 
   1264   1.1.1.3  christos             AcpiOsPrintf ("\n");
   1265       1.1    jruoho             AcpiDmIndent (Level - 1);
   1266       1.1    jruoho             AcpiOsPrintf ("{\n");
   1267       1.1    jruoho         }
   1268       1.1    jruoho         else
   1269       1.1    jruoho         {
   1270   1.1.1.4  christos             ParentOp->Common.DisasmFlags |= ACPI_PARSEOP_EMPTY_TERMLIST;
   1271  1.1.1.11  christos             ASL_CV_CLOSE_PAREN (Op, Level);
   1272  1.1.1.11  christos             AcpiOsPrintf ("{");
   1273       1.1    jruoho         }
   1274       1.1    jruoho     }
   1275       1.1    jruoho 
   1276       1.1    jruoho     if ((Op->Common.AmlOpcode == AML_NAME_OP) ||
   1277       1.1    jruoho         (Op->Common.AmlOpcode == AML_RETURN_OP))
   1278       1.1    jruoho     {
   1279       1.1    jruoho         Info->Level++;
   1280       1.1    jruoho     }
   1281   1.1.1.5  christos 
   1282   1.1.1.5  christos     /*
   1283   1.1.1.5  christos      * For ASL+, check for and emit a C-style symbol. If valid, the
   1284   1.1.1.5  christos      * symbol string has been deferred until after the first operand
   1285   1.1.1.5  christos      */
   1286   1.1.1.5  christos     if (AcpiGbl_CstyleDisassembly)
   1287   1.1.1.5  christos     {
   1288   1.1.1.5  christos         if (Op->Asl.OperatorSymbol)
   1289   1.1.1.5  christos         {
   1290   1.1.1.5  christos             AcpiOsPrintf ("%s", Op->Asl.OperatorSymbol);
   1291   1.1.1.5  christos             Op->Asl.OperatorSymbol = NULL;
   1292   1.1.1.5  christos         }
   1293   1.1.1.5  christos     }
   1294   1.1.1.5  christos 
   1295       1.1    jruoho     return (AE_OK);
   1296       1.1    jruoho }
   1297