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