]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
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 - 2005, R. Byron Moore | |
13 | * All rights reserved. | |
14 | * | |
15 | * Redistribution and use in source and binary forms, with or without | |
16 | * modification, are permitted provided that the following conditions | |
17 | * are met: | |
18 | * 1. Redistributions of source code must retain the above copyright | |
19 | * notice, this list of conditions, and the following disclaimer, | |
20 | * without modification. | |
21 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | |
22 | * substantially similar to the "NO WARRANTY" disclaimer below | |
23 | * ("Disclaimer") and any redistribution must be conditioned upon | |
24 | * including a substantially similar Disclaimer requirement for further | |
25 | * binary redistribution. | |
26 | * 3. Neither the names of the above-listed copyright holders nor the names | |
27 | * of any contributors may be used to endorse or promote products derived | |
28 | * from this software without specific prior written permission. | |
29 | * | |
30 | * Alternatively, this software may be distributed under the terms of the | |
31 | * GNU General Public License ("GPL") version 2 as published by the Free | |
32 | * Software Foundation. | |
33 | * | |
34 | * NO WARRANTY | |
35 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
36 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
37 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | |
38 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
39 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
40 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
41 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
42 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
43 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | |
44 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
45 | * POSSIBILITY OF SUCH DAMAGES. | |
46 | */ | |
47 | ||
48 | #ifndef __ACPIOSXF_H__ | |
49 | #define __ACPIOSXF_H__ | |
50 | ||
51 | #include "platform/acenv.h" | |
52 | #include "actypes.h" | |
53 | ||
54 | ||
55 | /* Priorities for acpi_os_queue_for_execution */ | |
56 | ||
57 | #define OSD_PRIORITY_GPE 1 | |
58 | #define OSD_PRIORITY_HIGH 2 | |
59 | #define OSD_PRIORITY_MED 3 | |
60 | #define OSD_PRIORITY_LO 4 | |
61 | ||
62 | #define ACPI_NO_UNIT_LIMIT ((u32) -1) | |
63 | #define ACPI_MUTEX_SEM 1 | |
64 | ||
65 | ||
66 | /* Functions for acpi_os_signal */ | |
67 | ||
68 | #define ACPI_SIGNAL_FATAL 0 | |
69 | #define ACPI_SIGNAL_BREAKPOINT 1 | |
70 | ||
71 | struct acpi_signal_fatal_info | |
72 | { | |
73 | u32 type; | |
74 | u32 code; | |
75 | u32 argument; | |
76 | }; | |
77 | ||
78 | ||
79 | /* | |
80 | * OSL Initialization and shutdown primitives | |
81 | */ | |
1da177e4 LT |
82 | acpi_status |
83 | acpi_os_initialize ( | |
84 | void); | |
85 | ||
86 | acpi_status | |
87 | acpi_os_terminate ( | |
88 | void); | |
89 | ||
90 | ||
91 | /* | |
92 | * ACPI Table interfaces | |
93 | */ | |
1da177e4 LT |
94 | acpi_status |
95 | acpi_os_get_root_pointer ( | |
96 | u32 flags, | |
97 | struct acpi_pointer *address); | |
98 | ||
99 | acpi_status | |
100 | acpi_os_predefined_override ( | |
101 | const struct acpi_predefined_names *init_val, | |
102 | acpi_string *new_val); | |
103 | ||
104 | acpi_status | |
105 | acpi_os_table_override ( | |
106 | struct acpi_table_header *existing_table, | |
107 | struct acpi_table_header **new_table); | |
108 | ||
109 | ||
110 | /* | |
111 | * Synchronization primitives | |
112 | */ | |
1da177e4 LT |
113 | acpi_status |
114 | acpi_os_create_semaphore ( | |
115 | u32 max_units, | |
116 | u32 initial_units, | |
117 | acpi_handle *out_handle); | |
118 | ||
119 | acpi_status | |
120 | acpi_os_delete_semaphore ( | |
121 | acpi_handle handle); | |
122 | ||
123 | acpi_status | |
124 | acpi_os_wait_semaphore ( | |
125 | acpi_handle handle, | |
126 | u32 units, | |
127 | u16 timeout); | |
128 | ||
129 | acpi_status | |
130 | acpi_os_signal_semaphore ( | |
131 | acpi_handle handle, | |
132 | u32 units); | |
133 | ||
134 | acpi_status | |
135 | acpi_os_create_lock ( | |
136 | acpi_handle *out_handle); | |
137 | ||
138 | void | |
139 | acpi_os_delete_lock ( | |
140 | acpi_handle handle); | |
141 | ||
73459f73 | 142 | unsigned long |
1da177e4 | 143 | acpi_os_acquire_lock ( |
73459f73 | 144 | acpi_handle handle); |
1da177e4 LT |
145 | |
146 | void | |
147 | acpi_os_release_lock ( | |
148 | acpi_handle handle, | |
73459f73 | 149 | unsigned long flags); |
1da177e4 LT |
150 | |
151 | ||
152 | /* | |
153 | * Memory allocation and mapping | |
154 | */ | |
1da177e4 LT |
155 | void * |
156 | acpi_os_allocate ( | |
157 | acpi_size size); | |
158 | ||
159 | void | |
160 | acpi_os_free ( | |
161 | void * memory); | |
162 | ||
163 | acpi_status | |
164 | acpi_os_map_memory ( | |
165 | acpi_physical_address physical_address, | |
166 | acpi_size size, | |
167 | void __iomem **logical_address); | |
168 | ||
169 | void | |
170 | acpi_os_unmap_memory ( | |
171 | void __iomem *logical_address, | |
172 | acpi_size size); | |
173 | ||
174 | #ifdef ACPI_FUTURE_USAGE | |
175 | acpi_status | |
176 | acpi_os_get_physical_address ( | |
177 | void *logical_address, | |
178 | acpi_physical_address *physical_address); | |
179 | #endif | |
180 | ||
181 | ||
73459f73 RM |
182 | |
183 | /* | |
184 | * Memory/Object Cache | |
185 | */ | |
186 | acpi_status | |
187 | acpi_os_create_cache ( | |
188 | char *cache_name, | |
189 | u16 object_size, | |
190 | u16 max_depth, | |
191 | acpi_cache_t **return_cache); | |
192 | ||
193 | acpi_status | |
194 | acpi_os_delete_cache ( | |
195 | acpi_cache_t *cache); | |
196 | ||
197 | acpi_status | |
198 | acpi_os_purge_cache ( | |
199 | acpi_cache_t *cache); | |
200 | ||
201 | void * | |
202 | acpi_os_acquire_object ( | |
203 | acpi_cache_t *cache); | |
204 | ||
205 | acpi_status | |
206 | acpi_os_release_object ( | |
207 | acpi_cache_t *cache, | |
208 | void *object); | |
209 | ||
1da177e4 LT |
210 | /* |
211 | * Interrupt handlers | |
212 | */ | |
1da177e4 LT |
213 | acpi_status |
214 | acpi_os_install_interrupt_handler ( | |
215 | u32 gsi, | |
216 | acpi_osd_handler service_routine, | |
217 | void *context); | |
218 | ||
219 | acpi_status | |
220 | acpi_os_remove_interrupt_handler ( | |
221 | u32 gsi, | |
222 | acpi_osd_handler service_routine); | |
223 | ||
224 | ||
225 | /* | |
226 | * Threads and Scheduling | |
227 | */ | |
1da177e4 LT |
228 | u32 |
229 | acpi_os_get_thread_id ( | |
230 | void); | |
231 | ||
232 | acpi_status | |
233 | acpi_os_queue_for_execution ( | |
234 | u32 priority, | |
235 | acpi_osd_exec_callback function, | |
236 | void *context); | |
237 | ||
238 | void | |
239 | acpi_os_wait_events_complete( | |
240 | void * context); | |
241 | ||
242 | void | |
243 | acpi_os_wait_events_complete ( | |
244 | void *context); | |
245 | ||
246 | void | |
247 | acpi_os_sleep ( | |
248 | acpi_integer milliseconds); | |
249 | ||
250 | void | |
251 | acpi_os_stall ( | |
252 | u32 microseconds); | |
253 | ||
254 | ||
255 | /* | |
256 | * Platform and hardware-independent I/O interfaces | |
257 | */ | |
1da177e4 LT |
258 | acpi_status |
259 | acpi_os_read_port ( | |
260 | acpi_io_address address, | |
261 | u32 *value, | |
262 | u32 width); | |
263 | ||
264 | acpi_status | |
265 | acpi_os_write_port ( | |
266 | acpi_io_address address, | |
267 | u32 value, | |
268 | u32 width); | |
269 | ||
270 | ||
271 | /* | |
272 | * Platform and hardware-independent physical memory interfaces | |
273 | */ | |
1da177e4 LT |
274 | acpi_status |
275 | acpi_os_read_memory ( | |
276 | acpi_physical_address address, | |
277 | u32 *value, | |
278 | u32 width); | |
279 | ||
280 | acpi_status | |
281 | acpi_os_write_memory ( | |
282 | acpi_physical_address address, | |
283 | u32 value, | |
284 | u32 width); | |
285 | ||
286 | ||
287 | /* | |
288 | * Platform and hardware-independent PCI configuration space access | |
289 | * Note: Can't use "Register" as a parameter, changed to "Reg" -- | |
290 | * certain compilers complain. | |
291 | */ | |
1da177e4 LT |
292 | acpi_status |
293 | acpi_os_read_pci_configuration ( | |
294 | struct acpi_pci_id *pci_id, | |
295 | u32 reg, | |
296 | void *value, | |
297 | u32 width); | |
298 | ||
299 | acpi_status | |
300 | acpi_os_write_pci_configuration ( | |
301 | struct acpi_pci_id *pci_id, | |
302 | u32 reg, | |
303 | acpi_integer value, | |
304 | u32 width); | |
305 | ||
306 | /* | |
307 | * Interim function needed for PCI IRQ routing | |
308 | */ | |
1da177e4 LT |
309 | void |
310 | acpi_os_derive_pci_id( | |
311 | acpi_handle rhandle, | |
312 | acpi_handle chandle, | |
313 | struct acpi_pci_id **pci_id); | |
314 | ||
315 | /* | |
316 | * Miscellaneous | |
317 | */ | |
1da177e4 LT |
318 | u8 |
319 | acpi_os_readable ( | |
320 | void *pointer, | |
321 | acpi_size length); | |
322 | ||
323 | #ifdef ACPI_FUTURE_USAGE | |
324 | u8 | |
325 | acpi_os_writable ( | |
326 | void *pointer, | |
327 | acpi_size length); | |
328 | #endif | |
329 | ||
330 | u64 | |
331 | acpi_os_get_timer ( | |
332 | void); | |
333 | ||
334 | acpi_status | |
335 | acpi_os_signal ( | |
336 | u32 function, | |
337 | void *info); | |
338 | ||
339 | /* | |
340 | * Debug print routines | |
341 | */ | |
1da177e4 LT |
342 | void ACPI_INTERNAL_VAR_XFACE |
343 | acpi_os_printf ( | |
344 | const char *format, | |
345 | ...); | |
346 | ||
347 | void | |
348 | acpi_os_vprintf ( | |
349 | const char *format, | |
350 | va_list args); | |
351 | ||
352 | void | |
353 | acpi_os_redirect_output ( | |
354 | void *destination); | |
355 | ||
356 | ||
44f6c012 | 357 | #ifdef ACPI_FUTURE_USAGE |
1da177e4 LT |
358 | /* |
359 | * Debug input | |
360 | */ | |
1da177e4 LT |
361 | u32 |
362 | acpi_os_get_line ( | |
363 | char *buffer); | |
364 | #endif | |
365 | ||
366 | ||
367 | /* | |
368 | * Directory manipulation | |
369 | */ | |
1da177e4 LT |
370 | void * |
371 | acpi_os_open_directory ( | |
372 | char *pathname, | |
373 | char *wildcard_spec, | |
374 | char requested_file_type); | |
375 | ||
376 | /* requeste_file_type values */ | |
377 | ||
378 | #define REQUEST_FILE_ONLY 0 | |
379 | #define REQUEST_DIR_ONLY 1 | |
380 | ||
381 | ||
382 | char * | |
383 | acpi_os_get_next_filename ( | |
384 | void *dir_handle); | |
385 | ||
386 | void | |
387 | acpi_os_close_directory ( | |
388 | void *dir_handle); | |
389 | ||
390 | /* | |
391 | * Debug | |
392 | */ | |
1da177e4 LT |
393 | void |
394 | acpi_os_dbg_assert( | |
395 | void *failed_assertion, | |
396 | void *file_name, | |
397 | u32 line_number, | |
398 | char *message); | |
399 | ||
1da177e4 | 400 | #endif /* __ACPIOSXF_H__ */ |