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