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 - 2016, 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
,
60 OSL_DEBUGGER_MAIN_THREAD
,
61 OSL_DEBUGGER_EXEC_THREAD
,
67 #define ACPI_NO_UNIT_LIMIT ((UINT32) -1)
68 #define ACPI_MUTEX_SEM 1
71 /* Functions for AcpiOsSignal */
73 #define ACPI_SIGNAL_FATAL 0
74 #define ACPI_SIGNAL_BREAKPOINT 1
76 typedef struct acpi_signal_fatal_info
82 } ACPI_SIGNAL_FATAL_INFO
;
86 * OSL Initialization and shutdown primitives
88 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInitialize
94 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTerminate
102 * ACPI Table interfaces
104 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetRootPointer
105 ACPI_PHYSICAL_ADDRESS
106 AcpiOsGetRootPointer (
110 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPredefinedOverride
112 AcpiOsPredefinedOverride (
113 const ACPI_PREDEFINED_NAMES
*InitVal
,
114 ACPI_STRING
*NewVal
);
117 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTableOverride
119 AcpiOsTableOverride (
120 ACPI_TABLE_HEADER
*ExistingTable
,
121 ACPI_TABLE_HEADER
**NewTable
);
124 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPhysicalTableOverride
126 AcpiOsPhysicalTableOverride (
127 ACPI_TABLE_HEADER
*ExistingTable
,
128 ACPI_PHYSICAL_ADDRESS
*NewAddress
,
129 UINT32
*NewTableLength
);
134 * Spinlock primitives
136 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateLock
139 ACPI_SPINLOCK
*OutHandle
);
142 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsDeleteLock
145 ACPI_SPINLOCK Handle
);
148 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireLock
151 ACPI_SPINLOCK Handle
);
154 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReleaseLock
157 ACPI_SPINLOCK Handle
,
158 ACPI_CPU_FLAGS Flags
);
163 * Semaphore primitives
165 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateSemaphore
167 AcpiOsCreateSemaphore (
170 ACPI_SEMAPHORE
*OutHandle
);
173 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsDeleteSemaphore
175 AcpiOsDeleteSemaphore (
176 ACPI_SEMAPHORE Handle
);
179 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWaitSemaphore
181 AcpiOsWaitSemaphore (
182 ACPI_SEMAPHORE Handle
,
187 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsSignalSemaphore
189 AcpiOsSignalSemaphore (
190 ACPI_SEMAPHORE Handle
,
196 * Mutex primitives. May be configured to use semaphores instead via
197 * ACPI_MUTEX_TYPE (see platform/acenv.h)
199 #if (ACPI_MUTEX_TYPE != ACPI_BINARY_SEMAPHORE)
201 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateMutex
204 ACPI_MUTEX
*OutHandle
);
207 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsDeleteMutex
213 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireMutex
220 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReleaseMutex
230 * Memory allocation and mapping
232 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocate
238 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocateZeroed
240 AcpiOsAllocateZeroed (
244 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsFree
250 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsMapMemory
253 ACPI_PHYSICAL_ADDRESS Where
,
257 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsUnmapMemory
260 void *LogicalAddress
,
264 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetPhysicalAddress
266 AcpiOsGetPhysicalAddress (
267 void *LogicalAddress
,
268 ACPI_PHYSICAL_ADDRESS
*PhysicalAddress
);
273 * Memory/Object Cache
275 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateCache
281 ACPI_CACHE_T
**ReturnCache
);
284 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsDeleteCache
287 ACPI_CACHE_T
*Cache
);
290 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPurgeCache
293 ACPI_CACHE_T
*Cache
);
296 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireObject
298 AcpiOsAcquireObject (
299 ACPI_CACHE_T
*Cache
);
302 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReleaseObject
304 AcpiOsReleaseObject (
313 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInstallInterruptHandler
315 AcpiOsInstallInterruptHandler (
316 UINT32 InterruptNumber
,
317 ACPI_OSD_HANDLER ServiceRoutine
,
321 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsRemoveInterruptHandler
323 AcpiOsRemoveInterruptHandler (
324 UINT32 InterruptNumber
,
325 ACPI_OSD_HANDLER ServiceRoutine
);
330 * Threads and Scheduling
332 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetThreadId
338 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsExecute
341 ACPI_EXECUTE_TYPE Type
,
342 ACPI_OSD_EXEC_CALLBACK Function
,
346 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWaitEventsComplete
348 AcpiOsWaitEventsComplete (
352 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsSleep
355 UINT64 Milliseconds
);
358 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsStall
361 UINT32 Microseconds
);
366 * Platform and hardware-independent I/O interfaces
368 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadPort
371 ACPI_IO_ADDRESS Address
,
376 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritePort
379 ACPI_IO_ADDRESS Address
,
386 * Platform and hardware-independent physical memory interfaces
388 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadMemory
391 ACPI_PHYSICAL_ADDRESS Address
,
396 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWriteMemory
399 ACPI_PHYSICAL_ADDRESS Address
,
406 * Platform and hardware-independent PCI configuration space access
407 * Note: Can't use "Register" as a parameter, changed to "Reg" --
408 * certain compilers complain.
410 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadPciConfiguration
412 AcpiOsReadPciConfiguration (
419 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritePciConfiguration
421 AcpiOsWritePciConfiguration (
432 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadable
439 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritable
446 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTimer
452 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsSignal
461 * Debug print routines
463 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPrintf
464 void ACPI_INTERNAL_VAR_XFACE
470 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsVprintf
477 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsRedirectOutput
479 AcpiOsRedirectOutput (
487 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetLine
497 * Obtain ACPI table(s)
499 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByName
501 AcpiOsGetTableByName (
504 ACPI_TABLE_HEADER
**Table
,
505 ACPI_PHYSICAL_ADDRESS
*Address
);
508 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByIndex
510 AcpiOsGetTableByIndex (
512 ACPI_TABLE_HEADER
**Table
,
514 ACPI_PHYSICAL_ADDRESS
*Address
);
517 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByAddress
519 AcpiOsGetTableByAddress (
520 ACPI_PHYSICAL_ADDRESS Address
,
521 ACPI_TABLE_HEADER
**Table
);
526 * Directory manipulation
528 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsOpenDirectory
530 AcpiOsOpenDirectory (
533 char RequestedFileType
);
536 /* RequesteFileType values */
538 #define REQUEST_FILE_ONLY 0
539 #define REQUEST_DIR_ONLY 1
542 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetNextFilename
544 AcpiOsGetNextFilename (
548 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCloseDirectory
550 AcpiOsCloseDirectory (
556 * File I/O and related support
558 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsOpenFile
565 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCloseFile
571 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadFile
580 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWriteFile
589 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetFileOffset
591 AcpiOsGetFileOffset (
595 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsSetFileOffset
597 AcpiOsSetFileOffset (
603 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTracePoint
606 ACPI_TRACE_EVENT_TYPE Type
,
613 #endif /* __ACPIOSXF_H__ */