Deleted Added
full compact
1/******************************************************************************
2 *
3 * Module Name: nsdump - table dumping routines for debug
4 * $Revision: 105 $
4 * $Revision: 116 $
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.

--- 109 unchanged lines hidden (view full) ---

122#include "acnamesp.h"
123#include "actables.h"
124#include "acparser.h"
125
126
127#define _COMPONENT ACPI_NAMESPACE
128 MODULE_NAME ("nsdump")
129
130
130#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
131
132
133/*******************************************************************************
134 *
135 * FUNCTION: AcpiNsPrintPathname
136 *
137 * PARAMETERS: NumSegment - Number of ACPI name segments
138 * Pathname - The compressed (internal) path
139 *
140 * DESCRIPTION: Print an object's full namespace pathname
141 *
142 ******************************************************************************/
143
144void
145AcpiNsPrintPathname (
146 UINT32 NumSegments,
147 char *Pathname)
148{
149 UINT32 i;
150
151 PROC_NAME ("AcpiNsPrintPathname");
152
153
154 if (!(AcpiDbgLevel & ACPI_LV_NAMES) || !(AcpiDbgLayer & ACPI_NAMESPACE))
155 {
156 return;
157 }
158
159 /* Print the entire name */
160
161 ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "["));
162
163 for (i = 0; i < NumSegments; i++)
164 {
165 AcpiOsPrintf ("%4.4s.", (char *) &Pathname[i * 4]);
166 }
167
168 AcpiOsPrintf ("]\n");
169}
170
171
172/*******************************************************************************
173 *
174 * FUNCTION: AcpiNsDumpPathname
175 *
176 * PARAMETERS: Handle - Object
177 * Msg - Prefix message
178 * Level - Desired debug level
179 * Component - Caller's component ID
180 *
181 * DESCRIPTION: Print an object's full namespace pathname

--- 28 unchanged lines hidden (view full) ---

210 return_ACPI_STATUS (AE_NO_MEMORY);
211 }
212
213 /* Convert handle to a full pathname and print it (with supplied message) */
214
215 Length = PATHNAME_MAX;
216 if (ACPI_SUCCESS (AcpiNsHandleToPathname (Handle, &Length, Buffer)))
217 {
179 AcpiOsPrintf ("%s %s (%p)\n", Msg, Buffer, Handle);
218 AcpiOsPrintf ("%s %s (Node %p)\n", Msg, Buffer, Handle);
219 }
220
221 ACPI_MEM_FREE (Buffer);
222
223 return_ACPI_STATUS (AE_OK);
224}
225
226

--- 39 unchanged lines hidden (view full) ---

