Bring in acpica-unix-20031203. As with other contrib imports, this import
[dragonfly.git] / sys / contrib / dev / acpica-unix-20031203 / include / 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
121 #ifndef __ACPIOSXF_H__
122 #define __ACPIOSXF_H__
123
124 #include "platform/acenv.h"
125 #include "actypes.h"
126
127
128 /* Priorities for AcpiOsQueueForExecution */
129
130 #define OSD_PRIORITY_GPE            1
131 #define OSD_PRIORITY_HIGH           2
132 #define OSD_PRIORITY_MED            3
133 #define OSD_PRIORITY_LO             4
134
135 #define ACPI_NO_UNIT_LIMIT          ((UINT32) -1)
136 #define ACPI_MUTEX_SEM              1
137
138
139 /* Functions for AcpiOsSignal */
140
141 #define ACPI_SIGNAL_FATAL           0
142 #define ACPI_SIGNAL_BREAKPOINT      1
143
144 typedef struct acpi_signal_fatal_info
145 {
146     UINT32                  Type;
147     UINT32                  Code;
148     UINT32                  Argument;
149
150 } ACPI_SIGNAL_FATAL_INFO;
151
152
153 /*
154  * OSL Initialization and shutdown primitives
155  */
156
157 ACPI_STATUS
158 AcpiOsInitialize (
159     void);
160
161 ACPI_STATUS
162 AcpiOsTerminate (
163     void);
164
165
166 /*
167  * ACPI Table interfaces
168  */
169
170 ACPI_STATUS
171 AcpiOsGetRootPointer (
172     UINT32                  Flags,
173     ACPI_POINTER            *Address);
174
175 ACPI_STATUS
176 AcpiOsPredefinedOverride (
177     const ACPI_PREDEFINED_NAMES *InitVal,
178     ACPI_STRING                 *NewVal);
179
180 ACPI_STATUS
181 AcpiOsTableOverride (
182     ACPI_TABLE_HEADER       *ExistingTable,
183     ACPI_TABLE_HEADER       **NewTable);
184
185
186 /*
187  * Synchronization primitives
188  */
189
190 ACPI_STATUS
191 AcpiOsCreateSemaphore (
192     UINT32                  MaxUnits,
193     UINT32                  InitialUnits,
194     ACPI_HANDLE             *OutHandle);
195
196 ACPI_STATUS
197 AcpiOsDeleteSemaphore (
198     ACPI_HANDLE             Handle);
199
200 ACPI_STATUS
201 AcpiOsWaitSemaphore (
202     ACPI_HANDLE             Handle,
203     UINT32                  Units,
204     UINT16                  Timeout);
205
206 ACPI_STATUS
207 AcpiOsSignalSemaphore (
208     ACPI_HANDLE             Handle,
209     UINT32                  Units);
210
211 ACPI_STATUS
212 AcpiOsCreateLock (
213     ACPI_HANDLE             *OutHandle);
214
215 void
216 AcpiOsDeleteLock (
217     ACPI_HANDLE             Handle);
218
219 void
220 AcpiOsAcquireLock (
221     ACPI_HANDLE             Handle,
222     UINT32                  Flags);
223
224 void
225 AcpiOsReleaseLock (
226     ACPI_HANDLE             Handle,
227     UINT32                  Flags);
228
229
230 /*
231  * Memory allocation and mapping
232  */
233
234 void *
235 AcpiOsAllocate (
236     ACPI_SIZE               Size);
237
238 void
239 AcpiOsFree (
240     void *                  Memory);
241
242 ACPI_STATUS
243 AcpiOsMapMemory (
244     ACPI_PHYSICAL_ADDRESS   PhysicalAddress,
245     ACPI_SIZE               Size,
246     void                    **LogicalAddress);
247
248 void
249 AcpiOsUnmapMemory (
250     void                    *LogicalAddress,
251     ACPI_SIZE               Size);
252
253 ACPI_STATUS
254 AcpiOsGetPhysicalAddress (
255     void                    *LogicalAddress,
256     ACPI_PHYSICAL_ADDRESS   *PhysicalAddress);
257
258
259 /*
260  * Interrupt handlers
261  */
262
263 ACPI_STATUS
264 AcpiOsInstallInterruptHandler (
265     UINT32                  InterruptNumber,
266     OSD_HANDLER             ServiceRoutine,
267     void                    *Context);
268
269 ACPI_STATUS
270 AcpiOsRemoveInterruptHandler (
271     UINT32                  InterruptNumber,
272     OSD_HANDLER             ServiceRoutine);
273
274
275 /*
276  * Threads and Scheduling
277  */
278
279 UINT32
280 AcpiOsGetThreadId (
281     void);
282
283 ACPI_STATUS
284 AcpiOsQueueForExecution (
285     UINT32                  Priority,
286     OSD_EXECUTION_CALLBACK  Function,
287     void                    *Context);
288
289 void
290 AcpiOsSleep (
291     UINT32                  Seconds,
292     UINT32                  Milliseconds);
293
294 void
295 AcpiOsStall (
296     UINT32                  Microseconds);
297
298
299 /*
300  * Platform and hardware-independent I/O interfaces
301  */
302
303 ACPI_STATUS
304 AcpiOsReadPort (
305     ACPI_IO_ADDRESS         Address,
306     UINT32                  *Value,
307     UINT32                  Width);
308
309 ACPI_STATUS
310 AcpiOsWritePort (
311     ACPI_IO_ADDRESS         Address,
312     UINT32                  Value,
313     UINT32                  Width);
314
315
316 /*
317  * Platform and hardware-independent physical memory interfaces
318  */
319
320 ACPI_STATUS
321 AcpiOsReadMemory (
322     ACPI_PHYSICAL_ADDRESS   Address,
323     UINT32                  *Value,
324     UINT32                  Width);
325
326 ACPI_STATUS
327 AcpiOsWriteMemory (
328     ACPI_PHYSICAL_ADDRESS   Address,
329     UINT32                  Value,
330     UINT32                  Width);
331
332
333 /*
334  * Platform and hardware-independent PCI configuration space access
335  */
336
337 ACPI_STATUS
338 AcpiOsReadPciConfiguration (
339     ACPI_PCI_ID             *PciId,
340     UINT32                  Register,
341     void                    *Value,
342     UINT32                  Width);
343
344 ACPI_STATUS
345 AcpiOsWritePciConfiguration (
346     ACPI_PCI_ID             *PciId,
347     UINT32                  Register,
348     ACPI_INTEGER            Value,
349     UINT32                  Width);
350
351 /*
352  * Interim function needed for PCI IRQ routing
353  */
354 void
355 AcpiOsDerivePciId(
356     ACPI_HANDLE             rhandle,
357     ACPI_HANDLE             chandle,
358     ACPI_PCI_ID             **PciId);
359
360 /*
361  * Miscellaneous
362  */
363
364 BOOLEAN
365 AcpiOsReadable (
366     void                    *Pointer,
367     ACPI_SIZE               Length);
368
369 BOOLEAN
370 AcpiOsWritable (
371     void                    *Pointer,
372     ACPI_SIZE               Length);
373
374 UINT32
375 AcpiOsGetTimer (
376     void);
377
378 ACPI_STATUS
379 AcpiOsSignal (
380     UINT32                  Function,
381     void                    *Info);
382
383 /*
384  * Debug print routines
385  */
386
387 void ACPI_INTERNAL_VAR_XFACE
388 AcpiOsPrintf (
389     const char              *Format,
390     ...);
391
392 void
393 AcpiOsVprintf (
394     const char              *Format,
395     va_list                 Args);
396
397 void
398 AcpiOsRedirectOutput (
399     void                    *Destination);
400
401
402 /*
403  * Debug input
404  */
405
406 UINT32
407 AcpiOsGetLine (
408     char                    *Buffer);
409
410
411 /*
412  * Directory manipulation
413  */
414
415 void *
416 AcpiOsOpenDirectory (
417     char                    *Pathname,
418     char                    *WildcardSpec,
419     char                    RequestedFileType);
420
421 /* RequesteFileType values */
422
423 #define REQUEST_FILE_ONLY                   0
424 #define REQUEST_DIR_ONLY                    1
425
426
427 char *
428 AcpiOsGetNextFilename (
429     void                    *DirHandle);
430
431 void
432 AcpiOsCloseDirectory (
433     void                    *DirHandle);
434
435 /*
436  * Debug
437  */
438
439 void
440 AcpiOsDbgAssert(
441     void                    *FailedAssertion,
442     void                    *FileName,
443     UINT32                  LineNumber,
444     char                    *Message);
445
446
447 #endif /* __ACPIOSXF_H__ */