1 /******************************************************************************
3 * Name: acinterp.h - Interpreter 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.
44 #ifndef __ACINTERP_H__
45 #define __ACINTERP_H__
48 #define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1]))
52 * exconvrt - object conversion
55 acpi_ex_convert_to_integer (
56 union acpi_operand_object *obj_desc,
57 union acpi_operand_object **result_desc,
61 acpi_ex_convert_to_buffer (
62 union acpi_operand_object *obj_desc,
63 union acpi_operand_object **result_desc);
66 acpi_ex_convert_to_string (
67 union acpi_operand_object *obj_desc,
68 union acpi_operand_object **result_desc,
71 /* Types for ->String conversion */
73 #define ACPI_EXPLICIT_BYTE_COPY 0x00000000
74 #define ACPI_EXPLICIT_CONVERT_HEX 0x00000001
75 #define ACPI_IMPLICIT_CONVERT_HEX 0x00000002
76 #define ACPI_EXPLICIT_CONVERT_DECIMAL 0x00000003
79 acpi_ex_convert_to_target_type (
80 acpi_object_type destination_type,
81 union acpi_operand_object *source_desc,
82 union acpi_operand_object **result_desc,
83 struct acpi_walk_state *walk_state);
87 * exfield - ACPI AML (p-code) execution - field manipulation
90 acpi_ex_common_buffer_setup (
91 union acpi_operand_object *obj_desc,
96 acpi_ex_write_with_update_rule (
97 union acpi_operand_object *obj_desc,
99 acpi_integer field_value,
100 u32 field_datum_byte_offset);
103 acpi_ex_get_buffer_datum(
107 u32 byte_granularity,
111 acpi_ex_set_buffer_datum (
112 acpi_integer merged_datum,
115 u32 byte_granularity,
119 acpi_ex_read_data_from_field (
120 struct acpi_walk_state *walk_state,
121 union acpi_operand_object *obj_desc,
122 union acpi_operand_object **ret_buffer_desc);
125 acpi_ex_write_data_to_field (
126 union acpi_operand_object *source_desc,
127 union acpi_operand_object *obj_desc,
128 union acpi_operand_object **result_desc);
132 * exfldio - low level field I/O
135 acpi_ex_extract_from_field (
136 union acpi_operand_object *obj_desc,
141 acpi_ex_insert_into_field (
142 union acpi_operand_object *obj_desc,
147 acpi_ex_access_region (
148 union acpi_operand_object *obj_desc,
149 u32 field_datum_byte_offset,
155 * exmisc - misc support routines
158 acpi_ex_get_object_reference (
159 union acpi_operand_object *obj_desc,
160 union acpi_operand_object **return_desc,
161 struct acpi_walk_state *walk_state);
164 acpi_ex_concat_template (
165 union acpi_operand_object *obj_desc,
166 union acpi_operand_object *obj_desc2,
167 union acpi_operand_object **actual_return_desc,
168 struct acpi_walk_state *walk_state);
171 acpi_ex_do_concatenate (
172 union acpi_operand_object *obj_desc,
173 union acpi_operand_object *obj_desc2,
174 union acpi_operand_object **actual_return_desc,
175 struct acpi_walk_state *walk_state);
178 acpi_ex_do_logical_numeric_op (
180 acpi_integer integer0,
181 acpi_integer integer1,
185 acpi_ex_do_logical_op (
187 union acpi_operand_object *operand0,
188 union acpi_operand_object *operand1,
194 acpi_integer operand0,
195 acpi_integer operand1);
198 acpi_ex_create_mutex (
199 struct acpi_walk_state *walk_state);
202 acpi_ex_create_processor (
203 struct acpi_walk_state *walk_state);
206 acpi_ex_create_power_resource (
207 struct acpi_walk_state *walk_state);
210 acpi_ex_create_region (
214 struct acpi_walk_state *walk_state);
217 acpi_ex_create_table_region (
218 struct acpi_walk_state *walk_state);
221 acpi_ex_create_event (
222 struct acpi_walk_state *walk_state);
225 acpi_ex_create_alias (
226 struct acpi_walk_state *walk_state);
229 acpi_ex_create_method (
232 struct acpi_walk_state *walk_state);
236 * exconfig - dynamic table load/unload
240 union acpi_operand_object *obj_desc,
241 union acpi_operand_object *target,
242 struct acpi_walk_state *walk_state);
245 acpi_ex_load_table_op (
246 struct acpi_walk_state *walk_state,
247 union acpi_operand_object **return_desc);
250 acpi_ex_unload_table (
251 union acpi_operand_object *ddb_handle);
255 * exmutex - mutex support
258 acpi_ex_acquire_mutex (
259 union acpi_operand_object *time_desc,
260 union acpi_operand_object *obj_desc,
261 struct acpi_walk_state *walk_state);
264 acpi_ex_release_mutex (
265 union acpi_operand_object *obj_desc,
266 struct acpi_walk_state *walk_state);
269 acpi_ex_release_all_mutexes (
270 struct acpi_thread_state *thread);
273 acpi_ex_unlink_mutex (
274 union acpi_operand_object *obj_desc);
278 * exprep - ACPI AML execution - prep utilities
281 acpi_ex_prep_common_field_object (
282 union acpi_operand_object *obj_desc,
285 u32 field_bit_position,
286 u32 field_bit_length);
289 acpi_ex_prep_field_value (
290 struct acpi_create_field_info *info);
294 * exsystem - Interface to OS services
297 acpi_ex_system_do_notify_op (
298 union acpi_operand_object *value,
299 union acpi_operand_object *obj_desc);
302 acpi_ex_system_do_suspend(
306 acpi_ex_system_do_stall (
310 acpi_ex_system_acquire_mutex(
311 union acpi_operand_object *time,
312 union acpi_operand_object *obj_desc);
315 acpi_ex_system_release_mutex(
316 union acpi_operand_object *obj_desc);
319 acpi_ex_system_signal_event(
320 union acpi_operand_object *obj_desc);
323 acpi_ex_system_wait_event(
324 union acpi_operand_object *time,
325 union acpi_operand_object *obj_desc);
328 acpi_ex_system_reset_event(
329 union acpi_operand_object *obj_desc);
332 acpi_ex_system_wait_semaphore (
333 acpi_handle semaphore,
338 * exoparg1 - ACPI AML execution, 1 operand
341 acpi_ex_opcode_0A_0T_1R (
342 struct acpi_walk_state *walk_state);
345 acpi_ex_opcode_1A_0T_0R (
346 struct acpi_walk_state *walk_state);
349 acpi_ex_opcode_1A_0T_1R (
350 struct acpi_walk_state *walk_state);
353 acpi_ex_opcode_1A_1T_1R (
354 struct acpi_walk_state *walk_state);
357 acpi_ex_opcode_1A_1T_0R (
358 struct acpi_walk_state *walk_state);
361 * exoparg2 - ACPI AML execution, 2 operands
364 acpi_ex_opcode_2A_0T_0R (
365 struct acpi_walk_state *walk_state);
368 acpi_ex_opcode_2A_0T_1R (
369 struct acpi_walk_state *walk_state);
372 acpi_ex_opcode_2A_1T_1R (
373 struct acpi_walk_state *walk_state);
376 acpi_ex_opcode_2A_2T_1R (
377 struct acpi_walk_state *walk_state);
381 * exoparg3 - ACPI AML execution, 3 operands
384 acpi_ex_opcode_3A_0T_0R (
385 struct acpi_walk_state *walk_state);
388 acpi_ex_opcode_3A_1T_1R (
389 struct acpi_walk_state *walk_state);
393 * exoparg6 - ACPI AML execution, 6 operands
396 acpi_ex_opcode_6A_0T_1R (
397 struct acpi_walk_state *walk_state);
401 * exresolv - Object resolution and get value functions
404 acpi_ex_resolve_to_value (
405 union acpi_operand_object **stack_ptr,
406 struct acpi_walk_state *walk_state);
409 acpi_ex_resolve_multiple (
410 struct acpi_walk_state *walk_state,
411 union acpi_operand_object *operand,
412 acpi_object_type *return_type,
413 union acpi_operand_object **return_desc);
417 * exresnte - resolve namespace node
420 acpi_ex_resolve_node_to_value (
421 struct acpi_namespace_node **stack_ptr,
422 struct acpi_walk_state *walk_state);
426 * exresop - resolve operand to value
429 acpi_ex_resolve_operands (
431 union acpi_operand_object **stack_ptr,
432 struct acpi_walk_state *walk_state);
436 * exdump - Interpreter debug output routines
439 acpi_ex_dump_operand (
440 union acpi_operand_object *obj_desc,
444 acpi_ex_dump_operands (
445 union acpi_operand_object **operands,
446 acpi_interpreter_mode interpreter_mode,
453 #ifdef ACPI_FUTURE_USAGE
455 acpi_ex_dump_object_descriptor (
456 union acpi_operand_object *object,
461 struct acpi_namespace_node *node,
463 #endif /* ACPI_FUTURE_USAGE */
467 * exnames - AML namestring support
470 acpi_ex_get_name_string (
471 acpi_object_type data_type,
473 char **out_name_string,
474 u32 *out_name_length);
478 * exstore - Object store support
482 union acpi_operand_object *val_desc,
483 union acpi_operand_object *dest_desc,
484 struct acpi_walk_state *walk_state);
487 acpi_ex_store_object_to_node (
488 union acpi_operand_object *source_desc,
489 struct acpi_namespace_node *node,
490 struct acpi_walk_state *walk_state,
491 u8 implicit_conversion);
493 #define ACPI_IMPLICIT_CONVERSION TRUE
494 #define ACPI_NO_IMPLICIT_CONVERSION FALSE
498 * exstoren - resolve/store object
501 acpi_ex_resolve_object (
502 union acpi_operand_object **source_desc_ptr,
503 acpi_object_type target_type,
504 struct acpi_walk_state *walk_state);
507 acpi_ex_store_object_to_object (
508 union acpi_operand_object *source_desc,
509 union acpi_operand_object *dest_desc,
510 union acpi_operand_object **new_desc,
511 struct acpi_walk_state *walk_state);
515 * exstorob - store object - buffer/string
518 acpi_ex_store_buffer_to_buffer (
519 union acpi_operand_object *source_desc,
520 union acpi_operand_object *target_desc);
523 acpi_ex_store_string_to_string (
524 union acpi_operand_object *source_desc,
525 union acpi_operand_object *target_desc);
529 * excopy - object copy
532 acpi_ex_copy_integer_to_index_field (
533 union acpi_operand_object *source_desc,
534 union acpi_operand_object *target_desc);
537 acpi_ex_copy_integer_to_bank_field (
538 union acpi_operand_object *source_desc,
539 union acpi_operand_object *target_desc);
542 acpi_ex_copy_data_to_named_field (
543 union acpi_operand_object *source_desc,
544 struct acpi_namespace_node *node);
547 acpi_ex_copy_integer_to_buffer_field (
548 union acpi_operand_object *source_desc,
549 union acpi_operand_object *target_desc);
553 * exutils - interpreter/scanner utilities
556 acpi_ex_enter_interpreter (
560 acpi_ex_exit_interpreter (
564 acpi_ex_truncate_for32bit_table (
565 union acpi_operand_object *obj_desc);
568 acpi_ex_acquire_global_lock (
572 acpi_ex_release_global_lock (
576 acpi_ex_eisa_id_to_string (
581 acpi_ex_unsigned_integer_to_string (
587 * exregion - default op_region handlers
590 acpi_ex_system_memory_space_handler (
592 acpi_physical_address address,
595 void *handler_context,
596 void *region_context);
599 acpi_ex_system_io_space_handler (
601 acpi_physical_address address,
604 void *handler_context,
605 void *region_context);
608 acpi_ex_pci_config_space_handler (
610 acpi_physical_address address,
613 void *handler_context,
614 void *region_context);
617 acpi_ex_cmos_space_handler (
619 acpi_physical_address address,
622 void *handler_context,
623 void *region_context);
626 acpi_ex_pci_bar_space_handler (
628 acpi_physical_address address,
631 void *handler_context,
632 void *region_context);
635 acpi_ex_embedded_controller_space_handler (
637 acpi_physical_address address,
640 void *handler_context,
641 void *region_context);
644 acpi_ex_sm_bus_space_handler (
646 acpi_physical_address address,
649 void *handler_context,
650 void *region_context);
654 acpi_ex_data_table_space_handler (
656 acpi_physical_address address,
659 void *handler_context,
660 void *region_context);
662 #endif /* __INTERP_H__ */