266 WhichBit = 1;
267
268
269 if (!(AcpiDbgLevel & Info->DebugLevel))
270 {
271 return (AE_OK);
272 }
273
274 if (!((ACPI_LV_TABLES & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
275 {
276 return (AE_OK);
277 }
278
279 if (!ObjHandle)
280 {
281 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n"));
282 return (AE_OK);
283 }
284
285 /* Check if the owner matches */
286
287 if ((Info->OwnerId != ACPI_UINT32_MAX) &&
288 (Info->OwnerId != ThisNode->OwnerId))
289 {
290 return (AE_OK);
291 }
292
249
293 /* Indent the object according to the level */
294
295 while (LevelTmp--)
296 {
254
297 /* Print appropriate characters to form tree structure */
298
299 if (LevelTmp)
300 {
301 if (DownstreamSiblingMask & WhichBit)
302 {
261 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "|"));
303 AcpiOsPrintf ("|");
304 }
263
305 else
306 {
266 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " "));
307 AcpiOsPrintf (" ");
308 }
309
310 WhichBit <<= 1;
311 }
271
312 else
313 {
314 if (AcpiNsExistDownstreamSibling (ThisNode + 1))
315 {
316 DownstreamSiblingMask |= (1 << (Level - 1));
277 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "+"));
317 AcpiOsPrintf ("+");
318 }
279
319 else
320 {
321 DownstreamSiblingMask &= ACPI_UINT32_MAX ^ (1 << (Level - 1));
283 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "+"));
322 AcpiOsPrintf ("+");
323 }
324
325 if (ThisNode->Child == NULL)
326 {
288 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "-"));
327 AcpiOsPrintf ("-");
328 }
290
329 else if (AcpiNsExistDownstreamSibling (ThisNode->Child))
330 {
293 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "+"));
331 AcpiOsPrintf ("+");
332 }
295
333 else
334 {
298 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "-"));
335 AcpiOsPrintf ("-");
336 }
337 }
338 }
339
303
340 /* Check the integrity of our data */
341
342 if (Type > INTERNAL_TYPE_MAX)
343 {
308 Type = INTERNAL_TYPE_DEF_ANY; /* prints as *ERROR* */
344 Type = INTERNAL_TYPE_DEF_ANY; /* prints as *ERROR* */
345 }
346
347 if (!AcpiUtValidAcpiName (ThisNode->Name))
348 {
349 REPORT_WARNING (("Invalid ACPI Name %08X\n", ThisNode->Name));
350 }
351
352 /*
353 * Now we can print out the pertinent information
354 */
319 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " %4.4s %-12s %p",
320 (char*)&ThisNode->Name, AcpiUtGetTypeName (Type), ThisNode));
355 AcpiOsPrintf (" %4.4s %-12s %p",
356 (char *) &ThisNode->Name, AcpiUtGetTypeName (Type), ThisNode);
357
322 ObjDesc = ThisNode->Object;
358 ObjDesc = AcpiNsGetAttachedObject (ThisNode);
359
360 switch (Info->DisplayType)
361 {
362 case ACPI_DISPLAY_SUMMARY:
363
364 if (!ObjDesc)
365 {
366 /* No attached object, we are done */
367
332 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n"));
368 AcpiOsPrintf ("\n");
369 return (AE_OK);
370 }
371
336
372 switch (Type)
373 {
374 case ACPI_TYPE_PROCESSOR:
340 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " ID %d Addr %.4X Len %.4X\n",
375 AcpiOsPrintf (" ID %d Addr %.4X Len %.4X\n",
376 ObjDesc->Processor.ProcId,
377 ObjDesc->Processor.Address,
343 ObjDesc->Processor.Length));
378 ObjDesc->Processor.Length);
379 break;
380
381 case ACPI_TYPE_DEVICE:
347 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Notification object: %p", ObjDesc));
382 AcpiOsPrintf (" Notification object: %p", ObjDesc);
383 break;
384
385 case ACPI_TYPE_METHOD:
351 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Args %d Len %.4X Aml %p \n",
386 AcpiOsPrintf (" Args %d Len %.4X Aml %p \n",
387 ObjDesc->Method.ParamCount,
388 ObjDesc->Method.AmlLength,
354 ObjDesc->Method.AmlStart));
389 ObjDesc->Method.AmlStart);
390 break;
391
392 case ACPI_TYPE_INTEGER:
358 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " = %8.8X%8.8X\n",
393 AcpiOsPrintf (" = %8.8X%8.8X\n",
394 HIDWORD (ObjDesc->Integer.Value),
360 LODWORD (ObjDesc->Integer.Value)));
395 LODWORD (ObjDesc->Integer.Value));
396 break;
397
398 case ACPI_TYPE_PACKAGE:
364 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Elements %.2X\n",
365 ObjDesc->Package.Count));
399 AcpiOsPrintf (" Elements %.2X\n",
400 ObjDesc->Package.Count);
401 break;
402
403 case ACPI_TYPE_BUFFER:
369 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Len %.2X",
370 ObjDesc->Buffer.Length));
404 AcpiOsPrintf (" Len %.2X",
405 ObjDesc->Buffer.Length);
406
407 /* Dump some of the buffer */
408
409 if (ObjDesc->Buffer.Length > 0)
410 {
376 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " ="));
411 AcpiOsPrintf (" =");
412 for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++)
413 {
379 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " %.2X",
380 ObjDesc->Buffer.Pointer[i]));
414 AcpiOsPrintf (" %.2X", ObjDesc->Buffer.Pointer[i]);
415 }
416 }
383 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n"));
417 AcpiOsPrintf ("\n");
418 break;
419
420 case ACPI_TYPE_STRING:
387 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Len %.2X",
388 ObjDesc->String.Length));
389
421 AcpiOsPrintf (" Len %.2X", ObjDesc->String.Length);
422
423 if (ObjDesc->String.Length > 0)
424 {
392 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " = \"%.32s\"...",
393 ObjDesc->String.Pointer));
425 AcpiOsPrintf (" = \"%.32s\"...", ObjDesc->String.Pointer);
426 }
395 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n"));
427 AcpiOsPrintf ("\n");
428 break;
429
430 case ACPI_TYPE_REGION:
399 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " [%s]",
400 AcpiUtGetRegionName (ObjDesc->Region.SpaceId)));
431 AcpiOsPrintf (" [%s]", AcpiUtGetRegionName (ObjDesc->Region.SpaceId));
432 if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
433 {
403 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Addr %8.8X%8.8X Len %.4X\n",
434 AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n",
435 HIDWORD(ObjDesc->Region.Address),
436 LODWORD(ObjDesc->Region.Address),
406 ObjDesc->Region.Length));
437 ObjDesc->Region.Length);
438 }
439 else
440 {
410 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " [Address/Length not evaluated]\n"));
441 AcpiOsPrintf (" [Address/Length not evaluated]\n");
442 }
443 break;
444
445 case INTERNAL_TYPE_REFERENCE:
415 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " [%s]\n",
416 AcpiPsGetOpcodeName (ObjDesc->Reference.Opcode)));
446 AcpiOsPrintf (" [%s]\n",
447 AcpiPsGetOpcodeName (ObjDesc->Reference.Opcode));
448 break;
449
450 case ACPI_TYPE_BUFFER_FIELD:
420
421 /* TBD: print Buffer name when we can easily get it */
451 if (ObjDesc->BufferField.BufferObj &&
452 ObjDesc->BufferField.BufferObj->Buffer.Node)
453 {
454 AcpiOsPrintf (" Buf [%4.4s]",
455 (char *) &ObjDesc->BufferField.BufferObj->Buffer.Node->Name);
456 }
457 break;
458
459 case INTERNAL_TYPE_REGION_FIELD:
425 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Rgn [%4.4s]",
426 (char *) &ObjDesc->CommonField.RegionObj->Region.Node->Name));
460 AcpiOsPrintf (" Rgn [%4.4s]",
461 (char *) &ObjDesc->CommonField.RegionObj->Region.Node->Name);
462 break;
463
464 case INTERNAL_TYPE_BANK_FIELD:
430 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Rgn [%4.4s]",
431 (char *) &ObjDesc->CommonField.RegionObj->Region.Node->Name));
465 AcpiOsPrintf (" Rgn [%4.4s] Bnk [%4.4s]",
466 (char *) &ObjDesc->CommonField.RegionObj->Region.Node->Name,
467 (char *) &ObjDesc->BankField.BankObj->CommonField.Node->Name);
468 break;
469
470 case INTERNAL_TYPE_INDEX_FIELD:
435 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Rgn [%4.4s]",
436 (char *) &ObjDesc->IndexField.IndexObj->CommonField.RegionObj->Region.Node->Name));
471 AcpiOsPrintf (" Idx [%4.4s] Dat [%4.4s]",
472 (char *) &ObjDesc->IndexField.IndexObj->CommonField.Node->Name,
473 (char *) &ObjDesc->IndexField.DataObj->CommonField.Node->Name);
474 break;
475
476 default:
440
441 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Object %p\n", ObjDesc));
477 AcpiOsPrintf (" Object %p\n", ObjDesc);
478 break;
479 }
480
481 /* Common field handling */
482
483 switch (Type)
484 {
485 case ACPI_TYPE_BUFFER_FIELD:
486 case INTERNAL_TYPE_REGION_FIELD:
487 case INTERNAL_TYPE_BANK_FIELD:
488 case INTERNAL_TYPE_INDEX_FIELD:
453 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Off %.2X Len %.2X Acc %.2d\n",
454 (ObjDesc->CommonField.BaseByteOffset * 8) + ObjDesc->CommonField.StartFieldBitOffset,
455 ObjDesc->CommonField.BitLength,
456 ObjDesc->CommonField.AccessBitWidth));
489 AcpiOsPrintf (" Off %.2X Len %.2X Acc %.2d\n",
490 (ObjDesc->CommonField.BaseByteOffset * 8)
491 + ObjDesc->CommonField.StartFieldBitOffset,
492 ObjDesc->CommonField.BitLength,
493 ObjDesc->CommonField.AccessBitWidth);
494 break;
495 }
496
497 break;
498
499
500 case ACPI_DISPLAY_OBJECTS:
501
465 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "%p O:%p",
466 ThisNode, ObjDesc));
502 AcpiOsPrintf ("%p O:%p",
503 ThisNode, ObjDesc);
504
505 if (!ObjDesc)
506 {
507 /* No attached object, we are done */
508
472 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n"));
509 AcpiOsPrintf ("\n");
510 return (AE_OK);
511 }
512
476 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(R%d)",
477 ObjDesc->Common.ReferenceCount));
513 AcpiOsPrintf ("(R%d)",
514 ObjDesc->Common.ReferenceCount);
515
516 switch (Type)
517 {
481
518 case ACPI_TYPE_METHOD:
519
520 /* Name is a Method and its AML offset/length are set */
521
486 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " M:%p-%X\n",
487 ObjDesc->Method.AmlStart,
488 ObjDesc->Method.AmlLength));
489
522 AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart,
523 ObjDesc->Method.AmlLength);
524 break;
525
492
526 case ACPI_TYPE_INTEGER:
527
495 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " N:%X%X\n",
496 HIDWORD(ObjDesc->Integer.Value),
497 LODWORD(ObjDesc->Integer.Value)));
528 AcpiOsPrintf (" N:%X%X\n", HIDWORD(ObjDesc->Integer.Value),
529 LODWORD(ObjDesc->Integer.Value));
530 break;
531
500
532 case ACPI_TYPE_STRING:
533
503 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " S:%p-%X\n",
504 ObjDesc->String.Pointer,
505 ObjDesc->String.Length));
534 AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer,
535 ObjDesc->String.Length);
536 break;
537
508
538 case ACPI_TYPE_BUFFER:
539
511 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " B:%p-%X\n",
512 ObjDesc->Buffer.Pointer,
513 ObjDesc->Buffer.Length));
540 AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer,
541 ObjDesc->Buffer.Length);
542 break;
543
516
544 default:
545
519 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n"));
546 AcpiOsPrintf ("\n");
547 break;
548 }
549 break;
550
551
552 default:
553 AcpiOsPrintf ("\n");
554 break;
555 }
556
557 /* If debug turned off, done */
558
559 if (!(AcpiDbgLevel & ACPI_LV_VALUES))
560 {
561 return (AE_OK);
562 }
563
564
565 /* If there is an attached object, display it */
566
535 ObjDesc = ThisNode->Object;
567 ObjDesc = AcpiNsGetAttachedObject (ThisNode);
568
569 /* Dump attached objects */
570
571 while (ObjDesc)
572 {
573 ObjType = INTERNAL_TYPE_INVALID;
574
575 /* Decode the type of attached object and dump the contents */
576
545 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Attached Object %p: ", ObjDesc));
577 AcpiOsPrintf (" Attached Object %p: ", ObjDesc);
578
579 if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED))
580 {
549 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(Ptr to Node)\n"));
581 AcpiOsPrintf ("(Ptr to Node)\n");
582 BytesToDump = sizeof (ACPI_NAMESPACE_NODE);
583 }
584
553
585 else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_INTERNAL))
586 {
587 ObjType = ObjDesc->Common.Type;
588
589 if (ObjType > INTERNAL_TYPE_MAX)
590 {
560 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(Ptr to ACPI Object type %X [UNKNOWN])\n", ObjType));
591 AcpiOsPrintf ("(Ptr to ACPI Object type %X [UNKNOWN])\n", ObjType);
592 BytesToDump = 32;
593 }
563
594 else
595 {
566 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(Ptr to ACPI Object type %2.2X [%s])\n",
567 ObjType, AcpiUtGetTypeName (ObjType)));
596 AcpiOsPrintf ("(Ptr to ACPI Object type %2.2X [%s])\n",
597 ObjType, AcpiUtGetTypeName (ObjType));
598 BytesToDump = sizeof (ACPI_OPERAND_OBJECT);
599 }
600 }
571
601 else
602 {
574 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(String or Buffer - not descriptor)\n"));
603 AcpiOsPrintf ("(String or Buffer - not descriptor)\n");
604 BytesToDump = 16;
605 }
606
607 DUMP_BUFFER (ObjDesc, BytesToDump);
608
609 /* If value is NOT an internal object, we are done */
610
611 if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED))

