i386/identcpu.c: Add VIA Nano support
[dragonfly.git] / sys / contrib / dev / acpica-unix-20061109 / interpreter / executer / exdump.c
blobf60c6723fefcac0322360f7e287787ca4fa581a8
1 /******************************************************************************
3 * Module Name: exdump - Interpreter debug output routines
4 * $Revision: 1.200 $
6 *****************************************************************************/
8 /******************************************************************************
10 * 1. Copyright Notice
12 * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp.
13 * All rights reserved.
15 * 2. License
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights. You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
20 * property rights.
22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23 * copy of the source code appearing in this file ("Covered Code") an
24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25 * base code distributed originally by Intel ("Original Intel Code") to copy,
26 * make derivatives, distribute, use and display any portion of the Covered
27 * Code in any form, with the right to sublicense such rights; and
29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30 * license (with the right to sublicense), under only those claims of Intel
31 * patents that are infringed by the Original Intel Code, to make, use, sell,
32 * offer to sell, and import the Covered Code and derivative works thereof
33 * solely to the minimum extent necessary to exercise the above copyright
34 * license, and in no event shall the patent license extend to any additions
35 * to or modifications of the Original Intel Code. No other license or right
36 * is granted directly or by implication, estoppel or otherwise;
38 * The above copyright and patent license is granted only if the following
39 * conditions are met:
41 * 3. Conditions
43 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44 * Redistribution of source code of any substantial portion of the Covered
45 * Code or modification with rights to further distribute source must include
46 * the above Copyright Notice, the above License, this list of Conditions,
47 * and the following Disclaimer and Export Compliance provision. In addition,
48 * Licensee must cause all Covered Code to which Licensee contributes to
49 * contain a file documenting the changes Licensee made to create that Covered
50 * Code and the date of any change. Licensee must include in that file the
51 * documentation of any changes made by any predecessor Licensee. Licensee
52 * must include a prominent statement that the modification is derived,
53 * directly or indirectly, from Original Intel Code.
55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56 * Redistribution of source code of any substantial portion of the Covered
57 * Code or modification without rights to further distribute source must
58 * include the following Disclaimer and Export Compliance provision in the
59 * documentation and/or other materials provided with distribution. In
60 * addition, Licensee may not authorize further sublicense of source of any
61 * portion of the Covered Code, and must include terms to the effect that the
62 * license from Licensee to its licensee is limited to the intellectual
63 * property embodied in the software Licensee provides to its licensee, and
64 * not to intellectual property embodied in modifications its licensee may
65 * make.
67 * 3.3. Redistribution of Executable. Redistribution in executable form of any
68 * substantial portion of the Covered Code or modification must reproduce the
69 * above Copyright Notice, and the following Disclaimer and Export Compliance
70 * provision in the documentation and/or other materials provided with the
71 * distribution.
73 * 3.4. Intel retains all right, title, and interest in and to the Original
74 * Intel Code.
76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77 * Intel shall be used in advertising or otherwise to promote the sale, use or
78 * other dealings in products derived from or relating to the Covered Code
79 * without prior written authorization from Intel.
81 * 4. Disclaimer and Export Compliance
83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
87 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89 * PARTICULAR PURPOSE.
91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98 * LIMITED REMEDY.
100 * 4.3. Licensee shall not export, either directly or indirectly, any of this
101 * software or system incorporating such software without first obtaining any
102 * required license or other approval from the U. S. Department of Commerce or
103 * any other agency or department of the United States Government. In the
104 * event Licensee exports any such software from the United States or
105 * re-exports any such software from a foreign destination, Licensee shall
106 * ensure that the distribution and export/re-export of the software is in
107 * compliance with all laws, regulations, orders, or other restrictions of the
108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109 * any of its subsidiaries will export/re-export any technical data, process,
110 * software, or service, directly or indirectly, to any country for which the
111 * United States government or any agency thereof requires an export license,
112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
115 *****************************************************************************/
117 #define __EXDUMP_C__
119 #include "acpi.h"
120 #include "acinterp.h"
121 #include "amlcode.h"
122 #include "acnamesp.h"
123 #include "acparser.h"
125 #define _COMPONENT ACPI_EXECUTER
126 ACPI_MODULE_NAME ("exdump")
129 * The following routines are used for debug output only
131 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
133 /* Local prototypes */
135 static void
136 AcpiExOutString (
137 char *Title,
138 char *Value);
140 static void
141 AcpiExOutPointer (
142 char *Title,
143 void *Value);
145 static void
146 AcpiExDumpObject (
147 ACPI_OPERAND_OBJECT *ObjDesc,
148 ACPI_EXDUMP_INFO *Info);
150 static void
151 AcpiExDumpReferenceObj (
152 ACPI_OPERAND_OBJECT *ObjDesc);
154 static void
155 AcpiExDumpPackageObj (
156 ACPI_OPERAND_OBJECT *ObjDesc,
157 UINT32 Level,
158 UINT32 Index);
161 /*******************************************************************************
163 * Object Descriptor info tables
165 * Note: The first table entry must be an INIT opcode and must contain
166 * the table length (number of table entries)
168 ******************************************************************************/
170 static ACPI_EXDUMP_INFO AcpiExDumpInteger[2] =
172 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpInteger), NULL},
173 {ACPI_EXD_UINT64, ACPI_EXD_OFFSET (Integer.Value), "Value"}
176 static ACPI_EXDUMP_INFO AcpiExDumpString[4] =
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}
184 static ACPI_EXDUMP_INFO AcpiExDumpBuffer[5] =
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_POINTER, ACPI_EXD_OFFSET (Buffer.Node), "Parent Node"},
190 {ACPI_EXD_BUFFER, 0, NULL}
193 static ACPI_EXDUMP_INFO AcpiExDumpPackage[5] =
195 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpPackage), NULL},
196 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Package.Flags), "Flags"},
197 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Package.Count), "Elements"},
198 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Package.Elements), "Element List"},
199 {ACPI_EXD_PACKAGE, 0, NULL}
202 static ACPI_EXDUMP_INFO AcpiExDumpDevice[4] =
204 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpDevice), NULL},
205 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.Handler), "Handler"},
206 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.SystemNotify), "System Notify"},
207 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.DeviceNotify), "Device Notify"}
210 static ACPI_EXDUMP_INFO AcpiExDumpEvent[2] =
212 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpEvent), NULL},
213 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Event.OsSemaphore), "OsSemaphore"}
216 static ACPI_EXDUMP_INFO AcpiExDumpMethod[8] =
218 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpMethod), NULL},
219 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.ParamCount), "ParamCount"},
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"}
228 static ACPI_EXDUMP_INFO AcpiExDumpMutex[5] =
230 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpMutex), NULL},
231 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Mutex.SyncLevel), "Sync Level"},
232 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Mutex.OwnerThread), "Owner Thread"},
233 {ACPI_EXD_UINT16, ACPI_EXD_OFFSET (Mutex.AcquisitionDepth), "Acquire Depth"},
234 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Mutex.OsMutex), "OsMutex"}
237 static ACPI_EXDUMP_INFO AcpiExDumpRegion[7] =
239 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpRegion), NULL},
240 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Region.SpaceId), "Space Id"},
241 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Region.Flags), "Flags"},
242 {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET (Region.Address), "Address"},
243 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Region.Length), "Length"},
244 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Region.Handler), "Handler"},
245 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Region.Next), "Next"}
248 static ACPI_EXDUMP_INFO AcpiExDumpPower[5] =
250 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpPower), NULL},
251 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (PowerResource.SystemLevel), "System Level"},
252 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (PowerResource.ResourceOrder), "Resource Order"},
253 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.SystemNotify), "System Notify"},
254 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.DeviceNotify), "Device Notify"}
257 static ACPI_EXDUMP_INFO AcpiExDumpProcessor[7] =
259 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpProcessor), NULL},
260 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Processor.ProcId), "Processor ID"},
261 {ACPI_EXD_UINT8 , ACPI_EXD_OFFSET (Processor.Length), "Length"},
262 {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET (Processor.Address), "Address"},
263 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.SystemNotify), "System Notify"},
264 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.DeviceNotify), "Device Notify"},
265 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.Handler), "Handler"}
268 static ACPI_EXDUMP_INFO AcpiExDumpThermal[4] =
270 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpThermal), NULL},
271 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.SystemNotify), "System Notify"},
272 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.DeviceNotify), "Device Notify"},
273 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.Handler), "Handler"}
276 static ACPI_EXDUMP_INFO AcpiExDumpBufferField[3] =
278 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBufferField), NULL},
279 {ACPI_EXD_FIELD, 0, NULL},
280 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (BufferField.BufferObj), "Buffer Object"}
283 static ACPI_EXDUMP_INFO AcpiExDumpRegionField[3] =
285 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpRegionField), NULL},
286 {ACPI_EXD_FIELD, 0, NULL},
287 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Field.RegionObj), "Region Object"}
290 static ACPI_EXDUMP_INFO AcpiExDumpBankField[5] =
292 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBankField), NULL},
293 {ACPI_EXD_FIELD, 0, NULL},
294 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (BankField.Value), "Value"},
295 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (BankField.RegionObj), "Region Object"},
296 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (BankField.BankObj), "Bank Object"}
299 static ACPI_EXDUMP_INFO AcpiExDumpIndexField[5] =
301 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBankField), NULL},
302 {ACPI_EXD_FIELD, 0, NULL},
303 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (IndexField.Value), "Value"},
304 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (IndexField.IndexObj), "Index Object"},
305 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (IndexField.DataObj), "Data Object"}
309 static ACPI_EXDUMP_INFO AcpiExDumpReference[7] =
311 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpReference), NULL},
312 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Reference.TargetType), "Target Type"},
313 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Reference.Offset), "Offset"},
314 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Object), "Object Desc"},
315 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Node), "Node"},
316 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Where), "Where"},
317 {ACPI_EXD_REFERENCE,0, NULL}
320 static ACPI_EXDUMP_INFO AcpiExDumpAddressHandler[6] =
322 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpAddressHandler), NULL},
323 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (AddressSpace.SpaceId), "Space Id"},
324 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Next), "Next"},
325 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.RegionList), "Region List"},
326 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Node), "Node"},
327 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Context), "Context"}
330 static ACPI_EXDUMP_INFO AcpiExDumpNotify[3] =
332 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpNotify), NULL},
333 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Node), "Node"},
334 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Context), "Context"}
338 /* Miscellaneous tables */
340 static ACPI_EXDUMP_INFO AcpiExDumpCommon[4] =
342 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpCommon), NULL},
343 {ACPI_EXD_TYPE , 0, NULL},
344 {ACPI_EXD_UINT16, ACPI_EXD_OFFSET (Common.ReferenceCount), "Reference Count"},
345 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Common.Flags), "Flags"}
349 static ACPI_EXDUMP_INFO AcpiExDumpFieldCommon[7] =
351 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpFieldCommon), NULL},
352 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (CommonField.FieldFlags), "Field Flags"},
353 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (CommonField.AccessByteWidth), "Access Byte Width"},
354 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (CommonField.BitLength), "Bit Length"},
355 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (CommonField.StartFieldBitOffset),"Field Bit Offset"},
356 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (CommonField.BaseByteOffset), "Base Byte Offset"},
357 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (CommonField.Node), "Parent Node"}
360 static ACPI_EXDUMP_INFO AcpiExDumpNode[5] =
362 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpNode), NULL},
363 {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET (Flags), "Flags"},
364 {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET (OwnerId), "Owner Id"},
365 {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET (Child), "Child List"},
366 {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET (Peer), "Next Peer"}
370 /* Dispatch table, indexed by object type */
372 static ACPI_EXDUMP_INFO *AcpiExDumpInfo[] =
374 NULL,
375 AcpiExDumpInteger,
376 AcpiExDumpString,
377 AcpiExDumpBuffer,
378 AcpiExDumpPackage,
379 NULL,
380 AcpiExDumpDevice,
381 AcpiExDumpEvent,
382 AcpiExDumpMethod,
383 AcpiExDumpMutex,
384 AcpiExDumpRegion,
385 AcpiExDumpPower,
386 AcpiExDumpProcessor,
387 AcpiExDumpThermal,
388 AcpiExDumpBufferField,
389 NULL,
390 NULL,
391 AcpiExDumpRegionField,
392 AcpiExDumpBankField,
393 AcpiExDumpIndexField,
394 AcpiExDumpReference,
395 NULL,
396 NULL,
397 AcpiExDumpNotify,
398 AcpiExDumpAddressHandler,
399 NULL,
400 NULL,
401 NULL
405 /*******************************************************************************
407 * FUNCTION: AcpiExDumpObject
409 * PARAMETERS: ObjDesc - Descriptor to dump
410 * Info - Info table corresponding to this object
411 * type
413 * RETURN: None
415 * DESCRIPTION: Walk the info table for this object
417 ******************************************************************************/
419 static void
420 AcpiExDumpObject (
421 ACPI_OPERAND_OBJECT *ObjDesc,
422 ACPI_EXDUMP_INFO *Info)
424 UINT8 *Target;
425 char *Name;
426 UINT8 Count;
429 if (!Info)
431 AcpiOsPrintf (
432 "ExDumpObject: Display not implemented for object type %s\n",
433 AcpiUtGetObjectTypeName (ObjDesc));
434 return;
437 /* First table entry must contain the table length (# of table entries) */
439 Count = Info->Offset;
441 while (Count)
443 Target = ACPI_ADD_PTR (UINT8, ObjDesc, Info->Offset);
444 Name = Info->Name;
446 switch (Info->Opcode)
448 case ACPI_EXD_INIT:
449 break;
451 case ACPI_EXD_TYPE:
452 AcpiExOutString ("Type", AcpiUtGetObjectTypeName (ObjDesc));
453 break;
455 case ACPI_EXD_UINT8:
457 AcpiOsPrintf ("%20s : %2.2X\n", Name, *Target);
458 break;
460 case ACPI_EXD_UINT16:
462 AcpiOsPrintf ("%20s : %4.4X\n", Name, ACPI_GET16 (Target));
463 break;
465 case ACPI_EXD_UINT32:
467 AcpiOsPrintf ("%20s : %8.8X\n", Name, ACPI_GET32 (Target));
468 break;
470 case ACPI_EXD_UINT64:
472 AcpiOsPrintf ("%20s : %8.8X%8.8X\n", "Value",
473 ACPI_FORMAT_UINT64 (ACPI_GET64 (Target)));
474 break;
476 case ACPI_EXD_POINTER:
477 case ACPI_EXD_ADDRESS:
479 AcpiExOutPointer (Name, *ACPI_CAST_PTR (void *, Target));
480 break;
482 case ACPI_EXD_STRING:
484 AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);
485 AcpiOsPrintf ("\n");
486 break;
488 case ACPI_EXD_BUFFER:
490 ACPI_DUMP_BUFFER (ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length);
491 break;
493 case ACPI_EXD_PACKAGE:
495 /* Dump the package contents */
497 AcpiOsPrintf ("\nPackage Contents:\n");
498 AcpiExDumpPackageObj (ObjDesc, 0, 0);
499 break;
501 case ACPI_EXD_FIELD:
503 AcpiExDumpObject (ObjDesc, AcpiExDumpFieldCommon);
504 break;
506 case ACPI_EXD_REFERENCE:
508 AcpiExOutString ("Opcode",
509 (AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode))->Name);
510 AcpiExDumpReferenceObj (ObjDesc);
511 break;
513 default:
514 AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n", Info->Opcode);
515 return;
518 Info++;
519 Count--;
524 /*******************************************************************************
526 * FUNCTION: AcpiExDumpOperand
528 * PARAMETERS: *ObjDesc - Pointer to entry to be dumped
529 * Depth - Current nesting depth
531 * RETURN: None
533 * DESCRIPTION: Dump an operand object
535 ******************************************************************************/
537 void
538 AcpiExDumpOperand (
539 ACPI_OPERAND_OBJECT *ObjDesc,
540 UINT32 Depth)
542 UINT32 Length;
543 UINT32 Index;
546 ACPI_FUNCTION_NAME (ExDumpOperand)
549 if (!((ACPI_LV_EXEC & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
551 return;
554 if (!ObjDesc)
556 /* This could be a null element of a package */
558 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n"));
559 return;
562 if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
564 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p Namespace Node: ", ObjDesc));
565 ACPI_DUMP_ENTRY (ObjDesc, ACPI_LV_EXEC);
566 return;
569 if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
571 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
572 "%p is not a node or operand object: [%s]\n",
573 ObjDesc, AcpiUtGetDescriptorName (ObjDesc)));
574 ACPI_DUMP_BUFFER (ObjDesc, sizeof (ACPI_OPERAND_OBJECT));
575 return;
578 /* ObjDesc is a valid object */
580 if (Depth > 0)
582 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%*s[%u] %p ",
583 Depth, " ", Depth, ObjDesc));
585 else
587 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", ObjDesc));
590 /* Decode object type */
592 switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
594 case ACPI_TYPE_LOCAL_REFERENCE:
596 switch (ObjDesc->Reference.Opcode)
598 case AML_DEBUG_OP:
600 AcpiOsPrintf ("Reference: Debug\n");
601 break;
604 case AML_NAME_OP:
606 ACPI_DUMP_PATHNAME (ObjDesc->Reference.Object,
607 "Reference: Name: ", ACPI_LV_INFO, _COMPONENT);
608 ACPI_DUMP_ENTRY (ObjDesc->Reference.Object, ACPI_LV_INFO);
609 break;
612 case AML_INDEX_OP:
614 AcpiOsPrintf ("Reference: Index %p\n",
615 ObjDesc->Reference.Object);
616 break;
619 case AML_REF_OF_OP:
621 AcpiOsPrintf ("Reference: (RefOf) %p\n",
622 ObjDesc->Reference.Object);
623 break;
626 case AML_ARG_OP:
628 AcpiOsPrintf ("Reference: Arg%d",
629 ObjDesc->Reference.Offset);
631 if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
633 /* Value is an Integer */
635 AcpiOsPrintf (" value is [%8.8X%8.8x]",
636 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
639 AcpiOsPrintf ("\n");
640 break;
643 case AML_LOCAL_OP:
645 AcpiOsPrintf ("Reference: Local%d",
646 ObjDesc->Reference.Offset);
648 if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
651 /* Value is an Integer */
653 AcpiOsPrintf (" value is [%8.8X%8.8x]",
654 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
657 AcpiOsPrintf ("\n");
658 break;
661 case AML_INT_NAMEPATH_OP:
663 AcpiOsPrintf ("Reference.Node->Name %X\n",
664 ObjDesc->Reference.Node->Name.Integer);
665 break;
668 default:
670 /* Unknown opcode */
672 AcpiOsPrintf ("Unknown Reference opcode=%X\n",
673 ObjDesc->Reference.Opcode);
674 break;
677 break;
680 case ACPI_TYPE_BUFFER:
682 AcpiOsPrintf ("Buffer len %X @ %p\n",
683 ObjDesc->Buffer.Length, ObjDesc->Buffer.Pointer);
685 Length = ObjDesc->Buffer.Length;
686 if (Length > 64)
688 Length = 64;
691 /* Debug only -- dump the buffer contents */
693 if (ObjDesc->Buffer.Pointer)
695 AcpiOsPrintf ("Buffer Contents: ");
697 for (Index = 0; Index < Length; Index++)
699 AcpiOsPrintf (" %02x", ObjDesc->Buffer.Pointer[Index]);
701 AcpiOsPrintf ("\n");
703 break;
706 case ACPI_TYPE_INTEGER:
708 AcpiOsPrintf ("Integer %8.8X%8.8X\n",
709 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
710 break;
713 case ACPI_TYPE_PACKAGE:
715 AcpiOsPrintf ("Package [Len %X] ElementArray %p\n",
716 ObjDesc->Package.Count, ObjDesc->Package.Elements);
719 * If elements exist, package element pointer is valid,
720 * and debug_level exceeds 1, dump package's elements.
722 if (ObjDesc->Package.Count &&
723 ObjDesc->Package.Elements &&
724 AcpiDbgLevel > 1)
726 for (Index = 0; Index < ObjDesc->Package.Count; Index++)
728 AcpiExDumpOperand (ObjDesc->Package.Elements[Index], Depth+1);
731 break;
734 case ACPI_TYPE_REGION:
736 AcpiOsPrintf ("Region %s (%X)",
737 AcpiUtGetRegionName (ObjDesc->Region.SpaceId),
738 ObjDesc->Region.SpaceId);
741 * If the address and length have not been evaluated,
742 * don't print them.
744 if (!(ObjDesc->Region.Flags & AOPOBJ_DATA_VALID))
746 AcpiOsPrintf ("\n");
748 else
750 AcpiOsPrintf (" base %8.8X%8.8X Length %X\n",
751 ACPI_FORMAT_UINT64 (ObjDesc->Region.Address),
752 ObjDesc->Region.Length);
754 break;
757 case ACPI_TYPE_STRING:
759 AcpiOsPrintf ("String length %X @ %p ",
760 ObjDesc->String.Length,
761 ObjDesc->String.Pointer);
763 AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);
764 AcpiOsPrintf ("\n");
765 break;
768 case ACPI_TYPE_LOCAL_BANK_FIELD:
770 AcpiOsPrintf ("BankField\n");
771 break;
774 case ACPI_TYPE_LOCAL_REGION_FIELD:
776 AcpiOsPrintf (
777 "RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n",
778 ObjDesc->Field.BitLength,
779 ObjDesc->Field.AccessByteWidth,
780 ObjDesc->Field.FieldFlags & AML_FIELD_LOCK_RULE_MASK,
781 ObjDesc->Field.FieldFlags & AML_FIELD_UPDATE_RULE_MASK,
782 ObjDesc->Field.BaseByteOffset,
783 ObjDesc->Field.StartFieldBitOffset);
785 AcpiExDumpOperand (ObjDesc->Field.RegionObj, Depth+1);
786 break;
789 case ACPI_TYPE_LOCAL_INDEX_FIELD:
791 AcpiOsPrintf ("IndexField\n");
792 break;
795 case ACPI_TYPE_BUFFER_FIELD:
797 AcpiOsPrintf (
798 "BufferField: %X bits at byte %X bit %X of\n",
799 ObjDesc->BufferField.BitLength,
800 ObjDesc->BufferField.BaseByteOffset,
801 ObjDesc->BufferField.StartFieldBitOffset);
803 if (!ObjDesc->BufferField.BufferObj)
805 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL*\n"));
807 else if (ACPI_GET_OBJECT_TYPE (ObjDesc->BufferField.BufferObj) !=
808 ACPI_TYPE_BUFFER)
810 AcpiOsPrintf ("*not a Buffer*\n");
812 else
814 AcpiExDumpOperand (ObjDesc->BufferField.BufferObj, Depth+1);
816 break;
819 case ACPI_TYPE_EVENT:
821 AcpiOsPrintf ("Event\n");
822 break;
825 case ACPI_TYPE_METHOD:
827 AcpiOsPrintf ("Method(%X) @ %p:%X\n",
828 ObjDesc->Method.ParamCount,
829 ObjDesc->Method.AmlStart,
830 ObjDesc->Method.AmlLength);
831 break;
834 case ACPI_TYPE_MUTEX:
836 AcpiOsPrintf ("Mutex\n");
837 break;
840 case ACPI_TYPE_DEVICE:
842 AcpiOsPrintf ("Device\n");
843 break;
846 case ACPI_TYPE_POWER:
848 AcpiOsPrintf ("Power\n");
849 break;
852 case ACPI_TYPE_PROCESSOR:
854 AcpiOsPrintf ("Processor\n");
855 break;
858 case ACPI_TYPE_THERMAL:
860 AcpiOsPrintf ("Thermal\n");
861 break;
864 default:
865 /* Unknown Type */
867 AcpiOsPrintf ("Unknown Type %X\n", ACPI_GET_OBJECT_TYPE (ObjDesc));
868 break;
871 return;
875 /*******************************************************************************
877 * FUNCTION: AcpiExDumpOperands
879 * PARAMETERS: Operands - Operand list
880 * InterpreterMode - Load or Exec
881 * Ident - Identification
882 * NumLevels - # of stack entries to dump above line
883 * Note - Output notation
884 * ModuleName - Caller's module name
885 * LineNumber - Caller's invocation line number
887 * DESCRIPTION: Dump the object stack
889 ******************************************************************************/
891 void
892 AcpiExDumpOperands (
893 ACPI_OPERAND_OBJECT **Operands,
894 ACPI_INTERPRETER_MODE InterpreterMode,
895 char *Ident,
896 UINT32 NumLevels,
897 char *Note,
898 char *ModuleName,
899 UINT32 LineNumber)
901 ACPI_NATIVE_UINT i;
904 ACPI_FUNCTION_NAME (ExDumpOperands);
907 if (!Ident)
909 Ident = "?";
912 if (!Note)
914 Note = "?";
917 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
918 "************* Operand Stack Contents (Opcode [%s], %d Operands)\n",
919 Ident, NumLevels));
921 if (NumLevels == 0)
923 NumLevels = 1;
926 /* Dump the operand stack starting at the top */
928 for (i = 0; NumLevels > 0; i--, NumLevels--)
930 AcpiExDumpOperand (Operands[i], 0);
933 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
934 "************* Operand Stack dump from %s(%d), %s\n",
935 ModuleName, LineNumber, Note));
936 return;
940 /*******************************************************************************
942 * FUNCTION: AcpiExOut* functions
944 * PARAMETERS: Title - Descriptive text
945 * Value - Value to be displayed
947 * DESCRIPTION: Object dump output formatting functions. These functions
948 * reduce the number of format strings required and keeps them
949 * all in one place for easy modification.
951 ******************************************************************************/
953 static void
954 AcpiExOutString (
955 char *Title,
956 char *Value)
958 AcpiOsPrintf ("%20s : %s\n", Title, Value);
961 static void
962 AcpiExOutPointer (
963 char *Title,
964 void *Value)
966 AcpiOsPrintf ("%20s : %p\n", Title, Value);
970 /*******************************************************************************
972 * FUNCTION: AcpiExDumpNamespaceNode
974 * PARAMETERS: Node - Descriptor to dump
975 * Flags - Force display if TRUE
977 * DESCRIPTION: Dumps the members of the given.Node
979 ******************************************************************************/
981 void
982 AcpiExDumpNamespaceNode (
983 ACPI_NAMESPACE_NODE *Node,
984 UINT32 Flags)
987 ACPI_FUNCTION_ENTRY ();
990 if (!Flags)
992 if (!((ACPI_LV_OBJECTS & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
994 return;
998 AcpiOsPrintf ("%20s : %4.4s\n", "Name", AcpiUtGetNodeName (Node));
999 AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type));
1000 AcpiExOutPointer ("Attached Object", AcpiNsGetAttachedObject (Node));
1001 AcpiExOutPointer ("Parent", AcpiNsGetParentNode (Node));
1003 AcpiExDumpObject (ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node),
1004 AcpiExDumpNode);
1008 /*******************************************************************************
1010 * FUNCTION: AcpiExDumpReferenceObj
1012 * PARAMETERS: Object - Descriptor to dump
1014 * DESCRIPTION: Dumps a reference object
1016 ******************************************************************************/
1018 static void
1019 AcpiExDumpReferenceObj (
1020 ACPI_OPERAND_OBJECT *ObjDesc)
1022 ACPI_BUFFER RetBuf;
1023 ACPI_STATUS Status;
1026 RetBuf.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
1028 if (ObjDesc->Reference.Opcode == AML_INT_NAMEPATH_OP)
1030 AcpiOsPrintf ("Named Object %p ", ObjDesc->Reference.Node);
1032 Status = AcpiNsHandleToPathname (ObjDesc->Reference.Node, &RetBuf);
1033 if (ACPI_FAILURE (Status))
1035 AcpiOsPrintf ("Could not convert name to pathname\n");
1037 else
1039 AcpiOsPrintf ("%s\n", (char *) RetBuf.Pointer);
1040 ACPI_FREE (RetBuf.Pointer);
1043 else if (ObjDesc->Reference.Object)
1045 AcpiOsPrintf ("\nReferenced Object: %p\n", ObjDesc->Reference.Object);
1050 /*******************************************************************************
1052 * FUNCTION: AcpiExDumpPackageObj
1054 * PARAMETERS: ObjDesc - Descriptor to dump
1055 * Level - Indentation Level
1056 * Index - Package index for this object
1058 * DESCRIPTION: Dumps the elements of the package
1060 ******************************************************************************/
1062 static void
1063 AcpiExDumpPackageObj (
1064 ACPI_OPERAND_OBJECT *ObjDesc,
1065 UINT32 Level,
1066 UINT32 Index)
1068 UINT32 i;
1071 /* Indentation and index output */
1073 if (Level > 0)
1075 for (i = 0; i < Level; i++)
1077 AcpiOsPrintf (" ");
1080 AcpiOsPrintf ("[%.2d] ", Index);
1083 AcpiOsPrintf ("%p ", ObjDesc);
1085 /* Null package elements are allowed */
1087 if (!ObjDesc)
1089 AcpiOsPrintf ("[Null Object]\n");
1090 return;
1093 /* Packages may only contain a few object types */
1095 switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
1097 case ACPI_TYPE_INTEGER:
1099 AcpiOsPrintf ("[Integer] = %8.8X%8.8X\n",
1100 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
1101 break;
1104 case ACPI_TYPE_STRING:
1106 AcpiOsPrintf ("[String] Value: ");
1107 for (i = 0; i < ObjDesc->String.Length; i++)
1109 AcpiOsPrintf ("%c", ObjDesc->String.Pointer[i]);
1111 AcpiOsPrintf ("\n");
1112 break;
1115 case ACPI_TYPE_BUFFER:
1117 AcpiOsPrintf ("[Buffer] Length %.2X = ", ObjDesc->Buffer.Length);
1118 if (ObjDesc->Buffer.Length)
1120 AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer),
1121 ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
1123 else
1125 AcpiOsPrintf ("\n");
1127 break;
1130 case ACPI_TYPE_PACKAGE:
1132 AcpiOsPrintf ("[Package] Contains %d Elements:\n",
1133 ObjDesc->Package.Count);
1135 for (i = 0; i < ObjDesc->Package.Count; i++)
1137 AcpiExDumpPackageObj (ObjDesc->Package.Elements[i], Level+1, i);
1139 break;
1142 case ACPI_TYPE_LOCAL_REFERENCE:
1144 AcpiOsPrintf ("[Object Reference] ");
1145 AcpiExDumpReferenceObj (ObjDesc);
1146 break;
1149 default:
1151 AcpiOsPrintf ("[Unknown Type] %X\n", ACPI_GET_OBJECT_TYPE (ObjDesc));
1152 break;
1157 /*******************************************************************************
1159 * FUNCTION: AcpiExDumpObjectDescriptor
1161 * PARAMETERS: ObjDesc - Descriptor to dump
1162 * Flags - Force display if TRUE
1164 * DESCRIPTION: Dumps the members of the object descriptor given.
1166 ******************************************************************************/
1168 void
1169 AcpiExDumpObjectDescriptor (
1170 ACPI_OPERAND_OBJECT *ObjDesc,
1171 UINT32 Flags)
1173 ACPI_FUNCTION_TRACE (ExDumpObjectDescriptor);
1176 if (!ObjDesc)
1178 return_VOID;
1181 if (!Flags)
1183 if (!((ACPI_LV_OBJECTS & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
1185 return_VOID;
1189 if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
1191 AcpiExDumpNamespaceNode ((ACPI_NAMESPACE_NODE *) ObjDesc, Flags);
1193 AcpiOsPrintf ("\nAttached Object (%p):\n",
1194 ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object);
1196 AcpiExDumpObjectDescriptor (
1197 ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object, Flags);
1198 return_VOID;
1201 if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
1203 AcpiOsPrintf (
1204 "ExDumpObjectDescriptor: %p is not an ACPI operand object: [%s]\n",
1205 ObjDesc, AcpiUtGetDescriptorName (ObjDesc));
1206 return_VOID;
1209 if (ObjDesc->Common.Type > ACPI_TYPE_NS_NODE_MAX)
1211 return_VOID;
1214 /* Common Fields */
1216 AcpiExDumpObject (ObjDesc, AcpiExDumpCommon);
1218 /* Object-specific fields */
1220 AcpiExDumpObject (ObjDesc, AcpiExDumpInfo[ObjDesc->Common.Type]);
1221 return_VOID;
1224 #endif