source: trunk/packages/xen-common/xen-common/xen/include/acpi/acpiosxf.h @ 34

Last change on this file since 34 was 34, checked in by hartmans, 17 years ago

Add xen and xen-common

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