1 /******************************************************************************
3 * Module Name: acparser.h - AML Parser subcomponent prototypes and defines
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2005, 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
66 #define ACPI_PARSE_DISASSEMBLE 0x0200
69 /******************************************************************************
73 *****************************************************************************/
77 * psxface - Parser external interfaces
80 acpi_ps_execute_method (
81 struct acpi_parameter_info *info);
85 * psargs - Parse AML opcode arguments
88 acpi_ps_get_next_package_end (
89 struct acpi_parse_state *parser_state);
92 acpi_ps_get_next_namestring (
93 struct acpi_parse_state *parser_state);
96 acpi_ps_get_next_simple_arg (
97 struct acpi_parse_state *parser_state,
99 union acpi_parse_object *arg);
102 acpi_ps_get_next_namepath (
103 struct acpi_walk_state *walk_state,
104 struct acpi_parse_state *parser_state,
105 union acpi_parse_object *arg,
109 acpi_ps_get_next_arg (
110 struct acpi_walk_state *walk_state,
111 struct acpi_parse_state *parser_state,
113 union acpi_parse_object **return_arg);
119 union acpi_parse_object *
121 union acpi_parse_object *scope,
125 union acpi_parse_object*
127 union acpi_parse_object *op);
131 * psopcode - AML Opcode information
133 const struct acpi_opcode_info *
134 acpi_ps_get_opcode_info (
138 acpi_ps_get_opcode_name (
143 * psparse - top level parsing routines
147 struct acpi_walk_state *walk_state);
150 acpi_ps_get_opcode_size (
154 acpi_ps_peek_opcode (
155 struct acpi_parse_state *state);
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);
170 * psloop - main parse loop
174 struct acpi_walk_state *walk_state);
178 * psscope - Scope stack management routines
182 struct acpi_parse_state *parser_state,
183 union acpi_parse_object *root);
185 union acpi_parse_object *
186 acpi_ps_get_parent_scope (
187 struct acpi_parse_state *state);
190 acpi_ps_has_completed_scope (
191 struct acpi_parse_state *parser_state);
195 struct acpi_parse_state *parser_state,
196 union acpi_parse_object **op,
202 struct acpi_parse_state *parser_state,
203 union acpi_parse_object *op,
208 acpi_ps_cleanup_scope (
209 struct acpi_parse_state *state);
213 * pstree - parse tree manipulation routines
217 union acpi_parse_object *op,
218 union acpi_parse_object *arg);
220 union acpi_parse_object*
222 union acpi_parse_object *scope,
227 union acpi_parse_object *
229 union acpi_parse_object *op,
232 #ifdef ACPI_FUTURE_USAGE
233 union acpi_parse_object *
234 acpi_ps_get_depth_next (
235 union acpi_parse_object *origin,
236 union acpi_parse_object *op);
237 #endif /* ACPI_FUTURE_USAGE */
241 * pswalk - parse tree walk routines
244 acpi_ps_walk_parsed_aml (
245 union acpi_parse_object *start_op,
246 union acpi_parse_object *end_op,
247 union acpi_operand_object *mth_desc,
248 struct acpi_namespace_node *start_node,
249 union acpi_operand_object **params,
250 union acpi_operand_object **caller_return_desc,
251 acpi_owner_id owner_id,
252 acpi_parse_downwards descending_callback,
253 acpi_parse_upwards ascending_callback);
256 acpi_ps_get_next_walk_op (
257 struct acpi_walk_state *walk_state,
258 union acpi_parse_object *op,
259 acpi_parse_upwards ascending_callback);
262 acpi_ps_delete_completed_op (
263 struct acpi_walk_state *walk_state);
266 acpi_ps_delete_parse_tree (
267 union acpi_parse_object *root);
271 * psutils - parser utilities
273 union acpi_parse_object *
274 acpi_ps_create_scope_op (
279 union acpi_parse_object *op,
282 union acpi_parse_object *
288 union acpi_parse_object *op);
291 acpi_ps_is_leading_char (
295 acpi_ps_is_prefix_char (
298 #ifdef ACPI_FUTURE_USAGE
301 union acpi_parse_object *op);
302 #endif /* ACPI_FUTURE_USAGE */
306 union acpi_parse_object *op,
311 * psdump - display parser tree
314 acpi_ps_sprint_path (
317 union acpi_parse_object *op);
323 union acpi_parse_object *op);
327 union acpi_parse_object *op);
330 #endif /* __ACPARSER_H__ */