acpiosxf.h revision 99146
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 * 13 * 1. Copyright Notice 14 * 15 * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp. 16 * All rights reserved. 17 * 18 * 2. License 19 * 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. 24 * 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 31 * 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; 41 * 42 * The above copyright and patent license is granted only if the following 43 * conditions are met: 44 * 45 * 3. Conditions 46 * 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. 58 * 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. 70 * 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. 76 * 77 * 3.4. Intel retains all right, title, and interest in and to the Original 78 * Intel Code. 79 * 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. 84 * 85 * 4. Disclaimer and Export Compliance 86 * 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. 94 * 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. 103 * 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. 118 * 119 *****************************************************************************/ 120 121#ifndef __ACPIOSXF_H__ 122#define __ACPIOSXF_H__ 123 124#include "platform/acenv.h" 125#include "actypes.h" 126 127 128/* Priorities for AcpiOsQueueForExecution */ 129 130#define OSD_PRIORITY_GPE 1 131#define OSD_PRIORITY_HIGH 2 132#define OSD_PRIORITY_MED 3 133#define OSD_PRIORITY_LO 4 134 135#define ACPI_NO_UNIT_LIMIT ((UINT32) -1) 136#define ACPI_MUTEX_SEM 1 137 138 139/* Functions for AcpiOsSignal */ 140 141#define ACPI_SIGNAL_FATAL 0 142#define ACPI_SIGNAL_BREAKPOINT 1 143 144typedef struct AcpiFatalInfo 145{ 146 UINT32 Type; 147 UINT32 Code; 148 UINT32 Argument; 149 150} ACPI_SIGNAL_FATAL_INFO; 151 152 153/* 154 * Types specific to the OS service interfaces 155 */ 156 157typedef UINT32 158(ACPI_SYSTEM_XFACE *OSD_HANDLER) ( 159 void *Context); 160 161typedef void 162(ACPI_SYSTEM_XFACE *OSD_EXECUTION_CALLBACK) ( 163 void *Context); 164 165 166/* 167 * OSL Initialization and shutdown primitives 168 */ 169 170ACPI_STATUS 171AcpiOsInitialize ( 172 void); 173 174ACPI_STATUS 175AcpiOsTerminate ( 176 void); 177 178 179/* 180 * ACPI Table interfaces 181 */ 182 183ACPI_STATUS 184AcpiOsGetRootPointer ( 185 UINT32 Flags, 186 ACPI_POINTER *Address); 187 188ACPI_STATUS 189AcpiOsTableOverride ( 190 ACPI_TABLE_HEADER *ExistingTable, 191 ACPI_TABLE_HEADER **NewTable); 192 193 194/* 195 * Synchronization primitives 196 */ 197 198ACPI_STATUS 199AcpiOsCreateSemaphore ( 200 UINT32 MaxUnits, 201 UINT32 InitialUnits, 202 ACPI_HANDLE *OutHandle); 203 204ACPI_STATUS 205AcpiOsDeleteSemaphore ( 206 ACPI_HANDLE Handle); 207 208ACPI_STATUS 209AcpiOsWaitSemaphore ( 210 ACPI_HANDLE Handle, 211 UINT32 Units, 212 UINT32 Timeout); 213 214ACPI_STATUS 215AcpiOsSignalSemaphore ( 216 ACPI_HANDLE Handle, 217 UINT32 Units); 218 219 220/* 221 * Memory allocation and mapping 222 */ 223 224void * 225AcpiOsAllocate ( 226 ACPI_SIZE Size); 227 228void 229AcpiOsFree ( 230 void * Memory); 231 232ACPI_STATUS 233AcpiOsMapMemory ( 234 ACPI_PHYSICAL_ADDRESS PhysicalAddress, 235 ACPI_SIZE Size, 236 void **LogicalAddress); 237 238void 239AcpiOsUnmapMemory ( 240 void *LogicalAddress, 241 ACPI_SIZE Size); 242 243ACPI_STATUS 244AcpiOsGetPhysicalAddress ( 245 void *LogicalAddress, 246 ACPI_PHYSICAL_ADDRESS *PhysicalAddress); 247 248 249/* 250 * Interrupt handlers 251 */ 252 253ACPI_STATUS 254AcpiOsInstallInterruptHandler ( 255 UINT32 InterruptNumber, 256 OSD_HANDLER ServiceRoutine, 257 void *Context); 258 259ACPI_STATUS 260AcpiOsRemoveInterruptHandler ( 261 UINT32 InterruptNumber, 262 OSD_HANDLER ServiceRoutine); 263 264 265/* 266 * Threads and Scheduling 267 */ 268 269UINT32 270AcpiOsGetThreadId ( 271 void); 272 273ACPI_STATUS 274AcpiOsQueueForExecution ( 275 UINT32 Priority, 276 OSD_EXECUTION_CALLBACK Function, 277 void *Context); 278 279void 280AcpiOsSleep ( 281 UINT32 Seconds, 282 UINT32 Milliseconds); 283 284void 285AcpiOsStall ( 286 UINT32 Microseconds); 287 288 289/* 290 * Platform and hardware-independent I/O interfaces 291 */ 292 293ACPI_STATUS 294AcpiOsReadPort ( 295 ACPI_IO_ADDRESS Address, 296 void *Value, 297 UINT32 Width); 298 299 300ACPI_STATUS 301AcpiOsWritePort ( 302 ACPI_IO_ADDRESS Address, 303 ACPI_INTEGER Value, 304 UINT32 Width); 305 306 307/* 308 * Platform and hardware-independent physical memory interfaces 309 */ 310 311ACPI_STATUS 312AcpiOsReadMemory ( 313 ACPI_PHYSICAL_ADDRESS Address, 314 void *Value, 315 UINT32 Width); 316 317 318ACPI_STATUS 319AcpiOsWriteMemory ( 320 ACPI_PHYSICAL_ADDRESS Address, 321 ACPI_INTEGER Value, 322 UINT32 Width); 323 324 325/* 326 * Platform and hardware-independent PCI configuration space access 327 */ 328 329ACPI_STATUS 330AcpiOsReadPciConfiguration ( 331 ACPI_PCI_ID *PciId, 332 UINT32 Register, 333 void *Value, 334 UINT32 Width); 335 336 337ACPI_STATUS 338AcpiOsWritePciConfiguration ( 339 ACPI_PCI_ID *PciId, 340 UINT32 Register, 341 ACPI_INTEGER Value, 342 UINT32 Width); 343 344 345/* 346 * Miscellaneous 347 */ 348 349BOOLEAN 350AcpiOsReadable ( 351 void *Pointer, 352 UINT32 Length); 353 354 355BOOLEAN 356AcpiOsWritable ( 357 void *Pointer, 358 UINT32 Length); 359 360UINT32 361AcpiOsGetTimer ( 362 void); 363 364ACPI_STATUS 365AcpiOsSignal ( 366 UINT32 Function, 367 void *Info); 368 369/* 370 * Debug print routines 371 */ 372 373void ACPI_INTERNAL_VAR_XFACE 374AcpiOsPrintf ( 375 const NATIVE_CHAR *Format, 376 ...); 377 378void 379AcpiOsVprintf ( 380 const NATIVE_CHAR *Format, 381 va_list Args); 382 383 384/* 385 * Debug input 386 */ 387 388UINT32 389AcpiOsGetLine ( 390 NATIVE_CHAR *Buffer); 391 392 393/* 394 * Debug 395 */ 396 397void 398AcpiOsDbgAssert( 399 void *FailedAssertion, 400 void *FileName, 401 UINT32 LineNumber, 402 NATIVE_CHAR *Message); 403 404 405#endif /* __ACPIOSXF_H__ */ 406