vserver 1.9.3
[linux-2.6.git] / include / acpi / acinterp.h
1 /******************************************************************************
2  *
3  * Name: acinterp.h - Interpreter subcomponent prototypes and defines
4  *
5  *****************************************************************************/
6
7 /*
8  * Copyright (C) 2000 - 2004, 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
51 acpi_status
52 acpi_ex_resolve_operands (
53         u16                             opcode,
54         union acpi_operand_object       **stack_ptr,
55         struct acpi_walk_state          *walk_state);
56
57 acpi_status
58 acpi_ex_check_object_type (
59         acpi_object_type                type_needed,
60         acpi_object_type                this_type,
61         void                            *object);
62
63 /*
64  * exxface - External interpreter interfaces
65  */
66
67 acpi_status
68 acpi_ex_load_table (
69         acpi_table_type                 table_id);
70
71 acpi_status
72 acpi_ex_execute_method (
73         struct acpi_namespace_node      *method_node,
74         union acpi_operand_object       **params,
75         union acpi_operand_object       **return_obj_desc);
76
77
78 /*
79  * exconvrt - object conversion
80  */
81
82 acpi_status
83 acpi_ex_convert_to_integer (
84         union acpi_operand_object       *obj_desc,
85         union acpi_operand_object       **result_desc,
86         struct acpi_walk_state          *walk_state);
87
88 acpi_status
89 acpi_ex_convert_to_buffer (
90         union acpi_operand_object       *obj_desc,
91         union acpi_operand_object       **result_desc,
92         struct acpi_walk_state          *walk_state);
93
94 acpi_status
95 acpi_ex_convert_to_string (
96         union acpi_operand_object       *obj_desc,
97         union acpi_operand_object       **result_desc,
98         u32                             base,
99         u32                             max_length,
100         struct acpi_walk_state          *walk_state);
101
102 acpi_status
103 acpi_ex_convert_to_target_type (
104         acpi_object_type                destination_type,
105         union acpi_operand_object       *source_desc,
106         union acpi_operand_object       **result_desc,
107         struct acpi_walk_state          *walk_state);
108
109 u32
110 acpi_ex_convert_to_ascii (
111         acpi_integer                    integer,
112         u32                             base,
113         u8                              *string,
114         u8                              max_length);
115
116 /*
117  * exfield - ACPI AML (p-code) execution - field manipulation
118  */
119
120 acpi_status
121 acpi_ex_common_buffer_setup (
122         union acpi_operand_object       *obj_desc,
123         u32                             buffer_length,
124         u32                             *datum_count);
125
126 acpi_status
127 acpi_ex_extract_from_field (
128         union acpi_operand_object       *obj_desc,
129         void                            *buffer,
130         u32                             buffer_length);
131
132 acpi_status
133 acpi_ex_insert_into_field (
134         union acpi_operand_object       *obj_desc,
135         void                            *buffer,
136         u32                             buffer_length);
137
138 acpi_status
139 acpi_ex_setup_region (
140         union acpi_operand_object       *obj_desc,
141         u32                             field_datum_byte_offset);
142
143 acpi_status
144 acpi_ex_access_region (
145         union acpi_operand_object       *obj_desc,
146         u32                             field_datum_byte_offset,
147         acpi_integer                    *value,
148         u32                             read_write);
149
150 u8
151 acpi_ex_register_overflow (
152         union acpi_operand_object       *obj_desc,
153         acpi_integer                    value);
154
155 acpi_status
156 acpi_ex_field_datum_io (
157         union acpi_operand_object       *obj_desc,
158         u32                             field_datum_byte_offset,
159         acpi_integer                    *value,
160         u32                             read_write);
161
162 acpi_status
163 acpi_ex_write_with_update_rule (
164         union acpi_operand_object       *obj_desc,
165         acpi_integer                    mask,
166         acpi_integer                    field_value,
167         u32                             field_datum_byte_offset);
168
169 void
170 acpi_ex_get_buffer_datum(
171         acpi_integer                    *datum,
172         void                            *buffer,
173         u32                             buffer_length,
174         u32                             byte_granularity,
175         u32                             buffer_offset);
176
177 void
178 acpi_ex_set_buffer_datum (
179         acpi_integer                    merged_datum,
180         void                            *buffer,
181         u32                             buffer_length,
182         u32                             byte_granularity,
183         u32                             buffer_offset);
184
185 acpi_status
186 acpi_ex_read_data_from_field (
187         struct acpi_walk_state          *walk_state,
188         union acpi_operand_object       *obj_desc,
189         union acpi_operand_object       **ret_buffer_desc);
190
191 acpi_status
192 acpi_ex_write_data_to_field (
193         union acpi_operand_object       *source_desc,
194         union acpi_operand_object       *obj_desc,
195         union acpi_operand_object       **result_desc);
196
197 /*
198  * exmisc - ACPI AML (p-code) execution - specific opcodes
199  */
200
201 acpi_status
202 acpi_ex_opcode_3A_0T_0R (
203         struct acpi_walk_state          *walk_state);
204
205 acpi_status
206 acpi_ex_opcode_3A_1T_1R (
207         struct acpi_walk_state          *walk_state);
208
209 acpi_status
210 acpi_ex_opcode_6A_0T_1R (
211         struct acpi_walk_state          *walk_state);
212
213 u8
214 acpi_ex_do_match (
215         u32                             match_op,
216         acpi_integer                    package_value,
217         acpi_integer                    match_value);
218
219 acpi_status
220 acpi_ex_get_object_reference (
221         union acpi_operand_object       *obj_desc,
222         union acpi_operand_object       **return_desc,
223         struct acpi_walk_state          *walk_state);
224
225 acpi_status
226 acpi_ex_resolve_multiple (
227         struct acpi_walk_state          *walk_state,
228         union acpi_operand_object       *operand,
229         acpi_object_type                *return_type,
230         union acpi_operand_object       **return_desc);
231
232 acpi_status
233 acpi_ex_concat_template (
234         union acpi_operand_object       *obj_desc,
235         union acpi_operand_object       *obj_desc2,
236         union acpi_operand_object       **actual_return_desc,
237         struct acpi_walk_state          *walk_state);
238
239 acpi_status
240 acpi_ex_do_concatenate (
241         union acpi_operand_object       *obj_desc,
242         union acpi_operand_object       *obj_desc2,
243         union acpi_operand_object       **actual_return_desc,
244         struct acpi_walk_state          *walk_state);
245
246 u8
247 acpi_ex_do_logical_op (
248         u16                             opcode,
249         union acpi_operand_object       *obj_desc,
250         union acpi_operand_object       *obj_desc2);
251
252 acpi_integer
253 acpi_ex_do_math_op (
254         u16                             opcode,
255         acpi_integer                    operand0,
256         acpi_integer                    operand1);
257
258 acpi_status
259 acpi_ex_create_mutex (
260         struct acpi_walk_state          *walk_state);
261
262 acpi_status
263 acpi_ex_create_processor (
264         struct acpi_walk_state          *walk_state);
265
266 acpi_status
267 acpi_ex_create_power_resource (
268         struct acpi_walk_state          *walk_state);
269
270 acpi_status
271 acpi_ex_create_region (
272         u8                              *aml_start,
273         u32                             aml_length,
274         u8                              region_space,
275         struct acpi_walk_state          *walk_state);
276
277 acpi_status
278 acpi_ex_create_table_region (
279         struct acpi_walk_state          *walk_state);
280
281 acpi_status
282 acpi_ex_create_event (
283         struct acpi_walk_state          *walk_state);
284
285 acpi_status
286 acpi_ex_create_alias (
287         struct acpi_walk_state          *walk_state);
288
289 acpi_status
290 acpi_ex_create_method (
291         u8                              *aml_start,
292         u32                             aml_length,
293         struct acpi_walk_state          *walk_state);
294
295
296 /*
297  * exconfig - dynamic table load/unload
298  */
299
300 acpi_status
301 acpi_ex_add_table (
302         struct acpi_table_header        *table,
303         struct acpi_namespace_node      *parent_node,
304         union acpi_operand_object       **ddb_handle);
305
306 acpi_status
307 acpi_ex_load_op (
308         union acpi_operand_object       *obj_desc,
309         union acpi_operand_object       *target,
310         struct acpi_walk_state          *walk_state);
311
312 acpi_status
313 acpi_ex_load_table_op (
314         struct acpi_walk_state          *walk_state,
315         union acpi_operand_object       **return_desc);
316
317 acpi_status
318 acpi_ex_unload_table (
319         union acpi_operand_object       *ddb_handle);
320
321
322 /*
323  * exmutex - mutex support
324  */
325
326 acpi_status
327 acpi_ex_acquire_mutex (
328         union acpi_operand_object       *time_desc,
329         union acpi_operand_object       *obj_desc,
330         struct acpi_walk_state          *walk_state);
331
332 acpi_status
333 acpi_ex_release_mutex (
334         union acpi_operand_object       *obj_desc,
335         struct acpi_walk_state          *walk_state);
336
337 void
338 acpi_ex_release_all_mutexes (
339         struct acpi_thread_state        *thread);
340
341 void
342 acpi_ex_unlink_mutex (
343         union acpi_operand_object       *obj_desc);
344
345 void
346 acpi_ex_link_mutex (
347         union acpi_operand_object       *obj_desc,
348         struct acpi_thread_state        *thread);
349
350 /*
351  * exprep - ACPI AML (p-code) execution - prep utilities
352  */
353
354 acpi_status
355 acpi_ex_prep_common_field_object (
356         union acpi_operand_object       *obj_desc,
357         u8                              field_flags,
358         u8                              field_attribute,
359         u32                             field_bit_position,
360         u32                             field_bit_length);
361
362 acpi_status
363 acpi_ex_prep_field_value (
364         struct acpi_create_field_info   *info);
365
366 /*
367  * exsystem - Interface to OS services
368  */
369
370 acpi_status
371 acpi_ex_system_do_notify_op (
372         union acpi_operand_object       *value,
373         union acpi_operand_object       *obj_desc);
374
375 acpi_status
376 acpi_ex_system_do_suspend(
377         u32                             time);
378
379 acpi_status
380 acpi_ex_system_do_stall (
381         u32                             time);
382
383 acpi_status
384 acpi_ex_system_acquire_mutex(
385         union acpi_operand_object       *time,
386         union acpi_operand_object       *obj_desc);
387
388 acpi_status
389 acpi_ex_system_release_mutex(
390         union acpi_operand_object       *obj_desc);
391
392 acpi_status
393 acpi_ex_system_signal_event(
394         union acpi_operand_object       *obj_desc);
395
396 acpi_status
397 acpi_ex_system_wait_event(
398         union acpi_operand_object       *time,
399         union acpi_operand_object       *obj_desc);
400
401 acpi_status
402 acpi_ex_system_reset_event(
403         union acpi_operand_object       *obj_desc);
404
405 acpi_status
406 acpi_ex_system_wait_semaphore (
407         acpi_handle                     semaphore,
408         u16                             timeout);
409
410
411 /*
412  * exmonadic - ACPI AML (p-code) execution, monadic operators
413  */
414
415 acpi_status
416 acpi_ex_opcode_1A_0T_0R (
417         struct acpi_walk_state          *walk_state);
418
419 acpi_status
420 acpi_ex_opcode_1A_0T_1R (
421         struct acpi_walk_state          *walk_state);
422
423 acpi_status
424 acpi_ex_opcode_1A_1T_1R (
425         struct acpi_walk_state          *walk_state);
426
427 acpi_status
428 acpi_ex_opcode_1A_1T_0R (
429         struct acpi_walk_state          *walk_state);
430
431 /*
432  * exdyadic - ACPI AML (p-code) execution, dyadic operators
433  */
434
435 acpi_status
436 acpi_ex_opcode_2A_0T_0R (
437         struct acpi_walk_state          *walk_state);
438
439 acpi_status
440 acpi_ex_opcode_2A_0T_1R (
441         struct acpi_walk_state          *walk_state);
442
443 acpi_status
444 acpi_ex_opcode_2A_1T_1R (
445         struct acpi_walk_state          *walk_state);
446
447 acpi_status
448 acpi_ex_opcode_2A_2T_1R (
449         struct acpi_walk_state          *walk_state);
450
451
452 /*
453  * exresolv  - Object resolution and get value functions
454  */
455
456 acpi_status
457 acpi_ex_resolve_to_value (
458         union acpi_operand_object       **stack_ptr,
459         struct acpi_walk_state          *walk_state);
460
461 acpi_status
462 acpi_ex_resolve_node_to_value (
463         struct acpi_namespace_node      **stack_ptr,
464         struct acpi_walk_state          *walk_state);
465
466 acpi_status
467 acpi_ex_resolve_object_to_value (
468         union acpi_operand_object       **stack_ptr,
469         struct acpi_walk_state          *walk_state);
470
471
472 /*
473  * exdump - Scanner debug output routines
474  */
475
476 void
477 acpi_ex_dump_operand (
478         union acpi_operand_object       *entry_desc);
479
480 void
481 acpi_ex_dump_operands (
482         union acpi_operand_object       **operands,
483         acpi_interpreter_mode           interpreter_mode,
484         char                            *ident,
485         u32                             num_levels,
486         char                            *note,
487         char                            *module_name,
488         u32                             line_number);
489
490 void
491 acpi_ex_dump_object_descriptor (
492         union acpi_operand_object       *object,
493         u32                             flags);
494
495 void
496 acpi_ex_dump_node (
497         struct acpi_namespace_node      *node,
498         u32                             flags);
499
500 void
501 acpi_ex_out_string (
502         char                            *title,
503         char                            *value);
504
505 void
506 acpi_ex_out_pointer (
507         char                            *title,
508         void                            *value);
509
510 void
511 acpi_ex_out_integer (
512         char                            *title,
513         u32                             value);
514
515 void
516 acpi_ex_out_address (
517         char                            *title,
518         acpi_physical_address           value);
519
520
521 /*
522  * exnames - interpreter/scanner name load/execute
523  */
524
525 char *
526 acpi_ex_allocate_name_string (
527         u32                             prefix_count,
528         u32                             num_name_segs);
529
530 u32
531 acpi_ex_good_char (
532         u32                             character);
533
534 acpi_status
535 acpi_ex_name_segment (
536         u8                              **in_aml_address,
537         char                            *name_string);
538
539 acpi_status
540 acpi_ex_get_name_string (
541         acpi_object_type                data_type,
542         u8                              *in_aml_address,
543         char                            **out_name_string,
544         u32                             *out_name_length);
545
546 acpi_status
547 acpi_ex_do_name (
548         acpi_object_type                data_type,
549         acpi_interpreter_mode           load_exec_mode);
550
551
552 /*
553  * exstore - Object store support
554  */
555
556 acpi_status
557 acpi_ex_store (
558         union acpi_operand_object       *val_desc,
559         union acpi_operand_object       *dest_desc,
560         struct acpi_walk_state          *walk_state);
561
562 acpi_status
563 acpi_ex_store_object_to_index (
564         union acpi_operand_object       *val_desc,
565         union acpi_operand_object       *dest_desc,
566         struct acpi_walk_state          *walk_state);
567
568 acpi_status
569 acpi_ex_store_object_to_node (
570         union acpi_operand_object       *source_desc,
571         struct acpi_namespace_node      *node,
572         struct acpi_walk_state          *walk_state,
573         u8                              implicit_conversion);
574
575 #define ACPI_IMPLICIT_CONVERSION        TRUE
576 #define ACPI_NO_IMPLICIT_CONVERSION     FALSE
577
578 /*
579  * exstoren
580  */
581
582 acpi_status
583 acpi_ex_resolve_object (
584         union acpi_operand_object       **source_desc_ptr,
585         acpi_object_type                target_type,
586         struct acpi_walk_state          *walk_state);
587
588 acpi_status
589 acpi_ex_store_object_to_object (
590         union acpi_operand_object       *source_desc,
591         union acpi_operand_object       *dest_desc,
592         union acpi_operand_object       **new_desc,
593         struct acpi_walk_state          *walk_state);
594
595
596 /*
597  * excopy - object copy
598  */
599
600 acpi_status
601 acpi_ex_store_buffer_to_buffer (
602         union acpi_operand_object       *source_desc,
603         union acpi_operand_object       *target_desc);
604
605 acpi_status
606 acpi_ex_store_string_to_string (
607         union acpi_operand_object       *source_desc,
608         union acpi_operand_object       *target_desc);
609
610 acpi_status
611 acpi_ex_copy_integer_to_index_field (
612         union acpi_operand_object       *source_desc,
613         union acpi_operand_object       *target_desc);
614
615 acpi_status
616 acpi_ex_copy_integer_to_bank_field (
617         union acpi_operand_object       *source_desc,
618         union acpi_operand_object       *target_desc);
619
620 acpi_status
621 acpi_ex_copy_data_to_named_field (
622         union acpi_operand_object       *source_desc,
623         struct acpi_namespace_node      *node);
624
625 acpi_status
626 acpi_ex_copy_integer_to_buffer_field (
627         union acpi_operand_object       *source_desc,
628         union acpi_operand_object       *target_desc);
629
630 /*
631  * exutils - interpreter/scanner utilities
632  */
633
634 acpi_status
635 acpi_ex_enter_interpreter (
636         void);
637
638 void
639 acpi_ex_exit_interpreter (
640         void);
641
642 void
643 acpi_ex_truncate_for32bit_table (
644         union acpi_operand_object       *obj_desc);
645
646 u8
647 acpi_ex_acquire_global_lock (
648         u32                             rule);
649
650 void
651 acpi_ex_release_global_lock (
652         u8                              locked);
653
654 u32
655 acpi_ex_digits_needed (
656         acpi_integer                    value,
657         u32                             base);
658
659 void
660 acpi_ex_eisa_id_to_string (
661         u32                             numeric_id,
662         char                            *out_string);
663
664 void
665 acpi_ex_unsigned_integer_to_string (
666         acpi_integer                    value,
667         char                            *out_string);
668
669
670 /*
671  * exregion - default op_region handlers
672  */
673
674 acpi_status
675 acpi_ex_system_memory_space_handler (
676         u32                             function,
677         acpi_physical_address           address,
678         u32                             bit_width,
679         acpi_integer                    *value,
680         void                            *handler_context,
681         void                            *region_context);
682
683 acpi_status
684 acpi_ex_system_io_space_handler (
685         u32                             function,
686         acpi_physical_address           address,
687         u32                             bit_width,
688         acpi_integer                    *value,
689         void                            *handler_context,
690         void                            *region_context);
691
692 acpi_status
693 acpi_ex_pci_config_space_handler (
694         u32                             function,
695         acpi_physical_address           address,
696         u32                             bit_width,
697         acpi_integer                    *value,
698         void                            *handler_context,
699         void                            *region_context);
700
701 acpi_status
702 acpi_ex_cmos_space_handler (
703         u32                             function,
704         acpi_physical_address           address,
705         u32                             bit_width,
706         acpi_integer                    *value,
707         void                            *handler_context,
708         void                            *region_context);
709
710 acpi_status
711 acpi_ex_pci_bar_space_handler (
712         u32                             function,
713         acpi_physical_address           address,
714         u32                             bit_width,
715         acpi_integer                    *value,
716         void                            *handler_context,
717         void                            *region_context);
718
719 acpi_status
720 acpi_ex_embedded_controller_space_handler (
721         u32                             function,
722         acpi_physical_address           address,
723         u32                             bit_width,
724         acpi_integer                    *value,
725         void                            *handler_context,
726         void                            *region_context);
727
728 acpi_status
729 acpi_ex_sm_bus_space_handler (
730         u32                             function,
731         acpi_physical_address           address,
732         u32                             bit_width,
733         acpi_integer                    *value,
734         void                            *handler_context,
735         void                            *region_context);
736
737
738 acpi_status
739 acpi_ex_data_table_space_handler (
740         u32                             function,
741         acpi_physical_address           address,
742         u32                             bit_width,
743         acpi_integer                    *value,
744         void                            *handler_context,
745         void                            *region_context);
746
747 #endif /* __INTERP_H__ */