dbdisply.c revision 80062
191094Sdes/******************************************************************************* 2115619Sdes * 3228690Sdes * Module Name: dbdisply - debug display commands 491094Sdes * $Revision: 46 $ 591094Sdes * 691094Sdes ******************************************************************************/ 799158Sdes 899158Sdes/****************************************************************************** 999158Sdes * 1091094Sdes * 1. Copyright Notice 1191094Sdes * 1291094Sdes * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. 1391094Sdes * All rights reserved. 1491094Sdes * 1591094Sdes * 2. License 1691094Sdes * 1791094Sdes * 2.1. This is your license from Intel Corp. under its intellectual property 1891094Sdes * rights. You may have additional license terms from the party that provided 1991094Sdes * you this software, covering your right to use that party's intellectual 2091094Sdes * property rights. 2191094Sdes * 2291094Sdes * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 2391094Sdes * copy of the source code appearing in this file ("Covered Code") an 2491094Sdes * irrevocable, perpetual, worldwide license under Intel's copyrights in the 2591094Sdes * base code distributed originally by Intel ("Original Intel Code") to copy, 2691094Sdes * make derivatives, distribute, use and display any portion of the Covered 2791094Sdes * Code in any form, with the right to sublicense such rights; and 2891094Sdes * 2991094Sdes * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 3091094Sdes * license (with the right to sublicense), under only those claims of Intel 3191094Sdes * patents that are infringed by the Original Intel Code, to make, use, sell, 3291094Sdes * offer to sell, and import the Covered Code and derivative works thereof 3391094Sdes * solely to the minimum extent necessary to exercise the above copyright 3491094Sdes * license, and in no event shall the patent license extend to any additions 35271947Sdes * to or modifications of the Original Intel Code. No other license or right 3691094Sdes * is granted directly or by implication, estoppel or otherwise; 3791094Sdes * 38228690Sdes * The above copyright and patent license is granted only if the following 39228690Sdes * conditions are met: 40228690Sdes * 41228690Sdes * 3. Conditions 4291094Sdes * 4391094Sdes * 3.1. Redistribution of Source with Rights to Further Distribute Source. 4491094Sdes * Redistribution of source code of any substantial portion of the Covered 4591094Sdes * Code or modification with rights to further distribute source must include 4691094Sdes * the above Copyright Notice, the above License, this list of Conditions, 4791094Sdes * and the following Disclaimer and Export Compliance provision. In addition, 4891094Sdes * Licensee must cause all Covered Code to which Licensee contributes to 49228690Sdes * contain a file documenting the changes Licensee made to create that Covered 5091094Sdes * Code and the date of any change. Licensee must include in that file the 51228690Sdes * documentation of any changes made by any predecessor Licensee. Licensee 5291094Sdes * must include a prominent statement that the modification is derived, 5391094Sdes * directly or indirectly, from Original Intel Code. 5491094Sdes * 5591100Sdes * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 5691100Sdes * Redistribution of source code of any substantial portion of the Covered 5791094Sdes * Code or modification without rights to further distribute source must 5891094Sdes * include the following Disclaimer and Export Compliance provision in the 5991094Sdes * documentation and/or other materials provided with distribution. In 6091094Sdes * addition, Licensee may not authorize further sublicense of source of any 6191094Sdes * portion of the Covered Code, and must include terms to the effect that the 6291094Sdes * license from Licensee to its licensee is limited to the intellectual 6391094Sdes * property embodied in the software Licensee provides to its licensee, and 6491094Sdes * not to intellectual property embodied in modifications its licensee may 6591094Sdes * make. 66271947Sdes * 67114536Sdes * 3.3. Redistribution of Executable. Redistribution in executable form of any 6891094Sdes * substantial portion of the Covered Code or modification must reproduce the 69107937Sdes * above Copyright Notice, and the following Disclaimer and Export Compliance 7091094Sdes * provision in the documentation and/or other materials provided with the 71107937Sdes * distribution. 7291094Sdes * 7391094Sdes * 3.4. Intel retains all right, title, and interest in and to the Original 7491094Sdes * Intel Code. 75107937Sdes * 76107937Sdes * 3.5. Neither the name Intel nor any other trademark owned or controlled by 77228690Sdes * Intel shall be used in advertising or otherwise to promote the sale, use or 78107937Sdes * other dealings in products derived from or relating to the Covered Code 79228690Sdes * without prior written authorization from Intel. 80107937Sdes * 8191094Sdes * 4. Disclaimer and Export Compliance 8291094Sdes * 8391094Sdes * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 8491094Sdes * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 8591094Sdes * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 8691094Sdes * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 8791094Sdes * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 8891094Sdes * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 8991094Sdes * PARTICULAR PURPOSE. 9091094Sdes * 9191094Sdes * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 9291094Sdes * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 9391094Sdes * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 9491094Sdes * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 9591094Sdes * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 9691094Sdes * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 9791094Sdes * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 9891094Sdes * LIMITED REMEDY. 9991094Sdes * 100107937Sdes * 4.3. Licensee shall not export, either directly or indirectly, any of this 10191094Sdes * software or system incorporating such software without first obtaining any 10291094Sdes * required license or other approval from the U. S. Department of Commerce or 10391094Sdes * any other agency or department of the United States Government. In the 104271947Sdes * event Licensee exports any such software from the United States or 105271947Sdes * re-exports any such software from a foreign destination, Licensee shall 106271947Sdes * ensure that the distribution and export/re-export of the software is in 10791094Sdes * compliance with all laws, regulations, orders, or other restrictions of the 10891094Sdes * U.S. Export Administration Regulations. Licensee agrees that neither it nor 109228690Sdes * any of its subsidiaries will export/re-export any technical data, process, 110228690Sdes * software, or service, directly or indirectly, to any country for which the 11191094Sdes * United States government or any agency thereof requires an export license, 112107937Sdes * other governmental approval, or letter of assurance, without first obtaining 11391094Sdes * such license, approval or letter. 114114536Sdes * 115114536Sdes *****************************************************************************/ 116228690Sdes 117255376Sdes 118228690Sdes#include "acpi.h" 11991094Sdes#include "acparser.h" 120294192Sdes#include "amlcode.h" 12191094Sdes#include "acdispat.h" 122255376Sdes#include "acnamesp.h" 123228690Sdes#include "acparser.h" 12491094Sdes#include "acevents.h" 125114536Sdes#include "acinterp.h" 126228690Sdes#include "acdebug.h" 12791094Sdes 12891094Sdes 12991094Sdes#ifdef ENABLE_DEBUGGER 13091094Sdes 131271947Sdes 132271947Sdes#define _COMPONENT ACPI_DEBUGGER 13391094Sdes MODULE_NAME ("dbdisply") 13491684Sdes 13591684Sdes 13691094Sdes/****************************************************************************** 13791094Sdes * 13899158Sdes * FUNCTION: AcpiDbGetPointer 13999158Sdes * 14091684Sdes * PARAMETERS: Target - Pointer to string to be converted 14199158Sdes * 14299158Sdes * RETURN: Converted pointer 14391094Sdes * 14491097Sdes * DESCRIPTION: Convert an ascii pointer value to a real value 14591094Sdes * 14691094Sdes *****************************************************************************/ 147228690Sdes 14891094Sdesvoid * 14991094SdesAcpiDbGetPointer ( 15091094Sdes void *Target) 15191094Sdes{ 15291094Sdes void *ObjPtr; 15391094Sdes 154271947Sdes 15591094Sdes#ifdef _IA16 15699158Sdes#include <stdio.h> 15799158Sdes 158255376Sdes /* Have to handle 16-bit pointers of the form segment:offset */ 15991094Sdes 16091094Sdes if (!sscanf (Target, "%p", &ObjPtr)) 16191094Sdes { 16291094Sdes AcpiOsPrintf ("Invalid pointer: %s\n", Target); 16391094Sdes return (NULL); 16491094Sdes } 16591094Sdes 16691094Sdes#else 16791094Sdes 168255376Sdes /* Simple flat pointer */ 16991094Sdes 17091094Sdes ObjPtr = (void *) STRTOUL (Target, NULL, 16); 17191094Sdes 17291094Sdes#endif 17391094Sdes 17499158Sdes return (ObjPtr); 17591097Sdes} 176271947Sdes 177271947Sdes 178271947Sdes/******************************************************************************* 179271947Sdes * 180271947Sdes * FUNCTION: AcpiDbDumpParserDescriptor 181271947Sdes * 182271947Sdes * PARAMETERS: Op - A parser Op descriptor 183271947Sdes * 184271947Sdes * RETURN: None 185271947Sdes * 186271947Sdes * DESCRIPTION: Display a formatted parser object 187271947Sdes * 188107937Sdes ******************************************************************************/ 18991094Sdes 19091094Sdesvoid 19191094SdesAcpiDbDumpParserDescriptor ( 19291094Sdes ACPI_PARSE_OBJECT *Op) 193228690Sdes{ 19491094Sdes ACPI_OPCODE_INFO *Info; 19591094Sdes 19691097Sdes 197255376Sdes Info = AcpiPsGetOpcodeInfo (Op->Opcode); 19891097Sdes 19991094Sdes AcpiOsPrintf ("Parser Op Descriptor:\n"); 20091094Sdes AcpiOsPrintf ("%20.20s : %4.4X\n", "Opcode", Op->Opcode); 20191097Sdes 20291097Sdes DEBUG_ONLY_MEMBERS (AcpiOsPrintf ("%20.20s : %s\n", "Opcode Name", Info->Name)); 20391094Sdes 20491094Sdes AcpiOsPrintf ("%20.20s : %p\n", "Value/ArgList", Op->Value); 20591094Sdes AcpiOsPrintf ("%20.20s : %p\n", "Parent", Op->Parent); 20691094Sdes AcpiOsPrintf ("%20.20s : %p\n", "NextOp", Op->Next); 20791094Sdes} 20891094Sdes 20991094Sdes 21091094Sdes/******************************************************************************* 21191094Sdes * 21291094Sdes * FUNCTION: AcpiDbDecodeAndDisplayObject 21391094Sdes * 21491094Sdes * PARAMETERS: Target - String with object to be displayed. Names 21591094Sdes * and hex pointers are supported. 21691094Sdes * OutputType - Byte, Word, Dword, or Qword (B|W|D|Q) 21791094Sdes * 21891094Sdes * RETURN: None 21991094Sdes * 22091094Sdes * DESCRIPTION: Display a formatted ACPI object 22191094Sdes * 22291094Sdes ******************************************************************************/ 22391094Sdes 22491094Sdesvoid 22591094SdesAcpiDbDecodeAndDisplayObject ( 22691094Sdes NATIVE_CHAR *Target, 22791094Sdes NATIVE_CHAR *OutputType) 22891094Sdes{ 22991094Sdes void *ObjPtr; 23091094Sdes ACPI_NAMESPACE_NODE *Node; 23191094Sdes UINT32 Display = DB_BYTE_DISPLAY; 23291094Sdes NATIVE_CHAR Buffer[80]; 23391094Sdes ACPI_BUFFER RetBuf; 23491094Sdes ACPI_STATUS Status; 23591094Sdes UINT32 Size; 23691094Sdes 23791094Sdes 23891094Sdes if (!Target) 23991684Sdes { 24091684Sdes return; 24191094Sdes } 24291094Sdes 24391094Sdes /* Decode the output type */ 24491094Sdes 24591094Sdes if (OutputType) 246228690Sdes { 24791094Sdes STRUPR (OutputType); 24891094Sdes if (OutputType[0] == 'W') 24991100Sdes { 25091100Sdes Display = DB_WORD_DISPLAY; 25191100Sdes } 25291100Sdes else if (OutputType[0] == 'D') 25391100Sdes { 25491100Sdes Display = DB_DWORD_DISPLAY; 255 } 256 else if (OutputType[0] == 'Q') 257 { 258 Display = DB_QWORD_DISPLAY; 259 } 260 } 261 262 263 RetBuf.Length = sizeof (Buffer); 264 RetBuf.Pointer = Buffer; 265 266 /* Differentiate between a number and a name */ 267 268 if ((Target[0] >= 0x30) && (Target[0] <= 0x39)) 269 { 270 ObjPtr = AcpiDbGetPointer (Target); 271 if (!AcpiOsReadable (ObjPtr, 16)) 272 { 273 AcpiOsPrintf ("Address %p is invalid in this address space\n", ObjPtr); 274 return; 275 } 276 277 /* Decode the object type */ 278 279 if (VALID_DESCRIPTOR_TYPE ((ObjPtr), ACPI_DESC_TYPE_NAMED)) 280 { 281 /* This is a Node */ 282 283 if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_NAMESPACE_NODE))) 284 { 285 AcpiOsPrintf ("Cannot read entire Named object at address %p\n", ObjPtr); 286 return; 287 } 288 289 Node = ObjPtr; 290 goto DumpNte; 291 } 292 293 else if (VALID_DESCRIPTOR_TYPE ((ObjPtr), ACPI_DESC_TYPE_INTERNAL)) 294 { 295 /* This is an ACPI OBJECT */ 296 297 if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_OPERAND_OBJECT))) 298 { 299 AcpiOsPrintf ("Cannot read entire ACPI object at address %p\n", ObjPtr); 300 return; 301 } 302 303 AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX); 304 AcpiExDumpObjectDescriptor (ObjPtr, 1); 305 } 306 307 else if (VALID_DESCRIPTOR_TYPE ((ObjPtr), ACPI_DESC_TYPE_PARSER)) 308 { 309 /* This is an 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 318 AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), Display, ACPI_UINT32_MAX); 319 AcpiDbDumpParserDescriptor ((ACPI_PARSE_OBJECT *) ObjPtr); 320 } 321 322 else 323 { 324 Size = 16; 325 if (AcpiOsReadable (ObjPtr, 64)) 326 { 327 Size = 64; 328 } 329 330 /* Just dump some memory */ 331 332 AcpiUtDumpBuffer (ObjPtr, Size, Display, ACPI_UINT32_MAX); 333 } 334 335 return; 336 } 337 338 339 /* The parameter is a name string that must be resolved to a Named obj */ 340 341 Node = AcpiDbLocalNsLookup (Target); 342 if (!Node) 343 { 344 return; 345 } 346 347 348DumpNte: 349 /* Now dump the Named obj */ 350 351 Status = AcpiGetName (Node, ACPI_FULL_PATHNAME, &RetBuf); 352 if (ACPI_FAILURE (Status)) 353 { 354 AcpiOsPrintf ("Could not convert name to pathname\n"); 355 } 356 357 else 358 { 359 AcpiOsPrintf ("Object Pathname: %s\n", RetBuf.Pointer); 360 } 361 362 if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE))) 363 { 364 AcpiOsPrintf ("Invalid Named object at address %p\n", Node); 365 return; 366 } 367 368 AcpiUtDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE), Display, ACPI_UINT32_MAX); 369 AcpiExDumpNode (Node, 1); 370 371 if (Node->Object) 372 { 373 AcpiOsPrintf ("\nAttached Object (%p):\n", Node->Object); 374 if (!AcpiOsReadable (Node->Object, sizeof (ACPI_OPERAND_OBJECT))) 375 { 376 AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n", Node->Object); 377 return; 378 } 379 380 AcpiUtDumpBuffer (Node->Object, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX); 381 AcpiExDumpObjectDescriptor (Node->Object, 1); 382 } 383} 384 385 386/******************************************************************************* 387 * 388 * FUNCTION: AcpiDbDecodeInternalObject 389 * 390 * PARAMETERS: ObjDesc - Object to be displayed 391 * 392 * RETURN: None 393 * 394 * DESCRIPTION: Short display of an internal object. Numbers and Strings. 395 * 396 ******************************************************************************/ 397 398void 399AcpiDbDecodeInternalObject ( 400 ACPI_OPERAND_OBJECT *ObjDesc) 401{ 402 UINT32 i; 403 404 405 if (!ObjDesc) 406 { 407 return; 408 } 409 410 AcpiOsPrintf (" %s", AcpiUtGetTypeName (ObjDesc->Common.Type)); 411 412 switch (ObjDesc->Common.Type) 413 { 414 case ACPI_TYPE_INTEGER: 415 AcpiOsPrintf (" %.8X", ObjDesc->Integer.Value); 416 break; 417 418 case ACPI_TYPE_STRING: 419 AcpiOsPrintf ("(%d) \"%.24s", 420 ObjDesc->String.Length, ObjDesc->String.Pointer); 421 422 if (ObjDesc->String.Length > 24) 423 { 424 AcpiOsPrintf ("..."); 425 } 426 else 427 { 428 AcpiOsPrintf ("\""); 429 } 430 break; 431 432 case ACPI_TYPE_BUFFER: 433 AcpiOsPrintf ("(%d)", ObjDesc->Buffer.Length); 434 for (i = 0; (i < 8) && (i < ObjDesc->Buffer.Length); i++) 435 { 436 AcpiOsPrintf (" %2.2X", ObjDesc->Buffer.Pointer[i]); 437 } 438 break; 439 } 440} 441 442 443/******************************************************************************* 444 * 445 * FUNCTION: AcpiDbDisplayInternalObject 446 * 447 * PARAMETERS: ObjDesc - Object to be displayed 448 * WalkState - Current walk state 449 * 450 * RETURN: None 451 * 452 * DESCRIPTION: Short display of an internal object 453 * 454 ******************************************************************************/ 455 456void 457AcpiDbDisplayInternalObject ( 458 ACPI_OPERAND_OBJECT *ObjDesc, 459 ACPI_WALK_STATE *WalkState) 460{ 461 UINT8 Type; 462 463 464 AcpiOsPrintf ("%p ", ObjDesc); 465 466 if (!ObjDesc) 467 { 468 AcpiOsPrintf ("<NullObj>\n"); 469 return; 470 } 471 472 473 /* Decode the object type */ 474 475 else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_PARSER)) 476 { 477 AcpiOsPrintf ("<Parser> "); 478 } 479 480 else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED)) 481 { 482 AcpiOsPrintf ("<Node> Name %4.4s Type-%s", 483 &((ACPI_NAMESPACE_NODE *)ObjDesc)->Name, 484 AcpiUtGetTypeName (((ACPI_NAMESPACE_NODE *) ObjDesc)->Type)); 485 if (((ACPI_NAMESPACE_NODE *) ObjDesc)->Flags & ANOBJ_METHOD_ARG) 486 { 487 AcpiOsPrintf (" [Method Arg]"); 488 } 489 if (((ACPI_NAMESPACE_NODE *) ObjDesc)->Flags & ANOBJ_METHOD_LOCAL) 490 { 491 AcpiOsPrintf (" [Method Local]"); 492 } 493 } 494 495 else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_INTERNAL)) 496 { 497 AcpiOsPrintf ("<Obj> "); 498 Type = ObjDesc->Common.Type; 499 if (Type > INTERNAL_TYPE_MAX) 500 { 501 AcpiOsPrintf (" Type %x [Invalid Type]", Type); 502 return; 503 } 504 505 /* Decode the ACPI object type */ 506 507 switch (ObjDesc->Common.Type) 508 { 509 case INTERNAL_TYPE_REFERENCE: 510 switch (ObjDesc->Reference.Opcode) 511 { 512 case AML_ZERO_OP: 513 AcpiOsPrintf ("[Const] Number %.8X", 0); 514 break; 515 516 case AML_ONES_OP: 517 AcpiOsPrintf ("[Const] Number %.8X", ACPI_UINT32_MAX); 518 break; 519 520 case AML_ONE_OP: 521 AcpiOsPrintf ("[Const] Number %.8X", 1); 522 break; 523 524 case AML_LOCAL_OP: 525 AcpiOsPrintf ("[Local%d] ", ObjDesc->Reference.Offset); 526 if (WalkState) 527 { 528 ObjDesc = WalkState->LocalVariables[ObjDesc->Reference.Offset].Object; 529 AcpiDbDecodeInternalObject (ObjDesc); 530 } 531 break; 532 533 case AML_ARG_OP: 534 AcpiOsPrintf ("[Arg%d] ", ObjDesc->Reference.Offset); 535 if (WalkState) 536 { 537 ObjDesc = WalkState->Arguments[ObjDesc->Reference.Offset].Object; 538 AcpiDbDecodeInternalObject (ObjDesc); 539 } 540 break; 541 542 case AML_DEBUG_OP: 543 AcpiOsPrintf ("[Debug] "); 544 break; 545 546 case AML_INDEX_OP: 547 AcpiOsPrintf ("[Index] "); 548 AcpiDbDecodeInternalObject (ObjDesc->Reference.Object); 549 break; 550 551 default: 552 break; 553 554 } 555 break; 556 557 default: 558 AcpiOsPrintf (" "); 559 AcpiDbDecodeInternalObject (ObjDesc); 560 break; 561 } 562 } 563 564 else 565 { 566 AcpiOsPrintf ("<Not a valid ACPI Object Descriptor> "); 567 } 568 569 AcpiOsPrintf ("\n"); 570} 571 572 573/******************************************************************************* 574 * 575 * FUNCTION: AcpiDbDisplayMethodInfo 576 * 577 * PARAMETERS: StartOp - Root of the control method parse tree 578 * 579 * RETURN: None 580 * 581 * DESCRIPTION: Display information about the current method 582 * 583 ******************************************************************************/ 584 585void 586AcpiDbDisplayMethodInfo ( 587 ACPI_PARSE_OBJECT *StartOp) 588{ 589 ACPI_WALK_STATE *WalkState; 590 ACPI_OPERAND_OBJECT *ObjDesc; 591 ACPI_NAMESPACE_NODE *Node; 592 ACPI_PARSE_OBJECT *RootOp; 593 ACPI_PARSE_OBJECT *Op; 594 ACPI_OPCODE_INFO *OpInfo; 595 UINT32 NumOps = 0; 596 UINT32 NumOperands = 0; 597 UINT32 NumOperators = 0; 598 UINT32 NumRemainingOps = 0; 599 UINT32 NumRemainingOperands = 0; 600 UINT32 NumRemainingOperators = 0; 601 UINT32 NumArgs; 602 UINT32 Concurrency; 603 BOOLEAN CountRemaining = FALSE; 604 605 606 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 607 if (!WalkState) 608 { 609 AcpiOsPrintf ("There is no method currently executing\n"); 610 return; 611 } 612 613 ObjDesc = WalkState->MethodDesc; 614 Node = WalkState->MethodNode; 615 616 NumArgs = ObjDesc->Method.ParamCount; 617 Concurrency = ObjDesc->Method.Concurrency; 618 619 AcpiOsPrintf ("Currently executing control method is [%4.4s]\n", &Node->Name); 620 AcpiOsPrintf ("%X arguments, max concurrency = %X\n", NumArgs, Concurrency); 621 622 623 RootOp = StartOp; 624 while (RootOp->Parent) 625 { 626 RootOp = RootOp->Parent; 627 } 628 629 Op = RootOp; 630 631 while (Op) 632 { 633 if (Op == StartOp) 634 { 635 CountRemaining = TRUE; 636 } 637 638 NumOps++; 639 if (CountRemaining) 640 { 641 NumRemainingOps++; 642 } 643 644 OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode); 645 if (ACPI_GET_OP_TYPE (OpInfo) != ACPI_OP_TYPE_OPCODE) 646 { 647 /* Bad opcode or ASCII character */ 648 649 continue; 650 } 651 652 653 /* Decode the opcode */ 654 655 switch (ACPI_GET_OP_CLASS (OpInfo)) 656 { 657 case OPTYPE_CONSTANT: /* argument type only */ 658 case OPTYPE_LITERAL: /* argument type only */ 659 case OPTYPE_DATA_TERM: /* argument type only */ 660 case OPTYPE_LOCAL_VARIABLE: /* argument type only */ 661 case OPTYPE_METHOD_ARGUMENT: /* argument type only */ 662 if (CountRemaining) 663 { 664 NumRemainingOperands++; 665 } 666 667 NumOperands++; 668 break; 669 670 default: 671 if (CountRemaining) 672 { 673 NumRemainingOperators++; 674 } 675 676 NumOperators++; 677 break; 678 } 679 680 681 Op = AcpiPsGetDepthNext (StartOp, Op); 682 } 683 684 AcpiOsPrintf ("Method contains: %X AML Opcodes - %X Operators, %X Operands\n", 685 NumOps, NumOperators, NumOperands); 686 687 AcpiOsPrintf ("Remaining to execute: %X AML Opcodes - %X Operators, %X Operands\n", 688 NumRemainingOps, NumRemainingOperators, NumRemainingOperands); 689} 690 691 692/******************************************************************************* 693 * 694 * FUNCTION: AcpiDbDisplayLocals 695 * 696 * PARAMETERS: None 697 * 698 * RETURN: None 699 * 700 * DESCRIPTION: Display all locals for the currently running control method 701 * 702 ******************************************************************************/ 703 704void 705AcpiDbDisplayLocals (void) 706{ 707 UINT32 i; 708 ACPI_WALK_STATE *WalkState; 709 ACPI_OPERAND_OBJECT *ObjDesc; 710 ACPI_NAMESPACE_NODE *Node; 711 712 713 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 714 if (!WalkState) 715 { 716 AcpiOsPrintf ("There is no method currently executing\n"); 717 return; 718 } 719 720 ObjDesc = WalkState->MethodDesc; 721 Node = WalkState->MethodNode; 722 723 724 AcpiOsPrintf ("Local Variables for method [%4.4s]:\n", &Node->Name); 725 726 for (i = 0; i < MTH_NUM_LOCALS; i++) 727 { 728 ObjDesc = WalkState->LocalVariables[i].Object; 729 AcpiOsPrintf ("Local%d: ", i); 730 AcpiDbDisplayInternalObject (ObjDesc, WalkState); 731 } 732} 733 734 735/******************************************************************************* 736 * 737 * FUNCTION: AcpiDbDisplayArguments 738 * 739 * PARAMETERS: None 740 * 741 * RETURN: None 742 * 743 * DESCRIPTION: Display all arguments for the currently running control method 744 * 745 ******************************************************************************/ 746 747void 748AcpiDbDisplayArguments (void) 749{ 750 UINT32 i; 751 ACPI_WALK_STATE *WalkState; 752 ACPI_OPERAND_OBJECT *ObjDesc; 753 UINT32 NumArgs; 754 UINT32 Concurrency; 755 ACPI_NAMESPACE_NODE *Node; 756 757 758 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 759 if (!WalkState) 760 { 761 AcpiOsPrintf ("There is no method currently executing\n"); 762 return; 763 } 764 765 ObjDesc = WalkState->MethodDesc; 766 Node = WalkState->MethodNode; 767 768 NumArgs = ObjDesc->Method.ParamCount; 769 Concurrency = ObjDesc->Method.Concurrency; 770 771 AcpiOsPrintf ("Method [%4.4s] has %X arguments, max concurrency = %X\n", &Node->Name, NumArgs, Concurrency); 772 773 for (i = 0; i < NumArgs; i++) 774 { 775 ObjDesc = WalkState->Arguments[i].Object; 776 AcpiOsPrintf ("Arg%d: ", i); 777 AcpiDbDisplayInternalObject (ObjDesc, WalkState); 778 } 779} 780 781 782/******************************************************************************* 783 * 784 * FUNCTION: AcpiDbDisplayResults 785 * 786 * PARAMETERS: None 787 * 788 * RETURN: None 789 * 790 * DESCRIPTION: Display current contents of a method result stack 791 * 792 ******************************************************************************/ 793 794void 795AcpiDbDisplayResults (void) 796{ 797 UINT32 i; 798 ACPI_WALK_STATE *WalkState; 799 ACPI_OPERAND_OBJECT *ObjDesc; 800 UINT32 NumResults = 0; 801 ACPI_NAMESPACE_NODE *Node; 802 803 804 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 805 if (!WalkState) 806 { 807 AcpiOsPrintf ("There is no method currently executing\n"); 808 return; 809 } 810 811 ObjDesc = WalkState->MethodDesc; 812 Node = WalkState->MethodNode; 813 814 if (WalkState->Results) 815 { 816 NumResults = WalkState->Results->Results.NumResults; 817 } 818 819 AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n", &Node->Name, NumResults); 820 821 for (i = 0; i < NumResults; i++) 822 { 823 ObjDesc = WalkState->Results->Results.ObjDesc[i]; 824 AcpiOsPrintf ("Result%d: ", i); 825 AcpiDbDisplayInternalObject (ObjDesc, WalkState); 826 } 827} 828 829 830/******************************************************************************* 831 * 832 * FUNCTION: AcpiDbDisplayCallingTree 833 * 834 * PARAMETERS: None 835 * 836 * RETURN: None 837 * 838 * DESCRIPTION: Display current calling tree of nested control methods 839 * 840 ******************************************************************************/ 841 842void 843AcpiDbDisplayCallingTree (void) 844{ 845 UINT32 i; 846 ACPI_WALK_STATE *WalkState; 847 ACPI_NAMESPACE_NODE *Node; 848 849 850 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 851 if (!WalkState) 852 { 853 AcpiOsPrintf ("There is no method currently executing\n"); 854 return; 855 } 856 857 Node = WalkState->MethodNode; 858 859 AcpiOsPrintf ("Current Control Method Call Tree\n"); 860 861 for (i = 0; WalkState; i++) 862 { 863 Node = WalkState->MethodNode; 864 865 AcpiOsPrintf (" [%4.4s]\n", &Node->Name); 866 867 WalkState = WalkState->Next; 868 } 869} 870 871 872/******************************************************************************* 873 * 874 * FUNCTION: AcpiDbDisplayResultObject 875 * 876 * PARAMETERS: ObjDesc - Object to be displayed 877 * WalkState - Current walk state 878 * 879 * RETURN: None 880 * 881 * DESCRIPTION: Display the result of an AML opcode 882 * 883 ******************************************************************************/ 884 885void 886AcpiDbDisplayResultObject ( 887 ACPI_OPERAND_OBJECT *ObjDesc, 888 ACPI_WALK_STATE *WalkState) 889{ 890 891 /* TBD: [Future] We don't always want to display the result. 892 * For now, only display if single stepping 893 * however, this output is very useful in other contexts also 894 */ 895 896 if (!AcpiGbl_CmSingleStep) 897 { 898 return; 899 } 900 901 AcpiOsPrintf ("ResultObj: "); 902 AcpiDbDisplayInternalObject (ObjDesc, WalkState); 903 AcpiOsPrintf ("\n"); 904} 905 906 907/******************************************************************************* 908 * 909 * FUNCTION: AcpiDbDisplayArgumentObject 910 * 911 * PARAMETERS: ObjDesc - Object to be displayed 912 * WalkState - Current walk state 913 * 914 * RETURN: None 915 * 916 * DESCRIPTION: Display the result of an AML opcode 917 * 918 ******************************************************************************/ 919 920void 921AcpiDbDisplayArgumentObject ( 922 ACPI_OPERAND_OBJECT *ObjDesc, 923 ACPI_WALK_STATE *WalkState) 924{ 925 926 927 if (!AcpiGbl_CmSingleStep) 928 { 929 return; 930 } 931 932 AcpiOsPrintf ("ArgObj: "); 933 AcpiDbDisplayInternalObject (ObjDesc, WalkState); 934} 935 936#endif /* ENABLE_DEBUGGER */ 937 938