blob: f004461a7753f5baefcc5b885ff2a6e767322b3d [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/******************************************************************************
2 *
3 * Name: acdisasm.h - AML disassembler
4 *
5 *****************************************************************************/
6
7/*
Bob Moore4a90c7e2006-01-13 16:22:00 -05008 * Copyright (C) 2000 - 2006, R. Byron Moore
Linus Torvalds1da177e2005-04-16 15:20:36 -07009 * 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
Linus Torvalds1da177e2005-04-16 15:20:36 -070049#define BLOCK_NONE 0
50#define BLOCK_PAREN 1
51#define BLOCK_BRACE 2
52#define BLOCK_COMMA_LIST 4
Bob Moore83135242006-10-03 00:00:00 -040053#define ACPI_DEFAULT_RESNAME *(u32 *) "__RD"
Linus Torvalds1da177e2005-04-16 15:20:36 -070054
Len Brown4be44fc2005-08-05 00:44:28 -040055struct acpi_external_list {
56 char *path;
57 struct acpi_external_list *next;
Linus Torvalds1da177e2005-04-16 15:20:36 -070058};
59
Len Brown4be44fc2005-08-05 00:44:28 -040060extern struct acpi_external_list *acpi_gbl_external_list;
Linus Torvalds1da177e2005-04-16 15:20:36 -070061
Bob Mooredefba1d2005-12-16 17:05:00 -050062/* Strings used for decoding flags to ASL keywords */
63
64extern const char *acpi_gbl_word_decode[4];
65extern const char *acpi_gbl_irq_decode[2];
Len Brown4be44fc2005-08-05 00:44:28 -040066extern const char *acpi_gbl_lock_rule[ACPI_NUM_LOCK_RULES];
67extern const char *acpi_gbl_access_types[ACPI_NUM_ACCESS_TYPES];
68extern const char *acpi_gbl_update_rules[ACPI_NUM_UPDATE_RULES];
69extern const char *acpi_gbl_match_ops[ACPI_NUM_MATCH_OPS];
Linus Torvalds1da177e2005-04-16 15:20:36 -070070
Len Brown4be44fc2005-08-05 00:44:28 -040071struct acpi_op_walk_info {
72 u32 level;
73 u32 bit_offset;
Bob Moore52fc0b02006-10-02 00:00:00 -040074 u32 flags;
Len Brown4be44fc2005-08-05 00:44:28 -040075 struct acpi_walk_state *walk_state;
Linus Torvalds1da177e2005-04-16 15:20:36 -070076};
77
78typedef
Len Brown4be44fc2005-08-05 00:44:28 -040079acpi_status(*asl_walk_callback) (union acpi_parse_object * op,
80 u32 level, void *context);
Linus Torvalds1da177e2005-04-16 15:20:36 -070081
Bob Moore83135242006-10-03 00:00:00 -040082struct acpi_resource_tag {
83 u32 bit_index;
84 char *tag;
85};
86
Linus Torvalds1da177e2005-04-16 15:20:36 -070087/*
88 * dmwalk
89 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070090void
Len Brown4be44fc2005-08-05 00:44:28 -040091acpi_dm_disassemble(struct acpi_walk_state *walk_state,
92 union acpi_parse_object *origin, u32 num_opcodes);
Linus Torvalds1da177e2005-04-16 15:20:36 -070093
Bob Moore83135242006-10-03 00:00:00 -040094void
95acpi_dm_walk_parse_tree(union acpi_parse_object *op,
96 asl_walk_callback descending_callback,
97 asl_walk_callback ascending_callback, void *context);
98
Robert Moore44f6c012005-04-18 22:49:35 -040099/*
100 * dmopcode
101 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102void
Len Brown4be44fc2005-08-05 00:44:28 -0400103acpi_dm_disassemble_one_op(struct acpi_walk_state *walk_state,
104 struct acpi_op_walk_info *info,
105 union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106
Len Brown4be44fc2005-08-05 00:44:28 -0400107void acpi_dm_decode_internal_object(union acpi_operand_object *obj_desc);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108
Len Brown4be44fc2005-08-05 00:44:28 -0400109u32 acpi_dm_list_type(union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110
Len Brown4be44fc2005-08-05 00:44:28 -0400111void acpi_dm_method_flags(union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112
Len Brown4be44fc2005-08-05 00:44:28 -0400113void acpi_dm_field_flags(union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114
Len Brown4be44fc2005-08-05 00:44:28 -0400115void acpi_dm_address_space(u8 space_id);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116
Len Brown4be44fc2005-08-05 00:44:28 -0400117void acpi_dm_region_flags(union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118
Len Brown4be44fc2005-08-05 00:44:28 -0400119void acpi_dm_match_op(union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120
Len Brown4be44fc2005-08-05 00:44:28 -0400121u8 acpi_dm_comma_if_list_member(union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122
Len Brown4be44fc2005-08-05 00:44:28 -0400123void acpi_dm_comma_if_field_member(union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124
125/*
Robert Moore44f6c012005-04-18 22:49:35 -0400126 * dmnames
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127 */
Len Brown4be44fc2005-08-05 00:44:28 -0400128u32 acpi_dm_dump_name(char *name);
Robert Moore44f6c012005-04-18 22:49:35 -0400129
130acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400131acpi_ps_display_object_pathname(struct acpi_walk_state *walk_state,
132 union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133
Len Brown4be44fc2005-08-05 00:44:28 -0400134void acpi_dm_namestring(char *name);
Robert Moore44f6c012005-04-18 22:49:35 -0400135
136/*
137 * dmobject
138 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700139void
Len Brown4be44fc2005-08-05 00:44:28 -0400140acpi_dm_display_internal_object(union acpi_operand_object *obj_desc,
141 struct acpi_walk_state *walk_state);
142
143void acpi_dm_display_arguments(struct acpi_walk_state *walk_state);
144
145void acpi_dm_display_locals(struct acpi_walk_state *walk_state);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146
147void
Len Brown4be44fc2005-08-05 00:44:28 -0400148acpi_dm_dump_method_info(acpi_status status,
149 struct acpi_walk_state *walk_state,
150 union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151
152/*
153 * dmbuffer
154 */
Len Brown4be44fc2005-08-05 00:44:28 -0400155void acpi_dm_disasm_byte_list(u32 level, u8 * byte_data, u32 byte_count);
Robert Moore44f6c012005-04-18 22:49:35 -0400156
157void
Len Brown4be44fc2005-08-05 00:44:28 -0400158acpi_dm_byte_list(struct acpi_op_walk_info *info, union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700159
Len Brown4be44fc2005-08-05 00:44:28 -0400160void acpi_dm_is_eisa_id(union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700161
Len Brown4be44fc2005-08-05 00:44:28 -0400162void acpi_dm_eisa_id(u32 encoded_id);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163
Len Brown4be44fc2005-08-05 00:44:28 -0400164u8 acpi_dm_is_unicode_buffer(union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700165
Len Brown4be44fc2005-08-05 00:44:28 -0400166u8 acpi_dm_is_string_buffer(union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167
168/*
169 * dmresrc
170 */
Bob Moore08978312005-10-21 00:00:00 -0400171void acpi_dm_dump_integer8(u8 value, char *name);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700172
Bob Moore08978312005-10-21 00:00:00 -0400173void acpi_dm_dump_integer16(u16 value, char *name);
174
175void acpi_dm_dump_integer32(u32 value, char *name);
176
177void acpi_dm_dump_integer64(u64 value, char *name);
178
179void
180acpi_dm_resource_template(struct acpi_op_walk_info *info,
Bob Moore83135242006-10-03 00:00:00 -0400181 union acpi_parse_object *op,
Bob Moore08978312005-10-21 00:00:00 -0400182 u8 * byte_data, u32 byte_count);
183
184u8 acpi_dm_is_resource_template(union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185
Len Brown4be44fc2005-08-05 00:44:28 -0400186void acpi_dm_indent(u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700187
Len Brown4be44fc2005-08-05 00:44:28 -0400188void acpi_dm_bit_list(u16 mask);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700189
Len Brown4be44fc2005-08-05 00:44:28 -0400190void acpi_dm_decode_attribute(u8 attribute);
Robert Moore44f6c012005-04-18 22:49:35 -0400191
Bob Moore83135242006-10-03 00:00:00 -0400192void acpi_dm_descriptor_name(void);
193
Linus Torvalds1da177e2005-04-16 15:20:36 -0700194/*
195 * dmresrcl
196 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700197void
Bob Moore50eca3e2005-09-30 19:03:00 -0400198acpi_dm_word_descriptor(union aml_resource *resource, u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700199
200void
Bob Moore50eca3e2005-09-30 19:03:00 -0400201acpi_dm_dword_descriptor(union aml_resource *resource, u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700202
203void
Bob Moore50eca3e2005-09-30 19:03:00 -0400204acpi_dm_extended_descriptor(union aml_resource *resource,
Len Brown4be44fc2005-08-05 00:44:28 -0400205 u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700206
207void
Bob Moore50eca3e2005-09-30 19:03:00 -0400208acpi_dm_qword_descriptor(union aml_resource *resource, u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700209
210void
Bob Moore50eca3e2005-09-30 19:03:00 -0400211acpi_dm_memory24_descriptor(union aml_resource *resource,
Len Brown4be44fc2005-08-05 00:44:28 -0400212 u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700213
214void
Bob Moore50eca3e2005-09-30 19:03:00 -0400215acpi_dm_memory32_descriptor(union aml_resource *resource,
Len Brown4be44fc2005-08-05 00:44:28 -0400216 u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700217
218void
Bob Moore50eca3e2005-09-30 19:03:00 -0400219acpi_dm_fixed_memory32_descriptor(union aml_resource *resource,
Robert Moorebda663d2005-09-16 16:51:15 -0400220 u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700221
222void
Bob Moore50eca3e2005-09-30 19:03:00 -0400223acpi_dm_generic_register_descriptor(union aml_resource *resource,
Len Brown4be44fc2005-08-05 00:44:28 -0400224 u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700225
226void
Bob Moore50eca3e2005-09-30 19:03:00 -0400227acpi_dm_interrupt_descriptor(union aml_resource *resource,
Len Brown4be44fc2005-08-05 00:44:28 -0400228 u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229
230void
Bob Moore50eca3e2005-09-30 19:03:00 -0400231acpi_dm_vendor_large_descriptor(union aml_resource *resource,
Len Brown4be44fc2005-08-05 00:44:28 -0400232 u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233
Bob Moore08978312005-10-21 00:00:00 -0400234void acpi_dm_vendor_common(char *name, u8 * byte_data, u32 length, u32 level);
235
Linus Torvalds1da177e2005-04-16 15:20:36 -0700236/*
237 * dmresrcs
238 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239void
Bob Moore50eca3e2005-09-30 19:03:00 -0400240acpi_dm_irq_descriptor(union aml_resource *resource, u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700241
242void
Bob Moore50eca3e2005-09-30 19:03:00 -0400243acpi_dm_dma_descriptor(union aml_resource *resource, u32 length, u32 level);
244
245void acpi_dm_io_descriptor(union aml_resource *resource, u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700246
247void
Bob Moore50eca3e2005-09-30 19:03:00 -0400248acpi_dm_fixed_io_descriptor(union aml_resource *resource,
Len Brown4be44fc2005-08-05 00:44:28 -0400249 u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700250
251void
Bob Moore50eca3e2005-09-30 19:03:00 -0400252acpi_dm_start_dependent_descriptor(union aml_resource *resource,
Len Brown4be44fc2005-08-05 00:44:28 -0400253 u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700254
255void
Bob Moore50eca3e2005-09-30 19:03:00 -0400256acpi_dm_end_dependent_descriptor(union aml_resource *resource,
Len Brown4be44fc2005-08-05 00:44:28 -0400257 u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700258
259void
Bob Moore50eca3e2005-09-30 19:03:00 -0400260acpi_dm_vendor_small_descriptor(union aml_resource *resource,
Len Brown4be44fc2005-08-05 00:44:28 -0400261 u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700262
263/*
264 * dmutils
265 */
Len Brown4be44fc2005-08-05 00:44:28 -0400266void acpi_dm_add_to_external_list(char *path);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700267
Bob Moore83135242006-10-03 00:00:00 -0400268/*
269 * dmrestag
270 */
271void acpi_dm_find_resources(union acpi_parse_object *root);
272
273void
274acpi_dm_check_resource_reference(union acpi_parse_object *op,
275 struct acpi_walk_state *walk_state);
276
Len Brown4be44fc2005-08-05 00:44:28 -0400277#endif /* __ACDISASM_H__ */