dbdisply.c revision 231844
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 63static void 64AcpiDbDumpParserDescriptor ( 65 ACPI_PARSE_OBJECT *Op); 66 67static void * 68AcpiDbGetPointer ( 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 83static 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 101typedef struct acpi_handler_info 102{ 103 void *Handler; 104 char *Name; 105 106} ACPI_HANDLER_INFO; 107 108static ACPI_HANDLER_INFO AcpiGbl_HandlerList[] = 109{ 110 {&AcpiGbl_SystemNotify.Handler, "System Notifications"}, 111 {&AcpiGbl_DeviceNotify.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 130static void * 131AcpiDbGetPointer ( 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 154static void 155AcpiDbDumpParserDescriptor ( 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 189void 190AcpiDbDecodeAndDisplayObject ( 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 324DumpNode: 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 379void 380AcpiDbDisplayMethodInfo ( 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 490void 491AcpiDbDisplayLocals ( 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 520void 521AcpiDbDisplayArguments ( 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 550void 551AcpiDbDisplayResults ( 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 613void 614AcpiDbDisplayCallingTree ( 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 654void 655AcpiDbDisplayObjectType ( 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 725void 726AcpiDbDisplayResultObject ( 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 757void 758AcpiDbDisplayArgumentObject ( 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 786void 787AcpiDbDisplayGpes ( 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 UINT32 GpeIndex; 796 UINT32 Block = 0; 797 UINT32 i; 798 UINT32 j; 799 char Buffer[80]; 800 ACPI_BUFFER RetBuf; 801 ACPI_STATUS Status; 802 803 804 RetBuf.Length = sizeof (Buffer); 805 RetBuf.Pointer = Buffer; 806 807 Block = 0; 808 809 /* Walk the GPE lists */ 810 811 GpeXruptInfo = AcpiGbl_GpeXruptListHead; 812 while (GpeXruptInfo) 813 { 814 GpeBlock = GpeXruptInfo->GpeBlockListHead; 815 while (GpeBlock) 816 { 817 Status = AcpiGetName (GpeBlock->Node, ACPI_FULL_PATHNAME, &RetBuf); 818 if (ACPI_FAILURE (Status)) 819 { 820 AcpiOsPrintf ("Could not convert name to pathname\n"); 821 } 822 823 if (GpeBlock->Node == AcpiGbl_FadtGpeDevice) 824 { 825 GpeType = "FADT-defined GPE block"; 826 } 827 else 828 { 829 GpeType = "GPE Block Device"; 830 } 831 832 AcpiOsPrintf ("\nBlock %u - Info %p DeviceNode %p [%s] - %s\n", 833 Block, GpeBlock, GpeBlock->Node, Buffer, GpeType); 834 835 AcpiOsPrintf (" Registers: %u (%u GPEs)\n", 836 GpeBlock->RegisterCount, GpeBlock->GpeCount); 837 838 AcpiOsPrintf (" GPE range: 0x%X to 0x%X on interrupt %u\n", 839 GpeBlock->BlockBaseNumber, 840 GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1), 841 GpeXruptInfo->InterruptNumber); 842 843 AcpiOsPrintf ( 844 " RegisterInfo: %p Status %8.8X%8.8X Enable %8.8X%8.8X\n", 845 GpeBlock->RegisterInfo, 846 ACPI_FORMAT_UINT64 (GpeBlock->RegisterInfo->StatusAddress.Address), 847 ACPI_FORMAT_UINT64 (GpeBlock->RegisterInfo->EnableAddress.Address)); 848 849 AcpiOsPrintf (" EventInfo: %p\n", GpeBlock->EventInfo); 850 851 /* Examine each GPE Register within the block */ 852 853 for (i = 0; i < GpeBlock->RegisterCount; i++) 854 { 855 GpeRegisterInfo = &GpeBlock->RegisterInfo[i]; 856 857 AcpiOsPrintf ( 858 " Reg %u: (GPE %.2X-%.2X) RunEnable %2.2X WakeEnable %2.2X" 859 " Status %8.8X%8.8X Enable %8.8X%8.8X\n", 860 i, GpeRegisterInfo->BaseGpeNumber, 861 GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1), 862 GpeRegisterInfo->EnableForRun, 863 GpeRegisterInfo->EnableForWake, 864 ACPI_FORMAT_UINT64 (GpeRegisterInfo->StatusAddress.Address), 865 ACPI_FORMAT_UINT64 (GpeRegisterInfo->EnableAddress.Address)); 866 867 /* Now look at the individual GPEs in this byte register */ 868 869 for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) 870 { 871 GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j; 872 GpeEventInfo = &GpeBlock->EventInfo[GpeIndex]; 873 874 if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == 875 ACPI_GPE_DISPATCH_NONE) 876 { 877 /* This GPE is not used (no method or handler), ignore it */ 878 879 continue; 880 } 881 882 AcpiOsPrintf ( 883 " GPE %.2X: %p RunRefs %2.2X Flags %2.2X (", 884 GpeBlock->BlockBaseNumber + GpeIndex, GpeEventInfo, 885 GpeEventInfo->RuntimeCount, GpeEventInfo->Flags); 886 887 /* Decode the flags byte */ 888 889 if (GpeEventInfo->Flags & ACPI_GPE_LEVEL_TRIGGERED) 890 { 891 AcpiOsPrintf ("Level, "); 892 } 893 else 894 { 895 AcpiOsPrintf ("Edge, "); 896 } 897 898 if (GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE) 899 { 900 AcpiOsPrintf ("CanWake, "); 901 } 902 else 903 { 904 AcpiOsPrintf ("RunOnly, "); 905 } 906 907 switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) 908 { 909 case ACPI_GPE_DISPATCH_NONE: 910 AcpiOsPrintf ("NotUsed"); 911 break; 912 case ACPI_GPE_DISPATCH_METHOD: 913 AcpiOsPrintf ("Method"); 914 break; 915 case ACPI_GPE_DISPATCH_HANDLER: 916 AcpiOsPrintf ("Handler"); 917 break; 918 case ACPI_GPE_DISPATCH_NOTIFY: 919 AcpiOsPrintf ("Notify"); 920 break; 921 default: 922 AcpiOsPrintf ("UNKNOWN: %X", 923 GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK); 924 break; 925 } 926 927 AcpiOsPrintf (")\n"); 928 } 929 } 930 Block++; 931 GpeBlock = GpeBlock->Next; 932 } 933 GpeXruptInfo = GpeXruptInfo->Next; 934 } 935} 936#endif /* !ACPI_REDUCED_HARDWARE */ 937 938 939/******************************************************************************* 940 * 941 * FUNCTION: AcpiDbDisplayHandlers 942 * 943 * PARAMETERS: None 944 * 945 * RETURN: None 946 * 947 * DESCRIPTION: Display the currently installed global handlers 948 * 949 ******************************************************************************/ 950 951void 952AcpiDbDisplayHandlers ( 953 void) 954{ 955 ACPI_OPERAND_OBJECT *ObjDesc; 956 ACPI_OPERAND_OBJECT *HandlerObj; 957 ACPI_ADR_SPACE_TYPE SpaceId; 958 UINT32 i; 959 960 961 /* Operation region handlers */ 962 963 AcpiOsPrintf ("\nOperation Region Handlers:\n"); 964 965 ObjDesc = AcpiNsGetAttachedObject (AcpiGbl_RootNode); 966 if (ObjDesc) 967 { 968 for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_SpaceIdList); i++) 969 { 970 SpaceId = AcpiGbl_SpaceIdList[i]; 971 HandlerObj = ObjDesc->Device.Handler; 972 973 AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, 974 AcpiUtGetRegionName ((UINT8) SpaceId), SpaceId); 975 976 while (HandlerObj) 977 { 978 if (AcpiGbl_SpaceIdList[i] == HandlerObj->AddressSpace.SpaceId) 979 { 980 AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, 981 (HandlerObj->AddressSpace.HandlerFlags & 982 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", 983 HandlerObj->AddressSpace.Handler); 984 goto FoundHandler; 985 } 986 987 HandlerObj = HandlerObj->AddressSpace.Next; 988 } 989 990 /* There is no handler for this SpaceId */ 991 992 AcpiOsPrintf ("None\n"); 993 994 FoundHandler:; 995 } 996 997 /* Find all handlers for user-defined SpaceIDs */ 998 999 HandlerObj = ObjDesc->Device.Handler; 1000 while (HandlerObj) 1001 { 1002 if (HandlerObj->AddressSpace.SpaceId >= ACPI_USER_REGION_BEGIN) 1003 { 1004 AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, 1005 "User-defined ID", HandlerObj->AddressSpace.SpaceId); 1006 AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, 1007 (HandlerObj->AddressSpace.HandlerFlags & 1008 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", 1009 HandlerObj->AddressSpace.Handler); 1010 } 1011 1012 HandlerObj = HandlerObj->AddressSpace.Next; 1013 } 1014 } 1015 1016#if (!ACPI_REDUCED_HARDWARE) 1017 1018 /* Fixed event handlers */ 1019 1020 AcpiOsPrintf ("\nFixed Event Handlers:\n"); 1021 1022 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) 1023 { 1024 AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, AcpiUtGetEventName (i), i); 1025 if (AcpiGbl_FixedEventHandlers[i].Handler) 1026 { 1027 AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User", 1028 AcpiGbl_FixedEventHandlers[i].Handler); 1029 } 1030 else 1031 { 1032 AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None"); 1033 } 1034 } 1035 1036#endif /* !ACPI_REDUCED_HARDWARE */ 1037 1038 /* Miscellaneous global handlers */ 1039 1040 AcpiOsPrintf ("\nMiscellaneous Global Handlers:\n"); 1041 1042 for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_HandlerList); i++) 1043 { 1044 AcpiOsPrintf (ACPI_HANDLER_NAME_STRING, AcpiGbl_HandlerList[i].Name); 1045 if (AcpiGbl_HandlerList[i].Handler) 1046 { 1047 AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User", 1048 AcpiGbl_HandlerList[i].Handler); 1049 } 1050 else 1051 { 1052 AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None"); 1053 } 1054 } 1055} 1056 1057#endif /* ACPI_DEBUGGER */ 1058