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 AcpiUtDumpBuffer (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 AcpiUtDumpBuffer (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 AcpiUtDumpBuffer (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 AcpiUtDumpBuffer ((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 AcpiUtDumpBuffer ((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: ObjectArg - User entered NS node handle 647 * 648 * RETURN: None 649 * 650 * DESCRIPTION: Display type of an arbitrary NS node 651 * 652 ******************************************************************************/ 653 654 void 655 AcpiDbDisplayObjectType ( 656 char *ObjectArg) 657 { 658 ACPI_HANDLE Handle; 659 ACPI_DEVICE_INFO *Info; 660 ACPI_STATUS Status; 661 UINT32 i; 662 663 664 Handle = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16)); 665 666 Status = AcpiGetObjectInfo (Handle, &Info); 667 if (ACPI_FAILURE (Status)) 668 { 669 AcpiOsPrintf ("Could not get object info, %s\n", 670 AcpiFormatException (Status)); 671 return; 672 } 673 674 AcpiOsPrintf ("ADR: %8.8X%8.8X, STA: %8.8X, Flags: %X\n", 675 ACPI_FORMAT_UINT64 (Info->Address), 676 Info->CurrentStatus, Info->Flags); 677 678 AcpiOsPrintf ("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X\n", 679 Info->HighestDstates[0], Info->HighestDstates[1], 680 Info->HighestDstates[2], Info->HighestDstates[3]); 681 682 AcpiOsPrintf ("S0W-%2.2X S1W-%2.2X S2W-%2.2X S3W-%2.2X S4W-%2.2X\n", 683 Info->LowestDstates[0], Info->LowestDstates[1], 684 Info->LowestDstates[2], Info->LowestDstates[3], 685 Info->LowestDstates[4]); 686 687 if (Info->Valid & ACPI_VALID_HID) 688 { 689 AcpiOsPrintf ("HID: %s\n", Info->HardwareId.String); 690 } 691 if (Info->Valid & ACPI_VALID_UID) 692 { 693 AcpiOsPrintf ("UID: %s\n", Info->UniqueId.String); 694 } 695 if (Info->Valid & ACPI_VALID_CID) 696 { 697 for (i = 0; i < Info->CompatibleIdList.Count; i++) 698 { 699 AcpiOsPrintf ("CID %u: %s\n", i, 700 Info->CompatibleIdList.Ids[i].String); 701 } 702 } 703 704 ACPI_FREE (Info); 705 } 706 707 708 /******************************************************************************* 709 * 710 * FUNCTION: AcpiDbDisplayResultObject 711 * 712 * PARAMETERS: ObjDesc - Object to be displayed 713 * WalkState - Current walk state 714 * 715 * RETURN: None 716 * 717 * DESCRIPTION: Display the result of an AML opcode 718 * 719 * Note: Curently only displays the result object if we are single stepping. 720 * However, this output may be useful in other contexts and could be enabled 721 * to do so if needed. 722 * 723 ******************************************************************************/ 724 725 void 726 AcpiDbDisplayResultObject ( 727 ACPI_OPERAND_OBJECT *ObjDesc, 728 ACPI_WALK_STATE *WalkState) 729 { 730 731 /* Only display if single stepping */ 732 733 if (!AcpiGbl_CmSingleStep) 734 { 735 return; 736 } 737 738 AcpiOsPrintf ("ResultObj: "); 739 AcpiDmDisplayInternalObject (ObjDesc, WalkState); 740 AcpiOsPrintf ("\n"); 741 } 742 743 744 /******************************************************************************* 745 * 746 * FUNCTION: AcpiDbDisplayArgumentObject 747 * 748 * PARAMETERS: ObjDesc - Object to be displayed 749 * WalkState - Current walk state 750 * 751 * RETURN: None 752 * 753 * DESCRIPTION: Display the result of an AML opcode 754 * 755 ******************************************************************************/ 756 757 void 758 AcpiDbDisplayArgumentObject ( 759 ACPI_OPERAND_OBJECT *ObjDesc, 760 ACPI_WALK_STATE *WalkState) 761 { 762 763 if (!AcpiGbl_CmSingleStep) 764 { 765 return; 766 } 767 768 AcpiOsPrintf ("ArgObj: "); 769 AcpiDmDisplayInternalObject (ObjDesc, WalkState); 770 } 771 772 773 #if (!ACPI_REDUCED_HARDWARE) 774 /******************************************************************************* 775 * 776 * FUNCTION: AcpiDbDisplayGpes 777 * 778 * PARAMETERS: None 779 * 780 * RETURN: None 781 * 782 * DESCRIPTION: Display the current GPE structures 783 * 784 ******************************************************************************/ 785 786 void 787 AcpiDbDisplayGpes ( 788 void) 789 { 790 ACPI_GPE_BLOCK_INFO *GpeBlock; 791 ACPI_GPE_XRUPT_INFO *GpeXruptInfo; 792 ACPI_GPE_EVENT_INFO *GpeEventInfo; 793 ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; 794 char *GpeType; 795 ACPI_GPE_NOTIFY_INFO *Notify; 796 UINT32 GpeIndex; 797 UINT32 Block = 0; 798 UINT32 i; 799 UINT32 j; 800 UINT32 Count; 801 char Buffer[80]; 802 ACPI_BUFFER RetBuf; 803 ACPI_STATUS Status; 804 805 806 RetBuf.Length = sizeof (Buffer); 807 RetBuf.Pointer = Buffer; 808 809 Block = 0; 810 811 /* Walk the GPE lists */ 812 813 GpeXruptInfo = AcpiGbl_GpeXruptListHead; 814 while (GpeXruptInfo) 815 { 816 GpeBlock = GpeXruptInfo->GpeBlockListHead; 817 while (GpeBlock) 818 { 819 Status = AcpiGetName (GpeBlock->Node, ACPI_FULL_PATHNAME, &RetBuf); 820 if (ACPI_FAILURE (Status)) 821 { 822 AcpiOsPrintf ("Could not convert name to pathname\n"); 823 } 824 825 if (GpeBlock->Node == AcpiGbl_FadtGpeDevice) 826 { 827 GpeType = "FADT-defined GPE block"; 828 } 829 else 830 { 831 GpeType = "GPE Block Device"; 832 } 833 834 AcpiOsPrintf ("\nBlock %u - Info %p DeviceNode %p [%s] - %s\n", 835 Block, GpeBlock, GpeBlock->Node, Buffer, GpeType); 836 837 AcpiOsPrintf (" Registers: %u (%u GPEs)\n", 838 GpeBlock->RegisterCount, GpeBlock->GpeCount); 839 840 AcpiOsPrintf (" GPE range: 0x%X to 0x%X on interrupt %u\n", 841 GpeBlock->BlockBaseNumber, 842 GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1), 843 GpeXruptInfo->InterruptNumber); 844 845 AcpiOsPrintf ( 846 " RegisterInfo: %p Status %8.8X%8.8X Enable %8.8X%8.8X\n", 847 GpeBlock->RegisterInfo, 848 ACPI_FORMAT_UINT64 (GpeBlock->RegisterInfo->StatusAddress.Address), 849 ACPI_FORMAT_UINT64 (GpeBlock->RegisterInfo->EnableAddress.Address)); 850 851 AcpiOsPrintf (" EventInfo: %p\n", GpeBlock->EventInfo); 852 853 /* Examine each GPE Register within the block */ 854 855 for (i = 0; i < GpeBlock->RegisterCount; i++) 856 { 857 GpeRegisterInfo = &GpeBlock->RegisterInfo[i]; 858 859 AcpiOsPrintf ( 860 " Reg %u: (GPE %.2X-%.2X) RunEnable %2.2X WakeEnable %2.2X" 861 " Status %8.8X%8.8X Enable %8.8X%8.8X\n", 862 i, GpeRegisterInfo->BaseGpeNumber, 863 GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1), 864 GpeRegisterInfo->EnableForRun, 865 GpeRegisterInfo->EnableForWake, 866 ACPI_FORMAT_UINT64 (GpeRegisterInfo->StatusAddress.Address), 867 ACPI_FORMAT_UINT64 (GpeRegisterInfo->EnableAddress.Address)); 868 869 /* Now look at the individual GPEs in this byte register */ 870 871 for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) 872 { 873 GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j; 874 GpeEventInfo = &GpeBlock->EventInfo[GpeIndex]; 875 876 if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == 877 ACPI_GPE_DISPATCH_NONE) 878 { 879 /* This GPE is not used (no method or handler), ignore it */ 880 881 continue; 882 } 883 884 AcpiOsPrintf ( 885 " GPE %.2X: %p RunRefs %2.2X Flags %2.2X (", 886 GpeBlock->BlockBaseNumber + GpeIndex, GpeEventInfo, 887 GpeEventInfo->RuntimeCount, GpeEventInfo->Flags); 888 889 /* Decode the flags byte */ 890 891 if (GpeEventInfo->Flags & ACPI_GPE_LEVEL_TRIGGERED) 892 { 893 AcpiOsPrintf ("Level, "); 894 } 895 else 896 { 897 AcpiOsPrintf ("Edge, "); 898 } 899 900 if (GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE) 901 { 902 AcpiOsPrintf ("CanWake, "); 903 } 904 else 905 { 906 AcpiOsPrintf ("RunOnly, "); 907 } 908 909 switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) 910 { 911 case ACPI_GPE_DISPATCH_NONE: 912 AcpiOsPrintf ("NotUsed"); 913 break; 914 case ACPI_GPE_DISPATCH_METHOD: 915 AcpiOsPrintf ("Method"); 916 break; 917 case ACPI_GPE_DISPATCH_HANDLER: 918 AcpiOsPrintf ("Handler"); 919 break; 920 case ACPI_GPE_DISPATCH_NOTIFY: 921 Count = 0; 922 Notify = GpeEventInfo->Dispatch.NotifyList; 923 while (Notify) 924 { 925 Count++; 926 Notify = Notify->Next; 927 } 928 AcpiOsPrintf ("Implicit Notify on %u devices", Count); 929 break; 930 default: 931 AcpiOsPrintf ("UNKNOWN: %X", 932 GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK); 933 break; 934 } 935 936 AcpiOsPrintf (")\n"); 937 } 938 } 939 Block++; 940 GpeBlock = GpeBlock->Next; 941 } 942 GpeXruptInfo = GpeXruptInfo->Next; 943 } 944 } 945 #endif /* !ACPI_REDUCED_HARDWARE */ 946 947 948 /******************************************************************************* 949 * 950 * FUNCTION: AcpiDbDisplayHandlers 951 * 952 * PARAMETERS: None 953 * 954 * RETURN: None 955 * 956 * DESCRIPTION: Display the currently installed global handlers 957 * 958 ******************************************************************************/ 959 960 void 961 AcpiDbDisplayHandlers ( 962 void) 963 { 964 ACPI_OPERAND_OBJECT *ObjDesc; 965 ACPI_OPERAND_OBJECT *HandlerObj; 966 ACPI_ADR_SPACE_TYPE SpaceId; 967 UINT32 i; 968 969 970 /* Operation region handlers */ 971 972 AcpiOsPrintf ("\nOperation Region Handlers:\n"); 973 974 ObjDesc = AcpiNsGetAttachedObject (AcpiGbl_RootNode); 975 if (ObjDesc) 976 { 977 for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_SpaceIdList); i++) 978 { 979 SpaceId = AcpiGbl_SpaceIdList[i]; 980 HandlerObj = ObjDesc->Device.Handler; 981 982 AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, 983 AcpiUtGetRegionName ((UINT8) SpaceId), SpaceId); 984 985 while (HandlerObj) 986 { 987 if (AcpiGbl_SpaceIdList[i] == HandlerObj->AddressSpace.SpaceId) 988 { 989 AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, 990 (HandlerObj->AddressSpace.HandlerFlags & 991 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", 992 HandlerObj->AddressSpace.Handler); 993 goto FoundHandler; 994 } 995 996 HandlerObj = HandlerObj->AddressSpace.Next; 997 } 998 999 /* There is no handler for this SpaceId */ 1000 1001 AcpiOsPrintf ("None\n"); 1002 1003 FoundHandler:; 1004 } 1005 1006 /* Find all handlers for user-defined SpaceIDs */ 1007 1008 HandlerObj = ObjDesc->Device.Handler; 1009 while (HandlerObj) 1010 { 1011 if (HandlerObj->AddressSpace.SpaceId >= ACPI_USER_REGION_BEGIN) 1012 { 1013 AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, 1014 "User-defined ID", HandlerObj->AddressSpace.SpaceId); 1015 AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, 1016 (HandlerObj->AddressSpace.HandlerFlags & 1017 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", 1018 HandlerObj->AddressSpace.Handler); 1019 } 1020 1021 HandlerObj = HandlerObj->AddressSpace.Next; 1022 } 1023 } 1024 1025 #if (!ACPI_REDUCED_HARDWARE) 1026 1027 /* Fixed event handlers */ 1028 1029 AcpiOsPrintf ("\nFixed Event Handlers:\n"); 1030 1031 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) 1032 { 1033 AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, AcpiUtGetEventName (i), i); 1034 if (AcpiGbl_FixedEventHandlers[i].Handler) 1035 { 1036 AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User", 1037 AcpiGbl_FixedEventHandlers[i].Handler); 1038 } 1039 else 1040 { 1041 AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None"); 1042 } 1043 } 1044 1045 #endif /* !ACPI_REDUCED_HARDWARE */ 1046 1047 /* Miscellaneous global handlers */ 1048 1049 AcpiOsPrintf ("\nMiscellaneous Global Handlers:\n"); 1050 1051 for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_HandlerList); i++) 1052 { 1053 AcpiOsPrintf (ACPI_HANDLER_NAME_STRING, AcpiGbl_HandlerList[i].Name); 1054 if (AcpiGbl_HandlerList[i].Handler) 1055 { 1056 AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User", 1057 AcpiGbl_HandlerList[i].Handler); 1058 } 1059 else 1060 { 1061 AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None"); 1062 } 1063 } 1064 } 1065 1066 #endif /* ACPI_DEBUGGER */ 1067