Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
434 | giacomo | 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 - 2003, 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 | */ |
||
82 | |||
83 | acpi_status |
||
84 | acpi_os_initialize ( |
||
85 | void); |
||
86 | |||
87 | acpi_status |
||
88 | acpi_os_terminate ( |
||
89 | void); |
||
90 | |||
91 | |||
92 | /* |
||
93 | * ACPI Table interfaces |
||
94 | */ |
||
95 | |||
96 | acpi_status |
||
97 | acpi_os_get_root_pointer ( |
||
98 | u32 flags, |
||
99 | struct acpi_pointer *address); |
||
100 | |||
101 | acpi_status |
||
102 | acpi_os_predefined_override ( |
||
103 | const struct acpi_predefined_names *init_val, |
||
104 | acpi_string *new_val); |
||
105 | |||
106 | acpi_status |
||
107 | acpi_os_table_override ( |
||
108 | struct acpi_table_header *existing_table, |
||
109 | struct acpi_table_header **new_table); |
||
110 | |||
111 | |||
112 | /* |
||
113 | * Synchronization primitives |
||
114 | */ |
||
115 | |||
116 | acpi_status |
||
117 | acpi_os_create_semaphore ( |
||
118 | u32 max_units, |
||
119 | u32 initial_units, |
||
120 | acpi_handle *out_handle); |
||
121 | |||
122 | acpi_status |
||
123 | acpi_os_delete_semaphore ( |
||
124 | acpi_handle handle); |
||
125 | |||
126 | acpi_status |
||
127 | acpi_os_wait_semaphore ( |
||
128 | acpi_handle handle, |
||
129 | u32 units, |
||
130 | u16 timeout); |
||
131 | |||
132 | acpi_status |
||
133 | acpi_os_signal_semaphore ( |
||
134 | acpi_handle handle, |
||
135 | u32 units); |
||
136 | |||
137 | acpi_status |
||
138 | acpi_os_create_lock ( |
||
139 | acpi_handle *out_handle); |
||
140 | |||
141 | void |
||
142 | acpi_os_delete_lock ( |
||
143 | acpi_handle handle); |
||
144 | |||
145 | void |
||
146 | acpi_os_acquire_lock ( |
||
147 | acpi_handle handle, |
||
148 | u32 flags); |
||
149 | |||
150 | void |
||
151 | acpi_os_release_lock ( |
||
152 | acpi_handle handle, |
||
153 | u32 flags); |
||
154 | |||
155 | |||
156 | /* |
||
157 | * Memory allocation and mapping |
||
158 | */ |
||
159 | |||
160 | void * |
||
161 | acpi_os_allocate ( |
||
162 | acpi_size size); |
||
163 | |||
164 | void |
||
165 | acpi_os_free ( |
||
166 | void * memory); |
||
167 | |||
168 | acpi_status |
||
169 | acpi_os_map_memory ( |
||
170 | acpi_physical_address physical_address, |
||
171 | acpi_size size, |
||
172 | void **logical_address); |
||
173 | |||
174 | void |
||
175 | acpi_os_unmap_memory ( |
||
176 | void *logical_address, |
||
177 | acpi_size size); |
||
178 | |||
179 | acpi_status |
||
180 | acpi_os_get_physical_address ( |
||
181 | void *logical_address, |
||
182 | acpi_physical_address *physical_address); |
||
183 | |||
184 | |||
185 | /* |
||
186 | * Interrupt handlers |
||
187 | */ |
||
188 | |||
189 | acpi_status |
||
190 | acpi_os_install_interrupt_handler ( |
||
191 | u32 interrupt_number, |
||
192 | OSD_HANDLER service_routine, |
||
193 | void *context); |
||
194 | |||
195 | acpi_status |
||
196 | acpi_os_remove_interrupt_handler ( |
||
197 | u32 interrupt_number, |
||
198 | OSD_HANDLER service_routine); |
||
199 | |||
200 | |||
201 | /* |
||
202 | * Threads and Scheduling |
||
203 | */ |
||
204 | |||
205 | u32 |
||
206 | acpi_os_get_thread_id ( |
||
207 | void); |
||
208 | |||
209 | acpi_status |
||
210 | acpi_os_queue_for_execution ( |
||
211 | u32 priority, |
||
212 | OSD_EXECUTION_CALLBACK function, |
||
213 | void *context); |
||
214 | |||
215 | void |
||
216 | acpi_os_sleep ( |
||
217 | u32 seconds, |
||
218 | u32 milliseconds); |
||
219 | |||
220 | void |
||
221 | acpi_os_stall ( |
||
222 | u32 microseconds); |
||
223 | |||
224 | |||
225 | /* |
||
226 | * Platform and hardware-independent I/O interfaces |
||
227 | */ |
||
228 | |||
229 | acpi_status |
||
230 | acpi_os_read_port ( |
||
231 | acpi_io_address address, |
||
232 | u32 *value, |
||
233 | u32 width); |
||
234 | |||
235 | acpi_status |
||
236 | acpi_os_write_port ( |
||
237 | acpi_io_address address, |
||
238 | u32 value, |
||
239 | u32 width); |
||
240 | |||
241 | |||
242 | /* |
||
243 | * Platform and hardware-independent physical memory interfaces |
||
244 | */ |
||
245 | |||
246 | acpi_status |
||
247 | acpi_os_read_memory ( |
||
248 | acpi_physical_address address, |
||
249 | u32 *value, |
||
250 | u32 width); |
||
251 | |||
252 | acpi_status |
||
253 | acpi_os_write_memory ( |
||
254 | acpi_physical_address address, |
||
255 | u32 value, |
||
256 | u32 width); |
||
257 | |||
258 | |||
259 | /* |
||
260 | * Platform and hardware-independent PCI configuration space access |
||
261 | */ |
||
262 | |||
263 | acpi_status |
||
264 | acpi_os_read_pci_configuration ( |
||
265 | struct acpi_pci_id *pci_id, |
||
266 | u32 register, |
||
267 | void *value, |
||
268 | u32 width); |
||
269 | |||
270 | acpi_status |
||
271 | acpi_os_write_pci_configuration ( |
||
272 | struct acpi_pci_id *pci_id, |
||
273 | u32 register, |
||
274 | acpi_integer value, |
||
275 | u32 width); |
||
276 | |||
277 | /* |
||
278 | * Interim function needed for PCI IRQ routing |
||
279 | */ |
||
280 | void |
||
281 | acpi_os_derive_pci_id( |
||
282 | acpi_handle rhandle, |
||
283 | acpi_handle chandle, |
||
284 | struct acpi_pci_id **pci_id); |
||
285 | |||
286 | /* |
||
287 | * Miscellaneous |
||
288 | */ |
||
289 | |||
290 | u8 |
||
291 | acpi_os_readable ( |
||
292 | void *pointer, |
||
293 | acpi_size length); |
||
294 | |||
295 | u8 |
||
296 | acpi_os_writable ( |
||
297 | void *pointer, |
||
298 | acpi_size length); |
||
299 | |||
300 | u32 |
||
301 | acpi_os_get_timer ( |
||
302 | void); |
||
303 | |||
304 | acpi_status |
||
305 | acpi_os_signal ( |
||
306 | u32 function, |
||
307 | void *info); |
||
308 | |||
309 | /* |
||
310 | * Debug print routines |
||
311 | */ |
||
312 | |||
313 | void ACPI_INTERNAL_VAR_XFACE |
||
314 | acpi_os_printf ( |
||
315 | const char *format, |
||
316 | ...); |
||
317 | |||
318 | void |
||
319 | acpi_os_vprintf ( |
||
320 | const char *format, |
||
321 | va_list args); |
||
322 | |||
323 | void |
||
324 | acpi_os_redirect_output ( |
||
325 | void *destination); |
||
326 | |||
327 | |||
328 | /* |
||
329 | * Debug input |
||
330 | */ |
||
331 | |||
332 | u32 |
||
333 | acpi_os_get_line ( |
||
334 | char *buffer); |
||
335 | |||
336 | |||
337 | /* |
||
338 | * Directory manipulation |
||
339 | */ |
||
340 | |||
341 | void * |
||
342 | acpi_os_open_directory ( |
||
343 | char *pathname, |
||
344 | char *wildcard_spec, |
||
345 | char requested_file_type); |
||
346 | |||
347 | /* requeste_file_type values */ |
||
348 | |||
349 | #define REQUEST_FILE_ONLY 0 |
||
350 | #define REQUEST_DIR_ONLY 1 |
||
351 | |||
352 | |||
353 | char * |
||
354 | acpi_os_get_next_filename ( |
||
355 | void *dir_handle); |
||
356 | |||
357 | void |
||
358 | acpi_os_close_directory ( |
||
359 | void *dir_handle); |
||
360 | |||
361 | /* |
||
362 | * Debug |
||
363 | */ |
||
364 | |||
365 | void |
||
366 | acpi_os_dbg_assert( |
||
367 | void *failed_assertion, |
||
368 | void *file_name, |
||
369 | u32 line_number, |
||
370 | char *message); |
||
371 | |||
372 | |||
373 | #endif /* __ACPIOSXF_H__ */ |