adisasm.c (241973) | adisasm.c (243347) |
---|---|
1/****************************************************************************** 2 * 3 * Module Name: adisasm - Application-level disassembler routines 4 * 5 *****************************************************************************/ 6 7/* 8 * Copyright (C) 2000 - 2012, Intel Corp. --- 74 unchanged lines hidden (view full) --- 83AdGetFileSize ( 84 FILE *File); 85 86static void 87AdCreateTableHeader ( 88 char *Filename, 89 ACPI_TABLE_HEADER *Table); 90 | 1/****************************************************************************** 2 * 3 * Module Name: adisasm - Application-level disassembler routines 4 * 5 *****************************************************************************/ 6 7/* 8 * Copyright (C) 2000 - 2012, Intel Corp. --- 74 unchanged lines hidden (view full) --- 83AdGetFileSize ( 84 FILE *File); 85 86static void 87AdCreateTableHeader ( 88 char *Filename, 89 ACPI_TABLE_HEADER *Table); 90 |
91static ACPI_STATUS 92AdDeferredParse ( 93 ACPI_PARSE_OBJECT *Op, 94 UINT8 *Aml, 95 UINT32 AmlLength); 96 97static ACPI_STATUS 98AdParseDeferredOps ( 99 ACPI_PARSE_OBJECT *Root); 100 101 | |
102/* Stubs for ASL compiler */ 103 104#ifndef ACPI_ASL_COMPILER 105BOOLEAN 106AcpiDsIsResultUsed ( 107 ACPI_PARSE_OBJECT *Op, 108 ACPI_WALK_STATE *WalkState) 109{ --- 638 unchanged lines hidden (view full) --- 748 } 749 750 return (AE_OK); 751} 752 753 754/****************************************************************************** 755 * | 91/* Stubs for ASL compiler */ 92 93#ifndef ACPI_ASL_COMPILER 94BOOLEAN 95AcpiDsIsResultUsed ( 96 ACPI_PARSE_OBJECT *Op, 97 ACPI_WALK_STATE *WalkState) 98{ --- 638 unchanged lines hidden (view full) --- 737 } 738 739 return (AE_OK); 740} 741 742 743/****************************************************************************** 744 * |
756 * FUNCTION: AdDeferredParse 757 * 758 * PARAMETERS: Op - Root Op of the deferred opcode 759 * Aml - Pointer to the raw AML 760 * AmlLength - Length of the AML 761 * 762 * RETURN: Status 763 * 764 * DESCRIPTION: Parse one deferred opcode 765 * (Methods, operation regions, etc.) 766 * 767 *****************************************************************************/ 768 769static ACPI_STATUS 770AdDeferredParse ( 771 ACPI_PARSE_OBJECT *Op, 772 UINT8 *Aml, 773 UINT32 AmlLength) 774{ 775 ACPI_WALK_STATE *WalkState; 776 ACPI_STATUS Status; 777 ACPI_PARSE_OBJECT *SearchOp; 778 ACPI_PARSE_OBJECT *StartOp; 779 UINT32 BaseAmlOffset; 780 ACPI_PARSE_OBJECT *ExtraOp; 781 782 783 ACPI_FUNCTION_TRACE (AdDeferredParse); 784 785 786 fprintf (stderr, "."); 787 788 if (!Aml || !AmlLength) 789 { 790 return_ACPI_STATUS (AE_OK); 791 } 792 793 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Parsing %s [%4.4s]\n", 794 Op->Common.AmlOpName, (char *) &Op->Named.Name)); 795 796 WalkState = AcpiDsCreateWalkState (0, Op, NULL, NULL); 797 if (!WalkState) 798 { 799 return_ACPI_STATUS (AE_NO_MEMORY); 800 } 801 802 Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, Aml, 803 AmlLength, NULL, ACPI_IMODE_LOAD_PASS1); 804 if (ACPI_FAILURE (Status)) 805 { 806 return_ACPI_STATUS (Status); 807 } 808 809 /* Parse the method */ 810 811 WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE; 812 WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE; 813 Status = AcpiPsParseAml (WalkState); 814 815 /* 816 * We need to update all of the Aml offsets, since the parser thought 817 * that the method began at offset zero. In reality, it began somewhere 818 * within the ACPI table, at the BaseAmlOffset. Walk the entire tree that 819 * was just created and update the AmlOffset in each Op 820 */ 821 BaseAmlOffset = (Op->Common.Value.Arg)->Common.AmlOffset + 1; 822 StartOp = (Op->Common.Value.Arg)->Common.Next; 823 SearchOp = StartOp; 824 825 /* Walk the parse tree */ 826 827 while (SearchOp) 828 { 829 SearchOp->Common.AmlOffset += BaseAmlOffset; 830 SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp); 831 } 832 833 /* 834 * Link the newly parsed subtree into the main parse tree 835 */ 836 switch (Op->Common.AmlOpcode) 837 { 838 case AML_BUFFER_OP: 839 case AML_PACKAGE_OP: 840 case AML_VAR_PACKAGE_OP: 841 842 switch (Op->Common.AmlOpcode) 843 { 844 case AML_PACKAGE_OP: 845 ExtraOp = Op->Common.Value.Arg; 846 ExtraOp = ExtraOp->Common.Next; 847 Op->Common.Value.Arg = ExtraOp->Common.Value.Arg; 848 break; 849 850 case AML_VAR_PACKAGE_OP: 851 case AML_BUFFER_OP: 852 default: 853 ExtraOp = Op->Common.Value.Arg; 854 Op->Common.Value.Arg = ExtraOp->Common.Value.Arg; 855 break; 856 } 857 858 /* Must point all parents to the main tree */ 859 860 StartOp = Op; 861 SearchOp = StartOp; 862 while (SearchOp) 863 { 864 if (SearchOp->Common.Parent == ExtraOp) 865 { 866 SearchOp->Common.Parent = Op; 867 } 868 SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp); 869 } 870 break; 871 872 default: 873 break; 874 } 875 876 return_ACPI_STATUS (AE_OK); 877} 878 879 880/****************************************************************************** 881 * 882 * FUNCTION: AdParseDeferredOps 883 * 884 * PARAMETERS: Root - Root of the parse tree 885 * 886 * RETURN: Status 887 * 888 * DESCRIPTION: Parse the deferred opcodes (Methods, regions, etc.) 889 * 890 *****************************************************************************/ 891 892static ACPI_STATUS 893AdParseDeferredOps ( 894 ACPI_PARSE_OBJECT *Root) 895{ 896 ACPI_PARSE_OBJECT *Op = Root; 897 ACPI_STATUS Status = AE_OK; 898 const ACPI_OPCODE_INFO *OpInfo; 899 900 901 ACPI_FUNCTION_NAME (AdParseDeferredOps); 902 fprintf (stderr, "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n"); 903 904 while (Op) 905 { 906 OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); 907 if (!(OpInfo->Flags & AML_DEFER)) 908 { 909 Op = AcpiPsGetDepthNext (Root, Op); 910 continue; 911 } 912 913 switch (Op->Common.AmlOpcode) 914 { 915 case AML_METHOD_OP: 916 case AML_BUFFER_OP: 917 case AML_PACKAGE_OP: 918 case AML_VAR_PACKAGE_OP: 919 920 Status = AdDeferredParse (Op, Op->Named.Data, Op->Named.Length); 921 if (ACPI_FAILURE (Status)) 922 { 923 return (Status); 924 } 925 break; 926 927 case AML_REGION_OP: 928 case AML_DATA_REGION_OP: 929 case AML_CREATE_QWORD_FIELD_OP: 930 case AML_CREATE_DWORD_FIELD_OP: 931 case AML_CREATE_WORD_FIELD_OP: 932 case AML_CREATE_BYTE_FIELD_OP: 933 case AML_CREATE_BIT_FIELD_OP: 934 case AML_CREATE_FIELD_OP: 935 case AML_BANK_FIELD_OP: 936 937 /* Nothing to do in these cases */ 938 939 break; 940 941 default: 942 ACPI_ERROR ((AE_INFO, "Unhandled deferred opcode [%s]", 943 Op->Common.AmlOpName)); 944 break; 945 } 946 947 Op = AcpiPsGetDepthNext (Root, Op); 948 } 949 950 fprintf (stderr, "\n"); 951 return (Status); 952} 953 954 955/****************************************************************************** 956 * | |
957 * FUNCTION: AdGetLocalTables 958 * 959 * PARAMETERS: Filename - Not used 960 * GetAllTables - TRUE if all tables are desired 961 * 962 * RETURN: Status 963 * 964 * DESCRIPTION: Get the ACPI tables from either memory or a file --- 221 unchanged lines hidden (view full) --- 1186 1187 if (External) 1188 { 1189 return (AE_OK); 1190 } 1191 1192 /* Pass 3: Parse control methods and link their parse trees into the main parse tree */ 1193 | 745 * FUNCTION: AdGetLocalTables 746 * 747 * PARAMETERS: Filename - Not used 748 * GetAllTables - TRUE if all tables are desired 749 * 750 * RETURN: Status 751 * 752 * DESCRIPTION: Get the ACPI tables from either memory or a file --- 221 unchanged lines hidden (view full) --- 974 975 if (External) 976 { 977 return (AE_OK); 978 } 979 980 /* Pass 3: Parse control methods and link their parse trees into the main parse tree */ 981 |
1194 Status = AdParseDeferredOps (AcpiGbl_ParseOpRoot); | 982 fprintf (stderr, "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n"); 983 Status = AcpiDmParseDeferredOps (AcpiGbl_ParseOpRoot); 984 fprintf (stderr, "\n"); |
1195 1196 /* Process Resource Templates */ 1197 1198 AcpiDmFindResources (AcpiGbl_ParseOpRoot); 1199 1200 fprintf (stderr, "Parsing completed\n"); 1201 return (AE_OK); 1202} | 985 986 /* Process Resource Templates */ 987 988 AcpiDmFindResources (AcpiGbl_ParseOpRoot); 989 990 fprintf (stderr, "Parsing completed\n"); 991 return (AE_OK); 992} |