blob: 5c7172477a0f5d356ef9ce86bbf991e4c391b392 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/******************************************************************************
2 *
3 * Name: acinterp.h - Interpreter subcomponent prototypes and defines
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
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.
25 *
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.
29 *
30 * NO WARRANTY
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.
42 */
43
44#ifndef __ACINTERP_H__
45#define __ACINTERP_H__
46
47
48#define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1]))
49
50
Linus Torvalds1da177e2005-04-16 15:20:36 -070051/*
52 * exconvrt - object conversion
53 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070054acpi_status
55acpi_ex_convert_to_integer (
56 union acpi_operand_object *obj_desc,
57 union acpi_operand_object **result_desc,
58 u32 flags);
59
60acpi_status
61acpi_ex_convert_to_buffer (
62 union acpi_operand_object *obj_desc,
63 union acpi_operand_object **result_desc);
64
65acpi_status
66acpi_ex_convert_to_string (
67 union acpi_operand_object *obj_desc,
68 union acpi_operand_object **result_desc,
69 u32 type);
70
71/* Types for ->String conversion */
72
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
77
78acpi_status
79acpi_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);
84
Linus Torvalds1da177e2005-04-16 15:20:36 -070085
86/*
87 * exfield - ACPI AML (p-code) execution - field manipulation
88 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070089acpi_status
90acpi_ex_common_buffer_setup (
91 union acpi_operand_object *obj_desc,
92 u32 buffer_length,
93 u32 *datum_count);
94
95acpi_status
Linus Torvalds1da177e2005-04-16 15:20:36 -070096acpi_ex_write_with_update_rule (
97 union acpi_operand_object *obj_desc,
98 acpi_integer mask,
99 acpi_integer field_value,
100 u32 field_datum_byte_offset);
101
102void
103acpi_ex_get_buffer_datum(
104 acpi_integer *datum,
105 void *buffer,
106 u32 buffer_length,
107 u32 byte_granularity,
108 u32 buffer_offset);
109
110void
111acpi_ex_set_buffer_datum (
112 acpi_integer merged_datum,
113 void *buffer,
114 u32 buffer_length,
115 u32 byte_granularity,
116 u32 buffer_offset);
117
118acpi_status
119acpi_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);
123
124acpi_status
125acpi_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);
129
Robert Moore44f6c012005-04-18 22:49:35 -0400130
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131/*
Robert Moore44f6c012005-04-18 22:49:35 -0400132 * exfldio - low level field I/O
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133 */
Robert Moore44f6c012005-04-18 22:49:35 -0400134acpi_status
135acpi_ex_extract_from_field (
136 union acpi_operand_object *obj_desc,
137 void *buffer,
138 u32 buffer_length);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700139
140acpi_status
Robert Moore44f6c012005-04-18 22:49:35 -0400141acpi_ex_insert_into_field (
142 union acpi_operand_object *obj_desc,
143 void *buffer,
144 u32 buffer_length);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145
146acpi_status
Robert Moore44f6c012005-04-18 22:49:35 -0400147acpi_ex_access_region (
148 union acpi_operand_object *obj_desc,
149 u32 field_datum_byte_offset,
150 acpi_integer *value,
151 u32 read_write);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152
Linus Torvalds1da177e2005-04-16 15:20:36 -0700153
Robert Moore44f6c012005-04-18 22:49:35 -0400154/*
155 * exmisc - misc support routines
156 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157acpi_status
158acpi_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);
162
163acpi_status
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164acpi_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);
169
170acpi_status
171acpi_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);
176
177acpi_status
178acpi_ex_do_logical_numeric_op (
179 u16 opcode,
180 acpi_integer integer0,
181 acpi_integer integer1,
182 u8 *logical_result);
183
184acpi_status
185acpi_ex_do_logical_op (
186 u16 opcode,
187 union acpi_operand_object *operand0,
188 union acpi_operand_object *operand1,
189 u8 *logical_result);
190
191acpi_integer
192acpi_ex_do_math_op (
193 u16 opcode,
194 acpi_integer operand0,
195 acpi_integer operand1);
196
197acpi_status
198acpi_ex_create_mutex (
199 struct acpi_walk_state *walk_state);
200
201acpi_status
202acpi_ex_create_processor (
203 struct acpi_walk_state *walk_state);
204
205acpi_status
206acpi_ex_create_power_resource (
207 struct acpi_walk_state *walk_state);
208
209acpi_status
210acpi_ex_create_region (
211 u8 *aml_start,
212 u32 aml_length,
213 u8 region_space,
214 struct acpi_walk_state *walk_state);
215
216acpi_status
217acpi_ex_create_table_region (
218 struct acpi_walk_state *walk_state);
219
220acpi_status
221acpi_ex_create_event (
222 struct acpi_walk_state *walk_state);
223
224acpi_status
225acpi_ex_create_alias (
226 struct acpi_walk_state *walk_state);
227
228acpi_status
229acpi_ex_create_method (
230 u8 *aml_start,
231 u32 aml_length,
232 struct acpi_walk_state *walk_state);
233
234
235/*
236 * exconfig - dynamic table load/unload
237 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238acpi_status
239acpi_ex_load_op (
240 union acpi_operand_object *obj_desc,
241 union acpi_operand_object *target,
242 struct acpi_walk_state *walk_state);
243
244acpi_status
245acpi_ex_load_table_op (
246 struct acpi_walk_state *walk_state,
247 union acpi_operand_object **return_desc);
248
249acpi_status
250acpi_ex_unload_table (
251 union acpi_operand_object *ddb_handle);
252
253
254/*
255 * exmutex - mutex support
256 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700257acpi_status
258acpi_ex_acquire_mutex (
259 union acpi_operand_object *time_desc,
260 union acpi_operand_object *obj_desc,
261 struct acpi_walk_state *walk_state);
262
263acpi_status
264acpi_ex_release_mutex (
265 union acpi_operand_object *obj_desc,
266 struct acpi_walk_state *walk_state);
267
268void
269acpi_ex_release_all_mutexes (
270 struct acpi_thread_state *thread);
271
272void
273acpi_ex_unlink_mutex (
274 union acpi_operand_object *obj_desc);
275
Linus Torvalds1da177e2005-04-16 15:20:36 -0700276
277/*
Robert Moore44f6c012005-04-18 22:49:35 -0400278 * exprep - ACPI AML execution - prep utilities
Linus Torvalds1da177e2005-04-16 15:20:36 -0700279 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700280acpi_status
281acpi_ex_prep_common_field_object (
282 union acpi_operand_object *obj_desc,
283 u8 field_flags,
284 u8 field_attribute,
285 u32 field_bit_position,
286 u32 field_bit_length);
287
288acpi_status
289acpi_ex_prep_field_value (
290 struct acpi_create_field_info *info);
291
Robert Moore44f6c012005-04-18 22:49:35 -0400292
Linus Torvalds1da177e2005-04-16 15:20:36 -0700293/*
294 * exsystem - Interface to OS services
295 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700296acpi_status
297acpi_ex_system_do_notify_op (
298 union acpi_operand_object *value,
299 union acpi_operand_object *obj_desc);
300
301acpi_status
302acpi_ex_system_do_suspend(
303 acpi_integer time);
304
305acpi_status
306acpi_ex_system_do_stall (
307 u32 time);
308
309acpi_status
310acpi_ex_system_acquire_mutex(
311 union acpi_operand_object *time,
312 union acpi_operand_object *obj_desc);
313
314acpi_status
315acpi_ex_system_release_mutex(
316 union acpi_operand_object *obj_desc);
317
318acpi_status
319acpi_ex_system_signal_event(
320 union acpi_operand_object *obj_desc);
321
322acpi_status
323acpi_ex_system_wait_event(
324 union acpi_operand_object *time,
325 union acpi_operand_object *obj_desc);
326
327acpi_status
328acpi_ex_system_reset_event(
329 union acpi_operand_object *obj_desc);
330
331acpi_status
332acpi_ex_system_wait_semaphore (
333 acpi_handle semaphore,
334 u16 timeout);
335
336
337/*
Robert Moore44f6c012005-04-18 22:49:35 -0400338 * exoparg1 - ACPI AML execution, 1 operand
Linus Torvalds1da177e2005-04-16 15:20:36 -0700339 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700340acpi_status
341acpi_ex_opcode_0A_0T_1R (
342 struct acpi_walk_state *walk_state);
343
344acpi_status
345acpi_ex_opcode_1A_0T_0R (
346 struct acpi_walk_state *walk_state);
347
348acpi_status
349acpi_ex_opcode_1A_0T_1R (
350 struct acpi_walk_state *walk_state);
351
352acpi_status
353acpi_ex_opcode_1A_1T_1R (
354 struct acpi_walk_state *walk_state);
355
356acpi_status
357acpi_ex_opcode_1A_1T_0R (
358 struct acpi_walk_state *walk_state);
359
360/*
Robert Moore44f6c012005-04-18 22:49:35 -0400361 * exoparg2 - ACPI AML execution, 2 operands
Linus Torvalds1da177e2005-04-16 15:20:36 -0700362 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700363acpi_status
364acpi_ex_opcode_2A_0T_0R (
365 struct acpi_walk_state *walk_state);
366
367acpi_status
368acpi_ex_opcode_2A_0T_1R (
369 struct acpi_walk_state *walk_state);
370
371acpi_status
372acpi_ex_opcode_2A_1T_1R (
373 struct acpi_walk_state *walk_state);
374
375acpi_status
376acpi_ex_opcode_2A_2T_1R (
377 struct acpi_walk_state *walk_state);
378
379
380/*
Robert Moore44f6c012005-04-18 22:49:35 -0400381 * exoparg3 - ACPI AML execution, 3 operands
Linus Torvalds1da177e2005-04-16 15:20:36 -0700382 */
Robert Moore44f6c012005-04-18 22:49:35 -0400383acpi_status
384acpi_ex_opcode_3A_0T_0R (
385 struct acpi_walk_state *walk_state);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700386
387acpi_status
Robert Moore44f6c012005-04-18 22:49:35 -0400388acpi_ex_opcode_3A_1T_1R (
389 struct acpi_walk_state *walk_state);
390
391
392/*
393 * exoparg6 - ACPI AML execution, 6 operands
394 */
395acpi_status
396acpi_ex_opcode_6A_0T_1R (
397 struct acpi_walk_state *walk_state);
398
399
400/*
401 * exresolv - Object resolution and get value functions
402 */
403acpi_status
Linus Torvalds1da177e2005-04-16 15:20:36 -0700404acpi_ex_resolve_to_value (
405 union acpi_operand_object **stack_ptr,
406 struct acpi_walk_state *walk_state);
407
408acpi_status
Robert Moore44f6c012005-04-18 22:49:35 -0400409acpi_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);
414
415
416/*
417 * exresnte - resolve namespace node
418 */
419acpi_status
Linus Torvalds1da177e2005-04-16 15:20:36 -0700420acpi_ex_resolve_node_to_value (
421 struct acpi_namespace_node **stack_ptr,
422 struct acpi_walk_state *walk_state);
423
Robert Moore44f6c012005-04-18 22:49:35 -0400424
425/*
426 * exresop - resolve operand to value
427 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700428acpi_status
Robert Moore44f6c012005-04-18 22:49:35 -0400429acpi_ex_resolve_operands (
430 u16 opcode,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700431 union acpi_operand_object **stack_ptr,
432 struct acpi_walk_state *walk_state);
433
434
435/*
436 * exdump - Interpreter debug output routines
437 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700438void
439acpi_ex_dump_operand (
440 union acpi_operand_object *obj_desc,
441 u32 depth);
442
443void
444acpi_ex_dump_operands (
445 union acpi_operand_object **operands,
446 acpi_interpreter_mode interpreter_mode,
447 char *ident,
448 u32 num_levels,
449 char *note,
450 char *module_name,
451 u32 line_number);
452
Robert Moore44f6c012005-04-18 22:49:35 -0400453#ifdef ACPI_FUTURE_USAGE
Linus Torvalds1da177e2005-04-16 15:20:36 -0700454void
455acpi_ex_dump_object_descriptor (
456 union acpi_operand_object *object,
457 u32 flags);
458
459void
460acpi_ex_dump_node (
461 struct acpi_namespace_node *node,
462 u32 flags);
Robert Moore44f6c012005-04-18 22:49:35 -0400463#endif /* ACPI_FUTURE_USAGE */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700464
Linus Torvalds1da177e2005-04-16 15:20:36 -0700465
466/*
Robert Moore44f6c012005-04-18 22:49:35 -0400467 * exnames - AML namestring support
Linus Torvalds1da177e2005-04-16 15:20:36 -0700468 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700469acpi_status
470acpi_ex_get_name_string (
471 acpi_object_type data_type,
472 u8 *in_aml_address,
473 char **out_name_string,
474 u32 *out_name_length);
475
Linus Torvalds1da177e2005-04-16 15:20:36 -0700476
477/*
478 * exstore - Object store support
479 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700480acpi_status
481acpi_ex_store (
482 union acpi_operand_object *val_desc,
483 union acpi_operand_object *dest_desc,
484 struct acpi_walk_state *walk_state);
485
486acpi_status
Linus Torvalds1da177e2005-04-16 15:20:36 -0700487acpi_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);
492
493#define ACPI_IMPLICIT_CONVERSION TRUE
494#define ACPI_NO_IMPLICIT_CONVERSION FALSE
495
Linus Torvalds1da177e2005-04-16 15:20:36 -0700496
Robert Moore44f6c012005-04-18 22:49:35 -0400497/*
498 * exstoren - resolve/store object
499 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700500acpi_status
501acpi_ex_resolve_object (
502 union acpi_operand_object **source_desc_ptr,
503 acpi_object_type target_type,
504 struct acpi_walk_state *walk_state);
505
506acpi_status
507acpi_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);
512
513
514/*
Robert Moore44f6c012005-04-18 22:49:35 -0400515 * exstorob - store object - buffer/string
Linus Torvalds1da177e2005-04-16 15:20:36 -0700516 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700517acpi_status
518acpi_ex_store_buffer_to_buffer (
519 union acpi_operand_object *source_desc,
520 union acpi_operand_object *target_desc);
521
522acpi_status
523acpi_ex_store_string_to_string (
524 union acpi_operand_object *source_desc,
525 union acpi_operand_object *target_desc);
526
Robert Moore44f6c012005-04-18 22:49:35 -0400527
528/*
529 * excopy - object copy
530 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700531acpi_status
532acpi_ex_copy_integer_to_index_field (
533 union acpi_operand_object *source_desc,
534 union acpi_operand_object *target_desc);
535
536acpi_status
537acpi_ex_copy_integer_to_bank_field (
538 union acpi_operand_object *source_desc,
539 union acpi_operand_object *target_desc);
540
541acpi_status
542acpi_ex_copy_data_to_named_field (
543 union acpi_operand_object *source_desc,
544 struct acpi_namespace_node *node);
545
546acpi_status
547acpi_ex_copy_integer_to_buffer_field (
548 union acpi_operand_object *source_desc,
549 union acpi_operand_object *target_desc);
550
Robert Moore44f6c012005-04-18 22:49:35 -0400551
Linus Torvalds1da177e2005-04-16 15:20:36 -0700552/*
553 * exutils - interpreter/scanner utilities
554 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700555acpi_status
556acpi_ex_enter_interpreter (
557 void);
558
559void
560acpi_ex_exit_interpreter (
561 void);
562
563void
564acpi_ex_truncate_for32bit_table (
565 union acpi_operand_object *obj_desc);
566
567u8
568acpi_ex_acquire_global_lock (
569 u32 rule);
570
571void
572acpi_ex_release_global_lock (
573 u8 locked);
574
Linus Torvalds1da177e2005-04-16 15:20:36 -0700575void
576acpi_ex_eisa_id_to_string (
577 u32 numeric_id,
578 char *out_string);
579
580void
581acpi_ex_unsigned_integer_to_string (
582 acpi_integer value,
583 char *out_string);
584
585
586/*
587 * exregion - default op_region handlers
588 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700589acpi_status
590acpi_ex_system_memory_space_handler (
591 u32 function,
592 acpi_physical_address address,
593 u32 bit_width,
594 acpi_integer *value,
595 void *handler_context,
596 void *region_context);
597
598acpi_status
599acpi_ex_system_io_space_handler (
600 u32 function,
601 acpi_physical_address address,
602 u32 bit_width,
603 acpi_integer *value,
604 void *handler_context,
605 void *region_context);
606
607acpi_status
608acpi_ex_pci_config_space_handler (
609 u32 function,
610 acpi_physical_address address,
611 u32 bit_width,
612 acpi_integer *value,
613 void *handler_context,
614 void *region_context);
615
616acpi_status
617acpi_ex_cmos_space_handler (
618 u32 function,
619 acpi_physical_address address,
620 u32 bit_width,
621 acpi_integer *value,
622 void *handler_context,
623 void *region_context);
624
625acpi_status
626acpi_ex_pci_bar_space_handler (
627 u32 function,
628 acpi_physical_address address,
629 u32 bit_width,
630 acpi_integer *value,
631 void *handler_context,
632 void *region_context);
633
634acpi_status
635acpi_ex_embedded_controller_space_handler (
636 u32 function,
637 acpi_physical_address address,
638 u32 bit_width,
639 acpi_integer *value,
640 void *handler_context,
641 void *region_context);
642
643acpi_status
644acpi_ex_sm_bus_space_handler (
645 u32 function,
646 acpi_physical_address address,
647 u32 bit_width,
648 acpi_integer *value,
649 void *handler_context,
650 void *region_context);
651
652
653acpi_status
654acpi_ex_data_table_space_handler (
655 u32 function,
656 acpi_physical_address address,
657 u32 bit_width,
658 acpi_integer *value,
659 void *handler_context,
660 void *region_context);
661
662#endif /* __INTERP_H__ */