Print this page
acpica-unix2-20130823
PANKOVs restructure
   1 /*******************************************************************************
   2  *
   3  * Module Name: dmwalk - AML disassembly tree walk
   4  *
   5  ******************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2011, 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.


 424         if (Op->Common.AmlOpcode == AML_SCOPE_OP)
 425         {
 426             /* This is the beginning of the Definition Block */
 427 
 428             AcpiOsPrintf ("{\n");
 429 
 430             /* Emit all External() declarations here */
 431 
 432             AcpiDmEmitExternals ();
 433             return (AE_OK);
 434         }
 435     }
 436     else if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
 437              (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) &&
 438              (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
 439     {
 440             /*
 441              * This is a first-level element of a term list,
 442              * indent a new line
 443              */





















 444             AcpiDmIndent (Level);



 445             Info->LastLevel = Level;
 446             Info->Count = 0;
 447     }
 448 
 449     /*
 450      * This is an inexpensive mechanism to try and keep lines from getting
 451      * too long. When the limit is hit, start a new line at the previous
 452      * indent plus one. A better but more expensive mechanism would be to
 453      * keep track of the current column.
 454      */
 455     Info->Count++;
 456     if (Info->Count /*+Info->LastLevel*/ > 10)
 457     {
 458         Info->Count = 0;
 459         AcpiOsPrintf ("\n");
 460         AcpiDmIndent (Info->LastLevel + 1);
 461     }
 462 
 463     /* Print the opcode name */
 464 
 465     AcpiDmDisassembleOneOp (NULL, Info, Op);
 466 
 467     if (Op->Common.DisasmOpcode == ACPI_DASM_LNOT_PREFIX)

 468     {
 469         return (AE_OK);
 470     }
 471 
 472     if ((Op->Common.AmlOpcode == AML_NAME_OP) ||
 473         (Op->Common.AmlOpcode == AML_RETURN_OP))
 474     {
 475         Info->Level--;
 476     }
 477 
 478     /* Start the opcode argument list if necessary */
 479 
 480     OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
 481 
 482     if ((OpInfo->Flags & AML_HAS_ARGS) ||
 483         (Op->Common.AmlOpcode == AML_EVENT_OP))
 484     {
 485         /* This opcode has an argument list */
 486 
 487         if (AcpiDmBlockType (Op) & BLOCK_PAREN)


 515                 {
 516                     AcpiDmDumpName (Name);
 517                 }
 518 
 519                 if (Op->Common.AmlOpcode != AML_INT_NAMEDFIELD_OP)
 520                 {
 521                     if (AcpiGbl_DbOpt_verbose)
 522                     {
 523                         (void) AcpiPsDisplayObjectPathname (NULL, Op);
 524                     }
 525                 }
 526                 break;
 527             }
 528 
 529             switch (Op->Common.AmlOpcode)
 530             {
 531             case AML_METHOD_OP:
 532 
 533                 AcpiDmMethodFlags (Op);
 534                 AcpiOsPrintf (")");




 535                 break;
 536 
 537 
 538             case AML_NAME_OP:
 539 
 540                 /* Check for _HID and related EISAID() */
 541 
 542                 AcpiDmIsEisaId (Op);
 543                 AcpiOsPrintf (", ");
 544                 break;
 545 
 546 
 547             case AML_REGION_OP:
 548 
 549                 AcpiDmRegionFlags (Op);
 550                 break;
 551 
 552 
 553             case AML_POWER_RES_OP:
 554 


 585                 AcpiOsPrintf (", ");
 586                 return (AE_OK);
 587 
 588 
 589             case AML_EVENT_OP:
 590             case AML_ALIAS_OP:
 591 
 592                 return (AE_OK);
 593 
 594 
 595             case AML_SCOPE_OP:
 596             case AML_DEVICE_OP:
 597             case AML_THERMAL_ZONE_OP:
 598 
 599                 AcpiOsPrintf (")");
 600                 break;
 601 
 602 
 603             default:
 604 
 605                 AcpiOsPrintf ("*** Unhandled named opcode %X\n", Op->Common.AmlOpcode);

 606                 break;
 607             }
 608         }
 609 
 610         else switch (Op->Common.AmlOpcode)
 611         {
 612         case AML_FIELD_OP:
 613         case AML_BANK_FIELD_OP:
 614         case AML_INDEX_FIELD_OP:
 615 
 616             Info->BitOffset = 0;
 617 
 618             /* Name of the parent OperationRegion */
 619 
 620             NextOp = AcpiPsGetDepthNext (NULL, Op);
 621             AcpiDmNamestring (NextOp->Common.Value.Name);
 622             AcpiOsPrintf (", ");
 623             NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
 624 
 625             switch (Op->Common.AmlOpcode)
 626             {
 627             case AML_BANK_FIELD_OP:
 628 
 629                 /* Namestring - Bank Name */
 630 
 631                 NextOp = AcpiPsGetDepthNext (NULL, NextOp);
 632                 AcpiDmNamestring (NextOp->Common.Value.Name);
 633                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
 634                 AcpiOsPrintf (", ");
 635 
 636                 /*
 637                  * Bank Value. This is a TermArg in the middle of the parameter
 638                  * list, must handle it here.
 639                  *
 640                  * Disassemble the TermArg parse tree. ACPI_PARSEOP_PARAMLIST
 641                  * eliminates newline in the output.
 642                  */
 643                 NextOp = NextOp->Common.Next;
 644 
 645                 Info->Flags = ACPI_PARSEOP_PARAMLIST;
 646                 AcpiDmWalkParseTree (NextOp, AcpiDmDescendingOp, AcpiDmAscendingOp, Info);

 647                 Info->Flags = 0;
 648                 Info->Level = Level;
 649 
 650                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
 651                 AcpiOsPrintf (", ");
 652                 break;
 653 
 654             case AML_INDEX_FIELD_OP:
 655 
 656                 /* Namestring - Data Name */
 657 
 658                 NextOp = AcpiPsGetDepthNext (NULL, NextOp);
 659                 AcpiDmNamestring (NextOp->Common.Value.Name);
 660                 AcpiOsPrintf (", ");
 661                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
 662                 break;
 663 
 664             default:
 665 
 666                 break;
 667             }
 668 
 669             AcpiDmFieldFlags (NextOp);
 670             break;
 671 
 672 
 673         case AML_BUFFER_OP:
 674 
 675             /* The next op is the size parameter */
 676 
 677             NextOp = AcpiPsGetDepthNext (NULL, Op);
 678             if (!NextOp)
 679             {
 680                 /* Single-step support */
 681 
 682                 return (AE_OK);
 683             }
 684 
 685             if (Op->Common.DisasmOpcode == ACPI_DASM_RESOURCE)
 686             {
 687                 /*
 688                  * We have a resource list.  Don't need to output
 689                  * the buffer size Op.  Open up a new block
 690                  */
 691                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
 692                 NextOp = NextOp->Common.Next;
 693                 AcpiOsPrintf (")\n");






 694                 AcpiDmIndent (Info->Level);
 695                 AcpiOsPrintf ("{\n");
 696                 return (AE_OK);
 697             }
 698 
 699             /* Normal Buffer, mark size as in the parameter list */
 700 
 701             NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
 702             return (AE_OK);
 703 
 704 
 705         case AML_VAR_PACKAGE_OP:
 706         case AML_IF_OP:
 707         case AML_WHILE_OP:
 708 
 709             /* The next op is the size or predicate parameter */
 710 
 711             NextOp = AcpiPsGetDepthNext (NULL, Op);
 712             if (NextOp)
 713             {
 714                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
 715             }
 716             return (AE_OK);
 717 
 718 
 719         case AML_PACKAGE_OP:
 720 
 721             /* The next op is the size or predicate parameter */
 722 
 723             NextOp = AcpiPsGetDepthNext (NULL, Op);
 724             if (NextOp)
 725             {
 726                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
 727             }
 728             return (AE_OK);
 729 
 730 
 731         case AML_MATCH_OP:
 732 
 733             AcpiDmMatchOp (Op);
 734             break;
 735 
 736 
 737         default:
 738 
 739             break;
 740         }
 741 
 742         if (AcpiDmBlockType (Op) & BLOCK_BRACE)
 743         {
 744             AcpiOsPrintf ("\n");
 745             AcpiDmIndent (Level);
 746             AcpiOsPrintf ("{\n");
 747         }
 748     }
 749 
 750     return (AE_OK);
 751 }
 752 
 753 
 754 /*******************************************************************************
 755  *
 756  * FUNCTION:    AcpiDmAscendingOp
 757  *
 758  * PARAMETERS:  ASL_WALK_CALLBACK
 759  *
 760  * RETURN:      Status
 761  *
 762  * DESCRIPTION: Second visitation of a parse object, during ascent of parse
 763  *              tree.  Close out any parameter lists and complete the opcode.
 764  *
 765  ******************************************************************************/
 766 
 767 static ACPI_STATUS
 768 AcpiDmAscendingOp (
 769     ACPI_PARSE_OBJECT       *Op,
 770     UINT32                  Level,
 771     void                    *Context)
 772 {
 773     ACPI_OP_WALK_INFO       *Info = Context;

 774 
 775 
 776     if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE)
 777     {
 778         /* Ignore this op -- it was handled elsewhere */
 779 
 780         return (AE_OK);
 781     }
 782 
 783     if ((Level == 0) && (Op->Common.AmlOpcode == AML_SCOPE_OP))
 784     {
 785         /* Indicates the end of the current descriptor block (table) */
 786 
 787         AcpiOsPrintf ("}\n\n");
 788         return (AE_OK);
 789     }
 790 
 791     switch (AcpiDmBlockType (Op))
 792     {
 793     case BLOCK_PAREN:
 794 
 795         /* Completed an op that has arguments, add closing paren */
 796 
 797         AcpiOsPrintf (")");
 798 













 799         /* Could be a nested operator, check if comma required */
 800 
 801         if (!AcpiDmCommaIfListMember (Op))
 802         {
 803             if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
 804                      (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) &&
 805                      (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
 806             {
 807                 /*
 808                  * This is a first-level element of a term list
 809                  * start a new line
 810                  */
 811                 if (!(Info->Flags & ACPI_PARSEOP_PARAMLIST))
 812                 {
 813                     AcpiOsPrintf ("\n");
 814                 }
 815             }
 816         }
 817         break;
 818 
 819 
 820     case BLOCK_BRACE:
 821     case (BLOCK_BRACE | BLOCK_PAREN):
 822 
 823         /* Completed an op that has a term list, add closing brace */
 824 
 825         if (Op->Common.DisasmFlags & ACPI_PARSEOP_EMPTY_TERMLIST)
 826         {
 827             AcpiOsPrintf ("}");
 828         }
 829         else
 830         {
 831             AcpiDmIndent (Level);
 832             AcpiOsPrintf ("}");
 833         }
 834 
 835         AcpiDmCommaIfListMember (Op);
 836 
 837         if (AcpiDmBlockType (Op->Common.Parent) != BLOCK_PAREN)
 838         {
 839             AcpiOsPrintf ("\n");
 840             if (!(Op->Common.DisasmFlags & ACPI_PARSEOP_EMPTY_TERMLIST))
 841             {
 842                 if ((Op->Common.AmlOpcode == AML_IF_OP)  &&
 843                     (Op->Common.Next) &&
 844                     (Op->Common.Next->Common.AmlOpcode == AML_ELSE_OP))
 845                 {
 846                     break;
 847                 }
 848 
 849                 if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
 850                     (!Op->Common.Next))
 851                 {
 852                     break;
 853                 }
 854                 AcpiOsPrintf ("\n");
 855             }
 856         }
 857         break;
 858 
 859 
 860     case BLOCK_NONE:
 861     default:
 862 
 863         /* Could be a nested operator, check if comma required */
 864 
 865         if (!AcpiDmCommaIfListMember (Op))
 866         {
 867             if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
 868                      (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) &&
 869                      (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
 870             {
 871                 /*
 872                  * This is a first-level element of a term list
 873                  * start a new line
 874                  */
 875                 AcpiOsPrintf ("\n");
 876             }
 877         }
 878         else if (Op->Common.Parent)
 879         {


 893                 break;
 894             }
 895         }
 896         break;
 897     }
 898 
 899     if (Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)
 900     {
 901         if ((Op->Common.Next) &&
 902             (Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST))
 903         {
 904             return (AE_OK);
 905         }
 906 
 907         /*
 908          * Just completed a parameter node for something like "Buffer (param)".
 909          * Close the paren and open up the term list block with a brace
 910          */
 911         if (Op->Common.Next)
 912         {
 913             AcpiOsPrintf (")\n");













 914             AcpiDmIndent (Level - 1);
 915             AcpiOsPrintf ("{\n");
 916         }
 917         else
 918         {
 919             Op->Common.Parent->Common.DisasmFlags |=
 920                                     ACPI_PARSEOP_EMPTY_TERMLIST;
 921             AcpiOsPrintf (") {");
 922         }
 923     }
 924 
 925     if ((Op->Common.AmlOpcode == AML_NAME_OP) ||
 926         (Op->Common.AmlOpcode == AML_RETURN_OP))
 927     {
 928         Info->Level++;
 929     }
 930     return (AE_OK);
 931 }
 932 
 933 
   1 /*******************************************************************************
   2  *
   3  * Module Name: dmwalk - AML disassembly tree walk
   4  *
   5  ******************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2013, 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.


 424         if (Op->Common.AmlOpcode == AML_SCOPE_OP)
 425         {
 426             /* This is the beginning of the Definition Block */
 427 
 428             AcpiOsPrintf ("{\n");
 429 
 430             /* Emit all External() declarations here */
 431 
 432             AcpiDmEmitExternals ();
 433             return (AE_OK);
 434         }
 435     }
 436     else if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
 437              (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) &&
 438              (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
 439     {
 440             /*
 441              * This is a first-level element of a term list,
 442              * indent a new line
 443              */
 444             switch (Op->Common.AmlOpcode)
 445             {
 446             case AML_NOOP_OP:
 447                 /*
 448                  * Optionally just ignore this opcode. Some tables use
 449                  * NoOp opcodes for "padding" out packages that the BIOS
 450                  * changes dynamically. This can leave hundreds or
 451                  * thousands of NoOp opcodes that if disassembled,
 452                  * cannot be compiled because they are syntactically
 453                  * incorrect.
 454                  */
 455                 if (AcpiGbl_IgnoreNoopOperator)
 456                 {
 457                     Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
 458                     return (AE_OK);
 459                 }
 460 
 461                 /* Fallthrough */
 462 
 463             default:
 464 
 465                 AcpiDmIndent (Level);
 466                 break;
 467             }
 468 
 469             Info->LastLevel = Level;
 470             Info->Count = 0;
 471     }
 472 
 473     /*
 474      * This is an inexpensive mechanism to try and keep lines from getting
 475      * too long. When the limit is hit, start a new line at the previous
 476      * indent plus one. A better but more expensive mechanism would be to
 477      * keep track of the current column.
 478      */
 479     Info->Count++;
 480     if (Info->Count /* +Info->LastLevel */ > 10)
 481     {
 482         Info->Count = 0;
 483         AcpiOsPrintf ("\n");
 484         AcpiDmIndent (Info->LastLevel + 1);
 485     }
 486 
 487     /* Print the opcode name */
 488 
 489     AcpiDmDisassembleOneOp (NULL, Info, Op);
 490 
 491     if ((Op->Common.DisasmOpcode == ACPI_DASM_LNOT_PREFIX) ||
 492         (Op->Common.AmlOpcode == AML_INT_CONNECTION_OP))
 493     {
 494         return (AE_OK);
 495     }
 496 
 497     if ((Op->Common.AmlOpcode == AML_NAME_OP) ||
 498         (Op->Common.AmlOpcode == AML_RETURN_OP))
 499     {
 500         Info->Level--;
 501     }
 502 
 503     /* Start the opcode argument list if necessary */
 504 
 505     OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
 506 
 507     if ((OpInfo->Flags & AML_HAS_ARGS) ||
 508         (Op->Common.AmlOpcode == AML_EVENT_OP))
 509     {
 510         /* This opcode has an argument list */
 511 
 512         if (AcpiDmBlockType (Op) & BLOCK_PAREN)


 540                 {
 541                     AcpiDmDumpName (Name);
 542                 }
 543 
 544                 if (Op->Common.AmlOpcode != AML_INT_NAMEDFIELD_OP)
 545                 {
 546                     if (AcpiGbl_DbOpt_verbose)
 547                     {
 548                         (void) AcpiPsDisplayObjectPathname (NULL, Op);
 549                     }
 550                 }
 551                 break;
 552             }
 553 
 554             switch (Op->Common.AmlOpcode)
 555             {
 556             case AML_METHOD_OP:
 557 
 558                 AcpiDmMethodFlags (Op);
 559                 AcpiOsPrintf (")");
 560 
 561                 /* Emit description comment for Method() with a predefined ACPI name */
 562 
 563                 AcpiDmPredefinedDescription (Op);
 564                 break;
 565 
 566 
 567             case AML_NAME_OP:
 568 
 569                 /* Check for _HID and related EISAID() */
 570 
 571                 AcpiDmIsEisaId (Op);
 572                 AcpiOsPrintf (", ");
 573                 break;
 574 
 575 
 576             case AML_REGION_OP:
 577 
 578                 AcpiDmRegionFlags (Op);
 579                 break;
 580 
 581 
 582             case AML_POWER_RES_OP:
 583 


 614                 AcpiOsPrintf (", ");
 615                 return (AE_OK);
 616 
 617 
 618             case AML_EVENT_OP:
 619             case AML_ALIAS_OP:
 620 
 621                 return (AE_OK);
 622 
 623 
 624             case AML_SCOPE_OP:
 625             case AML_DEVICE_OP:
 626             case AML_THERMAL_ZONE_OP:
 627 
 628                 AcpiOsPrintf (")");
 629                 break;
 630 
 631 
 632             default:
 633 
 634                 AcpiOsPrintf ("*** Unhandled named opcode %X\n",
 635                     Op->Common.AmlOpcode);
 636                 break;
 637             }
 638         }
 639 
 640         else switch (Op->Common.AmlOpcode)
 641         {
 642         case AML_FIELD_OP:
 643         case AML_BANK_FIELD_OP:
 644         case AML_INDEX_FIELD_OP:
 645 
 646             Info->BitOffset = 0;
 647 
 648             /* Name of the parent OperationRegion */
 649 
 650             NextOp = AcpiPsGetDepthNext (NULL, Op);
 651             AcpiDmNamestring (NextOp->Common.Value.Name);
 652             AcpiOsPrintf (", ");
 653             NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
 654 
 655             switch (Op->Common.AmlOpcode)
 656             {
 657             case AML_BANK_FIELD_OP:
 658 
 659                 /* Namestring - Bank Name */
 660 
 661                 NextOp = AcpiPsGetDepthNext (NULL, NextOp);
 662                 AcpiDmNamestring (NextOp->Common.Value.Name);
 663                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
 664                 AcpiOsPrintf (", ");
 665 
 666                 /*
 667                  * Bank Value. This is a TermArg in the middle of the parameter
 668                  * list, must handle it here.
 669                  *
 670                  * Disassemble the TermArg parse tree. ACPI_PARSEOP_PARAMLIST
 671                  * eliminates newline in the output.
 672                  */
 673                 NextOp = NextOp->Common.Next;
 674 
 675                 Info->Flags = ACPI_PARSEOP_PARAMLIST;
 676                 AcpiDmWalkParseTree (NextOp, AcpiDmDescendingOp,
 677                     AcpiDmAscendingOp, Info);
 678                 Info->Flags = 0;
 679                 Info->Level = Level;
 680 
 681                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
 682                 AcpiOsPrintf (", ");
 683                 break;
 684 
 685             case AML_INDEX_FIELD_OP:
 686 
 687                 /* Namestring - Data Name */
 688 
 689                 NextOp = AcpiPsGetDepthNext (NULL, NextOp);
 690                 AcpiDmNamestring (NextOp->Common.Value.Name);
 691                 AcpiOsPrintf (", ");
 692                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
 693                 break;
 694 
 695             default:
 696 
 697                 break;
 698             }
 699 
 700             AcpiDmFieldFlags (NextOp);
 701             break;
 702 

 703         case AML_BUFFER_OP:
 704 
 705             /* The next op is the size parameter */
 706 
 707             NextOp = AcpiPsGetDepthNext (NULL, Op);
 708             if (!NextOp)
 709             {
 710                 /* Single-step support */
 711 
 712                 return (AE_OK);
 713             }
 714 
 715             if (Op->Common.DisasmOpcode == ACPI_DASM_RESOURCE)
 716             {
 717                 /*
 718                  * We have a resource list. Don't need to output
 719                  * the buffer size Op. Open up a new block
 720                  */
 721                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
 722                 NextOp = NextOp->Common.Next;
 723                 AcpiOsPrintf (")");
 724 
 725                 /* Emit description comment for Name() with a predefined ACPI name */
 726 
 727                 AcpiDmPredefinedDescription (Op->Asl.Parent);
 728 
 729                 AcpiOsPrintf ("\n");
 730                 AcpiDmIndent (Info->Level);
 731                 AcpiOsPrintf ("{\n");
 732                 return (AE_OK);
 733             }
 734 
 735             /* Normal Buffer, mark size as in the parameter list */
 736 
 737             NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
 738             return (AE_OK);
 739 

 740         case AML_VAR_PACKAGE_OP:
 741         case AML_IF_OP:
 742         case AML_WHILE_OP:
 743 
 744             /* The next op is the size or predicate parameter */
 745 
 746             NextOp = AcpiPsGetDepthNext (NULL, Op);
 747             if (NextOp)
 748             {
 749                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
 750             }
 751             return (AE_OK);
 752 

 753         case AML_PACKAGE_OP:
 754 
 755             /* The next op is the size parameter */
 756 
 757             NextOp = AcpiPsGetDepthNext (NULL, Op);
 758             if (NextOp)
 759             {
 760                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
 761             }
 762             return (AE_OK);
 763 

 764         case AML_MATCH_OP:
 765 
 766             AcpiDmMatchOp (Op);
 767             break;
 768 

 769         default:
 770 
 771             break;
 772         }
 773 
 774         if (AcpiDmBlockType (Op) & BLOCK_BRACE)
 775         {
 776             AcpiOsPrintf ("\n");
 777             AcpiDmIndent (Level);
 778             AcpiOsPrintf ("{\n");
 779         }
 780     }
 781 
 782     return (AE_OK);
 783 }
 784 
 785 
 786 /*******************************************************************************
 787  *
 788  * FUNCTION:    AcpiDmAscendingOp
 789  *
 790  * PARAMETERS:  ASL_WALK_CALLBACK
 791  *
 792  * RETURN:      Status
 793  *
 794  * DESCRIPTION: Second visitation of a parse object, during ascent of parse
 795  *              tree. Close out any parameter lists and complete the opcode.
 796  *
 797  ******************************************************************************/
 798 
 799 static ACPI_STATUS
 800 AcpiDmAscendingOp (
 801     ACPI_PARSE_OBJECT       *Op,
 802     UINT32                  Level,
 803     void                    *Context)
 804 {
 805     ACPI_OP_WALK_INFO       *Info = Context;
 806     ACPI_PARSE_OBJECT       *ParentOp;
 807 
 808 
 809     if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE)
 810     {
 811         /* Ignore this op -- it was handled elsewhere */
 812 
 813         return (AE_OK);
 814     }
 815 
 816     if ((Level == 0) && (Op->Common.AmlOpcode == AML_SCOPE_OP))
 817     {
 818         /* Indicates the end of the current descriptor block (table) */
 819 
 820         AcpiOsPrintf ("}\n\n");
 821         return (AE_OK);
 822     }
 823 
 824     switch (AcpiDmBlockType (Op))
 825     {
 826     case BLOCK_PAREN:
 827 
 828         /* Completed an op that has arguments, add closing paren */
 829 
 830         AcpiOsPrintf (")");
 831 
 832         if (Op->Common.AmlOpcode == AML_NAME_OP)
 833         {
 834             /* Emit description comment for Name() with a predefined ACPI name */
 835 
 836             AcpiDmPredefinedDescription (Op);
 837         }
 838         else
 839         {
 840             /* For Create* operators, attempt to emit resource tag description */
 841 
 842             AcpiDmFieldPredefinedDescription (Op);
 843         }
 844 
 845         /* Could be a nested operator, check if comma required */
 846 
 847         if (!AcpiDmCommaIfListMember (Op))
 848         {
 849             if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
 850                      (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) &&
 851                      (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
 852             {
 853                 /*
 854                  * This is a first-level element of a term list
 855                  * start a new line
 856                  */
 857                 if (!(Info->Flags & ACPI_PARSEOP_PARAMLIST))
 858                 {
 859                     AcpiOsPrintf ("\n");
 860                 }
 861             }
 862         }
 863         break;
 864 

 865     case BLOCK_BRACE:
 866     case (BLOCK_BRACE | BLOCK_PAREN):
 867 
 868         /* Completed an op that has a term list, add closing brace */
 869 
 870         if (Op->Common.DisasmFlags & ACPI_PARSEOP_EMPTY_TERMLIST)
 871         {
 872             AcpiOsPrintf ("}");
 873         }
 874         else
 875         {
 876             AcpiDmIndent (Level);
 877             AcpiOsPrintf ("}");
 878         }
 879 
 880         AcpiDmCommaIfListMember (Op);
 881 
 882         if (AcpiDmBlockType (Op->Common.Parent) != BLOCK_PAREN)
 883         {
 884             AcpiOsPrintf ("\n");
 885             if (!(Op->Common.DisasmFlags & ACPI_PARSEOP_EMPTY_TERMLIST))
 886             {
 887                 if ((Op->Common.AmlOpcode == AML_IF_OP)  &&
 888                     (Op->Common.Next) &&
 889                     (Op->Common.Next->Common.AmlOpcode == AML_ELSE_OP))
 890                 {
 891                     break;
 892                 }
 893 
 894                 if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
 895                     (!Op->Common.Next))
 896                 {
 897                     break;
 898                 }
 899                 AcpiOsPrintf ("\n");
 900             }
 901         }
 902         break;
 903 

 904     case BLOCK_NONE:
 905     default:
 906 
 907         /* Could be a nested operator, check if comma required */
 908 
 909         if (!AcpiDmCommaIfListMember (Op))
 910         {
 911             if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
 912                      (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) &&
 913                      (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
 914             {
 915                 /*
 916                  * This is a first-level element of a term list
 917                  * start a new line
 918                  */
 919                 AcpiOsPrintf ("\n");
 920             }
 921         }
 922         else if (Op->Common.Parent)
 923         {


 937                 break;
 938             }
 939         }
 940         break;
 941     }
 942 
 943     if (Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)
 944     {
 945         if ((Op->Common.Next) &&
 946             (Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST))
 947         {
 948             return (AE_OK);
 949         }
 950 
 951         /*
 952          * Just completed a parameter node for something like "Buffer (param)".
 953          * Close the paren and open up the term list block with a brace
 954          */
 955         if (Op->Common.Next)
 956         {
 957             AcpiOsPrintf (")");
 958 
 959             /* Emit description comment for Name() with a predefined ACPI name */
 960 
 961             ParentOp = Op->Common.Parent;
 962             if (ParentOp)
 963             {
 964                 ParentOp = ParentOp->Common.Parent;
 965                 if (ParentOp && ParentOp->Asl.AmlOpcode == AML_NAME_OP)
 966                 {
 967                     AcpiDmPredefinedDescription (ParentOp);
 968                 }
 969             }
 970             AcpiOsPrintf ("\n");
 971             AcpiDmIndent (Level - 1);
 972             AcpiOsPrintf ("{\n");
 973         }
 974         else
 975         {
 976             Op->Common.Parent->Common.DisasmFlags |=
 977                                     ACPI_PARSEOP_EMPTY_TERMLIST;
 978             AcpiOsPrintf (") {");
 979         }
 980     }
 981 
 982     if ((Op->Common.AmlOpcode == AML_NAME_OP) ||
 983         (Op->Common.AmlOpcode == AML_RETURN_OP))
 984     {
 985         Info->Level++;
 986     }
 987     return (AE_OK);
 988 }
 989 
 990