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