WIP FPC-III support
[linux/fpc-iii.git] / drivers / acpi / acpica / acinterp.h
bloba6d896cda2a566ef69a74d983f0f6f6c7bd48e35
1 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
2 /******************************************************************************
4 * Name: acinterp.h - Interpreter subcomponent prototypes and defines
6 * Copyright (C) 2000 - 2020, Intel Corp.
8 *****************************************************************************/
10 #ifndef __ACINTERP_H__
11 #define __ACINTERP_H__
13 #define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1]))
15 /* Macros for tables used for debug output */
17 #define ACPI_EXD_OFFSET(f) (u8) ACPI_OFFSET (union acpi_operand_object,f)
18 #define ACPI_EXD_NSOFFSET(f) (u8) ACPI_OFFSET (struct acpi_namespace_node,f)
19 #define ACPI_EXD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_exdump_info))
22 * If possible, pack the following structures to byte alignment, since we
23 * don't care about performance for debug output. Two cases where we cannot
24 * pack the structures:
26 * 1) Hardware does not support misaligned memory transfers
27 * 2) Compiler does not support pointers within packed structures
29 #if (!defined(ACPI_MISALIGNMENT_NOT_SUPPORTED) && !defined(ACPI_PACKED_POINTERS_NOT_SUPPORTED))
30 #pragma pack(1)
31 #endif
33 typedef const struct acpi_exdump_info {
34 u8 opcode;
35 u8 offset;
36 const char *name;
38 } acpi_exdump_info;
40 /* Values for the Opcode field above */
42 #define ACPI_EXD_INIT 0
43 #define ACPI_EXD_TYPE 1
44 #define ACPI_EXD_UINT8 2
45 #define ACPI_EXD_UINT16 3
46 #define ACPI_EXD_UINT32 4
47 #define ACPI_EXD_UINT64 5
48 #define ACPI_EXD_LITERAL 6
49 #define ACPI_EXD_POINTER 7
50 #define ACPI_EXD_ADDRESS 8
51 #define ACPI_EXD_STRING 9
52 #define ACPI_EXD_BUFFER 10
53 #define ACPI_EXD_PACKAGE 11
54 #define ACPI_EXD_FIELD 12
55 #define ACPI_EXD_REFERENCE 13
56 #define ACPI_EXD_LIST 14 /* Operand object list */
57 #define ACPI_EXD_HDLR_LIST 15 /* Address Handler list */
58 #define ACPI_EXD_RGN_LIST 16 /* Region list */
59 #define ACPI_EXD_NODE 17 /* Namespace Node */
61 /* restore default alignment */
63 #pragma pack()
66 * exconvrt - object conversion
68 acpi_status
69 acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
70 union acpi_operand_object **result_desc,
71 u32 implicit_conversion);
73 acpi_status
74 acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
75 union acpi_operand_object **result_desc);
77 acpi_status
78 acpi_ex_convert_to_string(union acpi_operand_object *obj_desc,
79 union acpi_operand_object **result_desc, u32 type);
81 /* Types for ->String conversion */
83 #define ACPI_EXPLICIT_BYTE_COPY 0x00000000
84 #define ACPI_EXPLICIT_CONVERT_HEX 0x00000001
85 #define ACPI_IMPLICIT_CONVERT_HEX 0x00000002
86 #define ACPI_EXPLICIT_CONVERT_DECIMAL 0x00000003
88 acpi_status
89 acpi_ex_convert_to_target_type(acpi_object_type destination_type,
90 union acpi_operand_object *source_desc,
91 union acpi_operand_object **result_desc,
92 struct acpi_walk_state *walk_state);
95 * exdebug - AML debug object
97 void
98 acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
99 u32 level, u32 index);
101 void
102 acpi_ex_start_trace_method(struct acpi_namespace_node *method_node,
103 union acpi_operand_object *obj_desc,
104 struct acpi_walk_state *walk_state);
106 void
107 acpi_ex_stop_trace_method(struct acpi_namespace_node *method_node,
108 union acpi_operand_object *obj_desc,
109 struct acpi_walk_state *walk_state);
111 void
112 acpi_ex_start_trace_opcode(union acpi_parse_object *op,
113 struct acpi_walk_state *walk_state);
115 void
116 acpi_ex_stop_trace_opcode(union acpi_parse_object *op,
117 struct acpi_walk_state *walk_state);
119 void
120 acpi_ex_trace_point(acpi_trace_event_type type,
121 u8 begin, u8 *aml, char *pathname);
124 * exfield - ACPI AML (p-code) execution - field manipulation
126 acpi_status
127 acpi_ex_get_protocol_buffer_length(u32 protocol_id, u32 *return_length);
129 acpi_status
130 acpi_ex_common_buffer_setup(union acpi_operand_object *obj_desc,
131 u32 buffer_length, u32 * datum_count);
133 acpi_status
134 acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
135 u64 mask,
136 u64 field_value, u32 field_datum_byte_offset);
138 void
139 acpi_ex_get_buffer_datum(u64 *datum,
140 void *buffer,
141 u32 buffer_length,
142 u32 byte_granularity, u32 buffer_offset);
144 void
145 acpi_ex_set_buffer_datum(u64 merged_datum,
146 void *buffer,
147 u32 buffer_length,
148 u32 byte_granularity, u32 buffer_offset);
150 acpi_status
151 acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
152 union acpi_operand_object *obj_desc,
153 union acpi_operand_object **ret_buffer_desc);
155 acpi_status
156 acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
157 union acpi_operand_object *obj_desc,
158 union acpi_operand_object **result_desc);
161 * exfldio - low level field I/O
163 acpi_status
164 acpi_ex_extract_from_field(union acpi_operand_object *obj_desc,
165 void *buffer, u32 buffer_length);
167 acpi_status
168 acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
169 void *buffer, u32 buffer_length);
171 acpi_status
172 acpi_ex_access_region(union acpi_operand_object *obj_desc,
173 u32 field_datum_byte_offset, u64 *value, u32 read_write);
176 * exmisc - misc support routines
178 acpi_status
179 acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
180 union acpi_operand_object **return_desc,
181 struct acpi_walk_state *walk_state);
183 acpi_status
184 acpi_ex_concat_template(union acpi_operand_object *obj_desc,
185 union acpi_operand_object *obj_desc2,
186 union acpi_operand_object **actual_return_desc,
187 struct acpi_walk_state *walk_state);
189 acpi_status
190 acpi_ex_do_concatenate(union acpi_operand_object *obj_desc,
191 union acpi_operand_object *obj_desc2,
192 union acpi_operand_object **actual_return_desc,
193 struct acpi_walk_state *walk_state);
195 acpi_status
196 acpi_ex_do_logical_numeric_op(u16 opcode,
197 u64 integer0, u64 integer1, u8 *logical_result);
199 acpi_status
200 acpi_ex_do_logical_op(u16 opcode,
201 union acpi_operand_object *operand0,
202 union acpi_operand_object *operand1, u8 *logical_result);
204 u64 acpi_ex_do_math_op(u16 opcode, u64 operand0, u64 operand1);
206 acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state);
208 acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state);
210 acpi_status acpi_ex_create_power_resource(struct acpi_walk_state *walk_state);
212 acpi_status
213 acpi_ex_create_region(u8 * aml_start,
214 u32 aml_length,
215 u8 region_space, struct acpi_walk_state *walk_state);
217 acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state);
219 acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state);
221 acpi_status
222 acpi_ex_create_method(u8 * aml_start,
223 u32 aml_length, struct acpi_walk_state *walk_state);
226 * exconfig - dynamic table load/unload
228 acpi_status
229 acpi_ex_load_op(union acpi_operand_object *obj_desc,
230 union acpi_operand_object *target,
231 struct acpi_walk_state *walk_state);
233 acpi_status
234 acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
235 union acpi_operand_object **return_desc);
237 acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle);
240 * exmutex - mutex support
242 acpi_status
243 acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
244 union acpi_operand_object *obj_desc,
245 struct acpi_walk_state *walk_state);
247 acpi_status
248 acpi_ex_acquire_mutex_object(u16 timeout,
249 union acpi_operand_object *obj_desc,
250 acpi_thread_id thread_id);
252 acpi_status
253 acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
254 struct acpi_walk_state *walk_state);
256 acpi_status acpi_ex_release_mutex_object(union acpi_operand_object *obj_desc);
258 void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread);
260 void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc);
263 * exprep - ACPI AML execution - prep utilities
265 acpi_status
266 acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc,
267 u8 field_flags,
268 u8 field_attribute,
269 u32 field_bit_position, u32 field_bit_length);
271 acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info);
274 * exserial - field_unit support for serial address spaces
276 acpi_status
277 acpi_ex_read_serial_bus(union acpi_operand_object *obj_desc,
278 union acpi_operand_object **return_buffer);
280 acpi_status
281 acpi_ex_write_serial_bus(union acpi_operand_object *source_desc,
282 union acpi_operand_object *obj_desc,
283 union acpi_operand_object **return_buffer);
285 acpi_status
286 acpi_ex_read_gpio(union acpi_operand_object *obj_desc, void *buffer);
288 acpi_status
289 acpi_ex_write_gpio(union acpi_operand_object *source_desc,
290 union acpi_operand_object *obj_desc,
291 union acpi_operand_object **return_buffer);
294 * exsystem - Interface to OS services
296 acpi_status
297 acpi_ex_system_do_notify_op(union acpi_operand_object *value,
298 union acpi_operand_object *obj_desc);
300 acpi_status acpi_ex_system_do_sleep(u64 time);
302 acpi_status acpi_ex_system_do_stall(u32 time);
304 acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc);
306 acpi_status
307 acpi_ex_system_wait_event(union acpi_operand_object *time,
308 union acpi_operand_object *obj_desc);
310 acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc);
312 acpi_status
313 acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout);
315 acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout);
318 * exoparg1 - ACPI AML execution, 1 operand
320 acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state);
322 acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state);
324 acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state);
326 acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state);
328 acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state);
331 * exoparg2 - ACPI AML execution, 2 operands
333 acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state);
335 acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state);
337 acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state);
339 acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state);
342 * exoparg3 - ACPI AML execution, 3 operands
344 acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state);
346 acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state);
349 * exoparg6 - ACPI AML execution, 6 operands
351 acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state *walk_state);
354 * exresolv - Object resolution and get value functions
356 acpi_status
357 acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr,
358 struct acpi_walk_state *walk_state);
360 acpi_status
361 acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
362 union acpi_operand_object *operand,
363 acpi_object_type *return_type,
364 union acpi_operand_object **return_desc);
367 * exresnte - resolve namespace node
369 acpi_status
370 acpi_ex_resolve_node_to_value(struct acpi_namespace_node **stack_ptr,
371 struct acpi_walk_state *walk_state);
374 * exresop - resolve operand to value
376 acpi_status
377 acpi_ex_resolve_operands(u16 opcode,
378 union acpi_operand_object **stack_ptr,
379 struct acpi_walk_state *walk_state);
382 * exdump - Interpreter debug output routines
384 void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth);
386 void
387 acpi_ex_dump_operands(union acpi_operand_object **operands,
388 const char *opcode_name, u32 num_opcodes);
390 void
391 acpi_ex_dump_object_descriptor(union acpi_operand_object *object, u32 flags);
393 void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags);
396 * exnames - AML namestring support
398 acpi_status
399 acpi_ex_get_name_string(acpi_object_type data_type,
400 u8 * in_aml_address,
401 char **out_name_string, u32 * out_name_length);
404 * exstore - Object store support
406 acpi_status
407 acpi_ex_store(union acpi_operand_object *val_desc,
408 union acpi_operand_object *dest_desc,
409 struct acpi_walk_state *walk_state);
411 acpi_status
412 acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
413 struct acpi_namespace_node *node,
414 struct acpi_walk_state *walk_state,
415 u8 implicit_conversion);
418 * exstoren - resolve/store object
420 acpi_status
421 acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
422 acpi_object_type target_type,
423 struct acpi_walk_state *walk_state);
425 acpi_status
426 acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,
427 union acpi_operand_object *dest_desc,
428 union acpi_operand_object **new_desc,
429 struct acpi_walk_state *walk_state);
432 * exstorob - store object - buffer/string
434 acpi_status
435 acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
436 union acpi_operand_object *target_desc);
438 acpi_status
439 acpi_ex_store_string_to_string(union acpi_operand_object *source_desc,
440 union acpi_operand_object *target_desc);
443 * excopy - object copy
445 acpi_status
446 acpi_ex_copy_integer_to_index_field(union acpi_operand_object *source_desc,
447 union acpi_operand_object *target_desc);
449 acpi_status
450 acpi_ex_copy_integer_to_bank_field(union acpi_operand_object *source_desc,
451 union acpi_operand_object *target_desc);
453 acpi_status
454 acpi_ex_copy_data_to_named_field(union acpi_operand_object *source_desc,
455 struct acpi_namespace_node *node);
457 acpi_status
458 acpi_ex_copy_integer_to_buffer_field(union acpi_operand_object *source_desc,
459 union acpi_operand_object *target_desc);
462 * exutils - interpreter/scanner utilities
464 void acpi_ex_enter_interpreter(void);
466 void acpi_ex_exit_interpreter(void);
468 u8 acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc);
470 void acpi_ex_acquire_global_lock(u32 rule);
472 void acpi_ex_release_global_lock(u32 rule);
474 void acpi_ex_eisa_id_to_string(char *dest, u64 compressed_id);
476 void acpi_ex_integer_to_string(char *dest, u64 value);
478 void acpi_ex_pci_cls_to_string(char *dest, u8 class_code[3]);
480 u8 acpi_is_valid_space_id(u8 space_id);
483 * exregion - default op_region handlers
485 acpi_status
486 acpi_ex_system_memory_space_handler(u32 function,
487 acpi_physical_address address,
488 u32 bit_width,
489 u64 *value,
490 void *handler_context,
491 void *region_context);
493 acpi_status
494 acpi_ex_system_io_space_handler(u32 function,
495 acpi_physical_address address,
496 u32 bit_width,
497 u64 *value,
498 void *handler_context, void *region_context);
500 acpi_status
501 acpi_ex_pci_config_space_handler(u32 function,
502 acpi_physical_address address,
503 u32 bit_width,
504 u64 *value,
505 void *handler_context, void *region_context);
507 acpi_status
508 acpi_ex_cmos_space_handler(u32 function,
509 acpi_physical_address address,
510 u32 bit_width,
511 u64 *value,
512 void *handler_context, void *region_context);
514 acpi_status
515 acpi_ex_pci_bar_space_handler(u32 function,
516 acpi_physical_address address,
517 u32 bit_width,
518 u64 *value,
519 void *handler_context, void *region_context);
521 acpi_status
522 acpi_ex_embedded_controller_space_handler(u32 function,
523 acpi_physical_address address,
524 u32 bit_width,
525 u64 *value,
526 void *handler_context,
527 void *region_context);
529 acpi_status
530 acpi_ex_sm_bus_space_handler(u32 function,
531 acpi_physical_address address,
532 u32 bit_width,
533 u64 *value,
534 void *handler_context, void *region_context);
536 acpi_status
537 acpi_ex_data_table_space_handler(u32 function,
538 acpi_physical_address address,
539 u32 bit_width,
540 u64 *value,
541 void *handler_context, void *region_context);
543 #endif /* __INTERP_H__ */