1 /****************************************************************************** 2 * 3 * Module Name: nsdump - table dumping routines for debug 4 * 5 *****************************************************************************/ 6 7 /****************************************************************************** 8 * 9 * 1. Copyright Notice 10 * 11 * Some or all of this work - Copyright (c) 1999 - 2015, Intel Corp. 12 * All rights reserved. 13 * 14 * 2. License 15 * 16 * 2.1. This is your license from Intel Corp. under its intellectual property 17 * rights. You may have additional license terms from the party that provided 18 * you this software, covering your right to use that party's intellectual 19 * property rights. 20 * 21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 22 * copy of the source code appearing in this file ("Covered Code") an 23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 24 * base code distributed originally by Intel ("Original Intel Code") to copy, 25 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 28 * 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; 37 * 38 * The above copyright and patent license is granted only if the following 39 * conditions are met: 40 * 41 * 3. Conditions 42 * 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. 54 * 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. 66 * 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. 72 * 73 * 3.4. Intel retains all right, title, and interest in and to the Original 74 * Intel Code. 75 * 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. 80 * 81 * 4. Disclaimer and Export Compliance 82 * 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. 90 * 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. 99 * 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. 114 * 115 *****************************************************************************/ 116 117 #include "acpi.h" 118 #include "accommon.h" 119 #include "acnamesp.h" 120 #include "acoutput.h" 121 122 123 #define _COMPONENT ACPI_NAMESPACE 124 ACPI_MODULE_NAME ("nsdump") 125 126 /* Local prototypes */ 127 128 #ifdef ACPI_OBSOLETE_FUNCTIONS 129 void 130 AcpiNsDumpRootDevices ( 131 void); 132 133 static ACPI_STATUS 134 AcpiNsDumpOneDevice ( 135 ACPI_HANDLE ObjHandle, 136 UINT32 Level, 137 void *Context, 138 void **ReturnValue); 139 #endif 140 141 142 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 143 144 static ACPI_STATUS 145 AcpiNsDumpOneObjectPath ( 146 ACPI_HANDLE ObjHandle, 147 UINT32 Level, 148 void *Context, 149 void **ReturnValue); 150 151 static ACPI_STATUS 152 AcpiNsGetMaxDepth ( 153 ACPI_HANDLE ObjHandle, 154 UINT32 Level, 155 void *Context, 156 void **ReturnValue); 157 158 159 /******************************************************************************* 160 * 161 * FUNCTION: AcpiNsPrintPathname 162 * 163 * PARAMETERS: NumSegments - Number of ACPI name segments 164 * Pathname - The compressed (internal) path 165 * 166 * RETURN: None 167 * 168 * DESCRIPTION: Print an object's full namespace pathname 169 * 170 ******************************************************************************/ 171 172 void 173 AcpiNsPrintPathname ( 174 UINT32 NumSegments, 175 char *Pathname) 176 { 177 UINT32 i; 178 179 180 ACPI_FUNCTION_NAME (NsPrintPathname); 181 182 183 /* Check if debug output enabled */ 184 185 if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_NAMES, ACPI_NAMESPACE)) 186 { 187 return; 188 } 189 190 /* Print the entire name */ 191 192 ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[")); 193 194 while (NumSegments) 195 { 196 for (i = 0; i < 4; i++) 197 { 198 isprint ((int) Pathname[i]) ? 199 AcpiOsPrintf ("%c", Pathname[i]) : 200 AcpiOsPrintf ("?"); 201 } 202 203 Pathname += ACPI_NAME_SIZE; 204 NumSegments--; 205 if (NumSegments) 206 { 207 AcpiOsPrintf ("."); 208 } 209 } 210 211 AcpiOsPrintf ("]\n"); 212 } 213 214 215 /******************************************************************************* 216 * 217 * FUNCTION: AcpiNsDumpPathname 218 * 219 * PARAMETERS: Handle - Object 220 * Msg - Prefix message 221 * Level - Desired debug level 222 * Component - Caller's component ID 223 * 224 * RETURN: None 225 * 226 * DESCRIPTION: Print an object's full namespace pathname 227 * Manages allocation/freeing of a pathname buffer 228 * 229 ******************************************************************************/ 230 231 void 232 AcpiNsDumpPathname ( 233 ACPI_HANDLE Handle, 234 char *Msg, 235 UINT32 Level, 236 UINT32 Component) 237 { 238 239 ACPI_FUNCTION_TRACE (NsDumpPathname); 240 241 242 /* Do this only if the requested debug level and component are enabled */ 243 244 if (!ACPI_IS_DEBUG_ENABLED (Level, Component)) 245 { 246 return_VOID; 247 } 248 249 /* Convert handle to a full pathname and print it (with supplied message) */ 250 251 AcpiNsPrintNodePathname (Handle, Msg); 252 AcpiOsPrintf ("\n"); 253 return_VOID; 254 } 255 256 257 /******************************************************************************* 258 * 259 * FUNCTION: AcpiNsDumpOneObject 260 * 261 * PARAMETERS: ObjHandle - Node to be dumped 262 * Level - Nesting level of the handle 263 * Context - Passed into WalkNamespace 264 * ReturnValue - Not used 265 * 266 * RETURN: Status 267 * 268 * DESCRIPTION: Dump a single Node 269 * This procedure is a UserFunction called by AcpiNsWalkNamespace. 270 * 271 ******************************************************************************/ 272 273 ACPI_STATUS 274 AcpiNsDumpOneObject ( 275 ACPI_HANDLE ObjHandle, 276 UINT32 Level, 277 void *Context, 278 void **ReturnValue) 279 { 280 ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context; 281 ACPI_NAMESPACE_NODE *ThisNode; 282 ACPI_OPERAND_OBJECT *ObjDesc = NULL; 283 ACPI_OBJECT_TYPE ObjType; 284 ACPI_OBJECT_TYPE Type; 285 UINT32 BytesToDump; 286 UINT32 DbgLevel; 287 UINT32 i; 288 289 290 ACPI_FUNCTION_NAME (NsDumpOneObject); 291 292 293 /* Is output enabled? */ 294 295 if (!(AcpiDbgLevel & Info->DebugLevel)) 296 { 297 return (AE_OK); 298 } 299 300 if (!ObjHandle) 301 { 302 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n")); 303 return (AE_OK); 304 } 305 306 ThisNode = AcpiNsValidateHandle (ObjHandle); 307 if (!ThisNode) 308 { 309 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Invalid object handle %p\n", 310 ObjHandle)); 311 return (AE_OK); 312 } 313 314 Type = ThisNode->Type; 315 316 /* Check if the owner matches */ 317 318 if ((Info->OwnerId != ACPI_OWNER_ID_MAX) && 319 (Info->OwnerId != ThisNode->OwnerId)) 320 { 321 return (AE_OK); 322 } 323 324 if (!(Info->DisplayType & ACPI_DISPLAY_SHORT)) 325 { 326 /* Indent the object according to the level */ 327 328 AcpiOsPrintf ("%2d%*s", (UINT32) Level - 1, (int) Level * 2, " "); 329 330 /* Check the node type and name */ 331 332 if (Type > ACPI_TYPE_LOCAL_MAX) 333 { 334 ACPI_WARNING ((AE_INFO, "Invalid ACPI Object Type 0x%08X", Type)); 335 } 336 337 AcpiOsPrintf ("%4.4s", AcpiUtGetNodeName (ThisNode)); 338 } 339 340 /* Now we can print out the pertinent information */ 341 342 AcpiOsPrintf (" %-12s %p %2.2X ", 343 AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId); 344 345 DbgLevel = AcpiDbgLevel; 346 AcpiDbgLevel = 0; 347 ObjDesc = AcpiNsGetAttachedObject (ThisNode); 348 AcpiDbgLevel = DbgLevel; 349 350 /* Temp nodes are those nodes created by a control method */ 351 352 if (ThisNode->Flags & ANOBJ_TEMPORARY) 353 { 354 AcpiOsPrintf ("(T) "); 355 } 356 357 switch (Info->DisplayType & ACPI_DISPLAY_MASK) 358 { 359 case ACPI_DISPLAY_SUMMARY: 360 361 if (!ObjDesc) 362 { 363 /* No attached object. Some types should always have an object */ 364 365 switch (Type) 366 { 367 case ACPI_TYPE_INTEGER: 368 case ACPI_TYPE_PACKAGE: 369 case ACPI_TYPE_BUFFER: 370 case ACPI_TYPE_STRING: 371 case ACPI_TYPE_METHOD: 372 373 AcpiOsPrintf ("<No attached object>"); 374 break; 375 376 default: 377 378 break; 379 } 380 381 AcpiOsPrintf ("\n"); 382 return (AE_OK); 383 } 384 385 switch (Type) 386 { 387 case ACPI_TYPE_PROCESSOR: 388 389 AcpiOsPrintf ("ID %02X Len %02X Addr %8.8X%8.8X\n", 390 ObjDesc->Processor.ProcId, ObjDesc->Processor.Length, 391 ACPI_FORMAT_UINT64 (ObjDesc->Processor.Address)); 392 break; 393 394 case ACPI_TYPE_DEVICE: 395 396 AcpiOsPrintf ("Notify Object: %p\n", ObjDesc); 397 break; 398 399 case ACPI_TYPE_METHOD: 400 401 AcpiOsPrintf ("Args %X Len %.4X Aml %p\n", 402 (UINT32) ObjDesc->Method.ParamCount, 403 ObjDesc->Method.AmlLength, ObjDesc->Method.AmlStart); 404 break; 405 406 case ACPI_TYPE_INTEGER: 407 408 AcpiOsPrintf ("= %8.8X%8.8X\n", 409 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); 410 break; 411 412 case ACPI_TYPE_PACKAGE: 413 414 if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) 415 { 416 AcpiOsPrintf ("Elements %.2X\n", 417 ObjDesc->Package.Count); 418 } 419 else 420 { 421 AcpiOsPrintf ("[Length not yet evaluated]\n"); 422 } 423 break; 424 425 case ACPI_TYPE_BUFFER: 426 427 if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) 428 { 429 AcpiOsPrintf ("Len %.2X", 430 ObjDesc->Buffer.Length); 431 432 /* Dump some of the buffer */ 433 434 if (ObjDesc->Buffer.Length > 0) 435 { 436 AcpiOsPrintf (" ="); 437 for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++) 438 { 439 AcpiOsPrintf (" %.2hX", ObjDesc->Buffer.Pointer[i]); 440 } 441 } 442 AcpiOsPrintf ("\n"); 443 } 444 else 445 { 446 AcpiOsPrintf ("[Length not yet evaluated]\n"); 447 } 448 break; 449 450 case ACPI_TYPE_STRING: 451 452 AcpiOsPrintf ("Len %.2X ", ObjDesc->String.Length); 453 AcpiUtPrintString (ObjDesc->String.Pointer, 32); 454 AcpiOsPrintf ("\n"); 455 break; 456 457 case ACPI_TYPE_REGION: 458 459 AcpiOsPrintf ("[%s]", 460 AcpiUtGetRegionName (ObjDesc->Region.SpaceId)); 461 if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID) 462 { 463 AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n", 464 ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), 465 ObjDesc->Region.Length); 466 } 467 else 468 { 469 AcpiOsPrintf (" [Address/Length not yet evaluated]\n"); 470 } 471 break; 472 473 case ACPI_TYPE_LOCAL_REFERENCE: 474 475 AcpiOsPrintf ("[%s]\n", AcpiUtGetReferenceName (ObjDesc)); 476 break; 477 478 case ACPI_TYPE_BUFFER_FIELD: 479 480 if (ObjDesc->BufferField.BufferObj && 481 ObjDesc->BufferField.BufferObj->Buffer.Node) 482 { 483 AcpiOsPrintf ("Buf [%4.4s]", 484 AcpiUtGetNodeName ( 485 ObjDesc->BufferField.BufferObj->Buffer.Node)); 486 } 487 break; 488 489 case ACPI_TYPE_LOCAL_REGION_FIELD: 490 491 AcpiOsPrintf ("Rgn [%4.4s]", 492 AcpiUtGetNodeName ( 493 ObjDesc->CommonField.RegionObj->Region.Node)); 494 break; 495 496 case ACPI_TYPE_LOCAL_BANK_FIELD: 497 498 AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]", 499 AcpiUtGetNodeName ( 500 ObjDesc->CommonField.RegionObj->Region.Node), 501 AcpiUtGetNodeName ( 502 ObjDesc->BankField.BankObj->CommonField.Node)); 503 break; 504 505 case ACPI_TYPE_LOCAL_INDEX_FIELD: 506 507 AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]", 508 AcpiUtGetNodeName ( 509 ObjDesc->IndexField.IndexObj->CommonField.Node), 510 AcpiUtGetNodeName ( 511 ObjDesc->IndexField.DataObj->CommonField.Node)); 512 break; 513 514 case ACPI_TYPE_LOCAL_ALIAS: 515 case ACPI_TYPE_LOCAL_METHOD_ALIAS: 516 517 AcpiOsPrintf ("Target %4.4s (%p)\n", 518 AcpiUtGetNodeName (ObjDesc), ObjDesc); 519 break; 520 521 default: 522 523 AcpiOsPrintf ("Object %p\n", ObjDesc); 524 break; 525 } 526 527 /* Common field handling */ 528 529 switch (Type) 530 { 531 case ACPI_TYPE_BUFFER_FIELD: 532 case ACPI_TYPE_LOCAL_REGION_FIELD: 533 case ACPI_TYPE_LOCAL_BANK_FIELD: 534 case ACPI_TYPE_LOCAL_INDEX_FIELD: 535 536 AcpiOsPrintf (" Off %.3X Len %.2X Acc %.2hd\n", 537 (ObjDesc->CommonField.BaseByteOffset * 8) 538 + ObjDesc->CommonField.StartFieldBitOffset, 539 ObjDesc->CommonField.BitLength, 540 ObjDesc->CommonField.AccessByteWidth); 541 break; 542 543 default: 544 545 break; 546 } 547 break; 548 549 case ACPI_DISPLAY_OBJECTS: 550 551 AcpiOsPrintf ("O:%p", ObjDesc); 552 if (!ObjDesc) 553 { 554 /* No attached object, we are done */ 555 556 AcpiOsPrintf ("\n"); 557 return (AE_OK); 558 } 559 560 AcpiOsPrintf ("(R%u)", ObjDesc->Common.ReferenceCount); 561 562 switch (Type) 563 { 564 case ACPI_TYPE_METHOD: 565 566 /* Name is a Method and its AML offset/length are set */ 567 568 AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart, 569 ObjDesc->Method.AmlLength); 570 break; 571 572 case ACPI_TYPE_INTEGER: 573 574 AcpiOsPrintf (" I:%8.8X8.8%X\n", 575 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); 576 break; 577 578 case ACPI_TYPE_STRING: 579 580 AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer, 581 ObjDesc->String.Length); 582 break; 583 584 case ACPI_TYPE_BUFFER: 585 586 AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer, 587 ObjDesc->Buffer.Length); 588 break; 589 590 default: 591 592 AcpiOsPrintf ("\n"); 593 break; 594 } 595 break; 596 597 default: 598 AcpiOsPrintf ("\n"); 599 break; 600 } 601 602 /* If debug turned off, done */ 603 604 if (!(AcpiDbgLevel & ACPI_LV_VALUES)) 605 { 606 return (AE_OK); 607 } 608 609 /* If there is an attached object, display it */ 610 611 DbgLevel = AcpiDbgLevel; 612 AcpiDbgLevel = 0; 613 ObjDesc = AcpiNsGetAttachedObject (ThisNode); 614 AcpiDbgLevel = DbgLevel; 615 616 /* Dump attached objects */ 617 618 while (ObjDesc) 619 { 620 ObjType = ACPI_TYPE_INVALID; 621 AcpiOsPrintf ("Attached Object %p: ", ObjDesc); 622 623 /* Decode the type of attached object and dump the contents */ 624 625 switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)) 626 { 627 case ACPI_DESC_TYPE_NAMED: 628 629 AcpiOsPrintf ("(Ptr to Node)\n"); 630 BytesToDump = sizeof (ACPI_NAMESPACE_NODE); 631 ACPI_DUMP_BUFFER (ObjDesc, BytesToDump); 632 break; 633 634 case ACPI_DESC_TYPE_OPERAND: 635 636 ObjType = ObjDesc->Common.Type; 637 638 if (ObjType > ACPI_TYPE_LOCAL_MAX) 639 { 640 AcpiOsPrintf ("(Pointer to ACPI Object type %.2X [UNKNOWN])\n", 641 ObjType); 642 BytesToDump = 32; 643 } 644 else 645 { 646 AcpiOsPrintf ("(Pointer to ACPI Object type %.2X [%s])\n", 647 ObjType, AcpiUtGetTypeName (ObjType)); 648 BytesToDump = sizeof (ACPI_OPERAND_OBJECT); 649 } 650 651 ACPI_DUMP_BUFFER (ObjDesc, BytesToDump); 652 break; 653 654 default: 655 656 break; 657 } 658 659 /* If value is NOT an internal object, we are done */ 660 661 if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) 662 { 663 goto Cleanup; 664 } 665 666 /* Valid object, get the pointer to next level, if any */ 667 668 switch (ObjType) 669 { 670 case ACPI_TYPE_BUFFER: 671 case ACPI_TYPE_STRING: 672 /* 673 * NOTE: takes advantage of common fields between string/buffer 674 */ 675 BytesToDump = ObjDesc->String.Length; 676 ObjDesc = (void *) ObjDesc->String.Pointer; 677 AcpiOsPrintf ( "(Buffer/String pointer %p length %X)\n", 678 ObjDesc, BytesToDump); 679 ACPI_DUMP_BUFFER (ObjDesc, BytesToDump); 680 goto Cleanup; 681 682 case ACPI_TYPE_BUFFER_FIELD: 683 684 ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj; 685 break; 686 687 case ACPI_TYPE_PACKAGE: 688 689 ObjDesc = (void *) ObjDesc->Package.Elements; 690 break; 691 692 case ACPI_TYPE_METHOD: 693 694 ObjDesc = (void *) ObjDesc->Method.AmlStart; 695 break; 696 697 case ACPI_TYPE_LOCAL_REGION_FIELD: 698 699 ObjDesc = (void *) ObjDesc->Field.RegionObj; 700 break; 701 702 case ACPI_TYPE_LOCAL_BANK_FIELD: 703 704 ObjDesc = (void *) ObjDesc->BankField.RegionObj; 705 break; 706 707 case ACPI_TYPE_LOCAL_INDEX_FIELD: 708 709 ObjDesc = (void *) ObjDesc->IndexField.IndexObj; 710 break; 711 712 default: 713 714 goto Cleanup; 715 } 716 717 ObjType = ACPI_TYPE_INVALID; /* Terminate loop after next pass */ 718 } 719 720 Cleanup: 721 AcpiOsPrintf ("\n"); 722 return (AE_OK); 723 } 724 725 726 /******************************************************************************* 727 * 728 * FUNCTION: AcpiNsDumpObjects 729 * 730 * PARAMETERS: Type - Object type to be dumped 731 * DisplayType - 0 or ACPI_DISPLAY_SUMMARY 732 * MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX 733 * for an effectively unlimited depth. 734 * OwnerId - Dump only objects owned by this ID. Use 735 * ACPI_UINT32_MAX to match all owners. 736 * StartHandle - Where in namespace to start/end search 737 * 738 * RETURN: None 739 * 740 * DESCRIPTION: Dump typed objects within the loaded namespace. Uses 741 * AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject. 742 * 743 ******************************************************************************/ 744 745 void 746 AcpiNsDumpObjects ( 747 ACPI_OBJECT_TYPE Type, 748 UINT8 DisplayType, 749 UINT32 MaxDepth, 750 ACPI_OWNER_ID OwnerId, 751 ACPI_HANDLE StartHandle) 752 { 753 ACPI_WALK_INFO Info; 754 ACPI_STATUS Status; 755 756 757 ACPI_FUNCTION_ENTRY (); 758 759 760 /* 761 * Just lock the entire namespace for the duration of the dump. 762 * We don't want any changes to the namespace during this time, 763 * especially the temporary nodes since we are going to display 764 * them also. 765 */ 766 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); 767 if (ACPI_FAILURE (Status)) 768 { 769 AcpiOsPrintf ("Could not acquire namespace mutex\n"); 770 return; 771 } 772 773 Info.DebugLevel = ACPI_LV_TABLES; 774 Info.OwnerId = OwnerId; 775 Info.DisplayType = DisplayType; 776 777 (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, 778 ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, 779 AcpiNsDumpOneObject, NULL, (void *) &Info, NULL); 780 781 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); 782 } 783 784 785 /******************************************************************************* 786 * 787 * FUNCTION: AcpiNsDumpOneObjectPath, AcpiNsGetMaxDepth 788 * 789 * PARAMETERS: ObjHandle - Node to be dumped 790 * Level - Nesting level of the handle 791 * Context - Passed into WalkNamespace 792 * ReturnValue - Not used 793 * 794 * RETURN: Status 795 * 796 * DESCRIPTION: Dump the full pathname to a namespace object. AcpNsGetMaxDepth 797 * computes the maximum nesting depth in the namespace tree, in 798 * order to simplify formatting in AcpiNsDumpOneObjectPath. 799 * These procedures are UserFunctions called by AcpiNsWalkNamespace. 800 * 801 ******************************************************************************/ 802 803 static ACPI_STATUS 804 AcpiNsDumpOneObjectPath ( 805 ACPI_HANDLE ObjHandle, 806 UINT32 Level, 807 void *Context, 808 void **ReturnValue) 809 { 810 UINT32 MaxLevel = *((UINT32 *) Context); 811 char *Pathname; 812 ACPI_NAMESPACE_NODE *Node; 813 int PathIndent; 814 815 816 if (!ObjHandle) 817 { 818 return (AE_OK); 819 } 820 821 Node = AcpiNsValidateHandle (ObjHandle); 822 if (!Node) 823 { 824 /* Ignore bad node during namespace walk */ 825 826 return (AE_OK); 827 } 828 829 Pathname = AcpiNsGetExternalPathname (Node); 830 831 PathIndent = 1; 832 if (Level <= MaxLevel) 833 { 834 PathIndent = MaxLevel - Level + 1; 835 } 836 837 AcpiOsPrintf ("%2d%*s%-12s%*s", 838 Level, Level, " ", AcpiUtGetTypeName (Node->Type), 839 PathIndent, " "); 840 841 AcpiOsPrintf ("%s\n", &Pathname[1]); 842 ACPI_FREE (Pathname); 843 return (AE_OK); 844 } 845 846 847 static ACPI_STATUS 848 AcpiNsGetMaxDepth ( 849 ACPI_HANDLE ObjHandle, 850 UINT32 Level, 851 void *Context, 852 void **ReturnValue) 853 { 854 UINT32 *MaxLevel = (UINT32 *) Context; 855 856 857 if (Level > *MaxLevel) 858 { 859 *MaxLevel = Level; 860 } 861 return (AE_OK); 862 } 863 864 865 /******************************************************************************* 866 * 867 * FUNCTION: AcpiNsDumpObjectPaths 868 * 869 * PARAMETERS: Type - Object type to be dumped 870 * DisplayType - 0 or ACPI_DISPLAY_SUMMARY 871 * MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX 872 * for an effectively unlimited depth. 873 * OwnerId - Dump only objects owned by this ID. Use 874 * ACPI_UINT32_MAX to match all owners. 875 * StartHandle - Where in namespace to start/end search 876 * 877 * RETURN: None 878 * 879 * DESCRIPTION: Dump full object pathnames within the loaded namespace. Uses 880 * AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObjectPath. 881 * 882 ******************************************************************************/ 883 884 void 885 AcpiNsDumpObjectPaths ( 886 ACPI_OBJECT_TYPE Type, 887 UINT8 DisplayType, 888 UINT32 MaxDepth, 889 ACPI_OWNER_ID OwnerId, 890 ACPI_HANDLE StartHandle) 891 { 892 ACPI_STATUS Status; 893 UINT32 MaxLevel = 0; 894 895 896 ACPI_FUNCTION_ENTRY (); 897 898 899 /* 900 * Just lock the entire namespace for the duration of the dump. 901 * We don't want any changes to the namespace during this time, 902 * especially the temporary nodes since we are going to display 903 * them also. 904 */ 905 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); 906 if (ACPI_FAILURE (Status)) 907 { 908 AcpiOsPrintf ("Could not acquire namespace mutex\n"); 909 return; 910 } 911 912 /* Get the max depth of the namespace tree, for formatting later */ 913 914 (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, 915 ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, 916 AcpiNsGetMaxDepth, NULL, (void *) &MaxLevel, NULL); 917 918 /* Now dump the entire namespace */ 919 920 (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, 921 ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, 922 AcpiNsDumpOneObjectPath, NULL, (void *) &MaxLevel, NULL); 923 924 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); 925 } 926 927 928 /******************************************************************************* 929 * 930 * FUNCTION: AcpiNsDumpEntry 931 * 932 * PARAMETERS: Handle - Node to be dumped 933 * DebugLevel - Output level 934 * 935 * RETURN: None 936 * 937 * DESCRIPTION: Dump a single Node 938 * 939 ******************************************************************************/ 940 941 void 942 AcpiNsDumpEntry ( 943 ACPI_HANDLE Handle, 944 UINT32 DebugLevel) 945 { 946 ACPI_WALK_INFO Info; 947 948 949 ACPI_FUNCTION_ENTRY (); 950 951 952 Info.DebugLevel = DebugLevel; 953 Info.OwnerId = ACPI_OWNER_ID_MAX; 954 Info.DisplayType = ACPI_DISPLAY_SUMMARY; 955 956 (void) AcpiNsDumpOneObject (Handle, 1, &Info, NULL); 957 } 958 959 960 #ifdef ACPI_ASL_COMPILER 961 /******************************************************************************* 962 * 963 * FUNCTION: AcpiNsDumpTables 964 * 965 * PARAMETERS: SearchBase - Root of subtree to be dumped, or 966 * NS_ALL to dump the entire namespace 967 * MaxDepth - Maximum depth of dump. Use INT_MAX 968 * for an effectively unlimited depth. 969 * 970 * RETURN: None 971 * 972 * DESCRIPTION: Dump the name space, or a portion of it. 973 * 974 ******************************************************************************/ 975 976 void 977 AcpiNsDumpTables ( 978 ACPI_HANDLE SearchBase, 979 UINT32 MaxDepth) 980 { 981 ACPI_HANDLE SearchHandle = SearchBase; 982 983 984 ACPI_FUNCTION_TRACE (NsDumpTables); 985 986 987 if (!AcpiGbl_RootNode) 988 { 989 /* 990 * If the name space has not been initialized, 991 * there is nothing to dump. 992 */ 993 ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "namespace not initialized!\n")); 994 return_VOID; 995 } 996 997 if (ACPI_NS_ALL == SearchBase) 998 { 999 /* Entire namespace */ 1000 1001 SearchHandle = AcpiGbl_RootNode; 1002 ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n")); 1003 } 1004 1005 AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth, 1006 ACPI_OWNER_ID_MAX, SearchHandle); 1007 return_VOID; 1008 } 1009 #endif 1010 #endif 1011