acpiosxf.h revision 78986
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, 2000, 2001, 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 exercise the above copyright 37 * license, and in no event shall the patent license extend to any additions 38 * to or modifications of the Original Intel Code. No other license or right 39 * is granted directly or by implication, estoppel or otherwise; 40 * 41 * The above copyright and patent license is granted only if the following 42 * conditions are met: 43 * 44 * 3. Conditions 45 * 46 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 47 * Redistribution of source code of any substantial portion of the Covered 48 * Code or modification with rights to further distribute source must include 49 * the above Copyright Notice, the above License, this list of Conditions, 50 * and the following Disclaimer and Export Compliance provision. In addition, 51 * Licensee must cause all Covered Code to which Licensee contributes to 52 * contain a file documenting the changes Licensee made to create that Covered 53 * Code and the date of any change. Licensee must include in that file the 54 * documentation of any changes made by any predecessor Licensee. Licensee 55 * must include a prominent statement that the modification is derived, 56 * directly or indirectly, from Original Intel Code. 57 * 58 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 59 * Redistribution of source code of any substantial portion of the Covered 60 * Code or modification without rights to further distribute source must 61 * include the following Disclaimer and Export Compliance provision in the 62 * documentation and/or other materials provided with distribution. In 63 * addition, Licensee may not authorize further sublicense of source of any 64 * portion of the Covered Code, and must include terms to the effect that the 65 * license from Licensee to its licensee is limited to the intellectual 66 * property embodied in the software Licensee provides to its licensee, and 67 * not to intellectual property embodied in modifications its licensee may 68 * make. 69 * 70 * 3.3. Redistribution of Executable. Redistribution in executable form of any 71 * substantial portion of the Covered Code or modification must reproduce the 72 * above Copyright Notice, and the following Disclaimer and Export Compliance 73 * provision in the documentation and/or other materials provided with the 74 * distribution. 75 * 76 * 3.4. Intel retains all right, title, and interest in and to the Original 77 * Intel Code. 78 * 79 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 80 * Intel shall be used in advertising or otherwise to promote the sale, use or 81 * other dealings in products derived from or relating to the Covered Code 82 * without prior written authorization from Intel. 83 * 84 * 4. Disclaimer and Export Compliance 85 * 86 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 87 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 88 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 89 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 90 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 91 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 92 * PARTICULAR PURPOSE. 93 * 94 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 95 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 96 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 97 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 98 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 99 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 100 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 101 * LIMITED REMEDY. 102 * 103 * 4.3. Licensee shall not export, either directly or indirectly, any of this 104 * software or system incorporating such software without first obtaining any 105 * required license or other approval from the U. S. Department of Commerce or 106 * any other agency or department of the United States Government. In the 107 * event Licensee exports any such software from the United States or 108 * re-exports any such software from a foreign destination, Licensee shall 109 * ensure that the distribution and export/re-export of the software is in 110 * compliance with all laws, regulations, orders, or other restrictions of the 111 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 112 * any of its subsidiaries will export/re-export any technical data, process, 113 * software, or service, directly or indirectly, to any country for which the 114 * United States government or any agency thereof requires an export license, 115 * other governmental approval, or letter of assurance, without first obtaining 116 * such license, approval or letter. 117 * 118 *****************************************************************************/ 119 120#ifndef __ACPIOSXF_H__ 121#define __ACPIOSXF_H__ 122 123#include "platform/acenv.h" 124#include "actypes.h" 125 126 127/* Priorities for AcpiOsQueueForExecution */ 128 129#define OSD_PRIORITY_GPE 1 130#define OSD_PRIORITY_HIGH 2 131#define OSD_PRIORITY_MED 3 132#define OSD_PRIORITY_LO 4 133 134#define ACPI_NO_UNIT_LIMIT ((UINT32) -1) 135#define ACPI_MUTEX_SEM 1 136 137 138/* 139 * Types specific to the OS service interfaces 140 */ 141 142typedef 143UINT32 (*OSD_HANDLER) ( 144 void *Context); 145 146typedef 147void (*OSD_EXECUTION_CALLBACK) ( 148 void *Context); 149 150 151/* 152 * OSL Initialization and shutdown primitives 153 */ 154 155ACPI_STATUS 156AcpiOsInitialize ( 157 void); 158 159ACPI_STATUS 160AcpiOsTerminate ( 161 void); 162 163 164/* 165 * Synchronization primitives 166 */ 167 168ACPI_STATUS 169AcpiOsCreateSemaphore ( 170 UINT32 MaxUnits, 171 UINT32 InitialUnits, 172 ACPI_HANDLE *OutHandle); 173 174ACPI_STATUS 175AcpiOsDeleteSemaphore ( 176 ACPI_HANDLE Handle); 177 178ACPI_STATUS 179AcpiOsWaitSemaphore ( 180 ACPI_HANDLE Handle, 181 UINT32 Units, 182 UINT32 Timeout); 183 184ACPI_STATUS 185AcpiOsSignalSemaphore ( 186 ACPI_HANDLE Handle, 187 UINT32 Units); 188 189 190/* 191 * Memory allocation and mapping 192 */ 193 194void * 195AcpiOsAllocate ( 196 UINT32 Size); 197 198void * 199AcpiOsCallocate ( 200 UINT32 Size); 201 202void 203AcpiOsFree ( 204 void * Memory); 205 206ACPI_STATUS 207AcpiOsMapMemory ( 208 ACPI_PHYSICAL_ADDRESS PhysicalAddress, 209 UINT32 Length, 210 void **LogicalAddress); 211 212void 213AcpiOsUnmapMemory ( 214 void *LogicalAddress, 215 UINT32 Length); 216 217ACPI_STATUS 218AcpiOsGetPhysicalAddress ( 219 void *LogicalAddress, 220 ACPI_PHYSICAL_ADDRESS *PhysicalAddress); 221 222 223/* 224 * Interrupt handlers 225 */ 226 227ACPI_STATUS 228AcpiOsInstallInterruptHandler ( 229 UINT32 InterruptNumber, 230 OSD_HANDLER ServiceRoutine, 231 void *Context); 232 233ACPI_STATUS 234AcpiOsRemoveInterruptHandler ( 235 UINT32 InterruptNumber, 236 OSD_HANDLER ServiceRoutine); 237 238 239/* 240 * Threads and Scheduling 241 */ 242 243UINT32 244AcpiOsGetThreadId ( 245 void); 246 247ACPI_STATUS 248AcpiOsQueueForExecution ( 249 UINT32 Priority, 250 OSD_EXECUTION_CALLBACK Function, 251 void *Context); 252 253void 254AcpiOsSleep ( 255 UINT32 Seconds, 256 UINT32 Milliseconds); 257 258void 259AcpiOsSleepUsec ( 260 UINT32 Microseconds); 261 262 263/* 264 * Platform/Hardware independent I/O interfaces 265 */ 266 267UINT8 268AcpiOsIn8 ( 269 ACPI_IO_ADDRESS InPort); 270 271 272UINT16 273AcpiOsIn16 ( 274 ACPI_IO_ADDRESS InPort); 275 276UINT32 277AcpiOsIn32 ( 278 ACPI_IO_ADDRESS InPort); 279 280void 281AcpiOsOut8 ( 282 ACPI_IO_ADDRESS OutPort, 283 UINT8 Value); 284 285void 286AcpiOsOut16 ( 287 ACPI_IO_ADDRESS OutPort, 288 UINT16 Value); 289 290void 291AcpiOsOut32 ( 292 ACPI_IO_ADDRESS OutPort, 293 UINT32 Value); 294 295 296/* 297 * Platform/Hardware independent physical memory interfaces 298 */ 299 300UINT8 301AcpiOsMemIn8 ( 302 ACPI_PHYSICAL_ADDRESS InAddr); 303 304UINT16 305AcpiOsMemIn16 ( 306 ACPI_PHYSICAL_ADDRESS InAddr); 307 308UINT32 309AcpiOsMemIn32 ( 310 ACPI_PHYSICAL_ADDRESS InAddr); 311 312void 313AcpiOsMemOut8 ( 314 ACPI_PHYSICAL_ADDRESS OutAddr, 315 UINT8 Value); 316 317void 318AcpiOsMemOut16 ( 319 ACPI_PHYSICAL_ADDRESS OutAddr, 320 UINT16 Value); 321 322void 323AcpiOsMemOut32 ( 324 ACPI_PHYSICAL_ADDRESS OutAddr, 325 UINT32 Value); 326 327 328/* 329 * Standard access to PCI configuration space 330 */ 331 332ACPI_STATUS 333AcpiOsReadPciCfgByte ( 334 UINT32 Bus, 335 UINT32 DeviceFunction, 336 UINT32 Register, 337 UINT8 *Value); 338 339ACPI_STATUS 340AcpiOsReadPciCfgWord ( 341 UINT32 Bus, 342 UINT32 DeviceFunction, 343 UINT32 Register, 344 UINT16 *Value); 345 346ACPI_STATUS 347AcpiOsReadPciCfgDword ( 348 UINT32 Bus, 349 UINT32 DeviceFunction, 350 UINT32 Register, 351 UINT32 *Value); 352 353ACPI_STATUS 354AcpiOsWritePciCfgByte ( 355 UINT32 Bus, 356 UINT32 DeviceFunction, 357 UINT32 Register, 358 UINT8 Value); 359 360ACPI_STATUS 361AcpiOsWritePciCfgWord ( 362 UINT32 Bus, 363 UINT32 DeviceFunction, 364 UINT32 Register, 365 UINT16 Value); 366 367 368ACPI_STATUS 369AcpiOsWritePciCfgDword ( 370 UINT32 Bus, 371 UINT32 DeviceFunction, 372 UINT32 Register, 373 UINT32 Value); 374 375 376/* 377 * Miscellaneous 378 */ 379 380ACPI_STATUS 381AcpiOsBreakpoint ( 382 NATIVE_CHAR *Message); 383 384BOOLEAN 385AcpiOsReadable ( 386 void *Pointer, 387 UINT32 Length); 388 389 390BOOLEAN 391AcpiOsWritable ( 392 void *Pointer, 393 UINT32 Length); 394 395UINT32 396AcpiOsGetTimer ( 397 void); 398 399 400 401/* 402 * Debug print routines 403 */ 404 405INT32 406AcpiOsPrintf ( 407 const NATIVE_CHAR *Format, 408 ...); 409 410INT32 411AcpiOsVprintf ( 412 const NATIVE_CHAR *Format, 413 va_list Args); 414 415 416/* 417 * Debug input 418 */ 419 420UINT32 421AcpiOsGetLine ( 422 NATIVE_CHAR *Buffer); 423 424 425/* 426 * Debug 427 */ 428 429void 430AcpiOsDbgAssert( 431 void *FailedAssertion, 432 void *FileName, 433 UINT32 LineNumber, 434 NATIVE_CHAR *Message); 435 436 437#endif /* __ACPIOSXF_H__ */ 438