blob: 0727c132bd3c8096d9f887141283d7d75f93e148 [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
53
Len Brown4be44fc2005-08-05 00:44:28 -040054struct acpi_external_list {
55 char *path;
56 struct acpi_external_list *next;
Linus Torvalds1da177e2005-04-16 15:20:36 -070057};
58
Len Brown4be44fc2005-08-05 00:44:28 -040059extern struct acpi_external_list *acpi_gbl_external_list;
Linus Torvalds1da177e2005-04-16 15:20:36 -070060
Bob Mooredefba1d2005-12-16 17:05:00 -050061/* Strings used for decoding flags to ASL keywords */
62
63extern const char *acpi_gbl_word_decode[4];
64extern const char *acpi_gbl_irq_decode[2];
Len Brown4be44fc2005-08-05 00:44:28 -040065extern const char *acpi_gbl_lock_rule[ACPI_NUM_LOCK_RULES];
66extern const char *acpi_gbl_access_types[ACPI_NUM_ACCESS_TYPES];
67extern const char *acpi_gbl_update_rules[ACPI_NUM_UPDATE_RULES];
68extern const char *acpi_gbl_match_ops[ACPI_NUM_MATCH_OPS];
Linus Torvalds1da177e2005-04-16 15:20:36 -070069
Len Brown4be44fc2005-08-05 00:44:28 -040070struct acpi_op_walk_info {
71 u32 level;
72 u32 bit_offset;
Bob Moore52fc0b02006-10-02 00:00:00 -040073 u32 flags;
Len Brown4be44fc2005-08-05 00:44:28 -040074 struct acpi_walk_state *walk_state;
Linus Torvalds1da177e2005-04-16 15:20:36 -070075};
76
77typedef
Len Brown4be44fc2005-08-05 00:44:28 -040078acpi_status(*asl_walk_callback) (union acpi_parse_object * op,
79 u32 level, void *context);
Linus Torvalds1da177e2005-04-16 15:20:36 -070080
81/*
82 * dmwalk
83 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070084void
Len Brown4be44fc2005-08-05 00:44:28 -040085acpi_dm_disassemble(struct acpi_walk_state *walk_state,
86 union acpi_parse_object *origin, u32 num_opcodes);
Linus Torvalds1da177e2005-04-16 15:20:36 -070087
Robert Moore44f6c012005-04-18 22:49:35 -040088/*
89 * dmopcode
90 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070091void
Len Brown4be44fc2005-08-05 00:44:28 -040092acpi_dm_disassemble_one_op(struct acpi_walk_state *walk_state,
93 struct acpi_op_walk_info *info,
94 union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -070095
Len Brown4be44fc2005-08-05 00:44:28 -040096void acpi_dm_decode_internal_object(union acpi_operand_object *obj_desc);
Linus Torvalds1da177e2005-04-16 15:20:36 -070097
Len Brown4be44fc2005-08-05 00:44:28 -040098u32 acpi_dm_list_type(union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -070099
Len Brown4be44fc2005-08-05 00:44:28 -0400100void acpi_dm_method_flags(union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101
Len Brown4be44fc2005-08-05 00:44:28 -0400102void acpi_dm_field_flags(union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103
Len Brown4be44fc2005-08-05 00:44:28 -0400104void acpi_dm_address_space(u8 space_id);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105
Len Brown4be44fc2005-08-05 00:44:28 -0400106void acpi_dm_region_flags(union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107
Len Brown4be44fc2005-08-05 00:44:28 -0400108void acpi_dm_match_op(union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109
Len Brown4be44fc2005-08-05 00:44:28 -0400110u8 acpi_dm_comma_if_list_member(union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111
Len Brown4be44fc2005-08-05 00:44:28 -0400112void acpi_dm_comma_if_field_member(union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700113
114/*
Robert Moore44f6c012005-04-18 22:49:35 -0400115 * dmnames
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116 */
Len Brown4be44fc2005-08-05 00:44:28 -0400117u32 acpi_dm_dump_name(char *name);
Robert Moore44f6c012005-04-18 22:49:35 -0400118
119acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400120acpi_ps_display_object_pathname(struct acpi_walk_state *walk_state,
121 union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122
Len Brown4be44fc2005-08-05 00:44:28 -0400123void acpi_dm_namestring(char *name);
Robert Moore44f6c012005-04-18 22:49:35 -0400124
125/*
126 * dmobject
127 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700128void
Len Brown4be44fc2005-08-05 00:44:28 -0400129acpi_dm_display_internal_object(union acpi_operand_object *obj_desc,
130 struct acpi_walk_state *walk_state);
131
132void acpi_dm_display_arguments(struct acpi_walk_state *walk_state);
133
134void acpi_dm_display_locals(struct acpi_walk_state *walk_state);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135
136void
Len Brown4be44fc2005-08-05 00:44:28 -0400137acpi_dm_dump_method_info(acpi_status status,
138 struct acpi_walk_state *walk_state,
139 union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700140
141/*
142 * dmbuffer
143 */
Len Brown4be44fc2005-08-05 00:44:28 -0400144void acpi_dm_disasm_byte_list(u32 level, u8 * byte_data, u32 byte_count);
Robert Moore44f6c012005-04-18 22:49:35 -0400145
146void
Len Brown4be44fc2005-08-05 00:44:28 -0400147acpi_dm_byte_list(struct acpi_op_walk_info *info, union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148
Len Brown4be44fc2005-08-05 00:44:28 -0400149void acpi_dm_is_eisa_id(union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150
Len Brown4be44fc2005-08-05 00:44:28 -0400151void acpi_dm_eisa_id(u32 encoded_id);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152
Len Brown4be44fc2005-08-05 00:44:28 -0400153u8 acpi_dm_is_unicode_buffer(union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154
Len Brown4be44fc2005-08-05 00:44:28 -0400155u8 acpi_dm_is_string_buffer(union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156
157/*
158 * dmresrc
159 */
Bob Moore08978312005-10-21 00:00:00 -0400160void acpi_dm_dump_integer8(u8 value, char *name);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700161
Bob Moore08978312005-10-21 00:00:00 -0400162void acpi_dm_dump_integer16(u16 value, char *name);
163
164void acpi_dm_dump_integer32(u32 value, char *name);
165
166void acpi_dm_dump_integer64(u64 value, char *name);
167
168void
169acpi_dm_resource_template(struct acpi_op_walk_info *info,
170 u8 * byte_data, u32 byte_count);
171
172u8 acpi_dm_is_resource_template(union acpi_parse_object *op);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700173
Len Brown4be44fc2005-08-05 00:44:28 -0400174void acpi_dm_indent(u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175
Len Brown4be44fc2005-08-05 00:44:28 -0400176void acpi_dm_bit_list(u16 mask);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700177
Len Brown4be44fc2005-08-05 00:44:28 -0400178void acpi_dm_decode_attribute(u8 attribute);
Robert Moore44f6c012005-04-18 22:49:35 -0400179
Linus Torvalds1da177e2005-04-16 15:20:36 -0700180/*
181 * dmresrcl
182 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700183void
Bob Moore50eca3e2005-09-30 19:03:00 -0400184acpi_dm_word_descriptor(union aml_resource *resource, u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185
186void
Bob Moore50eca3e2005-09-30 19:03:00 -0400187acpi_dm_dword_descriptor(union aml_resource *resource, u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188
189void
Bob Moore50eca3e2005-09-30 19:03:00 -0400190acpi_dm_extended_descriptor(union aml_resource *resource,
Len Brown4be44fc2005-08-05 00:44:28 -0400191 u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700192
193void
Bob Moore50eca3e2005-09-30 19:03:00 -0400194acpi_dm_qword_descriptor(union aml_resource *resource, u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700195
196void
Bob Moore50eca3e2005-09-30 19:03:00 -0400197acpi_dm_memory24_descriptor(union aml_resource *resource,
Len Brown4be44fc2005-08-05 00:44:28 -0400198 u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700199
200void
Bob Moore50eca3e2005-09-30 19:03:00 -0400201acpi_dm_memory32_descriptor(union aml_resource *resource,
Len Brown4be44fc2005-08-05 00:44:28 -0400202 u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700203
204void
Bob Moore50eca3e2005-09-30 19:03:00 -0400205acpi_dm_fixed_memory32_descriptor(union aml_resource *resource,
Robert Moorebda663d2005-09-16 16:51:15 -0400206 u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700207
208void
Bob Moore50eca3e2005-09-30 19:03:00 -0400209acpi_dm_generic_register_descriptor(union aml_resource *resource,
Len Brown4be44fc2005-08-05 00:44:28 -0400210 u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700211
212void
Bob Moore50eca3e2005-09-30 19:03:00 -0400213acpi_dm_interrupt_descriptor(union aml_resource *resource,
Len Brown4be44fc2005-08-05 00:44:28 -0400214 u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700215
216void
Bob Moore50eca3e2005-09-30 19:03:00 -0400217acpi_dm_vendor_large_descriptor(union aml_resource *resource,
Len Brown4be44fc2005-08-05 00:44:28 -0400218 u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700219
Bob Moore08978312005-10-21 00:00:00 -0400220void acpi_dm_vendor_common(char *name, u8 * byte_data, u32 length, u32 level);
221
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222/*
223 * dmresrcs
224 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700225void
Bob Moore50eca3e2005-09-30 19:03:00 -0400226acpi_dm_irq_descriptor(union aml_resource *resource, u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700227
228void
Bob Moore50eca3e2005-09-30 19:03:00 -0400229acpi_dm_dma_descriptor(union aml_resource *resource, u32 length, u32 level);
230
231void acpi_dm_io_descriptor(union aml_resource *resource, u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700232
233void
Bob Moore50eca3e2005-09-30 19:03:00 -0400234acpi_dm_fixed_io_descriptor(union aml_resource *resource,
Len Brown4be44fc2005-08-05 00:44:28 -0400235 u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700236
237void
Bob Moore50eca3e2005-09-30 19:03:00 -0400238acpi_dm_start_dependent_descriptor(union aml_resource *resource,
Len Brown4be44fc2005-08-05 00:44:28 -0400239 u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700240
241void
Bob Moore50eca3e2005-09-30 19:03:00 -0400242acpi_dm_end_dependent_descriptor(union aml_resource *resource,
Len Brown4be44fc2005-08-05 00:44:28 -0400243 u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700244
245void
Bob Moore50eca3e2005-09-30 19:03:00 -0400246acpi_dm_vendor_small_descriptor(union aml_resource *resource,
Len Brown4be44fc2005-08-05 00:44:28 -0400247 u32 length, u32 level);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700248
249/*
250 * dmutils
251 */
Len Brown4be44fc2005-08-05 00:44:28 -0400252void acpi_dm_add_to_external_list(char *path);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700253
Len Brown4be44fc2005-08-05 00:44:28 -0400254#endif /* __ACDISASM_H__ */