Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:02

0001 /******************************************************************************
0002  *
0003  * Module Name: exdump - Interpreter debug output routines
0004  *
0005  *****************************************************************************/
0006 
0007 /******************************************************************************
0008  *
0009  * 1. Copyright Notice
0010  *
0011  * Some or all of this work - Copyright (c) 1999 - 2024, Intel Corp.
0012  * All rights reserved.
0013  *
0014  * 2. License
0015  *
0016  * 2.1. This is your license from Intel Corp. under its intellectual property
0017  * rights. You may have additional license terms from the party that provided
0018  * you this software, covering your right to use that party's intellectual
0019  * property rights.
0020  *
0021  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
0022  * copy of the source code appearing in this file ("Covered Code") an
0023  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
0024  * base code distributed originally by Intel ("Original Intel Code") to copy,
0025  * make derivatives, distribute, use and display any portion of the Covered
0026  * Code in any form, with the right to sublicense such rights; and
0027  *
0028  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
0029  * license (with the right to sublicense), under only those claims of Intel
0030  * patents that are infringed by the Original Intel Code, to make, use, sell,
0031  * offer to sell, and import the Covered Code and derivative works thereof
0032  * solely to the minimum extent necessary to exercise the above copyright
0033  * license, and in no event shall the patent license extend to any additions
0034  * to or modifications of the Original Intel Code. No other license or right
0035  * is granted directly or by implication, estoppel or otherwise;
0036  *
0037  * The above copyright and patent license is granted only if the following
0038  * conditions are met:
0039  *
0040  * 3. Conditions
0041  *
0042  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
0043  * Redistribution of source code of any substantial portion of the Covered
0044  * Code or modification with rights to further distribute source must include
0045  * the above Copyright Notice, the above License, this list of Conditions,
0046  * and the following Disclaimer and Export Compliance provision. In addition,
0047  * Licensee must cause all Covered Code to which Licensee contributes to
0048  * contain a file documenting the changes Licensee made to create that Covered
0049  * Code and the date of any change. Licensee must include in that file the
0050  * documentation of any changes made by any predecessor Licensee. Licensee
0051  * must include a prominent statement that the modification is derived,
0052  * directly or indirectly, from Original Intel Code.
0053  *
0054  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
0055  * Redistribution of source code of any substantial portion of the Covered
0056  * Code or modification without rights to further distribute source must
0057  * include the following Disclaimer and Export Compliance provision in the
0058  * documentation and/or other materials provided with distribution. In
0059  * addition, Licensee may not authorize further sublicense of source of any
0060  * portion of the Covered Code, and must include terms to the effect that the
0061  * license from Licensee to its licensee is limited to the intellectual
0062  * property embodied in the software Licensee provides to its licensee, and
0063  * not to intellectual property embodied in modifications its licensee may
0064  * make.
0065  *
0066  * 3.3. Redistribution of Executable. Redistribution in executable form of any
0067  * substantial portion of the Covered Code or modification must reproduce the
0068  * above Copyright Notice, and the following Disclaimer and Export Compliance
0069  * provision in the documentation and/or other materials provided with the
0070  * distribution.
0071  *
0072  * 3.4. Intel retains all right, title, and interest in and to the Original
0073  * Intel Code.
0074  *
0075  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
0076  * Intel shall be used in advertising or otherwise to promote the sale, use or
0077  * other dealings in products derived from or relating to the Covered Code
0078  * without prior written authorization from Intel.
0079  *
0080  * 4. Disclaimer and Export Compliance
0081  *
0082  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
0083  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
0084  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
0085  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
0086  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
0087  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
0088  * PARTICULAR PURPOSE.
0089  *
0090  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
0091  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
0092  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
0093  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
0094  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
0095  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
0096  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
0097  * LIMITED REMEDY.
0098  *
0099  * 4.3. Licensee shall not export, either directly or indirectly, any of this
0100  * software or system incorporating such software without first obtaining any
0101  * required license or other approval from the U. S. Department of Commerce or
0102  * any other agency or department of the United States Government. In the
0103  * event Licensee exports any such software from the United States or
0104  * re-exports any such software from a foreign destination, Licensee shall
0105  * ensure that the distribution and export/re-export of the software is in
0106  * compliance with all laws, regulations, orders, or other restrictions of the
0107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
0108  * any of its subsidiaries will export/re-export any technical data, process,
0109  * software, or service, directly or indirectly, to any country for which the
0110  * United States government or any agency thereof requires an export license,
0111  * other governmental approval, or letter of assurance, without first obtaining
0112  * such license, approval or letter.
0113  *
0114  *****************************************************************************
0115  *
0116  * Alternatively, you may choose to be licensed under the terms of the
0117  * following license:
0118  *
0119  * Redistribution and use in source and binary forms, with or without
0120  * modification, are permitted provided that the following conditions
0121  * are met:
0122  * 1. Redistributions of source code must retain the above copyright
0123  *    notice, this list of conditions, and the following disclaimer,
0124  *    without modification.
0125  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
0126  *    substantially similar to the "NO WARRANTY" disclaimer below
0127  *    ("Disclaimer") and any redistribution must be conditioned upon
0128  *    including a substantially similar Disclaimer requirement for further
0129  *    binary redistribution.
0130  * 3. Neither the names of the above-listed copyright holders nor the names
0131  *    of any contributors may be used to endorse or promote products derived
0132  *    from this software without specific prior written permission.
0133  *
0134  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0135  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0136  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0137  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0138  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0139  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0140  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0141  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0142  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0143  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0144  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0145  *
0146  * Alternatively, you may choose to be licensed under the terms of the
0147  * GNU General Public License ("GPL") version 2 as published by the Free
0148  * Software Foundation.
0149  *
0150  *****************************************************************************/
0151 
0152 #include "acpi.h"
0153 #include "accommon.h"
0154 #include "acinterp.h"
0155 #include "amlcode.h"
0156 #include "acnamesp.h"
0157 
0158 
0159 #define _COMPONENT          ACPI_EXECUTER
0160         ACPI_MODULE_NAME    ("exdump")
0161 
0162 /*
0163  * The following routines are used for debug output only
0164  */
0165 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
0166 
0167 /* Local prototypes */
0168 
0169 static void
0170 AcpiExOutString (
0171     const char              *Title,
0172     const char              *Value);
0173 
0174 static void
0175 AcpiExOutPointer (
0176     const char              *Title,
0177     const void              *Value);
0178 
0179 static void
0180 AcpiExDumpObject (
0181     ACPI_OPERAND_OBJECT     *ObjDesc,
0182     ACPI_EXDUMP_INFO        *Info);
0183 
0184 static void
0185 AcpiExDumpReferenceObj (
0186     ACPI_OPERAND_OBJECT     *ObjDesc);
0187 
0188 static void
0189 AcpiExDumpPackageObj (
0190     ACPI_OPERAND_OBJECT     *ObjDesc,
0191     UINT32                  Level,
0192     UINT32                  Index);
0193 
0194 
0195 /*******************************************************************************
0196  *
0197  * Object Descriptor info tables
0198  *
0199  * Note: The first table entry must be an INIT opcode and must contain
0200  * the table length (number of table entries)
0201  *
0202  ******************************************************************************/
0203 
0204 static ACPI_EXDUMP_INFO     AcpiExDumpInteger[2] =
0205 {
0206     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpInteger),        NULL},
0207     {ACPI_EXD_UINT64,   ACPI_EXD_OFFSET (Integer.Value),                "Value"}
0208 };
0209 
0210 static ACPI_EXDUMP_INFO     AcpiExDumpString[4] =
0211 {
0212     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpString),         NULL},
0213     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (String.Length),                "Length"},
0214     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (String.Pointer),               "Pointer"},
0215     {ACPI_EXD_STRING,   0,                                              NULL}
0216 };
0217 
0218 static ACPI_EXDUMP_INFO     AcpiExDumpBuffer[5] =
0219 {
0220     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpBuffer),         NULL},
0221     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (Buffer.Length),                "Length"},
0222     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Buffer.Pointer),               "Pointer"},
0223     {ACPI_EXD_NODE,     ACPI_EXD_OFFSET (Buffer.Node),                  "Parent Node"},
0224     {ACPI_EXD_BUFFER,   0,                                              NULL}
0225 };
0226 
0227 static ACPI_EXDUMP_INFO     AcpiExDumpPackage[6] =
0228 {
0229     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpPackage),        NULL},
0230     {ACPI_EXD_NODE,     ACPI_EXD_OFFSET (Package.Node),                 "Parent Node"},
0231     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Package.Flags),                "Flags"},
0232     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (Package.Count),                "Element Count"},
0233     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Package.Elements),             "Element List"},
0234     {ACPI_EXD_PACKAGE,  0,                                              NULL}
0235 };
0236 
0237 static ACPI_EXDUMP_INFO     AcpiExDumpDevice[4] =
0238 {
0239     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpDevice),         NULL},
0240     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Device.NotifyList[0]),         "System Notify"},
0241     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Device.NotifyList[1]),         "Device Notify"},
0242     {ACPI_EXD_HDLR_LIST,ACPI_EXD_OFFSET (Device.Handler),               "Handler"}
0243 };
0244 
0245 static ACPI_EXDUMP_INFO     AcpiExDumpEvent[2] =
0246 {
0247     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpEvent),          NULL},
0248     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Event.OsSemaphore),            "OsSemaphore"}
0249 };
0250 
0251 static ACPI_EXDUMP_INFO     AcpiExDumpMethod[9] =
0252 {
0253     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpMethod),         NULL},
0254     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Method.InfoFlags),             "Info Flags"},
0255     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Method.ParamCount),            "Parameter Count"},
0256     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Method.SyncLevel),             "Sync Level"},
0257     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Method.Mutex),                 "Mutex"},
0258     {ACPI_EXD_UINT16,   ACPI_EXD_OFFSET (Method.OwnerId),               "Owner Id"},
0259     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Method.ThreadCount),           "Thread Count"},
0260     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (Method.AmlLength),             "Aml Length"},
0261     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Method.AmlStart),              "Aml Start"}
0262 };
0263 
0264 static ACPI_EXDUMP_INFO     AcpiExDumpMutex[6] =
0265 {
0266     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpMutex),          NULL},
0267     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Mutex.SyncLevel),              "Sync Level"},
0268     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Mutex.OriginalSyncLevel),      "Original Sync Level"},
0269     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Mutex.OwnerThread),            "Owner Thread"},
0270     {ACPI_EXD_UINT16,   ACPI_EXD_OFFSET (Mutex.AcquisitionDepth),       "Acquire Depth"},
0271     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Mutex.OsMutex),                "OsMutex"}
0272 };
0273 
0274 static ACPI_EXDUMP_INFO     AcpiExDumpRegion[8] =
0275 {
0276     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpRegion),         NULL},
0277     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Region.SpaceId),               "Space Id"},
0278     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Region.Flags),                 "Flags"},
0279     {ACPI_EXD_NODE,     ACPI_EXD_OFFSET (Region.Node),                  "Parent Node"},
0280     {ACPI_EXD_ADDRESS,  ACPI_EXD_OFFSET (Region.Address),               "Address"},
0281     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (Region.Length),                "Length"},
0282     {ACPI_EXD_HDLR_LIST,ACPI_EXD_OFFSET (Region.Handler),               "Handler"},
0283     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Region.Next),                  "Next"}
0284 };
0285 
0286 static ACPI_EXDUMP_INFO     AcpiExDumpPower[6] =
0287 {
0288     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpPower),          NULL},
0289     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (PowerResource.SystemLevel),    "System Level"},
0290     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (PowerResource.ResourceOrder),  "Resource Order"},
0291     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (PowerResource.NotifyList[0]),  "System Notify"},
0292     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (PowerResource.NotifyList[1]),  "Device Notify"},
0293     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (PowerResource.Handler),        "Handler"}
0294 };
0295 
0296 static ACPI_EXDUMP_INFO     AcpiExDumpProcessor[7] =
0297 {
0298     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpProcessor),      NULL},
0299     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Processor.ProcId),             "Processor ID"},
0300     {ACPI_EXD_UINT8 ,   ACPI_EXD_OFFSET (Processor.Length),             "Length"},
0301     {ACPI_EXD_ADDRESS,  ACPI_EXD_OFFSET (Processor.Address),            "Address"},
0302     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Processor.NotifyList[0]),      "System Notify"},
0303     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Processor.NotifyList[1]),      "Device Notify"},
0304     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Processor.Handler),            "Handler"}
0305 };
0306 
0307 static ACPI_EXDUMP_INFO     AcpiExDumpThermal[4] =
0308 {
0309     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpThermal),        NULL},
0310     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (ThermalZone.NotifyList[0]),    "System Notify"},
0311     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (ThermalZone.NotifyList[1]),    "Device Notify"},
0312     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (ThermalZone.Handler),          "Handler"}
0313 };
0314 
0315 static ACPI_EXDUMP_INFO     AcpiExDumpBufferField[3] =
0316 {
0317     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpBufferField),    NULL},
0318     {ACPI_EXD_FIELD,    0,                                              NULL},
0319     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (BufferField.BufferObj),        "Buffer Object"}
0320 };
0321 
0322 static ACPI_EXDUMP_INFO     AcpiExDumpRegionField[5] =
0323 {
0324     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpRegionField),    NULL},
0325     {ACPI_EXD_FIELD,    0,                                              NULL},
0326     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Field.AccessLength),           "AccessLength"},
0327     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Field.RegionObj),              "Region Object"},
0328     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Field.ResourceBuffer),         "ResourceBuffer"}
0329 };
0330 
0331 static ACPI_EXDUMP_INFO     AcpiExDumpBankField[5] =
0332 {
0333     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpBankField),      NULL},
0334     {ACPI_EXD_FIELD,    0,                                              NULL},
0335     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (BankField.Value),              "Value"},
0336     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (BankField.RegionObj),          "Region Object"},
0337     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (BankField.BankObj),            "Bank Object"}
0338 };
0339 
0340 static ACPI_EXDUMP_INFO     AcpiExDumpIndexField[5] =
0341 {
0342     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpBankField),      NULL},
0343     {ACPI_EXD_FIELD,    0,                                              NULL},
0344     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (IndexField.Value),             "Value"},
0345     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (IndexField.IndexObj),          "Index Object"},
0346     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (IndexField.DataObj),           "Data Object"}
0347 };
0348 
0349 static ACPI_EXDUMP_INFO     AcpiExDumpReference[9] =
0350 {
0351     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpReference),       NULL},
0352     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Reference.Class),              "Class"},
0353     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Reference.TargetType),         "Target Type"},
0354     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (Reference.Value),              "Value"},
0355     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Reference.Object),             "Object Desc"},
0356     {ACPI_EXD_NODE,     ACPI_EXD_OFFSET (Reference.Node),               "Node"},
0357     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Reference.Where),              "Where"},
0358     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Reference.IndexPointer),       "Index Pointer"},
0359     {ACPI_EXD_REFERENCE,0,                                              NULL}
0360 };
0361 
0362 static ACPI_EXDUMP_INFO     AcpiExDumpAddressHandler[6] =
0363 {
0364     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpAddressHandler), NULL},
0365     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (AddressSpace.SpaceId),         "Space Id"},
0366     {ACPI_EXD_HDLR_LIST,ACPI_EXD_OFFSET (AddressSpace.Next),            "Next"},
0367     {ACPI_EXD_RGN_LIST, ACPI_EXD_OFFSET (AddressSpace.RegionList),      "Region List"},
0368     {ACPI_EXD_NODE,     ACPI_EXD_OFFSET (AddressSpace.Node),            "Node"},
0369     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (AddressSpace.Context),         "Context"}
0370 };
0371 
0372 static ACPI_EXDUMP_INFO     AcpiExDumpNotify[7] =
0373 {
0374     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpNotify),         NULL},
0375     {ACPI_EXD_NODE,     ACPI_EXD_OFFSET (Notify.Node),                  "Node"},
0376     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (Notify.HandlerType),           "Handler Type"},
0377     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Notify.Handler),               "Handler"},
0378     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Notify.Context),               "Context"},
0379     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Notify.Next[0]),               "Next System Notify"},
0380     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Notify.Next[1]),               "Next Device Notify"}
0381 };
0382 
0383 static ACPI_EXDUMP_INFO     AcpiExDumpExtra[6] =
0384 {
0385     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpExtra),          NULL},
0386     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Extra.Method_REG),             "_REG Method"},
0387     {ACPI_EXD_NODE,     ACPI_EXD_OFFSET (Extra.ScopeNode),              "Scope Node"},
0388     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Extra.RegionContext),          "Region Context"},
0389     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Extra.AmlStart),               "Aml Start"},
0390     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (Extra.AmlLength),              "Aml Length"}
0391 };
0392 
0393 static ACPI_EXDUMP_INFO     AcpiExDumpData[3] =
0394 {
0395     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpData),           NULL},
0396     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Data.Handler),                 "Handler"},
0397     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Data.Pointer),                 "Raw Data"}
0398 };
0399 
0400 /* Miscellaneous tables */
0401 
0402 static ACPI_EXDUMP_INFO     AcpiExDumpCommon[5] =
0403 {
0404     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpCommon),         NULL},
0405     {ACPI_EXD_TYPE ,    0,                                              NULL},
0406     {ACPI_EXD_UINT16,   ACPI_EXD_OFFSET (Common.ReferenceCount),        "Reference Count"},
0407     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Common.Flags),                 "Flags"},
0408     {ACPI_EXD_LIST,     ACPI_EXD_OFFSET (Common.NextObject),            "Object List"}
0409 };
0410 
0411 static ACPI_EXDUMP_INFO     AcpiExDumpFieldCommon[7] =
0412 {
0413     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpFieldCommon),    NULL},
0414     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (CommonField.FieldFlags),       "Field Flags"},
0415     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (CommonField.AccessByteWidth),  "Access Byte Width"},
0416     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (CommonField.BitLength),        "Bit Length"},
0417     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (CommonField.StartFieldBitOffset),"Field Bit Offset"},
0418     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (CommonField.BaseByteOffset),   "Base Byte Offset"},
0419     {ACPI_EXD_NODE,     ACPI_EXD_OFFSET (CommonField.Node),             "Parent Node"}
0420 };
0421 
0422 static ACPI_EXDUMP_INFO     AcpiExDumpNode[7] =
0423 {
0424     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpNode),           NULL},
0425     {ACPI_EXD_UINT16,   ACPI_EXD_NSOFFSET (Flags),                      "Flags"},
0426     {ACPI_EXD_UINT16,   ACPI_EXD_NSOFFSET (OwnerId),                    "Owner Id"},
0427     {ACPI_EXD_LIST,     ACPI_EXD_NSOFFSET (Object),                     "Object List"},
0428     {ACPI_EXD_NODE,     ACPI_EXD_NSOFFSET (Parent),                     "Parent"},
0429     {ACPI_EXD_NODE,     ACPI_EXD_NSOFFSET (Child),                      "Child"},
0430     {ACPI_EXD_NODE,     ACPI_EXD_NSOFFSET (Peer),                       "Peer"}
0431 };
0432 
0433 
0434 /* Dispatch table, indexed by object type */
0435 
0436 static ACPI_EXDUMP_INFO     *AcpiExDumpInfo[] =
0437 {
0438     NULL,
0439     AcpiExDumpInteger,
0440     AcpiExDumpString,
0441     AcpiExDumpBuffer,
0442     AcpiExDumpPackage,
0443     NULL,
0444     AcpiExDumpDevice,
0445     AcpiExDumpEvent,
0446     AcpiExDumpMethod,
0447     AcpiExDumpMutex,
0448     AcpiExDumpRegion,
0449     AcpiExDumpPower,
0450     AcpiExDumpProcessor,
0451     AcpiExDumpThermal,
0452     AcpiExDumpBufferField,
0453     NULL,
0454     NULL,
0455     AcpiExDumpRegionField,
0456     AcpiExDumpBankField,
0457     AcpiExDumpIndexField,
0458     AcpiExDumpReference,
0459     NULL,
0460     NULL,
0461     AcpiExDumpNotify,
0462     AcpiExDumpAddressHandler,
0463     NULL,
0464     NULL,
0465     NULL,
0466     AcpiExDumpExtra,
0467     AcpiExDumpData
0468 };
0469 
0470 
0471 /*******************************************************************************
0472  *
0473  * FUNCTION:    AcpiExDumpObject
0474  *
0475  * PARAMETERS:  ObjDesc             - Descriptor to dump
0476  *              Info                - Info table corresponding to this object
0477  *                                    type
0478  *
0479  * RETURN:      None
0480  *
0481  * DESCRIPTION: Walk the info table for this object
0482  *
0483  ******************************************************************************/
0484 
0485 static void
0486 AcpiExDumpObject (
0487     ACPI_OPERAND_OBJECT     *ObjDesc,
0488     ACPI_EXDUMP_INFO        *Info)
0489 {
0490     UINT8                   *Target;
0491     const char              *Name;
0492     UINT8                   Count;
0493     ACPI_OPERAND_OBJECT     *Start;
0494     ACPI_OPERAND_OBJECT     *Data = NULL;
0495     ACPI_OPERAND_OBJECT     *Next;
0496     ACPI_NAMESPACE_NODE     *Node;
0497 
0498 
0499     if (!Info)
0500     {
0501         AcpiOsPrintf (
0502             "ExDumpObject: Display not implemented for object type %s\n",
0503             AcpiUtGetObjectTypeName (ObjDesc));
0504         return;
0505     }
0506 
0507     /* First table entry must contain the table length (# of table entries) */
0508 
0509     Count = Info->Offset;
0510 
0511     while (Count)
0512     {
0513         if (!ObjDesc)
0514         {
0515             return;
0516         }
0517 
0518         Target = ACPI_ADD_PTR (UINT8, ObjDesc, Info->Offset);
0519         Name = Info->Name;
0520 
0521         switch (Info->Opcode)
0522         {
0523         case ACPI_EXD_INIT:
0524 
0525             break;
0526 
0527         case ACPI_EXD_TYPE:
0528 
0529             AcpiOsPrintf ("%20s : %2.2X [%s]\n", "Type",
0530                 ObjDesc->Common.Type,
0531                 AcpiUtGetObjectTypeName (ObjDesc));
0532             break;
0533 
0534         case ACPI_EXD_UINT8:
0535 
0536             AcpiOsPrintf ("%20s : %2.2X\n", Name, *Target);
0537             break;
0538 
0539         case ACPI_EXD_UINT16:
0540 
0541             AcpiOsPrintf ("%20s : %4.4X\n", Name, ACPI_GET16 (Target));
0542             break;
0543 
0544         case ACPI_EXD_UINT32:
0545 
0546             AcpiOsPrintf ("%20s : %8.8X\n", Name, ACPI_GET32 (Target));
0547             break;
0548 
0549         case ACPI_EXD_UINT64:
0550 
0551             AcpiOsPrintf ("%20s : %8.8X%8.8X\n", "Value",
0552                 ACPI_FORMAT_UINT64 (ACPI_GET64 (Target)));
0553             break;
0554 
0555         case ACPI_EXD_POINTER:
0556         case ACPI_EXD_ADDRESS:
0557 
0558             AcpiExOutPointer (Name, *ACPI_CAST_PTR (void *, Target));
0559             break;
0560 
0561         case ACPI_EXD_STRING:
0562 
0563             AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);
0564             AcpiOsPrintf ("\n");
0565             break;
0566 
0567         case ACPI_EXD_BUFFER:
0568 
0569             ACPI_DUMP_BUFFER (
0570                 ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length);
0571             break;
0572 
0573         case ACPI_EXD_PACKAGE:
0574 
0575             /* Dump the package contents */
0576 
0577             AcpiOsPrintf ("\nPackage Contents:\n");
0578             AcpiExDumpPackageObj (ObjDesc, 0, 0);
0579             break;
0580 
0581         case ACPI_EXD_FIELD:
0582 
0583             AcpiExDumpObject (ObjDesc, AcpiExDumpFieldCommon);
0584             break;
0585 
0586         case ACPI_EXD_REFERENCE:
0587 
0588             AcpiExOutString ("Class Name", AcpiUtGetReferenceName (ObjDesc));
0589             AcpiExDumpReferenceObj (ObjDesc);
0590             break;
0591 
0592         case ACPI_EXD_LIST:
0593 
0594             Start = *ACPI_CAST_PTR (void *, Target);
0595             Next = Start;
0596 
0597             AcpiOsPrintf ("%20s : %p ", Name, Next);
0598             if (Next)
0599             {
0600                 AcpiOsPrintf ("%s (Type %2.2X)",
0601                     AcpiUtGetObjectTypeName (Next), Next->Common.Type);
0602 
0603                 while (Next->Common.NextObject)
0604                 {
0605                     if ((Next->Common.Type == ACPI_TYPE_LOCAL_DATA) &&
0606                         !Data)
0607                     {
0608                         Data = Next;
0609                     }
0610 
0611                     Next = Next->Common.NextObject;
0612                     AcpiOsPrintf ("->%p(%s %2.2X)", Next,
0613                         AcpiUtGetObjectTypeName (Next), Next->Common.Type);
0614 
0615                     if ((Next == Start) || (Next == Data))
0616                     {
0617                         AcpiOsPrintf (
0618                             "\n**** Error: Object list appears to be circular linked");
0619                         break;
0620                     }
0621                 }
0622             }
0623             else
0624             {
0625                 AcpiOsPrintf ("- No attached objects");
0626             }
0627 
0628             AcpiOsPrintf ("\n");
0629             break;
0630 
0631         case ACPI_EXD_HDLR_LIST:
0632 
0633             Start = *ACPI_CAST_PTR (void *, Target);
0634             Next = Start;
0635 
0636             AcpiOsPrintf ("%20s : %p", Name, Next);
0637             if (Next)
0638             {
0639                 AcpiOsPrintf ("(%s %2.2X)",
0640                     AcpiUtGetObjectTypeName (Next),
0641                     Next->AddressSpace.SpaceId);
0642 
0643                 while (Next->AddressSpace.Next)
0644                 {
0645                     if ((Next->Common.Type == ACPI_TYPE_LOCAL_DATA) &&
0646                         !Data)
0647                     {
0648                         Data = Next;
0649                     }
0650 
0651                     Next = Next->AddressSpace.Next;
0652                     AcpiOsPrintf ("->%p(%s %2.2X)", Next,
0653                         AcpiUtGetObjectTypeName (Next),
0654                         Next->AddressSpace.SpaceId);
0655 
0656                     if ((Next == Start) || (Next == Data))
0657                     {
0658                         AcpiOsPrintf (
0659                             "\n**** Error: Handler list appears to be circular linked");
0660                         break;
0661                     }
0662                 }
0663             }
0664 
0665             AcpiOsPrintf ("\n");
0666             break;
0667 
0668         case ACPI_EXD_RGN_LIST:
0669 
0670             Start = *ACPI_CAST_PTR (void *, Target);
0671             Next = Start;
0672 
0673             AcpiOsPrintf ("%20s : %p", Name, Next);
0674             if (Next)
0675             {
0676                 AcpiOsPrintf ("(%s %2.2X)",
0677                     AcpiUtGetObjectTypeName (Next), Next->Common.Type);
0678 
0679                 while (Next->Region.Next)
0680                 {
0681                     if ((Next->Common.Type == ACPI_TYPE_LOCAL_DATA) &&
0682                         !Data)
0683                     {
0684                         Data = Next;
0685                     }
0686 
0687                     Next = Next->Region.Next;
0688                     AcpiOsPrintf ("->%p(%s %2.2X)", Next,
0689                         AcpiUtGetObjectTypeName (Next), Next->Common.Type);
0690 
0691                     if ((Next == Start) || (Next == Data))
0692                     {
0693                         AcpiOsPrintf (
0694                             "\n**** Error: Region list appears to be circular linked");
0695                         break;
0696                     }
0697                 }
0698             }
0699 
0700             AcpiOsPrintf ("\n");
0701             break;
0702 
0703         case ACPI_EXD_NODE:
0704 
0705             Node = *ACPI_CAST_PTR (ACPI_NAMESPACE_NODE *, Target);
0706 
0707             AcpiOsPrintf ("%20s : %p", Name, Node);
0708             if (Node)
0709             {
0710                 AcpiOsPrintf (" [%4.4s]", Node->Name.Ascii);
0711             }
0712             AcpiOsPrintf ("\n");
0713             break;
0714 
0715         default:
0716 
0717             AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n",
0718                 Info->Opcode);
0719             return;
0720         }
0721 
0722         Info++;
0723         Count--;
0724     }
0725 }
0726 
0727 
0728 /*******************************************************************************
0729  *
0730  * FUNCTION:    AcpiExDumpOperand
0731  *
0732  * PARAMETERS:  *ObjDesc        - Pointer to entry to be dumped
0733  *              Depth           - Current nesting depth
0734  *
0735  * RETURN:      None
0736  *
0737  * DESCRIPTION: Dump an operand object
0738  *
0739  ******************************************************************************/
0740 
0741 void
0742 AcpiExDumpOperand (
0743     ACPI_OPERAND_OBJECT     *ObjDesc,
0744     UINT32                  Depth)
0745 {
0746     UINT32                  Length;
0747     UINT32                  Index;
0748 
0749 
0750     ACPI_FUNCTION_NAME (ExDumpOperand);
0751 
0752 
0753     /* Check if debug output enabled */
0754 
0755     if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_EXEC, _COMPONENT))
0756     {
0757         return;
0758     }
0759 
0760     if (!ObjDesc)
0761     {
0762         /* This could be a null element of a package */
0763 
0764         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n"));
0765         return;
0766     }
0767 
0768     if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
0769     {
0770         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p Namespace Node: ", ObjDesc));
0771         ACPI_DUMP_ENTRY (ObjDesc, ACPI_LV_EXEC);
0772         return;
0773     }
0774 
0775     if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
0776     {
0777         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
0778             "%p is not a node or operand object: [%s]\n",
0779             ObjDesc, AcpiUtGetDescriptorName (ObjDesc)));
0780         ACPI_DUMP_BUFFER (ObjDesc, sizeof (ACPI_OPERAND_OBJECT));
0781         return;
0782     }
0783 
0784     /* ObjDesc is a valid object */
0785 
0786     if (Depth > 0)
0787     {
0788         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%*s[%u] %p Refs=%u ",
0789             Depth, " ", Depth, ObjDesc, ObjDesc->Common.ReferenceCount));
0790     }
0791     else
0792     {
0793         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p Refs=%u ",
0794             ObjDesc, ObjDesc->Common.ReferenceCount));
0795     }
0796 
0797     /* Decode object type */
0798 
0799     switch (ObjDesc->Common.Type)
0800     {
0801     case ACPI_TYPE_LOCAL_REFERENCE:
0802 
0803         AcpiOsPrintf ("Reference: [%s] ",
0804             AcpiUtGetReferenceName (ObjDesc));
0805 
0806         switch (ObjDesc->Reference.Class)
0807         {
0808         case ACPI_REFCLASS_DEBUG:
0809 
0810             AcpiOsPrintf ("\n");
0811             break;
0812 
0813         case ACPI_REFCLASS_INDEX:
0814 
0815             AcpiOsPrintf ("%p\n", ObjDesc->Reference.Object);
0816             break;
0817 
0818         case ACPI_REFCLASS_TABLE:
0819 
0820             AcpiOsPrintf ("Table Index %X\n", ObjDesc->Reference.Value);
0821             break;
0822 
0823         case ACPI_REFCLASS_REFOF:
0824 
0825             AcpiOsPrintf ("%p [%s]\n", ObjDesc->Reference.Object,
0826                 AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *)
0827                     ObjDesc->Reference.Object)->Common.Type));
0828             break;
0829 
0830         case ACPI_REFCLASS_NAME:
0831 
0832             AcpiUtRepairName (ObjDesc->Reference.Node->Name.Ascii);
0833             AcpiOsPrintf ("- [%4.4s] (Node %p)\n",
0834                 ObjDesc->Reference.Node->Name.Ascii,
0835                 ObjDesc->Reference.Node);
0836             break;
0837 
0838         case ACPI_REFCLASS_ARG:
0839         case ACPI_REFCLASS_LOCAL:
0840 
0841             AcpiOsPrintf ("%X\n", ObjDesc->Reference.Value);
0842             break;
0843 
0844         default:    /* Unknown reference class */
0845 
0846             AcpiOsPrintf ("%2.2X\n", ObjDesc->Reference.Class);
0847             break;
0848         }
0849         break;
0850 
0851     case ACPI_TYPE_BUFFER:
0852 
0853         AcpiOsPrintf ("Buffer length %.2X @ %p\n",
0854             ObjDesc->Buffer.Length, ObjDesc->Buffer.Pointer);
0855 
0856         /* Debug only -- dump the buffer contents */
0857 
0858         if (ObjDesc->Buffer.Pointer)
0859         {
0860             Length = ObjDesc->Buffer.Length;
0861             if (Length > 128)
0862             {
0863                 Length = 128;
0864             }
0865 
0866             AcpiOsPrintf (
0867                 "Buffer Contents: (displaying length 0x%.2X)\n", Length);
0868             ACPI_DUMP_BUFFER (ObjDesc->Buffer.Pointer, Length);
0869         }
0870         break;
0871 
0872     case ACPI_TYPE_INTEGER:
0873 
0874         AcpiOsPrintf ("Integer %8.8X%8.8X\n",
0875             ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
0876         break;
0877 
0878     case ACPI_TYPE_PACKAGE:
0879 
0880         AcpiOsPrintf ("Package [Len %X] ElementArray %p\n",
0881             ObjDesc->Package.Count, ObjDesc->Package.Elements);
0882 
0883         /*
0884          * If elements exist, package element pointer is valid,
0885          * and debug_level exceeds 1, dump package's elements.
0886          */
0887         if (ObjDesc->Package.Count &&
0888             ObjDesc->Package.Elements &&
0889             AcpiDbgLevel > 1)
0890         {
0891             for (Index = 0; Index < ObjDesc->Package.Count; Index++)
0892             {
0893                 AcpiExDumpOperand (
0894                     ObjDesc->Package.Elements[Index], Depth + 1);
0895             }
0896         }
0897         break;
0898 
0899     case ACPI_TYPE_REGION:
0900 
0901         AcpiOsPrintf ("Region %s (%X)",
0902             AcpiUtGetRegionName (ObjDesc->Region.SpaceId),
0903             ObjDesc->Region.SpaceId);
0904 
0905         /*
0906          * If the address and length have not been evaluated,
0907          * don't print them.
0908          */
0909         if (!(ObjDesc->Region.Flags & AOPOBJ_DATA_VALID))
0910         {
0911             AcpiOsPrintf ("\n");
0912         }
0913         else
0914         {
0915             AcpiOsPrintf (" base %8.8X%8.8X Length %X\n",
0916                 ACPI_FORMAT_UINT64 (ObjDesc->Region.Address),
0917                 ObjDesc->Region.Length);
0918         }
0919         break;
0920 
0921     case ACPI_TYPE_STRING:
0922 
0923         AcpiOsPrintf ("String length %X @ %p ",
0924             ObjDesc->String.Length,
0925             ObjDesc->String.Pointer);
0926 
0927         AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);
0928         AcpiOsPrintf ("\n");
0929         break;
0930 
0931     case ACPI_TYPE_LOCAL_BANK_FIELD:
0932 
0933         AcpiOsPrintf ("BankField\n");
0934         break;
0935 
0936     case ACPI_TYPE_LOCAL_REGION_FIELD:
0937 
0938         AcpiOsPrintf ("RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at "
0939             "byte=%X bit=%X of below:\n",
0940             ObjDesc->Field.BitLength,
0941             ObjDesc->Field.AccessByteWidth,
0942             ObjDesc->Field.FieldFlags & AML_FIELD_LOCK_RULE_MASK,
0943             ObjDesc->Field.FieldFlags & AML_FIELD_UPDATE_RULE_MASK,
0944             ObjDesc->Field.BaseByteOffset,
0945             ObjDesc->Field.StartFieldBitOffset);
0946 
0947         AcpiExDumpOperand (ObjDesc->Field.RegionObj, Depth + 1);
0948         break;
0949 
0950     case ACPI_TYPE_LOCAL_INDEX_FIELD:
0951 
0952         AcpiOsPrintf ("IndexField\n");
0953         break;
0954 
0955     case ACPI_TYPE_BUFFER_FIELD:
0956 
0957         AcpiOsPrintf ("BufferField: %X bits at byte %X bit %X of\n",
0958             ObjDesc->BufferField.BitLength,
0959             ObjDesc->BufferField.BaseByteOffset,
0960             ObjDesc->BufferField.StartFieldBitOffset);
0961 
0962         if (!ObjDesc->BufferField.BufferObj)
0963         {
0964             ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL*\n"));
0965         }
0966         else if ((ObjDesc->BufferField.BufferObj)->Common.Type !=
0967             ACPI_TYPE_BUFFER)
0968         {
0969             AcpiOsPrintf ("*not a Buffer*\n");
0970         }
0971         else
0972         {
0973             AcpiExDumpOperand (ObjDesc->BufferField.BufferObj, Depth + 1);
0974         }
0975         break;
0976 
0977     case ACPI_TYPE_EVENT:
0978 
0979         AcpiOsPrintf ("Event\n");
0980         break;
0981 
0982     case ACPI_TYPE_METHOD:
0983 
0984         AcpiOsPrintf ("Method(%X) @ %p:%X\n",
0985             ObjDesc->Method.ParamCount,
0986             ObjDesc->Method.AmlStart,
0987             ObjDesc->Method.AmlLength);
0988         break;
0989 
0990     case ACPI_TYPE_MUTEX:
0991 
0992         AcpiOsPrintf ("Mutex\n");
0993         break;
0994 
0995     case ACPI_TYPE_DEVICE:
0996 
0997         AcpiOsPrintf ("Device\n");
0998         break;
0999 
1000     case ACPI_TYPE_POWER:
1001 
1002         AcpiOsPrintf ("Power\n");
1003         break;
1004 
1005     case ACPI_TYPE_PROCESSOR:
1006 
1007         AcpiOsPrintf ("Processor\n");
1008         break;
1009 
1010     case ACPI_TYPE_THERMAL:
1011 
1012         AcpiOsPrintf ("Thermal\n");
1013         break;
1014 
1015     default:
1016 
1017         /* Unknown Type */
1018 
1019         AcpiOsPrintf ("Unknown Type %X\n", ObjDesc->Common.Type);
1020         break;
1021     }
1022 
1023     return;
1024 }
1025 
1026 
1027 /*******************************************************************************
1028  *
1029  * FUNCTION:    AcpiExDumpOperands
1030  *
1031  * PARAMETERS:  Operands            - A list of Operand objects
1032  *              OpcodeName          - AML opcode name
1033  *              NumOperands         - Operand count for this opcode
1034  *
1035  * DESCRIPTION: Dump the operands associated with the opcode
1036  *
1037  ******************************************************************************/
1038 
1039 void
1040 AcpiExDumpOperands (
1041     ACPI_OPERAND_OBJECT     **Operands,
1042     const char              *OpcodeName,
1043     UINT32                  NumOperands)
1044 {
1045     ACPI_FUNCTION_TRACE (ExDumpOperands);
1046 
1047 
1048     if (!OpcodeName)
1049     {
1050         OpcodeName = "UNKNOWN";
1051     }
1052 
1053     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
1054         "**** Start operand dump for opcode [%s], %u operands\n",
1055         OpcodeName, NumOperands));
1056 
1057     if (NumOperands == 0)
1058     {
1059         NumOperands = 1;
1060     }
1061 
1062     /* Dump the individual operands */
1063 
1064     while (NumOperands)
1065     {
1066         AcpiExDumpOperand (*Operands, 0);
1067         Operands++;
1068         NumOperands--;
1069     }
1070 
1071     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
1072         "**** End operand dump for [%s]\n", OpcodeName));
1073     return_VOID;
1074 }
1075 
1076 
1077 /*******************************************************************************
1078  *
1079  * FUNCTION:    AcpiExOut* functions
1080  *
1081  * PARAMETERS:  Title               - Descriptive text
1082  *              Value               - Value to be displayed
1083  *
1084  * DESCRIPTION: Object dump output formatting functions. These functions
1085  *              reduce the number of format strings required and keeps them
1086  *              all in one place for easy modification.
1087  *
1088  ******************************************************************************/
1089 
1090 static void
1091 AcpiExOutString (
1092     const char              *Title,
1093     const char              *Value)
1094 {
1095     AcpiOsPrintf ("%20s : %s\n", Title, Value);
1096 }
1097 
1098 static void
1099 AcpiExOutPointer (
1100     const char              *Title,
1101     const void              *Value)
1102 {
1103     AcpiOsPrintf ("%20s : %p\n", Title, Value);
1104 }
1105 
1106 
1107 /*******************************************************************************
1108  *
1109  * FUNCTION:    AcpiExDumpNamespaceNode
1110  *
1111  * PARAMETERS:  Node                - Descriptor to dump
1112  *              Flags               - Force display if TRUE
1113  *
1114  * DESCRIPTION: Dumps the members of the given.Node
1115  *
1116  ******************************************************************************/
1117 
1118 void
1119 AcpiExDumpNamespaceNode (
1120     ACPI_NAMESPACE_NODE     *Node,
1121     UINT32                  Flags)
1122 {
1123 
1124     ACPI_FUNCTION_ENTRY ();
1125 
1126 
1127     if (!Flags)
1128     {
1129         /* Check if debug output enabled */
1130 
1131         if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_OBJECTS, _COMPONENT))
1132         {
1133             return;
1134         }
1135     }
1136 
1137     AcpiOsPrintf ("%20s : %4.4s\n", "Name", AcpiUtGetNodeName (Node));
1138     AcpiOsPrintf ("%20s : %2.2X [%s]\n", "Type",
1139         Node->Type, AcpiUtGetTypeName (Node->Type));
1140 
1141     AcpiExDumpObject (ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node),
1142         AcpiExDumpNode);
1143 }
1144 
1145 
1146 /*******************************************************************************
1147  *
1148  * FUNCTION:    AcpiExDumpReferenceObj
1149  *
1150  * PARAMETERS:  Object              - Descriptor to dump
1151  *
1152  * DESCRIPTION: Dumps a reference object
1153  *
1154  ******************************************************************************/
1155 
1156 static void
1157 AcpiExDumpReferenceObj (
1158     ACPI_OPERAND_OBJECT     *ObjDesc)
1159 {
1160     ACPI_BUFFER             RetBuf;
1161     ACPI_STATUS             Status;
1162 
1163 
1164     RetBuf.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
1165 
1166     if (ObjDesc->Reference.Class == ACPI_REFCLASS_NAME)
1167     {
1168         AcpiOsPrintf (" %p ", ObjDesc->Reference.Node);
1169 
1170         Status = AcpiNsHandleToPathname (ObjDesc->Reference.Node,
1171             &RetBuf, TRUE);
1172         if (ACPI_FAILURE (Status))
1173         {
1174             AcpiOsPrintf (" Could not convert name to pathname: %s\n",
1175                 AcpiFormatException (Status));
1176         }
1177         else
1178         {
1179             AcpiOsPrintf ("%s: %s\n",
1180                 AcpiUtGetTypeName (ObjDesc->Reference.Node->Type),
1181                 (char *) RetBuf.Pointer);
1182             ACPI_FREE (RetBuf.Pointer);
1183         }
1184     }
1185     else if (ObjDesc->Reference.Object)
1186     {
1187         if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND)
1188         {
1189             AcpiOsPrintf ("%22s %p", "Target :",
1190                 ObjDesc->Reference.Object);
1191             if (ObjDesc->Reference.Class == ACPI_REFCLASS_TABLE)
1192             {
1193                 AcpiOsPrintf (" Table Index: %X\n",
1194                     ObjDesc->Reference.Value);
1195             }
1196             else
1197             {
1198                 AcpiOsPrintf (" [%s]\n",
1199                     AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *)
1200                     ObjDesc->Reference.Object)->Common.Type));
1201             }
1202         }
1203         else
1204         {
1205             AcpiOsPrintf (" Target: %p\n", ObjDesc->Reference.Object);
1206         }
1207     }
1208 }
1209 
1210 
1211 /*******************************************************************************
1212  *
1213  * FUNCTION:    AcpiExDumpPackageObj
1214  *
1215  * PARAMETERS:  ObjDesc             - Descriptor to dump
1216  *              Level               - Indentation Level
1217  *              Index               - Package index for this object
1218  *
1219  * DESCRIPTION: Dumps the elements of the package
1220  *
1221  ******************************************************************************/
1222 
1223 static void
1224 AcpiExDumpPackageObj (
1225     ACPI_OPERAND_OBJECT     *ObjDesc,
1226     UINT32                  Level,
1227     UINT32                  Index)
1228 {
1229     UINT32                  i;
1230 
1231 
1232     /* Indentation and index output */
1233 
1234     if (Level > 0)
1235     {
1236         for (i = 0; i < Level; i++)
1237         {
1238             AcpiOsPrintf ("  ");
1239         }
1240 
1241         AcpiOsPrintf ("[%.2d] ", Index);
1242     }
1243 
1244     AcpiOsPrintf ("%p ", ObjDesc);
1245 
1246     /* Null package elements are allowed */
1247 
1248     if (!ObjDesc)
1249     {
1250         AcpiOsPrintf ("[Null Object]\n");
1251         return;
1252     }
1253 
1254     /* Packages may only contain a few object types */
1255 
1256     switch (ObjDesc->Common.Type)
1257     {
1258     case ACPI_TYPE_INTEGER:
1259 
1260         AcpiOsPrintf ("[Integer] = %8.8X%8.8X\n",
1261             ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
1262         break;
1263 
1264     case ACPI_TYPE_STRING:
1265 
1266         AcpiOsPrintf ("[String]  Value: ");
1267         AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);
1268         AcpiOsPrintf ("\n");
1269         break;
1270 
1271     case ACPI_TYPE_BUFFER:
1272 
1273         AcpiOsPrintf ("[Buffer] Length %.2X = ", ObjDesc->Buffer.Length);
1274         if (ObjDesc->Buffer.Length)
1275         {
1276             AcpiUtDebugDumpBuffer (
1277                 ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer),
1278                 ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
1279         }
1280         else
1281         {
1282             AcpiOsPrintf ("\n");
1283         }
1284         break;
1285 
1286     case ACPI_TYPE_PACKAGE:
1287 
1288         AcpiOsPrintf ("[Package] Contains %u Elements:\n",
1289             ObjDesc->Package.Count);
1290 
1291         for (i = 0; i < ObjDesc->Package.Count; i++)
1292         {
1293             AcpiExDumpPackageObj (
1294                 ObjDesc->Package.Elements[i], Level + 1, i);
1295         }
1296         break;
1297 
1298     case ACPI_TYPE_LOCAL_REFERENCE:
1299 
1300         AcpiOsPrintf ("[Object Reference] Class [%s]",
1301             AcpiUtGetReferenceName (ObjDesc));
1302         AcpiExDumpReferenceObj (ObjDesc);
1303         break;
1304 
1305     default:
1306 
1307         AcpiOsPrintf ("[%s] Type: %2.2X\n",
1308             AcpiUtGetTypeName (ObjDesc->Common.Type), ObjDesc->Common.Type);
1309         break;
1310     }
1311 }
1312 
1313 
1314 /*******************************************************************************
1315  *
1316  * FUNCTION:    AcpiExDumpObjectDescriptor
1317  *
1318  * PARAMETERS:  ObjDesc             - Descriptor to dump
1319  *              Flags               - Force display if TRUE
1320  *
1321  * DESCRIPTION: Dumps the members of the object descriptor given.
1322  *
1323  ******************************************************************************/
1324 
1325 void
1326 AcpiExDumpObjectDescriptor (
1327     ACPI_OPERAND_OBJECT     *ObjDesc,
1328     UINT32                  Flags)
1329 {
1330     ACPI_FUNCTION_TRACE (ExDumpObjectDescriptor);
1331 
1332 
1333     if (!ObjDesc)
1334     {
1335         return_VOID;
1336     }
1337 
1338     if (!Flags)
1339     {
1340         /* Check if debug output enabled */
1341 
1342         if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_OBJECTS, _COMPONENT))
1343         {
1344             return_VOID;
1345         }
1346     }
1347 
1348     if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
1349     {
1350         AcpiExDumpNamespaceNode ((ACPI_NAMESPACE_NODE *) ObjDesc, Flags);
1351 
1352         ObjDesc = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object;
1353         if (!ObjDesc)
1354         {
1355             return_VOID;
1356         }
1357 
1358         AcpiOsPrintf ("\nAttached Object %p", ObjDesc);
1359         if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
1360         {
1361             AcpiOsPrintf (" - Namespace Node");
1362         }
1363 
1364         AcpiOsPrintf (":\n");
1365         goto DumpObject;
1366     }
1367 
1368     if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
1369     {
1370         AcpiOsPrintf (
1371             "%p is not an ACPI operand object: [%s]\n",
1372             ObjDesc, AcpiUtGetDescriptorName (ObjDesc));
1373         return_VOID;
1374     }
1375 
1376     /* Validate the object type */
1377 
1378     if (ObjDesc->Common.Type > ACPI_TYPE_LOCAL_MAX)
1379     {
1380         AcpiOsPrintf ("Not a known object type: %2.2X\n",
1381             ObjDesc->Common.Type);
1382         return_VOID;
1383     }
1384 
1385 
1386 DumpObject:
1387 
1388     if (!ObjDesc)
1389     {
1390         return_VOID;
1391     }
1392 
1393     /* Common Fields */
1394 
1395     AcpiExDumpObject (ObjDesc, AcpiExDumpCommon);
1396 
1397     /* Object-specific fields */
1398 
1399     AcpiExDumpObject (ObjDesc, AcpiExDumpInfo[ObjDesc->Common.Type]);
1400 
1401     if (ObjDesc->Common.Type == ACPI_TYPE_REGION)
1402     {
1403         ObjDesc = ObjDesc->Common.NextObject;
1404         if (ObjDesc->Common.Type > ACPI_TYPE_LOCAL_MAX)
1405         {
1406             AcpiOsPrintf (
1407                 "Secondary object is not a known object type: %2.2X\n",
1408                 ObjDesc->Common.Type);
1409 
1410             return_VOID;
1411         }
1412 
1413         AcpiOsPrintf ("\nExtra attached Object (%p):\n", ObjDesc);
1414         AcpiExDumpObject (ObjDesc, AcpiExDumpInfo[ObjDesc->Common.Type]);
1415     }
1416 
1417     return_VOID;
1418 }
1419 
1420 #endif