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
68 /******************************************************************************
72 *****************************************************************************/
76 * psxface - Parser external interfaces
85 struct acpi_parameter_info
*info
);
89 * psargs - Parse AML opcode arguments
92 acpi_ps_get_next_package_end (
93 struct acpi_parse_state
*parser_state
);
96 acpi_ps_get_next_namestring (
97 struct acpi_parse_state
*parser_state
);
100 acpi_ps_get_next_simple_arg (
101 struct acpi_parse_state
*parser_state
,
103 union acpi_parse_object
*arg
);
106 acpi_ps_get_next_namepath (
107 struct acpi_walk_state
*walk_state
,
108 struct acpi_parse_state
*parser_state
,
109 union acpi_parse_object
*arg
,
113 acpi_ps_get_next_arg (
114 struct acpi_walk_state
*walk_state
,
115 struct acpi_parse_state
*parser_state
,
117 union acpi_parse_object
**return_arg
);
123 union acpi_parse_object
*
125 union acpi_parse_object
*scope
,
129 union acpi_parse_object
*
131 union acpi_parse_object
*op
);
135 * psopcode - AML Opcode information
137 const struct acpi_opcode_info
*
138 acpi_ps_get_opcode_info (
142 acpi_ps_get_opcode_name (
147 * psparse - top level parsing routines
151 struct acpi_walk_state
*walk_state
);
154 acpi_ps_get_opcode_size (
158 acpi_ps_peek_opcode (
159 struct acpi_parse_state
*state
);
163 * psscope - Scope stack management routines
167 struct acpi_parse_state
*parser_state
,
168 union acpi_parse_object
*root
);
170 union acpi_parse_object
*
171 acpi_ps_get_parent_scope (
172 struct acpi_parse_state
*state
);
175 acpi_ps_has_completed_scope (
176 struct acpi_parse_state
*parser_state
);
180 struct acpi_parse_state
*parser_state
,
181 union acpi_parse_object
**op
,
187 struct acpi_parse_state
*parser_state
,
188 union acpi_parse_object
*op
,
193 acpi_ps_cleanup_scope (
194 struct acpi_parse_state
*state
);
198 * pstree - parse tree manipulation routines
202 union acpi_parse_object
*op
,
203 union acpi_parse_object
*arg
);
205 union acpi_parse_object
*
207 union acpi_parse_object
*scope
,
212 union acpi_parse_object
*
214 union acpi_parse_object
*op
,
217 #ifdef ACPI_FUTURE_USAGE
218 union acpi_parse_object
*
219 acpi_ps_get_depth_next (
220 union acpi_parse_object
*origin
,
221 union acpi_parse_object
*op
);
222 #endif /* ACPI_FUTURE_USAGE */
226 * pswalk - parse tree walk routines
229 acpi_ps_walk_parsed_aml (
230 union acpi_parse_object
*start_op
,
231 union acpi_parse_object
*end_op
,
232 union acpi_operand_object
*mth_desc
,
233 struct acpi_namespace_node
*start_node
,
234 union acpi_operand_object
**params
,
235 union acpi_operand_object
**caller_return_desc
,
236 acpi_owner_id owner_id
,
237 acpi_parse_downwards descending_callback
,
238 acpi_parse_upwards ascending_callback
);
241 acpi_ps_get_next_walk_op (
242 struct acpi_walk_state
*walk_state
,
243 union acpi_parse_object
*op
,
244 acpi_parse_upwards ascending_callback
);
247 acpi_ps_delete_completed_op (
248 struct acpi_walk_state
*walk_state
);
251 acpi_ps_delete_parse_tree (
252 union acpi_parse_object
*root
);
256 * psutils - parser utilities
258 union acpi_parse_object
*
259 acpi_ps_create_scope_op (
264 union acpi_parse_object
*op
,
267 union acpi_parse_object
*
273 union acpi_parse_object
*op
);
276 acpi_ps_is_leading_char (
280 acpi_ps_is_prefix_char (
283 #ifdef ACPI_FUTURE_USAGE
286 union acpi_parse_object
*op
);
287 #endif /* ACPI_FUTURE_USAGE */
291 union acpi_parse_object
*op
,
294 #ifdef ACPI_ENABLE_OBJECT_CACHE
296 acpi_ps_delete_parse_cache (
302 * psdump - display parser tree
305 acpi_ps_sprint_path (
308 union acpi_parse_object
*op
);
314 union acpi_parse_object
*op
);
318 union acpi_parse_object
*op
);
321 #endif /* __ACPARSER_H__ */