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