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