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