acpiosxf.h revision 151937
167754Smsmith 267754Smsmith/****************************************************************************** 367754Smsmith * 477424Smsmith * Name: acpiosxf.h - All interfaces to the OS Services Layer (OSL). These 577424Smsmith * interfaces must be implemented by OSL to interface the 677424Smsmith * ACPI components to the host operating system. 767754Smsmith * 867754Smsmith *****************************************************************************/ 967754Smsmith 1067754Smsmith 1167754Smsmith/****************************************************************************** 1267754Smsmith * 1367754Smsmith * 1. Copyright Notice 1467754Smsmith * 15151937Sjkim * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. 1670243Smsmith * All rights reserved. 1767754Smsmith * 1867754Smsmith * 2. License 1967754Smsmith * 2067754Smsmith * 2.1. This is your license from Intel Corp. under its intellectual property 2167754Smsmith * rights. You may have additional license terms from the party that provided 2267754Smsmith * you this software, covering your right to use that party's intellectual 2367754Smsmith * property rights. 2467754Smsmith * 2567754Smsmith * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 2667754Smsmith * copy of the source code appearing in this file ("Covered Code") an 2767754Smsmith * irrevocable, perpetual, worldwide license under Intel's copyrights in the 2867754Smsmith * base code distributed originally by Intel ("Original Intel Code") to copy, 2967754Smsmith * make derivatives, distribute, use and display any portion of the Covered 3067754Smsmith * Code in any form, with the right to sublicense such rights; and 3167754Smsmith * 3267754Smsmith * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 3367754Smsmith * license (with the right to sublicense), under only those claims of Intel 3467754Smsmith * patents that are infringed by the Original Intel Code, to make, use, sell, 3567754Smsmith * offer to sell, and import the Covered Code and derivative works thereof 3685756Smsmith * solely to the minimum extent necessary to exer 3785756Smsmith se the above copyright 3867754Smsmith * license, and in no event shall the patent license extend to any additions 3967754Smsmith * to or modifications of the Original Intel Code. No other license or right 4067754Smsmith * is granted directly or by implication, estoppel or otherwise; 4167754Smsmith * 4267754Smsmith * The above copyright and patent license is granted only if the following 4367754Smsmith * conditions are met: 4467754Smsmith * 4567754Smsmith * 3. Conditions 4667754Smsmith * 4767754Smsmith * 3.1. Redistribution of Source with Rights to Further Distribute Source. 4867754Smsmith * Redistribution of source code of any substantial portion of the Covered 4967754Smsmith * Code or modification with rights to further distribute source must include 5067754Smsmith * the above Copyright Notice, the above License, this list of Conditions, 5167754Smsmith * and the following Disclaimer and Export Compliance provision. In addition, 5267754Smsmith * Licensee must cause all Covered Code to which Licensee contributes to 5367754Smsmith * contain a file documenting the changes Licensee made to create that Covered 5467754Smsmith * Code and the date of any change. Licensee must include in that file the 5567754Smsmith * documentation of any changes made by any predecessor Licensee. Licensee 5667754Smsmith * must include a prominent statement that the modification is derived, 5767754Smsmith * directly or indirectly, from Original Intel Code. 5867754Smsmith * 5967754Smsmith * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 6067754Smsmith * Redistribution of source code of any substantial portion of the Covered 6167754Smsmith * Code or modification without rights to further distribute source must 6267754Smsmith * include the following Disclaimer and Export Compliance provision in the 6367754Smsmith * documentation and/or other materials provided with distribution. In 6467754Smsmith * addition, Licensee may not authorize further sublicense of source of any 6567754Smsmith * portion of the Covered Code, and must include terms to the effect that the 6667754Smsmith * license from Licensee to its licensee is limited to the intellectual 6767754Smsmith * property embodied in the software Licensee provides to its licensee, and 6867754Smsmith * not to intellectual property embodied in modifications its licensee may 6967754Smsmith * make. 7067754Smsmith * 7167754Smsmith * 3.3. Redistribution of Executable. Redistribution in executable form of any 7267754Smsmith * substantial portion of the Covered Code or modification must reproduce the 7367754Smsmith * above Copyright Notice, and the following Disclaimer and Export Compliance 7467754Smsmith * provision in the documentation and/or other materials provided with the 7567754Smsmith * distribution. 7667754Smsmith * 7767754Smsmith * 3.4. Intel retains all right, title, and interest in and to the Original 7867754Smsmith * Intel Code. 7967754Smsmith * 8067754Smsmith * 3.5. Neither the name Intel nor any other trademark owned or controlled by 8167754Smsmith * Intel shall be used in advertising or otherwise to promote the sale, use or 8267754Smsmith * other dealings in products derived from or relating to the Covered Code 8367754Smsmith * without prior written authorization from Intel. 8467754Smsmith * 8567754Smsmith * 4. Disclaimer and Export Compliance 8667754Smsmith * 8767754Smsmith * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 8867754Smsmith * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 8967754Smsmith * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 9067754Smsmith * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 9167754Smsmith * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 9267754Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 9367754Smsmith * PARTICULAR PURPOSE. 9467754Smsmith * 9567754Smsmith * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 9667754Smsmith * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 9767754Smsmith * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 9867754Smsmith * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 9967754Smsmith * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 10067754Smsmith * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 10167754Smsmith * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 10267754Smsmith * LIMITED REMEDY. 10367754Smsmith * 10467754Smsmith * 4.3. Licensee shall not export, either directly or indirectly, any of this 10567754Smsmith * software or system incorporating such software without first obtaining any 10667754Smsmith * required license or other approval from the U. S. Department of Commerce or 10767754Smsmith * any other agency or department of the United States Government. In the 10867754Smsmith * event Licensee exports any such software from the United States or 10967754Smsmith * re-exports any such software from a foreign destination, Licensee shall 11067754Smsmith * ensure that the distribution and export/re-export of the software is in 11167754Smsmith * compliance with all laws, regulations, orders, or other restrictions of the 11267754Smsmith * U.S. Export Administration Regulations. Licensee agrees that neither it nor 11367754Smsmith * any of its subsidiaries will export/re-export any technical data, process, 11467754Smsmith * software, or service, directly or indirectly, to any country for which the 11567754Smsmith * United States government or any agency thereof requires an export license, 11667754Smsmith * other governmental approval, or letter of assurance, without first obtaining 11767754Smsmith * such license, approval or letter. 11867754Smsmith * 11967754Smsmith *****************************************************************************/ 12067754Smsmith 12177424Smsmith#ifndef __ACPIOSXF_H__ 12277424Smsmith#define __ACPIOSXF_H__ 12367754Smsmith 124151600Sobrien#include <contrib/dev/acpica/acenv.h> 125151600Sobrien#include <contrib/dev/acpica/actypes.h> 12667754Smsmith 12767754Smsmith 12867754Smsmith/* Priorities for AcpiOsQueueForExecution */ 12967754Smsmith 13077424Smsmith#define OSD_PRIORITY_GPE 1 13177424Smsmith#define OSD_PRIORITY_HIGH 2 13277424Smsmith#define OSD_PRIORITY_MED 3 13377424Smsmith#define OSD_PRIORITY_LO 4 13467754Smsmith 13577424Smsmith#define ACPI_NO_UNIT_LIMIT ((UINT32) -1) 13677424Smsmith#define ACPI_MUTEX_SEM 1 13767754Smsmith 13867754Smsmith 13980062Smsmith/* Functions for AcpiOsSignal */ 14080062Smsmith 14180062Smsmith#define ACPI_SIGNAL_FATAL 0 14280062Smsmith#define ACPI_SIGNAL_BREAKPOINT 1 14380062Smsmith 144114237Snjltypedef struct acpi_signal_fatal_info 14580062Smsmith{ 14680062Smsmith UINT32 Type; 14780062Smsmith UINT32 Code; 14880062Smsmith UINT32 Argument; 14980062Smsmith 15080062Smsmith} ACPI_SIGNAL_FATAL_INFO; 15180062Smsmith 15280062Smsmith 15367754Smsmith/* 15477424Smsmith * OSL Initialization and shutdown primitives 15567754Smsmith */ 15667754SmsmithACPI_STATUS 15767754SmsmithAcpiOsInitialize ( 15867754Smsmith void); 15967754Smsmith 16067754SmsmithACPI_STATUS 16167754SmsmithAcpiOsTerminate ( 16267754Smsmith void); 16367754Smsmith 16499146Siwasaki 16599146Siwasaki/* 16699146Siwasaki * ACPI Table interfaces 16799146Siwasaki */ 16880062SmsmithACPI_STATUS 16980062SmsmithAcpiOsGetRootPointer ( 17080062Smsmith UINT32 Flags, 17199146Siwasaki ACPI_POINTER *Address); 17277424Smsmith 17399146SiwasakiACPI_STATUS 174114237SnjlAcpiOsPredefinedOverride ( 175114237Snjl const ACPI_PREDEFINED_NAMES *InitVal, 176114237Snjl ACPI_STRING *NewVal); 177114237Snjl 178114237SnjlACPI_STATUS 17999146SiwasakiAcpiOsTableOverride ( 18099146Siwasaki ACPI_TABLE_HEADER *ExistingTable, 18199146Siwasaki ACPI_TABLE_HEADER **NewTable); 18280062Smsmith 18399146Siwasaki 18467754Smsmith/* 18567754Smsmith * Synchronization primitives 18667754Smsmith */ 18767754SmsmithACPI_STATUS 18867754SmsmithAcpiOsCreateSemaphore ( 18967754Smsmith UINT32 MaxUnits, 19067754Smsmith UINT32 InitialUnits, 19167754Smsmith ACPI_HANDLE *OutHandle); 19267754Smsmith 19367754SmsmithACPI_STATUS 19467754SmsmithAcpiOsDeleteSemaphore ( 19567754Smsmith ACPI_HANDLE Handle); 19667754Smsmith 19767754SmsmithACPI_STATUS 19867754SmsmithAcpiOsWaitSemaphore ( 19967754Smsmith ACPI_HANDLE Handle, 20067754Smsmith UINT32 Units, 201107325Siwasaki UINT16 Timeout); 20267754Smsmith 20367754SmsmithACPI_STATUS 20467754SmsmithAcpiOsSignalSemaphore ( 20567754Smsmith ACPI_HANDLE Handle, 20667754Smsmith UINT32 Units); 20767754Smsmith 208117521SnjlACPI_STATUS 209117521SnjlAcpiOsCreateLock ( 210117521Snjl ACPI_HANDLE *OutHandle); 21177424Smsmith 212117521Snjlvoid 213117521SnjlAcpiOsDeleteLock ( 214117521Snjl ACPI_HANDLE Handle); 215117521Snjl 216151937SjkimACPI_NATIVE_UINT 217117521SnjlAcpiOsAcquireLock ( 218151937Sjkim ACPI_HANDLE Handle); 219117521Snjl 220117521Snjlvoid 221117521SnjlAcpiOsReleaseLock ( 222117521Snjl ACPI_HANDLE Handle, 223151937Sjkim ACPI_NATIVE_UINT Flags); 224117521Snjl 225117521Snjl 22667754Smsmith/* 22767754Smsmith * Memory allocation and mapping 22867754Smsmith */ 22967754Smsmithvoid * 23067754SmsmithAcpiOsAllocate ( 23191116Smsmith ACPI_SIZE Size); 23267754Smsmith 23367754Smsmithvoid 23467754SmsmithAcpiOsFree ( 23567754Smsmith void * Memory); 23667754Smsmith 23767754SmsmithACPI_STATUS 23867754SmsmithAcpiOsMapMemory ( 23969450Smsmith ACPI_PHYSICAL_ADDRESS PhysicalAddress, 24091116Smsmith ACPI_SIZE Size, 24167754Smsmith void **LogicalAddress); 24267754Smsmith 24367754Smsmithvoid 24467754SmsmithAcpiOsUnmapMemory ( 24567754Smsmith void *LogicalAddress, 24691116Smsmith ACPI_SIZE Size); 24767754Smsmith 24871867SmsmithACPI_STATUS 24971867SmsmithAcpiOsGetPhysicalAddress ( 25071867Smsmith void *LogicalAddress, 25171867Smsmith ACPI_PHYSICAL_ADDRESS *PhysicalAddress); 25267754Smsmith 25377424Smsmith 25467754Smsmith/* 255151937Sjkim * Memory/Object Cache 25667754Smsmith */ 257151937SjkimACPI_STATUS 258151937SjkimAcpiOsCreateCache ( 259151937Sjkim char *CacheName, 260151937Sjkim UINT16 ObjectSize, 261151937Sjkim UINT16 MaxDepth, 262151937Sjkim ACPI_CACHE_T **ReturnCache); 26367754Smsmith 26467754SmsmithACPI_STATUS 265151937SjkimAcpiOsDeleteCache ( 266151937Sjkim ACPI_CACHE_T *Cache); 267151937Sjkim 268151937SjkimACPI_STATUS 269151937SjkimAcpiOsPurgeCache ( 270151937Sjkim ACPI_CACHE_T *Cache); 271151937Sjkim 272151937Sjkimvoid * 273151937SjkimAcpiOsAcquireObject ( 274151937Sjkim ACPI_CACHE_T *Cache); 275151937Sjkim 276151937SjkimACPI_STATUS 277151937SjkimAcpiOsReleaseObject ( 278151937Sjkim ACPI_CACHE_T *Cache, 279151937Sjkim void *Object); 280151937Sjkim 281151937Sjkim 282151937Sjkim/* 283151937Sjkim * Interrupt handlers 284151937Sjkim */ 285151937SjkimACPI_STATUS 28667754SmsmithAcpiOsInstallInterruptHandler ( 28767754Smsmith UINT32 InterruptNumber, 288138287Smarks ACPI_OSD_HANDLER ServiceRoutine, 28967754Smsmith void *Context); 29067754Smsmith 29167754SmsmithACPI_STATUS 29267754SmsmithAcpiOsRemoveInterruptHandler ( 29367754Smsmith UINT32 InterruptNumber, 294138287Smarks ACPI_OSD_HANDLER ServiceRoutine); 29567754Smsmith 29667754Smsmith 29767754Smsmith/* 29877424Smsmith * Threads and Scheduling 29967754Smsmith */ 30077424SmsmithUINT32 30177424SmsmithAcpiOsGetThreadId ( 30277424Smsmith void); 30377424Smsmith 30467754SmsmithACPI_STATUS 30567754SmsmithAcpiOsQueueForExecution ( 30667754Smsmith UINT32 Priority, 307138287Smarks ACPI_OSD_EXEC_CALLBACK Function, 30867754Smsmith void *Context); 30967754Smsmith 31067754Smsmithvoid 311138287SmarksAcpiOsWaitEventsComplete ( 312138287Smarks void *Context); 313138287Smarks 314138287Smarksvoid 31567754SmsmithAcpiOsSleep ( 316138287Smarks ACPI_INTEGER Milliseconds); 31767754Smsmith 31867754Smsmithvoid 31980062SmsmithAcpiOsStall ( 32067754Smsmith UINT32 Microseconds); 32167754Smsmith 32277424Smsmith 32367754Smsmith/* 32480062Smsmith * Platform and hardware-independent I/O interfaces 32567754Smsmith */ 32680062SmsmithACPI_STATUS 32780062SmsmithAcpiOsReadPort ( 32880062Smsmith ACPI_IO_ADDRESS Address, 329117521Snjl UINT32 *Value, 33080062Smsmith UINT32 Width); 33167754Smsmith 33280062SmsmithACPI_STATUS 33380062SmsmithAcpiOsWritePort ( 33480062Smsmith ACPI_IO_ADDRESS Address, 335117521Snjl UINT32 Value, 33680062Smsmith UINT32 Width); 33767754Smsmith 33867754Smsmith 33967754Smsmith/* 34080062Smsmith * Platform and hardware-independent physical memory interfaces 34167754Smsmith */ 34280062SmsmithACPI_STATUS 34380062SmsmithAcpiOsReadMemory ( 34480062Smsmith ACPI_PHYSICAL_ADDRESS Address, 345117521Snjl UINT32 *Value, 34680062Smsmith UINT32 Width); 34767754Smsmith 34880062SmsmithACPI_STATUS 34980062SmsmithAcpiOsWriteMemory ( 35080062Smsmith ACPI_PHYSICAL_ADDRESS Address, 351117521Snjl UINT32 Value, 35280062Smsmith UINT32 Width); 35367754Smsmith 35467754Smsmith 35567754Smsmith/* 35680062Smsmith * Platform and hardware-independent PCI configuration space access 357138287Smarks * Note: Can't use "Register" as a parameter, changed to "Reg" -- 358138287Smarks * certain compilers complain. 35967754Smsmith */ 36067754SmsmithACPI_STATUS 36180062SmsmithAcpiOsReadPciConfiguration ( 36280062Smsmith ACPI_PCI_ID *PciId, 363138287Smarks UINT32 Reg, 36480062Smsmith void *Value, 36580062Smsmith UINT32 Width); 36667754Smsmith 36767754SmsmithACPI_STATUS 36880062SmsmithAcpiOsWritePciConfiguration ( 36980062Smsmith ACPI_PCI_ID *PciId, 370138287Smarks UINT32 Reg, 37187031Smsmith ACPI_INTEGER Value, 37280062Smsmith UINT32 Width); 37367754Smsmith 374114237Snjl/* 375114237Snjl * Interim function needed for PCI IRQ routing 376114237Snjl */ 377114237Snjlvoid 378114237SnjlAcpiOsDerivePciId( 379138287Smarks ACPI_HANDLE Rhandle, 380138287Smarks ACPI_HANDLE Chandle, 381114237Snjl ACPI_PCI_ID **PciId); 38267754Smsmith 38367754Smsmith/* 38467754Smsmith * Miscellaneous 38567754Smsmith */ 38667754SmsmithBOOLEAN 38767754SmsmithAcpiOsReadable ( 38867754Smsmith void *Pointer, 389117521Snjl ACPI_SIZE Length); 39067754Smsmith 39167754SmsmithBOOLEAN 39267754SmsmithAcpiOsWritable ( 39367754Smsmith void *Pointer, 394117521Snjl ACPI_SIZE Length); 39567754Smsmith 396138287SmarksUINT64 39778986SmsmithAcpiOsGetTimer ( 39878986Smsmith void); 39967754Smsmith 40080062SmsmithACPI_STATUS 40180062SmsmithAcpiOsSignal ( 40280062Smsmith UINT32 Function, 40380062Smsmith void *Info); 40478986Smsmith 40567754Smsmith/* 40667754Smsmith * Debug print routines 40767754Smsmith */ 40892388Smsmithvoid ACPI_INTERNAL_VAR_XFACE 40967754SmsmithAcpiOsPrintf ( 410114237Snjl const char *Format, 41167754Smsmith ...); 41267754Smsmith 41391116Smsmithvoid 41467754SmsmithAcpiOsVprintf ( 415114237Snjl const char *Format, 41667754Smsmith va_list Args); 41767754Smsmith 418100966Siwasakivoid 419100966SiwasakiAcpiOsRedirectOutput ( 420100966Siwasaki void *Destination); 42177424Smsmith 422100966Siwasaki 42367754Smsmith/* 42467754Smsmith * Debug input 42567754Smsmith */ 42667754SmsmithUINT32 42767754SmsmithAcpiOsGetLine ( 428114237Snjl char *Buffer); 42967754Smsmith 43067754Smsmith 43167754Smsmith/* 432114237Snjl * Directory manipulation 433114237Snjl */ 434114237Snjlvoid * 435114237SnjlAcpiOsOpenDirectory ( 436114237Snjl char *Pathname, 437114237Snjl char *WildcardSpec, 438114237Snjl char RequestedFileType); 439114237Snjl 440114237Snjl/* RequesteFileType values */ 441114237Snjl 442114237Snjl#define REQUEST_FILE_ONLY 0 443114237Snjl#define REQUEST_DIR_ONLY 1 444114237Snjl 445114237Snjl 446114237Snjlchar * 447114237SnjlAcpiOsGetNextFilename ( 448114237Snjl void *DirHandle); 449114237Snjl 450114237Snjlvoid 451114237SnjlAcpiOsCloseDirectory ( 452114237Snjl void *DirHandle); 453114237Snjl 454114237Snjl/* 45567754Smsmith * Debug 45667754Smsmith */ 45767754Smsmithvoid 45867754SmsmithAcpiOsDbgAssert( 45967754Smsmith void *FailedAssertion, 46067754Smsmith void *FileName, 46167754Smsmith UINT32 LineNumber, 462114237Snjl char *Message); 46367754Smsmith 46477424Smsmith#endif /* __ACPIOSXF_H__ */ 465