1 /******************************************************************************* 2 * 3 * Module Name: dbdisply - debug display commands 4 * 5 ******************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2014, Intel Corp. 9 * All rights reserved. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 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. 25 * 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. 29 * 30 * NO WARRANTY 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. 42 */ 43 44 45 #include "acpi.h" 46 #include "accommon.h" 47 #include "amlcode.h" 48 #include "acdispat.h" 49 #include "acnamesp.h" 50 #include "acparser.h" 51 #include "acinterp.h" 52 #include "acdebug.h" 53 #include "acdisasm.h" 54 55 56 #ifdef ACPI_DEBUGGER 57 58 #define _COMPONENT ACPI_CA_DEBUGGER 59 ACPI_MODULE_NAME ("dbdisply") 60 61 /* Local prototypes */ 62 63 static void 64 AcpiDbDumpParserDescriptor ( 65 ACPI_PARSE_OBJECT *Op); 66 67 static void * 68 AcpiDbGetPointer ( 69 void *Target); 70 71 static ACPI_STATUS 72 AcpiDbDisplayNonRootHandlers ( 73 ACPI_HANDLE ObjHandle, 74 UINT32 NestingLevel, 75 void *Context, 76 void **ReturnValue); 77 78 /* 79 * System handler information. 80 * Used for Handlers command, in AcpiDbDisplayHandlers. 81 */ 82 #define ACPI_PREDEFINED_PREFIX "%25s (%.2X) : " 83 #define ACPI_HANDLER_NAME_STRING "%30s : " 84 #define ACPI_HANDLER_PRESENT_STRING "%-9s (%p)\n" 85 #define ACPI_HANDLER_PRESENT_STRING2 "%-9s (%p)" 86 #define ACPI_HANDLER_NOT_PRESENT_STRING "%-9s\n" 87 88 /* All predefined Address Space IDs */ 89 90 static ACPI_ADR_SPACE_TYPE AcpiGbl_SpaceIdList[] = 91 { 92 ACPI_ADR_SPACE_SYSTEM_MEMORY, 93 ACPI_ADR_SPACE_SYSTEM_IO, 94 ACPI_ADR_SPACE_PCI_CONFIG, 95 ACPI_ADR_SPACE_EC, 96 ACPI_ADR_SPACE_SMBUS, 97 ACPI_ADR_SPACE_CMOS, 98 ACPI_ADR_SPACE_PCI_BAR_TARGET, 99 ACPI_ADR_SPACE_IPMI, 100 ACPI_ADR_SPACE_GPIO, 101 ACPI_ADR_SPACE_GSBUS, 102 ACPI_ADR_SPACE_DATA_TABLE, 103 ACPI_ADR_SPACE_FIXED_HARDWARE 104 }; 105 106 /* Global handler information */ 107 108 typedef struct acpi_handler_info 109 { 110 void *Handler; 111 char *Name; 112 113 } ACPI_HANDLER_INFO; 114 115 static ACPI_HANDLER_INFO AcpiGbl_HandlerList[] = 116 { 117 {&AcpiGbl_GlobalNotify[0].Handler, "System Notifications"}, 118 {&AcpiGbl_GlobalNotify[1].Handler, "Device Notifications"}, 119 {&AcpiGbl_TableHandler, "ACPI Table Events"}, 120 {&AcpiGbl_ExceptionHandler, "Control Method Exceptions"}, 121 {&AcpiGbl_InterfaceHandler, "OSI Invocations"} 122 }; 123 124 125 /******************************************************************************* 126 * 127 * FUNCTION: AcpiDbGetPointer 128 * 129 * PARAMETERS: Target - Pointer to string to be converted 130 * 131 * RETURN: Converted pointer 132 * 133 * DESCRIPTION: Convert an ascii pointer value to a real value 134 * 135 ******************************************************************************/ 136 137 static void * 138 AcpiDbGetPointer ( 139 void *Target) 140 { 141 void *ObjPtr; 142 ACPI_SIZE Address; 143 144 145 Address = ACPI_STRTOUL (Target, NULL, 16); 146 ObjPtr = ACPI_TO_POINTER (Address); 147 return (ObjPtr); 148 } 149 150 151 /******************************************************************************* 152 * 153 * FUNCTION: AcpiDbDumpParserDescriptor 154 * 155 * PARAMETERS: Op - A parser Op descriptor 156 * 157 * RETURN: None 158 * 159 * DESCRIPTION: Display a formatted parser object 160 * 161 ******************************************************************************/ 162 163 static void 164 AcpiDbDumpParserDescriptor ( 165 ACPI_PARSE_OBJECT *Op) 166 { 167 const ACPI_OPCODE_INFO *Info; 168 169 170 Info = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); 171 172 AcpiOsPrintf ("Parser Op Descriptor:\n"); 173 AcpiOsPrintf ("%20.20s : %4.4X\n", "Opcode", Op->Common.AmlOpcode); 174 175 ACPI_DEBUG_ONLY_MEMBERS (AcpiOsPrintf ("%20.20s : %s\n", "Opcode Name", 176 Info->Name)); 177 178 AcpiOsPrintf ("%20.20s : %p\n", "Value/ArgList", Op->Common.Value.Arg); 179 AcpiOsPrintf ("%20.20s : %p\n", "Parent", Op->Common.Parent); 180 AcpiOsPrintf ("%20.20s : %p\n", "NextOp", Op->Common.Next); 181 } 182 183 184 /******************************************************************************* 185 * 186 * FUNCTION: AcpiDbDecodeAndDisplayObject 187 * 188 * PARAMETERS: Target - String with object to be displayed. Names 189 * and hex pointers are supported. 190 * OutputType - Byte, Word, Dword, or Qword (B|W|D|Q) 191 * 192 * RETURN: None 193 * 194 * DESCRIPTION: Display a formatted ACPI object 195 * 196 ******************************************************************************/ 197 198 void 199 AcpiDbDecodeAndDisplayObject ( 200 char *Target, 201 char *OutputType) 202 { 203 void *ObjPtr; 204 ACPI_NAMESPACE_NODE *Node; 205 ACPI_OPERAND_OBJECT *ObjDesc; 206 UINT32 Display = DB_BYTE_DISPLAY; 207 char Buffer[80]; 208 ACPI_BUFFER RetBuf; 209 ACPI_STATUS Status; 210 UINT32 Size; 211 212 213 if (!Target) 214 { 215 return; 216 } 217 218 /* Decode the output type */ 219 220 if (OutputType) 221 { 222 AcpiUtStrupr (OutputType); 223 if (OutputType[0] == 'W') 224 { 225 Display = DB_WORD_DISPLAY; 226 } 227 else if (OutputType[0] == 'D') 228 { 229 Display = DB_DWORD_DISPLAY; 230 } 231 else if (OutputType[0] == 'Q') 232 { 233 Display = DB_QWORD_DISPLAY; 234 } 235 } 236 237 RetBuf.Length = sizeof (Buffer); 238 RetBuf.Pointer = Buffer; 239 240 /* Differentiate between a number and a name */ 241 242 if ((Target[0] >= 0x30) && (Target[0] <= 0x39)) 243 { 244 ObjPtr = AcpiDbGetPointer (Target); 245 if (!AcpiOsReadable (ObjPtr, 16)) 246 { 247 AcpiOsPrintf ("Address %p is invalid in this address space\n", 248 ObjPtr); 249 return; 250 } 251 252 /* Decode the object type */ 253 254 switch (ACPI_GET_DESCRIPTOR_TYPE (ObjPtr)) 255 { 256 case ACPI_DESC_TYPE_NAMED: 257 258 /* This is a namespace Node */ 259 260 if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_NAMESPACE_NODE))) 261 { 262 AcpiOsPrintf ( 263 "Cannot read entire Named object at address %p\n", ObjPtr); 264 return; 265 } 266 267 Node = ObjPtr; 268 goto DumpNode; 269 270 case ACPI_DESC_TYPE_OPERAND: 271 272 /* This is a ACPI OPERAND OBJECT */ 273 274 if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_OPERAND_OBJECT))) 275 { 276 AcpiOsPrintf ("Cannot read entire ACPI object at address %p\n", 277 ObjPtr); 278 return; 279 } 280 281 AcpiUtDebugDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), Display, 282 ACPI_UINT32_MAX); 283 AcpiExDumpObjectDescriptor (ObjPtr, 1); 284 break; 285 286 case ACPI_DESC_TYPE_PARSER: 287 288 /* This is a Parser Op object */ 289 290 if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_PARSE_OBJECT))) 291 { 292 AcpiOsPrintf ( 293 "Cannot read entire Parser object at address %p\n", ObjPtr); 294 return; 295 } 296 297 AcpiUtDebugDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), Display, 298 ACPI_UINT32_MAX); 299 AcpiDbDumpParserDescriptor ((ACPI_PARSE_OBJECT *) ObjPtr); 300 break; 301 302 default: 303 304 /* Is not a recognizeable object */ 305 306 AcpiOsPrintf ( 307 "Not a known ACPI internal object, descriptor type %2.2X\n", 308 ACPI_GET_DESCRIPTOR_TYPE (ObjPtr)); 309 310 Size = 16; 311 if (AcpiOsReadable (ObjPtr, 64)) 312 { 313 Size = 64; 314 } 315 316 /* Just dump some memory */ 317 318 AcpiUtDebugDumpBuffer (ObjPtr, Size, Display, ACPI_UINT32_MAX); 319 break; 320 } 321 322 return; 323 } 324 325 /* The parameter is a name string that must be resolved to a Named obj */ 326 327 Node = AcpiDbLocalNsLookup (Target); 328 if (!Node) 329 { 330 return; 331 } 332 333 334 DumpNode: 335 /* Now dump the NS node */ 336 337 Status = AcpiGetName (Node, ACPI_FULL_PATHNAME, &RetBuf); 338 if (ACPI_FAILURE (Status)) 339 { 340 AcpiOsPrintf ("Could not convert name to pathname\n"); 341 } 342 343 else 344 { 345 AcpiOsPrintf ("Object (%p) Pathname: %s\n", 346 Node, (char *) RetBuf.Pointer); 347 } 348 349 if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE))) 350 { 351 AcpiOsPrintf ("Invalid Named object at address %p\n", Node); 352 return; 353 } 354 355 AcpiUtDebugDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE), 356 Display, ACPI_UINT32_MAX); 357 AcpiExDumpNamespaceNode (Node, 1); 358 359 ObjDesc = AcpiNsGetAttachedObject (Node); 360 if (ObjDesc) 361 { 362 AcpiOsPrintf ("\nAttached Object (%p):\n", ObjDesc); 363 if (!AcpiOsReadable (ObjDesc, sizeof (ACPI_OPERAND_OBJECT))) 364 { 365 AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n", 366 ObjDesc); 367 return; 368 } 369 370 AcpiUtDebugDumpBuffer ((void *) ObjDesc, sizeof (ACPI_OPERAND_OBJECT), 371 Display, ACPI_UINT32_MAX); 372 AcpiExDumpObjectDescriptor (ObjDesc, 1); 373 } 374 } 375 376 377 /******************************************************************************* 378 * 379 * FUNCTION: AcpiDbDisplayMethodInfo 380 * 381 * PARAMETERS: StartOp - Root of the control method parse tree 382 * 383 * RETURN: None 384 * 385 * DESCRIPTION: Display information about the current method 386 * 387 ******************************************************************************/ 388 389 void 390 AcpiDbDisplayMethodInfo ( 391 ACPI_PARSE_OBJECT *StartOp) 392 { 393 ACPI_WALK_STATE *WalkState; 394 ACPI_OPERAND_OBJECT *ObjDesc; 395 ACPI_NAMESPACE_NODE *Node; 396 ACPI_PARSE_OBJECT *RootOp; 397 ACPI_PARSE_OBJECT *Op; 398 const ACPI_OPCODE_INFO *OpInfo; 399 UINT32 NumOps = 0; 400 UINT32 NumOperands = 0; 401 UINT32 NumOperators = 0; 402 UINT32 NumRemainingOps = 0; 403 UINT32 NumRemainingOperands = 0; 404 UINT32 NumRemainingOperators = 0; 405 BOOLEAN CountRemaining = FALSE; 406 407 408 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 409 if (!WalkState) 410 { 411 AcpiOsPrintf ("There is no method currently executing\n"); 412 return; 413 } 414 415 ObjDesc = WalkState->MethodDesc; 416 Node = WalkState->MethodNode; 417 418 AcpiOsPrintf ("Currently executing control method is [%4.4s]\n", 419 AcpiUtGetNodeName (Node)); 420 AcpiOsPrintf ("%X Arguments, SyncLevel = %X\n", 421 (UINT32) ObjDesc->Method.ParamCount, 422 (UINT32) ObjDesc->Method.SyncLevel); 423 424 425 RootOp = StartOp; 426 while (RootOp->Common.Parent) 427 { 428 RootOp = RootOp->Common.Parent; 429 } 430 431 Op = RootOp; 432 433 while (Op) 434 { 435 if (Op == StartOp) 436 { 437 CountRemaining = TRUE; 438 } 439 440 NumOps++; 441 if (CountRemaining) 442 { 443 NumRemainingOps++; 444 } 445 446 /* Decode the opcode */ 447 448 OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); 449 switch (OpInfo->Class) 450 { 451 case AML_CLASS_ARGUMENT: 452 453 if (CountRemaining) 454 { 455 NumRemainingOperands++; 456 } 457 458 NumOperands++; 459 break; 460 461 case AML_CLASS_UNKNOWN: 462 463 /* Bad opcode or ASCII character */ 464 465 continue; 466 467 default: 468 469 if (CountRemaining) 470 { 471 NumRemainingOperators++; 472 } 473 474 NumOperators++; 475 break; 476 } 477 478 Op = AcpiPsGetDepthNext (StartOp, Op); 479 } 480 481 AcpiOsPrintf ( 482 "Method contains: %X AML Opcodes - %X Operators, %X Operands\n", 483 NumOps, NumOperators, NumOperands); 484 485 AcpiOsPrintf ( 486 "Remaining to execute: %X AML Opcodes - %X Operators, %X Operands\n", 487 NumRemainingOps, NumRemainingOperators, NumRemainingOperands); 488 } 489 490 491 /******************************************************************************* 492 * 493 * FUNCTION: AcpiDbDisplayLocals 494 * 495 * PARAMETERS: None 496 * 497 * RETURN: None 498 * 499 * DESCRIPTION: Display all locals for the currently running control method 500 * 501 ******************************************************************************/ 502 503 void 504 AcpiDbDisplayLocals ( 505 void) 506 { 507 ACPI_WALK_STATE *WalkState; 508 509 510 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 511 if (!WalkState) 512 { 513 AcpiOsPrintf ("There is no method currently executing\n"); 514 return; 515 } 516 517 AcpiDmDisplayLocals (WalkState); 518 } 519 520 521 /******************************************************************************* 522 * 523 * FUNCTION: AcpiDbDisplayArguments 524 * 525 * PARAMETERS: None 526 * 527 * RETURN: None 528 * 529 * DESCRIPTION: Display all arguments for the currently running control method 530 * 531 ******************************************************************************/ 532 533 void 534 AcpiDbDisplayArguments ( 535 void) 536 { 537 ACPI_WALK_STATE *WalkState; 538 539 540 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 541 if (!WalkState) 542 { 543 AcpiOsPrintf ("There is no method currently executing\n"); 544 return; 545 } 546 547 AcpiDmDisplayArguments (WalkState); 548 } 549 550 551 /******************************************************************************* 552 * 553 * FUNCTION: AcpiDbDisplayResults 554 * 555 * PARAMETERS: None 556 * 557 * RETURN: None 558 * 559 * DESCRIPTION: Display current contents of a method result stack 560 * 561 ******************************************************************************/ 562 563 void 564 AcpiDbDisplayResults ( 565 void) 566 { 567 UINT32 i; 568 ACPI_WALK_STATE *WalkState; 569 ACPI_OPERAND_OBJECT *ObjDesc; 570 UINT32 ResultCount = 0; 571 ACPI_NAMESPACE_NODE *Node; 572 ACPI_GENERIC_STATE *Frame; 573 UINT32 Index; /* Index onto current frame */ 574 575 576 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 577 if (!WalkState) 578 { 579 AcpiOsPrintf ("There is no method currently executing\n"); 580 return; 581 } 582 583 ObjDesc = WalkState->MethodDesc; 584 Node = WalkState->MethodNode; 585 586 if (WalkState->Results) 587 { 588 ResultCount = WalkState->ResultCount; 589 } 590 591 AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n", 592 AcpiUtGetNodeName (Node), ResultCount); 593 594 /* From the top element of result stack */ 595 596 Frame = WalkState->Results; 597 Index = (ResultCount - 1) % ACPI_RESULTS_FRAME_OBJ_NUM; 598 599 for (i = 0; i < ResultCount; i++) 600 { 601 ObjDesc = Frame->Results.ObjDesc[Index]; 602 AcpiOsPrintf ("Result%u: ", i); 603 AcpiDmDisplayInternalObject (ObjDesc, WalkState); 604 if (Index == 0) 605 { 606 Frame = Frame->Results.Next; 607 Index = ACPI_RESULTS_FRAME_OBJ_NUM; 608 } 609 Index--; 610 } 611 } 612 613 614 /******************************************************************************* 615 * 616 * FUNCTION: AcpiDbDisplayCallingTree 617 * 618 * PARAMETERS: None 619 * 620 * RETURN: None 621 * 622 * DESCRIPTION: Display current calling tree of nested control methods 623 * 624 ******************************************************************************/ 625 626 void 627 AcpiDbDisplayCallingTree ( 628 void) 629 { 630 ACPI_WALK_STATE *WalkState; 631 ACPI_NAMESPACE_NODE *Node; 632 633 634 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 635 if (!WalkState) 636 { 637 AcpiOsPrintf ("There is no method currently executing\n"); 638 return; 639 } 640 641 Node = WalkState->MethodNode; 642 AcpiOsPrintf ("Current Control Method Call Tree\n"); 643 644 while (WalkState) 645 { 646 Node = WalkState->MethodNode; 647 648 AcpiOsPrintf (" [%4.4s]\n", AcpiUtGetNodeName (Node)); 649 650 WalkState = WalkState->Next; 651 } 652 } 653 654 655 /******************************************************************************* 656 * 657 * FUNCTION: AcpiDbDisplayObjectType 658 * 659 * PARAMETERS: Name - User entered NS node handle or name 660 * 661 * RETURN: None 662 * 663 * DESCRIPTION: Display type of an arbitrary NS node 664 * 665 ******************************************************************************/ 666 667 void 668 AcpiDbDisplayObjectType ( 669 char *Name) 670 { 671 ACPI_NAMESPACE_NODE *Node; 672 ACPI_DEVICE_INFO *Info; 673 ACPI_STATUS Status; 674 UINT32 i; 675 676 677 Node = AcpiDbConvertToNode (Name); 678 if (!Node) 679 { 680 return; 681 } 682 683 Status = AcpiGetObjectInfo (ACPI_CAST_PTR (ACPI_HANDLE, Node), &Info); 684 if (ACPI_FAILURE (Status)) 685 { 686 AcpiOsPrintf ("Could not get object info, %s\n", 687 AcpiFormatException (Status)); 688 return; 689 } 690 691 if (Info->Valid & ACPI_VALID_ADR) 692 { 693 AcpiOsPrintf ("ADR: %8.8X%8.8X, STA: %8.8X, Flags: %X\n", 694 ACPI_FORMAT_UINT64 (Info->Address), 695 Info->CurrentStatus, Info->Flags); 696 } 697 if (Info->Valid & ACPI_VALID_SXDS) 698 { 699 AcpiOsPrintf ("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X\n", 700 Info->HighestDstates[0], Info->HighestDstates[1], 701 Info->HighestDstates[2], Info->HighestDstates[3]); 702 } 703 if (Info->Valid & ACPI_VALID_SXWS) 704 { 705 AcpiOsPrintf ("S0W-%2.2X S1W-%2.2X S2W-%2.2X S3W-%2.2X S4W-%2.2X\n", 706 Info->LowestDstates[0], Info->LowestDstates[1], 707 Info->LowestDstates[2], Info->LowestDstates[3], 708 Info->LowestDstates[4]); 709 } 710 711 if (Info->Valid & ACPI_VALID_HID) 712 { 713 AcpiOsPrintf ("HID: %s\n", Info->HardwareId.String); 714 } 715 if (Info->Valid & ACPI_VALID_UID) 716 { 717 AcpiOsPrintf ("UID: %s\n", Info->UniqueId.String); 718 } 719 if (Info->Valid & ACPI_VALID_SUB) 720 { 721 AcpiOsPrintf ("SUB: %s\n", Info->SubsystemId.String); 722 } 723 if (Info->Valid & ACPI_VALID_CID) 724 { 725 for (i = 0; i < Info->CompatibleIdList.Count; i++) 726 { 727 AcpiOsPrintf ("CID %u: %s\n", i, 728 Info->CompatibleIdList.Ids[i].String); 729 } 730 } 731 732 ACPI_FREE (Info); 733 } 734 735 736 /******************************************************************************* 737 * 738 * FUNCTION: AcpiDbDisplayResultObject 739 * 740 * PARAMETERS: ObjDesc - Object to be displayed 741 * WalkState - Current walk state 742 * 743 * RETURN: None 744 * 745 * DESCRIPTION: Display the result of an AML opcode 746 * 747 * Note: Curently only displays the result object if we are single stepping. 748 * However, this output may be useful in other contexts and could be enabled 749 * to do so if needed. 750 * 751 ******************************************************************************/ 752 753 void 754 AcpiDbDisplayResultObject ( 755 ACPI_OPERAND_OBJECT *ObjDesc, 756 ACPI_WALK_STATE *WalkState) 757 { 758 759 /* Only display if single stepping */ 760 761 if (!AcpiGbl_CmSingleStep) 762 { 763 return; 764 } 765 766 AcpiOsPrintf ("ResultObj: "); 767 AcpiDmDisplayInternalObject (ObjDesc, WalkState); 768 AcpiOsPrintf ("\n"); 769 } 770 771 772 /******************************************************************************* 773 * 774 * FUNCTION: AcpiDbDisplayArgumentObject 775 * 776 * PARAMETERS: ObjDesc - Object to be displayed 777 * WalkState - Current walk state 778 * 779 * RETURN: None 780 * 781 * DESCRIPTION: Display the result of an AML opcode 782 * 783 ******************************************************************************/ 784 785 void 786 AcpiDbDisplayArgumentObject ( 787 ACPI_OPERAND_OBJECT *ObjDesc, 788 ACPI_WALK_STATE *WalkState) 789 { 790 791 if (!AcpiGbl_CmSingleStep) 792 { 793 return; 794 } 795 796 AcpiOsPrintf ("ArgObj: "); 797 AcpiDmDisplayInternalObject (ObjDesc, WalkState); 798 } 799 800 801 #if (!ACPI_REDUCED_HARDWARE) 802 /******************************************************************************* 803 * 804 * FUNCTION: AcpiDbDisplayGpes 805 * 806 * PARAMETERS: None 807 * 808 * RETURN: None 809 * 810 * DESCRIPTION: Display the current GPE structures 811 * 812 ******************************************************************************/ 813 814 void 815 AcpiDbDisplayGpes ( 816 void) 817 { 818 ACPI_GPE_BLOCK_INFO *GpeBlock; 819 ACPI_GPE_XRUPT_INFO *GpeXruptInfo; 820 ACPI_GPE_EVENT_INFO *GpeEventInfo; 821 ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; 822 char *GpeType; 823 ACPI_GPE_NOTIFY_INFO *Notify; 824 UINT32 GpeIndex; 825 UINT32 Block = 0; 826 UINT32 i; 827 UINT32 j; 828 UINT32 Count; 829 char Buffer[80]; 830 ACPI_BUFFER RetBuf; 831 ACPI_STATUS Status; 832 833 834 RetBuf.Length = sizeof (Buffer); 835 RetBuf.Pointer = Buffer; 836 837 Block = 0; 838 839 /* Walk the GPE lists */ 840 841 GpeXruptInfo = AcpiGbl_GpeXruptListHead; 842 while (GpeXruptInfo) 843 { 844 GpeBlock = GpeXruptInfo->GpeBlockListHead; 845 while (GpeBlock) 846 { 847 Status = AcpiGetName (GpeBlock->Node, ACPI_FULL_PATHNAME, &RetBuf); 848 if (ACPI_FAILURE (Status)) 849 { 850 AcpiOsPrintf ("Could not convert name to pathname\n"); 851 } 852 853 if (GpeBlock->Node == AcpiGbl_FadtGpeDevice) 854 { 855 GpeType = "FADT-defined GPE block"; 856 } 857 else 858 { 859 GpeType = "GPE Block Device"; 860 } 861 862 AcpiOsPrintf ("\nBlock %u - Info %p DeviceNode %p [%s] - %s\n", 863 Block, GpeBlock, GpeBlock->Node, Buffer, GpeType); 864 865 AcpiOsPrintf (" Registers: %u (%u GPEs)\n", 866 GpeBlock->RegisterCount, GpeBlock->GpeCount); 867 868 AcpiOsPrintf (" GPE range: 0x%X to 0x%X on interrupt %u\n", 869 GpeBlock->BlockBaseNumber, 870 GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1), 871 GpeXruptInfo->InterruptNumber); 872 873 AcpiOsPrintf ( 874 " RegisterInfo: %p Status %8.8X%8.8X Enable %8.8X%8.8X\n", 875 GpeBlock->RegisterInfo, 876 ACPI_FORMAT_UINT64 (GpeBlock->RegisterInfo->StatusAddress.Address), 877 ACPI_FORMAT_UINT64 (GpeBlock->RegisterInfo->EnableAddress.Address)); 878 879 AcpiOsPrintf (" EventInfo: %p\n", GpeBlock->EventInfo); 880 881 /* Examine each GPE Register within the block */ 882 883 for (i = 0; i < GpeBlock->RegisterCount; i++) 884 { 885 GpeRegisterInfo = &GpeBlock->RegisterInfo[i]; 886 887 AcpiOsPrintf ( 888 " Reg %u: (GPE %.2X-%.2X) RunEnable %2.2X WakeEnable %2.2X" 889 " Status %8.8X%8.8X Enable %8.8X%8.8X\n", 890 i, GpeRegisterInfo->BaseGpeNumber, 891 GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1), 892 GpeRegisterInfo->EnableForRun, 893 GpeRegisterInfo->EnableForWake, 894 ACPI_FORMAT_UINT64 (GpeRegisterInfo->StatusAddress.Address), 895 ACPI_FORMAT_UINT64 (GpeRegisterInfo->EnableAddress.Address)); 896 897 /* Now look at the individual GPEs in this byte register */ 898 899 for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) 900 { 901 GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j; 902 GpeEventInfo = &GpeBlock->EventInfo[GpeIndex]; 903 904 if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == 905 ACPI_GPE_DISPATCH_NONE) 906 { 907 /* This GPE is not used (no method or handler), ignore it */ 908 909 continue; 910 } 911 912 AcpiOsPrintf ( 913 " GPE %.2X: %p RunRefs %2.2X Flags %2.2X (", 914 GpeBlock->BlockBaseNumber + GpeIndex, GpeEventInfo, 915 GpeEventInfo->RuntimeCount, GpeEventInfo->Flags); 916 917 /* Decode the flags byte */ 918 919 if (GpeEventInfo->Flags & ACPI_GPE_LEVEL_TRIGGERED) 920 { 921 AcpiOsPrintf ("Level, "); 922 } 923 else 924 { 925 AcpiOsPrintf ("Edge, "); 926 } 927 928 if (GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE) 929 { 930 AcpiOsPrintf ("CanWake, "); 931 } 932 else 933 { 934 AcpiOsPrintf ("RunOnly, "); 935 } 936 937 switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) 938 { 939 case ACPI_GPE_DISPATCH_NONE: 940 941 AcpiOsPrintf ("NotUsed"); 942 break; 943 944 case ACPI_GPE_DISPATCH_METHOD: 945 946 AcpiOsPrintf ("Method"); 947 break; 948 case ACPI_GPE_DISPATCH_HANDLER: 949 950 AcpiOsPrintf ("Handler"); 951 break; 952 953 case ACPI_GPE_DISPATCH_NOTIFY: 954 955 Count = 0; 956 Notify = GpeEventInfo->Dispatch.NotifyList; 957 while (Notify) 958 { 959 Count++; 960 Notify = Notify->Next; 961 } 962 AcpiOsPrintf ("Implicit Notify on %u devices", Count); 963 break; 964 965 default: 966 967 AcpiOsPrintf ("UNKNOWN: %X", 968 GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK); 969 break; 970 } 971 972 AcpiOsPrintf (")\n"); 973 } 974 } 975 Block++; 976 GpeBlock = GpeBlock->Next; 977 } 978 GpeXruptInfo = GpeXruptInfo->Next; 979 } 980 } 981 #endif /* !ACPI_REDUCED_HARDWARE */ 982 983 984 /******************************************************************************* 985 * 986 * FUNCTION: AcpiDbDisplayHandlers 987 * 988 * PARAMETERS: None 989 * 990 * RETURN: None 991 * 992 * DESCRIPTION: Display the currently installed global handlers 993 * 994 ******************************************************************************/ 995 996 void 997 AcpiDbDisplayHandlers ( 998 void) 999 { 1000 ACPI_OPERAND_OBJECT *ObjDesc; 1001 ACPI_OPERAND_OBJECT *HandlerObj; 1002 ACPI_ADR_SPACE_TYPE SpaceId; 1003 UINT32 i; 1004 1005 1006 /* Operation region handlers */ 1007 1008 AcpiOsPrintf ("\nOperation Region Handlers at the namespace root:\n"); 1009 1010 ObjDesc = AcpiNsGetAttachedObject (AcpiGbl_RootNode); 1011 if (ObjDesc) 1012 { 1013 for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_SpaceIdList); i++) 1014 { 1015 SpaceId = AcpiGbl_SpaceIdList[i]; 1016 HandlerObj = ObjDesc->Device.Handler; 1017 1018 AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, 1019 AcpiUtGetRegionName ((UINT8) SpaceId), SpaceId); 1020 1021 while (HandlerObj) 1022 { 1023 if (AcpiGbl_SpaceIdList[i] == HandlerObj->AddressSpace.SpaceId) 1024 { 1025 AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, 1026 (HandlerObj->AddressSpace.HandlerFlags & 1027 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", 1028 HandlerObj->AddressSpace.Handler); 1029 goto FoundHandler; 1030 } 1031 1032 HandlerObj = HandlerObj->AddressSpace.Next; 1033 } 1034 1035 /* There is no handler for this SpaceId */ 1036 1037 AcpiOsPrintf ("None\n"); 1038 1039 FoundHandler:; 1040 } 1041 1042 /* Find all handlers for user-defined SpaceIDs */ 1043 1044 HandlerObj = ObjDesc->Device.Handler; 1045 while (HandlerObj) 1046 { 1047 if (HandlerObj->AddressSpace.SpaceId >= ACPI_USER_REGION_BEGIN) 1048 { 1049 AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, 1050 "User-defined ID", HandlerObj->AddressSpace.SpaceId); 1051 AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, 1052 (HandlerObj->AddressSpace.HandlerFlags & 1053 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", 1054 HandlerObj->AddressSpace.Handler); 1055 } 1056 1057 HandlerObj = HandlerObj->AddressSpace.Next; 1058 } 1059 } 1060 1061 #if (!ACPI_REDUCED_HARDWARE) 1062 1063 /* Fixed event handlers */ 1064 1065 AcpiOsPrintf ("\nFixed Event Handlers:\n"); 1066 1067 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) 1068 { 1069 AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, AcpiUtGetEventName (i), i); 1070 if (AcpiGbl_FixedEventHandlers[i].Handler) 1071 { 1072 AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User", 1073 AcpiGbl_FixedEventHandlers[i].Handler); 1074 } 1075 else 1076 { 1077 AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None"); 1078 } 1079 } 1080 1081 #endif /* !ACPI_REDUCED_HARDWARE */ 1082 1083 /* Miscellaneous global handlers */ 1084 1085 AcpiOsPrintf ("\nMiscellaneous Global Handlers:\n"); 1086 1087 for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_HandlerList); i++) 1088 { 1089 AcpiOsPrintf (ACPI_HANDLER_NAME_STRING, AcpiGbl_HandlerList[i].Name); 1090 if (AcpiGbl_HandlerList[i].Handler) 1091 { 1092 AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User", 1093 AcpiGbl_HandlerList[i].Handler); 1094 } 1095 else 1096 { 1097 AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None"); 1098 } 1099 } 1100 1101 1102 /* Other handlers that are installed throughout the namespace */ 1103 1104 AcpiOsPrintf ("\nOperation Region Handlers for specific devices:\n"); 1105 1106 (void) AcpiWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 1107 ACPI_UINT32_MAX, AcpiDbDisplayNonRootHandlers, 1108 NULL, NULL, NULL); 1109 } 1110 1111 1112 /******************************************************************************* 1113 * 1114 * FUNCTION: AcpiDbDisplayNonRootHandlers 1115 * 1116 * PARAMETERS: ACPI_WALK_CALLBACK 1117 * 1118 * RETURN: Status 1119 * 1120 * DESCRIPTION: Display information about all handlers installed for a 1121 * device object. 1122 * 1123 ******************************************************************************/ 1124 1125 static ACPI_STATUS 1126 AcpiDbDisplayNonRootHandlers ( 1127 ACPI_HANDLE ObjHandle, 1128 UINT32 NestingLevel, 1129 void *Context, 1130 void **ReturnValue) 1131 { 1132 ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle); 1133 ACPI_OPERAND_OBJECT *ObjDesc; 1134 ACPI_OPERAND_OBJECT *HandlerObj; 1135 char *Pathname; 1136 1137 1138 ObjDesc = AcpiNsGetAttachedObject (Node); 1139 if (!ObjDesc) 1140 { 1141 return (AE_OK); 1142 } 1143 1144 Pathname = AcpiNsGetExternalPathname (Node); 1145 if (!Pathname) 1146 { 1147 return (AE_OK); 1148 } 1149 1150 /* Display all handlers associated with this device */ 1151 1152 HandlerObj = ObjDesc->Device.Handler; 1153 while (HandlerObj) 1154 { 1155 AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, 1156 AcpiUtGetRegionName ((UINT8) HandlerObj->AddressSpace.SpaceId), 1157 HandlerObj->AddressSpace.SpaceId); 1158 1159 AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING2, 1160 (HandlerObj->AddressSpace.HandlerFlags & 1161 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", 1162 HandlerObj->AddressSpace.Handler); 1163 1164 AcpiOsPrintf (" Device Name: %s (%p)\n", Pathname, Node); 1165 1166 HandlerObj = HandlerObj->AddressSpace.Next; 1167 } 1168 1169 ACPI_FREE (Pathname); 1170 return (AE_OK); 1171 } 1172 1173 #endif /* ACPI_DEBUGGER */ 1174