machine/stdarg provides __va* macros, not va* macros, use <stdarg.h> instead
[dragonfly.git] / sys / contrib / dev / acpica / acpiosxf.h
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  *
13  * 1. Copyright Notice
14  *
15  * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
16  * All rights reserved.
17  *
18  * 2. License
19  *
20  * 2.1. This is your license from Intel Corp. under its intellectual property
21  * rights.  You may have additional license terms from the party that provided
22  * you this software, covering your right to use that party's intellectual
23  * property rights.
24  *
25  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
26  * copy of the source code appearing in this file ("Covered Code") an
27  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
28  * base code distributed originally by Intel ("Original Intel Code") to copy,
29  * make derivatives, distribute, use and display any portion of the Covered
30  * Code in any form, with the right to sublicense such rights; and
31  *
32  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
33  * license (with the right to sublicense), under only those claims of Intel
34  * patents that are infringed by the Original Intel Code, to make, use, sell,
35  * offer to sell, and import the Covered Code and derivative works thereof
36  * solely to the minimum extent necessary to exer
37  se the above copyright
38  * license, and in no event shall the patent license extend to any additions
39  * to or modifications of the Original Intel Code.  No other license or right
40  * is granted directly or by implication, estoppel or otherwise;
41  *
42  * The above copyright and patent license is granted only if the following
43  * conditions are met:
44  *
45  * 3. Conditions
46  *
47  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
48  * Redistribution of source code of any substantial portion of the Covered
49  * Code or modification with rights to further distribute source must include
50  * the above Copyright Notice, the above License, this list of Conditions,
51  * and the following Disclaimer and Export Compliance provision.  In addition,
52  * Licensee must cause all Covered Code to which Licensee contributes to
53  * contain a file documenting the changes Licensee made to create that Covered
54  * Code and the date of any change.  Licensee must include in that file the
55  * documentation of any changes made by any predecessor Licensee.  Licensee
56  * must include a prominent statement that the modification is derived,
57  * directly or indirectly, from Original Intel Code.
58  *
59  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
60  * Redistribution of source code of any substantial portion of the Covered
61  * Code or modification without rights to further distribute source must
62  * include the following Disclaimer and Export Compliance provision in the
63  * documentation and/or other materials provided with distribution.  In
64  * addition, Licensee may not authorize further sublicense of source of any
65  * portion of the Covered Code, and must include terms to the effect that the
66  * license from Licensee to its licensee is limited to the intellectual
67  * property embodied in the software Licensee provides to its licensee, and
68  * not to intellectual property embodied in modifications its licensee may
69  * make.
70  *
71  * 3.3. Redistribution of Executable. Redistribution in executable form of any
72  * substantial portion of the Covered Code or modification must reproduce the
73  * above Copyright Notice, and the following Disclaimer and Export Compliance
74  * provision in the documentation and/or other materials provided with the
75  * distribution.
76  *
77  * 3.4. Intel retains all right, title, and interest in and to the Original
78  * Intel Code.
79  *
80  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
81  * Intel shall be used in advertising or otherwise to promote the sale, use or
82  * other dealings in products derived from or relating to the Covered Code
83  * without prior written authorization from Intel.
84  *
85  * 4. Disclaimer and Export Compliance
86  *
87  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
88  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
89  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
90  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
91  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
92  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
93  * PARTICULAR PURPOSE.
94  *
95  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
96  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
97  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
98  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
99  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
100  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
101  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
102  * LIMITED REMEDY.
103  *
104  * 4.3. Licensee shall not export, either directly or indirectly, any of this
105  * software or system incorporating such software without first obtaining any
106  * required license or other approval from the U. S. Department of Commerce or
107  * any other agency or department of the United States Government.  In the
108  * event Licensee exports any such software from the United States or
109  * re-exports any such software from a foreign destination, Licensee shall
110  * ensure that the distribution and export/re-export of the software is in
111  * compliance with all laws, regulations, orders, or other restrictions of the
112  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
113  * any of its subsidiaries will export/re-export any technical data, process,
114  * software, or service, directly or indirectly, to any country for which the
115  * United States government or any agency thereof requires an export license,
116  * other governmental approval, or letter of assurance, without first obtaining
117  * such license, approval or letter.
118  *
119  *****************************************************************************/
120 /* $DragonFly: src/sys/contrib/dev/acpica/Attic/acpiosxf.h,v 1.1 2003/09/24 03:32:15 drhodus Exp $                                                               */
121
122 #ifndef __ACPIOSXF_H__
123 #define __ACPIOSXF_H__
124
125 #include "acenv.h"
126 #include "actypes.h"
127
128
129 /* Priorities for AcpiOsQueueForExecution */
130
131 #define OSD_PRIORITY_GPE            1
132 #define OSD_PRIORITY_HIGH           2
133 #define OSD_PRIORITY_MED            3
134 #define OSD_PRIORITY_LO             4
135
136 #define ACPI_NO_UNIT_LIMIT          ((UINT32) -1)
137 #define ACPI_MUTEX_SEM              1
138
139
140 /* Functions for AcpiOsSignal */
141
142 #define ACPI_SIGNAL_FATAL           0
143 #define ACPI_SIGNAL_BREAKPOINT      1
144
145 typedef struct acpi_signal_fatal_info
146 {
147     UINT32                  Type;
148     UINT32                  Code;
149     UINT32                  Argument;
150
151 } ACPI_SIGNAL_FATAL_INFO;
152
153
154 /*
155  * Types specific to the OS service interfaces
156  */
157
158 typedef UINT32
159 (ACPI_SYSTEM_XFACE *OSD_HANDLER) (
160     void                    *Context);
161
162 typedef void
163 (ACPI_SYSTEM_XFACE *OSD_EXECUTION_CALLBACK) (
164     void                    *Context);
165
166
167 /*
168  * OSL Initialization and shutdown primitives
169  */
170
171 ACPI_STATUS
172 AcpiOsInitialize (
173     void);
174
175 ACPI_STATUS
176 AcpiOsTerminate (
177     void);
178
179
180 /*
181  * ACPI Table interfaces
182  */
183
184 ACPI_STATUS
185 AcpiOsGetRootPointer (
186     UINT32                  Flags,
187     ACPI_POINTER            *Address);
188
189 ACPI_STATUS
190 AcpiOsPredefinedOverride (
191     const ACPI_PREDEFINED_NAMES *InitVal,
192     ACPI_STRING                 *NewVal);
193
194 ACPI_STATUS
195 AcpiOsTableOverride (
196     ACPI_TABLE_HEADER       *ExistingTable,
197     ACPI_TABLE_HEADER       **NewTable);
198
199
200 /*
201  * Synchronization primitives
202  */
203
204 ACPI_STATUS
205 AcpiOsCreateSemaphore (
206     UINT32                  MaxUnits,
207     UINT32                  InitialUnits,
208     ACPI_HANDLE             *OutHandle);
209
210 ACPI_STATUS
211 AcpiOsDeleteSemaphore (
212     ACPI_HANDLE             Handle);
213
214 ACPI_STATUS
215 AcpiOsWaitSemaphore (
216     ACPI_HANDLE             Handle,
217     UINT32                  Units,
218     UINT16                  Timeout);
219
220 ACPI_STATUS
221 AcpiOsSignalSemaphore (
222     ACPI_HANDLE             Handle,
223     UINT32                  Units);
224
225
226 /*
227  * Memory allocation and mapping
228  */
229
230 void *
231 AcpiOsAllocate (
232     ACPI_SIZE               Size);
233
234 void
235 AcpiOsFree (
236     void *                  Memory);
237
238 ACPI_STATUS
239 AcpiOsMapMemory (
240     ACPI_PHYSICAL_ADDRESS   PhysicalAddress,
241     ACPI_SIZE               Size,
242     void                    **LogicalAddress);
243
244 void
245 AcpiOsUnmapMemory (
246     void                    *LogicalAddress,
247     ACPI_SIZE               Size);
248
249 ACPI_STATUS
250 AcpiOsGetPhysicalAddress (
251     void                    *LogicalAddress,
252     ACPI_PHYSICAL_ADDRESS   *PhysicalAddress);
253
254
255 /*
256  * Interrupt handlers
257  */
258
259 ACPI_STATUS
260 AcpiOsInstallInterruptHandler (
261     UINT32                  InterruptNumber,
262     OSD_HANDLER             ServiceRoutine,
263     void                    *Context);
264
265 ACPI_STATUS
266 AcpiOsRemoveInterruptHandler (
267     UINT32                  InterruptNumber,
268     OSD_HANDLER             ServiceRoutine);
269
270
271 /*
272  * Threads and Scheduling
273  */
274
275 UINT32
276 AcpiOsGetThreadId (
277     void);
278
279 ACPI_STATUS
280 AcpiOsQueueForExecution (
281     UINT32                  Priority,
282     OSD_EXECUTION_CALLBACK  Function,
283     void                    *Context);
284
285 void
286 AcpiOsSleep (
287     UINT32                  Seconds,
288     UINT32                  Milliseconds);
289
290 void
291 AcpiOsStall (
292     UINT32                  Microseconds);
293
294
295 /*
296  * Platform and hardware-independent I/O interfaces
297  */
298
299 ACPI_STATUS
300 AcpiOsReadPort (
301     ACPI_IO_ADDRESS         Address,
302     void                    *Value,
303     UINT32                  Width);
304
305 ACPI_STATUS
306 AcpiOsWritePort (
307     ACPI_IO_ADDRESS         Address,
308     ACPI_INTEGER            Value,
309     UINT32                  Width);
310
311
312 /*
313  * Platform and hardware-independent physical memory interfaces
314  */
315
316 ACPI_STATUS
317 AcpiOsReadMemory (
318     ACPI_PHYSICAL_ADDRESS   Address,
319     void                    *Value,
320     UINT32                  Width);
321
322 ACPI_STATUS
323 AcpiOsWriteMemory (
324     ACPI_PHYSICAL_ADDRESS   Address,
325     ACPI_INTEGER            Value,
326     UINT32                  Width);
327
328
329 /*
330  * Platform and hardware-independent PCI configuration space access
331  */
332
333 ACPI_STATUS
334 AcpiOsReadPciConfiguration (
335     ACPI_PCI_ID             *PciId,
336     UINT32                  Register,
337     void                    *Value,
338     UINT32                  Width);
339
340 ACPI_STATUS
341 AcpiOsWritePciConfiguration (
342     ACPI_PCI_ID             *PciId,
343     UINT32                  Register,
344     ACPI_INTEGER            Value,
345     UINT32                  Width);
346
347 /*
348  * Interim function needed for PCI IRQ routing
349  */
350 void
351 AcpiOsDerivePciId(
352     ACPI_HANDLE             rhandle,
353     ACPI_HANDLE             chandle,
354     ACPI_PCI_ID             **PciId);
355
356 /*
357  * Miscellaneous
358  */
359
360 BOOLEAN
361 AcpiOsReadable (
362     void                    *Pointer,
363     UINT32                  Length);
364
365 BOOLEAN
366 AcpiOsWritable (
367     void                    *Pointer,
368     UINT32                  Length);
369
370 UINT32
371 AcpiOsGetTimer (
372     void);
373
374 ACPI_STATUS
375 AcpiOsSignal (
376     UINT32                  Function,
377     void                    *Info);
378
379 /*
380  * Debug print routines
381  */
382
383 void ACPI_INTERNAL_VAR_XFACE
384 AcpiOsPrintf (
385     const char              *Format,
386     ...);
387
388 void
389 AcpiOsVprintf (
390     const char              *Format,
391     va_list                 Args);
392
393 void
394 AcpiOsRedirectOutput (
395     void                    *Destination);
396
397
398 /*
399  * Debug input
400  */
401
402 UINT32
403 AcpiOsGetLine (
404     char                    *Buffer);
405
406
407 /*
408  * Directory manipulation
409  */
410
411 void *
412 AcpiOsOpenDirectory (
413     char                    *Pathname,
414     char                    *WildcardSpec,
415     char                    RequestedFileType);
416
417 /* RequesteFileType values */
418
419 #define REQUEST_FILE_ONLY                   0
420 #define REQUEST_DIR_ONLY                    1
421
422
423 char *
424 AcpiOsGetNextFilename (
425     void                    *DirHandle);
426
427 void
428 AcpiOsCloseDirectory (
429     void                    *DirHandle);
430
431 /*
432  * Debug
433  */
434
435 void
436 AcpiOsDbgAssert(
437     void                    *FailedAssertion,
438     void                    *FileName,
439     UINT32                  LineNumber,
440     char                    *Message);
441
442
443 #endif /* __ACPIOSXF_H__ */