1 /******************************************************************************
3 * Name: acpiosxf.h - All interfaces to the OS Services Layer (OSL). These
4 * interfaces must be implemented by OSL to interface the
5 * ACPI components to the host operating system.
7 *****************************************************************************/
10 * Copyright (C) 2000 - 2013, Intel Corp.
11 * All rights reserved.
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions, and the following disclaimer,
18 * without modification.
19 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
20 * substantially similar to the "NO WARRANTY" disclaimer below
21 * ("Disclaimer") and any redistribution must be conditioned upon
22 * including a substantially similar Disclaimer requirement for further
23 * binary redistribution.
24 * 3. Neither the names of the above-listed copyright holders nor the names
25 * of any contributors may be used to endorse or promote products derived
26 * from this software without specific prior written permission.
28 * Alternatively, this software may be distributed under the terms of the
29 * GNU General Public License ("GPL") version 2 as published by the Free
30 * Software Foundation.
33 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
34 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
35 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
36 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
37 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
38 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
39 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
40 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
41 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
42 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
43 * POSSIBILITY OF SUCH DAMAGES.
46 #ifndef __ACPIOSXF_H__
47 #define __ACPIOSXF_H__
49 #include "platform/acenv.h"
53 /* Types for AcpiOsExecute */
57 OSL_GLOBAL_LOCK_HANDLER
,
66 #define ACPI_NO_UNIT_LIMIT ((UINT32) -1)
67 #define ACPI_MUTEX_SEM 1
70 /* Functions for AcpiOsSignal */
72 #define ACPI_SIGNAL_FATAL 0
73 #define ACPI_SIGNAL_BREAKPOINT 1
75 typedef struct acpi_signal_fatal_info
81 } ACPI_SIGNAL_FATAL_INFO
;
85 * OSL Initialization and shutdown primitives
87 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInitialize
93 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTerminate
101 * ACPI Table interfaces
103 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetRootPointer
104 ACPI_PHYSICAL_ADDRESS
105 AcpiOsGetRootPointer (
109 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPredefinedOverride
111 AcpiOsPredefinedOverride (
112 const ACPI_PREDEFINED_NAMES
*InitVal
,
113 ACPI_STRING
*NewVal
);
116 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTableOverride
118 AcpiOsTableOverride (
119 ACPI_TABLE_HEADER
*ExistingTable
,
120 ACPI_TABLE_HEADER
**NewTable
);
123 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPhysicalTableOverride
125 AcpiOsPhysicalTableOverride (
126 ACPI_TABLE_HEADER
*ExistingTable
,
127 ACPI_PHYSICAL_ADDRESS
*NewAddress
,
128 UINT32
*NewTableLength
);
133 * Spinlock primitives
135 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateLock
138 ACPI_SPINLOCK
*OutHandle
);
141 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsDeleteLock
144 ACPI_SPINLOCK Handle
);
147 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireLock
150 ACPI_SPINLOCK Handle
);
153 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReleaseLock
156 ACPI_SPINLOCK Handle
,
157 ACPI_CPU_FLAGS Flags
);
162 * Semaphore primitives
164 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateSemaphore
166 AcpiOsCreateSemaphore (
169 ACPI_SEMAPHORE
*OutHandle
);
172 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsDeleteSemaphore
174 AcpiOsDeleteSemaphore (
175 ACPI_SEMAPHORE Handle
);
178 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWaitSemaphore
180 AcpiOsWaitSemaphore (
181 ACPI_SEMAPHORE Handle
,
186 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsSignalSemaphore
188 AcpiOsSignalSemaphore (
189 ACPI_SEMAPHORE Handle
,
195 * Mutex primitives. May be configured to use semaphores instead via
196 * ACPI_MUTEX_TYPE (see platform/acenv.h)
198 #if (ACPI_MUTEX_TYPE != ACPI_BINARY_SEMAPHORE)
200 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateMutex
203 ACPI_MUTEX
*OutHandle
);
206 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsDeleteMutex
212 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireMutex
219 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReleaseMutex
229 * Memory allocation and mapping
231 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocate
237 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocateZeroed
239 AcpiOsAllocateZeroed (
243 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsFree
249 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsMapMemory
252 ACPI_PHYSICAL_ADDRESS Where
,
256 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsUnmapMemory
259 void *LogicalAddress
,
263 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetPhysicalAddress
265 AcpiOsGetPhysicalAddress (
266 void *LogicalAddress
,
267 ACPI_PHYSICAL_ADDRESS
*PhysicalAddress
);
272 * Memory/Object Cache
274 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateCache
280 ACPI_CACHE_T
**ReturnCache
);
283 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsDeleteCache
286 ACPI_CACHE_T
*Cache
);
289 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPurgeCache
292 ACPI_CACHE_T
*Cache
);
295 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireObject
297 AcpiOsAcquireObject (
298 ACPI_CACHE_T
*Cache
);
301 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReleaseObject
303 AcpiOsReleaseObject (
312 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInstallInterruptHandler
314 AcpiOsInstallInterruptHandler (
315 UINT32 InterruptNumber
,
316 ACPI_OSD_HANDLER ServiceRoutine
,
320 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsRemoveInterruptHandler
322 AcpiOsRemoveInterruptHandler (
323 UINT32 InterruptNumber
,
324 ACPI_OSD_HANDLER ServiceRoutine
);
329 * Threads and Scheduling
331 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetThreadId
337 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsExecute
340 ACPI_EXECUTE_TYPE Type
,
341 ACPI_OSD_EXEC_CALLBACK Function
,
345 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWaitEventsComplete
347 AcpiOsWaitEventsComplete (
351 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsSleep
354 UINT64 Milliseconds
);
357 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsStall
360 UINT32 Microseconds
);
365 * Platform and hardware-independent I/O interfaces
367 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadPort
370 ACPI_IO_ADDRESS Address
,
375 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritePort
378 ACPI_IO_ADDRESS Address
,
385 * Platform and hardware-independent physical memory interfaces
387 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadMemory
390 ACPI_PHYSICAL_ADDRESS Address
,
395 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWriteMemory
398 ACPI_PHYSICAL_ADDRESS Address
,
405 * Platform and hardware-independent PCI configuration space access
406 * Note: Can't use "Register" as a parameter, changed to "Reg" --
407 * certain compilers complain.
409 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadPciConfiguration
411 AcpiOsReadPciConfiguration (
418 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritePciConfiguration
420 AcpiOsWritePciConfiguration (
431 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadable
438 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritable
445 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTimer
451 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsSignal
460 * Debug print routines
462 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPrintf
463 void ACPI_INTERNAL_VAR_XFACE
469 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsVprintf
476 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsRedirectOutput
478 AcpiOsRedirectOutput (
486 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetLine
496 * Obtain ACPI table(s)
498 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByName
500 AcpiOsGetTableByName (
503 ACPI_TABLE_HEADER
**Table
,
504 ACPI_PHYSICAL_ADDRESS
*Address
);
507 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByIndex
509 AcpiOsGetTableByIndex (
511 ACPI_TABLE_HEADER
**Table
,
513 ACPI_PHYSICAL_ADDRESS
*Address
);
516 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByAddress
518 AcpiOsGetTableByAddress (
519 ACPI_PHYSICAL_ADDRESS Address
,
520 ACPI_TABLE_HEADER
**Table
);
525 * Directory manipulation
527 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsOpenDirectory
529 AcpiOsOpenDirectory (
532 char RequestedFileType
);
535 /* RequesteFileType values */
537 #define REQUEST_FILE_ONLY 0
538 #define REQUEST_DIR_ONLY 1
541 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetNextFilename
543 AcpiOsGetNextFilename (
547 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCloseDirectory
549 AcpiOsCloseDirectory (
554 #endif /* __ACPIOSXF_H__ */