Home | History | Annotate | Line # | Download | only in debugger
dbobject.c revision 1.1.1.5.4.2
      1          1.1  christos /*******************************************************************************
      2          1.1  christos  *
      3          1.1  christos  * Module Name: dbobject - ACPI object decode and display
      4          1.1  christos  *
      5          1.1  christos  ******************************************************************************/
      6          1.1  christos 
      7          1.1  christos /*
      8  1.1.1.5.4.1  pgoyette  * Copyright (C) 2000 - 2018, Intel Corp.
      9          1.1  christos  * All rights reserved.
     10          1.1  christos  *
     11          1.1  christos  * Redistribution and use in source and binary forms, with or without
     12          1.1  christos  * modification, are permitted provided that the following conditions
     13          1.1  christos  * are met:
     14          1.1  christos  * 1. Redistributions of source code must retain the above copyright
     15          1.1  christos  *    notice, this list of conditions, and the following disclaimer,
     16          1.1  christos  *    without modification.
     17          1.1  christos  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18          1.1  christos  *    substantially similar to the "NO WARRANTY" disclaimer below
     19          1.1  christos  *    ("Disclaimer") and any redistribution must be conditioned upon
     20          1.1  christos  *    including a substantially similar Disclaimer requirement for further
     21          1.1  christos  *    binary redistribution.
     22          1.1  christos  * 3. Neither the names of the above-listed copyright holders nor the names
     23          1.1  christos  *    of any contributors may be used to endorse or promote products derived
     24          1.1  christos  *    from this software without specific prior written permission.
     25          1.1  christos  *
     26          1.1  christos  * Alternatively, this software may be distributed under the terms of the
     27          1.1  christos  * GNU General Public License ("GPL") version 2 as published by the Free
     28          1.1  christos  * Software Foundation.
     29          1.1  christos  *
     30          1.1  christos  * NO WARRANTY
     31          1.1  christos  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32          1.1  christos  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33          1.1  christos  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     34          1.1  christos  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35          1.1  christos  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36          1.1  christos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37          1.1  christos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38          1.1  christos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39          1.1  christos  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40          1.1  christos  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41          1.1  christos  * POSSIBILITY OF SUCH DAMAGES.
     42          1.1  christos  */
     43          1.1  christos 
     44          1.1  christos #include "acpi.h"
     45          1.1  christos #include "accommon.h"
     46          1.1  christos #include "acnamesp.h"
     47          1.1  christos #include "acdebug.h"
     48          1.1  christos 
     49          1.1  christos 
     50          1.1  christos #define _COMPONENT          ACPI_CA_DEBUGGER
     51          1.1  christos         ACPI_MODULE_NAME    ("dbobject")
     52          1.1  christos 
     53      1.1.1.2  christos 
     54          1.1  christos /* Local prototypes */
     55          1.1  christos 
     56          1.1  christos static void
     57          1.1  christos AcpiDbDecodeNode (
     58          1.1  christos     ACPI_NAMESPACE_NODE     *Node);
     59          1.1  christos 
     60          1.1  christos 
     61          1.1  christos /*******************************************************************************
     62          1.1  christos  *
     63          1.1  christos  * FUNCTION:    AcpiDbDumpMethodInfo
     64          1.1  christos  *
     65          1.1  christos  * PARAMETERS:  Status          - Method execution status
     66          1.1  christos  *              WalkState       - Current state of the parse tree walk
     67          1.1  christos  *
     68          1.1  christos  * RETURN:      None
     69          1.1  christos  *
     70          1.1  christos  * DESCRIPTION: Called when a method has been aborted because of an error.
     71          1.1  christos  *              Dumps the method execution stack, and the method locals/args,
     72          1.1  christos  *              and disassembles the AML opcode that failed.
     73          1.1  christos  *
     74          1.1  christos  ******************************************************************************/
     75          1.1  christos 
     76          1.1  christos void
     77          1.1  christos AcpiDbDumpMethodInfo (
     78          1.1  christos     ACPI_STATUS             Status,
     79          1.1  christos     ACPI_WALK_STATE         *WalkState)
     80          1.1  christos {
     81          1.1  christos     ACPI_THREAD_STATE       *Thread;
     82  1.1.1.5.4.2  pgoyette     ACPI_NAMESPACE_NODE     *Node;
     83  1.1.1.5.4.2  pgoyette 
     84  1.1.1.5.4.2  pgoyette 
     85  1.1.1.5.4.2  pgoyette     Node = WalkState->MethodNode;
     86  1.1.1.5.4.2  pgoyette 
     87  1.1.1.5.4.2  pgoyette     /* There are no locals or arguments for the module-level code case */
     88          1.1  christos 
     89  1.1.1.5.4.2  pgoyette     if (Node == AcpiGbl_RootNode)
     90  1.1.1.5.4.2  pgoyette     {
     91  1.1.1.5.4.2  pgoyette         return;
     92  1.1.1.5.4.2  pgoyette     }
     93          1.1  christos 
     94          1.1  christos     /* Ignore control codes, they are not errors */
     95          1.1  christos 
     96          1.1  christos     if ((Status & AE_CODE_MASK) == AE_CODE_CONTROL)
     97          1.1  christos     {
     98          1.1  christos         return;
     99          1.1  christos     }
    100          1.1  christos 
    101          1.1  christos     /* We may be executing a deferred opcode */
    102          1.1  christos 
    103          1.1  christos     if (WalkState->DeferredNode)
    104          1.1  christos     {
    105          1.1  christos         AcpiOsPrintf ("Executing subtree for Buffer/Package/Region\n");
    106          1.1  christos         return;
    107          1.1  christos     }
    108          1.1  christos 
    109          1.1  christos     /*
    110          1.1  christos      * If there is no Thread, we are not actually executing a method.
    111          1.1  christos      * This can happen when the iASL compiler calls the interpreter
    112          1.1  christos      * to perform constant folding.
    113          1.1  christos      */
    114          1.1  christos     Thread = WalkState->Thread;
    115          1.1  christos     if (!Thread)
    116          1.1  christos     {
    117          1.1  christos         return;
    118          1.1  christos     }
    119          1.1  christos 
    120          1.1  christos     /* Display the method locals and arguments */
    121          1.1  christos 
    122          1.1  christos     AcpiOsPrintf ("\n");
    123          1.1  christos     AcpiDbDecodeLocals (WalkState);
    124          1.1  christos     AcpiOsPrintf ("\n");
    125          1.1  christos     AcpiDbDecodeArguments (WalkState);
    126          1.1  christos     AcpiOsPrintf ("\n");
    127          1.1  christos }
    128          1.1  christos 
    129          1.1  christos 
    130          1.1  christos /*******************************************************************************
    131          1.1  christos  *
    132          1.1  christos  * FUNCTION:    AcpiDbDecodeInternalObject
    133          1.1  christos  *
    134          1.1  christos  * PARAMETERS:  ObjDesc         - Object to be displayed
    135          1.1  christos  *
    136          1.1  christos  * RETURN:      None
    137          1.1  christos  *
    138          1.1  christos  * DESCRIPTION: Short display of an internal object. Numbers/Strings/Buffers.
    139          1.1  christos  *
    140          1.1  christos  ******************************************************************************/
    141          1.1  christos 
    142          1.1  christos void
    143          1.1  christos AcpiDbDecodeInternalObject (
    144          1.1  christos     ACPI_OPERAND_OBJECT     *ObjDesc)
    145          1.1  christos {
    146          1.1  christos     UINT32                  i;
    147          1.1  christos 
    148          1.1  christos 
    149          1.1  christos     if (!ObjDesc)
    150          1.1  christos     {
    151          1.1  christos         AcpiOsPrintf (" Uninitialized");
    152          1.1  christos         return;
    153          1.1  christos     }
    154          1.1  christos 
    155          1.1  christos     if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
    156          1.1  christos     {
    157      1.1.1.2  christos         AcpiOsPrintf (" %p [%s]", ObjDesc,
    158      1.1.1.2  christos             AcpiUtGetDescriptorName (ObjDesc));
    159          1.1  christos         return;
    160          1.1  christos     }
    161          1.1  christos 
    162          1.1  christos     AcpiOsPrintf (" %s", AcpiUtGetObjectTypeName (ObjDesc));
    163          1.1  christos 
    164          1.1  christos     switch (ObjDesc->Common.Type)
    165          1.1  christos     {
    166          1.1  christos     case ACPI_TYPE_INTEGER:
    167          1.1  christos 
    168          1.1  christos         AcpiOsPrintf (" %8.8X%8.8X",
    169      1.1.1.2  christos             ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
    170          1.1  christos         break;
    171          1.1  christos 
    172          1.1  christos     case ACPI_TYPE_STRING:
    173          1.1  christos 
    174      1.1.1.3  christos         AcpiOsPrintf ("(%u) \"%.60s",
    175      1.1.1.2  christos             ObjDesc->String.Length, ObjDesc->String.Pointer);
    176          1.1  christos 
    177      1.1.1.3  christos         if (ObjDesc->String.Length > 60)
    178          1.1  christos         {
    179          1.1  christos             AcpiOsPrintf ("...");
    180          1.1  christos         }
    181          1.1  christos         else
    182          1.1  christos         {
    183          1.1  christos             AcpiOsPrintf ("\"");
    184          1.1  christos         }
    185          1.1  christos         break;
    186          1.1  christos 
    187          1.1  christos     case ACPI_TYPE_BUFFER:
    188          1.1  christos 
    189          1.1  christos         AcpiOsPrintf ("(%u)", ObjDesc->Buffer.Length);
    190          1.1  christos         for (i = 0; (i < 8) && (i < ObjDesc->Buffer.Length); i++)
    191          1.1  christos         {
    192          1.1  christos             AcpiOsPrintf (" %2.2X", ObjDesc->Buffer.Pointer[i]);
    193          1.1  christos         }
    194          1.1  christos         break;
    195          1.1  christos 
    196          1.1  christos     default:
    197          1.1  christos 
    198          1.1  christos         AcpiOsPrintf (" %p", ObjDesc);
    199          1.1  christos         break;
    200          1.1  christos     }
    201          1.1  christos }
    202          1.1  christos 
    203          1.1  christos 
    204          1.1  christos /*******************************************************************************
    205          1.1  christos  *
    206          1.1  christos  * FUNCTION:    AcpiDbDecodeNode
    207          1.1  christos  *
    208          1.1  christos  * PARAMETERS:  Node        - Object to be displayed
    209          1.1  christos  *
    210          1.1  christos  * RETURN:      None
    211          1.1  christos  *
    212          1.1  christos  * DESCRIPTION: Short display of a namespace node
    213          1.1  christos  *
    214          1.1  christos  ******************************************************************************/
    215          1.1  christos 
    216          1.1  christos static void
    217          1.1  christos AcpiDbDecodeNode (
    218          1.1  christos     ACPI_NAMESPACE_NODE     *Node)
    219          1.1  christos {
    220          1.1  christos 
    221          1.1  christos     AcpiOsPrintf ("<Node>            Name %4.4s",
    222      1.1.1.2  christos         AcpiUtGetNodeName (Node));
    223          1.1  christos 
    224          1.1  christos     if (Node->Flags & ANOBJ_METHOD_ARG)
    225          1.1  christos     {
    226          1.1  christos         AcpiOsPrintf (" [Method Arg]");
    227          1.1  christos     }
    228          1.1  christos     if (Node->Flags & ANOBJ_METHOD_LOCAL)
    229          1.1  christos     {
    230          1.1  christos         AcpiOsPrintf (" [Method Local]");
    231          1.1  christos     }
    232          1.1  christos 
    233          1.1  christos     switch (Node->Type)
    234          1.1  christos     {
    235          1.1  christos     /* These types have no attached object */
    236          1.1  christos 
    237          1.1  christos     case ACPI_TYPE_DEVICE:
    238          1.1  christos 
    239          1.1  christos         AcpiOsPrintf (" Device");
    240          1.1  christos         break;
    241          1.1  christos 
    242          1.1  christos     case ACPI_TYPE_THERMAL:
    243          1.1  christos 
    244          1.1  christos         AcpiOsPrintf (" Thermal Zone");
    245          1.1  christos         break;
    246          1.1  christos 
    247          1.1  christos     default:
    248          1.1  christos 
    249          1.1  christos         AcpiDbDecodeInternalObject (AcpiNsGetAttachedObject (Node));
    250          1.1  christos         break;
    251          1.1  christos     }
    252          1.1  christos }
    253          1.1  christos 
    254          1.1  christos 
    255          1.1  christos /*******************************************************************************
    256          1.1  christos  *
    257          1.1  christos  * FUNCTION:    AcpiDbDisplayInternalObject
    258          1.1  christos  *
    259          1.1  christos  * PARAMETERS:  ObjDesc         - Object to be displayed
    260          1.1  christos  *              WalkState       - Current walk state
    261          1.1  christos  *
    262          1.1  christos  * RETURN:      None
    263          1.1  christos  *
    264          1.1  christos  * DESCRIPTION: Short display of an internal object
    265          1.1  christos  *
    266          1.1  christos  ******************************************************************************/
    267          1.1  christos 
    268          1.1  christos void
    269          1.1  christos AcpiDbDisplayInternalObject (
    270          1.1  christos     ACPI_OPERAND_OBJECT     *ObjDesc,
    271          1.1  christos     ACPI_WALK_STATE         *WalkState)
    272          1.1  christos {
    273          1.1  christos     UINT8                   Type;
    274          1.1  christos 
    275          1.1  christos 
    276          1.1  christos     AcpiOsPrintf ("%p ", ObjDesc);
    277          1.1  christos 
    278          1.1  christos     if (!ObjDesc)
    279          1.1  christos     {
    280          1.1  christos         AcpiOsPrintf ("<Null Object>\n");
    281          1.1  christos         return;
    282          1.1  christos     }
    283          1.1  christos 
    284          1.1  christos     /* Decode the object type */
    285          1.1  christos 
    286          1.1  christos     switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
    287          1.1  christos     {
    288          1.1  christos     case ACPI_DESC_TYPE_PARSER:
    289          1.1  christos 
    290          1.1  christos         AcpiOsPrintf ("<Parser>  ");
    291          1.1  christos         break;
    292          1.1  christos 
    293          1.1  christos     case ACPI_DESC_TYPE_NAMED:
    294          1.1  christos 
    295          1.1  christos         AcpiDbDecodeNode ((ACPI_NAMESPACE_NODE *) ObjDesc);
    296          1.1  christos         break;
    297          1.1  christos 
    298          1.1  christos     case ACPI_DESC_TYPE_OPERAND:
    299          1.1  christos 
    300          1.1  christos         Type = ObjDesc->Common.Type;
    301          1.1  christos         if (Type > ACPI_TYPE_LOCAL_MAX)
    302          1.1  christos         {
    303          1.1  christos             AcpiOsPrintf (" Type %X [Invalid Type]", (UINT32) Type);
    304          1.1  christos             return;
    305          1.1  christos         }
    306          1.1  christos 
    307          1.1  christos         /* Decode the ACPI object type */
    308          1.1  christos 
    309          1.1  christos         switch (ObjDesc->Common.Type)
    310          1.1  christos         {
    311          1.1  christos         case ACPI_TYPE_LOCAL_REFERENCE:
    312          1.1  christos 
    313          1.1  christos             AcpiOsPrintf ("[%s] ", AcpiUtGetReferenceName (ObjDesc));
    314          1.1  christos 
    315          1.1  christos             /* Decode the refererence */
    316          1.1  christos 
    317          1.1  christos             switch (ObjDesc->Reference.Class)
    318          1.1  christos             {
    319          1.1  christos             case ACPI_REFCLASS_LOCAL:
    320          1.1  christos 
    321          1.1  christos                 AcpiOsPrintf ("%X ", ObjDesc->Reference.Value);
    322          1.1  christos                 if (WalkState)
    323          1.1  christos                 {
    324          1.1  christos                     ObjDesc = WalkState->LocalVariables
    325      1.1.1.2  christos                         [ObjDesc->Reference.Value].Object;
    326          1.1  christos                     AcpiOsPrintf ("%p", ObjDesc);
    327          1.1  christos                     AcpiDbDecodeInternalObject (ObjDesc);
    328          1.1  christos                 }
    329          1.1  christos                 break;
    330          1.1  christos 
    331          1.1  christos             case ACPI_REFCLASS_ARG:
    332          1.1  christos 
    333          1.1  christos                 AcpiOsPrintf ("%X ", ObjDesc->Reference.Value);
    334          1.1  christos                 if (WalkState)
    335          1.1  christos                 {
    336          1.1  christos                     ObjDesc = WalkState->Arguments
    337      1.1.1.2  christos                         [ObjDesc->Reference.Value].Object;
    338          1.1  christos                     AcpiOsPrintf ("%p", ObjDesc);
    339          1.1  christos                     AcpiDbDecodeInternalObject (ObjDesc);
    340          1.1  christos                 }
    341          1.1  christos                 break;
    342          1.1  christos 
    343          1.1  christos             case ACPI_REFCLASS_INDEX:
    344          1.1  christos 
    345          1.1  christos                 switch (ObjDesc->Reference.TargetType)
    346          1.1  christos                 {
    347          1.1  christos                 case ACPI_TYPE_BUFFER_FIELD:
    348          1.1  christos 
    349          1.1  christos                     AcpiOsPrintf ("%p", ObjDesc->Reference.Object);
    350          1.1  christos                     AcpiDbDecodeInternalObject (ObjDesc->Reference.Object);
    351          1.1  christos                     break;
    352          1.1  christos 
    353          1.1  christos                 case ACPI_TYPE_PACKAGE:
    354          1.1  christos 
    355          1.1  christos                     AcpiOsPrintf ("%p", ObjDesc->Reference.Where);
    356          1.1  christos                     if (!ObjDesc->Reference.Where)
    357          1.1  christos                     {
    358          1.1  christos                         AcpiOsPrintf (" Uninitialized WHERE pointer");
    359          1.1  christos                     }
    360          1.1  christos                     else
    361          1.1  christos                     {
    362          1.1  christos                         AcpiDbDecodeInternalObject (
    363          1.1  christos                             *(ObjDesc->Reference.Where));
    364          1.1  christos                     }
    365          1.1  christos                     break;
    366          1.1  christos 
    367          1.1  christos                 default:
    368          1.1  christos 
    369          1.1  christos                     AcpiOsPrintf ("Unknown index target type");
    370          1.1  christos                     break;
    371          1.1  christos                 }
    372          1.1  christos                 break;
    373          1.1  christos 
    374          1.1  christos             case ACPI_REFCLASS_REFOF:
    375          1.1  christos 
    376          1.1  christos                 if (!ObjDesc->Reference.Object)
    377          1.1  christos                 {
    378      1.1.1.2  christos                     AcpiOsPrintf (
    379      1.1.1.2  christos                         "Uninitialized reference subobject pointer");
    380          1.1  christos                     break;
    381          1.1  christos                 }
    382          1.1  christos 
    383          1.1  christos                 /* Reference can be to a Node or an Operand object */
    384          1.1  christos 
    385          1.1  christos                 switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc->Reference.Object))
    386          1.1  christos                 {
    387          1.1  christos                 case ACPI_DESC_TYPE_NAMED:
    388      1.1.1.2  christos 
    389          1.1  christos                     AcpiDbDecodeNode (ObjDesc->Reference.Object);
    390          1.1  christos                     break;
    391          1.1  christos 
    392          1.1  christos                 case ACPI_DESC_TYPE_OPERAND:
    393      1.1.1.2  christos 
    394          1.1  christos                     AcpiDbDecodeInternalObject (ObjDesc->Reference.Object);
    395          1.1  christos                     break;
    396          1.1  christos 
    397          1.1  christos                 default:
    398          1.1  christos                     break;
    399          1.1  christos                 }
    400          1.1  christos                 break;
    401          1.1  christos 
    402          1.1  christos             case ACPI_REFCLASS_NAME:
    403          1.1  christos 
    404          1.1  christos                 AcpiDbDecodeNode (ObjDesc->Reference.Node);
    405          1.1  christos                 break;
    406          1.1  christos 
    407          1.1  christos             case ACPI_REFCLASS_DEBUG:
    408          1.1  christos             case ACPI_REFCLASS_TABLE:
    409          1.1  christos 
    410          1.1  christos                 AcpiOsPrintf ("\n");
    411          1.1  christos                 break;
    412          1.1  christos 
    413          1.1  christos             default:    /* Unknown reference class */
    414          1.1  christos 
    415          1.1  christos                 AcpiOsPrintf ("%2.2X\n", ObjDesc->Reference.Class);
    416          1.1  christos                 break;
    417          1.1  christos             }
    418          1.1  christos             break;
    419          1.1  christos 
    420          1.1  christos         default:
    421          1.1  christos 
    422          1.1  christos             AcpiOsPrintf ("<Obj>            ");
    423          1.1  christos             AcpiDbDecodeInternalObject (ObjDesc);
    424          1.1  christos             break;
    425          1.1  christos         }
    426          1.1  christos         break;
    427          1.1  christos 
    428          1.1  christos     default:
    429          1.1  christos 
    430          1.1  christos         AcpiOsPrintf ("<Not a valid ACPI Object Descriptor> [%s]",
    431          1.1  christos             AcpiUtGetDescriptorName (ObjDesc));
    432          1.1  christos         break;
    433          1.1  christos     }
    434          1.1  christos 
    435          1.1  christos     AcpiOsPrintf ("\n");
    436          1.1  christos }
    437          1.1  christos 
    438          1.1  christos 
    439          1.1  christos /*******************************************************************************
    440          1.1  christos  *
    441          1.1  christos  * FUNCTION:    AcpiDbDecodeLocals
    442          1.1  christos  *
    443          1.1  christos  * PARAMETERS:  WalkState       - State for current method
    444          1.1  christos  *
    445          1.1  christos  * RETURN:      None
    446          1.1  christos  *
    447          1.1  christos  * DESCRIPTION: Display all locals for the currently running control method
    448          1.1  christos  *
    449          1.1  christos  ******************************************************************************/
    450          1.1  christos 
    451          1.1  christos void
    452          1.1  christos AcpiDbDecodeLocals (
    453          1.1  christos     ACPI_WALK_STATE         *WalkState)
    454          1.1  christos {
    455          1.1  christos     UINT32                  i;
    456          1.1  christos     ACPI_OPERAND_OBJECT     *ObjDesc;
    457          1.1  christos     ACPI_NAMESPACE_NODE     *Node;
    458      1.1.1.2  christos     BOOLEAN                 DisplayLocals = FALSE;
    459          1.1  christos 
    460          1.1  christos 
    461  1.1.1.5.4.2  pgoyette     Node = WalkState->MethodNode;
    462          1.1  christos     ObjDesc = WalkState->MethodDesc;
    463  1.1.1.5.4.2  pgoyette 
    464  1.1.1.5.4.2  pgoyette     /* There are no locals for the module-level code case */
    465  1.1.1.5.4.2  pgoyette 
    466  1.1.1.5.4.2  pgoyette     if (Node == AcpiGbl_RootNode)
    467  1.1.1.5.4.2  pgoyette     {
    468  1.1.1.5.4.2  pgoyette         return;
    469  1.1.1.5.4.2  pgoyette     }
    470      1.1.1.2  christos 
    471          1.1  christos     if (!Node)
    472          1.1  christos     {
    473          1.1  christos         AcpiOsPrintf (
    474          1.1  christos             "No method node (Executing subtree for buffer or opregion)\n");
    475          1.1  christos         return;
    476          1.1  christos     }
    477          1.1  christos 
    478          1.1  christos     if (Node->Type != ACPI_TYPE_METHOD)
    479          1.1  christos     {
    480          1.1  christos         AcpiOsPrintf ("Executing subtree for Buffer/Package/Region\n");
    481          1.1  christos         return;
    482          1.1  christos     }
    483          1.1  christos 
    484      1.1.1.2  christos     /* Are any locals actually set? */
    485          1.1  christos 
    486          1.1  christos     for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++)
    487          1.1  christos     {
    488          1.1  christos         ObjDesc = WalkState->LocalVariables[i].Object;
    489      1.1.1.2  christos         if (ObjDesc)
    490      1.1.1.2  christos         {
    491      1.1.1.2  christos             DisplayLocals = TRUE;
    492      1.1.1.2  christos             break;
    493      1.1.1.2  christos         }
    494      1.1.1.2  christos     }
    495      1.1.1.2  christos 
    496      1.1.1.2  christos     /* If any are set, only display the ones that are set */
    497      1.1.1.2  christos 
    498      1.1.1.2  christos     if (DisplayLocals)
    499      1.1.1.2  christos     {
    500      1.1.1.5  christos         AcpiOsPrintf ("\nInitialized Local Variables for Method [%4.4s]:\n",
    501      1.1.1.2  christos             AcpiUtGetNodeName (Node));
    502      1.1.1.2  christos 
    503      1.1.1.2  christos         for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++)
    504      1.1.1.2  christos         {
    505      1.1.1.2  christos             ObjDesc = WalkState->LocalVariables[i].Object;
    506      1.1.1.2  christos             if (ObjDesc)
    507      1.1.1.2  christos             {
    508      1.1.1.2  christos                 AcpiOsPrintf ("    Local%X: ", i);
    509      1.1.1.2  christos                 AcpiDbDisplayInternalObject (ObjDesc, WalkState);
    510      1.1.1.2  christos             }
    511      1.1.1.2  christos         }
    512      1.1.1.2  christos     }
    513      1.1.1.2  christos     else
    514      1.1.1.2  christos     {
    515      1.1.1.2  christos         AcpiOsPrintf (
    516      1.1.1.5  christos             "No Local Variables are initialized for Method [%4.4s]\n",
    517      1.1.1.2  christos             AcpiUtGetNodeName (Node));
    518          1.1  christos     }
    519          1.1  christos }
    520          1.1  christos 
    521          1.1  christos 
    522          1.1  christos /*******************************************************************************
    523          1.1  christos  *
    524          1.1  christos  * FUNCTION:    AcpiDbDecodeArguments
    525          1.1  christos  *
    526          1.1  christos  * PARAMETERS:  WalkState       - State for current method
    527          1.1  christos  *
    528          1.1  christos  * RETURN:      None
    529          1.1  christos  *
    530          1.1  christos  * DESCRIPTION: Display all arguments for the currently running control method
    531          1.1  christos  *
    532          1.1  christos  ******************************************************************************/
    533          1.1  christos 
    534          1.1  christos void
    535          1.1  christos AcpiDbDecodeArguments (
    536          1.1  christos     ACPI_WALK_STATE         *WalkState)
    537          1.1  christos {
    538          1.1  christos     UINT32                  i;
    539          1.1  christos     ACPI_OPERAND_OBJECT     *ObjDesc;
    540          1.1  christos     ACPI_NAMESPACE_NODE     *Node;
    541      1.1.1.2  christos     BOOLEAN                 DisplayArgs = FALSE;
    542          1.1  christos 
    543          1.1  christos 
    544      1.1.1.2  christos     Node = WalkState->MethodNode;
    545          1.1  christos     ObjDesc = WalkState->MethodDesc;
    546      1.1.1.2  christos 
    547  1.1.1.5.4.2  pgoyette     /* There are no arguments for the module-level code case */
    548  1.1.1.5.4.2  pgoyette 
    549  1.1.1.5.4.2  pgoyette     if (Node == AcpiGbl_RootNode)
    550  1.1.1.5.4.2  pgoyette     {
    551  1.1.1.5.4.2  pgoyette         return;
    552  1.1.1.5.4.2  pgoyette     }
    553  1.1.1.5.4.2  pgoyette 
    554          1.1  christos     if (!Node)
    555          1.1  christos     {
    556          1.1  christos         AcpiOsPrintf (
    557          1.1  christos             "No method node (Executing subtree for buffer or opregion)\n");
    558          1.1  christos         return;
    559          1.1  christos     }
    560          1.1  christos 
    561          1.1  christos     if (Node->Type != ACPI_TYPE_METHOD)
    562          1.1  christos     {
    563          1.1  christos         AcpiOsPrintf ("Executing subtree for Buffer/Package/Region\n");
    564          1.1  christos         return;
    565          1.1  christos     }
    566          1.1  christos 
    567      1.1.1.2  christos     /* Are any arguments actually set? */
    568          1.1  christos 
    569          1.1  christos     for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++)
    570          1.1  christos     {
    571          1.1  christos         ObjDesc = WalkState->Arguments[i].Object;
    572      1.1.1.2  christos         if (ObjDesc)
    573      1.1.1.2  christos         {
    574      1.1.1.2  christos             DisplayArgs = TRUE;
    575      1.1.1.2  christos             break;
    576      1.1.1.2  christos         }
    577          1.1  christos     }
    578          1.1  christos 
    579      1.1.1.2  christos     /* If any are set, only display the ones that are set */
    580      1.1.1.2  christos 
    581      1.1.1.2  christos     if (DisplayArgs)
    582      1.1.1.2  christos     {
    583      1.1.1.2  christos         AcpiOsPrintf (
    584      1.1.1.2  christos             "Initialized Arguments for Method [%4.4s]:  "
    585      1.1.1.2  christos             "(%X arguments defined for method invocation)\n",
    586      1.1.1.5  christos             AcpiUtGetNodeName (Node), Node->Object->Method.ParamCount);
    587      1.1.1.2  christos 
    588      1.1.1.2  christos         for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++)
    589      1.1.1.2  christos         {
    590      1.1.1.2  christos             ObjDesc = WalkState->Arguments[i].Object;
    591      1.1.1.2  christos             if (ObjDesc)
    592      1.1.1.2  christos             {
    593      1.1.1.2  christos                 AcpiOsPrintf ("    Arg%u:   ", i);
    594      1.1.1.2  christos                 AcpiDbDisplayInternalObject (ObjDesc, WalkState);
    595      1.1.1.2  christos             }
    596      1.1.1.2  christos         }
    597      1.1.1.2  christos     }
    598      1.1.1.2  christos     else
    599      1.1.1.2  christos     {
    600      1.1.1.2  christos         AcpiOsPrintf (
    601      1.1.1.2  christos             "No Arguments are initialized for method [%4.4s]\n",
    602      1.1.1.2  christos             AcpiUtGetNodeName (Node));
    603      1.1.1.2  christos     }
    604      1.1.1.2  christos }
    605