Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / acpi / acpiosxf.h
blob857c8072eb1e0d84baee03d5fcd5c16fe264ad90
2 /******************************************************************************
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.
8 *****************************************************************************/
12 * Copyright (C) 2000 - 2005, R. Byron Moore
13 * All rights reserved.
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.
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.
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.
48 #ifndef __ACPIOSXF_H__
49 #define __ACPIOSXF_H__
51 #include "platform/acenv.h"
52 #include "actypes.h"
55 /* Priorities for acpi_os_queue_for_execution */
57 #define OSD_PRIORITY_GPE 1
58 #define OSD_PRIORITY_HIGH 2
59 #define OSD_PRIORITY_MED 3
60 #define OSD_PRIORITY_LO 4
62 #define ACPI_NO_UNIT_LIMIT ((u32) -1)
63 #define ACPI_MUTEX_SEM 1
66 /* Functions for acpi_os_signal */
68 #define ACPI_SIGNAL_FATAL 0
69 #define ACPI_SIGNAL_BREAKPOINT 1
71 struct acpi_signal_fatal_info
73 u32 type;
74 u32 code;
75 u32 argument;
80 * OSL Initialization and shutdown primitives
83 acpi_status
84 acpi_os_initialize (
85 void);
87 acpi_status
88 acpi_os_terminate (
89 void);
93 * ACPI Table interfaces
96 acpi_status
97 acpi_os_get_root_pointer (
98 u32 flags,
99 struct acpi_pointer *address);
101 acpi_status
102 acpi_os_predefined_override (
103 const struct acpi_predefined_names *init_val,
104 acpi_string *new_val);
106 acpi_status
107 acpi_os_table_override (
108 struct acpi_table_header *existing_table,
109 struct acpi_table_header **new_table);
113 * Synchronization primitives
116 acpi_status
117 acpi_os_create_semaphore (
118 u32 max_units,
119 u32 initial_units,
120 acpi_handle *out_handle);
122 acpi_status
123 acpi_os_delete_semaphore (
124 acpi_handle handle);
126 acpi_status
127 acpi_os_wait_semaphore (
128 acpi_handle handle,
129 u32 units,
130 u16 timeout);
132 acpi_status
133 acpi_os_signal_semaphore (
134 acpi_handle handle,
135 u32 units);
137 acpi_status
138 acpi_os_create_lock (
139 acpi_handle *out_handle);
141 void
142 acpi_os_delete_lock (
143 acpi_handle handle);
145 void
146 acpi_os_acquire_lock (
147 acpi_handle handle,
148 u32 flags);
150 void
151 acpi_os_release_lock (
152 acpi_handle handle,
153 u32 flags);
157 * Memory allocation and mapping
160 void *
161 acpi_os_allocate (
162 acpi_size size);
164 void
165 acpi_os_free (
166 void * memory);
168 acpi_status
169 acpi_os_map_memory (
170 acpi_physical_address physical_address,
171 acpi_size size,
172 void __iomem **logical_address);
174 void
175 acpi_os_unmap_memory (
176 void __iomem *logical_address,
177 acpi_size size);
179 #ifdef ACPI_FUTURE_USAGE
180 acpi_status
181 acpi_os_get_physical_address (
182 void *logical_address,
183 acpi_physical_address *physical_address);
184 #endif
188 * Interrupt handlers
191 acpi_status
192 acpi_os_install_interrupt_handler (
193 u32 gsi,
194 acpi_osd_handler service_routine,
195 void *context);
197 acpi_status
198 acpi_os_remove_interrupt_handler (
199 u32 gsi,
200 acpi_osd_handler service_routine);
204 * Threads and Scheduling
208 acpi_os_get_thread_id (
209 void);
211 acpi_status
212 acpi_os_queue_for_execution (
213 u32 priority,
214 acpi_osd_exec_callback function,
215 void *context);
217 void
218 acpi_os_wait_events_complete(
219 void * context);
221 void
222 acpi_os_wait_events_complete (
223 void *context);
225 void
226 acpi_os_sleep (
227 acpi_integer milliseconds);
229 void
230 acpi_os_stall (
231 u32 microseconds);
235 * Platform and hardware-independent I/O interfaces
238 acpi_status
239 acpi_os_read_port (
240 acpi_io_address address,
241 u32 *value,
242 u32 width);
244 acpi_status
245 acpi_os_write_port (
246 acpi_io_address address,
247 u32 value,
248 u32 width);
252 * Platform and hardware-independent physical memory interfaces
255 acpi_status
256 acpi_os_read_memory (
257 acpi_physical_address address,
258 u32 *value,
259 u32 width);
261 acpi_status
262 acpi_os_write_memory (
263 acpi_physical_address address,
264 u32 value,
265 u32 width);
269 * Platform and hardware-independent PCI configuration space access
270 * Note: Can't use "Register" as a parameter, changed to "Reg" --
271 * certain compilers complain.
274 acpi_status
275 acpi_os_read_pci_configuration (
276 struct acpi_pci_id *pci_id,
277 u32 reg,
278 void *value,
279 u32 width);
281 acpi_status
282 acpi_os_write_pci_configuration (
283 struct acpi_pci_id *pci_id,
284 u32 reg,
285 acpi_integer value,
286 u32 width);
289 * Interim function needed for PCI IRQ routing
292 void
293 acpi_os_derive_pci_id(
294 acpi_handle rhandle,
295 acpi_handle chandle,
296 struct acpi_pci_id **pci_id);
299 * Miscellaneous
303 acpi_os_readable (
304 void *pointer,
305 acpi_size length);
307 #ifdef ACPI_FUTURE_USAGE
309 acpi_os_writable (
310 void *pointer,
311 acpi_size length);
312 #endif
315 acpi_os_get_timer (
316 void);
318 acpi_status
319 acpi_os_signal (
320 u32 function,
321 void *info);
324 * Debug print routines
327 void ACPI_INTERNAL_VAR_XFACE
328 acpi_os_printf (
329 const char *format,
330 ...);
332 void
333 acpi_os_vprintf (
334 const char *format,
335 va_list args);
337 void
338 acpi_os_redirect_output (
339 void *destination);
343 * Debug input
346 #ifdef ACPI_FUTURE_USAGE
348 acpi_os_get_line (
349 char *buffer);
350 #endif
354 * Directory manipulation
357 void *
358 acpi_os_open_directory (
359 char *pathname,
360 char *wildcard_spec,
361 char requested_file_type);
363 /* requeste_file_type values */
365 #define REQUEST_FILE_ONLY 0
366 #define REQUEST_DIR_ONLY 1
369 char *
370 acpi_os_get_next_filename (
371 void *dir_handle);
373 void
374 acpi_os_close_directory (
375 void *dir_handle);
378 * Debug
381 void
382 acpi_os_dbg_assert(
383 void *failed_assertion,
384 void *file_name,
385 u32 line_number,
386 char *message);
389 #endif /* __ACPIOSXF_H__ */