1 /******************************************************************************* 2 * 3 * Module Name: dmopcode - AML disassembler, specific AML opcodes 4 * 5 ******************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2015, 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 #include <contrib/dev/acpica/include/acpi.h> 45 #include <contrib/dev/acpica/include/accommon.h> 46 #include <contrib/dev/acpica/include/acparser.h> 47 #include <contrib/dev/acpica/include/amlcode.h> 48 #include <contrib/dev/acpica/include/acdisasm.h> 49 #include <contrib/dev/acpica/include/acinterp.h> 50 #include <contrib/dev/acpica/include/acnamesp.h> 51 52 #ifdef ACPI_DISASSEMBLER 53 54 #define _COMPONENT ACPI_CA_DEBUGGER 55 ACPI_MODULE_NAME ("dmopcode") 56 57 58 /* Local prototypes */ 59 60 static void 61 AcpiDmMatchKeyword ( 62 ACPI_PARSE_OBJECT *Op); 63 64 65 /******************************************************************************* 66 * 67 * FUNCTION: AcpiDmDisplayTargetPathname 68 * 69 * PARAMETERS: Op - Parse object 70 * 71 * RETURN: None 72 * 73 * DESCRIPTION: For AML opcodes that have a target operand, display the full 74 * pathname for the target, in a comment field. Handles Return() 75 * statements also. 76 * 77 ******************************************************************************/ 78 79 void 80 AcpiDmDisplayTargetPathname ( 81 ACPI_PARSE_OBJECT *Op) 82 { 83 ACPI_PARSE_OBJECT *NextOp; 84 ACPI_PARSE_OBJECT *PrevOp = NULL; 85 char *Pathname; 86 const ACPI_OPCODE_INFO *OpInfo; 87 88 89 if (Op->Common.AmlOpcode == AML_RETURN_OP) 90 { 91 PrevOp = Op->Asl.Value.Arg; 92 } 93 else 94 { 95 OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); 96 if (!(OpInfo->Flags & AML_HAS_TARGET)) 97 { 98 return; 99 } 100 101 /* Target is the last Op in the arg list */ 102 103 NextOp = Op->Asl.Value.Arg; 104 while (NextOp) 105 { 106 PrevOp = NextOp; 107 NextOp = PrevOp->Asl.Next; 108 } 109 } 110 111 if (!PrevOp) 112 { 113 return; 114 } 115 116 /* We must have a namepath AML opcode */ 117 118 if (PrevOp->Asl.AmlOpcode != AML_INT_NAMEPATH_OP) 119 { 120 return; 121 } 122 123 /* A null string is the "no target specified" case */ 124 125 if (!PrevOp->Asl.Value.String) 126 { 127 return; 128 } 129 130 /* No node means "unresolved external reference" */ 131 132 if (!PrevOp->Asl.Node) 133 { 134 AcpiOsPrintf (" /* External reference */"); 135 return; 136 } 137 138 /* Ignore if path is already from the root */ 139 140 if (*PrevOp->Asl.Value.String == '\\') 141 { 142 return; 143 } 144 145 /* Now: we can get the full pathname */ 146 147 Pathname = AcpiNsGetExternalPathname (PrevOp->Asl.Node); 148 if (!Pathname) 149 { 150 return; 151 } 152 153 AcpiOsPrintf (" /* %s */", Pathname); 154 ACPI_FREE (Pathname); 155 } 156 157 158 /******************************************************************************* 159 * 160 * FUNCTION: AcpiDmNotifyDescription 161 * 162 * PARAMETERS: Op - Name() parse object 163 * 164 * RETURN: None 165 * 166 * DESCRIPTION: Emit a description comment for the value associated with a 167 * Notify() operator. 168 * 169 ******************************************************************************/ 170 171 void 172 AcpiDmNotifyDescription ( 173 ACPI_PARSE_OBJECT *Op) 174 { 175 ACPI_PARSE_OBJECT *NextOp; 176 ACPI_NAMESPACE_NODE *Node; 177 UINT8 NotifyValue; 178 UINT8 Type = ACPI_TYPE_ANY; 179 180 181 /* The notify value is the second argument */ 182 183 NextOp = Op->Asl.Value.Arg; 184 NextOp = NextOp->Asl.Next; 185 186 switch (NextOp->Common.AmlOpcode) 187 { 188 case AML_ZERO_OP: 189 case AML_ONE_OP: 190 191 NotifyValue = (UINT8) NextOp->Common.AmlOpcode; 192 break; 193 194 case AML_BYTE_OP: 195 196 NotifyValue = (UINT8) NextOp->Asl.Value.Integer; 197 break; 198 199 default: 200 return; 201 } 202 203 /* 204 * Attempt to get the namespace node so we can determine the object type. 205 * Some notify values are dependent on the object type (Device, Thermal, 206 * or Processor). 207 */ 208 Node = Op->Asl.Node; 209 if (Node) 210 { 211 Type = Node->Type; 212 } 213 214 AcpiOsPrintf (" // %s", AcpiUtGetNotifyName (NotifyValue, Type)); 215 } 216 217 218 /******************************************************************************* 219 * 220 * FUNCTION: AcpiDmPredefinedDescription 221 * 222 * PARAMETERS: Op - Name() parse object 223 * 224 * RETURN: None 225 * 226 * DESCRIPTION: Emit a description comment for a predefined ACPI name. 227 * Used for iASL compiler only. 228 * 229 ******************************************************************************/ 230 231 void 232 AcpiDmPredefinedDescription ( 233 ACPI_PARSE_OBJECT *Op) 234 { 235 #ifdef ACPI_ASL_COMPILER 236 const AH_PREDEFINED_NAME *Info; 237 char *NameString; 238 int LastCharIsDigit; 239 int LastCharsAreHex; 240 241 242 if (!Op) 243 { 244 return; 245 } 246 247 /* Ensure that the comment field is emitted only once */ 248 249 if (Op->Common.DisasmFlags & ACPI_PARSEOP_PREDEF_CHECKED) 250 { 251 return; 252 } 253 Op->Common.DisasmFlags |= ACPI_PARSEOP_PREDEF_CHECKED; 254 255 /* Predefined name must start with an underscore */ 256 257 NameString = ACPI_CAST_PTR (char, &Op->Named.Name); 258 if (NameString[0] != '_') 259 { 260 return; 261 } 262 263 /* 264 * Check for the special ACPI names: 265 * _ACd, _ALd, _EJd, _Exx, _Lxx, _Qxx, _Wxx, _T_a 266 * (where d=decimal_digit, x=hex_digit, a=anything) 267 * 268 * Convert these to the generic name for table lookup. 269 * Note: NameString is guaranteed to be upper case here. 270 */ 271 LastCharIsDigit = 272 (isdigit ((int) NameString[3])); /* d */ 273 LastCharsAreHex = 274 (isxdigit ((int) NameString[2]) && /* xx */ 275 isxdigit ((int) NameString[3])); 276 277 switch (NameString[1]) 278 { 279 case 'A': 280 281 if ((NameString[2] == 'C') && (LastCharIsDigit)) 282 { 283 NameString = "_ACx"; 284 } 285 else if ((NameString[2] == 'L') && (LastCharIsDigit)) 286 { 287 NameString = "_ALx"; 288 } 289 break; 290 291 case 'E': 292 293 if ((NameString[2] == 'J') && (LastCharIsDigit)) 294 { 295 NameString = "_EJx"; 296 } 297 else if (LastCharsAreHex) 298 { 299 NameString = "_Exx"; 300 } 301 break; 302 303 case 'L': 304 305 if (LastCharsAreHex) 306 { 307 NameString = "_Lxx"; 308 } 309 break; 310 311 case 'Q': 312 313 if (LastCharsAreHex) 314 { 315 NameString = "_Qxx"; 316 } 317 break; 318 319 case 'T': 320 321 if (NameString[2] == '_') 322 { 323 NameString = "_T_x"; 324 } 325 break; 326 327 case 'W': 328 329 if (LastCharsAreHex) 330 { 331 NameString = "_Wxx"; 332 } 333 break; 334 335 default: 336 337 break; 338 } 339 340 /* Match the name in the info table */ 341 342 Info = AcpiAhMatchPredefinedName (NameString); 343 if (Info) 344 { 345 AcpiOsPrintf (" // %4.4s: %s", 346 NameString, ACPI_CAST_PTR (char, Info->Description)); 347 } 348 349 #endif 350 return; 351 } 352 353 354 /******************************************************************************* 355 * 356 * FUNCTION: AcpiDmFieldPredefinedDescription 357 * 358 * PARAMETERS: Op - Parse object 359 * 360 * RETURN: None 361 * 362 * DESCRIPTION: Emit a description comment for a resource descriptor tag 363 * (which is a predefined ACPI name.) Used for iASL compiler only. 364 * 365 ******************************************************************************/ 366 367 void 368 AcpiDmFieldPredefinedDescription ( 369 ACPI_PARSE_OBJECT *Op) 370 { 371 #ifdef ACPI_ASL_COMPILER 372 ACPI_PARSE_OBJECT *IndexOp; 373 char *Tag; 374 const ACPI_OPCODE_INFO *OpInfo; 375 const AH_PREDEFINED_NAME *Info; 376 377 378 if (!Op) 379 { 380 return; 381 } 382 383 /* Ensure that the comment field is emitted only once */ 384 385 if (Op->Common.DisasmFlags & ACPI_PARSEOP_PREDEF_CHECKED) 386 { 387 return; 388 } 389 Op->Common.DisasmFlags |= ACPI_PARSEOP_PREDEF_CHECKED; 390 391 /* 392 * Op must be one of the Create* operators: CreateField, CreateBitField, 393 * CreateByteField, CreateWordField, CreateDwordField, CreateQwordField 394 */ 395 OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); 396 if (!(OpInfo->Flags & AML_CREATE)) 397 { 398 return; 399 } 400 401 /* Second argument is the Index argument */ 402 403 IndexOp = Op->Common.Value.Arg; 404 IndexOp = IndexOp->Common.Next; 405 406 /* Index argument must be a namepath */ 407 408 if (IndexOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP) 409 { 410 return; 411 } 412 413 /* Major cheat: We previously put the Tag ptr in the Node field */ 414 415 Tag = ACPI_CAST_PTR (char, IndexOp->Common.Node); 416 if (!Tag) 417 { 418 return; 419 } 420 421 /* Match the name in the info table */ 422 423 Info = AcpiAhMatchPredefinedName (Tag); 424 if (Info) 425 { 426 AcpiOsPrintf (" // %4.4s: %s", Tag, 427 ACPI_CAST_PTR (char, Info->Description)); 428 } 429 430 #endif 431 return; 432 } 433 434 435 /******************************************************************************* 436 * 437 * FUNCTION: AcpiDmMethodFlags 438 * 439 * PARAMETERS: Op - Method Object to be examined 440 * 441 * RETURN: None 442 * 443 * DESCRIPTION: Decode control method flags 444 * 445 ******************************************************************************/ 446 447 void 448 AcpiDmMethodFlags ( 449 ACPI_PARSE_OBJECT *Op) 450 { 451 UINT32 Flags; 452 UINT32 Args; 453 454 455 /* The next Op contains the flags */ 456 457 Op = AcpiPsGetDepthNext (NULL, Op); 458 Flags = (UINT8) Op->Common.Value.Integer; 459 Args = Flags & 0x07; 460 461 /* Mark the Op as completed */ 462 463 Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; 464 465 /* 1) Method argument count */ 466 467 AcpiOsPrintf (", %u, ", Args); 468 469 /* 2) Serialize rule */ 470 471 if (!(Flags & 0x08)) 472 { 473 AcpiOsPrintf ("Not"); 474 } 475 476 AcpiOsPrintf ("Serialized"); 477 478 /* 3) SyncLevel */ 479 480 if (Flags & 0xF0) 481 { 482 AcpiOsPrintf (", %u", Flags >> 4); 483 } 484 } 485 486 487 /******************************************************************************* 488 * 489 * FUNCTION: AcpiDmFieldFlags 490 * 491 * PARAMETERS: Op - Field Object to be examined 492 * 493 * RETURN: None 494 * 495 * DESCRIPTION: Decode Field definition flags 496 * 497 ******************************************************************************/ 498 499 void 500 AcpiDmFieldFlags ( 501 ACPI_PARSE_OBJECT *Op) 502 { 503 UINT32 Flags; 504 505 506 Op = Op->Common.Next; 507 Flags = (UINT8) Op->Common.Value.Integer; 508 509 /* Mark the Op as completed */ 510 511 Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; 512 513 AcpiOsPrintf ("%s, ", AcpiGbl_AccessTypes [Flags & 0x07]); 514 AcpiOsPrintf ("%s, ", AcpiGbl_LockRule [(Flags & 0x10) >> 4]); 515 AcpiOsPrintf ("%s)", AcpiGbl_UpdateRules [(Flags & 0x60) >> 5]); 516 } 517 518 519 /******************************************************************************* 520 * 521 * FUNCTION: AcpiDmAddressSpace 522 * 523 * PARAMETERS: SpaceId - ID to be translated 524 * 525 * RETURN: None 526 * 527 * DESCRIPTION: Decode a SpaceId to an AddressSpaceKeyword 528 * 529 ******************************************************************************/ 530 531 void 532 AcpiDmAddressSpace ( 533 UINT8 SpaceId) 534 { 535 536 if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS) 537 { 538 if (SpaceId == 0x7F) 539 { 540 AcpiOsPrintf ("FFixedHW, "); 541 } 542 else 543 { 544 AcpiOsPrintf ("0x%.2X, ", SpaceId); 545 } 546 } 547 else 548 { 549 AcpiOsPrintf ("%s, ", AcpiGbl_RegionTypes [SpaceId]); 550 } 551 } 552 553 554 /******************************************************************************* 555 * 556 * FUNCTION: AcpiDmRegionFlags 557 * 558 * PARAMETERS: Op - Object to be examined 559 * 560 * RETURN: None 561 * 562 * DESCRIPTION: Decode OperationRegion flags 563 * 564 ******************************************************************************/ 565 566 void 567 AcpiDmRegionFlags ( 568 ACPI_PARSE_OBJECT *Op) 569 { 570 571 /* The next Op contains the SpaceId */ 572 573 Op = AcpiPsGetDepthNext (NULL, Op); 574 575 /* Mark the Op as completed */ 576 577 Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; 578 579 AcpiOsPrintf (", "); 580 AcpiDmAddressSpace ((UINT8) Op->Common.Value.Integer); 581 } 582 583 584 /******************************************************************************* 585 * 586 * FUNCTION: AcpiDmMatchOp 587 * 588 * PARAMETERS: Op - Match Object to be examined 589 * 590 * RETURN: None 591 * 592 * DESCRIPTION: Decode Match opcode operands 593 * 594 ******************************************************************************/ 595 596 void 597 AcpiDmMatchOp ( 598 ACPI_PARSE_OBJECT *Op) 599 { 600 ACPI_PARSE_OBJECT *NextOp; 601 602 603 NextOp = AcpiPsGetDepthNext (NULL, Op); 604 NextOp = NextOp->Common.Next; 605 606 if (!NextOp) 607 { 608 /* Handle partial tree during single-step */ 609 610 return; 611 } 612 613 /* Mark the two nodes that contain the encoding for the match keywords */ 614 615 NextOp->Common.DisasmOpcode = ACPI_DASM_MATCHOP; 616 617 NextOp = NextOp->Common.Next; 618 NextOp = NextOp->Common.Next; 619 NextOp->Common.DisasmOpcode = ACPI_DASM_MATCHOP; 620 } 621 622 623 /******************************************************************************* 624 * 625 * FUNCTION: AcpiDmMatchKeyword 626 * 627 * PARAMETERS: Op - Match Object to be examined 628 * 629 * RETURN: None 630 * 631 * DESCRIPTION: Decode Match opcode operands 632 * 633 ******************************************************************************/ 634 635 static void 636 AcpiDmMatchKeyword ( 637 ACPI_PARSE_OBJECT *Op) 638 { 639 640 if (((UINT32) Op->Common.Value.Integer) > ACPI_MAX_MATCH_OPCODE) 641 { 642 AcpiOsPrintf ("/* Unknown Match Keyword encoding */"); 643 } 644 else 645 { 646 AcpiOsPrintf ("%s", ACPI_CAST_PTR (char, 647 AcpiGbl_MatchOps[(ACPI_SIZE) Op->Common.Value.Integer])); 648 } 649 } 650 651 652 /******************************************************************************* 653 * 654 * FUNCTION: AcpiDmDisassembleOneOp 655 * 656 * PARAMETERS: WalkState - Current walk info 657 * Info - Parse tree walk info 658 * Op - Op that is to be printed 659 * 660 * RETURN: None 661 * 662 * DESCRIPTION: Disassemble a single AML opcode 663 * 664 ******************************************************************************/ 665 666 void 667 AcpiDmDisassembleOneOp ( 668 ACPI_WALK_STATE *WalkState, 669 ACPI_OP_WALK_INFO *Info, 670 ACPI_PARSE_OBJECT *Op) 671 { 672 const ACPI_OPCODE_INFO *OpInfo = NULL; 673 UINT32 Offset; 674 UINT32 Length; 675 ACPI_PARSE_OBJECT *Child; 676 ACPI_STATUS Status; 677 UINT8 *Aml; 678 const AH_DEVICE_ID *IdInfo; 679 680 681 if (!Op) 682 { 683 AcpiOsPrintf ("<NULL OP PTR>"); 684 return; 685 } 686 687 switch (Op->Common.DisasmOpcode) 688 { 689 case ACPI_DASM_MATCHOP: 690 691 AcpiDmMatchKeyword (Op); 692 return; 693 694 case ACPI_DASM_LNOT_SUFFIX: 695 696 if (!AcpiGbl_CstyleDisassembly) 697 { 698 switch (Op->Common.AmlOpcode) 699 { 700 case AML_LEQUAL_OP: 701 AcpiOsPrintf ("LNotEqual"); 702 break; 703 704 case AML_LGREATER_OP: 705 AcpiOsPrintf ("LLessEqual"); 706 break; 707 708 case AML_LLESS_OP: 709 AcpiOsPrintf ("LGreaterEqual"); 710 break; 711 712 default: 713 break; 714 } 715 } 716 717 Op->Common.DisasmOpcode = 0; 718 Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; 719 return; 720 721 default: 722 break; 723 } 724 725 OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); 726 727 /* The op and arguments */ 728 729 switch (Op->Common.AmlOpcode) 730 { 731 case AML_LNOT_OP: 732 733 Child = Op->Common.Value.Arg; 734 if ((Child->Common.AmlOpcode == AML_LEQUAL_OP) || 735 (Child->Common.AmlOpcode == AML_LGREATER_OP) || 736 (Child->Common.AmlOpcode == AML_LLESS_OP)) 737 { 738 Child->Common.DisasmOpcode = ACPI_DASM_LNOT_SUFFIX; 739 Op->Common.DisasmOpcode = ACPI_DASM_LNOT_PREFIX; 740 } 741 else 742 { 743 AcpiOsPrintf ("%s", OpInfo->Name); 744 } 745 break; 746 747 case AML_BYTE_OP: 748 749 AcpiOsPrintf ("0x%2.2X", (UINT32) Op->Common.Value.Integer); 750 break; 751 752 case AML_WORD_OP: 753 754 if (Op->Common.DisasmOpcode == ACPI_DASM_EISAID) 755 { 756 AcpiDmDecompressEisaId ((UINT32) Op->Common.Value.Integer); 757 } 758 else 759 { 760 AcpiOsPrintf ("0x%4.4X", (UINT32) Op->Common.Value.Integer); 761 } 762 break; 763 764 case AML_DWORD_OP: 765 766 if (Op->Common.DisasmOpcode == ACPI_DASM_EISAID) 767 { 768 AcpiDmDecompressEisaId ((UINT32) Op->Common.Value.Integer); 769 } 770 else 771 { 772 AcpiOsPrintf ("0x%8.8X", (UINT32) Op->Common.Value.Integer); 773 } 774 break; 775 776 case AML_QWORD_OP: 777 778 AcpiOsPrintf ("0x%8.8X%8.8X", 779 ACPI_FORMAT_UINT64 (Op->Common.Value.Integer)); 780 break; 781 782 case AML_STRING_OP: 783 784 AcpiUtPrintString (Op->Common.Value.String, ACPI_UINT16_MAX); 785 786 /* For _HID/_CID strings, attempt to output a descriptive comment */ 787 788 if (Op->Common.DisasmOpcode == ACPI_DASM_HID_STRING) 789 { 790 /* If we know about the ID, emit the description */ 791 792 IdInfo = AcpiAhMatchHardwareId (Op->Common.Value.String); 793 if (IdInfo) 794 { 795 AcpiOsPrintf (" /* %s */", IdInfo->Description); 796 } 797 } 798 break; 799 800 case AML_BUFFER_OP: 801 /* 802 * Determine the type of buffer. We can have one of the following: 803 * 804 * 1) ResourceTemplate containing Resource Descriptors. 805 * 2) Unicode String buffer 806 * 3) ASCII String buffer 807 * 4) Raw data buffer (if none of the above) 808 * 809 * Since there are no special AML opcodes to differentiate these 810 * types of buffers, we have to closely look at the data in the 811 * buffer to determine the type. 812 */ 813 if (!AcpiGbl_NoResourceDisassembly) 814 { 815 Status = AcpiDmIsResourceTemplate (WalkState, Op); 816 if (ACPI_SUCCESS (Status)) 817 { 818 Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE; 819 AcpiOsPrintf ("ResourceTemplate"); 820 break; 821 } 822 else if (Status == AE_AML_NO_RESOURCE_END_TAG) 823 { 824 AcpiOsPrintf ("/**** Is ResourceTemplate, but EndTag not at buffer end ****/ "); 825 } 826 } 827 828 if (AcpiDmIsUuidBuffer (Op)) 829 { 830 Op->Common.DisasmOpcode = ACPI_DASM_UUID; 831 AcpiOsPrintf ("ToUUID ("); 832 } 833 else if (AcpiDmIsUnicodeBuffer (Op)) 834 { 835 Op->Common.DisasmOpcode = ACPI_DASM_UNICODE; 836 AcpiOsPrintf ("Unicode ("); 837 } 838 else if (AcpiDmIsStringBuffer (Op)) 839 { 840 Op->Common.DisasmOpcode = ACPI_DASM_STRING; 841 AcpiOsPrintf ("Buffer"); 842 } 843 else if (AcpiDmIsPldBuffer (Op)) 844 { 845 Op->Common.DisasmOpcode = ACPI_DASM_PLD_METHOD; 846 AcpiOsPrintf ("ToPLD ("); 847 } 848 else 849 { 850 Op->Common.DisasmOpcode = ACPI_DASM_BUFFER; 851 AcpiOsPrintf ("Buffer"); 852 } 853 break; 854 855 case AML_INT_NAMEPATH_OP: 856 857 AcpiDmNamestring (Op->Common.Value.Name); 858 break; 859 860 case AML_INT_NAMEDFIELD_OP: 861 862 Length = AcpiDmDumpName (Op->Named.Name); 863 AcpiOsPrintf (",%*.s %u", (unsigned) (5 - Length), " ", 864 (UINT32) Op->Common.Value.Integer); 865 AcpiDmCommaIfFieldMember (Op); 866 867 Info->BitOffset += (UINT32) Op->Common.Value.Integer; 868 break; 869 870 case AML_INT_RESERVEDFIELD_OP: 871 872 /* Offset() -- Must account for previous offsets */ 873 874 Offset = (UINT32) Op->Common.Value.Integer; 875 Info->BitOffset += Offset; 876 877 if (Info->BitOffset % 8 == 0) 878 { 879 AcpiOsPrintf ("Offset (0x%.2X)", ACPI_DIV_8 (Info->BitOffset)); 880 } 881 else 882 { 883 AcpiOsPrintf (" , %u", Offset); 884 } 885 886 AcpiDmCommaIfFieldMember (Op); 887 break; 888 889 case AML_INT_ACCESSFIELD_OP: 890 case AML_INT_EXTACCESSFIELD_OP: 891 892 AcpiOsPrintf ("AccessAs (%s, ", 893 AcpiGbl_AccessTypes [(UINT32) (Op->Common.Value.Integer & 0x7)]); 894 895 AcpiDmDecodeAttribute ((UINT8) (Op->Common.Value.Integer >> 8)); 896 897 if (Op->Common.AmlOpcode == AML_INT_EXTACCESSFIELD_OP) 898 { 899 AcpiOsPrintf (" (0x%2.2X)", (unsigned) ((Op->Common.Value.Integer >> 16) & 0xFF)); 900 } 901 902 AcpiOsPrintf (")"); 903 AcpiDmCommaIfFieldMember (Op); 904 break; 905 906 case AML_INT_CONNECTION_OP: 907 /* 908 * Two types of Connection() - one with a buffer object, the 909 * other with a namestring that points to a buffer object. 910 */ 911 AcpiOsPrintf ("Connection ("); 912 Child = Op->Common.Value.Arg; 913 914 if (Child->Common.AmlOpcode == AML_INT_BYTELIST_OP) 915 { 916 AcpiOsPrintf ("\n"); 917 918 Aml = Child->Named.Data; 919 Length = (UINT32) Child->Common.Value.Integer; 920 921 Info->Level += 1; 922 Info->MappingOp = Op; 923 Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE; 924 925 AcpiDmResourceTemplate (Info, Op->Common.Parent, Aml, Length); 926 927 Info->Level -= 1; 928 AcpiDmIndent (Info->Level); 929 } 930 else 931 { 932 AcpiDmNamestring (Child->Common.Value.Name); 933 } 934 935 AcpiOsPrintf (")"); 936 AcpiDmCommaIfFieldMember (Op); 937 AcpiOsPrintf ("\n"); 938 939 Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; /* for now, ignore in AcpiDmAscendingOp */ 940 Child->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; 941 break; 942 943 case AML_INT_BYTELIST_OP: 944 945 AcpiDmByteList (Info, Op); 946 break; 947 948 case AML_INT_METHODCALL_OP: 949 950 Op = AcpiPsGetDepthNext (NULL, Op); 951 Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; 952 953 AcpiDmNamestring (Op->Common.Value.Name); 954 break; 955 956 default: 957 958 /* Just get the opcode name and print it */ 959 960 AcpiOsPrintf ("%s", OpInfo->Name); 961 962 963 #ifdef ACPI_DEBUGGER 964 965 if ((Op->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP) && 966 (WalkState) && 967 (WalkState->Results) && 968 (WalkState->ResultCount)) 969 { 970 AcpiDmDecodeInternalObject ( 971 WalkState->Results->Results.ObjDesc [ 972 (WalkState->ResultCount - 1) % 973 ACPI_RESULTS_FRAME_OBJ_NUM]); 974 } 975 #endif 976 977 break; 978 } 979 } 980 981 #endif /* ACPI_DISASSEMBLER */ 982