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 *****************************************************************************/
9 /******************************************************************************
13 * Some or all of this work - Copyright (c) 1999 - 2017, Intel Corp.
14 * All rights reserved.
18 * 2.1. This is your license from Intel Corp. under its intellectual property
19 * rights. You may have additional license terms from the party that provided
20 * you this software, covering your right to use that party's intellectual
23 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
24 * copy of the source code appearing in this file ("Covered Code") an
25 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
26 * base code distributed originally by Intel ("Original Intel Code") to copy,
27 * make derivatives, distribute, use and display any portion of the Covered
28 * Code in any form, with the right to sublicense such rights; and
30 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
31 * license (with the right to sublicense), under only those claims of Intel
32 * patents that are infringed by the Original Intel Code, to make, use, sell,
33 * offer to sell, and import the Covered Code and derivative works thereof
34 * solely to the minimum extent necessary to exercise the above copyright
35 * license, and in no event shall the patent license extend to any additions
36 * to or modifications of the Original Intel Code. No other license or right
37 * is granted directly or by implication, estoppel or otherwise;
39 * The above copyright and patent license is granted only if the following
44 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
45 * Redistribution of source code of any substantial portion of the Covered
46 * Code or modification with rights to further distribute source must include
47 * the above Copyright Notice, the above License, this list of Conditions,
48 * and the following Disclaimer and Export Compliance provision. In addition,
49 * Licensee must cause all Covered Code to which Licensee contributes to
50 * contain a file documenting the changes Licensee made to create that Covered
51 * Code and the date of any change. Licensee must include in that file the
52 * documentation of any changes made by any predecessor Licensee. Licensee
53 * must include a prominent statement that the modification is derived,
54 * directly or indirectly, from Original Intel Code.
56 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
57 * Redistribution of source code of any substantial portion of the Covered
58 * Code or modification without rights to further distribute source must
59 * include the following Disclaimer and Export Compliance provision in the
60 * documentation and/or other materials provided with distribution. In
61 * addition, Licensee may not authorize further sublicense of source of any
62 * portion of the Covered Code, and must include terms to the effect that the
63 * license from Licensee to its licensee is limited to the intellectual
64 * property embodied in the software Licensee provides to its licensee, and
65 * not to intellectual property embodied in modifications its licensee may
68 * 3.3. Redistribution of Executable. Redistribution in executable form of any
69 * substantial portion of the Covered Code or modification must reproduce the
70 * above Copyright Notice, and the following Disclaimer and Export Compliance
71 * provision in the documentation and/or other materials provided with the
74 * 3.4. Intel retains all right, title, and interest in and to the Original
77 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
78 * Intel shall be used in advertising or otherwise to promote the sale, use or
79 * other dealings in products derived from or relating to the Covered Code
80 * without prior written authorization from Intel.
82 * 4. Disclaimer and Export Compliance
84 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
85 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
86 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
87 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
88 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
89 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
92 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
93 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
94 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
95 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
96 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
97 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
98 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
101 * 4.3. Licensee shall not export, either directly or indirectly, any of this
102 * software or system incorporating such software without first obtaining any
103 * required license or other approval from the U. S. Department of Commerce or
104 * any other agency or department of the United States Government. In the
105 * event Licensee exports any such software from the United States or
106 * re-exports any such software from a foreign destination, Licensee shall
107 * ensure that the distribution and export/re-export of the software is in
108 * compliance with all laws, regulations, orders, or other restrictions of the
109 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
110 * any of its subsidiaries will export/re-export any technical data, process,
111 * software, or service, directly or indirectly, to any country for which the
112 * United States government or any agency thereof requires an export license,
113 * other governmental approval, or letter of assurance, without first obtaining
114 * such license, approval or letter.
116 *****************************************************************************
118 * Alternatively, you may choose to be licensed under the terms of the
121 * Redistribution and use in source and binary forms, with or without
122 * modification, are permitted provided that the following conditions
124 * 1. Redistributions of source code must retain the above copyright
125 * notice, this list of conditions, and the following disclaimer,
126 * without modification.
127 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
128 * substantially similar to the "NO WARRANTY" disclaimer below
129 * ("Disclaimer") and any redistribution must be conditioned upon
130 * including a substantially similar Disclaimer requirement for further
131 * binary redistribution.
132 * 3. Neither the names of the above-listed copyright holders nor the names
133 * of any contributors may be used to endorse or promote products derived
134 * from this software without specific prior written permission.
136 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
137 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
138 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
139 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
140 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
141 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
142 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
143 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
144 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
145 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
146 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
148 * Alternatively, you may choose to be licensed under the terms of the
149 * GNU General Public License ("GPL") version 2 as published by the Free
150 * Software Foundation.
152 *****************************************************************************/
154 #ifndef __ACPIOSXF_H__
155 #define __ACPIOSXF_H__
157 #include "platform/acenv.h"
161 /* Types for AcpiOsExecute */
165 OSL_GLOBAL_LOCK_HANDLER
,
168 OSL_DEBUGGER_MAIN_THREAD
,
169 OSL_DEBUGGER_EXEC_THREAD
,
175 #define ACPI_NO_UNIT_LIMIT ((UINT32) -1)
176 #define ACPI_MUTEX_SEM 1
179 /* Functions for AcpiOsSignal */
181 #define ACPI_SIGNAL_FATAL 0
182 #define ACPI_SIGNAL_BREAKPOINT 1
184 typedef struct acpi_signal_fatal_info
190 } ACPI_SIGNAL_FATAL_INFO
;
194 * OSL Initialization and shutdown primitives
196 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInitialize
202 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTerminate
210 * ACPI Table interfaces
212 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetRootPointer
213 ACPI_PHYSICAL_ADDRESS
214 AcpiOsGetRootPointer (
218 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPredefinedOverride
220 AcpiOsPredefinedOverride (
221 const ACPI_PREDEFINED_NAMES
*InitVal
,
222 ACPI_STRING
*NewVal
);
225 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTableOverride
227 AcpiOsTableOverride (
228 ACPI_TABLE_HEADER
*ExistingTable
,
229 ACPI_TABLE_HEADER
**NewTable
);
232 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPhysicalTableOverride
234 AcpiOsPhysicalTableOverride (
235 ACPI_TABLE_HEADER
*ExistingTable
,
236 ACPI_PHYSICAL_ADDRESS
*NewAddress
,
237 UINT32
*NewTableLength
);
242 * Spinlock primitives
244 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateLock
247 ACPI_SPINLOCK
*OutHandle
);
250 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsDeleteLock
253 ACPI_SPINLOCK Handle
);
256 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireLock
259 ACPI_SPINLOCK Handle
);
262 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReleaseLock
265 ACPI_SPINLOCK Handle
,
266 ACPI_CPU_FLAGS Flags
);
271 * Semaphore primitives
273 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateSemaphore
275 AcpiOsCreateSemaphore (
278 ACPI_SEMAPHORE
*OutHandle
);
281 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsDeleteSemaphore
283 AcpiOsDeleteSemaphore (
284 ACPI_SEMAPHORE Handle
);
287 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWaitSemaphore
289 AcpiOsWaitSemaphore (
290 ACPI_SEMAPHORE Handle
,
295 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsSignalSemaphore
297 AcpiOsSignalSemaphore (
298 ACPI_SEMAPHORE Handle
,
304 * Mutex primitives. May be configured to use semaphores instead via
305 * ACPI_MUTEX_TYPE (see platform/acenv.h)
307 #if (ACPI_MUTEX_TYPE != ACPI_BINARY_SEMAPHORE)
309 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateMutex
312 ACPI_MUTEX
*OutHandle
);
315 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsDeleteMutex
321 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireMutex
328 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReleaseMutex
338 * Memory allocation and mapping
340 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocate
346 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocateZeroed
348 AcpiOsAllocateZeroed (
352 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsFree
358 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsMapMemory
361 ACPI_PHYSICAL_ADDRESS Where
,
365 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsUnmapMemory
368 void *LogicalAddress
,
372 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetPhysicalAddress
374 AcpiOsGetPhysicalAddress (
375 void *LogicalAddress
,
376 ACPI_PHYSICAL_ADDRESS
*PhysicalAddress
);
381 * Memory/Object Cache
383 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateCache
389 ACPI_CACHE_T
**ReturnCache
);
392 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsDeleteCache
395 ACPI_CACHE_T
*Cache
);
398 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPurgeCache
401 ACPI_CACHE_T
*Cache
);
404 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireObject
406 AcpiOsAcquireObject (
407 ACPI_CACHE_T
*Cache
);
410 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReleaseObject
412 AcpiOsReleaseObject (
421 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInstallInterruptHandler
423 AcpiOsInstallInterruptHandler (
424 UINT32 InterruptNumber
,
425 ACPI_OSD_HANDLER ServiceRoutine
,
429 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsRemoveInterruptHandler
431 AcpiOsRemoveInterruptHandler (
432 UINT32 InterruptNumber
,
433 ACPI_OSD_HANDLER ServiceRoutine
);
438 * Threads and Scheduling
440 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetThreadId
446 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsExecute
449 ACPI_EXECUTE_TYPE Type
,
450 ACPI_OSD_EXEC_CALLBACK Function
,
454 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWaitEventsComplete
456 AcpiOsWaitEventsComplete (
460 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsSleep
463 UINT64 Milliseconds
);
466 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsStall
469 UINT32 Microseconds
);
474 * Platform and hardware-independent I/O interfaces
476 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadPort
479 ACPI_IO_ADDRESS Address
,
484 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritePort
487 ACPI_IO_ADDRESS Address
,
494 * Platform and hardware-independent physical memory interfaces
496 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadMemory
499 ACPI_PHYSICAL_ADDRESS Address
,
504 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWriteMemory
507 ACPI_PHYSICAL_ADDRESS Address
,
514 * Platform and hardware-independent PCI configuration space access
515 * Note: Can't use "Register" as a parameter, changed to "Reg" --
516 * certain compilers complain.
518 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadPciConfiguration
520 AcpiOsReadPciConfiguration (
527 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritePciConfiguration
529 AcpiOsWritePciConfiguration (
540 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadable
547 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritable
554 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTimer
560 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsSignal
567 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsEnterSleep
577 * Debug print routines
579 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPrintf
580 void ACPI_INTERNAL_VAR_XFACE
586 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsVprintf
593 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsRedirectOutput
595 AcpiOsRedirectOutput (
603 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetLine
611 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInitializeDebugger
613 AcpiOsInitializeDebugger (
617 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTerminateDebugger
619 AcpiOsTerminateDebugger (
623 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWaitCommandReady
625 AcpiOsWaitCommandReady (
629 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsNotifyCommandComplete
631 AcpiOsNotifyCommandComplete (
635 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTracePoint
638 ACPI_TRACE_EVENT_TYPE Type
,
646 * Obtain ACPI table(s)
648 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByName
650 AcpiOsGetTableByName (
653 ACPI_TABLE_HEADER
**Table
,
654 ACPI_PHYSICAL_ADDRESS
*Address
);
657 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByIndex
659 AcpiOsGetTableByIndex (
661 ACPI_TABLE_HEADER
**Table
,
663 ACPI_PHYSICAL_ADDRESS
*Address
);
666 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByAddress
668 AcpiOsGetTableByAddress (
669 ACPI_PHYSICAL_ADDRESS Address
,
670 ACPI_TABLE_HEADER
**Table
);
675 * Directory manipulation
677 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsOpenDirectory
679 AcpiOsOpenDirectory (
682 char RequestedFileType
);
685 /* RequesteFileType values */
687 #define REQUEST_FILE_ONLY 0
688 #define REQUEST_DIR_ONLY 1
691 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetNextFilename
693 AcpiOsGetNextFilename (
697 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCloseDirectory
699 AcpiOsCloseDirectory (
704 #endif /* __ACPIOSXF_H__ */