i386/identcpu.c: Add VIA Nano support
[dragonfly.git] / sys / contrib / dev / acpica-unix-20061109 / include / acpiosxf.h
blobfafce3cd9e4c45ed56df7fd9e2bbefe47cab432c
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 *****************************************************************************/
11 /******************************************************************************
13 * 1. Copyright Notice
15 * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp.
16 * All rights reserved.
18 * 2. License
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.
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
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;
42 * The above copyright and patent license is granted only if the following
43 * conditions are met:
45 * 3. Conditions
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.
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.
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.
77 * 3.4. Intel retains all right, title, and interest in and to the Original
78 * Intel Code.
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.
85 * 4. Disclaimer and Export Compliance
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.
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.
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.
119 *****************************************************************************/
121 #ifndef __ACPIOSXF_H__
122 #define __ACPIOSXF_H__
124 #include "platform/acenv.h"
125 #include "actypes.h"
128 /* Types for AcpiOsExecute */
130 typedef enum
132 OSL_GLOBAL_LOCK_HANDLER,
133 OSL_NOTIFY_HANDLER,
134 OSL_GPE_HANDLER,
135 OSL_DEBUGGER_THREAD,
136 OSL_EC_POLL_HANDLER,
137 OSL_EC_BURST_HANDLER
139 } ACPI_EXECUTE_TYPE;
141 #define ACPI_NO_UNIT_LIMIT ((UINT32) -1)
142 #define ACPI_MUTEX_SEM 1
145 /* Functions for AcpiOsSignal */
147 #define ACPI_SIGNAL_FATAL 0
148 #define ACPI_SIGNAL_BREAKPOINT 1
150 typedef struct acpi_signal_fatal_info
152 UINT32 Type;
153 UINT32 Code;
154 UINT32 Argument;
156 } ACPI_SIGNAL_FATAL_INFO;
160 * OSL Initialization and shutdown primitives
162 ACPI_STATUS
163 AcpiOsInitialize (
164 void);
166 ACPI_STATUS
167 AcpiOsTerminate (
168 void);
172 * ACPI Table interfaces
174 ACPI_PHYSICAL_ADDRESS
175 AcpiOsGetRootPointer (
176 void);
178 ACPI_STATUS
179 AcpiOsPredefinedOverride (
180 const ACPI_PREDEFINED_NAMES *InitVal,
181 ACPI_STRING *NewVal);
183 ACPI_STATUS
184 AcpiOsTableOverride (
185 ACPI_TABLE_HEADER *ExistingTable,
186 ACPI_TABLE_HEADER **NewTable);
190 * Spinlock primitives
192 ACPI_STATUS
193 AcpiOsCreateLock (
194 ACPI_SPINLOCK *OutHandle);
196 void
197 AcpiOsDeleteLock (
198 ACPI_SPINLOCK Handle);
200 ACPI_CPU_FLAGS
201 AcpiOsAcquireLock (
202 ACPI_SPINLOCK Handle);
204 void
205 AcpiOsReleaseLock (
206 ACPI_SPINLOCK Handle,
207 ACPI_CPU_FLAGS Flags);
211 * Semaphore primitives
213 ACPI_STATUS
214 AcpiOsCreateSemaphore (
215 UINT32 MaxUnits,
216 UINT32 InitialUnits,
217 ACPI_SEMAPHORE *OutHandle);
219 ACPI_STATUS
220 AcpiOsDeleteSemaphore (
221 ACPI_SEMAPHORE Handle);
223 ACPI_STATUS
224 AcpiOsWaitSemaphore (
225 ACPI_SEMAPHORE Handle,
226 UINT32 Units,
227 UINT16 Timeout);
229 ACPI_STATUS
230 AcpiOsSignalSemaphore (
231 ACPI_SEMAPHORE Handle,
232 UINT32 Units);
236 * Mutex primitives
238 ACPI_STATUS
239 AcpiOsCreateMutex (
240 ACPI_MUTEX *OutHandle);
242 void
243 AcpiOsDeleteMutex (
244 ACPI_MUTEX Handle);
246 ACPI_STATUS
247 AcpiOsAcquireMutex (
248 ACPI_MUTEX Handle,
249 UINT16 Timeout);
251 void
252 AcpiOsReleaseMutex (
253 ACPI_MUTEX Handle);
255 /* Temporary macros for Mutex* interfaces, map to existing semaphore xfaces */
257 #define AcpiOsCreateMutex(OutHandle) AcpiOsCreateSemaphore (1, 1, OutHandle)
258 #define AcpiOsDeleteMutex(Handle) (void) AcpiOsDeleteSemaphore (Handle)
259 #define AcpiOsAcquireMutex(Handle,Time) AcpiOsWaitSemaphore (Handle, 1, Time)
260 #define AcpiOsReleaseMutex(Handle) (void) AcpiOsSignalSemaphore (Handle, 1)
264 * Memory allocation and mapping
266 void *
267 AcpiOsAllocate (
268 ACPI_SIZE Size);
270 void
271 AcpiOsFree (
272 void * Memory);
274 void *
275 AcpiOsMapMemory (
276 ACPI_PHYSICAL_ADDRESS Where,
277 ACPI_NATIVE_UINT Length);
279 void
280 AcpiOsUnmapMemory (
281 void *LogicalAddress,
282 ACPI_SIZE Size);
284 ACPI_STATUS
285 AcpiOsGetPhysicalAddress (
286 void *LogicalAddress,
287 ACPI_PHYSICAL_ADDRESS *PhysicalAddress);
291 * Memory/Object Cache
293 ACPI_STATUS
294 AcpiOsCreateCache (
295 char *CacheName,
296 UINT16 ObjectSize,
297 UINT16 MaxDepth,
298 ACPI_CACHE_T **ReturnCache);
300 ACPI_STATUS
301 AcpiOsDeleteCache (
302 ACPI_CACHE_T *Cache);
304 ACPI_STATUS
305 AcpiOsPurgeCache (
306 ACPI_CACHE_T *Cache);
308 void *
309 AcpiOsAcquireObject (
310 ACPI_CACHE_T *Cache);
312 ACPI_STATUS
313 AcpiOsReleaseObject (
314 ACPI_CACHE_T *Cache,
315 void *Object);
319 * Interrupt handlers
321 ACPI_STATUS
322 AcpiOsInstallInterruptHandler (
323 UINT32 InterruptNumber,
324 ACPI_OSD_HANDLER ServiceRoutine,
325 void *Context);
327 ACPI_STATUS
328 AcpiOsRemoveInterruptHandler (
329 UINT32 InterruptNumber,
330 ACPI_OSD_HANDLER ServiceRoutine);
334 * Threads and Scheduling
336 ACPI_THREAD_ID
337 AcpiOsGetThreadId (
338 void);
340 ACPI_STATUS
341 AcpiOsExecute (
342 ACPI_EXECUTE_TYPE Type,
343 ACPI_OSD_EXEC_CALLBACK Function,
344 void *Context);
346 void
347 AcpiOsWaitEventsComplete (
348 void *Context);
350 void
351 AcpiOsSleep (
352 ACPI_INTEGER Milliseconds);
354 void
355 AcpiOsStall (
356 UINT32 Microseconds);
360 * Platform and hardware-independent I/O interfaces
362 ACPI_STATUS
363 AcpiOsReadPort (
364 ACPI_IO_ADDRESS Address,
365 UINT32 *Value,
366 UINT32 Width);
368 ACPI_STATUS
369 AcpiOsWritePort (
370 ACPI_IO_ADDRESS Address,
371 UINT32 Value,
372 UINT32 Width);
376 * Platform and hardware-independent physical memory interfaces
378 ACPI_STATUS
379 AcpiOsReadMemory (
380 ACPI_PHYSICAL_ADDRESS Address,
381 UINT32 *Value,
382 UINT32 Width);
384 ACPI_STATUS
385 AcpiOsWriteMemory (
386 ACPI_PHYSICAL_ADDRESS Address,
387 UINT32 Value,
388 UINT32 Width);
392 * Platform and hardware-independent PCI configuration space access
393 * Note: Can't use "Register" as a parameter, changed to "Reg" --
394 * certain compilers complain.
396 ACPI_STATUS
397 AcpiOsReadPciConfiguration (
398 ACPI_PCI_ID *PciId,
399 UINT32 Reg,
400 void *Value,
401 UINT32 Width);
403 ACPI_STATUS
404 AcpiOsWritePciConfiguration (
405 ACPI_PCI_ID *PciId,
406 UINT32 Reg,
407 ACPI_INTEGER Value,
408 UINT32 Width);
412 * Interim function needed for PCI IRQ routing
414 void
415 AcpiOsDerivePciId(
416 ACPI_HANDLE Rhandle,
417 ACPI_HANDLE Chandle,
418 ACPI_PCI_ID **PciId);
422 * Miscellaneous
424 ACPI_STATUS
425 AcpiOsValidateInterface (
426 char *Interface);
428 ACPI_STATUS
429 AcpiOsValidateAddress (
430 UINT8 SpaceId,
431 ACPI_PHYSICAL_ADDRESS Address,
432 ACPI_SIZE Length);
434 BOOLEAN
435 AcpiOsReadable (
436 void *Pointer,
437 ACPI_SIZE Length);
439 BOOLEAN
440 AcpiOsWritable (
441 void *Pointer,
442 ACPI_SIZE Length);
444 UINT64
445 AcpiOsGetTimer (
446 void);
448 ACPI_STATUS
449 AcpiOsSignal (
450 UINT32 Function,
451 void *Info);
455 * Debug print routines
457 void ACPI_INTERNAL_VAR_XFACE
458 AcpiOsPrintf (
459 const char *Format,
460 ...);
462 void
463 AcpiOsVprintf (
464 const char *Format,
465 va_list Args);
467 void
468 AcpiOsRedirectOutput (
469 void *Destination);
473 * Debug input
475 UINT32
476 AcpiOsGetLine (
477 char *Buffer);
481 * Directory manipulation
483 void *
484 AcpiOsOpenDirectory (
485 char *Pathname,
486 char *WildcardSpec,
487 char RequestedFileType);
489 /* RequesteFileType values */
491 #define REQUEST_FILE_ONLY 0
492 #define REQUEST_DIR_ONLY 1
495 char *
496 AcpiOsGetNextFilename (
497 void *DirHandle);
499 void
500 AcpiOsCloseDirectory (
501 void *DirHandle);
504 #endif /* __ACPIOSXF_H__ */