1 /******************************************************************************
3 * Module Name: acparser.h - AML Parser subcomponent prototypes and defines
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2004, R. Byron Moore
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
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.
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.
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.
45 #ifndef __ACPARSER_H__
46 #define __ACPARSER_H__
49 #define OP_HAS_RETURN_VALUE 1
51 /* variable # arguments */
53 #define ACPI_VAR_ARGS ACPI_UINT32_MAX
56 #define ACPI_PARSE_DELETE_TREE 0x0001
57 #define ACPI_PARSE_NO_TREE_DELETE 0x0000
58 #define ACPI_PARSE_TREE_MASK 0x0001
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
65 #define ACPI_PARSE_DEFERRED_OP 0x0100
67 /* Parser external interfaces */
76 struct acpi_namespace_node *method_node,
77 union acpi_operand_object **params,
78 union acpi_operand_object **return_obj_desc);
81 /******************************************************************************
85 *****************************************************************************/
88 /* psargs - Parse AML opcode arguments */
91 acpi_ps_get_next_package_end (
92 struct acpi_parse_state *parser_state);
95 acpi_ps_get_next_package_length (
96 struct acpi_parse_state *parser_state);
99 acpi_ps_get_next_namestring (
100 struct acpi_parse_state *parser_state);
103 acpi_ps_get_next_simple_arg (
104 struct acpi_parse_state *parser_state,
106 union acpi_parse_object *arg);
109 acpi_ps_get_next_namepath (
110 struct acpi_walk_state *walk_state,
111 struct acpi_parse_state *parser_state,
112 union acpi_parse_object *arg,
115 union acpi_parse_object *
116 acpi_ps_get_next_field (
117 struct acpi_parse_state *parser_state);
120 acpi_ps_get_next_arg (
121 struct acpi_walk_state *walk_state,
122 struct acpi_parse_state *parser_state,
124 union acpi_parse_object **return_arg);
129 union acpi_parse_object *
131 union acpi_parse_object *scope,
135 union acpi_parse_object*
137 union acpi_parse_object *op);
140 /* psopcode - AML Opcode information */
142 const struct acpi_opcode_info *
143 acpi_ps_get_opcode_info (
147 acpi_ps_get_opcode_name (
151 /* psparse - top level parsing routines */
154 acpi_ps_get_opcode_size (
158 acpi_ps_complete_this_op (
159 struct acpi_walk_state *walk_state,
160 union acpi_parse_object *op);
163 acpi_ps_next_parse_state (
164 struct acpi_walk_state *walk_state,
165 union acpi_parse_object *op,
166 acpi_status callback_status);
169 acpi_ps_find_object (
170 struct acpi_walk_state *walk_state,
171 union acpi_parse_object **out_op);
174 acpi_ps_delete_parse_tree (
175 union acpi_parse_object *root);
179 struct acpi_walk_state *walk_state);
183 struct acpi_walk_state *walk_state);
186 acpi_ps_parse_table (
189 acpi_parse_downwards descending_callback,
190 acpi_parse_upwards ascending_callback,
191 union acpi_parse_object **root_object);
194 acpi_ps_peek_opcode (
195 struct acpi_parse_state *state);
198 /* psscope - Scope stack management routines */
203 struct acpi_parse_state *parser_state,
204 union acpi_parse_object *root);
206 union acpi_parse_object *
207 acpi_ps_get_parent_scope (
208 struct acpi_parse_state *state);
211 acpi_ps_has_completed_scope (
212 struct acpi_parse_state *parser_state);
216 struct acpi_parse_state *parser_state,
217 union acpi_parse_object **op,
223 struct acpi_parse_state *parser_state,
224 union acpi_parse_object *op,
229 acpi_ps_cleanup_scope (
230 struct acpi_parse_state *state);
233 /* pstree - parse tree manipulation routines */
237 union acpi_parse_object *op,
238 union acpi_parse_object *arg);
240 union acpi_parse_object*
242 union acpi_parse_object *scope,
247 union acpi_parse_object *
249 union acpi_parse_object *op,
252 union acpi_parse_object *
254 union acpi_parse_object *op);
256 union acpi_parse_object *
257 acpi_ps_get_depth_next (
258 union acpi_parse_object *origin,
259 union acpi_parse_object *op);
262 /* pswalk - parse tree walk routines */
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);
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);
283 acpi_ps_delete_completed_op (
284 struct acpi_walk_state *walk_state);
287 /* psutils - parser utilities */
289 union acpi_parse_object *
290 acpi_ps_create_scope_op (
295 union acpi_parse_object *op,
298 union acpi_parse_object *
304 union acpi_parse_object *op);
307 acpi_ps_delete_parse_cache (
311 acpi_ps_is_leading_char (
315 acpi_ps_is_prefix_char (
320 union acpi_parse_object *op);
324 union acpi_parse_object *op,
328 /* psdump - display parser tree */
331 acpi_ps_sprint_path (
334 union acpi_parse_object *op);
340 union acpi_parse_object *op);
344 union acpi_parse_object *op);
347 #endif /* __ACPARSER_H__ */