make oldconfig will rebuild these...
[linux-2.4.21-pre4.git] / drivers / acpi / include / acparser.h
1 /******************************************************************************
2  *
3  * Module Name: acparser.h - AML Parser subcomponent prototypes and defines
4  *       $Revision: 1.1.1.1 $
5  *
6  *****************************************************************************/
7
8 /*
9  *  Copyright (C) 2000, 2001 R. Byron Moore
10  *
11  *  This program is free software; you can redistribute it and/or modify
12  *  it under the terms of the GNU General Public License as published by
13  *  the Free Software Foundation; either version 2 of the License, or
14  *  (at your option) any later version.
15  *
16  *  This program is distributed in the hope that it will be useful,
17  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  *  GNU General Public License for more details.
20  *
21  *  You should have received a copy of the GNU General Public License
22  *  along with this program; if not, write to the Free Software
23  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24  */
25
26
27 #ifndef __ACPARSER_H__
28 #define __ACPARSER_H__
29
30
31 #define OP_HAS_RETURN_VALUE         1
32
33 /* variable # arguments */
34
35 #define ACPI_VAR_ARGS               ACPI_UINT32_MAX
36
37 /* maximum virtual address */
38
39 #define ACPI_MAX_AML                ((u8 *)(~0UL))
40
41
42 #define ACPI_PARSE_DELETE_TREE          0x0001
43 #define ACPI_PARSE_NO_TREE_DELETE       0x0000
44 #define ACPI_PARSE_TREE_MASK            0x0001
45
46 #define ACPI_PARSE_LOAD_PASS1           0x0010
47 #define ACPI_PARSE_LOAD_PASS2           0x0020
48 #define ACPI_PARSE_EXECUTE              0x0030
49 #define ACPI_PARSE_MODE_MASK            0x0030
50
51 /* psapi - Parser external interfaces */
52
53 acpi_status
54 acpi_psx_load_table (
55         u8                      *pcode_addr,
56         u32                     pcode_length);
57
58 acpi_status
59 acpi_psx_execute (
60         acpi_namespace_node     *method_node,
61         acpi_operand_object     **params,
62         acpi_operand_object     **return_obj_desc);
63
64 /******************************************************************************
65  *
66  * Parser interfaces
67  *
68  *****************************************************************************/
69
70
71 /* psargs - Parse AML opcode arguments */
72
73 u8 *
74 acpi_ps_get_next_package_end (
75         acpi_parse_state        *parser_state);
76
77 u32
78 acpi_ps_get_next_package_length (
79         acpi_parse_state        *parser_state);
80
81 NATIVE_CHAR *
82 acpi_ps_get_next_namestring (
83         acpi_parse_state        *parser_state);
84
85 void
86 acpi_ps_get_next_simple_arg (
87         acpi_parse_state        *parser_state,
88         u32                     arg_type,       /* type of argument */
89         acpi_parse_object       *arg);           /* (OUT) argument data */
90
91 void
92 acpi_ps_get_next_namepath (
93         acpi_parse_state        *parser_state,
94         acpi_parse_object       *arg,
95         u32                     *arg_count,
96         u8                      method_call);
97
98 acpi_parse_object *
99 acpi_ps_get_next_field (
100         acpi_parse_state        *parser_state);
101
102 acpi_parse_object *
103 acpi_ps_get_next_arg (
104         acpi_parse_state        *parser_state,
105         u32                     arg_type,
106         u32                     *arg_count);
107
108
109 /* psopcode - AML Opcode information */
110
111 const acpi_opcode_info *
112 acpi_ps_get_opcode_info (
113         u16                     opcode);
114
115 NATIVE_CHAR *
116 acpi_ps_get_opcode_name (
117         u16                     opcode);
118
119
120 /* psparse - top level parsing routines */
121
122 acpi_status
123 acpi_ps_find_object (
124         acpi_walk_state         *walk_state,
125         acpi_parse_object       **out_op);
126
127 void
128 acpi_ps_delete_parse_tree (
129         acpi_parse_object       *root);
130
131 acpi_status
132 acpi_ps_parse_loop (
133         acpi_walk_state         *walk_state);
134
135 acpi_status
136 acpi_ps_parse_aml (
137         acpi_walk_state         *walk_state);
138
139 acpi_status
140 acpi_ps_parse_table (
141         u8                      *aml,
142         u32                     aml_size,
143         acpi_parse_downwards    descending_callback,
144         acpi_parse_upwards      ascending_callback,
145         acpi_parse_object       **root_object);
146
147 u16
148 acpi_ps_peek_opcode (
149         acpi_parse_state        *state);
150
151
152 /* psscope - Scope stack management routines */
153
154
155 acpi_status
156 acpi_ps_init_scope (
157         acpi_parse_state        *parser_state,
158         acpi_parse_object       *root);
159
160 acpi_parse_object *
161 acpi_ps_get_parent_scope (
162         acpi_parse_state        *state);
163
164 u8
165 acpi_ps_has_completed_scope (
166         acpi_parse_state        *parser_state);
167
168 void
169 acpi_ps_pop_scope (
170         acpi_parse_state        *parser_state,
171         acpi_parse_object       **op,
172         u32                     *arg_list,
173         u32                     *arg_count);
174
175 acpi_status
176 acpi_ps_push_scope (
177         acpi_parse_state        *parser_state,
178         acpi_parse_object       *op,
179         u32                     remaining_args,
180         u32                     arg_count);
181
182 void
183 acpi_ps_cleanup_scope (
184         acpi_parse_state        *state);
185
186
187 /* pstree - parse tree manipulation routines */
188
189 void
190 acpi_ps_append_arg(
191         acpi_parse_object       *op,
192         acpi_parse_object       *arg);
193
194 acpi_parse_object*
195 acpi_ps_find (
196         acpi_parse_object       *scope,
197         NATIVE_CHAR             *path,
198         u16                     opcode,
199         u32                     create);
200
201 acpi_parse_object *
202 acpi_ps_get_arg(
203         acpi_parse_object       *op,
204         u32                      argn);
205
206 acpi_parse_object *
207 acpi_ps_get_child (
208         acpi_parse_object       *op);
209
210 acpi_parse_object *
211 acpi_ps_get_depth_next (
212         acpi_parse_object       *origin,
213         acpi_parse_object       *op);
214
215
216 /* pswalk - parse tree walk routines */
217
218 acpi_status
219 acpi_ps_walk_parsed_aml (
220         acpi_parse_object       *start_op,
221         acpi_parse_object       *end_op,
222         acpi_operand_object     *mth_desc,
223         acpi_namespace_node     *start_node,
224         acpi_operand_object     **params,
225         acpi_operand_object     **caller_return_desc,
226         acpi_owner_id           owner_id,
227         acpi_parse_downwards    descending_callback,
228         acpi_parse_upwards      ascending_callback);
229
230 acpi_status
231 acpi_ps_get_next_walk_op (
232         acpi_walk_state         *walk_state,
233         acpi_parse_object       *op,
234         acpi_parse_upwards      ascending_callback);
235
236
237 /* psutils - parser utilities */
238
239 void
240 acpi_ps_init_op (
241         acpi_parse_object       *op,
242         u16                     opcode);
243
244 acpi_parse_object *
245 acpi_ps_alloc_op (
246         u16                     opcode);
247
248 void
249 acpi_ps_free_op (
250         acpi_parse_object       *op);
251
252 void
253 acpi_ps_delete_parse_cache (
254         void);
255
256 u8
257 acpi_ps_is_leading_char (
258         u32                     c);
259
260 u8
261 acpi_ps_is_prefix_char (
262         u32                     c);
263
264 u32
265 acpi_ps_get_name(
266         acpi_parse_object       *op);
267
268 void
269 acpi_ps_set_name(
270         acpi_parse_object       *op,
271         u32                     name);
272
273
274 /* psdump - display parser tree */
275
276 u32
277 acpi_ps_sprint_path (
278         NATIVE_CHAR             *buffer_start,
279         u32                     buffer_size,
280         acpi_parse_object       *op);
281
282 u32
283 acpi_ps_sprint_op (
284         NATIVE_CHAR             *buffer_start,
285         u32                     buffer_size,
286         acpi_parse_object       *op);
287
288 void
289 acpi_ps_show (
290         acpi_parse_object       *op);
291
292
293 #endif /* __ACPARSER_H__ */