1
2 /******************************************************************************
3 *
4 * Name: acpiosxf.h - All interfaces to the OS-dependent layer. These
5 * interfaces must be implemented by the OS-dependent
6 * front-end to the ACPI subsystem.
7 *
8 *****************************************************************************/
9
10
11 /*
12 * Copyright (C) 2000 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 __ACPIOSD_H__
30 #define __ACPIOSD_H__
31
32 #include "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 /*
48 * Types specific to the OS-dependent layer interfaces
49 */
50
51 typedef
52 u32 (*OSD_HANDLER) (
53 void *context);
54
55 typedef
56 void (*OSD_EXECUTION_CALLBACK) (
57 void *context);
58
59
60 /*
61 * Initialization and shutdown primitives (Optional)
62 */
63
64 ACPI_STATUS
65 acpi_os_initialize (
66 void);
67
68 ACPI_STATUS
69 acpi_os_terminate (
70 void);
71
72 /*
73 * Synchronization primitives
74 */
75
76 ACPI_STATUS
77 acpi_os_create_semaphore (
78 u32 max_units,
79 u32 initial_units,
80 ACPI_HANDLE *out_handle);
81
82 ACPI_STATUS
83 acpi_os_delete_semaphore (
84 ACPI_HANDLE handle);
85
86 ACPI_STATUS
87 acpi_os_wait_semaphore (
88 ACPI_HANDLE handle,
89 u32 units,
90 u32 timeout);
91
92 ACPI_STATUS
93 acpi_os_signal_semaphore (
94 ACPI_HANDLE handle,
95 u32 units);
96
97 /*
98 * Memory allocation and mapping
99 */
100
101 void *
102 acpi_os_allocate (
103 u32 size);
104
105 void *
106 acpi_os_callocate (
107 u32 size);
108
109 void
110 acpi_os_free (
111 void * memory);
112
113 ACPI_STATUS
114 acpi_os_map_memory (
115 ACPI_PHYSICAL_ADDRESS physical_address,
116 u32 length,
117 void **logical_address);
118
119 void
120 acpi_os_unmap_memory (
121 void *logical_address,
122 u32 length);
123
124
125 /*
126 * Interrupt handlers
127 */
128
129 ACPI_STATUS
130 acpi_os_install_interrupt_handler (
131 u32 interrupt_number,
132 OSD_HANDLER service_routine,
133 void *context);
134
135 ACPI_STATUS
136 acpi_os_remove_interrupt_handler (
137 u32 interrupt_number,
138 OSD_HANDLER service_routine);
139
140
141 /*
142 * Scheduling
143 */
144
145 ACPI_STATUS
146 acpi_os_queue_for_execution (
147 u32 priority,
148 OSD_EXECUTION_CALLBACK function,
149 void *context);
150
151 void
152 acpi_os_sleep (
153 u32 seconds,
154 u32 milliseconds);
155
156 void
157 acpi_os_sleep_usec (
158 u32 microseconds);
159
160 /*
161 * Platform/Hardware independent I/O interfaces
162 */
163
164 u8
165 acpi_os_in8 (
166 ACPI_IO_ADDRESS in_port);
167
168
169 u16
170 acpi_os_in16 (
171 ACPI_IO_ADDRESS in_port);
172
173 u32
174 acpi_os_in32 (
175 ACPI_IO_ADDRESS in_port);
176
177 void
178 acpi_os_out8 (
179 ACPI_IO_ADDRESS out_port,
180 u8 value);
181
182 void
183 acpi_os_out16 (
184 ACPI_IO_ADDRESS out_port,
185 u16 value);
186
187 void
188 acpi_os_out32 (
189 ACPI_IO_ADDRESS out_port,
190 u32 value);
191
192 /*
193 * Platform/Hardware independent physical memory interfaces
194 */
195
196 u8
197 acpi_os_mem_in8 (
198 ACPI_PHYSICAL_ADDRESS in_addr);
199
200 u16
201 acpi_os_mem_in16 (
202 ACPI_PHYSICAL_ADDRESS in_addr);
203
204 u32
205 acpi_os_mem_in32 (
206 ACPI_PHYSICAL_ADDRESS in_addr);
207
208 void
209 acpi_os_mem_out8 (
210 ACPI_PHYSICAL_ADDRESS out_addr,
211 u8 value);
212
213 void
214 acpi_os_mem_out16 (
215 ACPI_PHYSICAL_ADDRESS out_addr,
216 u16 value);
217
218 void
219 acpi_os_mem_out32 (
220 ACPI_PHYSICAL_ADDRESS out_addr,
221 u32 value);
222
223
224 /*
225 * Standard access to PCI configuration space
226 */
227
228 ACPI_STATUS
229 acpi_os_read_pci_cfg_byte (
230 u32 bus,
231 u32 device_function,
232 u32 register,
233 u8 *value);
234
235 ACPI_STATUS
236 acpi_os_read_pci_cfg_word (
237 u32 bus,
238 u32 device_function,
239 u32 register,
240 u16 *value);
241
242 ACPI_STATUS
243 acpi_os_read_pci_cfg_dword (
244 u32 bus,
245 u32 device_function,
246 u32 register,
247 u32 *value);
248
249 ACPI_STATUS
250 acpi_os_write_pci_cfg_byte (
251 u32 bus,
252 u32 device_function,
253 u32 register,
254 u8 value);
255
256 ACPI_STATUS
257 acpi_os_write_pci_cfg_word (
258 u32 bus,
259 u32 device_function,
260 u32 register,
261 u16 value);
262
263
264 ACPI_STATUS
265 acpi_os_write_pci_cfg_dword (
266 u32 bus,
267 u32 device_function,
268 u32 register,
269 u32 value);
270
271
272 /*
273 * Miscellaneous
274 */
275
276 ACPI_STATUS
277 acpi_os_breakpoint (
278 NATIVE_CHAR *message);
279
280 u8
281 acpi_os_readable (
282 void *pointer,
283 u32 length);
284
285
286 u8
287 acpi_os_writable (
288 void *pointer,
289 u32 length);
290
291
292 /*
293 * Debug print routines
294 */
295
296 s32
297 acpi_os_printf (
298 const NATIVE_CHAR *format,
299 ...);
300
301 s32
302 acpi_os_vprintf (
303 const NATIVE_CHAR *format,
304 va_list args);
305
306 /*
307 * Debug input
308 */
309
310 u32
311 acpi_os_get_line (
312 NATIVE_CHAR *buffer);
313
314
315 /*
316 * Debug
317 */
318
319 void
320 acpi_os_dbg_assert(
321 void *failed_assertion,
322 void *file_name,
323 u32 line_number,
324 NATIVE_CHAR *message);
325
326
327 #endif /* __ACPIOSD_H__ */
328
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.