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 * Copyright (C) 2000 - 2012, Intel Corp. 13 * All rights reserved. 14 * 15 * Redistribution and use in source and binary forms, with or without 16 * modification, are permitted provided that the following conditions 17 * are met: 18 * 1. Redistributions of source code must retain the above copyright 19 * notice, this list of conditions, and the following disclaimer, 20 * without modification. 21 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 22 * substantially similar to the "NO WARRANTY" disclaimer below 23 * ("Disclaimer") and any redistribution must be conditioned upon 24 * including a substantially similar Disclaimer requirement for further 25 * binary redistribution. 26 * 3. Neither the names of the above-listed copyright holders nor the names 27 * of any contributors may be used to endorse or promote products derived 28 * from this software without specific prior written permission. 29 * 30 * Alternatively, this software may be distributed under the terms of the 31 * GNU General Public License ("GPL") version 2 as published by the Free 32 * Software Foundation. 33 * 34 * NO WARRANTY 35 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 38 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 40 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 41 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 42 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 43 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 44 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 45 * POSSIBILITY OF SUCH DAMAGES. 46 */ 47 48#ifndef __ACPIOSXF_H__ 49#define __ACPIOSXF_H__ 50 51#include <contrib/dev/acpica/include/platform/acenv.h> 52#include <contrib/dev/acpica/include/actypes.h> 53 54 55/* Types for AcpiOsExecute */ 56 57typedef enum 58{ 59 OSL_GLOBAL_LOCK_HANDLER, 60 OSL_NOTIFY_HANDLER, 61 OSL_GPE_HANDLER, 62 OSL_DEBUGGER_THREAD, 63 OSL_EC_POLL_HANDLER, 64 OSL_EC_BURST_HANDLER 65 66} ACPI_EXECUTE_TYPE; 67 68#define ACPI_NO_UNIT_LIMIT ((UINT32) -1) 69#define ACPI_MUTEX_SEM 1 70 71 72/* Functions for AcpiOsSignal */ 73 74#define ACPI_SIGNAL_FATAL 0 75#define ACPI_SIGNAL_BREAKPOINT 1 76 77typedef struct acpi_signal_fatal_info 78{ 79 UINT32 Type; 80 UINT32 Code; 81 UINT32 Argument; 82 83} ACPI_SIGNAL_FATAL_INFO; 84 85 86/* 87 * OSL Initialization and shutdown primitives 88 */ 89ACPI_STATUS 90AcpiOsInitialize ( 91 void); 92 93ACPI_STATUS 94AcpiOsTerminate ( 95 void); 96 97 98/* 99 * ACPI Table interfaces 100 */ 101ACPI_PHYSICAL_ADDRESS 102AcpiOsGetRootPointer ( 103 void); 104 105ACPI_STATUS 106AcpiOsPredefinedOverride ( 107 const ACPI_PREDEFINED_NAMES *InitVal, 108 ACPI_STRING *NewVal); 109 110ACPI_STATUS 111AcpiOsTableOverride ( 112 ACPI_TABLE_HEADER *ExistingTable, 113 ACPI_TABLE_HEADER **NewTable); 114 115ACPI_STATUS 116AcpiOsPhysicalTableOverride ( 117 ACPI_TABLE_HEADER *ExistingTable, 118 ACPI_PHYSICAL_ADDRESS *NewAddress, 119 UINT32 *NewTableLength); 120 121 122/* 123 * Spinlock primitives 124 */ 125ACPI_STATUS 126AcpiOsCreateLock ( 127 ACPI_SPINLOCK *OutHandle); 128 129void 130AcpiOsDeleteLock ( 131 ACPI_SPINLOCK Handle); 132 133ACPI_CPU_FLAGS 134AcpiOsAcquireLock ( 135 ACPI_SPINLOCK Handle); 136 137void 138AcpiOsReleaseLock ( 139 ACPI_SPINLOCK Handle, 140 ACPI_CPU_FLAGS Flags); 141 142 143/* 144 * Semaphore primitives 145 */ 146ACPI_STATUS 147AcpiOsCreateSemaphore ( 148 UINT32 MaxUnits, 149 UINT32 InitialUnits, 150 ACPI_SEMAPHORE *OutHandle); 151 152ACPI_STATUS 153AcpiOsDeleteSemaphore ( 154 ACPI_SEMAPHORE Handle); 155 156ACPI_STATUS 157AcpiOsWaitSemaphore ( 158 ACPI_SEMAPHORE Handle, 159 UINT32 Units, 160 UINT16 Timeout); 161 162ACPI_STATUS 163AcpiOsSignalSemaphore ( 164 ACPI_SEMAPHORE Handle, 165 UINT32 Units); 166 167 168/* 169 * Mutex primitives. May be configured to use semaphores instead via 170 * ACPI_MUTEX_TYPE (see platform/acenv.h) 171 */ 172#if (ACPI_MUTEX_TYPE != ACPI_BINARY_SEMAPHORE) 173 174ACPI_STATUS 175AcpiOsCreateMutex ( 176 ACPI_MUTEX *OutHandle); 177 178void 179AcpiOsDeleteMutex ( 180 ACPI_MUTEX Handle); 181 182ACPI_STATUS 183AcpiOsAcquireMutex ( 184 ACPI_MUTEX Handle, 185 UINT16 Timeout); 186 187void 188AcpiOsReleaseMutex ( 189 ACPI_MUTEX Handle); 190#endif 191 192 193/* 194 * Memory allocation and mapping 195 */ 196void * 197AcpiOsAllocate ( 198 ACPI_SIZE Size); 199 200void 201AcpiOsFree ( 202 void * Memory); 203 204void * 205AcpiOsMapMemory ( 206 ACPI_PHYSICAL_ADDRESS Where, 207 ACPI_SIZE Length); 208 209void 210AcpiOsUnmapMemory ( 211 void *LogicalAddress, 212 ACPI_SIZE Size); 213 214ACPI_STATUS 215AcpiOsGetPhysicalAddress ( 216 void *LogicalAddress, 217 ACPI_PHYSICAL_ADDRESS *PhysicalAddress); 218 219 220/* 221 * Memory/Object Cache 222 */ 223ACPI_STATUS 224AcpiOsCreateCache ( 225 char *CacheName, 226 UINT16 ObjectSize, 227 UINT16 MaxDepth, 228 ACPI_CACHE_T **ReturnCache); 229 230ACPI_STATUS 231AcpiOsDeleteCache ( 232 ACPI_CACHE_T *Cache); 233 234ACPI_STATUS 235AcpiOsPurgeCache ( 236 ACPI_CACHE_T *Cache); 237 238void * 239AcpiOsAcquireObject ( 240 ACPI_CACHE_T *Cache); 241 242ACPI_STATUS 243AcpiOsReleaseObject ( 244 ACPI_CACHE_T *Cache, 245 void *Object); 246 247 248/* 249 * Interrupt handlers 250 */ 251ACPI_STATUS 252AcpiOsInstallInterruptHandler ( 253 UINT32 InterruptNumber, 254 ACPI_OSD_HANDLER ServiceRoutine, 255 void *Context); 256 257ACPI_STATUS 258AcpiOsRemoveInterruptHandler ( 259 UINT32 InterruptNumber, 260 ACPI_OSD_HANDLER ServiceRoutine); 261 262 263/* 264 * Threads and Scheduling 265 */ 266ACPI_THREAD_ID 267AcpiOsGetThreadId ( 268 void); 269 270ACPI_STATUS 271AcpiOsExecute ( 272 ACPI_EXECUTE_TYPE Type, 273 ACPI_OSD_EXEC_CALLBACK Function, 274 void *Context); 275 276void 277AcpiOsWaitEventsComplete (
| 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 * Copyright (C) 2000 - 2012, Intel Corp. 13 * All rights reserved. 14 * 15 * Redistribution and use in source and binary forms, with or without 16 * modification, are permitted provided that the following conditions 17 * are met: 18 * 1. Redistributions of source code must retain the above copyright 19 * notice, this list of conditions, and the following disclaimer, 20 * without modification. 21 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 22 * substantially similar to the "NO WARRANTY" disclaimer below 23 * ("Disclaimer") and any redistribution must be conditioned upon 24 * including a substantially similar Disclaimer requirement for further 25 * binary redistribution. 26 * 3. Neither the names of the above-listed copyright holders nor the names 27 * of any contributors may be used to endorse or promote products derived 28 * from this software without specific prior written permission. 29 * 30 * Alternatively, this software may be distributed under the terms of the 31 * GNU General Public License ("GPL") version 2 as published by the Free 32 * Software Foundation. 33 * 34 * NO WARRANTY 35 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 38 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 40 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 41 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 42 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 43 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 44 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 45 * POSSIBILITY OF SUCH DAMAGES. 46 */ 47 48#ifndef __ACPIOSXF_H__ 49#define __ACPIOSXF_H__ 50 51#include <contrib/dev/acpica/include/platform/acenv.h> 52#include <contrib/dev/acpica/include/actypes.h> 53 54 55/* Types for AcpiOsExecute */ 56 57typedef enum 58{ 59 OSL_GLOBAL_LOCK_HANDLER, 60 OSL_NOTIFY_HANDLER, 61 OSL_GPE_HANDLER, 62 OSL_DEBUGGER_THREAD, 63 OSL_EC_POLL_HANDLER, 64 OSL_EC_BURST_HANDLER 65 66} ACPI_EXECUTE_TYPE; 67 68#define ACPI_NO_UNIT_LIMIT ((UINT32) -1) 69#define ACPI_MUTEX_SEM 1 70 71 72/* Functions for AcpiOsSignal */ 73 74#define ACPI_SIGNAL_FATAL 0 75#define ACPI_SIGNAL_BREAKPOINT 1 76 77typedef struct acpi_signal_fatal_info 78{ 79 UINT32 Type; 80 UINT32 Code; 81 UINT32 Argument; 82 83} ACPI_SIGNAL_FATAL_INFO; 84 85 86/* 87 * OSL Initialization and shutdown primitives 88 */ 89ACPI_STATUS 90AcpiOsInitialize ( 91 void); 92 93ACPI_STATUS 94AcpiOsTerminate ( 95 void); 96 97 98/* 99 * ACPI Table interfaces 100 */ 101ACPI_PHYSICAL_ADDRESS 102AcpiOsGetRootPointer ( 103 void); 104 105ACPI_STATUS 106AcpiOsPredefinedOverride ( 107 const ACPI_PREDEFINED_NAMES *InitVal, 108 ACPI_STRING *NewVal); 109 110ACPI_STATUS 111AcpiOsTableOverride ( 112 ACPI_TABLE_HEADER *ExistingTable, 113 ACPI_TABLE_HEADER **NewTable); 114 115ACPI_STATUS 116AcpiOsPhysicalTableOverride ( 117 ACPI_TABLE_HEADER *ExistingTable, 118 ACPI_PHYSICAL_ADDRESS *NewAddress, 119 UINT32 *NewTableLength); 120 121 122/* 123 * Spinlock primitives 124 */ 125ACPI_STATUS 126AcpiOsCreateLock ( 127 ACPI_SPINLOCK *OutHandle); 128 129void 130AcpiOsDeleteLock ( 131 ACPI_SPINLOCK Handle); 132 133ACPI_CPU_FLAGS 134AcpiOsAcquireLock ( 135 ACPI_SPINLOCK Handle); 136 137void 138AcpiOsReleaseLock ( 139 ACPI_SPINLOCK Handle, 140 ACPI_CPU_FLAGS Flags); 141 142 143/* 144 * Semaphore primitives 145 */ 146ACPI_STATUS 147AcpiOsCreateSemaphore ( 148 UINT32 MaxUnits, 149 UINT32 InitialUnits, 150 ACPI_SEMAPHORE *OutHandle); 151 152ACPI_STATUS 153AcpiOsDeleteSemaphore ( 154 ACPI_SEMAPHORE Handle); 155 156ACPI_STATUS 157AcpiOsWaitSemaphore ( 158 ACPI_SEMAPHORE Handle, 159 UINT32 Units, 160 UINT16 Timeout); 161 162ACPI_STATUS 163AcpiOsSignalSemaphore ( 164 ACPI_SEMAPHORE Handle, 165 UINT32 Units); 166 167 168/* 169 * Mutex primitives. May be configured to use semaphores instead via 170 * ACPI_MUTEX_TYPE (see platform/acenv.h) 171 */ 172#if (ACPI_MUTEX_TYPE != ACPI_BINARY_SEMAPHORE) 173 174ACPI_STATUS 175AcpiOsCreateMutex ( 176 ACPI_MUTEX *OutHandle); 177 178void 179AcpiOsDeleteMutex ( 180 ACPI_MUTEX Handle); 181 182ACPI_STATUS 183AcpiOsAcquireMutex ( 184 ACPI_MUTEX Handle, 185 UINT16 Timeout); 186 187void 188AcpiOsReleaseMutex ( 189 ACPI_MUTEX Handle); 190#endif 191 192 193/* 194 * Memory allocation and mapping 195 */ 196void * 197AcpiOsAllocate ( 198 ACPI_SIZE Size); 199 200void 201AcpiOsFree ( 202 void * Memory); 203 204void * 205AcpiOsMapMemory ( 206 ACPI_PHYSICAL_ADDRESS Where, 207 ACPI_SIZE Length); 208 209void 210AcpiOsUnmapMemory ( 211 void *LogicalAddress, 212 ACPI_SIZE Size); 213 214ACPI_STATUS 215AcpiOsGetPhysicalAddress ( 216 void *LogicalAddress, 217 ACPI_PHYSICAL_ADDRESS *PhysicalAddress); 218 219 220/* 221 * Memory/Object Cache 222 */ 223ACPI_STATUS 224AcpiOsCreateCache ( 225 char *CacheName, 226 UINT16 ObjectSize, 227 UINT16 MaxDepth, 228 ACPI_CACHE_T **ReturnCache); 229 230ACPI_STATUS 231AcpiOsDeleteCache ( 232 ACPI_CACHE_T *Cache); 233 234ACPI_STATUS 235AcpiOsPurgeCache ( 236 ACPI_CACHE_T *Cache); 237 238void * 239AcpiOsAcquireObject ( 240 ACPI_CACHE_T *Cache); 241 242ACPI_STATUS 243AcpiOsReleaseObject ( 244 ACPI_CACHE_T *Cache, 245 void *Object); 246 247 248/* 249 * Interrupt handlers 250 */ 251ACPI_STATUS 252AcpiOsInstallInterruptHandler ( 253 UINT32 InterruptNumber, 254 ACPI_OSD_HANDLER ServiceRoutine, 255 void *Context); 256 257ACPI_STATUS 258AcpiOsRemoveInterruptHandler ( 259 UINT32 InterruptNumber, 260 ACPI_OSD_HANDLER ServiceRoutine); 261 262 263/* 264 * Threads and Scheduling 265 */ 266ACPI_THREAD_ID 267AcpiOsGetThreadId ( 268 void); 269 270ACPI_STATUS 271AcpiOsExecute ( 272 ACPI_EXECUTE_TYPE Type, 273 ACPI_OSD_EXEC_CALLBACK Function, 274 void *Context); 275 276void 277AcpiOsWaitEventsComplete (
|
279 280void 281AcpiOsSleep ( 282 UINT64 Milliseconds); 283 284void 285AcpiOsStall ( 286 UINT32 Microseconds); 287 288 289/* 290 * Platform and hardware-independent I/O interfaces 291 */ 292ACPI_STATUS 293AcpiOsReadPort ( 294 ACPI_IO_ADDRESS Address, 295 UINT32 *Value, 296 UINT32 Width); 297 298ACPI_STATUS 299AcpiOsWritePort ( 300 ACPI_IO_ADDRESS Address, 301 UINT32 Value, 302 UINT32 Width); 303 304 305/* 306 * Platform and hardware-independent physical memory interfaces 307 */ 308ACPI_STATUS 309AcpiOsReadMemory ( 310 ACPI_PHYSICAL_ADDRESS Address, 311 UINT64 *Value, 312 UINT32 Width); 313 314ACPI_STATUS 315AcpiOsWriteMemory ( 316 ACPI_PHYSICAL_ADDRESS Address, 317 UINT64 Value, 318 UINT32 Width); 319 320 321/* 322 * Platform and hardware-independent PCI configuration space access 323 * Note: Can't use "Register" as a parameter, changed to "Reg" -- 324 * certain compilers complain. 325 */ 326ACPI_STATUS 327AcpiOsReadPciConfiguration ( 328 ACPI_PCI_ID *PciId, 329 UINT32 Reg, 330 UINT64 *Value, 331 UINT32 Width); 332 333ACPI_STATUS 334AcpiOsWritePciConfiguration ( 335 ACPI_PCI_ID *PciId, 336 UINT32 Reg, 337 UINT64 Value, 338 UINT32 Width); 339 340 341/* 342 * Miscellaneous 343 */ 344BOOLEAN 345AcpiOsReadable ( 346 void *Pointer, 347 ACPI_SIZE Length); 348 349BOOLEAN 350AcpiOsWritable ( 351 void *Pointer, 352 ACPI_SIZE Length); 353 354UINT64 355AcpiOsGetTimer ( 356 void); 357 358ACPI_STATUS 359AcpiOsSignal ( 360 UINT32 Function, 361 void *Info); 362 363 364/* 365 * Debug print routines 366 */ 367void ACPI_INTERNAL_VAR_XFACE 368AcpiOsPrintf ( 369 const char *Format, 370 ...); 371 372void 373AcpiOsVprintf ( 374 const char *Format, 375 va_list Args); 376 377void 378AcpiOsRedirectOutput ( 379 void *Destination); 380 381 382/* 383 * Debug input 384 */ 385ACPI_STATUS 386AcpiOsGetLine ( 387 char *Buffer, 388 UINT32 BufferLength, 389 UINT32 *BytesRead); 390 391 392/* 393 * Directory manipulation 394 */ 395void * 396AcpiOsOpenDirectory ( 397 char *Pathname, 398 char *WildcardSpec, 399 char RequestedFileType); 400 401/* RequesteFileType values */ 402 403#define REQUEST_FILE_ONLY 0 404#define REQUEST_DIR_ONLY 1 405 406 407char * 408AcpiOsGetNextFilename ( 409 void *DirHandle); 410 411void 412AcpiOsCloseDirectory ( 413 void *DirHandle); 414 415 416#endif /* __ACPIOSXF_H__ */
| 279 280void 281AcpiOsSleep ( 282 UINT64 Milliseconds); 283 284void 285AcpiOsStall ( 286 UINT32 Microseconds); 287 288 289/* 290 * Platform and hardware-independent I/O interfaces 291 */ 292ACPI_STATUS 293AcpiOsReadPort ( 294 ACPI_IO_ADDRESS Address, 295 UINT32 *Value, 296 UINT32 Width); 297 298ACPI_STATUS 299AcpiOsWritePort ( 300 ACPI_IO_ADDRESS Address, 301 UINT32 Value, 302 UINT32 Width); 303 304 305/* 306 * Platform and hardware-independent physical memory interfaces 307 */ 308ACPI_STATUS 309AcpiOsReadMemory ( 310 ACPI_PHYSICAL_ADDRESS Address, 311 UINT64 *Value, 312 UINT32 Width); 313 314ACPI_STATUS 315AcpiOsWriteMemory ( 316 ACPI_PHYSICAL_ADDRESS Address, 317 UINT64 Value, 318 UINT32 Width); 319 320 321/* 322 * Platform and hardware-independent PCI configuration space access 323 * Note: Can't use "Register" as a parameter, changed to "Reg" -- 324 * certain compilers complain. 325 */ 326ACPI_STATUS 327AcpiOsReadPciConfiguration ( 328 ACPI_PCI_ID *PciId, 329 UINT32 Reg, 330 UINT64 *Value, 331 UINT32 Width); 332 333ACPI_STATUS 334AcpiOsWritePciConfiguration ( 335 ACPI_PCI_ID *PciId, 336 UINT32 Reg, 337 UINT64 Value, 338 UINT32 Width); 339 340 341/* 342 * Miscellaneous 343 */ 344BOOLEAN 345AcpiOsReadable ( 346 void *Pointer, 347 ACPI_SIZE Length); 348 349BOOLEAN 350AcpiOsWritable ( 351 void *Pointer, 352 ACPI_SIZE Length); 353 354UINT64 355AcpiOsGetTimer ( 356 void); 357 358ACPI_STATUS 359AcpiOsSignal ( 360 UINT32 Function, 361 void *Info); 362 363 364/* 365 * Debug print routines 366 */ 367void ACPI_INTERNAL_VAR_XFACE 368AcpiOsPrintf ( 369 const char *Format, 370 ...); 371 372void 373AcpiOsVprintf ( 374 const char *Format, 375 va_list Args); 376 377void 378AcpiOsRedirectOutput ( 379 void *Destination); 380 381 382/* 383 * Debug input 384 */ 385ACPI_STATUS 386AcpiOsGetLine ( 387 char *Buffer, 388 UINT32 BufferLength, 389 UINT32 *BytesRead); 390 391 392/* 393 * Directory manipulation 394 */ 395void * 396AcpiOsOpenDirectory ( 397 char *Pathname, 398 char *WildcardSpec, 399 char RequestedFileType); 400 401/* RequesteFileType values */ 402 403#define REQUEST_FILE_ONLY 0 404#define REQUEST_DIR_ONLY 1 405 406 407char * 408AcpiOsGetNextFilename ( 409 void *DirHandle); 410 411void 412AcpiOsCloseDirectory ( 413 void *DirHandle); 414 415 416#endif /* __ACPIOSXF_H__ */
|