acpiosxf.h revision 193267
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 *
15193267Sjkim * Some or all of this work - Copyright (c) 1999 - 2009, 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
124193251Sjkim#include "platform/acenv.h"
125193251Sjkim#include "actypes.h"
12667754Smsmith
12767754Smsmith
128167802Sjkim/* Types for AcpiOsExecute */
12967754Smsmith
130167802Sjkimtypedef enum
131167802Sjkim{
132167802Sjkim    OSL_GLOBAL_LOCK_HANDLER,
133167802Sjkim    OSL_NOTIFY_HANDLER,
134167802Sjkim    OSL_GPE_HANDLER,
135167802Sjkim    OSL_DEBUGGER_THREAD,
136167802Sjkim    OSL_EC_POLL_HANDLER,
137167802Sjkim    OSL_EC_BURST_HANDLER
13867754Smsmith
139167802Sjkim} ACPI_EXECUTE_TYPE;
140167802Sjkim
14177424Smsmith#define ACPI_NO_UNIT_LIMIT          ((UINT32) -1)
14277424Smsmith#define ACPI_MUTEX_SEM              1
14367754Smsmith
14467754Smsmith
14580062Smsmith/* Functions for AcpiOsSignal */
14680062Smsmith
14780062Smsmith#define ACPI_SIGNAL_FATAL           0
14880062Smsmith#define ACPI_SIGNAL_BREAKPOINT      1
14980062Smsmith
150114237Snjltypedef struct acpi_signal_fatal_info
15180062Smsmith{
15280062Smsmith    UINT32                  Type;
15380062Smsmith    UINT32                  Code;
15480062Smsmith    UINT32                  Argument;
15580062Smsmith
15680062Smsmith} ACPI_SIGNAL_FATAL_INFO;
15780062Smsmith
15880062Smsmith
15967754Smsmith/*
16077424Smsmith * OSL Initialization and shutdown primitives
16167754Smsmith */
16267754SmsmithACPI_STATUS
16367754SmsmithAcpiOsInitialize (
16467754Smsmith    void);
16567754Smsmith
16667754SmsmithACPI_STATUS
16767754SmsmithAcpiOsTerminate (
16867754Smsmith    void);
16967754Smsmith
17099146Siwasaki
17199146Siwasaki/*
17299146Siwasaki * ACPI Table interfaces
17399146Siwasaki */
174167802SjkimACPI_PHYSICAL_ADDRESS
17580062SmsmithAcpiOsGetRootPointer (
176167802Sjkim    void);
17777424Smsmith
17899146SiwasakiACPI_STATUS
179114237SnjlAcpiOsPredefinedOverride (
180114237Snjl    const ACPI_PREDEFINED_NAMES *InitVal,
181114237Snjl    ACPI_STRING                 *NewVal);
182114237Snjl
183114237SnjlACPI_STATUS
18499146SiwasakiAcpiOsTableOverride (
18599146Siwasaki    ACPI_TABLE_HEADER       *ExistingTable,
18699146Siwasaki    ACPI_TABLE_HEADER       **NewTable);
18780062Smsmith
18899146Siwasaki
18967754Smsmith/*
190167802Sjkim * Spinlock primitives
19167754Smsmith */
19267754SmsmithACPI_STATUS
193167802SjkimAcpiOsCreateLock (
194167802Sjkim    ACPI_SPINLOCK           *OutHandle);
195167802Sjkim
196167802Sjkimvoid
197167802SjkimAcpiOsDeleteLock (
198167802Sjkim    ACPI_SPINLOCK           Handle);
199167802Sjkim
200167802SjkimACPI_CPU_FLAGS
201167802SjkimAcpiOsAcquireLock (
202167802Sjkim    ACPI_SPINLOCK           Handle);
203167802Sjkim
204167802Sjkimvoid
205167802SjkimAcpiOsReleaseLock (
206167802Sjkim    ACPI_SPINLOCK           Handle,
207167802Sjkim    ACPI_CPU_FLAGS          Flags);
208167802Sjkim
209167802Sjkim
210167802Sjkim/*
211167802Sjkim * Semaphore primitives
212167802Sjkim */
213167802SjkimACPI_STATUS
21467754SmsmithAcpiOsCreateSemaphore (
21567754Smsmith    UINT32                  MaxUnits,
21667754Smsmith    UINT32                  InitialUnits,
217167802Sjkim    ACPI_SEMAPHORE          *OutHandle);
21867754Smsmith
21967754SmsmithACPI_STATUS
22067754SmsmithAcpiOsDeleteSemaphore (
221167802Sjkim    ACPI_SEMAPHORE          Handle);
22267754Smsmith
22367754SmsmithACPI_STATUS
22467754SmsmithAcpiOsWaitSemaphore (
225167802Sjkim    ACPI_SEMAPHORE          Handle,
22667754Smsmith    UINT32                  Units,
227107325Siwasaki    UINT16                  Timeout);
22867754Smsmith
22967754SmsmithACPI_STATUS
23067754SmsmithAcpiOsSignalSemaphore (
231167802Sjkim    ACPI_SEMAPHORE          Handle,
23267754Smsmith    UINT32                  Units);
23367754Smsmith
234167802Sjkim
235167802Sjkim/*
236193267Sjkim * Mutex primitives. May be configured to use semaphores instead via
237193267Sjkim * ACPI_MUTEX_TYPE (see platform/acenv.h)
238167802Sjkim */
239193267Sjkim#if (ACPI_MUTEX_TYPE != ACPI_BINARY_SEMAPHORE)
240193267Sjkim
241117521SnjlACPI_STATUS
242167802SjkimAcpiOsCreateMutex (
243167802Sjkim    ACPI_MUTEX              *OutHandle);
24477424Smsmith
245117521Snjlvoid
246167802SjkimAcpiOsDeleteMutex (
247167802Sjkim    ACPI_MUTEX              Handle);
248117521Snjl
249167802SjkimACPI_STATUS
250167802SjkimAcpiOsAcquireMutex (
251167802Sjkim    ACPI_MUTEX              Handle,
252167802Sjkim    UINT16                  Timeout);
253117521Snjl
254117521Snjlvoid
255167802SjkimAcpiOsReleaseMutex (
256167802Sjkim    ACPI_MUTEX              Handle);
257193267Sjkim#endif
258117521Snjl
259117521Snjl
26067754Smsmith/*
26167754Smsmith * Memory allocation and mapping
26267754Smsmith */
26367754Smsmithvoid *
26467754SmsmithAcpiOsAllocate (
26591116Smsmith    ACPI_SIZE               Size);
26667754Smsmith
26767754Smsmithvoid
26867754SmsmithAcpiOsFree (
26967754Smsmith    void *                  Memory);
27067754Smsmith
271167802Sjkimvoid *
27267754SmsmithAcpiOsMapMemory (
273167802Sjkim    ACPI_PHYSICAL_ADDRESS   Where,
274193267Sjkim    ACPI_SIZE               Length);
27567754Smsmith
27667754Smsmithvoid
27767754SmsmithAcpiOsUnmapMemory (
27867754Smsmith    void                    *LogicalAddress,
27991116Smsmith    ACPI_SIZE               Size);
28067754Smsmith
28171867SmsmithACPI_STATUS
28271867SmsmithAcpiOsGetPhysicalAddress (
28371867Smsmith    void                    *LogicalAddress,
28471867Smsmith    ACPI_PHYSICAL_ADDRESS   *PhysicalAddress);
28567754Smsmith
28677424Smsmith
28767754Smsmith/*
288151937Sjkim * Memory/Object Cache
28967754Smsmith */
290151937SjkimACPI_STATUS
291151937SjkimAcpiOsCreateCache (
292151937Sjkim    char                    *CacheName,
293151937Sjkim    UINT16                  ObjectSize,
294151937Sjkim    UINT16                  MaxDepth,
295151937Sjkim    ACPI_CACHE_T            **ReturnCache);
29667754Smsmith
29767754SmsmithACPI_STATUS
298151937SjkimAcpiOsDeleteCache (
299151937Sjkim    ACPI_CACHE_T            *Cache);
300151937Sjkim
301151937SjkimACPI_STATUS
302151937SjkimAcpiOsPurgeCache (
303151937Sjkim    ACPI_CACHE_T            *Cache);
304151937Sjkim
305151937Sjkimvoid *
306151937SjkimAcpiOsAcquireObject (
307151937Sjkim    ACPI_CACHE_T            *Cache);
308151937Sjkim
309151937SjkimACPI_STATUS
310151937SjkimAcpiOsReleaseObject (
311151937Sjkim    ACPI_CACHE_T            *Cache,
312151937Sjkim    void                    *Object);
313151937Sjkim
314151937Sjkim
315151937Sjkim/*
316151937Sjkim * Interrupt handlers
317151937Sjkim */
318151937SjkimACPI_STATUS
31967754SmsmithAcpiOsInstallInterruptHandler (
32067754Smsmith    UINT32                  InterruptNumber,
321138287Smarks    ACPI_OSD_HANDLER        ServiceRoutine,
32267754Smsmith    void                    *Context);
32367754Smsmith
32467754SmsmithACPI_STATUS
32567754SmsmithAcpiOsRemoveInterruptHandler (
32667754Smsmith    UINT32                  InterruptNumber,
327138287Smarks    ACPI_OSD_HANDLER        ServiceRoutine);
32867754Smsmith
32967754Smsmith
33067754Smsmith/*
33177424Smsmith * Threads and Scheduling
33267754Smsmith */
333167802SjkimACPI_THREAD_ID
33477424SmsmithAcpiOsGetThreadId (
33577424Smsmith    void);
33677424Smsmith
33767754SmsmithACPI_STATUS
338167802SjkimAcpiOsExecute (
339167802Sjkim    ACPI_EXECUTE_TYPE       Type,
340138287Smarks    ACPI_OSD_EXEC_CALLBACK  Function,
34167754Smsmith    void                    *Context);
34267754Smsmith
34367754Smsmithvoid
344138287SmarksAcpiOsWaitEventsComplete (
345138287Smarks    void                    *Context);
346138287Smarks
347138287Smarksvoid
34867754SmsmithAcpiOsSleep (
349138287Smarks    ACPI_INTEGER            Milliseconds);
35067754Smsmith
35167754Smsmithvoid
35280062SmsmithAcpiOsStall (
35367754Smsmith    UINT32                  Microseconds);
35467754Smsmith
35577424Smsmith
35667754Smsmith/*
35780062Smsmith * Platform and hardware-independent I/O interfaces
35867754Smsmith */
35980062SmsmithACPI_STATUS
36080062SmsmithAcpiOsReadPort (
36180062Smsmith    ACPI_IO_ADDRESS         Address,
362117521Snjl    UINT32                  *Value,
36380062Smsmith    UINT32                  Width);
36467754Smsmith
36580062SmsmithACPI_STATUS
36680062SmsmithAcpiOsWritePort (
36780062Smsmith    ACPI_IO_ADDRESS         Address,
368117521Snjl    UINT32                  Value,
36980062Smsmith    UINT32                  Width);
37067754Smsmith
37167754Smsmith
37267754Smsmith/*
37380062Smsmith * Platform and hardware-independent physical memory interfaces
37467754Smsmith */
37580062SmsmithACPI_STATUS
37680062SmsmithAcpiOsReadMemory (
37780062Smsmith    ACPI_PHYSICAL_ADDRESS   Address,
378117521Snjl    UINT32                  *Value,
37980062Smsmith    UINT32                  Width);
38067754Smsmith
38180062SmsmithACPI_STATUS
38280062SmsmithAcpiOsWriteMemory (
38380062Smsmith    ACPI_PHYSICAL_ADDRESS   Address,
384117521Snjl    UINT32                  Value,
38580062Smsmith    UINT32                  Width);
38667754Smsmith
38767754Smsmith
38867754Smsmith/*
38980062Smsmith * Platform and hardware-independent PCI configuration space access
390138287Smarks * Note: Can't use "Register" as a parameter, changed to "Reg" --
391138287Smarks * certain compilers complain.
39267754Smsmith */
39367754SmsmithACPI_STATUS
39480062SmsmithAcpiOsReadPciConfiguration (
39580062Smsmith    ACPI_PCI_ID             *PciId,
396138287Smarks    UINT32                  Reg,
39780062Smsmith    void                    *Value,
39880062Smsmith    UINT32                  Width);
39967754Smsmith
40067754SmsmithACPI_STATUS
40180062SmsmithAcpiOsWritePciConfiguration (
40280062Smsmith    ACPI_PCI_ID             *PciId,
403138287Smarks    UINT32                  Reg,
40487031Smsmith    ACPI_INTEGER            Value,
40580062Smsmith    UINT32                  Width);
40667754Smsmith
407167802Sjkim
408114237Snjl/*
409114237Snjl * Interim function needed for PCI IRQ routing
410114237Snjl */
411114237Snjlvoid
412114237SnjlAcpiOsDerivePciId(
413138287Smarks    ACPI_HANDLE             Rhandle,
414138287Smarks    ACPI_HANDLE             Chandle,
415114237Snjl    ACPI_PCI_ID             **PciId);
41667754Smsmith
417167802Sjkim
41867754Smsmith/*
41967754Smsmith * Miscellaneous
42067754Smsmith */
421167802SjkimACPI_STATUS
422167802SjkimAcpiOsValidateInterface (
423167802Sjkim    char                    *Interface);
424167802Sjkim
42567754SmsmithBOOLEAN
42667754SmsmithAcpiOsReadable (
42767754Smsmith    void                    *Pointer,
428117521Snjl    ACPI_SIZE               Length);
42967754Smsmith
43067754SmsmithBOOLEAN
43167754SmsmithAcpiOsWritable (
43267754Smsmith    void                    *Pointer,
433117521Snjl    ACPI_SIZE               Length);
43467754Smsmith
435138287SmarksUINT64
43678986SmsmithAcpiOsGetTimer (
43778986Smsmith    void);
43867754Smsmith
43980062SmsmithACPI_STATUS
44080062SmsmithAcpiOsSignal (
44180062Smsmith    UINT32                  Function,
44280062Smsmith    void                    *Info);
44378986Smsmith
444167802Sjkim
44567754Smsmith/*
44667754Smsmith * Debug print routines
44767754Smsmith */
44892388Smsmithvoid ACPI_INTERNAL_VAR_XFACE
44967754SmsmithAcpiOsPrintf (
450114237Snjl    const char              *Format,
45167754Smsmith    ...);
45267754Smsmith
45391116Smsmithvoid
45467754SmsmithAcpiOsVprintf (
455114237Snjl    const char              *Format,
45667754Smsmith    va_list                 Args);
45767754Smsmith
458100966Siwasakivoid
459100966SiwasakiAcpiOsRedirectOutput (
460100966Siwasaki    void                    *Destination);
46177424Smsmith
462100966Siwasaki
46367754Smsmith/*
46467754Smsmith * Debug input
46567754Smsmith */
46667754SmsmithUINT32
46767754SmsmithAcpiOsGetLine (
468114237Snjl    char                    *Buffer);
46967754Smsmith
47067754Smsmith
47167754Smsmith/*
472114237Snjl * Directory manipulation
473114237Snjl */
474114237Snjlvoid *
475114237SnjlAcpiOsOpenDirectory (
476114237Snjl    char                    *Pathname,
477114237Snjl    char                    *WildcardSpec,
478114237Snjl    char                    RequestedFileType);
479114237Snjl
480114237Snjl/* RequesteFileType values */
481114237Snjl
482114237Snjl#define REQUEST_FILE_ONLY                   0
483114237Snjl#define REQUEST_DIR_ONLY                    1
484114237Snjl
485114237Snjl
486114237Snjlchar *
487114237SnjlAcpiOsGetNextFilename (
488114237Snjl    void                    *DirHandle);
489114237Snjl
490114237Snjlvoid
491114237SnjlAcpiOsCloseDirectory (
492114237Snjl    void                    *DirHandle);
493114237Snjl
49467754Smsmith
49577424Smsmith#endif /* __ACPIOSXF_H__ */
496