1 /******************************************************************************
3 * Module Name: exdump - Interpreter debug output routines
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2011, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
46 #include <contrib/dev/acpica/include/acpi.h>
47 #include <contrib/dev/acpica/include/accommon.h>
48 #include <contrib/dev/acpica/include/acinterp.h>
49 #include <contrib/dev/acpica/include/amlcode.h>
50 #include <contrib/dev/acpica/include/acnamesp.h>
53 #define _COMPONENT ACPI_EXECUTER
54 ACPI_MODULE_NAME ("exdump")
57 * The following routines are used for debug output only
59 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
61 /* Local prototypes */
75 ACPI_OPERAND_OBJECT *ObjDesc,
76 ACPI_EXDUMP_INFO *Info);
79 AcpiExDumpReferenceObj (
80 ACPI_OPERAND_OBJECT *ObjDesc);
83 AcpiExDumpPackageObj (
84 ACPI_OPERAND_OBJECT *ObjDesc,
89 /*******************************************************************************
91 * Object Descriptor info tables
93 * Note: The first table entry must be an INIT opcode and must contain
94 * the table length (number of table entries)
96 ******************************************************************************/
98 static ACPI_EXDUMP_INFO AcpiExDumpInteger[2] =
100 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpInteger), NULL},
101 {ACPI_EXD_UINT64, ACPI_EXD_OFFSET (Integer.Value), "Value"}
104 static ACPI_EXDUMP_INFO AcpiExDumpString[4] =
106 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpString), NULL},
107 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (String.Length), "Length"},
108 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (String.Pointer), "Pointer"},
109 {ACPI_EXD_STRING, 0, NULL}
112 static ACPI_EXDUMP_INFO AcpiExDumpBuffer[5] =
114 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBuffer), NULL},
115 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Buffer.Length), "Length"},
116 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Buffer.Pointer), "Pointer"},
117 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Buffer.Node), "Parent Node"},
118 {ACPI_EXD_BUFFER, 0, NULL}
121 static ACPI_EXDUMP_INFO AcpiExDumpPackage[5] =
123 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpPackage), NULL},
124 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Package.Flags), "Flags"},
125 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Package.Count), "Elements"},
126 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Package.Elements), "Element List"},
127 {ACPI_EXD_PACKAGE, 0, NULL}
130 static ACPI_EXDUMP_INFO AcpiExDumpDevice[4] =
132 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpDevice), NULL},
133 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.Handler), "Handler"},
134 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.SystemNotify), "System Notify"},
135 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.DeviceNotify), "Device Notify"}
138 static ACPI_EXDUMP_INFO AcpiExDumpEvent[2] =
140 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpEvent), NULL},
141 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Event.OsSemaphore), "OsSemaphore"}
144 static ACPI_EXDUMP_INFO AcpiExDumpMethod[9] =
146 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpMethod), NULL},
147 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.InfoFlags), "Info Flags"},
148 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.ParamCount), "Parameter Count"},
149 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.SyncLevel), "Sync Level"},
150 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Method.Mutex), "Mutex"},
151 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.OwnerId), "Owner Id"},
152 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.ThreadCount), "Thread Count"},
153 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Method.AmlLength), "Aml Length"},
154 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Method.AmlStart), "Aml Start"}
157 static ACPI_EXDUMP_INFO AcpiExDumpMutex[5] =
159 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpMutex), NULL},
160 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Mutex.SyncLevel), "Sync Level"},
161 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Mutex.OwnerThread), "Owner Thread"},
162 {ACPI_EXD_UINT16, ACPI_EXD_OFFSET (Mutex.AcquisitionDepth), "Acquire Depth"},
163 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Mutex.OsMutex), "OsMutex"}
166 static ACPI_EXDUMP_INFO AcpiExDumpRegion[7] =
168 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpRegion), NULL},
169 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Region.SpaceId), "Space Id"},
170 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Region.Flags), "Flags"},
171 {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET (Region.Address), "Address"},
172 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Region.Length), "Length"},
173 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Region.Handler), "Handler"},
174 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Region.Next), "Next"}
177 static ACPI_EXDUMP_INFO AcpiExDumpPower[5] =
179 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpPower), NULL},
180 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (PowerResource.SystemLevel), "System Level"},
181 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (PowerResource.ResourceOrder), "Resource Order"},
182 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.SystemNotify), "System Notify"},
183 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.DeviceNotify), "Device Notify"}
186 static ACPI_EXDUMP_INFO AcpiExDumpProcessor[7] =
188 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpProcessor), NULL},
189 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Processor.ProcId), "Processor ID"},
190 {ACPI_EXD_UINT8 , ACPI_EXD_OFFSET (Processor.Length), "Length"},
191 {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET (Processor.Address), "Address"},
192 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.SystemNotify), "System Notify"},
193 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.DeviceNotify), "Device Notify"},
194 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.Handler), "Handler"}
197 static ACPI_EXDUMP_INFO AcpiExDumpThermal[4] =
199 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpThermal), NULL},
200 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.SystemNotify), "System Notify"},
201 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.DeviceNotify), "Device Notify"},
202 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.Handler), "Handler"}
205 static ACPI_EXDUMP_INFO AcpiExDumpBufferField[3] =
207 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBufferField), NULL},
208 {ACPI_EXD_FIELD, 0, NULL},
209 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (BufferField.BufferObj), "Buffer Object"}
212 static ACPI_EXDUMP_INFO AcpiExDumpRegionField[3] =
214 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpRegionField), NULL},
215 {ACPI_EXD_FIELD, 0, NULL},
216 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Field.RegionObj), "Region Object"}
219 static ACPI_EXDUMP_INFO AcpiExDumpBankField[5] =
221 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBankField), NULL},
222 {ACPI_EXD_FIELD, 0, NULL},
223 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (BankField.Value), "Value"},
224 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (BankField.RegionObj), "Region Object"},
225 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (BankField.BankObj), "Bank Object"}
228 static ACPI_EXDUMP_INFO AcpiExDumpIndexField[5] =
230 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBankField), NULL},
231 {ACPI_EXD_FIELD, 0, NULL},
232 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (IndexField.Value), "Value"},
233 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (IndexField.IndexObj), "Index Object"},
234 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (IndexField.DataObj), "Data Object"}
237 static ACPI_EXDUMP_INFO AcpiExDumpReference[8] =
239 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpReference), NULL},
240 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Reference.Class), "Class"},
241 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Reference.TargetType), "Target Type"},
242 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Reference.Value), "Value"},
243 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Object), "Object Desc"},
244 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Node), "Node"},
245 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Where), "Where"},
246 {ACPI_EXD_REFERENCE,0, NULL}
249 static ACPI_EXDUMP_INFO AcpiExDumpAddressHandler[6] =
251 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpAddressHandler), NULL},
252 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (AddressSpace.SpaceId), "Space Id"},
253 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Next), "Next"},
254 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.RegionList), "Region List"},
255 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Node), "Node"},
256 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Context), "Context"}
259 static ACPI_EXDUMP_INFO AcpiExDumpNotify[3] =
261 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpNotify), NULL},
262 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Node), "Node"},
263 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Context), "Context"}
267 /* Miscellaneous tables */
269 static ACPI_EXDUMP_INFO AcpiExDumpCommon[4] =
271 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpCommon), NULL},
272 {ACPI_EXD_TYPE , 0, NULL},
273 {ACPI_EXD_UINT16, ACPI_EXD_OFFSET (Common.ReferenceCount), "Reference Count"},
274 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Common.Flags), "Flags"}
277 static ACPI_EXDUMP_INFO AcpiExDumpFieldCommon[7] =
279 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpFieldCommon), NULL},
280 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (CommonField.FieldFlags), "Field Flags"},
281 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (CommonField.AccessByteWidth), "Access Byte Width"},
282 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (CommonField.BitLength), "Bit Length"},
283 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (CommonField.StartFieldBitOffset),"Field Bit Offset"},
284 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (CommonField.BaseByteOffset), "Base Byte Offset"},
285 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (CommonField.Node), "Parent Node"}
288 static ACPI_EXDUMP_INFO AcpiExDumpNode[5] =
290 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpNode), NULL},
291 {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET (Flags), "Flags"},
292 {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET (OwnerId), "Owner Id"},
293 {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET (Child), "Child List"},
294 {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET (Peer), "Next Peer"}
298 /* Dispatch table, indexed by object type */
300 static ACPI_EXDUMP_INFO *AcpiExDumpInfo[] =
316 AcpiExDumpBufferField,
319 AcpiExDumpRegionField,
321 AcpiExDumpIndexField,
326 AcpiExDumpAddressHandler,
333 /*******************************************************************************
335 * FUNCTION: AcpiExDumpObject
337 * PARAMETERS: ObjDesc - Descriptor to dump
338 * Info - Info table corresponding to this object
343 * DESCRIPTION: Walk the info table for this object
345 ******************************************************************************/
349 ACPI_OPERAND_OBJECT *ObjDesc,
350 ACPI_EXDUMP_INFO *Info)
360 "ExDumpObject: Display not implemented for object type %s\n",
361 AcpiUtGetObjectTypeName (ObjDesc));
365 /* First table entry must contain the table length (# of table entries) */
367 Count = Info->Offset;
371 Target = ACPI_ADD_PTR (UINT8, ObjDesc, Info->Offset);
374 switch (Info->Opcode)
381 AcpiExOutString ("Type", AcpiUtGetObjectTypeName (ObjDesc));
386 AcpiOsPrintf ("%20s : %2.2X\n", Name, *Target);
389 case ACPI_EXD_UINT16:
391 AcpiOsPrintf ("%20s : %4.4X\n", Name, ACPI_GET16 (Target));
394 case ACPI_EXD_UINT32:
396 AcpiOsPrintf ("%20s : %8.8X\n", Name, ACPI_GET32 (Target));
399 case ACPI_EXD_UINT64:
401 AcpiOsPrintf ("%20s : %8.8X%8.8X\n", "Value",
402 ACPI_FORMAT_UINT64 (ACPI_GET64 (Target)));
405 case ACPI_EXD_POINTER:
406 case ACPI_EXD_ADDRESS:
408 AcpiExOutPointer (Name, *ACPI_CAST_PTR (void *, Target));
411 case ACPI_EXD_STRING:
413 AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);
417 case ACPI_EXD_BUFFER:
419 ACPI_DUMP_BUFFER (ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length);
422 case ACPI_EXD_PACKAGE:
424 /* Dump the package contents */
426 AcpiOsPrintf ("\nPackage Contents:\n");
427 AcpiExDumpPackageObj (ObjDesc, 0, 0);
432 AcpiExDumpObject (ObjDesc, AcpiExDumpFieldCommon);
435 case ACPI_EXD_REFERENCE:
437 AcpiExOutString ("Class Name",
438 ACPI_CAST_PTR (char, AcpiUtGetReferenceName (ObjDesc)));
439 AcpiExDumpReferenceObj (ObjDesc);
444 AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n",
455 /*******************************************************************************
457 * FUNCTION: AcpiExDumpOperand
459 * PARAMETERS: *ObjDesc - Pointer to entry to be dumped
460 * Depth - Current nesting depth
464 * DESCRIPTION: Dump an operand object
466 ******************************************************************************/
470 ACPI_OPERAND_OBJECT *ObjDesc,
477 ACPI_FUNCTION_NAME (ExDumpOperand)
480 if (!((ACPI_LV_EXEC & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
487 /* This could be a null element of a package */
489 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n"));
493 if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
495 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p Namespace Node: ", ObjDesc));
496 ACPI_DUMP_ENTRY (ObjDesc, ACPI_LV_EXEC);
500 if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
502 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
503 "%p is not a node or operand object: [%s]\n",
504 ObjDesc, AcpiUtGetDescriptorName (ObjDesc)));
505 ACPI_DUMP_BUFFER (ObjDesc, sizeof (ACPI_OPERAND_OBJECT));
509 /* ObjDesc is a valid object */
513 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%*s[%u] %p ",
514 Depth, " ", Depth, ObjDesc));
518 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", ObjDesc));
521 /* Decode object type */
523 switch (ObjDesc->Common.Type)
525 case ACPI_TYPE_LOCAL_REFERENCE:
527 AcpiOsPrintf ("Reference: [%s] ", AcpiUtGetReferenceName (ObjDesc));
529 switch (ObjDesc->Reference.Class)
531 case ACPI_REFCLASS_DEBUG:
537 case ACPI_REFCLASS_INDEX:
539 AcpiOsPrintf ("%p\n", ObjDesc->Reference.Object);
543 case ACPI_REFCLASS_TABLE:
545 AcpiOsPrintf ("Table Index %X\n", ObjDesc->Reference.Value);
549 case ACPI_REFCLASS_REFOF:
551 AcpiOsPrintf ("%p [%s]\n", ObjDesc->Reference.Object,
552 AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *)
553 ObjDesc->Reference.Object)->Common.Type));
557 case ACPI_REFCLASS_NAME:
559 AcpiOsPrintf ("- [%4.4s]\n", ObjDesc->Reference.Node->Name.Ascii);
563 case ACPI_REFCLASS_ARG:
564 case ACPI_REFCLASS_LOCAL:
566 AcpiOsPrintf ("%X\n", ObjDesc->Reference.Value);
570 default: /* Unknown reference class */
572 AcpiOsPrintf ("%2.2X\n", ObjDesc->Reference.Class);
578 case ACPI_TYPE_BUFFER:
580 AcpiOsPrintf ("Buffer length %.2X @ %p\n",
581 ObjDesc->Buffer.Length, ObjDesc->Buffer.Pointer);
583 /* Debug only -- dump the buffer contents */
585 if (ObjDesc->Buffer.Pointer)
587 Length = ObjDesc->Buffer.Length;
593 AcpiOsPrintf ("Buffer Contents: (displaying length 0x%.2X)\n",
595 ACPI_DUMP_BUFFER (ObjDesc->Buffer.Pointer, Length);
600 case ACPI_TYPE_INTEGER:
602 AcpiOsPrintf ("Integer %8.8X%8.8X\n",
603 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
607 case ACPI_TYPE_PACKAGE:
609 AcpiOsPrintf ("Package [Len %X] ElementArray %p\n",
610 ObjDesc->Package.Count, ObjDesc->Package.Elements);
613 * If elements exist, package element pointer is valid,
614 * and debug_level exceeds 1, dump package's elements.
616 if (ObjDesc->Package.Count &&
617 ObjDesc->Package.Elements &&
620 for (Index = 0; Index < ObjDesc->Package.Count; Index++)
622 AcpiExDumpOperand (ObjDesc->Package.Elements[Index], Depth+1);
628 case ACPI_TYPE_REGION:
630 AcpiOsPrintf ("Region %s (%X)",
631 AcpiUtGetRegionName (ObjDesc->Region.SpaceId),
632 ObjDesc->Region.SpaceId);
635 * If the address and length have not been evaluated,
638 if (!(ObjDesc->Region.Flags & AOPOBJ_DATA_VALID))
644 AcpiOsPrintf (" base %8.8X%8.8X Length %X\n",
645 ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address),
646 ObjDesc->Region.Length);
651 case ACPI_TYPE_STRING:
653 AcpiOsPrintf ("String length %X @ %p ",
654 ObjDesc->String.Length,
655 ObjDesc->String.Pointer);
657 AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);
662 case ACPI_TYPE_LOCAL_BANK_FIELD:
664 AcpiOsPrintf ("BankField\n");
668 case ACPI_TYPE_LOCAL_REGION_FIELD:
670 AcpiOsPrintf ("RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at "
671 "byte=%X bit=%X of below:\n",
672 ObjDesc->Field.BitLength,
673 ObjDesc->Field.AccessByteWidth,
674 ObjDesc->Field.FieldFlags & AML_FIELD_LOCK_RULE_MASK,
675 ObjDesc->Field.FieldFlags & AML_FIELD_UPDATE_RULE_MASK,
676 ObjDesc->Field.BaseByteOffset,
677 ObjDesc->Field.StartFieldBitOffset);
679 AcpiExDumpOperand (ObjDesc->Field.RegionObj, Depth+1);
683 case ACPI_TYPE_LOCAL_INDEX_FIELD:
685 AcpiOsPrintf ("IndexField\n");
689 case ACPI_TYPE_BUFFER_FIELD:
691 AcpiOsPrintf ("BufferField: %X bits at byte %X bit %X of\n",
692 ObjDesc->BufferField.BitLength,
693 ObjDesc->BufferField.BaseByteOffset,
694 ObjDesc->BufferField.StartFieldBitOffset);
696 if (!ObjDesc->BufferField.BufferObj)
698 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL*\n"));
700 else if ((ObjDesc->BufferField.BufferObj)->Common.Type !=
703 AcpiOsPrintf ("*not a Buffer*\n");
707 AcpiExDumpOperand (ObjDesc->BufferField.BufferObj, Depth+1);
712 case ACPI_TYPE_EVENT:
714 AcpiOsPrintf ("Event\n");
718 case ACPI_TYPE_METHOD:
720 AcpiOsPrintf ("Method(%X) @ %p:%X\n",
721 ObjDesc->Method.ParamCount,
722 ObjDesc->Method.AmlStart,
723 ObjDesc->Method.AmlLength);
727 case ACPI_TYPE_MUTEX:
729 AcpiOsPrintf ("Mutex\n");
733 case ACPI_TYPE_DEVICE:
735 AcpiOsPrintf ("Device\n");
739 case ACPI_TYPE_POWER:
741 AcpiOsPrintf ("Power\n");
745 case ACPI_TYPE_PROCESSOR:
747 AcpiOsPrintf ("Processor\n");
751 case ACPI_TYPE_THERMAL:
753 AcpiOsPrintf ("Thermal\n");
760 AcpiOsPrintf ("Unknown Type %X\n", ObjDesc->Common.Type);
768 /*******************************************************************************
770 * FUNCTION: AcpiExDumpOperands
772 * PARAMETERS: Operands - A list of Operand objects
773 * OpcodeName - AML opcode name
774 * NumOperands - Operand count for this opcode
776 * DESCRIPTION: Dump the operands associated with the opcode
778 ******************************************************************************/
782 ACPI_OPERAND_OBJECT **Operands,
783 const char *OpcodeName,
786 ACPI_FUNCTION_NAME (ExDumpOperands);
791 OpcodeName = "UNKNOWN";
794 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
795 "**** Start operand dump for opcode [%s], %u operands\n",
796 OpcodeName, NumOperands));
798 if (NumOperands == 0)
803 /* Dump the individual operands */
807 AcpiExDumpOperand (*Operands, 0);
812 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
813 "**** End operand dump for [%s]\n", OpcodeName));
818 /*******************************************************************************
820 * FUNCTION: AcpiExOut* functions
822 * PARAMETERS: Title - Descriptive text
823 * Value - Value to be displayed
825 * DESCRIPTION: Object dump output formatting functions. These functions
826 * reduce the number of format strings required and keeps them
827 * all in one place for easy modification.
829 ******************************************************************************/
836 AcpiOsPrintf ("%20s : %s\n", Title, Value);
844 AcpiOsPrintf ("%20s : %p\n", Title, Value);
848 /*******************************************************************************
850 * FUNCTION: AcpiExDumpNamespaceNode
852 * PARAMETERS: Node - Descriptor to dump
853 * Flags - Force display if TRUE
855 * DESCRIPTION: Dumps the members of the given.Node
857 ******************************************************************************/
860 AcpiExDumpNamespaceNode (
861 ACPI_NAMESPACE_NODE *Node,
865 ACPI_FUNCTION_ENTRY ();
870 if (!((ACPI_LV_OBJECTS & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
876 AcpiOsPrintf ("%20s : %4.4s\n", "Name", AcpiUtGetNodeName (Node));
877 AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type));
878 AcpiExOutPointer ("Attached Object", AcpiNsGetAttachedObject (Node));
879 AcpiExOutPointer ("Parent", Node->Parent);
881 AcpiExDumpObject (ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node),
886 /*******************************************************************************
888 * FUNCTION: AcpiExDumpReferenceObj
890 * PARAMETERS: Object - Descriptor to dump
892 * DESCRIPTION: Dumps a reference object
894 ******************************************************************************/
897 AcpiExDumpReferenceObj (
898 ACPI_OPERAND_OBJECT *ObjDesc)
904 RetBuf.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
906 if (ObjDesc->Reference.Class == ACPI_REFCLASS_NAME)
908 AcpiOsPrintf (" %p ", ObjDesc->Reference.Node);
910 Status = AcpiNsHandleToPathname (ObjDesc->Reference.Node, &RetBuf);
911 if (ACPI_FAILURE (Status))
913 AcpiOsPrintf (" Could not convert name to pathname\n");
917 AcpiOsPrintf ("%s\n", (char *) RetBuf.Pointer);
918 ACPI_FREE (RetBuf.Pointer);
921 else if (ObjDesc->Reference.Object)
923 if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND)
925 AcpiOsPrintf (" Target: %p", ObjDesc->Reference.Object);
926 if (ObjDesc->Reference.Class == ACPI_REFCLASS_TABLE)
928 AcpiOsPrintf (" Table Index: %X\n", ObjDesc->Reference.Value);
932 AcpiOsPrintf (" Target: %p [%s]\n", ObjDesc->Reference.Object,
933 AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *)
934 ObjDesc->Reference.Object)->Common.Type));
939 AcpiOsPrintf (" Target: %p\n", ObjDesc->Reference.Object);
945 /*******************************************************************************
947 * FUNCTION: AcpiExDumpPackageObj
949 * PARAMETERS: ObjDesc - Descriptor to dump
950 * Level - Indentation Level
951 * Index - Package index for this object
953 * DESCRIPTION: Dumps the elements of the package
955 ******************************************************************************/
958 AcpiExDumpPackageObj (
959 ACPI_OPERAND_OBJECT *ObjDesc,
966 /* Indentation and index output */
970 for (i = 0; i < Level; i++)
975 AcpiOsPrintf ("[%.2d] ", Index);
978 AcpiOsPrintf ("%p ", ObjDesc);
980 /* Null package elements are allowed */
984 AcpiOsPrintf ("[Null Object]\n");
988 /* Packages may only contain a few object types */
990 switch (ObjDesc->Common.Type)
992 case ACPI_TYPE_INTEGER:
994 AcpiOsPrintf ("[Integer] = %8.8X%8.8X\n",
995 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
999 case ACPI_TYPE_STRING:
1001 AcpiOsPrintf ("[String] Value: ");
1002 for (i = 0; i < ObjDesc->String.Length; i++)
1004 AcpiOsPrintf ("%c", ObjDesc->String.Pointer[i]);
1006 AcpiOsPrintf ("\n");
1010 case ACPI_TYPE_BUFFER:
1012 AcpiOsPrintf ("[Buffer] Length %.2X = ", ObjDesc->Buffer.Length);
1013 if (ObjDesc->Buffer.Length)
1015 AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer),
1016 ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
1020 AcpiOsPrintf ("\n");
1025 case ACPI_TYPE_PACKAGE:
1027 AcpiOsPrintf ("[Package] Contains %u Elements:\n",
1028 ObjDesc->Package.Count);
1030 for (i = 0; i < ObjDesc->Package.Count; i++)
1032 AcpiExDumpPackageObj (ObjDesc->Package.Elements[i], Level+1, i);
1037 case ACPI_TYPE_LOCAL_REFERENCE:
1039 AcpiOsPrintf ("[Object Reference] Type [%s] %2.2X",
1040 AcpiUtGetReferenceName (ObjDesc),
1041 ObjDesc->Reference.Class);
1042 AcpiExDumpReferenceObj (ObjDesc);
1048 AcpiOsPrintf ("[Unknown Type] %X\n", ObjDesc->Common.Type);
1054 /*******************************************************************************
1056 * FUNCTION: AcpiExDumpObjectDescriptor
1058 * PARAMETERS: ObjDesc - Descriptor to dump
1059 * Flags - Force display if TRUE
1061 * DESCRIPTION: Dumps the members of the object descriptor given.
1063 ******************************************************************************/
1066 AcpiExDumpObjectDescriptor (
1067 ACPI_OPERAND_OBJECT *ObjDesc,
1070 ACPI_FUNCTION_TRACE (ExDumpObjectDescriptor);
1080 if (!((ACPI_LV_OBJECTS & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
1086 if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
1088 AcpiExDumpNamespaceNode ((ACPI_NAMESPACE_NODE *) ObjDesc, Flags);
1090 AcpiOsPrintf ("\nAttached Object (%p):\n",
1091 ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object);
1093 AcpiExDumpObjectDescriptor (
1094 ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object, Flags);
1098 if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
1101 "ExDumpObjectDescriptor: %p is not an ACPI operand object: [%s]\n",
1102 ObjDesc, AcpiUtGetDescriptorName (ObjDesc));
1106 if (ObjDesc->Common.Type > ACPI_TYPE_NS_NODE_MAX)
1113 AcpiExDumpObject (ObjDesc, AcpiExDumpCommon);
1115 /* Object-specific fields */
1117 AcpiExDumpObject (ObjDesc, AcpiExDumpInfo[ObjDesc->Common.Type]);