diff options
Diffstat (limited to 'include/acpi/acparser.h')
-rw-r--r-- | include/acpi/acparser.h | 351 |
1 files changed, 351 insertions, 0 deletions
diff --git a/include/acpi/acparser.h b/include/acpi/acparser.h new file mode 100644 index 000000000000..c0395ef2b0d0 --- /dev/null +++ b/include/acpi/acparser.h | |||
@@ -0,0 +1,351 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Module Name: acparser.h - AML Parser subcomponent prototypes and defines | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | ||
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 | |||
45 | #ifndef __ACPARSER_H__ | ||
46 | #define __ACPARSER_H__ | ||
47 | |||
48 | |||
49 | #define OP_HAS_RETURN_VALUE 1 | ||
50 | |||
51 | /* variable # arguments */ | ||
52 | |||
53 | #define ACPI_VAR_ARGS ACPI_UINT32_MAX | ||
54 | |||
55 | |||
56 | #define ACPI_PARSE_DELETE_TREE 0x0001 | ||
57 | #define ACPI_PARSE_NO_TREE_DELETE 0x0000 | ||
58 | #define ACPI_PARSE_TREE_MASK 0x0001 | ||
59 | |||
60 | #define ACPI_PARSE_LOAD_PASS1 0x0010 | ||
61 | #define ACPI_PARSE_LOAD_PASS2 0x0020 | ||
62 | #define ACPI_PARSE_EXECUTE 0x0030 | ||
63 | #define ACPI_PARSE_MODE_MASK 0x0030 | ||
64 | |||
65 | #define ACPI_PARSE_DEFERRED_OP 0x0100 | ||
66 | |||
67 | /* Parser external interfaces */ | ||
68 | |||
69 | acpi_status | ||
70 | acpi_psx_load_table ( | ||
71 | u8 *pcode_addr, | ||
72 | u32 pcode_length); | ||
73 | |||
74 | acpi_status | ||
75 | acpi_psx_execute ( | ||
76 | struct acpi_parameter_info *info); | ||
77 | |||
78 | |||
79 | /****************************************************************************** | ||
80 | * | ||
81 | * Parser interfaces | ||
82 | * | ||
83 | *****************************************************************************/ | ||
84 | |||
85 | |||
86 | /* psargs - Parse AML opcode arguments */ | ||
87 | |||
88 | u8 * | ||
89 | acpi_ps_get_next_package_end ( | ||
90 | struct acpi_parse_state *parser_state); | ||
91 | |||
92 | u32 | ||
93 | acpi_ps_get_next_package_length ( | ||
94 | struct acpi_parse_state *parser_state); | ||
95 | |||
96 | char * | ||
97 | acpi_ps_get_next_namestring ( | ||
98 | struct acpi_parse_state *parser_state); | ||
99 | |||
100 | void | ||
101 | acpi_ps_get_next_simple_arg ( | ||
102 | struct acpi_parse_state *parser_state, | ||
103 | u32 arg_type, | ||
104 | union acpi_parse_object *arg); | ||
105 | |||
106 | acpi_status | ||
107 | acpi_ps_get_next_namepath ( | ||
108 | struct acpi_walk_state *walk_state, | ||
109 | struct acpi_parse_state *parser_state, | ||
110 | union acpi_parse_object *arg, | ||
111 | u8 method_call); | ||
112 | |||
113 | union acpi_parse_object * | ||
114 | acpi_ps_get_next_field ( | ||
115 | struct acpi_parse_state *parser_state); | ||
116 | |||
117 | acpi_status | ||
118 | acpi_ps_get_next_arg ( | ||
119 | struct acpi_walk_state *walk_state, | ||
120 | struct acpi_parse_state *parser_state, | ||
121 | u32 arg_type, | ||
122 | union acpi_parse_object **return_arg); | ||
123 | |||
124 | |||
125 | /* psfind */ | ||
126 | |||
127 | union acpi_parse_object * | ||
128 | acpi_ps_find_name ( | ||
129 | union acpi_parse_object *scope, | ||
130 | u32 name, | ||
131 | u32 opcode); | ||
132 | |||
133 | union acpi_parse_object* | ||
134 | acpi_ps_get_parent ( | ||
135 | union acpi_parse_object *op); | ||
136 | |||
137 | |||
138 | /* psopcode - AML Opcode information */ | ||
139 | |||
140 | const struct acpi_opcode_info * | ||
141 | acpi_ps_get_opcode_info ( | ||
142 | u16 opcode); | ||
143 | |||
144 | char * | ||
145 | acpi_ps_get_opcode_name ( | ||
146 | u16 opcode); | ||
147 | |||
148 | |||
149 | /* psparse - top level parsing routines */ | ||
150 | |||
151 | u32 | ||
152 | acpi_ps_get_opcode_size ( | ||
153 | u32 opcode); | ||
154 | |||
155 | void | ||
156 | acpi_ps_complete_this_op ( | ||
157 | struct acpi_walk_state *walk_state, | ||
158 | union acpi_parse_object *op); | ||
159 | |||
160 | acpi_status | ||
161 | acpi_ps_next_parse_state ( | ||
162 | struct acpi_walk_state *walk_state, | ||
163 | union acpi_parse_object *op, | ||
164 | acpi_status callback_status); | ||
165 | |||
166 | acpi_status | ||
167 | acpi_ps_find_object ( | ||
168 | struct acpi_walk_state *walk_state, | ||
169 | union acpi_parse_object **out_op); | ||
170 | |||
171 | void | ||
172 | acpi_ps_delete_parse_tree ( | ||
173 | union acpi_parse_object *root); | ||
174 | |||
175 | acpi_status | ||
176 | acpi_ps_parse_loop ( | ||
177 | struct acpi_walk_state *walk_state); | ||
178 | |||
179 | acpi_status | ||
180 | acpi_ps_parse_aml ( | ||
181 | struct acpi_walk_state *walk_state); | ||
182 | |||
183 | acpi_status | ||
184 | acpi_ps_parse_table ( | ||
185 | u8 *aml, | ||
186 | u32 aml_size, | ||
187 | acpi_parse_downwards descending_callback, | ||
188 | acpi_parse_upwards ascending_callback, | ||
189 | union acpi_parse_object **root_object); | ||
190 | |||
191 | u16 | ||
192 | acpi_ps_peek_opcode ( | ||
193 | struct acpi_parse_state *state); | ||
194 | |||
195 | |||
196 | /* psscope - Scope stack management routines */ | ||
197 | |||
198 | |||
199 | acpi_status | ||
200 | acpi_ps_init_scope ( | ||
201 | struct acpi_parse_state *parser_state, | ||
202 | union acpi_parse_object *root); | ||
203 | |||
204 | union acpi_parse_object * | ||
205 | acpi_ps_get_parent_scope ( | ||
206 | struct acpi_parse_state *state); | ||
207 | |||
208 | u8 | ||
209 | acpi_ps_has_completed_scope ( | ||
210 | struct acpi_parse_state *parser_state); | ||
211 | |||
212 | void | ||
213 | acpi_ps_pop_scope ( | ||
214 | struct acpi_parse_state *parser_state, | ||
215 | union acpi_parse_object **op, | ||
216 | u32 *arg_list, | ||
217 | u32 *arg_count); | ||
218 | |||
219 | acpi_status | ||
220 | acpi_ps_push_scope ( | ||
221 | struct acpi_parse_state *parser_state, | ||
222 | union acpi_parse_object *op, | ||
223 | u32 remaining_args, | ||
224 | u32 arg_count); | ||
225 | |||
226 | void | ||
227 | acpi_ps_cleanup_scope ( | ||
228 | struct acpi_parse_state *state); | ||
229 | |||
230 | |||
231 | /* pstree - parse tree manipulation routines */ | ||
232 | |||
233 | void | ||
234 | acpi_ps_append_arg( | ||
235 | union acpi_parse_object *op, | ||
236 | union acpi_parse_object *arg); | ||
237 | |||
238 | union acpi_parse_object* | ||
239 | acpi_ps_find ( | ||
240 | union acpi_parse_object *scope, | ||
241 | char *path, | ||
242 | u16 opcode, | ||
243 | u32 create); | ||
244 | |||
245 | union acpi_parse_object * | ||
246 | acpi_ps_get_arg( | ||
247 | union acpi_parse_object *op, | ||
248 | u32 argn); | ||
249 | |||
250 | #ifdef ACPI_FUTURE_USAGE | ||
251 | union acpi_parse_object * | ||
252 | acpi_ps_get_child ( | ||
253 | union acpi_parse_object *op); | ||
254 | |||
255 | union acpi_parse_object * | ||
256 | acpi_ps_get_depth_next ( | ||
257 | union acpi_parse_object *origin, | ||
258 | union acpi_parse_object *op); | ||
259 | #endif /* ACPI_FUTURE_USAGE */ | ||
260 | |||
261 | |||
262 | /* pswalk - parse tree walk routines */ | ||
263 | |||
264 | acpi_status | ||
265 | acpi_ps_walk_parsed_aml ( | ||
266 | union acpi_parse_object *start_op, | ||
267 | union acpi_parse_object *end_op, | ||
268 | union acpi_operand_object *mth_desc, | ||
269 | struct acpi_namespace_node *start_node, | ||
270 | union acpi_operand_object **params, | ||
271 | union acpi_operand_object **caller_return_desc, | ||
272 | acpi_owner_id owner_id, | ||
273 | acpi_parse_downwards descending_callback, | ||
274 | acpi_parse_upwards ascending_callback); | ||
275 | |||
276 | acpi_status | ||
277 | acpi_ps_get_next_walk_op ( | ||
278 | struct acpi_walk_state *walk_state, | ||
279 | union acpi_parse_object *op, | ||
280 | acpi_parse_upwards ascending_callback); | ||
281 | |||
282 | acpi_status | ||
283 | acpi_ps_delete_completed_op ( | ||
284 | struct acpi_walk_state *walk_state); | ||
285 | |||
286 | |||
287 | /* psutils - parser utilities */ | ||
288 | |||
289 | union acpi_parse_object * | ||
290 | acpi_ps_create_scope_op ( | ||
291 | void); | ||
292 | |||
293 | void | ||
294 | acpi_ps_init_op ( | ||
295 | union acpi_parse_object *op, | ||
296 | u16 opcode); | ||
297 | |||
298 | union acpi_parse_object * | ||
299 | acpi_ps_alloc_op ( | ||
300 | u16 opcode); | ||
301 | |||
302 | void | ||
303 | acpi_ps_free_op ( | ||
304 | union acpi_parse_object *op); | ||
305 | |||
306 | #ifdef ACPI_ENABLE_OBJECT_CACHE | ||
307 | void | ||
308 | acpi_ps_delete_parse_cache ( | ||
309 | void); | ||
310 | #endif | ||
311 | |||
312 | u8 | ||
313 | acpi_ps_is_leading_char ( | ||
314 | u32 c); | ||
315 | |||
316 | u8 | ||
317 | acpi_ps_is_prefix_char ( | ||
318 | u32 c); | ||
319 | |||
320 | #ifdef ACPI_FUTURE_USAGE | ||
321 | u32 | ||
322 | acpi_ps_get_name( | ||
323 | union acpi_parse_object *op); | ||
324 | #endif | ||
325 | |||
326 | void | ||
327 | acpi_ps_set_name( | ||
328 | union acpi_parse_object *op, | ||
329 | u32 name); | ||
330 | |||
331 | |||
332 | /* psdump - display parser tree */ | ||
333 | |||
334 | u32 | ||
335 | acpi_ps_sprint_path ( | ||
336 | char *buffer_start, | ||
337 | u32 buffer_size, | ||
338 | union acpi_parse_object *op); | ||
339 | |||
340 | u32 | ||
341 | acpi_ps_sprint_op ( | ||
342 | char *buffer_start, | ||
343 | u32 buffer_size, | ||
344 | union acpi_parse_object *op); | ||
345 | |||
346 | void | ||
347 | acpi_ps_show ( | ||
348 | union acpi_parse_object *op); | ||
349 | |||
350 | |||
351 | #endif /* __ACPARSER_H__ */ | ||