xref: /titanic_41/usr/src/uts/intel/sys/acpi/acpiosxf.h (revision 74e20cfe817b82802b16fac8690dadcda76f54f5)
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 - 2006, 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 /* Types for AcpiOsExecute */
129 
130 typedef enum
131 {
132     OSL_GLOBAL_LOCK_HANDLER,
133     OSL_NOTIFY_HANDLER,
134     OSL_GPE_HANDLER,
135     OSL_DEBUGGER_THREAD,
136     OSL_EC_POLL_HANDLER,
137     OSL_EC_BURST_HANDLER
138 
139 } ACPI_EXECUTE_TYPE;
140 
141 #define ACPI_NO_UNIT_LIMIT          ((UINT32) -1)
142 #define ACPI_MUTEX_SEM              1
143 
144 
145 /* Functions for AcpiOsSignal */
146 
147 #define ACPI_SIGNAL_FATAL           0
148 #define ACPI_SIGNAL_BREAKPOINT      1
149 
150 typedef struct acpi_signal_fatal_info
151 {
152     UINT32                  Type;
153     UINT32                  Code;
154     UINT32                  Argument;
155 
156 } ACPI_SIGNAL_FATAL_INFO;
157 
158 
159 /*
160  * OSL Initialization and shutdown primitives
161  */
162 ACPI_STATUS
163 AcpiOsInitialize (
164     void);
165 
166 ACPI_STATUS
167 AcpiOsTerminate (
168     void);
169 
170 
171 /*
172  * ACPI Table interfaces
173  */
174 ACPI_STATUS
175 AcpiOsGetRootPointer (
176     UINT32                  Flags,
177     ACPI_POINTER            *Address);
178 
179 ACPI_STATUS
180 AcpiOsPredefinedOverride (
181     const ACPI_PREDEFINED_NAMES *InitVal,
182     ACPI_STRING                 *NewVal);
183 
184 ACPI_STATUS
185 AcpiOsTableOverride (
186     ACPI_TABLE_HEADER       *ExistingTable,
187     ACPI_TABLE_HEADER       **NewTable);
188 
189 
190 /*
191  * Spinlock primitives
192  */
193 ACPI_STATUS
194 AcpiOsCreateLock (
195     ACPI_SPINLOCK           *OutHandle);
196 
197 void
198 AcpiOsDeleteLock (
199     ACPI_SPINLOCK           Handle);
200 
201 ACPI_CPU_FLAGS
202 AcpiOsAcquireLock (
203     ACPI_SPINLOCK           Handle);
204 
205 void
206 AcpiOsReleaseLock (
207     ACPI_SPINLOCK           Handle,
208     ACPI_CPU_FLAGS          Flags);
209 
210 
211 /*
212  * Semaphore primitives
213  */
214 ACPI_STATUS
215 AcpiOsCreateSemaphore (
216     UINT32                  MaxUnits,
217     UINT32                  InitialUnits,
218     ACPI_SEMAPHORE          *OutHandle);
219 
220 ACPI_STATUS
221 AcpiOsDeleteSemaphore (
222     ACPI_SEMAPHORE          Handle);
223 
224 ACPI_STATUS
225 AcpiOsWaitSemaphore (
226     ACPI_SEMAPHORE          Handle,
227     UINT32                  Units,
228     UINT16                  Timeout);
229 
230 ACPI_STATUS
231 AcpiOsSignalSemaphore (
232     ACPI_SEMAPHORE          Handle,
233     UINT32                  Units);
234 
235 
236 /*
237  * Mutex primitives
238  */
239 ACPI_STATUS
240 AcpiOsCreateMutex (
241     ACPI_MUTEX              *OutHandle);
242 
243 void
244 AcpiOsDeleteMutex (
245     ACPI_MUTEX              Handle);
246 
247 ACPI_STATUS
248 AcpiOsAcquireMutex (
249     ACPI_MUTEX              Handle,
250     UINT16                  Timeout);
251 
252 void
253 AcpiOsReleaseMutex (
254     ACPI_MUTEX              Handle);
255 
256 /* Temporary macros for Mutex* interfaces, map to existing semaphore xfaces */
257 
258 #define AcpiOsCreateMutex(OutHandle)        AcpiOsCreateSemaphore (1, 1, OutHandle)
259 #define AcpiOsDeleteMutex(Handle)           (void) AcpiOsDeleteSemaphore (Handle)
260 #define AcpiOsAcquireMutex(Handle,Time)     AcpiOsWaitSemaphore (Handle, 1, Time)
261 #define AcpiOsReleaseMutex(Handle)          (void) AcpiOsSignalSemaphore (Handle, 1)
262 
263 
264 /*
265  * Memory allocation and mapping
266  */
267 void *
268 AcpiOsAllocate (
269     ACPI_SIZE               Size);
270 
271 void
272 AcpiOsFree (
273     void *                  Memory);
274 
275 ACPI_STATUS
276 AcpiOsMapMemory (
277     ACPI_PHYSICAL_ADDRESS   PhysicalAddress,
278     ACPI_SIZE               Size,
279     void                    **LogicalAddress);
280 
281 void
282 AcpiOsUnmapMemory (
283     void                    *LogicalAddress,
284     ACPI_SIZE               Size);
285 
286 ACPI_STATUS
287 AcpiOsGetPhysicalAddress (
288     void                    *LogicalAddress,
289     ACPI_PHYSICAL_ADDRESS   *PhysicalAddress);
290 
291 
292 /*
293  * Memory/Object Cache
294  */
295 ACPI_STATUS
296 AcpiOsCreateCache (
297     char                    *CacheName,
298     UINT16                  ObjectSize,
299     UINT16                  MaxDepth,
300     ACPI_CACHE_T            **ReturnCache);
301 
302 ACPI_STATUS
303 AcpiOsDeleteCache (
304     ACPI_CACHE_T            *Cache);
305 
306 ACPI_STATUS
307 AcpiOsPurgeCache (
308     ACPI_CACHE_T            *Cache);
309 
310 void *
311 AcpiOsAcquireObject (
312     ACPI_CACHE_T            *Cache);
313 
314 ACPI_STATUS
315 AcpiOsReleaseObject (
316     ACPI_CACHE_T            *Cache,
317     void                    *Object);
318 
319 
320 /*
321  * Interrupt handlers
322  */
323 ACPI_STATUS
324 AcpiOsInstallInterruptHandler (
325     UINT32                  InterruptNumber,
326     ACPI_OSD_HANDLER        ServiceRoutine,
327     void                    *Context);
328 
329 ACPI_STATUS
330 AcpiOsRemoveInterruptHandler (
331     UINT32                  InterruptNumber,
332     ACPI_OSD_HANDLER        ServiceRoutine);
333 
334 
335 /*
336  * Threads and Scheduling
337  */
338 ACPI_THREAD_ID
339 AcpiOsGetThreadId (
340     void);
341 
342 ACPI_STATUS
343 AcpiOsExecute (
344     ACPI_EXECUTE_TYPE       Type,
345     ACPI_OSD_EXEC_CALLBACK  Function,
346     void                    *Context);
347 
348 void
349 AcpiOsWaitEventsComplete (
350     void                    *Context);
351 
352 void
353 AcpiOsSleep (
354     ACPI_INTEGER            Milliseconds);
355 
356 void
357 AcpiOsStall (
358     UINT32                  Microseconds);
359 
360 
361 /*
362  * Platform and hardware-independent I/O interfaces
363  */
364 ACPI_STATUS
365 AcpiOsReadPort (
366     ACPI_IO_ADDRESS         Address,
367     UINT32                  *Value,
368     UINT32                  Width);
369 
370 ACPI_STATUS
371 AcpiOsWritePort (
372     ACPI_IO_ADDRESS         Address,
373     UINT32                  Value,
374     UINT32                  Width);
375 
376 
377 /*
378  * Platform and hardware-independent physical memory interfaces
379  */
380 ACPI_STATUS
381 AcpiOsReadMemory (
382     ACPI_PHYSICAL_ADDRESS   Address,
383     UINT32                  *Value,
384     UINT32                  Width);
385 
386 ACPI_STATUS
387 AcpiOsWriteMemory (
388     ACPI_PHYSICAL_ADDRESS   Address,
389     UINT32                  Value,
390     UINT32                  Width);
391 
392 
393 /*
394  * Platform and hardware-independent PCI configuration space access
395  * Note: Can't use "Register" as a parameter, changed to "Reg" --
396  * certain compilers complain.
397  */
398 ACPI_STATUS
399 AcpiOsReadPciConfiguration (
400     ACPI_PCI_ID             *PciId,
401     UINT32                  Reg,
402     void                    *Value,
403     UINT32                  Width);
404 
405 ACPI_STATUS
406 AcpiOsWritePciConfiguration (
407     ACPI_PCI_ID             *PciId,
408     UINT32                  Reg,
409     ACPI_INTEGER            Value,
410     UINT32                  Width);
411 
412 
413 /*
414  * Interim function needed for PCI IRQ routing
415  */
416 void
417 AcpiOsDerivePciId(
418     ACPI_HANDLE             Rhandle,
419     ACPI_HANDLE             Chandle,
420     ACPI_PCI_ID             **PciId);
421 
422 
423 /*
424  * Miscellaneous
425  */
426 ACPI_STATUS
427 AcpiOsValidateInterface (
428     char                    *Interface);
429 
430 ACPI_STATUS
431 AcpiOsValidateAddress (
432     UINT8                   SpaceId,
433     ACPI_PHYSICAL_ADDRESS   Address,
434     ACPI_SIZE               Length);
435 
436 BOOLEAN
437 AcpiOsReadable (
438     void                    *Pointer,
439     ACPI_SIZE               Length);
440 
441 BOOLEAN
442 AcpiOsWritable (
443     void                    *Pointer,
444     ACPI_SIZE               Length);
445 
446 UINT64
447 AcpiOsGetTimer (
448     void);
449 
450 ACPI_STATUS
451 AcpiOsSignal (
452     UINT32                  Function,
453     void                    *Info);
454 
455 
456 /*
457  * Debug print routines
458  */
459 void ACPI_INTERNAL_VAR_XFACE
460 AcpiOsPrintf (
461     const char              *Format,
462     ...);
463 
464 void
465 AcpiOsVprintf (
466     const char              *Format,
467     va_list                 Args);
468 
469 void
470 AcpiOsRedirectOutput (
471     void                    *Destination);
472 
473 
474 /*
475  * Debug input
476  */
477 UINT32
478 AcpiOsGetLine (
479     char                    *Buffer);
480 
481 
482 /*
483  * Directory manipulation
484  */
485 void *
486 AcpiOsOpenDirectory (
487     char                    *Pathname,
488     char                    *WildcardSpec,
489     char                    RequestedFileType);
490 
491 /* RequesteFileType values */
492 
493 #define REQUEST_FILE_ONLY                   0
494 #define REQUEST_DIR_ONLY                    1
495 
496 
497 char *
498 AcpiOsGetNextFilename (
499     void                    *DirHandle);
500 
501 void
502 AcpiOsCloseDirectory (
503     void                    *DirHandle);
504 
505 
506 #endif /* __ACPIOSXF_H__ */
507