--- 37 unchanged lines hidden (view full) ---

649 case INTERNAL_TYPE_INDEX_FIELD:
650 ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->IndexField.IndexObj;
651 break;
652
653 default:
654 goto Cleanup;
655 }
656
628 ObjType = INTERNAL_TYPE_INVALID; /* Terminate loop after next pass */
657 ObjType = INTERNAL_TYPE_INVALID; /* Terminate loop after next pass */
658 }
659
660Cleanup:
632 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n"));
661 AcpiOsPrintf ("\n");
662 return (AE_OK);
663}
664
665
666/*******************************************************************************
667 *
668 * FUNCTION: AcpiNsDumpObjects
669 *

--- 153 unchanged lines hidden (view full) ---

823 {
824 /* entire namespace */
825
826 SearchHandle = AcpiGbl_RootNode;
827 ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n"));
828 }
829
830
802 AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth,
831 AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth,
832 ACPI_UINT32_MAX, SearchHandle);
833 return_VOID;
834}
835
836
837/*******************************************************************************
838 *
839 * FUNCTION: AcpiNsDumpEntry

--- 13 unchanged lines hidden (view full) ---

853 ACPI_WALK_INFO Info;
854
855
856 FUNCTION_ENTRY ();
857
858
859 Info.DebugLevel = DebugLevel;
860 Info.OwnerId = ACPI_UINT32_MAX;
861 Info.DisplayType = ACPI_DISPLAY_SUMMARY;
862
863 AcpiNsDumpOneObject (Handle, 1, &Info, NULL);
864}
865
866#endif
867