1/******************************************************************************* 2 * 3 * Module Name: dbdisply - debug display commands
|
4 * $Revision: 78 $
|
4 * $Revision: 79 $ |
5 * 6 ******************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp. 13 * All rights reserved. 14 * 15 * 2. License 16 * 17 * 2.1. This is your license from Intel Corp. under its intellectual property 18 * rights. You may have additional license terms from the party that provided 19 * you this software, covering your right to use that party's intellectual 20 * property rights. 21 * 22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 23 * copy of the source code appearing in this file ("Covered Code") an 24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 25 * base code distributed originally by Intel ("Original Intel Code") to copy, 26 * make derivatives, distribute, use and display any portion of the Covered 27 * Code in any form, with the right to sublicense such rights; and 28 * 29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 30 * license (with the right to sublicense), under only those claims of Intel 31 * patents that are infringed by the Original Intel Code, to make, use, sell, 32 * offer to sell, and import the Covered Code and derivative works thereof 33 * solely to the minimum extent necessary to exercise the above copyright 34 * license, and in no event shall the patent license extend to any additions 35 * to or modifications of the Original Intel Code. No other license or right 36 * is granted directly or by implication, estoppel or otherwise; 37 * 38 * The above copyright and patent license is granted only if the following 39 * conditions are met: 40 * 41 * 3. Conditions 42 * 43 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 44 * Redistribution of source code of any substantial portion of the Covered 45 * Code or modification with rights to further distribute source must include 46 * the above Copyright Notice, the above License, this list of Conditions, 47 * and the following Disclaimer and Export Compliance provision. In addition, 48 * Licensee must cause all Covered Code to which Licensee contributes to 49 * contain a file documenting the changes Licensee made to create that Covered 50 * Code and the date of any change. Licensee must include in that file the 51 * documentation of any changes made by any predecessor Licensee. Licensee 52 * must include a prominent statement that the modification is derived, 53 * directly or indirectly, from Original Intel Code. 54 * 55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 56 * Redistribution of source code of any substantial portion of the Covered 57 * Code or modification without rights to further distribute source must 58 * include the following Disclaimer and Export Compliance provision in the 59 * documentation and/or other materials provided with distribution. In 60 * addition, Licensee may not authorize further sublicense of source of any 61 * portion of the Covered Code, and must include terms to the effect that the 62 * license from Licensee to its licensee is limited to the intellectual 63 * property embodied in the software Licensee provides to its licensee, and 64 * not to intellectual property embodied in modifications its licensee may 65 * make. 66 * 67 * 3.3. Redistribution of Executable. Redistribution in executable form of any 68 * substantial portion of the Covered Code or modification must reproduce the 69 * above Copyright Notice, and the following Disclaimer and Export Compliance 70 * provision in the documentation and/or other materials provided with the 71 * distribution. 72 * 73 * 3.4. Intel retains all right, title, and interest in and to the Original 74 * Intel Code. 75 * 76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 77 * Intel shall be used in advertising or otherwise to promote the sale, use or 78 * other dealings in products derived from or relating to the Covered Code 79 * without prior written authorization from Intel. 80 * 81 * 4. Disclaimer and Export Compliance 82 * 83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 87 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 89 * PARTICULAR PURPOSE. 90 * 91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 98 * LIMITED REMEDY. 99 * 100 * 4.3. Licensee shall not export, either directly or indirectly, any of this 101 * software or system incorporating such software without first obtaining any 102 * required license or other approval from the U. S. Department of Commerce or 103 * any other agency or department of the United States Government. In the 104 * event Licensee exports any such software from the United States or 105 * re-exports any such software from a foreign destination, Licensee shall 106 * ensure that the distribution and export/re-export of the software is in 107 * compliance with all laws, regulations, orders, or other restrictions of the 108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 109 * any of its subsidiaries will export/re-export any technical data, process, 110 * software, or service, directly or indirectly, to any country for which the 111 * United States government or any agency thereof requires an export license, 112 * other governmental approval, or letter of assurance, without first obtaining 113 * such license, approval or letter. 114 * 115 *****************************************************************************/ 116 117 118#include "acpi.h" 119#include "amlcode.h" 120#include "acdispat.h" 121#include "acnamesp.h" 122#include "acparser.h" 123#include "acinterp.h" 124#include "acdebug.h" 125 126 127#ifdef ACPI_DEBUGGER 128 129 130#define _COMPONENT ACPI_CA_DEBUGGER 131 ACPI_MODULE_NAME ("dbdisply") 132 133 134/****************************************************************************** 135 * 136 * FUNCTION: AcpiDbGetPointer 137 * 138 * PARAMETERS: Target - Pointer to string to be converted 139 * 140 * RETURN: Converted pointer 141 * 142 * DESCRIPTION: Convert an ascii pointer value to a real value 143 * 144 *****************************************************************************/ 145 146void * 147AcpiDbGetPointer ( 148 void *Target) 149{ 150 void *ObjPtr; 151 152 153#if ACPI_MACHINE_WIDTH == 16 154#include <stdio.h> 155 156 /* Have to handle 16-bit pointers of the form segment:offset */ 157 158 if (!sscanf (Target, "%p", &ObjPtr)) 159 { 160 AcpiOsPrintf ("Invalid pointer: %s\n", Target); 161 return (NULL); 162 } 163 164#else 165 166 /* Simple flat pointer */ 167 168 ObjPtr = ACPI_TO_POINTER (ACPI_STRTOUL (Target, NULL, 16)); 169#endif 170 171 return (ObjPtr); 172} 173 174 175/******************************************************************************* 176 * 177 * FUNCTION: AcpiDbDumpParserDescriptor 178 * 179 * PARAMETERS: Op - A parser Op descriptor 180 * 181 * RETURN: None 182 * 183 * DESCRIPTION: Display a formatted parser object 184 * 185 ******************************************************************************/ 186 187void 188AcpiDbDumpParserDescriptor ( 189 ACPI_PARSE_OBJECT *Op) 190{ 191 const ACPI_OPCODE_INFO *Info; 192 193 194 Info = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); 195 196 AcpiOsPrintf ("Parser Op Descriptor:\n"); 197 AcpiOsPrintf ("%20.20s : %4.4X\n", "Opcode", Op->Common.AmlOpcode); 198 199 ACPI_DEBUG_ONLY_MEMBERS (AcpiOsPrintf ("%20.20s : %s\n", "Opcode Name", Info->Name)); 200 201 AcpiOsPrintf ("%20.20s : %p\n", "Value/ArgList", Op->Common.Value.Arg); 202 AcpiOsPrintf ("%20.20s : %p\n", "Parent", Op->Common.Parent); 203 AcpiOsPrintf ("%20.20s : %p\n", "NextOp", Op->Common.Next); 204} 205 206 207/******************************************************************************* 208 * 209 * FUNCTION: AcpiDbDecodeAndDisplayObject 210 * 211 * PARAMETERS: Target - String with object to be displayed. Names 212 * and hex pointers are supported. 213 * OutputType - Byte, Word, Dword, or Qword (B|W|D|Q) 214 * 215 * RETURN: None 216 * 217 * DESCRIPTION: Display a formatted ACPI object 218 * 219 ******************************************************************************/ 220 221void 222AcpiDbDecodeAndDisplayObject ( 223 NATIVE_CHAR *Target, 224 NATIVE_CHAR *OutputType) 225{ 226 void *ObjPtr; 227 ACPI_NAMESPACE_NODE *Node; 228 ACPI_OPERAND_OBJECT *ObjDesc; 229 UINT32 Display = DB_BYTE_DISPLAY; 230 NATIVE_CHAR Buffer[80]; 231 ACPI_BUFFER RetBuf; 232 ACPI_STATUS Status; 233 UINT32 Size; 234 235 236 if (!Target) 237 { 238 return; 239 } 240 241 /* Decode the output type */ 242 243 if (OutputType) 244 { 245 ACPI_STRUPR (OutputType); 246 if (OutputType[0] == 'W') 247 { 248 Display = DB_WORD_DISPLAY; 249 } 250 else if (OutputType[0] == 'D') 251 { 252 Display = DB_DWORD_DISPLAY; 253 } 254 else if (OutputType[0] == 'Q') 255 { 256 Display = DB_QWORD_DISPLAY; 257 } 258 } 259 260 RetBuf.Length = sizeof (Buffer); 261 RetBuf.Pointer = Buffer; 262 263 /* Differentiate between a number and a name */ 264 265 if ((Target[0] >= 0x30) && (Target[0] <= 0x39)) 266 { 267 ObjPtr = AcpiDbGetPointer (Target); 268 if (!AcpiOsReadable (ObjPtr, 16)) 269 { 270 AcpiOsPrintf ("Address %p is invalid in this address space\n", ObjPtr); 271 return; 272 } 273 274 /* Decode the object type */ 275 276 switch (ACPI_GET_DESCRIPTOR_TYPE (ObjPtr)) 277 { 278 case ACPI_DESC_TYPE_NAMED: 279 280 /* This is a namespace Node */ 281 282 if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_NAMESPACE_NODE))) 283 { 284 AcpiOsPrintf ("Cannot read entire Named object at address %p\n", ObjPtr); 285 return; 286 } 287 288 Node = ObjPtr; 289 goto DumpNte; 290 291 292 case ACPI_DESC_TYPE_OPERAND: 293 294 /* This is a ACPI OPERAND OBJECT */ 295 296 if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_OPERAND_OBJECT))) 297 { 298 AcpiOsPrintf ("Cannot read entire ACPI object at address %p\n", ObjPtr); 299 return; 300 } 301 302 AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX); 303 AcpiExDumpObjectDescriptor (ObjPtr, 1); 304 break; 305 306 307 case ACPI_DESC_TYPE_PARSER: 308 309 /* This is a Parser Op object */ 310 311 if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_PARSE_OBJECT))) 312 { 313 AcpiOsPrintf ("Cannot read entire Parser object at address %p\n", ObjPtr); 314 return; 315 } 316 317 AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), Display, ACPI_UINT32_MAX); 318 AcpiDbDumpParserDescriptor ((ACPI_PARSE_OBJECT *) ObjPtr); 319 break; 320 321 322 default: 323 324 /* Is not a recognizeable object */ 325 326 Size = 16; 327 if (AcpiOsReadable (ObjPtr, 64)) 328 { 329 Size = 64; 330 } 331 332 /* Just dump some memory */ 333 334 AcpiUtDumpBuffer (ObjPtr, Size, Display, ACPI_UINT32_MAX); 335 break; 336 } 337 338 return; 339 } 340 341 /* The parameter is a name string that must be resolved to a Named obj */ 342 343 Node = AcpiDbLocalNsLookup (Target); 344 if (!Node) 345 { 346 return; 347 } 348 349 350DumpNte: 351 /* Now dump the Named obj */ 352 353 Status = AcpiGetName (Node, ACPI_FULL_PATHNAME, &RetBuf); 354 if (ACPI_FAILURE (Status)) 355 { 356 AcpiOsPrintf ("Could not convert name to pathname\n"); 357 } 358 359 else 360 {
|
361 AcpiOsPrintf ("Object (%p) Pathname: %s\n", Node, RetBuf.Pointer);
|
361 AcpiOsPrintf ("Object (%p) Pathname: %s\n", Node, (char *) RetBuf.Pointer); |
362 } 363 364 if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE))) 365 { 366 AcpiOsPrintf ("Invalid Named object at address %p\n", Node); 367 return; 368 } 369 370 AcpiUtDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE), Display, ACPI_UINT32_MAX); 371 AcpiExDumpNode (Node, 1); 372 373 ObjDesc = AcpiNsGetAttachedObject (Node); 374 if (ObjDesc) 375 { 376 AcpiOsPrintf ("\nAttached Object (%p):\n", ObjDesc); 377 if (!AcpiOsReadable (ObjDesc, sizeof (ACPI_OPERAND_OBJECT))) 378 { 379 AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n", ObjDesc); 380 return; 381 } 382 383 AcpiUtDumpBuffer ((void *) ObjDesc, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX); 384 AcpiExDumpObjectDescriptor (ObjDesc, 1); 385 } 386} 387 388 389/******************************************************************************* 390 * 391 * FUNCTION: AcpiDbDecodeInternalObject 392 * 393 * PARAMETERS: ObjDesc - Object to be displayed 394 * 395 * RETURN: None 396 * 397 * DESCRIPTION: Short display of an internal object. Numbers and Strings. 398 * 399 ******************************************************************************/ 400 401void 402AcpiDbDecodeInternalObject ( 403 ACPI_OPERAND_OBJECT *ObjDesc) 404{ 405 UINT32 i; 406 407 408 if (!ObjDesc) 409 {
|
410 AcpiOsPrintf (" Uninitialized\n");
|
410 AcpiOsPrintf (" Uninitialized"); |
411 return; 412 } 413 414 if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) 415 { 416 AcpiOsPrintf ("%p", ObjDesc); 417 return; 418 } 419 420 AcpiOsPrintf (" %s", AcpiUtGetObjectTypeName (ObjDesc)); 421 422 switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) 423 { 424 case ACPI_TYPE_INTEGER: 425 426 AcpiOsPrintf (" %8.8X%8.8X", ACPI_HIDWORD (ObjDesc->Integer.Value), 427 ACPI_LODWORD (ObjDesc->Integer.Value)); 428 break; 429 430 431 case ACPI_TYPE_STRING: 432 433 AcpiOsPrintf ("(%d) \"%.24s", 434 ObjDesc->String.Length, ObjDesc->String.Pointer); 435 436 if (ObjDesc->String.Length > 24) 437 { 438 AcpiOsPrintf ("..."); 439 } 440 else 441 { 442 AcpiOsPrintf ("\""); 443 } 444 break; 445 446 447 case ACPI_TYPE_BUFFER: 448 449 AcpiOsPrintf ("(%d)", ObjDesc->Buffer.Length); 450 for (i = 0; (i < 8) && (i < ObjDesc->Buffer.Length); i++) 451 { 452 AcpiOsPrintf (" %2.2X", ObjDesc->Buffer.Pointer[i]); 453 } 454 break; 455 456 457 default: 458 459 AcpiOsPrintf ("%p", ObjDesc); 460 break; 461 } 462} 463 464 465/******************************************************************************* 466 * 467 * FUNCTION: AcpiDbDecodeNode 468 * 469 * PARAMETERS: Node - Object to be displayed 470 * 471 * RETURN: None 472 * 473 * DESCRIPTION: Short display of a namespace node 474 * 475 ******************************************************************************/ 476 477void 478AcpiDbDecodeNode ( 479 ACPI_NAMESPACE_NODE *Node) 480{ 481 482 483 AcpiOsPrintf ("<Node> Name %4.4s Type-%s", 484 Node->Name.Ascii, AcpiUtGetTypeName (Node->Type)); 485 486 if (Node->Flags & ANOBJ_METHOD_ARG) 487 { 488 AcpiOsPrintf (" [Method Arg]"); 489 } 490 if (Node->Flags & ANOBJ_METHOD_LOCAL) 491 { 492 AcpiOsPrintf (" [Method Local]"); 493 } 494 495 AcpiDbDecodeInternalObject (AcpiNsGetAttachedObject (Node)); 496} 497 498 499/******************************************************************************* 500 * 501 * FUNCTION: AcpiDbDisplayInternalObject 502 * 503 * PARAMETERS: ObjDesc - Object to be displayed 504 * WalkState - Current walk state 505 * 506 * RETURN: None 507 * 508 * DESCRIPTION: Short display of an internal object 509 * 510 ******************************************************************************/ 511 512void 513AcpiDbDisplayInternalObject ( 514 ACPI_OPERAND_OBJECT *ObjDesc, 515 ACPI_WALK_STATE *WalkState) 516{ 517 UINT8 Type; 518 519 520 AcpiOsPrintf ("%p ", ObjDesc); 521 522 if (!ObjDesc) 523 { 524 AcpiOsPrintf ("<NullObj>\n"); 525 return; 526 } 527 528 /* Decode the object type */ 529 530 switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)) 531 { 532 case ACPI_DESC_TYPE_PARSER: 533 534 AcpiOsPrintf ("<Parser> "); 535 break; 536 537 538 case ACPI_DESC_TYPE_NAMED: 539 540 AcpiDbDecodeNode ((ACPI_NAMESPACE_NODE *) ObjDesc); 541 break; 542 543 544 case ACPI_DESC_TYPE_OPERAND: 545 546 Type = ACPI_GET_OBJECT_TYPE (ObjDesc); 547 if (Type > INTERNAL_TYPE_MAX) 548 {
|
549 AcpiOsPrintf (" Type %hX [Invalid Type]", Type);
|
549 AcpiOsPrintf (" Type %X [Invalid Type]", (UINT32) Type); |
550 return; 551 } 552 553 /* Decode the ACPI object type */ 554 555 switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) 556 { 557 case INTERNAL_TYPE_REFERENCE: 558 559 switch (ObjDesc->Reference.Opcode) 560 { 561 case AML_LOCAL_OP: 562 563 AcpiOsPrintf ("[Local%d] ", ObjDesc->Reference.Offset); 564 if (WalkState) 565 { 566 ObjDesc = WalkState->LocalVariables[ObjDesc->Reference.Offset].Object; 567 AcpiOsPrintf ("%p", ObjDesc); 568 AcpiDbDecodeInternalObject (ObjDesc); 569 } 570 break; 571 572 573 case AML_ARG_OP: 574 575 AcpiOsPrintf ("[Arg%d] ", ObjDesc->Reference.Offset); 576 if (WalkState) 577 { 578 ObjDesc = WalkState->Arguments[ObjDesc->Reference.Offset].Object; 579 AcpiOsPrintf ("%p", ObjDesc); 580 AcpiDbDecodeInternalObject (ObjDesc); 581 } 582 break; 583 584 585 case AML_DEBUG_OP: 586 587 AcpiOsPrintf ("[Debug] "); 588 break; 589 590 591 case AML_INDEX_OP: 592 593 AcpiOsPrintf ("[Index] ");
|
594 AcpiDbDecodeInternalObject (ObjDesc->Reference.Object);
|
594 if (!ObjDesc->Reference.Where) 595 { 596 AcpiOsPrintf ("Uninitialized WHERE ptr"); 597 } 598 else 599 { 600 AcpiDbDecodeInternalObject (*(ObjDesc->Reference.Where)); 601 } |
602 break; 603 604 605 case AML_REF_OF_OP: 606
|
600 AcpiOsPrintf ("[Reference] ");
|
607 AcpiOsPrintf ("[RefOf] "); |
608 609 /* Reference can be to a Node or an Operand object */ 610 611 switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc->Reference.Object)) 612 { 613 case ACPI_DESC_TYPE_NAMED: 614 AcpiDbDecodeNode (ObjDesc->Reference.Object); 615 break; 616 617 case ACPI_DESC_TYPE_OPERAND: 618 AcpiDbDecodeInternalObject (ObjDesc->Reference.Object); 619 break; 620 621 default: 622 break; 623 } 624 break; 625 626 627 default: 628 629 AcpiOsPrintf ("Unknown Reference opcode %X\n", 630 ObjDesc->Reference.Opcode); 631 break; 632 } 633 break; 634 635 default: 636 637 AcpiOsPrintf ("<Obj> "); 638 AcpiOsPrintf (" "); 639 AcpiDbDecodeInternalObject (ObjDesc); 640 break; 641 } 642 break; 643 644 645 default: 646 647 AcpiOsPrintf ("<Not a valid ACPI Object Descriptor> "); 648 break; 649 } 650 651 AcpiOsPrintf ("\n"); 652} 653 654 655/******************************************************************************* 656 * 657 * FUNCTION: AcpiDbDisplayMethodInfo 658 * 659 * PARAMETERS: StartOp - Root of the control method parse tree 660 * 661 * RETURN: None 662 * 663 * DESCRIPTION: Display information about the current method 664 * 665 ******************************************************************************/ 666 667void 668AcpiDbDisplayMethodInfo ( 669 ACPI_PARSE_OBJECT *StartOp) 670{ 671 ACPI_WALK_STATE *WalkState; 672 ACPI_OPERAND_OBJECT *ObjDesc; 673 ACPI_NAMESPACE_NODE *Node; 674 ACPI_PARSE_OBJECT *RootOp; 675 ACPI_PARSE_OBJECT *Op; 676 const ACPI_OPCODE_INFO *OpInfo; 677 UINT32 NumOps = 0; 678 UINT32 NumOperands = 0; 679 UINT32 NumOperators = 0; 680 UINT32 NumRemainingOps = 0; 681 UINT32 NumRemainingOperands = 0; 682 UINT32 NumRemainingOperators = 0; 683 UINT32 NumArgs; 684 UINT32 Concurrency; 685 BOOLEAN CountRemaining = FALSE; 686 687 688 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 689 if (!WalkState) 690 { 691 AcpiOsPrintf ("There is no method currently executing\n"); 692 return; 693 } 694 695 ObjDesc = WalkState->MethodDesc; 696 Node = WalkState->MethodNode; 697 698 NumArgs = ObjDesc->Method.ParamCount; 699 Concurrency = ObjDesc->Method.Concurrency; 700 701 AcpiOsPrintf ("Currently executing control method is [%4.4s]\n", Node->Name.Ascii); 702 AcpiOsPrintf ("%X arguments, max concurrency = %X\n", NumArgs, Concurrency); 703 704 705 RootOp = StartOp; 706 while (RootOp->Common.Parent) 707 { 708 RootOp = RootOp->Common.Parent; 709 } 710 711 Op = RootOp; 712 713 while (Op) 714 { 715 if (Op == StartOp) 716 { 717 CountRemaining = TRUE; 718 } 719 720 NumOps++; 721 if (CountRemaining) 722 { 723 NumRemainingOps++; 724 } 725 726 /* Decode the opcode */ 727 728 OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); 729 switch (OpInfo->Class) 730 { 731 case AML_CLASS_ARGUMENT: 732 if (CountRemaining) 733 { 734 NumRemainingOperands++; 735 } 736 737 NumOperands++; 738 break; 739 740 case AML_CLASS_UNKNOWN: 741 /* Bad opcode or ASCII character */ 742 743 continue; 744 745 default: 746 if (CountRemaining) 747 { 748 NumRemainingOperators++; 749 } 750 751 NumOperators++; 752 break; 753 } 754 755 Op = AcpiPsGetDepthNext (StartOp, Op); 756 } 757 758 AcpiOsPrintf ("Method contains: %X AML Opcodes - %X Operators, %X Operands\n", 759 NumOps, NumOperators, NumOperands); 760 761 AcpiOsPrintf ("Remaining to execute: %X AML Opcodes - %X Operators, %X Operands\n", 762 NumRemainingOps, NumRemainingOperators, NumRemainingOperands); 763} 764 765 766/******************************************************************************* 767 * 768 * FUNCTION: AcpiDbDisplayLocals 769 * 770 * PARAMETERS: None 771 * 772 * RETURN: None 773 * 774 * DESCRIPTION: Display all locals for the currently running control method 775 * 776 ******************************************************************************/ 777 778void 779AcpiDbDisplayLocals (void) 780{ 781 UINT32 i; 782 ACPI_WALK_STATE *WalkState; 783 ACPI_OPERAND_OBJECT *ObjDesc; 784 ACPI_NAMESPACE_NODE *Node; 785 786 787 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 788 if (!WalkState) 789 { 790 AcpiOsPrintf ("There is no method currently executing\n"); 791 return; 792 } 793 794 ObjDesc = WalkState->MethodDesc; 795 Node = WalkState->MethodNode; 796 AcpiOsPrintf ("Local Variables for method [%4.4s]:\n", Node->Name.Ascii); 797 798 for (i = 0; i < MTH_NUM_LOCALS; i++) 799 { 800 ObjDesc = WalkState->LocalVariables[i].Object; 801 AcpiOsPrintf ("Local%d: ", i); 802 AcpiDbDisplayInternalObject (ObjDesc, WalkState); 803 } 804} 805 806 807/******************************************************************************* 808 * 809 * FUNCTION: AcpiDbDisplayArguments 810 * 811 * PARAMETERS: None 812 * 813 * RETURN: None 814 * 815 * DESCRIPTION: Display all arguments for the currently running control method 816 * 817 ******************************************************************************/ 818 819void 820AcpiDbDisplayArguments (void) 821{ 822 UINT32 i; 823 ACPI_WALK_STATE *WalkState; 824 ACPI_OPERAND_OBJECT *ObjDesc; 825 UINT32 NumArgs; 826 UINT32 Concurrency; 827 ACPI_NAMESPACE_NODE *Node; 828 829 830 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 831 if (!WalkState) 832 { 833 AcpiOsPrintf ("There is no method currently executing\n"); 834 return; 835 } 836 837 ObjDesc = WalkState->MethodDesc; 838 Node = WalkState->MethodNode; 839 840 NumArgs = ObjDesc->Method.ParamCount; 841 Concurrency = ObjDesc->Method.Concurrency; 842 843 AcpiOsPrintf ("Method [%4.4s] has %X arguments, max concurrency = %X\n", 844 Node->Name.Ascii, NumArgs, Concurrency); 845 846 for (i = 0; i < NumArgs; i++) 847 { 848 ObjDesc = WalkState->Arguments[i].Object; 849 AcpiOsPrintf ("Arg%d: ", i); 850 AcpiDbDisplayInternalObject (ObjDesc, WalkState); 851 } 852} 853 854 855/******************************************************************************* 856 * 857 * FUNCTION: AcpiDbDisplayResults 858 * 859 * PARAMETERS: None 860 * 861 * RETURN: None 862 * 863 * DESCRIPTION: Display current contents of a method result stack 864 * 865 ******************************************************************************/ 866 867void 868AcpiDbDisplayResults (void) 869{ 870 UINT32 i; 871 ACPI_WALK_STATE *WalkState; 872 ACPI_OPERAND_OBJECT *ObjDesc; 873 UINT32 NumResults = 0; 874 ACPI_NAMESPACE_NODE *Node; 875 876 877 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 878 if (!WalkState) 879 { 880 AcpiOsPrintf ("There is no method currently executing\n"); 881 return; 882 } 883 884 ObjDesc = WalkState->MethodDesc; 885 Node = WalkState->MethodNode; 886 887 if (WalkState->Results) 888 { 889 NumResults = WalkState->Results->Results.NumResults; 890 } 891 892 AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n", 893 Node->Name.Ascii, NumResults); 894 895 for (i = 0; i < NumResults; i++) 896 { 897 ObjDesc = WalkState->Results->Results.ObjDesc[i]; 898 AcpiOsPrintf ("Result%d: ", i); 899 AcpiDbDisplayInternalObject (ObjDesc, WalkState); 900 } 901} 902 903 904/******************************************************************************* 905 * 906 * FUNCTION: AcpiDbDisplayCallingTree 907 * 908 * PARAMETERS: None 909 * 910 * RETURN: None 911 * 912 * DESCRIPTION: Display current calling tree of nested control methods 913 * 914 ******************************************************************************/ 915 916void 917AcpiDbDisplayCallingTree (void) 918{ 919 ACPI_WALK_STATE *WalkState; 920 ACPI_NAMESPACE_NODE *Node; 921 922 923 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 924 if (!WalkState) 925 { 926 AcpiOsPrintf ("There is no method currently executing\n"); 927 return; 928 } 929 930 Node = WalkState->MethodNode; 931 AcpiOsPrintf ("Current Control Method Call Tree\n"); 932 933 while (WalkState) 934 { 935 Node = WalkState->MethodNode; 936 937 AcpiOsPrintf (" [%4.4s]\n", Node->Name.Ascii); 938 939 WalkState = WalkState->Next; 940 } 941} 942 943 944/******************************************************************************* 945 * 946 * FUNCTION: AcpiDbDisplayResultObject 947 * 948 * PARAMETERS: ObjDesc - Object to be displayed 949 * WalkState - Current walk state 950 * 951 * RETURN: None 952 * 953 * DESCRIPTION: Display the result of an AML opcode 954 * 955 * Note: Curently only displays the result object if we are single stepping. 956 * However, this output may be useful in other contexts and could be enabled 957 * to do so if needed. 958 * 959 ******************************************************************************/ 960 961void 962AcpiDbDisplayResultObject ( 963 ACPI_OPERAND_OBJECT *ObjDesc, 964 ACPI_WALK_STATE *WalkState) 965{ 966 967 /* Only display if single stepping */ 968 969 if (!AcpiGbl_CmSingleStep) 970 { 971 return; 972 } 973 974 AcpiOsPrintf ("ResultObj: "); 975 AcpiDbDisplayInternalObject (ObjDesc, WalkState); 976 AcpiOsPrintf ("\n"); 977} 978 979 980/******************************************************************************* 981 * 982 * FUNCTION: AcpiDbDisplayArgumentObject 983 * 984 * PARAMETERS: ObjDesc - Object to be displayed 985 * WalkState - Current walk state 986 * 987 * RETURN: None 988 * 989 * DESCRIPTION: Display the result of an AML opcode 990 * 991 ******************************************************************************/ 992 993void 994AcpiDbDisplayArgumentObject ( 995 ACPI_OPERAND_OBJECT *ObjDesc, 996 ACPI_WALK_STATE *WalkState) 997{ 998 999 if (!AcpiGbl_CmSingleStep) 1000 { 1001 return; 1002 } 1003 1004 AcpiOsPrintf ("ArgObj: "); 1005 AcpiDbDisplayInternalObject (ObjDesc, WalkState); 1006} 1007 1008#endif /* ACPI_DEBUGGER */ 1009
|