acpiosxf.h revision 92388
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 *
1591116Smsmith * Some or all of this work - Copyright (c) 1999 - 2002, 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
12477424Smsmith#include "platform/acenv.h"
12567754Smsmith#include "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
14480062Smsmithtypedef struct AcpiFatalInfo
14580062Smsmith{
14680062Smsmith    UINT32                  Type;
14780062Smsmith    UINT32                  Code;
14880062Smsmith    UINT32                  Argument;
14980062Smsmith
15080062Smsmith} ACPI_SIGNAL_FATAL_INFO;
15180062Smsmith
15280062Smsmith
15367754Smsmith/*
15477424Smsmith * Types specific to the OS service interfaces
15567754Smsmith */
15667754Smsmith
15792388Smsmithtypedef UINT32
15892388Smsmith(ACPI_SYSTEM_XFACE *OSD_HANDLER) (
15967754Smsmith    void                    *Context);
16067754Smsmith
16192388Smsmithtypedef void
16292388Smsmith(ACPI_SYSTEM_XFACE *OSD_EXECUTION_CALLBACK) (
16367754Smsmith    void                    *Context);
16467754Smsmith
16567754Smsmith
16667754Smsmith/*
16777424Smsmith * OSL Initialization and shutdown primitives
16867754Smsmith */
16967754Smsmith
17067754SmsmithACPI_STATUS
17167754SmsmithAcpiOsInitialize (
17267754Smsmith    void);
17367754Smsmith
17467754SmsmithACPI_STATUS
17567754SmsmithAcpiOsTerminate (
17667754Smsmith    void);
17767754Smsmith
17880062SmsmithACPI_STATUS
17980062SmsmithAcpiOsGetRootPointer (
18080062Smsmith    UINT32                  Flags,
18180062Smsmith    ACPI_PHYSICAL_ADDRESS   *RsdpPhysicalAddress);
18277424Smsmith
18380062Smsmith
18467754Smsmith/*
18567754Smsmith * Synchronization primitives
18667754Smsmith */
18767754Smsmith
18867754SmsmithACPI_STATUS
18967754SmsmithAcpiOsCreateSemaphore (
19067754Smsmith    UINT32                  MaxUnits,
19167754Smsmith    UINT32                  InitialUnits,
19267754Smsmith    ACPI_HANDLE             *OutHandle);
19367754Smsmith
19467754SmsmithACPI_STATUS
19567754SmsmithAcpiOsDeleteSemaphore (
19667754Smsmith    ACPI_HANDLE             Handle);
19767754Smsmith
19867754SmsmithACPI_STATUS
19967754SmsmithAcpiOsWaitSemaphore (
20067754Smsmith    ACPI_HANDLE             Handle,
20167754Smsmith    UINT32                  Units,
20267754Smsmith    UINT32                  Timeout);
20367754Smsmith
20467754SmsmithACPI_STATUS
20567754SmsmithAcpiOsSignalSemaphore (
20667754Smsmith    ACPI_HANDLE             Handle,
20767754Smsmith    UINT32                  Units);
20867754Smsmith
20977424Smsmith
21067754Smsmith/*
21167754Smsmith * Memory allocation and mapping
21267754Smsmith */
21367754Smsmith
21467754Smsmithvoid *
21567754SmsmithAcpiOsAllocate (
21691116Smsmith    ACPI_SIZE               Size);
21767754Smsmith
21867754Smsmithvoid
21967754SmsmithAcpiOsFree (
22067754Smsmith    void *                  Memory);
22167754Smsmith
22267754SmsmithACPI_STATUS
22367754SmsmithAcpiOsMapMemory (
22469450Smsmith    ACPI_PHYSICAL_ADDRESS   PhysicalAddress,
22591116Smsmith    ACPI_SIZE               Size,
22667754Smsmith    void                    **LogicalAddress);
22767754Smsmith
22867754Smsmithvoid
22967754SmsmithAcpiOsUnmapMemory (
23067754Smsmith    void                    *LogicalAddress,
23191116Smsmith    ACPI_SIZE               Size);
23267754Smsmith
23371867SmsmithACPI_STATUS
23471867SmsmithAcpiOsGetPhysicalAddress (
23571867Smsmith    void                    *LogicalAddress,
23671867Smsmith    ACPI_PHYSICAL_ADDRESS   *PhysicalAddress);
23767754Smsmith
23877424Smsmith
23967754Smsmith/*
24067754Smsmith * Interrupt handlers
24167754Smsmith */
24267754Smsmith
24367754SmsmithACPI_STATUS
24467754SmsmithAcpiOsInstallInterruptHandler (
24567754Smsmith    UINT32                  InterruptNumber,
24667754Smsmith    OSD_HANDLER             ServiceRoutine,
24767754Smsmith    void                    *Context);
24867754Smsmith
24967754SmsmithACPI_STATUS
25067754SmsmithAcpiOsRemoveInterruptHandler (
25167754Smsmith    UINT32                  InterruptNumber,
25267754Smsmith    OSD_HANDLER             ServiceRoutine);
25367754Smsmith
25467754Smsmith
25567754Smsmith/*
25677424Smsmith * Threads and Scheduling
25767754Smsmith */
25867754Smsmith
25977424SmsmithUINT32
26077424SmsmithAcpiOsGetThreadId (
26177424Smsmith    void);
26277424Smsmith
26367754SmsmithACPI_STATUS
26467754SmsmithAcpiOsQueueForExecution (
26567754Smsmith    UINT32                  Priority,
26667754Smsmith    OSD_EXECUTION_CALLBACK  Function,
26767754Smsmith    void                    *Context);
26867754Smsmith
26967754Smsmithvoid
27067754SmsmithAcpiOsSleep (
27167754Smsmith    UINT32                  Seconds,
27267754Smsmith    UINT32                  Milliseconds);
27367754Smsmith
27467754Smsmithvoid
27580062SmsmithAcpiOsStall (
27667754Smsmith    UINT32                  Microseconds);
27767754Smsmith
27877424Smsmith
27967754Smsmith/*
28080062Smsmith * Platform and hardware-independent I/O interfaces
28167754Smsmith */
28267754Smsmith
28380062SmsmithACPI_STATUS
28480062SmsmithAcpiOsReadPort (
28580062Smsmith    ACPI_IO_ADDRESS         Address,
28680062Smsmith    void                    *Value,
28780062Smsmith    UINT32                  Width);
28867754Smsmith
28967754Smsmith
29080062SmsmithACPI_STATUS
29180062SmsmithAcpiOsWritePort (
29280062Smsmith    ACPI_IO_ADDRESS         Address,
29387031Smsmith    ACPI_INTEGER            Value,
29480062Smsmith    UINT32                  Width);
29567754Smsmith
29667754Smsmith
29767754Smsmith/*
29880062Smsmith * Platform and hardware-independent physical memory interfaces
29967754Smsmith */
30067754Smsmith
30180062SmsmithACPI_STATUS
30280062SmsmithAcpiOsReadMemory (
30380062Smsmith    ACPI_PHYSICAL_ADDRESS   Address,
30480062Smsmith    void                    *Value,
30580062Smsmith    UINT32                  Width);
30667754Smsmith
30767754Smsmith
30880062SmsmithACPI_STATUS
30980062SmsmithAcpiOsWriteMemory (
31080062Smsmith    ACPI_PHYSICAL_ADDRESS   Address,
31187031Smsmith    ACPI_INTEGER            Value,
31280062Smsmith    UINT32                  Width);
31367754Smsmith
31467754Smsmith
31567754Smsmith/*
31680062Smsmith * Platform and hardware-independent PCI configuration space access
31767754Smsmith */
31867754Smsmith
31967754SmsmithACPI_STATUS
32080062SmsmithAcpiOsReadPciConfiguration (
32180062Smsmith    ACPI_PCI_ID             *PciId,
32267754Smsmith    UINT32                  Register,
32380062Smsmith    void                    *Value,
32480062Smsmith    UINT32                  Width);
32567754Smsmith
32667754Smsmith
32767754SmsmithACPI_STATUS
32880062SmsmithAcpiOsWritePciConfiguration (
32980062Smsmith    ACPI_PCI_ID             *PciId,
33067754Smsmith    UINT32                  Register,
33187031Smsmith    ACPI_INTEGER            Value,
33280062Smsmith    UINT32                  Width);
33367754Smsmith
33467754Smsmith
33567754Smsmith/*
33667754Smsmith * Miscellaneous
33767754Smsmith */
33867754Smsmith
33967754SmsmithBOOLEAN
34067754SmsmithAcpiOsReadable (
34167754Smsmith    void                    *Pointer,
34267754Smsmith    UINT32                  Length);
34367754Smsmith
34467754Smsmith
34567754SmsmithBOOLEAN
34667754SmsmithAcpiOsWritable (
34767754Smsmith    void                    *Pointer,
34867754Smsmith    UINT32                  Length);
34967754Smsmith
35078986SmsmithUINT32
35178986SmsmithAcpiOsGetTimer (
35278986Smsmith    void);
35367754Smsmith
35480062SmsmithACPI_STATUS
35580062SmsmithAcpiOsSignal (
35680062Smsmith    UINT32                  Function,
35780062Smsmith    void                    *Info);
35878986Smsmith
35967754Smsmith/*
36067754Smsmith * Debug print routines
36167754Smsmith */
36267754Smsmith
36392388Smsmithvoid ACPI_INTERNAL_VAR_XFACE
36467754SmsmithAcpiOsPrintf (
36567754Smsmith    const NATIVE_CHAR       *Format,
36667754Smsmith    ...);
36767754Smsmith
36891116Smsmithvoid
36967754SmsmithAcpiOsVprintf (
37067754Smsmith    const NATIVE_CHAR       *Format,
37167754Smsmith    va_list                 Args);
37267754Smsmith
37377424Smsmith
37467754Smsmith/*
37567754Smsmith * Debug input
37667754Smsmith */
37767754Smsmith
37867754SmsmithUINT32
37967754SmsmithAcpiOsGetLine (
38067754Smsmith    NATIVE_CHAR             *Buffer);
38167754Smsmith
38267754Smsmith
38367754Smsmith/*
38467754Smsmith * Debug
38567754Smsmith */
38667754Smsmith
38767754Smsmithvoid
38867754SmsmithAcpiOsDbgAssert(
38967754Smsmith    void                    *FailedAssertion,
39067754Smsmith    void                    *FileName,
39167754Smsmith    UINT32                  LineNumber,
39267754Smsmith    NATIVE_CHAR             *Message);
39367754Smsmith
39467754Smsmith
39577424Smsmith#endif /* __ACPIOSXF_H__ */
396