1 /******************************************************************************
3 * Name: acdispat.h - dispatcher (parser to interpreter interface)
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.
49 #define NAMEOF_LOCAL_NTE "__L0"
50 #define NAMEOF_ARG_NTE "__A0"
53 /* Common interfaces */
56 acpi_ds_obj_stack_push (
58 struct acpi_walk_state
*walk_state
);
61 acpi_ds_obj_stack_pop (
63 struct acpi_walk_state
*walk_state
);
66 acpi_ds_obj_stack_get_value (
68 struct acpi_walk_state
*walk_state
);
71 acpi_ds_obj_stack_pop_object (
72 union acpi_operand_object
**object
,
73 struct acpi_walk_state
*walk_state
);
76 /* dsopcode - support for late evaluation */
79 acpi_ds_execute_arguments (
80 struct acpi_namespace_node
*node
,
81 struct acpi_namespace_node
*scope_node
,
86 acpi_ds_get_buffer_field_arguments (
87 union acpi_operand_object
*obj_desc
);
90 acpi_ds_get_region_arguments (
91 union acpi_operand_object
*rgn_desc
);
94 acpi_ds_get_buffer_arguments (
95 union acpi_operand_object
*obj_desc
);
98 acpi_ds_get_package_arguments (
99 union acpi_operand_object
*obj_desc
);
102 acpi_ds_init_buffer_field (
104 union acpi_operand_object
*obj_desc
,
105 union acpi_operand_object
*buffer_desc
,
106 union acpi_operand_object
*offset_desc
,
107 union acpi_operand_object
*length_desc
,
108 union acpi_operand_object
*result_desc
);
111 acpi_ds_eval_buffer_field_operands (
112 struct acpi_walk_state
*walk_state
,
113 union acpi_parse_object
*op
);
116 acpi_ds_eval_region_operands (
117 struct acpi_walk_state
*walk_state
,
118 union acpi_parse_object
*op
);
121 acpi_ds_eval_data_object_operands (
122 struct acpi_walk_state
*walk_state
,
123 union acpi_parse_object
*op
,
124 union acpi_operand_object
*obj_desc
);
127 acpi_ds_initialize_region (
128 acpi_handle obj_handle
);
131 /* dsctrl - Parser/Interpreter interface, control stack routines */
135 acpi_ds_exec_begin_control_op (
136 struct acpi_walk_state
*walk_state
,
137 union acpi_parse_object
*op
);
140 acpi_ds_exec_end_control_op (
141 struct acpi_walk_state
*walk_state
,
142 union acpi_parse_object
*op
);
145 /* dsexec - Parser/Interpreter interface, method execution callbacks */
149 acpi_ds_get_predicate_value (
150 struct acpi_walk_state
*walk_state
,
151 union acpi_operand_object
*result_obj
);
154 acpi_ds_exec_begin_op (
155 struct acpi_walk_state
*walk_state
,
156 union acpi_parse_object
**out_op
);
159 acpi_ds_exec_end_op (
160 struct acpi_walk_state
*state
);
163 /* dsfield - Parser/Interpreter interface for AML fields */
166 acpi_ds_get_field_names (
167 struct acpi_create_field_info
*info
,
168 struct acpi_walk_state
*walk_state
,
169 union acpi_parse_object
*arg
);
172 acpi_ds_create_field (
173 union acpi_parse_object
*op
,
174 struct acpi_namespace_node
*region_node
,
175 struct acpi_walk_state
*walk_state
);
178 acpi_ds_create_bank_field (
179 union acpi_parse_object
*op
,
180 struct acpi_namespace_node
*region_node
,
181 struct acpi_walk_state
*walk_state
);
184 acpi_ds_create_index_field (
185 union acpi_parse_object
*op
,
186 struct acpi_namespace_node
*region_node
,
187 struct acpi_walk_state
*walk_state
);
190 acpi_ds_create_buffer_field (
191 union acpi_parse_object
*op
,
192 struct acpi_walk_state
*walk_state
);
195 acpi_ds_init_field_objects (
196 union acpi_parse_object
*op
,
197 struct acpi_walk_state
*walk_state
);
200 /* dsload - Parser/Interpreter interface, namespace load callbacks */
203 acpi_ds_load1_begin_op (
204 struct acpi_walk_state
*walk_state
,
205 union acpi_parse_object
**out_op
);
208 acpi_ds_load1_end_op (
209 struct acpi_walk_state
*walk_state
);
212 acpi_ds_load2_begin_op (
213 struct acpi_walk_state
*walk_state
,
214 union acpi_parse_object
**out_op
);
217 acpi_ds_load2_end_op (
218 struct acpi_walk_state
*walk_state
);
221 acpi_ds_init_callbacks (
222 struct acpi_walk_state
*walk_state
,
226 /* dsmthdat - method data (locals/args) */
230 acpi_ds_store_object_to_local (
233 union acpi_operand_object
*src_desc
,
234 struct acpi_walk_state
*walk_state
);
237 acpi_ds_method_data_get_entry (
240 struct acpi_walk_state
*walk_state
,
241 union acpi_operand_object
***node
);
244 acpi_ds_method_data_delete_all (
245 struct acpi_walk_state
*walk_state
);
248 acpi_ds_is_method_value (
249 union acpi_operand_object
*obj_desc
);
252 acpi_ds_method_data_get_type (
255 struct acpi_walk_state
*walk_state
);
258 acpi_ds_method_data_get_value (
261 struct acpi_walk_state
*walk_state
,
262 union acpi_operand_object
**dest_desc
);
265 acpi_ds_method_data_delete_value (
268 struct acpi_walk_state
*walk_state
);
271 acpi_ds_method_data_init_args (
272 union acpi_operand_object
**params
,
274 struct acpi_walk_state
*walk_state
);
277 acpi_ds_method_data_get_node (
280 struct acpi_walk_state
*walk_state
,
281 struct acpi_namespace_node
**node
);
284 acpi_ds_method_data_init (
285 struct acpi_walk_state
*walk_state
);
288 acpi_ds_method_data_set_value (
291 union acpi_operand_object
*object
,
292 struct acpi_walk_state
*walk_state
);
295 /* dsmethod - Parser/Interpreter interface - control method parsing */
298 acpi_ds_parse_method (
299 acpi_handle obj_handle
);
302 acpi_ds_call_control_method (
303 struct acpi_thread_state
*thread
,
304 struct acpi_walk_state
*walk_state
,
305 union acpi_parse_object
*op
);
308 acpi_ds_restart_control_method (
309 struct acpi_walk_state
*walk_state
,
310 union acpi_operand_object
*return_desc
);
313 acpi_ds_terminate_control_method (
314 struct acpi_walk_state
*walk_state
);
317 acpi_ds_begin_method_execution (
318 struct acpi_namespace_node
*method_node
,
319 union acpi_operand_object
*obj_desc
,
320 struct acpi_namespace_node
*calling_method_node
);
323 /* dsobj - Parser/Interpreter interface - object initialization and conversion */
326 acpi_ds_init_one_object (
327 acpi_handle obj_handle
,
330 void **return_value
);
333 acpi_ds_initialize_objects (
334 struct acpi_table_desc
*table_desc
,
335 struct acpi_namespace_node
*start_node
);
338 acpi_ds_build_internal_buffer_obj (
339 struct acpi_walk_state
*walk_state
,
340 union acpi_parse_object
*op
,
342 union acpi_operand_object
**obj_desc_ptr
);
345 acpi_ds_build_internal_package_obj (
346 struct acpi_walk_state
*walk_state
,
347 union acpi_parse_object
*op
,
349 union acpi_operand_object
**obj_desc
);
352 acpi_ds_build_internal_object (
353 struct acpi_walk_state
*walk_state
,
354 union acpi_parse_object
*op
,
355 union acpi_operand_object
**obj_desc_ptr
);
358 acpi_ds_init_object_from_op (
359 struct acpi_walk_state
*walk_state
,
360 union acpi_parse_object
*op
,
362 union acpi_operand_object
**obj_desc
);
365 acpi_ds_create_node (
366 struct acpi_walk_state
*walk_state
,
367 struct acpi_namespace_node
*node
,
368 union acpi_parse_object
*op
);
371 /* dsutils - Parser/Interpreter interface utility routines */
374 acpi_ds_is_result_used (
375 union acpi_parse_object
*op
,
376 struct acpi_walk_state
*walk_state
);
379 acpi_ds_delete_result_if_not_used (
380 union acpi_parse_object
*op
,
381 union acpi_operand_object
*result_obj
,
382 struct acpi_walk_state
*walk_state
);
385 acpi_ds_create_operand (
386 struct acpi_walk_state
*walk_state
,
387 union acpi_parse_object
*arg
,
391 acpi_ds_create_operands (
392 struct acpi_walk_state
*walk_state
,
393 union acpi_parse_object
*first_arg
);
396 acpi_ds_resolve_operands (
397 struct acpi_walk_state
*walk_state
);
400 acpi_ds_clear_operands (
401 struct acpi_walk_state
*walk_state
);
405 * dswscope - Scope Stack manipulation
409 acpi_ds_scope_stack_push (
410 struct acpi_namespace_node
*node
,
411 acpi_object_type type
,
412 struct acpi_walk_state
*walk_state
);
416 acpi_ds_scope_stack_pop (
417 struct acpi_walk_state
*walk_state
);
420 acpi_ds_scope_stack_clear (
421 struct acpi_walk_state
*walk_state
);
424 /* dswstate - parser WALK_STATE management routines */
426 struct acpi_walk_state
*
427 acpi_ds_create_walk_state (
428 acpi_owner_id owner_id
,
429 union acpi_parse_object
*origin
,
430 union acpi_operand_object
*mth_desc
,
431 struct acpi_thread_state
*thread
);
434 acpi_ds_init_aml_walk (
435 struct acpi_walk_state
*walk_state
,
436 union acpi_parse_object
*op
,
437 struct acpi_namespace_node
*method_node
,
440 struct acpi_parameter_info
*info
,
444 acpi_ds_obj_stack_delete_all (
445 struct acpi_walk_state
*walk_state
);
448 acpi_ds_obj_stack_pop_and_delete (
450 struct acpi_walk_state
*walk_state
);
453 acpi_ds_delete_walk_state (
454 struct acpi_walk_state
*walk_state
);
456 struct acpi_walk_state
*
457 acpi_ds_pop_walk_state (
458 struct acpi_thread_state
*thread
);
461 acpi_ds_push_walk_state (
462 struct acpi_walk_state
*walk_state
,
463 struct acpi_thread_state
*thread
);
466 acpi_ds_result_stack_pop (
467 struct acpi_walk_state
*walk_state
);
470 acpi_ds_result_stack_push (
471 struct acpi_walk_state
*walk_state
);
474 acpi_ds_result_stack_clear (
475 struct acpi_walk_state
*walk_state
);
477 struct acpi_walk_state
*
478 acpi_ds_get_current_walk_state (
479 struct acpi_thread_state
*thread
);
482 acpi_ds_delete_walk_state_cache (
486 acpi_ds_result_insert (
489 struct acpi_walk_state
*walk_state
);
492 acpi_ds_result_remove (
493 union acpi_operand_object
**object
,
495 struct acpi_walk_state
*walk_state
);
499 union acpi_operand_object
**object
,
500 struct acpi_walk_state
*walk_state
);
503 acpi_ds_result_push (
504 union acpi_operand_object
*object
,
505 struct acpi_walk_state
*walk_state
);
508 acpi_ds_result_pop_from_bottom (
509 union acpi_operand_object
**object
,
510 struct acpi_walk_state
*walk_state
);
512 #endif /* _ACDISPAT_H_ */