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 Size = 16; 307 if (AcpiOsReadable (ObjPtr, 64)) 308 { 309 Size = 64; 310 } 311 312 /* Just dump some memory */ 313 314 AcpiUtDebugDumpBuffer (ObjPtr, Size, Display, ACPI_UINT32_MAX); 315 break; 316 } 317 318 return; 319 } 320 321 /* The parameter is a name string that must be resolved to a Named obj */ 322 323 Node = AcpiDbLocalNsLookup (Target); 324 if (!Node) 325 { 326 return; 327 } 328 329 330 DumpNode: 331 /* Now dump the NS node */ 332 333 Status = AcpiGetName (Node, ACPI_FULL_PATHNAME, &RetBuf); 334 if (ACPI_FAILURE (Status)) 335 { 336 AcpiOsPrintf ("Could not convert name to pathname\n"); 337 } 338 339 else 340 { 341 AcpiOsPrintf ("Object (%p) Pathname: %s\n", 342 Node, (char *) RetBuf.Pointer); 343 } 344 345 if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE))) 346 { 347 AcpiOsPrintf ("Invalid Named object at address %p\n", Node); 348 return; 349 } 350 351 AcpiUtDebugDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE), 352 Display, ACPI_UINT32_MAX); 353 AcpiExDumpNamespaceNode (Node, 1); 354 355 ObjDesc = AcpiNsGetAttachedObject (Node); 356 if (ObjDesc) 357 { 358 AcpiOsPrintf ("\nAttached Object (%p):\n", ObjDesc); 359 if (!AcpiOsReadable (ObjDesc, sizeof (ACPI_OPERAND_OBJECT))) 360 { 361 AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n", 362 ObjDesc); 363 return; 364 } 365 366 AcpiUtDebugDumpBuffer ((void *) ObjDesc, sizeof (ACPI_OPERAND_OBJECT), 367 Display, ACPI_UINT32_MAX); 368 AcpiExDumpObjectDescriptor (ObjDesc, 1); 369 } 370 } 371 372 373 /******************************************************************************* 374 * 375 * FUNCTION: AcpiDbDisplayMethodInfo 376 * 377 * PARAMETERS: StartOp - Root of the control method parse tree 378 * 379 * RETURN: None 380 * 381 * DESCRIPTION: Display information about the current method 382 * 383 ******************************************************************************/ 384 385 void 386 AcpiDbDisplayMethodInfo ( 387 ACPI_PARSE_OBJECT *StartOp) 388 { 389 ACPI_WALK_STATE *WalkState; 390 ACPI_OPERAND_OBJECT *ObjDesc; 391 ACPI_NAMESPACE_NODE *Node; 392 ACPI_PARSE_OBJECT *RootOp; 393 ACPI_PARSE_OBJECT *Op; 394 const ACPI_OPCODE_INFO *OpInfo; 395 UINT32 NumOps = 0; 396 UINT32 NumOperands = 0; 397 UINT32 NumOperators = 0; 398 UINT32 NumRemainingOps = 0; 399 UINT32 NumRemainingOperands = 0; 400 UINT32 NumRemainingOperators = 0; 401 BOOLEAN CountRemaining = FALSE; 402 403 404 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 405 if (!WalkState) 406 { 407 AcpiOsPrintf ("There is no method currently executing\n"); 408 return; 409 } 410 411 ObjDesc = WalkState->MethodDesc; 412 Node = WalkState->MethodNode; 413 414 AcpiOsPrintf ("Currently executing control method is [%4.4s]\n", 415 AcpiUtGetNodeName (Node)); 416 AcpiOsPrintf ("%X Arguments, SyncLevel = %X\n", 417 (UINT32) ObjDesc->Method.ParamCount, 418 (UINT32) ObjDesc->Method.SyncLevel); 419 420 421 RootOp = StartOp; 422 while (RootOp->Common.Parent) 423 { 424 RootOp = RootOp->Common.Parent; 425 } 426 427 Op = RootOp; 428 429 while (Op) 430 { 431 if (Op == StartOp) 432 { 433 CountRemaining = TRUE; 434 } 435 436 NumOps++; 437 if (CountRemaining) 438 { 439 NumRemainingOps++; 440 } 441 442 /* Decode the opcode */ 443 444 OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); 445 switch (OpInfo->Class) 446 { 447 case AML_CLASS_ARGUMENT: 448 449 if (CountRemaining) 450 { 451 NumRemainingOperands++; 452 } 453 454 NumOperands++; 455 break; 456 457 case AML_CLASS_UNKNOWN: 458 459 /* Bad opcode or ASCII character */ 460 461 continue; 462 463 default: 464 465 if (CountRemaining) 466 { 467 NumRemainingOperators++; 468 } 469 470 NumOperators++; 471 break; 472 } 473 474 Op = AcpiPsGetDepthNext (StartOp, Op); 475 } 476 477 AcpiOsPrintf ( 478 "Method contains: %X AML Opcodes - %X Operators, %X Operands\n", 479 NumOps, NumOperators, NumOperands); 480 481 AcpiOsPrintf ( 482 "Remaining to execute: %X AML Opcodes - %X Operators, %X Operands\n", 483 NumRemainingOps, NumRemainingOperators, NumRemainingOperands); 484 } 485 486 487 /******************************************************************************* 488 * 489 * FUNCTION: AcpiDbDisplayLocals 490 * 491 * PARAMETERS: None 492 * 493 * RETURN: None 494 * 495 * DESCRIPTION: Display all locals for the currently running control method 496 * 497 ******************************************************************************/ 498 499 void 500 AcpiDbDisplayLocals ( 501 void) 502 { 503 ACPI_WALK_STATE *WalkState; 504 505 506 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 507 if (!WalkState) 508 { 509 AcpiOsPrintf ("There is no method currently executing\n"); 510 return; 511 } 512 513 AcpiDmDisplayLocals (WalkState); 514 } 515 516 517 /******************************************************************************* 518 * 519 * FUNCTION: AcpiDbDisplayArguments 520 * 521 * PARAMETERS: None 522 * 523 * RETURN: None 524 * 525 * DESCRIPTION: Display all arguments for the currently running control method 526 * 527 ******************************************************************************/ 528 529 void 530 AcpiDbDisplayArguments ( 531 void) 532 { 533 ACPI_WALK_STATE *WalkState; 534 535 536 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 537 if (!WalkState) 538 { 539 AcpiOsPrintf ("There is no method currently executing\n"); 540 return; 541 } 542 543 AcpiDmDisplayArguments (WalkState); 544 } 545 546 547 /******************************************************************************* 548 * 549 * FUNCTION: AcpiDbDisplayResults 550 * 551 * PARAMETERS: None 552 * 553 * RETURN: None 554 * 555 * DESCRIPTION: Display current contents of a method result stack 556 * 557 ******************************************************************************/ 558 559 void 560 AcpiDbDisplayResults ( 561 void) 562 { 563 UINT32 i; 564 ACPI_WALK_STATE *WalkState; 565 ACPI_OPERAND_OBJECT *ObjDesc; 566 UINT32 ResultCount = 0; 567 ACPI_NAMESPACE_NODE *Node; 568 ACPI_GENERIC_STATE *Frame; 569 UINT32 Index; /* Index onto current frame */ 570 571 572 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 573 if (!WalkState) 574 { 575 AcpiOsPrintf ("There is no method currently executing\n"); 576 return; 577 } 578 579 ObjDesc = WalkState->MethodDesc; 580 Node = WalkState->MethodNode; 581 582 if (WalkState->Results) 583 { 584 ResultCount = WalkState->ResultCount; 585 } 586 587 AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n", 588 AcpiUtGetNodeName (Node), ResultCount); 589 590 /* From the top element of result stack */ 591 592 Frame = WalkState->Results; 593 Index = (ResultCount - 1) % ACPI_RESULTS_FRAME_OBJ_NUM; 594 595 for (i = 0; i < ResultCount; i++) 596 { 597 ObjDesc = Frame->Results.ObjDesc[Index]; 598 AcpiOsPrintf ("Result%u: ", i); 599 AcpiDmDisplayInternalObject (ObjDesc, WalkState); 600 if (Index == 0) 601 { 602 Frame = Frame->Results.Next; 603 Index = ACPI_RESULTS_FRAME_OBJ_NUM; 604 } 605 Index--; 606 } 607 } 608 609 610 /******************************************************************************* 611 * 612 * FUNCTION: AcpiDbDisplayCallingTree 613 * 614 * PARAMETERS: None 615 * 616 * RETURN: None 617 * 618 * DESCRIPTION: Display current calling tree of nested control methods 619 * 620 ******************************************************************************/ 621 622 void 623 AcpiDbDisplayCallingTree ( 624 void) 625 { 626 ACPI_WALK_STATE *WalkState; 627 ACPI_NAMESPACE_NODE *Node; 628 629 630 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 631 if (!WalkState) 632 { 633 AcpiOsPrintf ("There is no method currently executing\n"); 634 return; 635 } 636 637 Node = WalkState->MethodNode; 638 AcpiOsPrintf ("Current Control Method Call Tree\n"); 639 640 while (WalkState) 641 { 642 Node = WalkState->MethodNode; 643 644 AcpiOsPrintf (" [%4.4s]\n", AcpiUtGetNodeName (Node)); 645 646 WalkState = WalkState->Next; 647 } 648 } 649 650 651 /******************************************************************************* 652 * 653 * FUNCTION: AcpiDbDisplayObjectType 654 * 655 * PARAMETERS: Name - User entered NS node handle or name 656 * 657 * RETURN: None 658 * 659 * DESCRIPTION: Display type of an arbitrary NS node 660 * 661 ******************************************************************************/ 662 663 void 664 AcpiDbDisplayObjectType ( 665 char *Name) 666 { 667 ACPI_NAMESPACE_NODE *Node; 668 ACPI_DEVICE_INFO *Info; 669 ACPI_STATUS Status; 670 UINT32 i; 671 672 673 Node = AcpiDbConvertToNode (Name); 674 if (!Node) 675 { 676 return; 677 } 678 679 Status = AcpiGetObjectInfo (ACPI_CAST_PTR (ACPI_HANDLE, Node), &Info); 680 if (ACPI_FAILURE (Status)) 681 { 682 AcpiOsPrintf ("Could not get object info, %s\n", 683 AcpiFormatException (Status)); 684 return; 685 } 686 687 if (Info->Valid & ACPI_VALID_ADR) 688 { 689 AcpiOsPrintf ("ADR: %8.8X%8.8X, STA: %8.8X, Flags: %X\n", 690 ACPI_FORMAT_UINT64 (Info->Address), 691 Info->CurrentStatus, Info->Flags); 692 } 693 if (Info->Valid & ACPI_VALID_SXDS) 694 { 695 AcpiOsPrintf ("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X\n", 696 Info->HighestDstates[0], Info->HighestDstates[1], 697 Info->HighestDstates[2], Info->HighestDstates[3]); 698 } 699 if (Info->Valid & ACPI_VALID_SXWS) 700 { 701 AcpiOsPrintf ("S0W-%2.2X S1W-%2.2X S2W-%2.2X S3W-%2.2X S4W-%2.2X\n", 702 Info->LowestDstates[0], Info->LowestDstates[1], 703 Info->LowestDstates[2], Info->LowestDstates[3], 704 Info->LowestDstates[4]); 705 } 706 707 if (Info->Valid & ACPI_VALID_HID) 708 { 709 AcpiOsPrintf ("HID: %s\n", Info->HardwareId.String); 710 } 711 if (Info->Valid & ACPI_VALID_UID) 712 { 713 AcpiOsPrintf ("UID: %s\n", Info->UniqueId.String); 714 } 715 if (Info->Valid & ACPI_VALID_SUB) 716 { 717 AcpiOsPrintf ("SUB: %s\n", Info->SubsystemId.String); 718 } 719 if (Info->Valid & ACPI_VALID_CID) 720 { 721 for (i = 0; i < Info->CompatibleIdList.Count; i++) 722 { 723 AcpiOsPrintf ("CID %u: %s\n", i, 724 Info->CompatibleIdList.Ids[i].String); 725 } 726 } 727 728 ACPI_FREE (Info); 729 } 730 731 732 /******************************************************************************* 733 * 734 * FUNCTION: AcpiDbDisplayResultObject 735 * 736 * PARAMETERS: ObjDesc - Object to be displayed 737 * WalkState - Current walk state 738 * 739 * RETURN: None 740 * 741 * DESCRIPTION: Display the result of an AML opcode 742 * 743 * Note: Curently only displays the result object if we are single stepping. 744 * However, this output may be useful in other contexts and could be enabled 745 * to do so if needed. 746 * 747 ******************************************************************************/ 748 749 void 750 AcpiDbDisplayResultObject ( 751 ACPI_OPERAND_OBJECT *ObjDesc, 752 ACPI_WALK_STATE *WalkState) 753 { 754 755 /* Only display if single stepping */ 756 757 if (!AcpiGbl_CmSingleStep) 758 { 759 return; 760 } 761 762 AcpiOsPrintf ("ResultObj: "); 763 AcpiDmDisplayInternalObject (ObjDesc, WalkState); 764 AcpiOsPrintf ("\n"); 765 } 766 767 768 /******************************************************************************* 769 * 770 * FUNCTION: AcpiDbDisplayArgumentObject 771 * 772 * PARAMETERS: ObjDesc - Object to be displayed 773 * WalkState - Current walk state 774 * 775 * RETURN: None 776 * 777 * DESCRIPTION: Display the result of an AML opcode 778 * 779 ******************************************************************************/ 780 781 void 782 AcpiDbDisplayArgumentObject ( 783 ACPI_OPERAND_OBJECT *ObjDesc, 784 ACPI_WALK_STATE *WalkState) 785 { 786 787 if (!AcpiGbl_CmSingleStep) 788 { 789 return; 790 } 791 792 AcpiOsPrintf ("ArgObj: "); 793 AcpiDmDisplayInternalObject (ObjDesc, WalkState); 794 } 795 796 797 #if (!ACPI_REDUCED_HARDWARE) 798 /******************************************************************************* 799 * 800 * FUNCTION: AcpiDbDisplayGpes 801 * 802 * PARAMETERS: None 803 * 804 * RETURN: None 805 * 806 * DESCRIPTION: Display the current GPE structures 807 * 808 ******************************************************************************/ 809 810 void 811 AcpiDbDisplayGpes ( 812 void) 813 { 814 ACPI_GPE_BLOCK_INFO *GpeBlock; 815 ACPI_GPE_XRUPT_INFO *GpeXruptInfo; 816 ACPI_GPE_EVENT_INFO *GpeEventInfo; 817 ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; 818 char *GpeType; 819 ACPI_GPE_NOTIFY_INFO *Notify; 820 UINT32 GpeIndex; 821 UINT32 Block = 0; 822 UINT32 i; 823 UINT32 j; 824 UINT32 Count; 825 char Buffer[80]; 826 ACPI_BUFFER RetBuf; 827 ACPI_STATUS Status; 828 829 830 RetBuf.Length = sizeof (Buffer); 831 RetBuf.Pointer = Buffer; 832 833 Block = 0; 834 835 /* Walk the GPE lists */ 836 837 GpeXruptInfo = AcpiGbl_GpeXruptListHead; 838 while (GpeXruptInfo) 839 { 840 GpeBlock = GpeXruptInfo->GpeBlockListHead; 841 while (GpeBlock) 842 { 843 Status = AcpiGetName (GpeBlock->Node, ACPI_FULL_PATHNAME, &RetBuf); 844 if (ACPI_FAILURE (Status)) 845 { 846 AcpiOsPrintf ("Could not convert name to pathname\n"); 847 } 848 849 if (GpeBlock->Node == AcpiGbl_FadtGpeDevice) 850 { 851 GpeType = "FADT-defined GPE block"; 852 } 853 else 854 { 855 GpeType = "GPE Block Device"; 856 } 857 858 AcpiOsPrintf ("\nBlock %u - Info %p DeviceNode %p [%s] - %s\n", 859 Block, GpeBlock, GpeBlock->Node, Buffer, GpeType); 860 861 AcpiOsPrintf (" Registers: %u (%u GPEs)\n", 862 GpeBlock->RegisterCount, GpeBlock->GpeCount); 863 864 AcpiOsPrintf (" GPE range: 0x%X to 0x%X on interrupt %u\n", 865 GpeBlock->BlockBaseNumber, 866 GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1), 867 GpeXruptInfo->InterruptNumber); 868 869 AcpiOsPrintf ( 870 " RegisterInfo: %p Status %8.8X%8.8X Enable %8.8X%8.8X\n", 871 GpeBlock->RegisterInfo, 872 ACPI_FORMAT_UINT64 (GpeBlock->RegisterInfo->StatusAddress.Address), 873 ACPI_FORMAT_UINT64 (GpeBlock->RegisterInfo->EnableAddress.Address)); 874 875 AcpiOsPrintf (" EventInfo: %p\n", GpeBlock->EventInfo); 876 877 /* Examine each GPE Register within the block */ 878 879 for (i = 0; i < GpeBlock->RegisterCount; i++) 880 { 881 GpeRegisterInfo = &GpeBlock->RegisterInfo[i]; 882 883 AcpiOsPrintf ( 884 " Reg %u: (GPE %.2X-%.2X) RunEnable %2.2X WakeEnable %2.2X" 885 " Status %8.8X%8.8X Enable %8.8X%8.8X\n", 886 i, GpeRegisterInfo->BaseGpeNumber, 887 GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1), 888 GpeRegisterInfo->EnableForRun, 889 GpeRegisterInfo->EnableForWake, 890 ACPI_FORMAT_UINT64 (GpeRegisterInfo->StatusAddress.Address), 891 ACPI_FORMAT_UINT64 (GpeRegisterInfo->EnableAddress.Address)); 892 893 /* Now look at the individual GPEs in this byte register */ 894 895 for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) 896 { 897 GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j; 898 GpeEventInfo = &GpeBlock->EventInfo[GpeIndex]; 899 900 if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == 901 ACPI_GPE_DISPATCH_NONE) 902 { 903 /* This GPE is not used (no method or handler), ignore it */ 904 905 continue; 906 } 907 908 AcpiOsPrintf ( 909 " GPE %.2X: %p RunRefs %2.2X Flags %2.2X (", 910 GpeBlock->BlockBaseNumber + GpeIndex, GpeEventInfo, 911 GpeEventInfo->RuntimeCount, GpeEventInfo->Flags); 912 913 /* Decode the flags byte */ 914 915 if (GpeEventInfo->Flags & ACPI_GPE_LEVEL_TRIGGERED) 916 { 917 AcpiOsPrintf ("Level, "); 918 } 919 else 920 { 921 AcpiOsPrintf ("Edge, "); 922 } 923 924 if (GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE) 925 { 926 AcpiOsPrintf ("CanWake, "); 927 } 928 else 929 { 930 AcpiOsPrintf ("RunOnly, "); 931 } 932 933 switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) 934 { 935 case ACPI_GPE_DISPATCH_NONE: 936 937 AcpiOsPrintf ("NotUsed"); 938 break; 939 940 case ACPI_GPE_DISPATCH_METHOD: 941 942 AcpiOsPrintf ("Method"); 943 break; 944 case ACPI_GPE_DISPATCH_HANDLER: 945 946 AcpiOsPrintf ("Handler"); 947 break; 948 949 case ACPI_GPE_DISPATCH_NOTIFY: 950 951 Count = 0; 952 Notify = GpeEventInfo->Dispatch.NotifyList; 953 while (Notify) 954 { 955 Count++; 956 Notify = Notify->Next; 957 } 958 AcpiOsPrintf ("Implicit Notify on %u devices", Count); 959 break; 960 961 default: 962 963 AcpiOsPrintf ("UNKNOWN: %X", 964 GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK); 965 break; 966 } 967 968 AcpiOsPrintf (")\n"); 969 } 970 } 971 Block++; 972 GpeBlock = GpeBlock->Next; 973 } 974 GpeXruptInfo = GpeXruptInfo->Next; 975 } 976 } 977 #endif /* !ACPI_REDUCED_HARDWARE */ 978 979 980 /******************************************************************************* 981 * 982 * FUNCTION: AcpiDbDisplayHandlers 983 * 984 * PARAMETERS: None 985 * 986 * RETURN: None 987 * 988 * DESCRIPTION: Display the currently installed global handlers 989 * 990 ******************************************************************************/ 991 992 void 993 AcpiDbDisplayHandlers ( 994 void) 995 { 996 ACPI_OPERAND_OBJECT *ObjDesc; 997 ACPI_OPERAND_OBJECT *HandlerObj; 998 ACPI_ADR_SPACE_TYPE SpaceId; 999 UINT32 i; 1000 1001 1002 /* Operation region handlers */ 1003 1004 AcpiOsPrintf ("\nOperation Region Handlers at the namespace root:\n"); 1005 1006 ObjDesc = AcpiNsGetAttachedObject (AcpiGbl_RootNode); 1007 if (ObjDesc) 1008 { 1009 for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_SpaceIdList); i++) 1010 { 1011 SpaceId = AcpiGbl_SpaceIdList[i]; 1012 HandlerObj = ObjDesc->Device.Handler; 1013 1014 AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, 1015 AcpiUtGetRegionName ((UINT8) SpaceId), SpaceId); 1016 1017 while (HandlerObj) 1018 { 1019 if (AcpiGbl_SpaceIdList[i] == HandlerObj->AddressSpace.SpaceId) 1020 { 1021 AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, 1022 (HandlerObj->AddressSpace.HandlerFlags & 1023 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", 1024 HandlerObj->AddressSpace.Handler); 1025 goto FoundHandler; 1026 } 1027 1028 HandlerObj = HandlerObj->AddressSpace.Next; 1029 } 1030 1031 /* There is no handler for this SpaceId */ 1032 1033 AcpiOsPrintf ("None\n"); 1034 1035 FoundHandler:; 1036 } 1037 1038 /* Find all handlers for user-defined SpaceIDs */ 1039 1040 HandlerObj = ObjDesc->Device.Handler; 1041 while (HandlerObj) 1042 { 1043 if (HandlerObj->AddressSpace.SpaceId >= ACPI_USER_REGION_BEGIN) 1044 { 1045 AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, 1046 "User-defined ID", HandlerObj->AddressSpace.SpaceId); 1047 AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, 1048 (HandlerObj->AddressSpace.HandlerFlags & 1049 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", 1050 HandlerObj->AddressSpace.Handler); 1051 } 1052 1053 HandlerObj = HandlerObj->AddressSpace.Next; 1054 } 1055 } 1056 1057 #if (!ACPI_REDUCED_HARDWARE) 1058 1059 /* Fixed event handlers */ 1060 1061 AcpiOsPrintf ("\nFixed Event Handlers:\n"); 1062 1063 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) 1064 { 1065 AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, AcpiUtGetEventName (i), i); 1066 if (AcpiGbl_FixedEventHandlers[i].Handler) 1067 { 1068 AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User", 1069 AcpiGbl_FixedEventHandlers[i].Handler); 1070 } 1071 else 1072 { 1073 AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None"); 1074 } 1075 } 1076 1077 #endif /* !ACPI_REDUCED_HARDWARE */ 1078 1079 /* Miscellaneous global handlers */ 1080 1081 AcpiOsPrintf ("\nMiscellaneous Global Handlers:\n"); 1082 1083 for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_HandlerList); i++) 1084 { 1085 AcpiOsPrintf (ACPI_HANDLER_NAME_STRING, AcpiGbl_HandlerList[i].Name); 1086 if (AcpiGbl_HandlerList[i].Handler) 1087 { 1088 AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User", 1089 AcpiGbl_HandlerList[i].Handler); 1090 } 1091 else 1092 { 1093 AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None"); 1094 } 1095 } 1096 1097 1098 /* Other handlers that are installed throughout the namespace */ 1099 1100 AcpiOsPrintf ("\nOperation Region Handlers for specific devices:\n"); 1101 1102 (void) AcpiWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 1103 ACPI_UINT32_MAX, AcpiDbDisplayNonRootHandlers, 1104 NULL, NULL, NULL); 1105 } 1106 1107 1108 /******************************************************************************* 1109 * 1110 * FUNCTION: AcpiDbDisplayNonRootHandlers 1111 * 1112 * PARAMETERS: ACPI_WALK_CALLBACK 1113 * 1114 * RETURN: Status 1115 * 1116 * DESCRIPTION: Display information about all handlers installed for a 1117 * device object. 1118 * 1119 ******************************************************************************/ 1120 1121 static ACPI_STATUS 1122 AcpiDbDisplayNonRootHandlers ( 1123 ACPI_HANDLE ObjHandle, 1124 UINT32 NestingLevel, 1125 void *Context, 1126 void **ReturnValue) 1127 { 1128 ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle); 1129 ACPI_OPERAND_OBJECT *ObjDesc; 1130 ACPI_OPERAND_OBJECT *HandlerObj; 1131 char *Pathname; 1132 1133 1134 ObjDesc = AcpiNsGetAttachedObject (Node); 1135 if (!ObjDesc) 1136 { 1137 return (AE_OK); 1138 } 1139 1140 Pathname = AcpiNsGetExternalPathname (Node); 1141 if (!Pathname) 1142 { 1143 return (AE_OK); 1144 } 1145 1146 /* Display all handlers associated with this device */ 1147 1148 HandlerObj = ObjDesc->Device.Handler; 1149 while (HandlerObj) 1150 { 1151 AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, 1152 AcpiUtGetRegionName ((UINT8) HandlerObj->AddressSpace.SpaceId), 1153 HandlerObj->AddressSpace.SpaceId); 1154 1155 AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING2, 1156 (HandlerObj->AddressSpace.HandlerFlags & 1157 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", 1158 HandlerObj->AddressSpace.Handler); 1159 1160 AcpiOsPrintf (" Device Name: %s (%p)\n", Pathname, Node); 1161 1162 HandlerObj = HandlerObj->AddressSpace.Next; 1163 } 1164 1165 ACPI_FREE (Pathname); 1166 return (AE_OK); 1167 } 1168 1169 #endif /* ACPI_DEBUGGER */