Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /****************************************************************************** |
2 | * | |
3 | * Name: acdisasm.h - AML disassembler | |
4 | * | |
5 | *****************************************************************************/ | |
6 | ||
7 | /* | |
4a90c7e8 | 8 | * Copyright (C) 2000 - 2006, R. Byron Moore |
1da177e4 LT |
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 | #ifndef __ACDISASM_H__ | |
45 | #define __ACDISASM_H__ | |
46 | ||
47 | #include "amlresrc.h" | |
48 | ||
1da177e4 LT |
49 | #define BLOCK_NONE 0 |
50 | #define BLOCK_PAREN 1 | |
51 | #define BLOCK_BRACE 2 | |
52 | #define BLOCK_COMMA_LIST 4 | |
8313524a | 53 | #define ACPI_DEFAULT_RESNAME *(u32 *) "__RD" |
1da177e4 | 54 | |
4be44fcd LB |
55 | struct acpi_external_list { |
56 | char *path; | |
958dd242 | 57 | char *internal_path; |
4be44fcd | 58 | struct acpi_external_list *next; |
958dd242 BM |
59 | u32 value; |
60 | u16 length; | |
61 | u8 type; | |
1da177e4 LT |
62 | }; |
63 | ||
4be44fcd | 64 | extern struct acpi_external_list *acpi_gbl_external_list; |
defba1d8 | 65 | |
793c2388 BM |
66 | typedef const struct acpi_dmtable_info { |
67 | u8 opcode; | |
68 | u8 offset; | |
69 | char *name; | |
defba1d8 | 70 | |
793c2388 BM |
71 | } acpi_dmtable_info; |
72 | ||
73 | /* | |
74 | * Values for Opcode above. | |
75 | * Note: 0-7 must not change, used as a flag shift value | |
76 | */ | |
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_MADT 23 | |
101 | #define ACPI_DMT_SRAT 24 | |
102 | #define ACPI_DMT_EXIT 25 | |
103 | ||
104 | typedef | |
105 | void (*ACPI_TABLE_HANDLER) (struct acpi_table_header * table); | |
106 | ||
107 | struct acpi_dmtable_data { | |
108 | char *signature; | |
109 | struct acpi_dmtable_info *table_info; | |
110 | ACPI_TABLE_HANDLER table_handler; | |
111 | }; | |
4be44fcd LB |
112 | |
113 | struct acpi_op_walk_info { | |
114 | u32 level; | |
958dd242 BM |
115 | u32 last_level; |
116 | u32 count; | |
4be44fcd | 117 | u32 bit_offset; |
52fc0b02 | 118 | u32 flags; |
4be44fcd | 119 | struct acpi_walk_state *walk_state; |
1da177e4 LT |
120 | }; |
121 | ||
122 | typedef | |
4be44fcd LB |
123 | acpi_status(*asl_walk_callback) (union acpi_parse_object * op, |
124 | u32 level, void *context); | |
1da177e4 | 125 | |
8313524a BM |
126 | struct acpi_resource_tag { |
127 | u32 bit_index; | |
128 | char *tag; | |
129 | }; | |
130 | ||
793c2388 BM |
131 | /* Strings used for decoding flags to ASL keywords */ |
132 | ||
b229cf92 BM |
133 | extern const char *acpi_gbl_word_decode[]; |
134 | extern const char *acpi_gbl_irq_decode[]; | |
135 | extern const char *acpi_gbl_lock_rule[]; | |
136 | extern const char *acpi_gbl_access_types[]; | |
137 | extern const char *acpi_gbl_update_rules[]; | |
138 | extern const char *acpi_gbl_match_ops[]; | |
793c2388 BM |
139 | |
140 | extern struct acpi_dmtable_info acpi_dm_table_info_asf0[]; | |
141 | extern struct acpi_dmtable_info acpi_dm_table_info_asf1[]; | |
142 | extern struct acpi_dmtable_info acpi_dm_table_info_asf2[]; | |
143 | extern struct acpi_dmtable_info acpi_dm_table_info_asf3[]; | |
144 | extern struct acpi_dmtable_info acpi_dm_table_info_asf4[]; | |
145 | extern struct acpi_dmtable_info acpi_dm_table_info_asf_hdr[]; | |
146 | extern struct acpi_dmtable_info acpi_dm_table_info_boot[]; | |
147 | extern struct acpi_dmtable_info acpi_dm_table_info_cpep[]; | |
148 | extern struct acpi_dmtable_info acpi_dm_table_info_cpep0[]; | |
149 | extern struct acpi_dmtable_info acpi_dm_table_info_dbgp[]; | |
150 | extern struct acpi_dmtable_info acpi_dm_table_info_ecdt[]; | |
151 | extern struct acpi_dmtable_info acpi_dm_table_info_facs[]; | |
152 | extern struct acpi_dmtable_info acpi_dm_table_info_fadt1[]; | |
153 | extern struct acpi_dmtable_info acpi_dm_table_info_fadt2[]; | |
154 | extern struct acpi_dmtable_info acpi_dm_table_info_gas[]; | |
155 | extern struct acpi_dmtable_info acpi_dm_table_info_header[]; | |
156 | extern struct acpi_dmtable_info acpi_dm_table_info_hpet[]; | |
157 | extern struct acpi_dmtable_info acpi_dm_table_info_madt[]; | |
158 | extern struct acpi_dmtable_info acpi_dm_table_info_madt0[]; | |
159 | extern struct acpi_dmtable_info acpi_dm_table_info_madt1[]; | |
160 | extern struct acpi_dmtable_info acpi_dm_table_info_madt2[]; | |
161 | extern struct acpi_dmtable_info acpi_dm_table_info_madt3[]; | |
162 | extern struct acpi_dmtable_info acpi_dm_table_info_madt4[]; | |
163 | extern struct acpi_dmtable_info acpi_dm_table_info_madt5[]; | |
164 | extern struct acpi_dmtable_info acpi_dm_table_info_madt6[]; | |
165 | extern struct acpi_dmtable_info acpi_dm_table_info_madt7[]; | |
166 | extern struct acpi_dmtable_info acpi_dm_table_info_madt8[]; | |
167 | extern struct acpi_dmtable_info acpi_dm_table_info_madt_hdr[]; | |
168 | extern struct acpi_dmtable_info acpi_dm_table_info_mcfg[]; | |
169 | extern struct acpi_dmtable_info acpi_dm_table_info_mcfg0[]; | |
170 | extern struct acpi_dmtable_info acpi_dm_table_info_rsdp1[]; | |
171 | extern struct acpi_dmtable_info acpi_dm_table_info_rsdp2[]; | |
172 | extern struct acpi_dmtable_info acpi_dm_table_info_sbst[]; | |
173 | extern struct acpi_dmtable_info acpi_dm_table_info_slit[]; | |
174 | extern struct acpi_dmtable_info acpi_dm_table_info_spcr[]; | |
175 | extern struct acpi_dmtable_info acpi_dm_table_info_spmi[]; | |
176 | extern struct acpi_dmtable_info acpi_dm_table_info_srat[]; | |
177 | extern struct acpi_dmtable_info acpi_dm_table_info_srat0[]; | |
178 | extern struct acpi_dmtable_info acpi_dm_table_info_srat1[]; | |
179 | extern struct acpi_dmtable_info acpi_dm_table_info_tcpa[]; | |
180 | extern struct acpi_dmtable_info acpi_dm_table_info_wdrt[]; | |
181 | ||
182 | /* | |
183 | * dmtable | |
184 | */ | |
185 | void acpi_dm_dump_data_table(struct acpi_table_header *table); | |
186 | ||
187 | void | |
188 | acpi_dm_dump_table(u32 table_length, | |
189 | u32 table_offset, | |
190 | void *table, | |
191 | u32 sub_table_length, struct acpi_dmtable_info *info); | |
192 | ||
193 | void acpi_dm_line_header(u32 offset, u32 byte_length, char *name); | |
194 | ||
195 | void acpi_dm_line_header2(u32 offset, u32 byte_length, char *name, u32 value); | |
196 | ||
197 | /* | |
198 | * dmtbdump | |
199 | */ | |
200 | void acpi_dm_dump_asf(struct acpi_table_header *table); | |
201 | ||
202 | void acpi_dm_dump_cpep(struct acpi_table_header *table); | |
203 | ||
204 | void acpi_dm_dump_fadt(struct acpi_table_header *table); | |
205 | ||
206 | void acpi_dm_dump_srat(struct acpi_table_header *table); | |
207 | ||
208 | void acpi_dm_dump_mcfg(struct acpi_table_header *table); | |
209 | ||
210 | void acpi_dm_dump_madt(struct acpi_table_header *table); | |
211 | ||
212 | u32 acpi_dm_dump_rsdp(struct acpi_table_header *table); | |
213 | ||
214 | void acpi_dm_dump_rsdt(struct acpi_table_header *table); | |
215 | ||
216 | void acpi_dm_dump_slit(struct acpi_table_header *table); | |
217 | ||
218 | void acpi_dm_dump_xsdt(struct acpi_table_header *table); | |
219 | ||
1da177e4 LT |
220 | /* |
221 | * dmwalk | |
222 | */ | |
1da177e4 | 223 | void |
4be44fcd LB |
224 | acpi_dm_disassemble(struct acpi_walk_state *walk_state, |
225 | union acpi_parse_object *origin, u32 num_opcodes); | |
1da177e4 | 226 | |
8313524a BM |
227 | void |
228 | acpi_dm_walk_parse_tree(union acpi_parse_object *op, | |
229 | asl_walk_callback descending_callback, | |
230 | asl_walk_callback ascending_callback, void *context); | |
231 | ||
44f6c012 RM |
232 | /* |
233 | * dmopcode | |
234 | */ | |
1da177e4 | 235 | void |
4be44fcd LB |
236 | acpi_dm_disassemble_one_op(struct acpi_walk_state *walk_state, |
237 | struct acpi_op_walk_info *info, | |
238 | union acpi_parse_object *op); | |
1da177e4 | 239 | |
4be44fcd | 240 | void acpi_dm_decode_internal_object(union acpi_operand_object *obj_desc); |
1da177e4 | 241 | |
4be44fcd | 242 | u32 acpi_dm_list_type(union acpi_parse_object *op); |
1da177e4 | 243 | |
4be44fcd | 244 | void acpi_dm_method_flags(union acpi_parse_object *op); |
1da177e4 | 245 | |
4be44fcd | 246 | void acpi_dm_field_flags(union acpi_parse_object *op); |
1da177e4 | 247 | |
4be44fcd | 248 | void acpi_dm_address_space(u8 space_id); |
1da177e4 | 249 | |
4be44fcd | 250 | void acpi_dm_region_flags(union acpi_parse_object *op); |
1da177e4 | 251 | |
4be44fcd | 252 | void acpi_dm_match_op(union acpi_parse_object *op); |
1da177e4 | 253 | |
4be44fcd | 254 | u8 acpi_dm_comma_if_list_member(union acpi_parse_object *op); |
1da177e4 | 255 | |
4be44fcd | 256 | void acpi_dm_comma_if_field_member(union acpi_parse_object *op); |
1da177e4 LT |
257 | |
258 | /* | |
44f6c012 | 259 | * dmnames |
1da177e4 | 260 | */ |
4be44fcd | 261 | u32 acpi_dm_dump_name(char *name); |
44f6c012 RM |
262 | |
263 | acpi_status | |
4be44fcd LB |
264 | acpi_ps_display_object_pathname(struct acpi_walk_state *walk_state, |
265 | union acpi_parse_object *op); | |
44f6c012 | 266 | |
4be44fcd | 267 | void acpi_dm_namestring(char *name); |
1da177e4 | 268 | |
44f6c012 RM |
269 | /* |
270 | * dmobject | |
271 | */ | |
1da177e4 | 272 | void |
4be44fcd LB |
273 | acpi_dm_display_internal_object(union acpi_operand_object *obj_desc, |
274 | struct acpi_walk_state *walk_state); | |
1da177e4 | 275 | |
4be44fcd | 276 | void acpi_dm_display_arguments(struct acpi_walk_state *walk_state); |
1da177e4 | 277 | |
4be44fcd | 278 | void acpi_dm_display_locals(struct acpi_walk_state *walk_state); |
1da177e4 LT |
279 | |
280 | void | |
4be44fcd LB |
281 | acpi_dm_dump_method_info(acpi_status status, |
282 | struct acpi_walk_state *walk_state, | |
283 | union acpi_parse_object *op); | |
1da177e4 LT |
284 | |
285 | /* | |
286 | * dmbuffer | |
287 | */ | |
4be44fcd | 288 | void acpi_dm_disasm_byte_list(u32 level, u8 * byte_data, u32 byte_count); |
44f6c012 RM |
289 | |
290 | void | |
4be44fcd | 291 | acpi_dm_byte_list(struct acpi_op_walk_info *info, union acpi_parse_object *op); |
1da177e4 | 292 | |
4be44fcd | 293 | void acpi_dm_is_eisa_id(union acpi_parse_object *op); |
1da177e4 | 294 | |
4be44fcd | 295 | void acpi_dm_eisa_id(u32 encoded_id); |
1da177e4 | 296 | |
4be44fcd | 297 | u8 acpi_dm_is_unicode_buffer(union acpi_parse_object *op); |
1da177e4 | 298 | |
4be44fcd | 299 | u8 acpi_dm_is_string_buffer(union acpi_parse_object *op); |
1da177e4 LT |
300 | |
301 | /* | |
302 | * dmresrc | |
303 | */ | |
0897831b BM |
304 | void acpi_dm_dump_integer8(u8 value, char *name); |
305 | ||
306 | void acpi_dm_dump_integer16(u16 value, char *name); | |
307 | ||
308 | void acpi_dm_dump_integer32(u32 value, char *name); | |
309 | ||
310 | void acpi_dm_dump_integer64(u64 value, char *name); | |
311 | ||
1da177e4 | 312 | void |
0897831b | 313 | acpi_dm_resource_template(struct acpi_op_walk_info *info, |
8313524a | 314 | union acpi_parse_object *op, |
0897831b | 315 | u8 * byte_data, u32 byte_count); |
1da177e4 | 316 | |
0897831b | 317 | u8 acpi_dm_is_resource_template(union acpi_parse_object *op); |
1da177e4 | 318 | |
4be44fcd | 319 | void acpi_dm_indent(u32 level); |
1da177e4 | 320 | |
4be44fcd | 321 | void acpi_dm_bit_list(u16 mask); |
1da177e4 | 322 | |
4be44fcd | 323 | void acpi_dm_decode_attribute(u8 attribute); |
44f6c012 | 324 | |
8313524a BM |
325 | void acpi_dm_descriptor_name(void); |
326 | ||
1da177e4 LT |
327 | /* |
328 | * dmresrcl | |
329 | */ | |
1da177e4 | 330 | void |
50eca3eb | 331 | acpi_dm_word_descriptor(union aml_resource *resource, u32 length, u32 level); |
1da177e4 LT |
332 | |
333 | void | |
50eca3eb | 334 | acpi_dm_dword_descriptor(union aml_resource *resource, u32 length, u32 level); |
1da177e4 LT |
335 | |
336 | void | |
50eca3eb | 337 | acpi_dm_extended_descriptor(union aml_resource *resource, |
4be44fcd | 338 | u32 length, u32 level); |
1da177e4 LT |
339 | |
340 | void | |
50eca3eb | 341 | acpi_dm_qword_descriptor(union aml_resource *resource, u32 length, u32 level); |
1da177e4 LT |
342 | |
343 | void | |
50eca3eb | 344 | acpi_dm_memory24_descriptor(union aml_resource *resource, |
4be44fcd | 345 | u32 length, u32 level); |
1da177e4 LT |
346 | |
347 | void | |
50eca3eb | 348 | acpi_dm_memory32_descriptor(union aml_resource *resource, |
4be44fcd | 349 | u32 length, u32 level); |
1da177e4 LT |
350 | |
351 | void | |
50eca3eb | 352 | acpi_dm_fixed_memory32_descriptor(union aml_resource *resource, |
bda663d3 | 353 | u32 length, u32 level); |
1da177e4 LT |
354 | |
355 | void | |
50eca3eb | 356 | acpi_dm_generic_register_descriptor(union aml_resource *resource, |
4be44fcd | 357 | u32 length, u32 level); |
1da177e4 LT |
358 | |
359 | void | |
50eca3eb | 360 | acpi_dm_interrupt_descriptor(union aml_resource *resource, |
4be44fcd | 361 | u32 length, u32 level); |
1da177e4 LT |
362 | |
363 | void | |
50eca3eb | 364 | acpi_dm_vendor_large_descriptor(union aml_resource *resource, |
4be44fcd | 365 | u32 length, u32 level); |
1da177e4 | 366 | |
0897831b BM |
367 | void acpi_dm_vendor_common(char *name, u8 * byte_data, u32 length, u32 level); |
368 | ||
1da177e4 LT |
369 | /* |
370 | * dmresrcs | |
371 | */ | |
1da177e4 | 372 | void |
50eca3eb | 373 | acpi_dm_irq_descriptor(union aml_resource *resource, u32 length, u32 level); |
1da177e4 LT |
374 | |
375 | void | |
50eca3eb | 376 | acpi_dm_dma_descriptor(union aml_resource *resource, u32 length, u32 level); |
1da177e4 | 377 | |
50eca3eb | 378 | void acpi_dm_io_descriptor(union aml_resource *resource, u32 length, u32 level); |
1da177e4 LT |
379 | |
380 | void | |
50eca3eb | 381 | acpi_dm_fixed_io_descriptor(union aml_resource *resource, |
4be44fcd | 382 | u32 length, u32 level); |
1da177e4 LT |
383 | |
384 | void | |
50eca3eb | 385 | acpi_dm_start_dependent_descriptor(union aml_resource *resource, |
4be44fcd | 386 | u32 length, u32 level); |
1da177e4 LT |
387 | |
388 | void | |
50eca3eb | 389 | acpi_dm_end_dependent_descriptor(union aml_resource *resource, |
4be44fcd | 390 | u32 length, u32 level); |
1da177e4 LT |
391 | |
392 | void | |
50eca3eb | 393 | acpi_dm_vendor_small_descriptor(union aml_resource *resource, |
4be44fcd | 394 | u32 length, u32 level); |
1da177e4 LT |
395 | |
396 | /* | |
397 | * dmutils | |
398 | */ | |
958dd242 | 399 | void acpi_dm_add_to_external_list(char *path, u8 type, u32 value); |
1da177e4 | 400 | |
8313524a BM |
401 | /* |
402 | * dmrestag | |
403 | */ | |
404 | void acpi_dm_find_resources(union acpi_parse_object *root); | |
405 | ||
406 | void | |
407 | acpi_dm_check_resource_reference(union acpi_parse_object *op, | |
408 | struct acpi_walk_state *walk_state); | |
409 | ||
4be44fcd | 410 | #endif /* __ACDISASM_H__ */ |