acpiosxf.h revision 67754
11573Srgrimes
21573Srgrimes/******************************************************************************
31573Srgrimes *
41573Srgrimes * Name: acpiosd.h - All interfaces to the OS-dependent layer.  These
51573Srgrimes *                   interfaces must be implemented by the OS-dependent
61573Srgrimes *                   front-end to the ACPI subsystem.
71573Srgrimes *
81573Srgrimes *****************************************************************************/
91573Srgrimes
101573Srgrimes
111573Srgrimes/******************************************************************************
121573Srgrimes *
131573Srgrimes * 1. Copyright Notice
141573Srgrimes *
151573Srgrimes * Some or all of this work - Copyright (c) 1999, Intel Corp.  All rights
16249808Semaste * reserved.
171573Srgrimes *
181573Srgrimes * 2. License
191573Srgrimes *
201573Srgrimes * 2.1. This is your license from Intel Corp. under its intellectual property
211573Srgrimes * rights.  You may have additional license terms from the party that provided
221573Srgrimes * you this software, covering your right to use that party's intellectual
231573Srgrimes * property rights.
241573Srgrimes *
251573Srgrimes * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
261573Srgrimes * copy of the source code appearing in this file ("Covered Code") an
271573Srgrimes * irrevocable, perpetual, worldwide license under Intel's copyrights in the
281573Srgrimes * base code distributed originally by Intel ("Original Intel Code") to copy,
291573Srgrimes * make derivatives, distribute, use and display any portion of the Covered
301573Srgrimes * Code in any form, with the right to sublicense such rights; and
311573Srgrimes *
321573Srgrimes * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
331573Srgrimes * license (with the right to sublicense), under only those claims of Intel
341573Srgrimes * patents that are infringed by the Original Intel Code, to make, use, sell,
351573Srgrimes * offer to sell, and import the Covered Code and derivative works thereof
3692986Sobrien * solely to the minimum extent necessary to exercise the above copyright
3792986Sobrien * license, and in no event shall the patent license extend to any additions
381573Srgrimes * to or modifications of the Original Intel Code.  No other license or right
3971579Sdeischen * is granted directly or by implication, estoppel or otherwise;
401573Srgrimes *
411573Srgrimes * The above copyright and patent license is granted only if the following
4271579Sdeischen * conditions are met:
431573Srgrimes *
4435129Sjb * 3. Conditions
45126800Stjr *
461573Srgrimes * 3.1. Redistribution of Source with Rights to Further Distribute Source.
471573Srgrimes * Redistribution of source code of any substantial portion of the Covered
481573Srgrimes * Code or modification with rights to further distribute source must include
491573Srgrimes * the above Copyright Notice, the above License, this list of Conditions,
5013545Sjulian * and the following Disclaimer and Export Compliance provision.  In addition,
51249810Semaste * Licensee must cause all Covered Code to which Licensee contributes to
521573Srgrimes * contain a file documenting the changes Licensee made to create that Covered
5313545Sjulian * Code and the date of any change.  Licensee must include in that file the
54268985Spfg * documentation of any changes made by any predecessor Licensee.  Licensee
551573Srgrimes * must include a prominent statement that the modification is derived,
561573Srgrimes * directly or indirectly, from Original Intel Code.
571573Srgrimes *
581573Srgrimes * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
59268985Spfg * Redistribution of source code of any substantial portion of the Covered
601573Srgrimes * Code or modification without rights to further distribute source must
611573Srgrimes * include the following Disclaimer and Export Compliance provision in the
621573Srgrimes * documentation and/or other materials provided with distribution.  In
631573Srgrimes * addition, Licensee may not authorize further sublicense of source of any
641573Srgrimes * portion of the Covered Code, and must include terms to the effect that the
65320942Skib * license from Licensee to its licensee is limited to the intellectual
66126800Stjr * property embodied in the software Licensee provides to its licensee, and
6713545Sjulian * not to intellectual property embodied in modifications its licensee may
68320942Skib * make.
6913545Sjulian *
701573Srgrimes * 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 __ACPIOSD_H__
121#define __ACPIOSD_H__
122
123#include "acenv.h"
124#include "actypes.h"
125
126
127/* Priorities for AcpiOsQueueForExecution */
128
129#define OSD_PRIORITY_HIGH   1
130#define OSD_PRIORITY_MED    2
131#define OSD_PRIORITY_LO     3
132#define OSD_PRIORITY_GPE    OSD_PRIORITY_HIGH
133
134#define ACPI_NO_UNIT_LIMIT  ((UINT32) -1)
135#define ACPI_MUTEX_SEM      1
136
137
138/*
139 * Types specific to the OS-dependent layer interfaces
140 */
141
142typedef
143UINT32 (*OSD_HANDLER) (
144    void                    *Context);
145
146typedef
147void (*OSD_EXECUTION_CALLBACK) (
148    void                    *Context);
149
150
151/*
152 * Initialization and shutdown primitives  (Optional)
153 */
154
155ACPI_STATUS
156AcpiOsInitialize (
157    void);
158
159ACPI_STATUS
160AcpiOsTerminate (
161    void);
162
163/*
164 * Synchronization primitives
165 */
166
167ACPI_STATUS
168AcpiOsCreateSemaphore (
169    UINT32                  MaxUnits,
170    UINT32                  InitialUnits,
171    ACPI_HANDLE             *OutHandle);
172
173ACPI_STATUS
174AcpiOsDeleteSemaphore (
175    ACPI_HANDLE             Handle);
176
177ACPI_STATUS
178AcpiOsWaitSemaphore (
179    ACPI_HANDLE             Handle,
180    UINT32                  Units,
181    UINT32                  Timeout);
182
183ACPI_STATUS
184AcpiOsSignalSemaphore (
185    ACPI_HANDLE             Handle,
186    UINT32                  Units);
187
188/*
189 * Memory allocation and mapping
190 */
191
192void *
193AcpiOsAllocate (
194    UINT32                  Size);
195
196void *
197AcpiOsCallocate (
198    UINT32                  Size);
199
200void
201AcpiOsFree (
202    void *                  Memory);
203
204ACPI_STATUS
205AcpiOsMapMemory (
206    void                    *PhysicalAddress,
207    UINT32                  Length,
208    void                    **LogicalAddress);
209
210void
211AcpiOsUnmapMemory (
212    void                    *LogicalAddress,
213    UINT32                  Length);
214
215
216/*
217 * Interrupt handlers
218 */
219
220ACPI_STATUS
221AcpiOsInstallInterruptHandler (
222    UINT32                  InterruptNumber,
223    OSD_HANDLER             ServiceRoutine,
224    void                    *Context);
225
226ACPI_STATUS
227AcpiOsRemoveInterruptHandler (
228    UINT32                  InterruptNumber,
229    OSD_HANDLER             ServiceRoutine);
230
231
232/*
233 * Scheduling
234 */
235
236ACPI_STATUS
237AcpiOsQueueForExecution (
238    UINT32                  Priority,
239    OSD_EXECUTION_CALLBACK  Function,
240    void                    *Context);
241
242void
243AcpiOsSleep (
244    UINT32                  Seconds,
245    UINT32                  Milliseconds);
246
247void
248AcpiOsSleepUsec (
249    UINT32                  Microseconds);
250
251/*
252 * Platform/Hardware independent I/O interfaces
253 */
254
255UINT8
256AcpiOsIn8 (
257    ACPI_IO_ADDRESS         InPort);
258
259
260UINT16
261AcpiOsIn16 (
262    ACPI_IO_ADDRESS         InPort);
263
264UINT32
265AcpiOsIn32 (
266    ACPI_IO_ADDRESS         InPort);
267
268void
269AcpiOsOut8 (
270    ACPI_IO_ADDRESS         OutPort,
271    UINT8                   Value);
272
273void
274AcpiOsOut16 (
275    ACPI_IO_ADDRESS         OutPort,
276    UINT16                  Value);
277
278void
279AcpiOsOut32 (
280    ACPI_IO_ADDRESS         OutPort,
281    UINT32                  Value);
282
283/*
284 * Platform/Hardware independent physical memory interfaces
285 */
286
287UINT8
288AcpiOsMemIn8 (
289    ACPI_MEM_ADDRESS         InAddr);
290
291
292UINT16
293AcpiOsMemIn16 (
294    ACPI_MEM_ADDRESS         InAddr);
295
296UINT32
297AcpiOsMemIn32 (
298    ACPI_MEM_ADDRESS         InAddr);
299
300void
301AcpiOsMemOut8 (
302    ACPI_MEM_ADDRESS        OutAddr,
303    UINT8                   Value);
304
305void
306AcpiOsMemOut16 (
307    ACPI_MEM_ADDRESS        OutAddr,
308    UINT16                  Value);
309
310void
311AcpiOsMemOut32 (
312    ACPI_MEM_ADDRESS        OutAddr,
313    UINT32                  Value);
314
315
316/*
317 * Standard access to PCI configuration space
318 */
319
320ACPI_STATUS
321AcpiOsReadPciCfgByte (
322    UINT32                  Bus,
323    UINT32                  DeviceFunction,
324    UINT32                  Register,
325    UINT8                   *Value);
326
327ACPI_STATUS
328AcpiOsReadPciCfgWord (
329    UINT32                  Bus,
330    UINT32                  DeviceFunction,
331    UINT32                  Register,
332    UINT16                  *Value);
333
334ACPI_STATUS
335AcpiOsReadPciCfgDword (
336    UINT32                  Bus,
337    UINT32                  DeviceFunction,
338    UINT32                  Register,
339    UINT32                  *Value);
340
341ACPI_STATUS
342AcpiOsWritePciCfgByte (
343    UINT32                  Bus,
344    UINT32                  DeviceFunction,
345    UINT32                  Register,
346    UINT8                   Value);
347
348ACPI_STATUS
349AcpiOsWritePciCfgWord (
350    UINT32                  Bus,
351    UINT32                  DeviceFunction,
352    UINT32                  Register,
353    UINT16                  Value);
354
355
356ACPI_STATUS
357AcpiOsWritePciCfgDword (
358    UINT32                  Bus,
359    UINT32                  DeviceFunction,
360    UINT32                  Register,
361    UINT32                  Value);
362
363
364/*
365 * Miscellaneous
366 */
367
368ACPI_STATUS
369AcpiOsBreakpoint (
370    NATIVE_CHAR             *Message);
371
372BOOLEAN
373AcpiOsReadable (
374    void                    *Pointer,
375    UINT32                  Length);
376
377
378BOOLEAN
379AcpiOsWritable (
380    void                    *Pointer,
381    UINT32                  Length);
382
383
384/*
385 * Debug print routines
386 */
387
388INT32
389AcpiOsPrintf (
390    const NATIVE_CHAR       *Format,
391    ...);
392
393INT32
394AcpiOsVprintf (
395    const NATIVE_CHAR       *Format,
396    va_list                 Args);
397
398/*
399 * Debug input
400 */
401
402UINT32
403AcpiOsGetLine (
404    NATIVE_CHAR             *Buffer);
405
406
407/*
408 * Debug
409 */
410
411void
412AcpiOsDbgAssert(
413    void                    *FailedAssertion,
414    void                    *FileName,
415    UINT32                  LineNumber,
416    NATIVE_CHAR             *Message);
417
418
419#endif /* __ACPIOSD_H__ */
420