Home | History | Annotate | Line # | Download | only in executer
exdump.c revision 1.1.1.4
      1 /******************************************************************************
      2  *
      3  * Module Name: exdump - Interpreter debug output routines
      4  *
      5  *****************************************************************************/
      6 
      7 /*
      8  * Copyright (C) 2000 - 2014, Intel Corp.
      9  * All rights reserved.
     10  *
     11  * Redistribution and use in source and binary forms, with or without
     12  * modification, are permitted provided that the following conditions
     13  * are met:
     14  * 1. Redistributions of source code must retain the above copyright
     15  *    notice, this list of conditions, and the following disclaimer,
     16  *    without modification.
     17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18  *    substantially similar to the "NO WARRANTY" disclaimer below
     19  *    ("Disclaimer") and any redistribution must be conditioned upon
     20  *    including a substantially similar Disclaimer requirement for further
     21  *    binary redistribution.
     22  * 3. Neither the names of the above-listed copyright holders nor the names
     23  *    of any contributors may be used to endorse or promote products derived
     24  *    from this software without specific prior written permission.
     25  *
     26  * Alternatively, this software may be distributed under the terms of the
     27  * GNU General Public License ("GPL") version 2 as published by the Free
     28  * Software Foundation.
     29  *
     30  * NO WARRANTY
     31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41  * POSSIBILITY OF SUCH DAMAGES.
     42  */
     43 
     44 #define __EXDUMP_C__
     45 
     46 #include "acpi.h"
     47 #include "accommon.h"
     48 #include "acinterp.h"
     49 #include "amlcode.h"
     50 #include "acnamesp.h"
     51 
     52 
     53 #define _COMPONENT          ACPI_EXECUTER
     54         ACPI_MODULE_NAME    ("exdump")
     55 
     56 /*
     57  * The following routines are used for debug output only
     58  */
     59 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
     60 
     61 /* Local prototypes */
     62 
     63 static void
     64 AcpiExOutString (
     65     char                    *Title,
     66     char                    *Value);
     67 
     68 static void
     69 AcpiExOutPointer (
     70     char                    *Title,
     71     void                    *Value);
     72 
     73 static void
     74 AcpiExDumpObject (
     75     ACPI_OPERAND_OBJECT     *ObjDesc,
     76     ACPI_EXDUMP_INFO        *Info);
     77 
     78 static void
     79 AcpiExDumpReferenceObj (
     80     ACPI_OPERAND_OBJECT     *ObjDesc);
     81 
     82 static void
     83 AcpiExDumpPackageObj (
     84     ACPI_OPERAND_OBJECT     *ObjDesc,
     85     UINT32                  Level,
     86     UINT32                  Index);
     87 
     88 
     89 /*******************************************************************************
     90  *
     91  * Object Descriptor info tables
     92  *
     93  * Note: The first table entry must be an INIT opcode and must contain
     94  * the table length (number of table entries)
     95  *
     96  ******************************************************************************/
     97 
     98 static ACPI_EXDUMP_INFO     AcpiExDumpInteger[2] =
     99 {
    100     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpInteger),        NULL},
    101     {ACPI_EXD_UINT64,   ACPI_EXD_OFFSET (Integer.Value),                "Value"}
    102 };
    103 
    104 static ACPI_EXDUMP_INFO     AcpiExDumpString[4] =
    105 {
    106     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpString),         NULL},
    107     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (String.Length),                "Length"},
    108     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (String.Pointer),               "Pointer"},
    109     {ACPI_EXD_STRING,   0,                                              NULL}
    110 };
    111 
    112 static ACPI_EXDUMP_INFO     AcpiExDumpBuffer[5] =
    113 {
    114     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpBuffer),         NULL},
    115     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (Buffer.Length),                "Length"},
    116     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Buffer.Pointer),               "Pointer"},
    117     {ACPI_EXD_NODE,     ACPI_EXD_OFFSET (Buffer.Node),                  "Parent Node"},
    118     {ACPI_EXD_BUFFER,   0,                                              NULL}
    119 };
    120 
    121 static ACPI_EXDUMP_INFO     AcpiExDumpPackage[6] =
    122 {
    123     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpPackage),        NULL},
    124     {ACPI_EXD_NODE,     ACPI_EXD_OFFSET (Package.Node),                 "Parent Node"},
    125     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Package.Flags),                "Flags"},
    126     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (Package.Count),                "Elements"},
    127     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Package.Elements),             "Element List"},
    128     {ACPI_EXD_PACKAGE,  0,                                              NULL}
    129 };
    130 
    131 static ACPI_EXDUMP_INFO     AcpiExDumpDevice[4] =
    132 {
    133     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpDevice),         NULL},
    134     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Device.NotifyList[0]),         "System Notify"},
    135     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Device.NotifyList[1]),         "Device Notify"},
    136     {ACPI_EXD_HDLR_LIST,ACPI_EXD_OFFSET (Device.Handler),               "Handler"}
    137 };
    138 
    139 static ACPI_EXDUMP_INFO     AcpiExDumpEvent[2] =
    140 {
    141     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpEvent),          NULL},
    142     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Event.OsSemaphore),            "OsSemaphore"}
    143 };
    144 
    145 static ACPI_EXDUMP_INFO     AcpiExDumpMethod[9] =
    146 {
    147     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpMethod),         NULL},
    148     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Method.InfoFlags),             "Info Flags"},
    149     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Method.ParamCount),            "Parameter Count"},
    150     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Method.SyncLevel),             "Sync Level"},
    151     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Method.Mutex),                 "Mutex"},
    152     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Method.OwnerId),               "Owner Id"},
    153     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Method.ThreadCount),           "Thread Count"},
    154     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (Method.AmlLength),             "Aml Length"},
    155     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Method.AmlStart),              "Aml Start"}
    156 };
    157 
    158 static ACPI_EXDUMP_INFO     AcpiExDumpMutex[6] =
    159 {
    160     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpMutex),          NULL},
    161     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Mutex.SyncLevel),              "Sync Level"},
    162     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Mutex.OriginalSyncLevel),      "Original Sync Level"},
    163     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Mutex.OwnerThread),            "Owner Thread"},
    164     {ACPI_EXD_UINT16,   ACPI_EXD_OFFSET (Mutex.AcquisitionDepth),       "Acquire Depth"},
    165     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Mutex.OsMutex),                "OsMutex"}
    166 };
    167 
    168 static ACPI_EXDUMP_INFO     AcpiExDumpRegion[8] =
    169 {
    170     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpRegion),         NULL},
    171     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Region.SpaceId),               "Space Id"},
    172     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Region.Flags),                 "Flags"},
    173     {ACPI_EXD_NODE,     ACPI_EXD_OFFSET (Region.Node),                  "Parent Node"},
    174     {ACPI_EXD_ADDRESS,  ACPI_EXD_OFFSET (Region.Address),               "Address"},
    175     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (Region.Length),                "Length"},
    176     {ACPI_EXD_HDLR_LIST,ACPI_EXD_OFFSET (Region.Handler),               "Handler"},
    177     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Region.Next),                  "Next"}
    178 };
    179 
    180 static ACPI_EXDUMP_INFO     AcpiExDumpPower[6] =
    181 {
    182     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpPower),          NULL},
    183     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (PowerResource.SystemLevel),    "System Level"},
    184     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (PowerResource.ResourceOrder),  "Resource Order"},
    185     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (PowerResource.NotifyList[0]),  "System Notify"},
    186     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (PowerResource.NotifyList[1]),  "Device Notify"},
    187     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (PowerResource.Handler),        "Handler"}
    188 };
    189 
    190 static ACPI_EXDUMP_INFO     AcpiExDumpProcessor[7] =
    191 {
    192     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpProcessor),      NULL},
    193     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Processor.ProcId),             "Processor ID"},
    194     {ACPI_EXD_UINT8 ,   ACPI_EXD_OFFSET (Processor.Length),             "Length"},
    195     {ACPI_EXD_ADDRESS,  ACPI_EXD_OFFSET (Processor.Address),            "Address"},
    196     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Processor.NotifyList[0]),      "System Notify"},
    197     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Processor.NotifyList[1]),      "Device Notify"},
    198     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Processor.Handler),            "Handler"}
    199 };
    200 
    201 static ACPI_EXDUMP_INFO     AcpiExDumpThermal[4] =
    202 {
    203     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpThermal),        NULL},
    204     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (ThermalZone.NotifyList[0]),    "System Notify"},
    205     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (ThermalZone.NotifyList[1]),    "Device Notify"},
    206     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (ThermalZone.Handler),          "Handler"}
    207 };
    208 
    209 static ACPI_EXDUMP_INFO     AcpiExDumpBufferField[3] =
    210 {
    211     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpBufferField),    NULL},
    212     {ACPI_EXD_FIELD,    0,                                              NULL},
    213     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (BufferField.BufferObj),        "Buffer Object"}
    214 };
    215 
    216 static ACPI_EXDUMP_INFO     AcpiExDumpRegionField[5] =
    217 {
    218     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpRegionField),    NULL},
    219     {ACPI_EXD_FIELD,    0,                                              NULL},
    220     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Field.AccessLength),           "AccessLength"},
    221     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Field.RegionObj),              "Region Object"},
    222     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Field.ResourceBuffer),         "ResourceBuffer"}
    223 };
    224 
    225 static ACPI_EXDUMP_INFO     AcpiExDumpBankField[5] =
    226 {
    227     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpBankField),      NULL},
    228     {ACPI_EXD_FIELD,    0,                                              NULL},
    229     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (BankField.Value),              "Value"},
    230     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (BankField.RegionObj),          "Region Object"},
    231     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (BankField.BankObj),            "Bank Object"}
    232 };
    233 
    234 static ACPI_EXDUMP_INFO     AcpiExDumpIndexField[5] =
    235 {
    236     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpBankField),      NULL},
    237     {ACPI_EXD_FIELD,    0,                                              NULL},
    238     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (IndexField.Value),             "Value"},
    239     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (IndexField.IndexObj),          "Index Object"},
    240     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (IndexField.DataObj),           "Data Object"}
    241 };
    242 
    243 static ACPI_EXDUMP_INFO     AcpiExDumpReference[8] =
    244 {
    245     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpReference),       NULL},
    246     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Reference.Class),              "Class"},
    247     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Reference.TargetType),         "Target Type"},
    248     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (Reference.Value),              "Value"},
    249     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Reference.Object),             "Object Desc"},
    250     {ACPI_EXD_NODE,     ACPI_EXD_OFFSET (Reference.Node),               "Node"},
    251     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Reference.Where),              "Where"},
    252     {ACPI_EXD_REFERENCE,0,                                              NULL}
    253 };
    254 
    255 static ACPI_EXDUMP_INFO     AcpiExDumpAddressHandler[6] =
    256 {
    257     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpAddressHandler), NULL},
    258     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (AddressSpace.SpaceId),         "Space Id"},
    259     {ACPI_EXD_HDLR_LIST,ACPI_EXD_OFFSET (AddressSpace.Next),            "Next"},
    260     {ACPI_EXD_RGN_LIST, ACPI_EXD_OFFSET (AddressSpace.RegionList),      "Region List"},
    261     {ACPI_EXD_NODE,     ACPI_EXD_OFFSET (AddressSpace.Node),            "Node"},
    262     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (AddressSpace.Context),         "Context"}
    263 };
    264 
    265 static ACPI_EXDUMP_INFO     AcpiExDumpNotify[7] =
    266 {
    267     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpNotify),         NULL},
    268     {ACPI_EXD_NODE,     ACPI_EXD_OFFSET (Notify.Node),                  "Node"},
    269     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (Notify.HandlerType),           "Handler Type"},
    270     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Notify.Handler),               "Handler"},
    271     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Notify.Context),               "Context"},
    272     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Notify.Next[0]),               "Next System Notify"},
    273     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Notify.Next[1]),               "Next Device Notify"}
    274 };
    275 
    276 static ACPI_EXDUMP_INFO     AcpiExDumpExtra[6] =
    277 {
    278     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpExtra),          NULL},
    279     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Extra.Method_REG),             "_REG Method"},
    280     {ACPI_EXD_NODE,     ACPI_EXD_OFFSET (Extra.ScopeNode),              "Scope Node"},
    281     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Extra.RegionContext),          "Region Context"},
    282     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Extra.AmlStart),               "Aml Start"},
    283     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (Extra.AmlLength),              "Aml Length"}
    284 };
    285 
    286 static ACPI_EXDUMP_INFO     AcpiExDumpData[3] =
    287 {
    288     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpData),           NULL},
    289     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Data.Handler),                 "Handler"},
    290     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Data.Pointer),                 "Raw Data"}
    291 };
    292 
    293 /* Miscellaneous tables */
    294 
    295 static ACPI_EXDUMP_INFO     AcpiExDumpCommon[5] =
    296 {
    297     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpCommon),         NULL},
    298     {ACPI_EXD_TYPE ,    0,                                              NULL},
    299     {ACPI_EXD_UINT16,   ACPI_EXD_OFFSET (Common.ReferenceCount),        "Reference Count"},
    300     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Common.Flags),                 "Flags"},
    301     {ACPI_EXD_LIST,     ACPI_EXD_OFFSET (Common.NextObject),            "Object List"}
    302 };
    303 
    304 static ACPI_EXDUMP_INFO     AcpiExDumpFieldCommon[7] =
    305 {
    306     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpFieldCommon),    NULL},
    307     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (CommonField.FieldFlags),       "Field Flags"},
    308     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (CommonField.AccessByteWidth),  "Access Byte Width"},
    309     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (CommonField.BitLength),        "Bit Length"},
    310     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (CommonField.StartFieldBitOffset),"Field Bit Offset"},
    311     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (CommonField.BaseByteOffset),   "Base Byte Offset"},
    312     {ACPI_EXD_NODE,     ACPI_EXD_OFFSET (CommonField.Node),             "Parent Node"}
    313 };
    314 
    315 static ACPI_EXDUMP_INFO     AcpiExDumpNode[7] =
    316 {
    317     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpNode),           NULL},
    318     {ACPI_EXD_UINT8,    ACPI_EXD_NSOFFSET (Flags),                      "Flags"},
    319     {ACPI_EXD_UINT8,    ACPI_EXD_NSOFFSET (OwnerId),                    "Owner Id"},
    320     {ACPI_EXD_LIST,     ACPI_EXD_NSOFFSET (Object),                     "Object List"},
    321     {ACPI_EXD_NODE,     ACPI_EXD_NSOFFSET (Parent),                     "Parent"},
    322     {ACPI_EXD_NODE,     ACPI_EXD_NSOFFSET (Child),                      "Child"},
    323     {ACPI_EXD_NODE,     ACPI_EXD_NSOFFSET (Peer),                       "Peer"}
    324 };
    325 
    326 
    327 /* Dispatch table, indexed by object type */
    328 
    329 static ACPI_EXDUMP_INFO     *AcpiExDumpInfo[] =
    330 {
    331     NULL,
    332     AcpiExDumpInteger,
    333     AcpiExDumpString,
    334     AcpiExDumpBuffer,
    335     AcpiExDumpPackage,
    336     NULL,
    337     AcpiExDumpDevice,
    338     AcpiExDumpEvent,
    339     AcpiExDumpMethod,
    340     AcpiExDumpMutex,
    341     AcpiExDumpRegion,
    342     AcpiExDumpPower,
    343     AcpiExDumpProcessor,
    344     AcpiExDumpThermal,
    345     AcpiExDumpBufferField,
    346     NULL,
    347     NULL,
    348     AcpiExDumpRegionField,
    349     AcpiExDumpBankField,
    350     AcpiExDumpIndexField,
    351     AcpiExDumpReference,
    352     NULL,
    353     NULL,
    354     AcpiExDumpNotify,
    355     AcpiExDumpAddressHandler,
    356     NULL,
    357     NULL,
    358     NULL,
    359     AcpiExDumpExtra,
    360     AcpiExDumpData
    361 };
    362 
    363 
    364 /*******************************************************************************
    365  *
    366  * FUNCTION:    AcpiExDumpObject
    367  *
    368  * PARAMETERS:  ObjDesc             - Descriptor to dump
    369  *              Info                - Info table corresponding to this object
    370  *                                    type
    371  *
    372  * RETURN:      None
    373  *
    374  * DESCRIPTION: Walk the info table for this object
    375  *
    376  ******************************************************************************/
    377 
    378 static void
    379 AcpiExDumpObject (
    380     ACPI_OPERAND_OBJECT     *ObjDesc,
    381     ACPI_EXDUMP_INFO        *Info)
    382 {
    383     UINT8                   *Target;
    384     char                    *Name;
    385     const char              *ReferenceName;
    386     UINT8                   Count;
    387     ACPI_OPERAND_OBJECT     *Start;
    388     ACPI_OPERAND_OBJECT     *Data = NULL;
    389     ACPI_OPERAND_OBJECT     *Next;
    390     ACPI_NAMESPACE_NODE     *Node;
    391 
    392 
    393     if (!Info)
    394     {
    395         AcpiOsPrintf (
    396             "ExDumpObject: Display not implemented for object type %s\n",
    397             AcpiUtGetObjectTypeName (ObjDesc));
    398         return;
    399     }
    400 
    401     /* First table entry must contain the table length (# of table entries) */
    402 
    403     Count = Info->Offset;
    404 
    405     while (Count)
    406     {
    407         Target = ACPI_ADD_PTR (UINT8, ObjDesc, Info->Offset);
    408         Name = Info->Name;
    409 
    410         switch (Info->Opcode)
    411         {
    412         case ACPI_EXD_INIT:
    413 
    414             break;
    415 
    416         case ACPI_EXD_TYPE:
    417 
    418             AcpiOsPrintf ("%20s : %2.2X [%s]\n", "Type",
    419                 ObjDesc->Common.Type, AcpiUtGetObjectTypeName (ObjDesc));
    420             break;
    421 
    422         case ACPI_EXD_UINT8:
    423 
    424             AcpiOsPrintf ("%20s : %2.2X\n", Name, *Target);
    425             break;
    426 
    427         case ACPI_EXD_UINT16:
    428 
    429             AcpiOsPrintf ("%20s : %4.4X\n", Name, ACPI_GET16 (Target));
    430             break;
    431 
    432         case ACPI_EXD_UINT32:
    433 
    434             AcpiOsPrintf ("%20s : %8.8X\n", Name, ACPI_GET32 (Target));
    435             break;
    436 
    437         case ACPI_EXD_UINT64:
    438 
    439             AcpiOsPrintf ("%20s : %8.8X%8.8X\n", "Value",
    440                 ACPI_FORMAT_UINT64 (ACPI_GET64 (Target)));
    441             break;
    442 
    443         case ACPI_EXD_POINTER:
    444         case ACPI_EXD_ADDRESS:
    445 
    446             AcpiExOutPointer (Name, *ACPI_CAST_PTR (void *, Target));
    447             break;
    448 
    449         case ACPI_EXD_STRING:
    450 
    451             AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);
    452             AcpiOsPrintf ("\n");
    453             break;
    454 
    455         case ACPI_EXD_BUFFER:
    456 
    457             ACPI_DUMP_BUFFER (ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length);
    458             break;
    459 
    460         case ACPI_EXD_PACKAGE:
    461 
    462             /* Dump the package contents */
    463 
    464             AcpiOsPrintf ("\nPackage Contents:\n");
    465             AcpiExDumpPackageObj (ObjDesc, 0, 0);
    466             break;
    467 
    468         case ACPI_EXD_FIELD:
    469 
    470             AcpiExDumpObject (ObjDesc, AcpiExDumpFieldCommon);
    471             break;
    472 
    473         case ACPI_EXD_REFERENCE:
    474 
    475             ReferenceName = AcpiUtGetReferenceName (ObjDesc);
    476             AcpiExOutString ("Class Name", ACPI_CAST_PTR (char, ReferenceName));
    477             AcpiExDumpReferenceObj (ObjDesc);
    478             break;
    479 
    480         case ACPI_EXD_LIST:
    481 
    482             Start = *ACPI_CAST_PTR (void *, Target);
    483             Next = Start;
    484 
    485             AcpiOsPrintf ("%20s : %p", Name, Next);
    486             if (Next)
    487             {
    488                 AcpiOsPrintf ("(%s %2.2X)",
    489                     AcpiUtGetObjectTypeName (Next), Next->Common.Type);
    490 
    491                 while (Next->Common.NextObject)
    492                 {
    493                     if ((Next->Common.Type == ACPI_TYPE_LOCAL_DATA) &&
    494                         !Data)
    495                     {
    496                         Data = Next;
    497                     }
    498 
    499                     Next = Next->Common.NextObject;
    500                     AcpiOsPrintf ("->%p(%s %2.2X)", Next,
    501                         AcpiUtGetObjectTypeName (Next), Next->Common.Type);
    502 
    503                     if ((Next == Start) || (Next == Data))
    504                     {
    505                         AcpiOsPrintf ("\n**** Error: Object list appears to be circular linked");
    506                         break;
    507                     }
    508                 }
    509             }
    510 
    511             AcpiOsPrintf ("\n");
    512             break;
    513 
    514         case ACPI_EXD_HDLR_LIST:
    515 
    516             Start = *ACPI_CAST_PTR (void *, Target);
    517             Next = Start;
    518 
    519             AcpiOsPrintf ("%20s : %p", Name, Next);
    520             if (Next)
    521             {
    522                 AcpiOsPrintf ("(%s %2.2X)",
    523                     AcpiUtGetObjectTypeName (Next), Next->Common.Type);
    524 
    525                 while (Next->AddressSpace.Next)
    526                 {
    527                     if ((Next->Common.Type == ACPI_TYPE_LOCAL_DATA) &&
    528                         !Data)
    529                     {
    530                         Data = Next;
    531                     }
    532 
    533                     Next = Next->AddressSpace.Next;
    534                     AcpiOsPrintf ("->%p(%s %2.2X)", Next,
    535                         AcpiUtGetObjectTypeName (Next), Next->Common.Type);
    536 
    537                     if ((Next == Start) || (Next == Data))
    538                     {
    539                         AcpiOsPrintf ("\n**** Error: Handler list appears to be circular linked");
    540                         break;
    541                     }
    542                 }
    543             }
    544 
    545             AcpiOsPrintf ("\n");
    546             break;
    547 
    548         case ACPI_EXD_RGN_LIST:
    549 
    550             Start = *ACPI_CAST_PTR (void *, Target);
    551             Next = Start;
    552 
    553             AcpiOsPrintf ("%20s : %p", Name, Next);
    554             if (Next)
    555             {
    556                 AcpiOsPrintf ("(%s %2.2X)",
    557                     AcpiUtGetObjectTypeName (Next), Next->Common.Type);
    558 
    559                 while (Next->Region.Next)
    560                 {
    561                     if ((Next->Common.Type == ACPI_TYPE_LOCAL_DATA) &&
    562                         !Data)
    563                     {
    564                         Data = Next;
    565                     }
    566 
    567                     Next = Next->Region.Next;
    568                     AcpiOsPrintf ("->%p(%s %2.2X)", Next,
    569                         AcpiUtGetObjectTypeName (Next), Next->Common.Type);
    570 
    571                     if ((Next == Start) || (Next == Data))
    572                     {
    573                         AcpiOsPrintf ("\n**** Error: Region list appears to be circular linked");
    574                         break;
    575                     }
    576                 }
    577             }
    578 
    579             AcpiOsPrintf ("\n");
    580             break;
    581 
    582         case ACPI_EXD_NODE:
    583 
    584             Node = *ACPI_CAST_PTR (ACPI_NAMESPACE_NODE *, Target);
    585 
    586             AcpiOsPrintf ("%20s : %p", Name, Node);
    587             if (Node)
    588             {
    589                 AcpiOsPrintf (" [%4.4s]", Node->Name.Ascii);
    590             }
    591             AcpiOsPrintf ("\n");
    592             break;
    593 
    594         default:
    595 
    596             AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n",
    597                 Info->Opcode);
    598             return;
    599         }
    600 
    601         Info++;
    602         Count--;
    603     }
    604 }
    605 
    606 
    607 /*******************************************************************************
    608  *
    609  * FUNCTION:    AcpiExDumpOperand
    610  *
    611  * PARAMETERS:  *ObjDesc        - Pointer to entry to be dumped
    612  *              Depth           - Current nesting depth
    613  *
    614  * RETURN:      None
    615  *
    616  * DESCRIPTION: Dump an operand object
    617  *
    618  ******************************************************************************/
    619 
    620 void
    621 AcpiExDumpOperand (
    622     ACPI_OPERAND_OBJECT     *ObjDesc,
    623     UINT32                  Depth)
    624 {
    625     UINT32                  Length;
    626     UINT32                  Index;
    627 
    628 
    629     ACPI_FUNCTION_NAME (ExDumpOperand)
    630 
    631 
    632     /* Check if debug output enabled */
    633 
    634     if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_EXEC, _COMPONENT))
    635     {
    636         return;
    637     }
    638 
    639     if (!ObjDesc)
    640     {
    641         /* This could be a null element of a package */
    642 
    643         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n"));
    644         return;
    645     }
    646 
    647     if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
    648     {
    649         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p Namespace Node: ", ObjDesc));
    650         ACPI_DUMP_ENTRY (ObjDesc, ACPI_LV_EXEC);
    651         return;
    652     }
    653 
    654     if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
    655     {
    656         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
    657             "%p is not a node or operand object: [%s]\n",
    658             ObjDesc, AcpiUtGetDescriptorName (ObjDesc)));
    659         ACPI_DUMP_BUFFER (ObjDesc, sizeof (ACPI_OPERAND_OBJECT));
    660         return;
    661     }
    662 
    663     /* ObjDesc is a valid object */
    664 
    665     if (Depth > 0)
    666     {
    667         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%*s[%u] %p ",
    668             Depth, " ", Depth, ObjDesc));
    669     }
    670     else
    671     {
    672         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", ObjDesc));
    673     }
    674 
    675     /* Decode object type */
    676 
    677     switch (ObjDesc->Common.Type)
    678     {
    679     case ACPI_TYPE_LOCAL_REFERENCE:
    680 
    681         AcpiOsPrintf ("Reference: [%s] ", AcpiUtGetReferenceName (ObjDesc));
    682 
    683         switch (ObjDesc->Reference.Class)
    684         {
    685         case ACPI_REFCLASS_DEBUG:
    686 
    687             AcpiOsPrintf ("\n");
    688             break;
    689 
    690         case ACPI_REFCLASS_INDEX:
    691 
    692             AcpiOsPrintf ("%p\n", ObjDesc->Reference.Object);
    693             break;
    694 
    695         case ACPI_REFCLASS_TABLE:
    696 
    697             AcpiOsPrintf ("Table Index %X\n", ObjDesc->Reference.Value);
    698             break;
    699 
    700         case ACPI_REFCLASS_REFOF:
    701 
    702             AcpiOsPrintf ("%p [%s]\n", ObjDesc->Reference.Object,
    703                 AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *)
    704                     ObjDesc->Reference.Object)->Common.Type));
    705             break;
    706 
    707         case ACPI_REFCLASS_NAME:
    708 
    709             AcpiOsPrintf ("- [%4.4s]\n", ObjDesc->Reference.Node->Name.Ascii);
    710             break;
    711 
    712         case ACPI_REFCLASS_ARG:
    713         case ACPI_REFCLASS_LOCAL:
    714 
    715             AcpiOsPrintf ("%X\n", ObjDesc->Reference.Value);
    716             break;
    717 
    718         default:    /* Unknown reference class */
    719 
    720             AcpiOsPrintf ("%2.2X\n", ObjDesc->Reference.Class);
    721             break;
    722         }
    723         break;
    724 
    725     case ACPI_TYPE_BUFFER:
    726 
    727         AcpiOsPrintf ("Buffer length %.2X @ %p\n",
    728             ObjDesc->Buffer.Length, ObjDesc->Buffer.Pointer);
    729 
    730         /* Debug only -- dump the buffer contents */
    731 
    732         if (ObjDesc->Buffer.Pointer)
    733         {
    734             Length = ObjDesc->Buffer.Length;
    735             if (Length > 128)
    736             {
    737                 Length = 128;
    738             }
    739 
    740             AcpiOsPrintf ("Buffer Contents: (displaying length 0x%.2X)\n",
    741                 Length);
    742             ACPI_DUMP_BUFFER (ObjDesc->Buffer.Pointer, Length);
    743         }
    744         break;
    745 
    746     case ACPI_TYPE_INTEGER:
    747 
    748         AcpiOsPrintf ("Integer %8.8X%8.8X\n",
    749             ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
    750         break;
    751 
    752     case ACPI_TYPE_PACKAGE:
    753 
    754         AcpiOsPrintf ("Package [Len %X] ElementArray %p\n",
    755             ObjDesc->Package.Count, ObjDesc->Package.Elements);
    756 
    757         /*
    758          * If elements exist, package element pointer is valid,
    759          * and debug_level exceeds 1, dump package's elements.
    760          */
    761         if (ObjDesc->Package.Count &&
    762             ObjDesc->Package.Elements &&
    763             AcpiDbgLevel > 1)
    764         {
    765             for (Index = 0; Index < ObjDesc->Package.Count; Index++)
    766             {
    767                 AcpiExDumpOperand (ObjDesc->Package.Elements[Index], Depth+1);
    768             }
    769         }
    770         break;
    771 
    772     case ACPI_TYPE_REGION:
    773 
    774         AcpiOsPrintf ("Region %s (%X)",
    775             AcpiUtGetRegionName (ObjDesc->Region.SpaceId),
    776             ObjDesc->Region.SpaceId);
    777 
    778         /*
    779          * If the address and length have not been evaluated,
    780          * don't print them.
    781          */
    782         if (!(ObjDesc->Region.Flags & AOPOBJ_DATA_VALID))
    783         {
    784             AcpiOsPrintf ("\n");
    785         }
    786         else
    787         {
    788             AcpiOsPrintf (" base %8.8X%8.8X Length %X\n",
    789                 ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address),
    790                 ObjDesc->Region.Length);
    791         }
    792         break;
    793 
    794     case ACPI_TYPE_STRING:
    795 
    796         AcpiOsPrintf ("String length %X @ %p ",
    797             ObjDesc->String.Length,
    798             ObjDesc->String.Pointer);
    799 
    800         AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);
    801         AcpiOsPrintf ("\n");
    802         break;
    803 
    804     case ACPI_TYPE_LOCAL_BANK_FIELD:
    805 
    806         AcpiOsPrintf ("BankField\n");
    807         break;
    808 
    809     case ACPI_TYPE_LOCAL_REGION_FIELD:
    810 
    811         AcpiOsPrintf ("RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at "
    812             "byte=%X bit=%X of below:\n",
    813             ObjDesc->Field.BitLength,
    814             ObjDesc->Field.AccessByteWidth,
    815             ObjDesc->Field.FieldFlags & AML_FIELD_LOCK_RULE_MASK,
    816             ObjDesc->Field.FieldFlags & AML_FIELD_UPDATE_RULE_MASK,
    817             ObjDesc->Field.BaseByteOffset,
    818             ObjDesc->Field.StartFieldBitOffset);
    819 
    820         AcpiExDumpOperand (ObjDesc->Field.RegionObj, Depth+1);
    821         break;
    822 
    823     case ACPI_TYPE_LOCAL_INDEX_FIELD:
    824 
    825         AcpiOsPrintf ("IndexField\n");
    826         break;
    827 
    828     case ACPI_TYPE_BUFFER_FIELD:
    829 
    830         AcpiOsPrintf ("BufferField: %X bits at byte %X bit %X of\n",
    831             ObjDesc->BufferField.BitLength,
    832             ObjDesc->BufferField.BaseByteOffset,
    833             ObjDesc->BufferField.StartFieldBitOffset);
    834 
    835         if (!ObjDesc->BufferField.BufferObj)
    836         {
    837             ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL*\n"));
    838         }
    839         else if ((ObjDesc->BufferField.BufferObj)->Common.Type !=
    840                     ACPI_TYPE_BUFFER)
    841         {
    842             AcpiOsPrintf ("*not a Buffer*\n");
    843         }
    844         else
    845         {
    846             AcpiExDumpOperand (ObjDesc->BufferField.BufferObj, Depth+1);
    847         }
    848         break;
    849 
    850     case ACPI_TYPE_EVENT:
    851 
    852         AcpiOsPrintf ("Event\n");
    853         break;
    854 
    855     case ACPI_TYPE_METHOD:
    856 
    857         AcpiOsPrintf ("Method(%X) @ %p:%X\n",
    858             ObjDesc->Method.ParamCount,
    859             ObjDesc->Method.AmlStart,
    860             ObjDesc->Method.AmlLength);
    861         break;
    862 
    863     case ACPI_TYPE_MUTEX:
    864 
    865         AcpiOsPrintf ("Mutex\n");
    866         break;
    867 
    868     case ACPI_TYPE_DEVICE:
    869 
    870         AcpiOsPrintf ("Device\n");
    871         break;
    872 
    873     case ACPI_TYPE_POWER:
    874 
    875         AcpiOsPrintf ("Power\n");
    876         break;
    877 
    878     case ACPI_TYPE_PROCESSOR:
    879 
    880         AcpiOsPrintf ("Processor\n");
    881         break;
    882 
    883     case ACPI_TYPE_THERMAL:
    884 
    885         AcpiOsPrintf ("Thermal\n");
    886         break;
    887 
    888     default:
    889 
    890         /* Unknown Type */
    891 
    892         AcpiOsPrintf ("Unknown Type %X\n", ObjDesc->Common.Type);
    893         break;
    894     }
    895 
    896     return;
    897 }
    898 
    899 
    900 /*******************************************************************************
    901  *
    902  * FUNCTION:    AcpiExDumpOperands
    903  *
    904  * PARAMETERS:  Operands            - A list of Operand objects
    905  *              OpcodeName          - AML opcode name
    906  *              NumOperands         - Operand count for this opcode
    907  *
    908  * DESCRIPTION: Dump the operands associated with the opcode
    909  *
    910  ******************************************************************************/
    911 
    912 void
    913 AcpiExDumpOperands (
    914     ACPI_OPERAND_OBJECT     **Operands,
    915     const char              *OpcodeName,
    916     UINT32                  NumOperands)
    917 {
    918     ACPI_FUNCTION_NAME (ExDumpOperands);
    919 
    920 
    921     if (!OpcodeName)
    922     {
    923         OpcodeName = "UNKNOWN";
    924     }
    925 
    926     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
    927         "**** Start operand dump for opcode [%s], %u operands\n",
    928         OpcodeName, NumOperands));
    929 
    930     if (NumOperands == 0)
    931     {
    932         NumOperands = 1;
    933     }
    934 
    935     /* Dump the individual operands */
    936 
    937     while (NumOperands)
    938     {
    939         AcpiExDumpOperand (*Operands, 0);
    940         Operands++;
    941         NumOperands--;
    942     }
    943 
    944     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
    945         "**** End operand dump for [%s]\n", OpcodeName));
    946     return;
    947 }
    948 
    949 
    950 /*******************************************************************************
    951  *
    952  * FUNCTION:    AcpiExOut* functions
    953  *
    954  * PARAMETERS:  Title               - Descriptive text
    955  *              Value               - Value to be displayed
    956  *
    957  * DESCRIPTION: Object dump output formatting functions. These functions
    958  *              reduce the number of format strings required and keeps them
    959  *              all in one place for easy modification.
    960  *
    961  ******************************************************************************/
    962 
    963 static void
    964 AcpiExOutString (
    965     char                    *Title,
    966     char                    *Value)
    967 {
    968     AcpiOsPrintf ("%20s : %s\n", Title, Value);
    969 }
    970 
    971 static void
    972 AcpiExOutPointer (
    973     char                    *Title,
    974     void                    *Value)
    975 {
    976     AcpiOsPrintf ("%20s : %p\n", Title, Value);
    977 }
    978 
    979 
    980 /*******************************************************************************
    981  *
    982  * FUNCTION:    AcpiExDumpNamespaceNode
    983  *
    984  * PARAMETERS:  Node                - Descriptor to dump
    985  *              Flags               - Force display if TRUE
    986  *
    987  * DESCRIPTION: Dumps the members of the given.Node
    988  *
    989  ******************************************************************************/
    990 
    991 void
    992 AcpiExDumpNamespaceNode (
    993     ACPI_NAMESPACE_NODE     *Node,
    994     UINT32                  Flags)
    995 {
    996 
    997     ACPI_FUNCTION_ENTRY ();
    998 
    999 
   1000     if (!Flags)
   1001     {
   1002         /* Check if debug output enabled */
   1003 
   1004         if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_OBJECTS, _COMPONENT))
   1005         {
   1006             return;
   1007         }
   1008     }
   1009 
   1010     AcpiOsPrintf ("%20s : %4.4s\n", "Name", AcpiUtGetNodeName (Node));
   1011     AcpiOsPrintf ("%20s : %2.2X [%s]\n", "Type",
   1012         Node->Type, AcpiUtGetTypeName (Node->Type));
   1013 
   1014     AcpiExDumpObject (ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node),
   1015         AcpiExDumpNode);
   1016 }
   1017 
   1018 
   1019 /*******************************************************************************
   1020  *
   1021  * FUNCTION:    AcpiExDumpReferenceObj
   1022  *
   1023  * PARAMETERS:  Object              - Descriptor to dump
   1024  *
   1025  * DESCRIPTION: Dumps a reference object
   1026  *
   1027  ******************************************************************************/
   1028 
   1029 static void
   1030 AcpiExDumpReferenceObj (
   1031     ACPI_OPERAND_OBJECT     *ObjDesc)
   1032 {
   1033     ACPI_BUFFER             RetBuf;
   1034     ACPI_STATUS             Status;
   1035 
   1036 
   1037     RetBuf.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
   1038 
   1039     if (ObjDesc->Reference.Class == ACPI_REFCLASS_NAME)
   1040     {
   1041         AcpiOsPrintf (" %p ", ObjDesc->Reference.Node);
   1042 
   1043         Status = AcpiNsHandleToPathname (ObjDesc->Reference.Node, &RetBuf);
   1044         if (ACPI_FAILURE (Status))
   1045         {
   1046             AcpiOsPrintf (" Could not convert name to pathname\n");
   1047         }
   1048         else
   1049         {
   1050            AcpiOsPrintf ("%s\n", (char *) RetBuf.Pointer);
   1051            ACPI_FREE (RetBuf.Pointer);
   1052         }
   1053     }
   1054     else if (ObjDesc->Reference.Object)
   1055     {
   1056         if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND)
   1057         {
   1058             AcpiOsPrintf (" Target: %p", ObjDesc->Reference.Object);
   1059             if (ObjDesc->Reference.Class == ACPI_REFCLASS_TABLE)
   1060             {
   1061                 AcpiOsPrintf (" Table Index: %X\n", ObjDesc->Reference.Value);
   1062             }
   1063             else
   1064             {
   1065                 AcpiOsPrintf (" Target: %p [%s]\n", ObjDesc->Reference.Object,
   1066                     AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *)
   1067                         ObjDesc->Reference.Object)->Common.Type));
   1068             }
   1069         }
   1070         else
   1071         {
   1072             AcpiOsPrintf (" Target: %p\n", ObjDesc->Reference.Object);
   1073         }
   1074     }
   1075 }
   1076 
   1077 
   1078 /*******************************************************************************
   1079  *
   1080  * FUNCTION:    AcpiExDumpPackageObj
   1081  *
   1082  * PARAMETERS:  ObjDesc             - Descriptor to dump
   1083  *              Level               - Indentation Level
   1084  *              Index               - Package index for this object
   1085  *
   1086  * DESCRIPTION: Dumps the elements of the package
   1087  *
   1088  ******************************************************************************/
   1089 
   1090 static void
   1091 AcpiExDumpPackageObj (
   1092     ACPI_OPERAND_OBJECT     *ObjDesc,
   1093     UINT32                  Level,
   1094     UINT32                  Index)
   1095 {
   1096     UINT32                  i;
   1097 
   1098 
   1099     /* Indentation and index output */
   1100 
   1101     if (Level > 0)
   1102     {
   1103         for (i = 0; i < Level; i++)
   1104         {
   1105             AcpiOsPrintf ("  ");
   1106         }
   1107 
   1108         AcpiOsPrintf ("[%.2d] ", Index);
   1109     }
   1110 
   1111     AcpiOsPrintf ("%p ", ObjDesc);
   1112 
   1113     /* Null package elements are allowed */
   1114 
   1115     if (!ObjDesc)
   1116     {
   1117         AcpiOsPrintf ("[Null Object]\n");
   1118         return;
   1119     }
   1120 
   1121     /* Packages may only contain a few object types */
   1122 
   1123     switch (ObjDesc->Common.Type)
   1124     {
   1125     case ACPI_TYPE_INTEGER:
   1126 
   1127         AcpiOsPrintf ("[Integer] = %8.8X%8.8X\n",
   1128             ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
   1129         break;
   1130 
   1131     case ACPI_TYPE_STRING:
   1132 
   1133         AcpiOsPrintf ("[String]  Value: ");
   1134         AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);
   1135         AcpiOsPrintf ("\n");
   1136         break;
   1137 
   1138     case ACPI_TYPE_BUFFER:
   1139 
   1140         AcpiOsPrintf ("[Buffer] Length %.2X = ", ObjDesc->Buffer.Length);
   1141         if (ObjDesc->Buffer.Length)
   1142         {
   1143             AcpiUtDebugDumpBuffer (ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer),
   1144                 ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
   1145         }
   1146         else
   1147         {
   1148             AcpiOsPrintf ("\n");
   1149         }
   1150         break;
   1151 
   1152     case ACPI_TYPE_PACKAGE:
   1153 
   1154         AcpiOsPrintf ("[Package] Contains %u Elements:\n",
   1155             ObjDesc->Package.Count);
   1156 
   1157         for (i = 0; i < ObjDesc->Package.Count; i++)
   1158         {
   1159             AcpiExDumpPackageObj (ObjDesc->Package.Elements[i], Level+1, i);
   1160         }
   1161         break;
   1162 
   1163     case ACPI_TYPE_LOCAL_REFERENCE:
   1164 
   1165         AcpiOsPrintf ("[Object Reference] Type [%s] %2.2X",
   1166             AcpiUtGetReferenceName (ObjDesc),
   1167             ObjDesc->Reference.Class);
   1168         AcpiExDumpReferenceObj (ObjDesc);
   1169         break;
   1170 
   1171     default:
   1172 
   1173         AcpiOsPrintf ("[Unknown Type] %X\n", ObjDesc->Common.Type);
   1174         break;
   1175     }
   1176 }
   1177 
   1178 
   1179 /*******************************************************************************
   1180  *
   1181  * FUNCTION:    AcpiExDumpObjectDescriptor
   1182  *
   1183  * PARAMETERS:  ObjDesc             - Descriptor to dump
   1184  *              Flags               - Force display if TRUE
   1185  *
   1186  * DESCRIPTION: Dumps the members of the object descriptor given.
   1187  *
   1188  ******************************************************************************/
   1189 
   1190 void
   1191 AcpiExDumpObjectDescriptor (
   1192     ACPI_OPERAND_OBJECT     *ObjDesc,
   1193     UINT32                  Flags)
   1194 {
   1195     ACPI_FUNCTION_TRACE (ExDumpObjectDescriptor);
   1196 
   1197 
   1198     if (!ObjDesc)
   1199     {
   1200         return_VOID;
   1201     }
   1202 
   1203     if (!Flags)
   1204     {
   1205         /* Check if debug output enabled */
   1206 
   1207         if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_OBJECTS, _COMPONENT))
   1208         {
   1209             return_VOID;
   1210         }
   1211     }
   1212 
   1213     if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
   1214     {
   1215         AcpiExDumpNamespaceNode ((ACPI_NAMESPACE_NODE *) ObjDesc, Flags);
   1216 
   1217         AcpiOsPrintf ("\nAttached Object (%p):\n",
   1218             ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object);
   1219 
   1220         ObjDesc = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object;
   1221         goto DumpObject;
   1222     }
   1223 
   1224     if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
   1225     {
   1226         AcpiOsPrintf (
   1227             "%p is not an ACPI operand object: [%s]\n",
   1228             ObjDesc, AcpiUtGetDescriptorName (ObjDesc));
   1229         return_VOID;
   1230     }
   1231 
   1232     /* Validate the object type */
   1233 
   1234     if (ObjDesc->Common.Type > ACPI_TYPE_LOCAL_MAX)
   1235     {
   1236         AcpiOsPrintf ("Not a known object type: %2.2X\n",
   1237             ObjDesc->Common.Type);
   1238         return_VOID;
   1239     }
   1240 
   1241 
   1242 DumpObject:
   1243 
   1244     /* Common Fields */
   1245 
   1246     AcpiExDumpObject (ObjDesc, AcpiExDumpCommon);
   1247 
   1248     /* Object-specific fields */
   1249 
   1250     AcpiExDumpObject (ObjDesc, AcpiExDumpInfo[ObjDesc->Common.Type]);
   1251 
   1252     if (ObjDesc->Common.Type == ACPI_TYPE_REGION)
   1253     {
   1254         ObjDesc = ObjDesc->Common.NextObject;
   1255         if (ObjDesc->Common.Type > ACPI_TYPE_LOCAL_MAX)
   1256         {
   1257             AcpiOsPrintf ("Secondary object is not a known object type: %2.2X\n",
   1258                 ObjDesc->Common.Type);
   1259 
   1260             return_VOID;
   1261         }
   1262 
   1263         AcpiOsPrintf ("\nExtra attached Object (%p):\n", ObjDesc);
   1264         AcpiExDumpObject (ObjDesc, AcpiExDumpInfo[ObjDesc->Common.Type]);
   1265     }
   1266 
   1267     return_VOID;
   1268 }
   1269 
   1270 #endif
   1271