Merge master.kernel.org:/pub/scm/linux/kernel/git/dtor/input
[pandora-kernel.git] / 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 /*
52  * exconvrt - object conversion
53  */
54 acpi_status
55 acpi_ex_convert_to_integer (
56         union acpi_operand_object       *obj_desc,
57         union acpi_operand_object       **result_desc,
58         u32                             flags);
59
60 acpi_status
61 acpi_ex_convert_to_buffer (
62         union acpi_operand_object       *obj_desc,
63         union acpi_operand_object       **result_desc);
64
65 acpi_status
66 acpi_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
78 acpi_status
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);
84
85
86 /*
87  * exfield - ACPI AML (p-code) execution - field manipulation
88  */
89 acpi_status
90 acpi_ex_common_buffer_setup (
91         union acpi_operand_object       *obj_desc,
92         u32                             buffer_length,
93         u32                             *datum_count);
94
95 acpi_status
96 acpi_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
102 void
103 acpi_ex_get_buffer_datum(
104         acpi_integer                    *datum,
105         void                            *buffer,
106         u32                             buffer_length,
107         u32                             byte_granularity,
108         u32                             buffer_offset);
109
110 void
111 acpi_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
118 acpi_status
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);
123
124 acpi_status
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);
129
130
131 /*
132  * exfldio - low level field I/O
133  */
134 acpi_status
135 acpi_ex_extract_from_field (
136         union acpi_operand_object       *obj_desc,
137         void                            *buffer,
138         u32                             buffer_length);
139
140 acpi_status
141 acpi_ex_insert_into_field (
142         union acpi_operand_object       *obj_desc,
143         void                            *buffer,
144         u32                             buffer_length);
145
146 acpi_status
147 acpi_ex_access_region (
148         union acpi_operand_object       *obj_desc,
149         u32                             field_datum_byte_offset,
150         acpi_integer                    *value,
151         u32                             read_write);
152
153
154 /*
155  * exmisc - misc support routines
156  */
157 acpi_status
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);
162
163 acpi_status
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);
169
170 acpi_status
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);
176
177 acpi_status
178 acpi_ex_do_logical_numeric_op (
179         u16                             opcode,
180         acpi_integer                    integer0,
181         acpi_integer                    integer1,
182         u8                              *logical_result);
183
184 acpi_status
185 acpi_ex_do_logical_op (
186         u16                             opcode,
187         union acpi_operand_object       *operand0,
188         union acpi_operand_object       *operand1,
189         u8                              *logical_result);
190
191 acpi_integer
192 acpi_ex_do_math_op (
193         u16                             opcode,
194         acpi_integer                    operand0,
195         acpi_integer                    operand1);
196
197 acpi_status
198 acpi_ex_create_mutex (
199         struct acpi_walk_state          *walk_state);
200
201 acpi_status
202 acpi_ex_create_processor (
203         struct acpi_walk_state          *walk_state);
204
205 acpi_status
206 acpi_ex_create_power_resource (
207         struct acpi_walk_state          *walk_state);
208
209 acpi_status
210 acpi_ex_create_region (
211         u8                              *aml_start,
212         u32                             aml_length,
213         u8                              region_space,
214         struct acpi_walk_state          *walk_state);
215
216 acpi_status
217 acpi_ex_create_table_region (
218         struct acpi_walk_state          *walk_state);
219
220 acpi_status
221 acpi_ex_create_event (
222         struct acpi_walk_state          *walk_state);
223
224 acpi_status
225 acpi_ex_create_alias (
226         struct acpi_walk_state          *walk_state);
227
228 acpi_status
229 acpi_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  */
238 acpi_status
239 acpi_ex_load_op (
240         union acpi_operand_object       *obj_desc,
241         union acpi_operand_object       *target,
242         struct acpi_walk_state          *walk_state);
243
244 acpi_status
245 acpi_ex_load_table_op (
246         struct acpi_walk_state          *walk_state,
247         union acpi_operand_object       **return_desc);
248
249 acpi_status
250 acpi_ex_unload_table (
251         union acpi_operand_object       *ddb_handle);
252
253
254 /*
255  * exmutex - mutex support
256  */
257 acpi_status
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);
262
263 acpi_status
264 acpi_ex_release_mutex (
265         union acpi_operand_object       *obj_desc,
266         struct acpi_walk_state          *walk_state);
267
268 void
269 acpi_ex_release_all_mutexes (
270         struct acpi_thread_state        *thread);
271
272 void
273 acpi_ex_unlink_mutex (
274         union acpi_operand_object       *obj_desc);
275
276
277 /*
278  * exprep - ACPI AML execution - prep utilities
279  */
280 acpi_status
281 acpi_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
288 acpi_status
289 acpi_ex_prep_field_value (
290         struct acpi_create_field_info   *info);
291
292
293 /*
294  * exsystem - Interface to OS services
295  */
296 acpi_status
297 acpi_ex_system_do_notify_op (
298         union acpi_operand_object       *value,
299         union acpi_operand_object       *obj_desc);
300
301 acpi_status
302 acpi_ex_system_do_suspend(
303         acpi_integer                    time);
304
305 acpi_status
306 acpi_ex_system_do_stall (
307         u32                             time);
308
309 acpi_status
310 acpi_ex_system_acquire_mutex(
311         union acpi_operand_object       *time,
312         union acpi_operand_object       *obj_desc);
313
314 acpi_status
315 acpi_ex_system_release_mutex(
316         union acpi_operand_object       *obj_desc);
317
318 acpi_status
319 acpi_ex_system_signal_event(
320         union acpi_operand_object       *obj_desc);
321
322 acpi_status
323 acpi_ex_system_wait_event(
324         union acpi_operand_object       *time,
325         union acpi_operand_object       *obj_desc);
326
327 acpi_status
328 acpi_ex_system_reset_event(
329         union acpi_operand_object       *obj_desc);
330
331 acpi_status
332 acpi_ex_system_wait_semaphore (
333         acpi_handle                     semaphore,
334         u16                             timeout);
335
336
337 /*
338  * exoparg1 - ACPI AML execution, 1 operand
339  */
340 acpi_status
341 acpi_ex_opcode_0A_0T_1R (
342         struct acpi_walk_state          *walk_state);
343
344 acpi_status
345 acpi_ex_opcode_1A_0T_0R (
346         struct acpi_walk_state          *walk_state);
347
348 acpi_status
349 acpi_ex_opcode_1A_0T_1R (
350         struct acpi_walk_state          *walk_state);
351
352 acpi_status
353 acpi_ex_opcode_1A_1T_1R (
354         struct acpi_walk_state          *walk_state);
355
356 acpi_status
357 acpi_ex_opcode_1A_1T_0R (
358         struct acpi_walk_state          *walk_state);
359
360 /*
361  * exoparg2 - ACPI AML execution, 2 operands
362  */
363 acpi_status
364 acpi_ex_opcode_2A_0T_0R (
365         struct acpi_walk_state          *walk_state);
366
367 acpi_status
368 acpi_ex_opcode_2A_0T_1R (
369         struct acpi_walk_state          *walk_state);
370
371 acpi_status
372 acpi_ex_opcode_2A_1T_1R (
373         struct acpi_walk_state          *walk_state);
374
375 acpi_status
376 acpi_ex_opcode_2A_2T_1R (
377         struct acpi_walk_state          *walk_state);
378
379
380 /*
381  * exoparg3 - ACPI AML execution, 3 operands
382  */
383 acpi_status
384 acpi_ex_opcode_3A_0T_0R (
385         struct acpi_walk_state          *walk_state);
386
387 acpi_status
388 acpi_ex_opcode_3A_1T_1R (
389         struct acpi_walk_state          *walk_state);
390
391
392 /*
393  * exoparg6 - ACPI AML execution, 6 operands
394  */
395 acpi_status
396 acpi_ex_opcode_6A_0T_1R (
397         struct acpi_walk_state          *walk_state);
398
399
400 /*
401  * exresolv - Object resolution and get value functions
402  */
403 acpi_status
404 acpi_ex_resolve_to_value (
405         union acpi_operand_object       **stack_ptr,
406         struct acpi_walk_state          *walk_state);
407
408 acpi_status
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);
414
415
416 /*
417  * exresnte - resolve namespace node
418  */
419 acpi_status
420 acpi_ex_resolve_node_to_value (
421         struct acpi_namespace_node      **stack_ptr,
422         struct acpi_walk_state          *walk_state);
423
424
425 /*
426  * exresop - resolve operand to value
427  */
428 acpi_status
429 acpi_ex_resolve_operands (
430         u16                             opcode,
431         union acpi_operand_object       **stack_ptr,
432         struct acpi_walk_state          *walk_state);
433
434
435 /*
436  * exdump - Interpreter debug output routines
437  */
438 void
439 acpi_ex_dump_operand (
440         union acpi_operand_object       *obj_desc,
441         u32                             depth);
442
443 void
444 acpi_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
453 #ifdef  ACPI_FUTURE_USAGE
454 void
455 acpi_ex_dump_object_descriptor (
456         union acpi_operand_object       *object,
457         u32                             flags);
458
459 void
460 acpi_ex_dump_node (
461         struct acpi_namespace_node      *node,
462         u32                             flags);
463 #endif  /* ACPI_FUTURE_USAGE */
464
465
466 /*
467  * exnames - AML namestring support
468  */
469 acpi_status
470 acpi_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
476
477 /*
478  * exstore - Object store support
479  */
480 acpi_status
481 acpi_ex_store (
482         union acpi_operand_object       *val_desc,
483         union acpi_operand_object       *dest_desc,
484         struct acpi_walk_state          *walk_state);
485
486 acpi_status
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);
492
493 #define ACPI_IMPLICIT_CONVERSION        TRUE
494 #define ACPI_NO_IMPLICIT_CONVERSION     FALSE
495
496
497 /*
498  * exstoren - resolve/store object
499  */
500 acpi_status
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);
505
506 acpi_status
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);
512
513
514 /*
515  * exstorob - store object - buffer/string
516  */
517 acpi_status
518 acpi_ex_store_buffer_to_buffer (
519         union acpi_operand_object       *source_desc,
520         union acpi_operand_object       *target_desc);
521
522 acpi_status
523 acpi_ex_store_string_to_string (
524         union acpi_operand_object       *source_desc,
525         union acpi_operand_object       *target_desc);
526
527
528 /*
529  * excopy - object copy
530  */
531 acpi_status
532 acpi_ex_copy_integer_to_index_field (
533         union acpi_operand_object       *source_desc,
534         union acpi_operand_object       *target_desc);
535
536 acpi_status
537 acpi_ex_copy_integer_to_bank_field (
538         union acpi_operand_object       *source_desc,
539         union acpi_operand_object       *target_desc);
540
541 acpi_status
542 acpi_ex_copy_data_to_named_field (
543         union acpi_operand_object       *source_desc,
544         struct acpi_namespace_node      *node);
545
546 acpi_status
547 acpi_ex_copy_integer_to_buffer_field (
548         union acpi_operand_object       *source_desc,
549         union acpi_operand_object       *target_desc);
550
551
552 /*
553  * exutils - interpreter/scanner utilities
554  */
555 acpi_status
556 acpi_ex_enter_interpreter (
557         void);
558
559 void
560 acpi_ex_exit_interpreter (
561         void);
562
563 void
564 acpi_ex_truncate_for32bit_table (
565         union acpi_operand_object       *obj_desc);
566
567 u8
568 acpi_ex_acquire_global_lock (
569         u32                             rule);
570
571 void
572 acpi_ex_release_global_lock (
573         u8                              locked);
574
575 void
576 acpi_ex_eisa_id_to_string (
577         u32                             numeric_id,
578         char                            *out_string);
579
580 void
581 acpi_ex_unsigned_integer_to_string (
582         acpi_integer                    value,
583         char                            *out_string);
584
585
586 /*
587  * exregion - default op_region handlers
588  */
589 acpi_status
590 acpi_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
598 acpi_status
599 acpi_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
607 acpi_status
608 acpi_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
616 acpi_status
617 acpi_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
625 acpi_status
626 acpi_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
634 acpi_status
635 acpi_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
643 acpi_status
644 acpi_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
653 acpi_status
654 acpi_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__ */