make oldconfig will rebuild these...
[linux-2.4.21-pre4.git] / drivers / acpi / include / acpiosxf.h
1
2 /******************************************************************************
3  *
4  * Name: acpiosxf.h - All interfaces to the OS Services Layer (OSL).  These
5  *                    interfaces must be implemented by OSL to interface the
6  *                    ACPI components to the host operating system.
7  *
8  *****************************************************************************/
9
10
11 /*
12  *  Copyright (C) 2000, 2001 R. Byron Moore
13  *
14  *  This program is free software; you can redistribute it and/or modify
15  *  it under the terms of the GNU General Public License as published by
16  *  the Free Software Foundation; either version 2 of the License, or
17  *  (at your option) any later version.
18  *
19  *  This program is distributed in the hope that it will be useful,
20  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  *  GNU General Public License for more details.
23  *
24  *  You should have received a copy of the GNU General Public License
25  *  along with this program; if not, write to the Free Software
26  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
27  */
28
29 #ifndef __ACPIOSXF_H__
30 #define __ACPIOSXF_H__
31
32 #include "platform/acenv.h"
33 #include "actypes.h"
34
35
36 /* Priorities for Acpi_os_queue_for_execution */
37
38 #define OSD_PRIORITY_GPE            1
39 #define OSD_PRIORITY_HIGH           2
40 #define OSD_PRIORITY_MED            3
41 #define OSD_PRIORITY_LO             4
42
43 #define ACPI_NO_UNIT_LIMIT          ((u32) -1)
44 #define ACPI_MUTEX_SEM              1
45
46
47 /* Functions for Acpi_os_signal */
48
49 #define ACPI_SIGNAL_FATAL           0
50 #define ACPI_SIGNAL_BREAKPOINT      1
51
52 typedef struct acpi_fatal_info
53 {
54         u32                     type;
55         u32                     code;
56         u32                     argument;
57
58 } ACPI_SIGNAL_FATAL_INFO;
59
60
61 /*
62  * Types specific to the OS service interfaces
63  */
64
65 typedef
66 u32 (*OSD_HANDLER) (
67         void                    *context);
68
69 typedef
70 void (*OSD_EXECUTION_CALLBACK) (
71         void                    *context);
72
73
74 /*
75  * OSL Initialization and shutdown primitives
76  */
77
78 acpi_status
79 acpi_os_initialize (
80         void);
81
82 acpi_status
83 acpi_os_terminate (
84         void);
85
86 acpi_status
87 acpi_os_get_root_pointer (
88         u32                     flags,
89         ACPI_PHYSICAL_ADDRESS   *rsdp_physical_address);
90
91
92 /*
93  * Synchronization primitives
94  */
95
96 acpi_status
97 acpi_os_create_semaphore (
98         u32                     max_units,
99         u32                     initial_units,
100         acpi_handle             *out_handle);
101
102 acpi_status
103 acpi_os_delete_semaphore (
104         acpi_handle             handle);
105
106 acpi_status
107 acpi_os_wait_semaphore (
108         acpi_handle             handle,
109         u32                     units,
110         u32                     timeout);
111
112 acpi_status
113 acpi_os_signal_semaphore (
114         acpi_handle             handle,
115         u32                     units);
116
117
118 /*
119  * Memory allocation and mapping
120  */
121
122 void *
123 acpi_os_allocate (
124         u32                     size);
125
126 void *
127 acpi_os_callocate (
128         u32                     size);
129
130 void
131 acpi_os_free (
132         void *                  memory);
133
134 acpi_status
135 acpi_os_map_memory (
136         ACPI_PHYSICAL_ADDRESS   physical_address,
137         u32                     length,
138         void                    **logical_address);
139
140 void
141 acpi_os_unmap_memory (
142         void                    *logical_address,
143         u32                     length);
144
145 acpi_status
146 acpi_os_get_physical_address (
147         void                    *logical_address,
148         ACPI_PHYSICAL_ADDRESS   *physical_address);
149
150
151 /*
152  * Interrupt handlers
153  */
154
155 acpi_status
156 acpi_os_install_interrupt_handler (
157         u32                     interrupt_number,
158         OSD_HANDLER             service_routine,
159         void                    *context);
160
161 acpi_status
162 acpi_os_remove_interrupt_handler (
163         u32                     interrupt_number,
164         OSD_HANDLER             service_routine);
165
166
167 /*
168  * Threads and Scheduling
169  */
170
171 u32
172 acpi_os_get_thread_id (
173         void);
174
175 acpi_status
176 acpi_os_queue_for_execution (
177         u32                     priority,
178         OSD_EXECUTION_CALLBACK  function,
179         void                    *context);
180
181 void
182 acpi_os_sleep (
183         u32                     seconds,
184         u32                     milliseconds);
185
186 void
187 acpi_os_stall (
188         u32                     microseconds);
189
190
191 /*
192  * Platform and hardware-independent I/O interfaces
193  */
194
195 acpi_status
196 acpi_os_read_port (
197         ACPI_IO_ADDRESS         address,
198         void                    *value,
199         u32                     width);
200
201
202 acpi_status
203 acpi_os_write_port (
204         ACPI_IO_ADDRESS         address,
205         NATIVE_UINT             value,
206         u32                     width);
207
208
209 /*
210  * Platform and hardware-independent physical memory interfaces
211  */
212
213 acpi_status
214 acpi_os_read_memory (
215         ACPI_PHYSICAL_ADDRESS   address,
216         void                    *value,
217         u32                     width);
218
219
220 acpi_status
221 acpi_os_write_memory (
222         ACPI_PHYSICAL_ADDRESS   address,
223         NATIVE_UINT             value,
224         u32                     width);
225
226
227 /*
228  * Platform and hardware-independent PCI configuration space access
229  */
230
231 acpi_status
232 acpi_os_read_pci_configuration (
233         acpi_pci_id             *pci_id,
234         u32                     register,
235         void                    *value,
236         u32                     width);
237
238
239 acpi_status
240 acpi_os_write_pci_configuration (
241         acpi_pci_id             *pci_id,
242         u32                     register,
243         NATIVE_UINT             value,
244         u32                     width);
245
246
247 /*
248  * Miscellaneous
249  */
250
251 u8
252 acpi_os_readable (
253         void                    *pointer,
254         u32                     length);
255
256
257 u8
258 acpi_os_writable (
259         void                    *pointer,
260         u32                     length);
261
262 u32
263 acpi_os_get_timer (
264         void);
265
266 acpi_status
267 acpi_os_signal (
268         u32                     function,
269         void                    *info);
270
271 /*
272  * Debug print routines
273  */
274
275 s32
276 acpi_os_printf (
277         const NATIVE_CHAR       *format,
278         ...);
279
280 s32
281 acpi_os_vprintf (
282         const NATIVE_CHAR       *format,
283         va_list                 args);
284
285
286 /*
287  * Debug input
288  */
289
290 u32
291 acpi_os_get_line (
292         NATIVE_CHAR             *buffer);
293
294
295 /*
296  * Debug
297  */
298
299 void
300 acpi_os_dbg_assert(
301         void                    *failed_assertion,
302         void                    *file_name,
303         u32                     line_number,
304         NATIVE_CHAR             *message);
305
306
307 #endif /* __ACPIOSXF_H__ */