1 /******************************************************************************
3 * Name: acdisasm.h - AML disassembler
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2006, R. Byron Moore
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
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.
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.
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.
44 #ifndef __ACDISASM_H__
45 #define __ACDISASM_H__
52 #define BLOCK_COMMA_LIST 4
53 #define ACPI_DEFAULT_RESNAME *(u32 *) "__RD"
55 struct acpi_external_list {
58 struct acpi_external_list *next;
64 extern struct acpi_external_list *acpi_gbl_external_list;
66 typedef const struct acpi_dmtable_info {
74 * Values for Opcode above.
75 * Note: 0-7 must not change, used as a flag shift value
77 #define ACPI_DMT_FLAG0 0
78 #define ACPI_DMT_FLAG1 1
79 #define ACPI_DMT_FLAG2 2
80 #define ACPI_DMT_FLAG3 3
81 #define ACPI_DMT_FLAG4 4
82 #define ACPI_DMT_FLAG5 5
83 #define ACPI_DMT_FLAG6 6
84 #define ACPI_DMT_FLAG7 7
85 #define ACPI_DMT_FLAGS0 8
86 #define ACPI_DMT_FLAGS2 9
87 #define ACPI_DMT_UINT8 10
88 #define ACPI_DMT_UINT16 11
89 #define ACPI_DMT_UINT24 12
90 #define ACPI_DMT_UINT32 13
91 #define ACPI_DMT_UINT56 14
92 #define ACPI_DMT_UINT64 15
93 #define ACPI_DMT_STRING 16
94 #define ACPI_DMT_NAME4 17
95 #define ACPI_DMT_NAME6 18
96 #define ACPI_DMT_NAME8 19
97 #define ACPI_DMT_CHKSUM 20
98 #define ACPI_DMT_SPACEID 21
99 #define ACPI_DMT_GAS 22
100 #define ACPI_DMT_DMAR 23
101 #define ACPI_DMT_MADT 24
102 #define ACPI_DMT_SRAT 25
103 #define ACPI_DMT_EXIT 26
106 void (*ACPI_TABLE_HANDLER) (struct acpi_table_header * table);
108 struct acpi_dmtable_data {
110 struct acpi_dmtable_info *table_info;
111 ACPI_TABLE_HANDLER table_handler;
114 struct acpi_op_walk_info {
120 struct acpi_walk_state *walk_state;
124 acpi_status(*asl_walk_callback) (union acpi_parse_object * op,
125 u32 level, void *context);
127 struct acpi_resource_tag {
132 /* Strings used for decoding flags to ASL keywords */
134 extern const char *acpi_gbl_word_decode[];
135 extern const char *acpi_gbl_irq_decode[];
136 extern const char *acpi_gbl_lock_rule[];
137 extern const char *acpi_gbl_access_types[];
138 extern const char *acpi_gbl_update_rules[];
139 extern const char *acpi_gbl_match_ops[];
141 extern struct acpi_dmtable_info acpi_dm_table_info_asf0[];
142 extern struct acpi_dmtable_info acpi_dm_table_info_asf1[];
143 extern struct acpi_dmtable_info acpi_dm_table_info_asf2[];
144 extern struct acpi_dmtable_info acpi_dm_table_info_asf3[];
145 extern struct acpi_dmtable_info acpi_dm_table_info_asf4[];
146 extern struct acpi_dmtable_info acpi_dm_table_info_asf_hdr[];
147 extern struct acpi_dmtable_info acpi_dm_table_info_boot[];
148 extern struct acpi_dmtable_info acpi_dm_table_info_cpep[];
149 extern struct acpi_dmtable_info acpi_dm_table_info_cpep0[];
150 extern struct acpi_dmtable_info acpi_dm_table_info_dbgp[];
151 extern struct acpi_dmtable_info acpi_dm_table_info_dmar[];
152 extern struct acpi_dmtable_info acpi_dm_table_info_dmar_hdr[];
153 extern struct acpi_dmtable_info acpi_dm_table_info_dmar_scope[];
154 extern struct acpi_dmtable_info acpi_dm_table_info_dmar0[];
155 extern struct acpi_dmtable_info acpi_dm_table_info_dmar1[];
156 extern struct acpi_dmtable_info acpi_dm_table_info_ecdt[];
157 extern struct acpi_dmtable_info acpi_dm_table_info_facs[];
158 extern struct acpi_dmtable_info acpi_dm_table_info_fadt1[];
159 extern struct acpi_dmtable_info acpi_dm_table_info_fadt2[];
160 extern struct acpi_dmtable_info acpi_dm_table_info_gas[];
161 extern struct acpi_dmtable_info acpi_dm_table_info_header[];
162 extern struct acpi_dmtable_info acpi_dm_table_info_hpet[];
163 extern struct acpi_dmtable_info acpi_dm_table_info_madt[];
164 extern struct acpi_dmtable_info acpi_dm_table_info_madt0[];
165 extern struct acpi_dmtable_info acpi_dm_table_info_madt1[];
166 extern struct acpi_dmtable_info acpi_dm_table_info_madt2[];
167 extern struct acpi_dmtable_info acpi_dm_table_info_madt3[];
168 extern struct acpi_dmtable_info acpi_dm_table_info_madt4[];
169 extern struct acpi_dmtable_info acpi_dm_table_info_madt5[];
170 extern struct acpi_dmtable_info acpi_dm_table_info_madt6[];
171 extern struct acpi_dmtable_info acpi_dm_table_info_madt7[];
172 extern struct acpi_dmtable_info acpi_dm_table_info_madt8[];
173 extern struct acpi_dmtable_info acpi_dm_table_info_madt_hdr[];
174 extern struct acpi_dmtable_info acpi_dm_table_info_mcfg[];
175 extern struct acpi_dmtable_info acpi_dm_table_info_mcfg0[];
176 extern struct acpi_dmtable_info acpi_dm_table_info_rsdp1[];
177 extern struct acpi_dmtable_info acpi_dm_table_info_rsdp2[];
178 extern struct acpi_dmtable_info acpi_dm_table_info_sbst[];
179 extern struct acpi_dmtable_info acpi_dm_table_info_slit[];
180 extern struct acpi_dmtable_info acpi_dm_table_info_spcr[];
181 extern struct acpi_dmtable_info acpi_dm_table_info_spmi[];
182 extern struct acpi_dmtable_info acpi_dm_table_info_srat[];
183 extern struct acpi_dmtable_info acpi_dm_table_info_srat0[];
184 extern struct acpi_dmtable_info acpi_dm_table_info_srat1[];
185 extern struct acpi_dmtable_info acpi_dm_table_info_tcpa[];
186 extern struct acpi_dmtable_info acpi_dm_table_info_wdrt[];
191 void acpi_dm_dump_data_table(struct acpi_table_header *table);
194 acpi_dm_dump_table(u32 table_length,
197 u32 sub_table_length, struct acpi_dmtable_info *info);
199 void acpi_dm_line_header(u32 offset, u32 byte_length, char *name);
201 void acpi_dm_line_header2(u32 offset, u32 byte_length, char *name, u32 value);
206 void acpi_dm_dump_asf(struct acpi_table_header *table);
208 void acpi_dm_dump_cpep(struct acpi_table_header *table);
210 void acpi_dm_dump_dmar(struct acpi_table_header *table);
212 void acpi_dm_dump_fadt(struct acpi_table_header *table);
214 void acpi_dm_dump_srat(struct acpi_table_header *table);
216 void acpi_dm_dump_mcfg(struct acpi_table_header *table);
218 void acpi_dm_dump_madt(struct acpi_table_header *table);
220 u32 acpi_dm_dump_rsdp(struct acpi_table_header *table);
222 void acpi_dm_dump_rsdt(struct acpi_table_header *table);
224 void acpi_dm_dump_slit(struct acpi_table_header *table);
226 void acpi_dm_dump_xsdt(struct acpi_table_header *table);
232 acpi_dm_disassemble(struct acpi_walk_state *walk_state,
233 union acpi_parse_object *origin, u32 num_opcodes);
236 acpi_dm_walk_parse_tree(union acpi_parse_object *op,
237 asl_walk_callback descending_callback,
238 asl_walk_callback ascending_callback, void *context);
244 acpi_dm_disassemble_one_op(struct acpi_walk_state *walk_state,
245 struct acpi_op_walk_info *info,
246 union acpi_parse_object *op);
248 void acpi_dm_decode_internal_object(union acpi_operand_object *obj_desc);
250 u32 acpi_dm_list_type(union acpi_parse_object *op);
252 void acpi_dm_method_flags(union acpi_parse_object *op);
254 void acpi_dm_field_flags(union acpi_parse_object *op);
256 void acpi_dm_address_space(u8 space_id);
258 void acpi_dm_region_flags(union acpi_parse_object *op);
260 void acpi_dm_match_op(union acpi_parse_object *op);
262 u8 acpi_dm_comma_if_list_member(union acpi_parse_object *op);
264 void acpi_dm_comma_if_field_member(union acpi_parse_object *op);
269 u32 acpi_dm_dump_name(char *name);
272 acpi_ps_display_object_pathname(struct acpi_walk_state *walk_state,
273 union acpi_parse_object *op);
275 void acpi_dm_namestring(char *name);
281 acpi_dm_display_internal_object(union acpi_operand_object *obj_desc,
282 struct acpi_walk_state *walk_state);
284 void acpi_dm_display_arguments(struct acpi_walk_state *walk_state);
286 void acpi_dm_display_locals(struct acpi_walk_state *walk_state);
289 acpi_dm_dump_method_info(acpi_status status,
290 struct acpi_walk_state *walk_state,
291 union acpi_parse_object *op);
296 void acpi_dm_disasm_byte_list(u32 level, u8 * byte_data, u32 byte_count);
299 acpi_dm_byte_list(struct acpi_op_walk_info *info, union acpi_parse_object *op);
301 void acpi_dm_is_eisa_id(union acpi_parse_object *op);
303 void acpi_dm_eisa_id(u32 encoded_id);
305 u8 acpi_dm_is_unicode_buffer(union acpi_parse_object *op);
307 u8 acpi_dm_is_string_buffer(union acpi_parse_object *op);
312 void acpi_dm_dump_integer8(u8 value, char *name);
314 void acpi_dm_dump_integer16(u16 value, char *name);
316 void acpi_dm_dump_integer32(u32 value, char *name);
318 void acpi_dm_dump_integer64(u64 value, char *name);
321 acpi_dm_resource_template(struct acpi_op_walk_info *info,
322 union acpi_parse_object *op,
323 u8 * byte_data, u32 byte_count);
325 u8 acpi_dm_is_resource_template(union acpi_parse_object *op);
327 void acpi_dm_indent(u32 level);
329 void acpi_dm_bit_list(u16 mask);
331 void acpi_dm_decode_attribute(u8 attribute);
333 void acpi_dm_descriptor_name(void);
339 acpi_dm_word_descriptor(union aml_resource *resource, u32 length, u32 level);
342 acpi_dm_dword_descriptor(union aml_resource *resource, u32 length, u32 level);
345 acpi_dm_extended_descriptor(union aml_resource *resource,
346 u32 length, u32 level);
349 acpi_dm_qword_descriptor(union aml_resource *resource, u32 length, u32 level);
352 acpi_dm_memory24_descriptor(union aml_resource *resource,
353 u32 length, u32 level);
356 acpi_dm_memory32_descriptor(union aml_resource *resource,
357 u32 length, u32 level);
360 acpi_dm_fixed_memory32_descriptor(union aml_resource *resource,
361 u32 length, u32 level);
364 acpi_dm_generic_register_descriptor(union aml_resource *resource,
365 u32 length, u32 level);
368 acpi_dm_interrupt_descriptor(union aml_resource *resource,
369 u32 length, u32 level);
372 acpi_dm_vendor_large_descriptor(union aml_resource *resource,
373 u32 length, u32 level);
375 void acpi_dm_vendor_common(char *name, u8 * byte_data, u32 length, u32 level);
381 acpi_dm_irq_descriptor(union aml_resource *resource, u32 length, u32 level);
384 acpi_dm_dma_descriptor(union aml_resource *resource, u32 length, u32 level);
386 void acpi_dm_io_descriptor(union aml_resource *resource, u32 length, u32 level);
389 acpi_dm_fixed_io_descriptor(union aml_resource *resource,
390 u32 length, u32 level);
393 acpi_dm_start_dependent_descriptor(union aml_resource *resource,
394 u32 length, u32 level);
397 acpi_dm_end_dependent_descriptor(union aml_resource *resource,
398 u32 length, u32 level);
401 acpi_dm_vendor_small_descriptor(union aml_resource *resource,
402 u32 length, u32 level);
407 void acpi_dm_add_to_external_list(char *path, u8 type, u32 value);
412 void acpi_dm_find_resources(union acpi_parse_object *root);
415 acpi_dm_check_resource_reference(union acpi_parse_object *op,
416 struct acpi_walk_state *walk_state);
418 #endif /* __ACDISASM_H__ */