1 /******************************************************************************
3 * Module Name: exdump - Interpreter debug output routines
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2012, 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.
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[5] =
214 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpRegionField), NULL},
215 {ACPI_EXD_FIELD, 0, NULL},
216 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Field.AccessLength), "AccessLength"},
217 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Field.RegionObj), "Region Object"},
218 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Field.ResourceBuffer), "ResourceBuffer"}
221 static ACPI_EXDUMP_INFO AcpiExDumpBankField[5] =
223 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBankField), NULL},
224 {ACPI_EXD_FIELD, 0, NULL},
225 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (BankField.Value), "Value"},
226 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (BankField.RegionObj), "Region Object"},
227 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (BankField.BankObj), "Bank Object"}
230 static ACPI_EXDUMP_INFO AcpiExDumpIndexField[5] =
232 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBankField), NULL},
233 {ACPI_EXD_FIELD, 0, NULL},
234 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (IndexField.Value), "Value"},
235 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (IndexField.IndexObj), "Index Object"},
236 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (IndexField.DataObj), "Data Object"}
239 static ACPI_EXDUMP_INFO AcpiExDumpReference[8] =
241 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpReference), NULL},
242 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Reference.Class), "Class"},
243 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Reference.TargetType), "Target Type"},
244 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Reference.Value), "Value"},
245 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Object), "Object Desc"},
246 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Node), "Node"},
247 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Where), "Where"},
248 {ACPI_EXD_REFERENCE,0, NULL}
251 static ACPI_EXDUMP_INFO AcpiExDumpAddressHandler[6] =
253 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpAddressHandler), NULL},
254 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (AddressSpace.SpaceId), "Space Id"},
255 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Next), "Next"},
256 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.RegionList), "Region List"},
257 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Node), "Node"},
258 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Context), "Context"}
261 static ACPI_EXDUMP_INFO AcpiExDumpNotify[3] =
263 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpNotify), NULL},
264 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Node), "Node"},
265 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Context), "Context"}
269 /* Miscellaneous tables */
271 static ACPI_EXDUMP_INFO AcpiExDumpCommon[4] =
273 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpCommon), NULL},
274 {ACPI_EXD_TYPE , 0, NULL},
275 {ACPI_EXD_UINT16, ACPI_EXD_OFFSET (Common.ReferenceCount), "Reference Count"},
276 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Common.Flags), "Flags"}
279 static ACPI_EXDUMP_INFO AcpiExDumpFieldCommon[7] =
281 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpFieldCommon), NULL},
282 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (CommonField.FieldFlags), "Field Flags"},
283 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (CommonField.AccessByteWidth), "Access Byte Width"},
284 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (CommonField.BitLength), "Bit Length"},
285 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (CommonField.StartFieldBitOffset),"Field Bit Offset"},
286 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (CommonField.BaseByteOffset), "Base Byte Offset"},
287 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (CommonField.Node), "Parent Node"}
290 static ACPI_EXDUMP_INFO AcpiExDumpNode[5] =
292 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpNode), NULL},
293 {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET (Flags), "Flags"},
294 {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET (OwnerId), "Owner Id"},
295 {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET (Child), "Child List"},
296 {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET (Peer), "Next Peer"}
300 /* Dispatch table, indexed by object type */
302 static ACPI_EXDUMP_INFO *AcpiExDumpInfo[] =
318 AcpiExDumpBufferField,
321 AcpiExDumpRegionField,
323 AcpiExDumpIndexField,
328 AcpiExDumpAddressHandler,
335 /*******************************************************************************
337 * FUNCTION: AcpiExDumpObject
339 * PARAMETERS: ObjDesc - Descriptor to dump
340 * Info - Info table corresponding to this object
345 * DESCRIPTION: Walk the info table for this object
347 ******************************************************************************/
351 ACPI_OPERAND_OBJECT *ObjDesc,
352 ACPI_EXDUMP_INFO *Info)
362 "ExDumpObject: Display not implemented for object type %s\n",
363 AcpiUtGetObjectTypeName (ObjDesc));
367 /* First table entry must contain the table length (# of table entries) */
369 Count = Info->Offset;
373 Target = ACPI_ADD_PTR (UINT8, ObjDesc, Info->Offset);
376 switch (Info->Opcode)
383 AcpiExOutString ("Type", AcpiUtGetObjectTypeName (ObjDesc));
388 AcpiOsPrintf ("%20s : %2.2X\n", Name, *Target);
391 case ACPI_EXD_UINT16:
393 AcpiOsPrintf ("%20s : %4.4X\n", Name, ACPI_GET16 (Target));
396 case ACPI_EXD_UINT32:
398 AcpiOsPrintf ("%20s : %8.8X\n", Name, ACPI_GET32 (Target));
401 case ACPI_EXD_UINT64:
403 AcpiOsPrintf ("%20s : %8.8X%8.8X\n", "Value",
404 ACPI_FORMAT_UINT64 (ACPI_GET64 (Target)));
407 case ACPI_EXD_POINTER:
408 case ACPI_EXD_ADDRESS:
410 AcpiExOutPointer (Name, *ACPI_CAST_PTR (void *, Target));
413 case ACPI_EXD_STRING:
415 AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);
419 case ACPI_EXD_BUFFER:
421 ACPI_DUMP_BUFFER (ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length);
424 case ACPI_EXD_PACKAGE:
426 /* Dump the package contents */
428 AcpiOsPrintf ("\nPackage Contents:\n");
429 AcpiExDumpPackageObj (ObjDesc, 0, 0);
434 AcpiExDumpObject (ObjDesc, AcpiExDumpFieldCommon);
437 case ACPI_EXD_REFERENCE:
439 AcpiExOutString ("Class Name",
440 ACPI_CAST_PTR (char, AcpiUtGetReferenceName (ObjDesc)));
441 AcpiExDumpReferenceObj (ObjDesc);
446 AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n",
457 /*******************************************************************************
459 * FUNCTION: AcpiExDumpOperand
461 * PARAMETERS: *ObjDesc - Pointer to entry to be dumped
462 * Depth - Current nesting depth
466 * DESCRIPTION: Dump an operand object
468 ******************************************************************************/
472 ACPI_OPERAND_OBJECT *ObjDesc,
479 ACPI_FUNCTION_NAME (ExDumpOperand)
482 if (!((ACPI_LV_EXEC & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
489 /* This could be a null element of a package */
491 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n"));
495 if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
497 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p Namespace Node: ", ObjDesc));
498 ACPI_DUMP_ENTRY (ObjDesc, ACPI_LV_EXEC);
502 if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
504 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
505 "%p is not a node or operand object: [%s]\n",
506 ObjDesc, AcpiUtGetDescriptorName (ObjDesc)));
507 ACPI_DUMP_BUFFER (ObjDesc, sizeof (ACPI_OPERAND_OBJECT));
511 /* ObjDesc is a valid object */
515 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%*s[%u] %p ",
516 Depth, " ", Depth, ObjDesc));
520 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", ObjDesc));
523 /* Decode object type */
525 switch (ObjDesc->Common.Type)
527 case ACPI_TYPE_LOCAL_REFERENCE:
529 AcpiOsPrintf ("Reference: [%s] ", AcpiUtGetReferenceName (ObjDesc));
531 switch (ObjDesc->Reference.Class)
533 case ACPI_REFCLASS_DEBUG:
539 case ACPI_REFCLASS_INDEX:
541 AcpiOsPrintf ("%p\n", ObjDesc->Reference.Object);
545 case ACPI_REFCLASS_TABLE:
547 AcpiOsPrintf ("Table Index %X\n", ObjDesc->Reference.Value);
551 case ACPI_REFCLASS_REFOF:
553 AcpiOsPrintf ("%p [%s]\n", ObjDesc->Reference.Object,
554 AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *)
555 ObjDesc->Reference.Object)->Common.Type));
559 case ACPI_REFCLASS_NAME:
561 AcpiOsPrintf ("- [%4.4s]\n", ObjDesc->Reference.Node->Name.Ascii);
565 case ACPI_REFCLASS_ARG:
566 case ACPI_REFCLASS_LOCAL:
568 AcpiOsPrintf ("%X\n", ObjDesc->Reference.Value);
572 default: /* Unknown reference class */
574 AcpiOsPrintf ("%2.2X\n", ObjDesc->Reference.Class);
580 case ACPI_TYPE_BUFFER:
582 AcpiOsPrintf ("Buffer length %.2X @ %p\n",
583 ObjDesc->Buffer.Length, ObjDesc->Buffer.Pointer);
585 /* Debug only -- dump the buffer contents */
587 if (ObjDesc->Buffer.Pointer)
589 Length = ObjDesc->Buffer.Length;
595 AcpiOsPrintf ("Buffer Contents: (displaying length 0x%.2X)\n",
597 ACPI_DUMP_BUFFER (ObjDesc->Buffer.Pointer, Length);
602 case ACPI_TYPE_INTEGER:
604 AcpiOsPrintf ("Integer %8.8X%8.8X\n",
605 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
609 case ACPI_TYPE_PACKAGE:
611 AcpiOsPrintf ("Package [Len %X] ElementArray %p\n",
612 ObjDesc->Package.Count, ObjDesc->Package.Elements);
615 * If elements exist, package element pointer is valid,
616 * and debug_level exceeds 1, dump package's elements.
618 if (ObjDesc->Package.Count &&
619 ObjDesc->Package.Elements &&
622 for (Index = 0; Index < ObjDesc->Package.Count; Index++)
624 AcpiExDumpOperand (ObjDesc->Package.Elements[Index], Depth+1);
630 case ACPI_TYPE_REGION:
632 AcpiOsPrintf ("Region %s (%X)",
633 AcpiUtGetRegionName (ObjDesc->Region.SpaceId),
634 ObjDesc->Region.SpaceId);
637 * If the address and length have not been evaluated,
640 if (!(ObjDesc->Region.Flags & AOPOBJ_DATA_VALID))
646 AcpiOsPrintf (" base %8.8X%8.8X Length %X\n",
647 ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address),
648 ObjDesc->Region.Length);
653 case ACPI_TYPE_STRING:
655 AcpiOsPrintf ("String length %X @ %p ",
656 ObjDesc->String.Length,
657 ObjDesc->String.Pointer);
659 AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);
664 case ACPI_TYPE_LOCAL_BANK_FIELD:
666 AcpiOsPrintf ("BankField\n");
670 case ACPI_TYPE_LOCAL_REGION_FIELD:
672 AcpiOsPrintf ("RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at "
673 "byte=%X bit=%X of below:\n",
674 ObjDesc->Field.BitLength,
675 ObjDesc->Field.AccessByteWidth,
676 ObjDesc->Field.FieldFlags & AML_FIELD_LOCK_RULE_MASK,
677 ObjDesc->Field.FieldFlags & AML_FIELD_UPDATE_RULE_MASK,
678 ObjDesc->Field.BaseByteOffset,
679 ObjDesc->Field.StartFieldBitOffset);
681 AcpiExDumpOperand (ObjDesc->Field.RegionObj, Depth+1);
685 case ACPI_TYPE_LOCAL_INDEX_FIELD:
687 AcpiOsPrintf ("IndexField\n");
691 case ACPI_TYPE_BUFFER_FIELD:
693 AcpiOsPrintf ("BufferField: %X bits at byte %X bit %X of\n",
694 ObjDesc->BufferField.BitLength,
695 ObjDesc->BufferField.BaseByteOffset,
696 ObjDesc->BufferField.StartFieldBitOffset);
698 if (!ObjDesc->BufferField.BufferObj)
700 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL*\n"));
702 else if ((ObjDesc->BufferField.BufferObj)->Common.Type !=
705 AcpiOsPrintf ("*not a Buffer*\n");
709 AcpiExDumpOperand (ObjDesc->BufferField.BufferObj, Depth+1);
714 case ACPI_TYPE_EVENT:
716 AcpiOsPrintf ("Event\n");
720 case ACPI_TYPE_METHOD:
722 AcpiOsPrintf ("Method(%X) @ %p:%X\n",
723 ObjDesc->Method.ParamCount,
724 ObjDesc->Method.AmlStart,
725 ObjDesc->Method.AmlLength);
729 case ACPI_TYPE_MUTEX:
731 AcpiOsPrintf ("Mutex\n");
735 case ACPI_TYPE_DEVICE:
737 AcpiOsPrintf ("Device\n");
741 case ACPI_TYPE_POWER:
743 AcpiOsPrintf ("Power\n");
747 case ACPI_TYPE_PROCESSOR:
749 AcpiOsPrintf ("Processor\n");
753 case ACPI_TYPE_THERMAL:
755 AcpiOsPrintf ("Thermal\n");
762 AcpiOsPrintf ("Unknown Type %X\n", ObjDesc->Common.Type);
770 /*******************************************************************************
772 * FUNCTION: AcpiExDumpOperands
774 * PARAMETERS: Operands - A list of Operand objects
775 * OpcodeName - AML opcode name
776 * NumOperands - Operand count for this opcode
778 * DESCRIPTION: Dump the operands associated with the opcode
780 ******************************************************************************/
784 ACPI_OPERAND_OBJECT **Operands,
785 const char *OpcodeName,
788 ACPI_FUNCTION_NAME (ExDumpOperands);
793 OpcodeName = "UNKNOWN";
796 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
797 "**** Start operand dump for opcode [%s], %u operands\n",
798 OpcodeName, NumOperands));
800 if (NumOperands == 0)
805 /* Dump the individual operands */
809 AcpiExDumpOperand (*Operands, 0);
814 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
815 "**** End operand dump for [%s]\n", OpcodeName));
820 /*******************************************************************************
822 * FUNCTION: AcpiExOut* functions
824 * PARAMETERS: Title - Descriptive text
825 * Value - Value to be displayed
827 * DESCRIPTION: Object dump output formatting functions. These functions
828 * reduce the number of format strings required and keeps them
829 * all in one place for easy modification.
831 ******************************************************************************/
838 AcpiOsPrintf ("%20s : %s\n", Title, Value);
846 AcpiOsPrintf ("%20s : %p\n", Title, Value);
850 /*******************************************************************************
852 * FUNCTION: AcpiExDumpNamespaceNode
854 * PARAMETERS: Node - Descriptor to dump
855 * Flags - Force display if TRUE
857 * DESCRIPTION: Dumps the members of the given.Node
859 ******************************************************************************/
862 AcpiExDumpNamespaceNode (
863 ACPI_NAMESPACE_NODE *Node,
867 ACPI_FUNCTION_ENTRY ();
872 if (!((ACPI_LV_OBJECTS & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
878 AcpiOsPrintf ("%20s : %4.4s\n", "Name", AcpiUtGetNodeName (Node));
879 AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type));
880 AcpiExOutPointer ("Attached Object", AcpiNsGetAttachedObject (Node));
881 AcpiExOutPointer ("Parent", Node->Parent);
883 AcpiExDumpObject (ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node),
888 /*******************************************************************************
890 * FUNCTION: AcpiExDumpReferenceObj
892 * PARAMETERS: Object - Descriptor to dump
894 * DESCRIPTION: Dumps a reference object
896 ******************************************************************************/
899 AcpiExDumpReferenceObj (
900 ACPI_OPERAND_OBJECT *ObjDesc)
906 RetBuf.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
908 if (ObjDesc->Reference.Class == ACPI_REFCLASS_NAME)
910 AcpiOsPrintf (" %p ", ObjDesc->Reference.Node);
912 Status = AcpiNsHandleToPathname (ObjDesc->Reference.Node, &RetBuf);
913 if (ACPI_FAILURE (Status))
915 AcpiOsPrintf (" Could not convert name to pathname\n");
919 AcpiOsPrintf ("%s\n", (char *) RetBuf.Pointer);
920 ACPI_FREE (RetBuf.Pointer);
923 else if (ObjDesc->Reference.Object)
925 if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND)
927 AcpiOsPrintf (" Target: %p", ObjDesc->Reference.Object);
928 if (ObjDesc->Reference.Class == ACPI_REFCLASS_TABLE)
930 AcpiOsPrintf (" Table Index: %X\n", ObjDesc->Reference.Value);
934 AcpiOsPrintf (" Target: %p [%s]\n", ObjDesc->Reference.Object,
935 AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *)
936 ObjDesc->Reference.Object)->Common.Type));
941 AcpiOsPrintf (" Target: %p\n", ObjDesc->Reference.Object);
947 /*******************************************************************************
949 * FUNCTION: AcpiExDumpPackageObj
951 * PARAMETERS: ObjDesc - Descriptor to dump
952 * Level - Indentation Level
953 * Index - Package index for this object
955 * DESCRIPTION: Dumps the elements of the package
957 ******************************************************************************/
960 AcpiExDumpPackageObj (
961 ACPI_OPERAND_OBJECT *ObjDesc,
968 /* Indentation and index output */
972 for (i = 0; i < Level; i++)
977 AcpiOsPrintf ("[%.2d] ", Index);
980 AcpiOsPrintf ("%p ", ObjDesc);
982 /* Null package elements are allowed */
986 AcpiOsPrintf ("[Null Object]\n");
990 /* Packages may only contain a few object types */
992 switch (ObjDesc->Common.Type)
994 case ACPI_TYPE_INTEGER:
996 AcpiOsPrintf ("[Integer] = %8.8X%8.8X\n",
997 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
1001 case ACPI_TYPE_STRING:
1003 AcpiOsPrintf ("[String] Value: ");
1004 for (i = 0; i < ObjDesc->String.Length; i++)
1006 AcpiOsPrintf ("%c", ObjDesc->String.Pointer[i]);
1008 AcpiOsPrintf ("\n");
1012 case ACPI_TYPE_BUFFER:
1014 AcpiOsPrintf ("[Buffer] Length %.2X = ", ObjDesc->Buffer.Length);
1015 if (ObjDesc->Buffer.Length)
1017 AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer),
1018 ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
1022 AcpiOsPrintf ("\n");
1027 case ACPI_TYPE_PACKAGE:
1029 AcpiOsPrintf ("[Package] Contains %u Elements:\n",
1030 ObjDesc->Package.Count);
1032 for (i = 0; i < ObjDesc->Package.Count; i++)
1034 AcpiExDumpPackageObj (ObjDesc->Package.Elements[i], Level+1, i);
1039 case ACPI_TYPE_LOCAL_REFERENCE:
1041 AcpiOsPrintf ("[Object Reference] Type [%s] %2.2X",
1042 AcpiUtGetReferenceName (ObjDesc),
1043 ObjDesc->Reference.Class);
1044 AcpiExDumpReferenceObj (ObjDesc);
1050 AcpiOsPrintf ("[Unknown Type] %X\n", ObjDesc->Common.Type);
1056 /*******************************************************************************
1058 * FUNCTION: AcpiExDumpObjectDescriptor
1060 * PARAMETERS: ObjDesc - Descriptor to dump
1061 * Flags - Force display if TRUE
1063 * DESCRIPTION: Dumps the members of the object descriptor given.
1065 ******************************************************************************/
1068 AcpiExDumpObjectDescriptor (
1069 ACPI_OPERAND_OBJECT *ObjDesc,
1072 ACPI_FUNCTION_TRACE (ExDumpObjectDescriptor);
1082 if (!((ACPI_LV_OBJECTS & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
1088 if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
1090 AcpiExDumpNamespaceNode ((ACPI_NAMESPACE_NODE *) ObjDesc, Flags);
1092 AcpiOsPrintf ("\nAttached Object (%p):\n",
1093 ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object);
1095 AcpiExDumpObjectDescriptor (
1096 ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object, Flags);
1100 if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
1103 "ExDumpObjectDescriptor: %p is not an ACPI operand object: [%s]\n",
1104 ObjDesc, AcpiUtGetDescriptorName (ObjDesc));
1108 if (ObjDesc->Common.Type > ACPI_TYPE_NS_NODE_MAX)
1115 AcpiExDumpObject (ObjDesc, AcpiExDumpCommon);
1117 /* Object-specific fields */
1119 AcpiExDumpObject (ObjDesc, AcpiExDumpInfo[ObjDesc->Common.Type]);