1 /******************************************************************************
3 * Name: acdispat.h - dispatcher (parser to interpreter interface)
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.
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
);
65 #ifdef ACPI_FUTURE_USAGE
67 acpi_ds_obj_stack_get_value (
69 struct acpi_walk_state
*walk_state
);
73 acpi_ds_obj_stack_pop_object (
74 union acpi_operand_object
**object
,
75 struct acpi_walk_state
*walk_state
);
78 /* dsopcode - support for late evaluation */
81 acpi_ds_execute_arguments (
82 struct acpi_namespace_node
*node
,
83 struct acpi_namespace_node
*scope_node
,
88 acpi_ds_get_buffer_field_arguments (
89 union acpi_operand_object
*obj_desc
);
92 acpi_ds_get_region_arguments (
93 union acpi_operand_object
*rgn_desc
);
96 acpi_ds_get_buffer_arguments (
97 union acpi_operand_object
*obj_desc
);
100 acpi_ds_get_package_arguments (
101 union acpi_operand_object
*obj_desc
);
104 acpi_ds_init_buffer_field (
106 union acpi_operand_object
*obj_desc
,
107 union acpi_operand_object
*buffer_desc
,
108 union acpi_operand_object
*offset_desc
,
109 union acpi_operand_object
*length_desc
,
110 union acpi_operand_object
*result_desc
);
113 acpi_ds_eval_buffer_field_operands (
114 struct acpi_walk_state
*walk_state
,
115 union acpi_parse_object
*op
);
118 acpi_ds_eval_region_operands (
119 struct acpi_walk_state
*walk_state
,
120 union acpi_parse_object
*op
);
123 acpi_ds_eval_data_object_operands (
124 struct acpi_walk_state
*walk_state
,
125 union acpi_parse_object
*op
,
126 union acpi_operand_object
*obj_desc
);
129 acpi_ds_initialize_region (
130 acpi_handle obj_handle
);
133 /* dsctrl - Parser/Interpreter interface, control stack routines */
137 acpi_ds_exec_begin_control_op (
138 struct acpi_walk_state
*walk_state
,
139 union acpi_parse_object
*op
);
142 acpi_ds_exec_end_control_op (
143 struct acpi_walk_state
*walk_state
,
144 union acpi_parse_object
*op
);
147 /* dsexec - Parser/Interpreter interface, method execution callbacks */
151 acpi_ds_get_predicate_value (
152 struct acpi_walk_state
*walk_state
,
153 union acpi_operand_object
*result_obj
);
156 acpi_ds_exec_begin_op (
157 struct acpi_walk_state
*walk_state
,
158 union acpi_parse_object
**out_op
);
161 acpi_ds_exec_end_op (
162 struct acpi_walk_state
*state
);
165 /* dsfield - Parser/Interpreter interface for AML fields */
168 acpi_ds_get_field_names (
169 struct acpi_create_field_info
*info
,
170 struct acpi_walk_state
*walk_state
,
171 union acpi_parse_object
*arg
);
174 acpi_ds_create_field (
175 union acpi_parse_object
*op
,
176 struct acpi_namespace_node
*region_node
,
177 struct acpi_walk_state
*walk_state
);
180 acpi_ds_create_bank_field (
181 union acpi_parse_object
*op
,
182 struct acpi_namespace_node
*region_node
,
183 struct acpi_walk_state
*walk_state
);
186 acpi_ds_create_index_field (
187 union acpi_parse_object
*op
,
188 struct acpi_namespace_node
*region_node
,
189 struct acpi_walk_state
*walk_state
);
192 acpi_ds_create_buffer_field (
193 union acpi_parse_object
*op
,
194 struct acpi_walk_state
*walk_state
);
197 acpi_ds_init_field_objects (
198 union acpi_parse_object
*op
,
199 struct acpi_walk_state
*walk_state
);
202 /* dsload - Parser/Interpreter interface, namespace load callbacks */
205 acpi_ds_load1_begin_op (
206 struct acpi_walk_state
*walk_state
,
207 union acpi_parse_object
**out_op
);
210 acpi_ds_load1_end_op (
211 struct acpi_walk_state
*walk_state
);
214 acpi_ds_load2_begin_op (
215 struct acpi_walk_state
*walk_state
,
216 union acpi_parse_object
**out_op
);
219 acpi_ds_load2_end_op (
220 struct acpi_walk_state
*walk_state
);
223 acpi_ds_init_callbacks (
224 struct acpi_walk_state
*walk_state
,
228 /* dsmthdat - method data (locals/args) */
232 acpi_ds_store_object_to_local (
235 union acpi_operand_object
*src_desc
,
236 struct acpi_walk_state
*walk_state
);
239 acpi_ds_method_data_get_entry (
242 struct acpi_walk_state
*walk_state
,
243 union acpi_operand_object
***node
);
246 acpi_ds_method_data_delete_all (
247 struct acpi_walk_state
*walk_state
);
250 acpi_ds_is_method_value (
251 union acpi_operand_object
*obj_desc
);
253 #ifdef ACPI_FUTURE_USAGE
255 acpi_ds_method_data_get_type (
258 struct acpi_walk_state
*walk_state
);
262 acpi_ds_method_data_get_value (
265 struct acpi_walk_state
*walk_state
,
266 union acpi_operand_object
**dest_desc
);
269 acpi_ds_method_data_delete_value (
272 struct acpi_walk_state
*walk_state
);
275 acpi_ds_method_data_init_args (
276 union acpi_operand_object
**params
,
278 struct acpi_walk_state
*walk_state
);
281 acpi_ds_method_data_get_node (
284 struct acpi_walk_state
*walk_state
,
285 struct acpi_namespace_node
**node
);
288 acpi_ds_method_data_init (
289 struct acpi_walk_state
*walk_state
);
292 acpi_ds_method_data_set_value (
295 union acpi_operand_object
*object
,
296 struct acpi_walk_state
*walk_state
);
299 /* dsmethod - Parser/Interpreter interface - control method parsing */
302 acpi_ds_parse_method (
303 acpi_handle obj_handle
);
306 acpi_ds_call_control_method (
307 struct acpi_thread_state
*thread
,
308 struct acpi_walk_state
*walk_state
,
309 union acpi_parse_object
*op
);
312 acpi_ds_restart_control_method (
313 struct acpi_walk_state
*walk_state
,
314 union acpi_operand_object
*return_desc
);
317 acpi_ds_terminate_control_method (
318 struct acpi_walk_state
*walk_state
);
321 acpi_ds_begin_method_execution (
322 struct acpi_namespace_node
*method_node
,
323 union acpi_operand_object
*obj_desc
,
324 struct acpi_namespace_node
*calling_method_node
);
327 /* dsobj - Parser/Interpreter interface - object initialization and conversion */
330 acpi_ds_init_one_object (
331 acpi_handle obj_handle
,
334 void **return_value
);
337 acpi_ds_initialize_objects (
338 struct acpi_table_desc
*table_desc
,
339 struct acpi_namespace_node
*start_node
);
342 acpi_ds_build_internal_buffer_obj (
343 struct acpi_walk_state
*walk_state
,
344 union acpi_parse_object
*op
,
346 union acpi_operand_object
**obj_desc_ptr
);
349 acpi_ds_build_internal_package_obj (
350 struct acpi_walk_state
*walk_state
,
351 union acpi_parse_object
*op
,
353 union acpi_operand_object
**obj_desc
);
356 acpi_ds_build_internal_object (
357 struct acpi_walk_state
*walk_state
,
358 union acpi_parse_object
*op
,
359 union acpi_operand_object
**obj_desc_ptr
);
362 acpi_ds_init_object_from_op (
363 struct acpi_walk_state
*walk_state
,
364 union acpi_parse_object
*op
,
366 union acpi_operand_object
**obj_desc
);
369 acpi_ds_create_node (
370 struct acpi_walk_state
*walk_state
,
371 struct acpi_namespace_node
*node
,
372 union acpi_parse_object
*op
);
375 /* dsutils - Parser/Interpreter interface utility routines */
378 acpi_ds_clear_implicit_return (
379 struct acpi_walk_state
*walk_state
);
382 acpi_ds_do_implicit_return (
383 union acpi_operand_object
*return_desc
,
384 struct acpi_walk_state
*walk_state
,
388 acpi_ds_is_result_used (
389 union acpi_parse_object
*op
,
390 struct acpi_walk_state
*walk_state
);
393 acpi_ds_delete_result_if_not_used (
394 union acpi_parse_object
*op
,
395 union acpi_operand_object
*result_obj
,
396 struct acpi_walk_state
*walk_state
);
399 acpi_ds_create_operand (
400 struct acpi_walk_state
*walk_state
,
401 union acpi_parse_object
*arg
,
405 acpi_ds_create_operands (
406 struct acpi_walk_state
*walk_state
,
407 union acpi_parse_object
*first_arg
);
410 acpi_ds_resolve_operands (
411 struct acpi_walk_state
*walk_state
);
414 acpi_ds_clear_operands (
415 struct acpi_walk_state
*walk_state
);
419 * dswscope - Scope Stack manipulation
423 acpi_ds_scope_stack_push (
424 struct acpi_namespace_node
*node
,
425 acpi_object_type type
,
426 struct acpi_walk_state
*walk_state
);
430 acpi_ds_scope_stack_pop (
431 struct acpi_walk_state
*walk_state
);
434 acpi_ds_scope_stack_clear (
435 struct acpi_walk_state
*walk_state
);
438 /* dswstate - parser WALK_STATE management routines */
440 struct acpi_walk_state
*
441 acpi_ds_create_walk_state (
442 acpi_owner_id owner_id
,
443 union acpi_parse_object
*origin
,
444 union acpi_operand_object
*mth_desc
,
445 struct acpi_thread_state
*thread
);
448 acpi_ds_init_aml_walk (
449 struct acpi_walk_state
*walk_state
,
450 union acpi_parse_object
*op
,
451 struct acpi_namespace_node
*method_node
,
454 struct acpi_parameter_info
*info
,
457 #ifdef ACPI_FUTURE_USAGE
459 acpi_ds_obj_stack_delete_all (
460 struct acpi_walk_state
*walk_state
);
464 acpi_ds_obj_stack_pop_and_delete (
466 struct acpi_walk_state
*walk_state
);
469 acpi_ds_delete_walk_state (
470 struct acpi_walk_state
*walk_state
);
472 struct acpi_walk_state
*
473 acpi_ds_pop_walk_state (
474 struct acpi_thread_state
*thread
);
477 acpi_ds_push_walk_state (
478 struct acpi_walk_state
*walk_state
,
479 struct acpi_thread_state
*thread
);
482 acpi_ds_result_stack_pop (
483 struct acpi_walk_state
*walk_state
);
486 acpi_ds_result_stack_push (
487 struct acpi_walk_state
*walk_state
);
490 acpi_ds_result_stack_clear (
491 struct acpi_walk_state
*walk_state
);
493 struct acpi_walk_state
*
494 acpi_ds_get_current_walk_state (
495 struct acpi_thread_state
*thread
);
497 #ifdef ACPI_ENABLE_OBJECT_CACHE
499 acpi_ds_delete_walk_state_cache (
503 #ifdef ACPI_FUTURE_USAGE
505 acpi_ds_result_insert (
508 struct acpi_walk_state
*walk_state
);
511 acpi_ds_result_remove (
512 union acpi_operand_object
**object
,
514 struct acpi_walk_state
*walk_state
);
519 union acpi_operand_object
**object
,
520 struct acpi_walk_state
*walk_state
);
523 acpi_ds_result_push (
524 union acpi_operand_object
*object
,
525 struct acpi_walk_state
*walk_state
);
528 acpi_ds_result_pop_from_bottom (
529 union acpi_operand_object
**object
,
530 struct acpi_walk_state
*walk_state
);
532 #endif /* _ACDISPAT_H_ */