[ACPICA]
[reactos.git] / reactos / drivers / bus / acpi / acpica / include / acpiosxf.h
1 /******************************************************************************
2 *
3 * Name: acpiosxf.h - All interfaces to the OS Services Layer (OSL). These
4 * interfaces must be implemented by OSL to interface the
5 * ACPI components to the host operating system.
6 *
7 *****************************************************************************/
8
9 /******************************************************************************
10 *
11 * 1. Copyright Notice
12 *
13 * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp.
14 * All rights reserved.
15 *
16 * 2. License
17 *
18 * 2.1. This is your license from Intel Corp. under its intellectual property
19 * rights. You may have additional license terms from the party that provided
20 * you this software, covering your right to use that party's intellectual
21 * property rights.
22 *
23 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
24 * copy of the source code appearing in this file ("Covered Code") an
25 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
26 * base code distributed originally by Intel ("Original Intel Code") to copy,
27 * make derivatives, distribute, use and display any portion of the Covered
28 * Code in any form, with the right to sublicense such rights; and
29 *
30 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
31 * license (with the right to sublicense), under only those claims of Intel
32 * patents that are infringed by the Original Intel Code, to make, use, sell,
33 * offer to sell, and import the Covered Code and derivative works thereof
34 * solely to the minimum extent necessary to exercise the above copyright
35 * license, and in no event shall the patent license extend to any additions
36 * to or modifications of the Original Intel Code. No other license or right
37 * is granted directly or by implication, estoppel or otherwise;
38 *
39 * The above copyright and patent license is granted only if the following
40 * conditions are met:
41 *
42 * 3. Conditions
43 *
44 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
45 * Redistribution of source code of any substantial portion of the Covered
46 * Code or modification with rights to further distribute source must include
47 * the above Copyright Notice, the above License, this list of Conditions,
48 * and the following Disclaimer and Export Compliance provision. In addition,
49 * Licensee must cause all Covered Code to which Licensee contributes to
50 * contain a file documenting the changes Licensee made to create that Covered
51 * Code and the date of any change. Licensee must include in that file the
52 * documentation of any changes made by any predecessor Licensee. Licensee
53 * must include a prominent statement that the modification is derived,
54 * directly or indirectly, from Original Intel Code.
55 *
56 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
57 * Redistribution of source code of any substantial portion of the Covered
58 * Code or modification without rights to further distribute source must
59 * include the following Disclaimer and Export Compliance provision in the
60 * documentation and/or other materials provided with distribution. In
61 * addition, Licensee may not authorize further sublicense of source of any
62 * portion of the Covered Code, and must include terms to the effect that the
63 * license from Licensee to its licensee is limited to the intellectual
64 * property embodied in the software Licensee provides to its licensee, and
65 * not to intellectual property embodied in modifications its licensee may
66 * make.
67 *
68 * 3.3. Redistribution of Executable. Redistribution in executable form of any
69 * substantial portion of the Covered Code or modification must reproduce the
70 * above Copyright Notice, and the following Disclaimer and Export Compliance
71 * provision in the documentation and/or other materials provided with the
72 * distribution.
73 *
74 * 3.4. Intel retains all right, title, and interest in and to the Original
75 * Intel Code.
76 *
77 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
78 * Intel shall be used in advertising or otherwise to promote the sale, use or
79 * other dealings in products derived from or relating to the Covered Code
80 * without prior written authorization from Intel.
81 *
82 * 4. Disclaimer and Export Compliance
83 *
84 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
85 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
86 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
87 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
88 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
89 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90 * PARTICULAR PURPOSE.
91 *
92 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
93 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
94 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
95 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
96 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
97 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
98 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99 * LIMITED REMEDY.
100 *
101 * 4.3. Licensee shall not export, either directly or indirectly, any of this
102 * software or system incorporating such software without first obtaining any
103 * required license or other approval from the U. S. Department of Commerce or
104 * any other agency or department of the United States Government. In the
105 * event Licensee exports any such software from the United States or
106 * re-exports any such software from a foreign destination, Licensee shall
107 * ensure that the distribution and export/re-export of the software is in
108 * compliance with all laws, regulations, orders, or other restrictions of the
109 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
110 * any of its subsidiaries will export/re-export any technical data, process,
111 * software, or service, directly or indirectly, to any country for which the
112 * United States government or any agency thereof requires an export license,
113 * other governmental approval, or letter of assurance, without first obtaining
114 * such license, approval or letter.
115 *
116 *****************************************************************************/
117
118 #ifndef __ACPIOSXF_H__
119 #define __ACPIOSXF_H__
120
121 #include "platform/acenv.h"
122 #include "actypes.h"
123
124
125 /* Types for AcpiOsExecute */
126
127 typedef enum
128 {
129 OSL_GLOBAL_LOCK_HANDLER,
130 OSL_NOTIFY_HANDLER,
131 OSL_GPE_HANDLER,
132 OSL_DEBUGGER_THREAD,
133 OSL_EC_POLL_HANDLER,
134 OSL_EC_BURST_HANDLER
135
136 } ACPI_EXECUTE_TYPE;
137
138 #define ACPI_NO_UNIT_LIMIT ((UINT32) -1)
139 #define ACPI_MUTEX_SEM 1
140
141
142 /* Functions for AcpiOsSignal */
143
144 #define ACPI_SIGNAL_FATAL 0
145 #define ACPI_SIGNAL_BREAKPOINT 1
146
147 typedef struct acpi_signal_fatal_info
148 {
149 UINT32 Type;
150 UINT32 Code;
151 UINT32 Argument;
152
153 } ACPI_SIGNAL_FATAL_INFO;
154
155
156 /*
157 * OSL Initialization and shutdown primitives
158 */
159 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInitialize
160 ACPI_STATUS
161 AcpiOsInitialize (
162 void);
163 #endif
164
165 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTerminate
166 ACPI_STATUS
167 AcpiOsTerminate (
168 void);
169 #endif
170
171
172 /*
173 * ACPI Table interfaces
174 */
175 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetRootPointer
176 ACPI_PHYSICAL_ADDRESS
177 AcpiOsGetRootPointer (
178 void);
179 #endif
180
181 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPredefinedOverride
182 ACPI_STATUS
183 AcpiOsPredefinedOverride (
184 const ACPI_PREDEFINED_NAMES *InitVal,
185 ACPI_STRING *NewVal);
186 #endif
187
188 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTableOverride
189 ACPI_STATUS
190 AcpiOsTableOverride (
191 ACPI_TABLE_HEADER *ExistingTable,
192 ACPI_TABLE_HEADER **NewTable);
193 #endif
194
195 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPhysicalTableOverride
196 ACPI_STATUS
197 AcpiOsPhysicalTableOverride (
198 ACPI_TABLE_HEADER *ExistingTable,
199 ACPI_PHYSICAL_ADDRESS *NewAddress,
200 UINT32 *NewTableLength);
201 #endif
202
203
204 /*
205 * Spinlock primitives
206 */
207 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateLock
208 ACPI_STATUS
209 AcpiOsCreateLock (
210 ACPI_SPINLOCK *OutHandle);
211 #endif
212
213 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsDeleteLock
214 void
215 AcpiOsDeleteLock (
216 ACPI_SPINLOCK Handle);
217 #endif
218
219 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireLock
220 ACPI_CPU_FLAGS
221 AcpiOsAcquireLock (
222 ACPI_SPINLOCK Handle);
223 #endif
224
225 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReleaseLock
226 void
227 AcpiOsReleaseLock (
228 ACPI_SPINLOCK Handle,
229 ACPI_CPU_FLAGS Flags);
230 #endif
231
232
233 /*
234 * Semaphore primitives
235 */
236 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateSemaphore
237 ACPI_STATUS
238 AcpiOsCreateSemaphore (
239 UINT32 MaxUnits,
240 UINT32 InitialUnits,
241 ACPI_SEMAPHORE *OutHandle);
242 #endif
243
244 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsDeleteSemaphore
245 ACPI_STATUS
246 AcpiOsDeleteSemaphore (
247 ACPI_SEMAPHORE Handle);
248 #endif
249
250 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWaitSemaphore
251 ACPI_STATUS
252 AcpiOsWaitSemaphore (
253 ACPI_SEMAPHORE Handle,
254 UINT32 Units,
255 UINT16 Timeout);
256 #endif
257
258 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsSignalSemaphore
259 ACPI_STATUS
260 AcpiOsSignalSemaphore (
261 ACPI_SEMAPHORE Handle,
262 UINT32 Units);
263 #endif
264
265
266 /*
267 * Mutex primitives. May be configured to use semaphores instead via
268 * ACPI_MUTEX_TYPE (see platform/acenv.h)
269 */
270 #if (ACPI_MUTEX_TYPE != ACPI_BINARY_SEMAPHORE)
271
272 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateMutex
273 ACPI_STATUS
274 AcpiOsCreateMutex (
275 ACPI_MUTEX *OutHandle);
276 #endif
277
278 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsDeleteMutex
279 void
280 AcpiOsDeleteMutex (
281 ACPI_MUTEX Handle);
282 #endif
283
284 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireMutex
285 ACPI_STATUS
286 AcpiOsAcquireMutex (
287 ACPI_MUTEX Handle,
288 UINT16 Timeout);
289 #endif
290
291 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReleaseMutex
292 void
293 AcpiOsReleaseMutex (
294 ACPI_MUTEX Handle);
295 #endif
296
297 #endif
298
299
300 /*
301 * Memory allocation and mapping
302 */
303 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocate
304 void *
305 AcpiOsAllocate (
306 ACPI_SIZE Size);
307 #endif
308
309 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocateZeroed
310 void *
311 AcpiOsAllocateZeroed (
312 ACPI_SIZE Size);
313 #endif
314
315 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsFree
316 void
317 AcpiOsFree (
318 void * Memory);
319 #endif
320
321 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsMapMemory
322 void *
323 AcpiOsMapMemory (
324 ACPI_PHYSICAL_ADDRESS Where,
325 ACPI_SIZE Length);
326 #endif
327
328 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsUnmapMemory
329 void
330 AcpiOsUnmapMemory (
331 void *LogicalAddress,
332 ACPI_SIZE Size);
333 #endif
334
335 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetPhysicalAddress
336 ACPI_STATUS
337 AcpiOsGetPhysicalAddress (
338 void *LogicalAddress,
339 ACPI_PHYSICAL_ADDRESS *PhysicalAddress);
340 #endif
341
342
343 /*
344 * Memory/Object Cache
345 */
346 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateCache
347 ACPI_STATUS
348 AcpiOsCreateCache (
349 char *CacheName,
350 UINT16 ObjectSize,
351 UINT16 MaxDepth,
352 ACPI_CACHE_T **ReturnCache);
353 #endif
354
355 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsDeleteCache
356 ACPI_STATUS
357 AcpiOsDeleteCache (
358 ACPI_CACHE_T *Cache);
359 #endif
360
361 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPurgeCache
362 ACPI_STATUS
363 AcpiOsPurgeCache (
364 ACPI_CACHE_T *Cache);
365 #endif
366
367 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireObject
368 void *
369 AcpiOsAcquireObject (
370 ACPI_CACHE_T *Cache);
371 #endif
372
373 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReleaseObject
374 ACPI_STATUS
375 AcpiOsReleaseObject (
376 ACPI_CACHE_T *Cache,
377 void *Object);
378 #endif
379
380
381 /*
382 * Interrupt handlers
383 */
384 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInstallInterruptHandler
385 ACPI_STATUS
386 AcpiOsInstallInterruptHandler (
387 UINT32 InterruptNumber,
388 ACPI_OSD_HANDLER ServiceRoutine,
389 void *Context);
390 #endif
391
392 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsRemoveInterruptHandler
393 ACPI_STATUS
394 AcpiOsRemoveInterruptHandler (
395 UINT32 InterruptNumber,
396 ACPI_OSD_HANDLER ServiceRoutine);
397 #endif
398
399
400 /*
401 * Threads and Scheduling
402 */
403 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetThreadId
404 ACPI_THREAD_ID
405 AcpiOsGetThreadId (
406 void);
407 #endif
408
409 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsExecute
410 ACPI_STATUS
411 AcpiOsExecute (
412 ACPI_EXECUTE_TYPE Type,
413 ACPI_OSD_EXEC_CALLBACK Function,
414 void *Context);
415 #endif
416
417 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWaitEventsComplete
418 void
419 AcpiOsWaitEventsComplete (
420 void);
421 #endif
422
423 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsSleep
424 void
425 AcpiOsSleep (
426 UINT64 Milliseconds);
427 #endif
428
429 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsStall
430 void
431 AcpiOsStall (
432 UINT32 Microseconds);
433 #endif
434
435
436 /*
437 * Platform and hardware-independent I/O interfaces
438 */
439 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadPort
440 ACPI_STATUS
441 AcpiOsReadPort (
442 ACPI_IO_ADDRESS Address,
443 UINT32 *Value,
444 UINT32 Width);
445 #endif
446
447 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritePort
448 ACPI_STATUS
449 AcpiOsWritePort (
450 ACPI_IO_ADDRESS Address,
451 UINT32 Value,
452 UINT32 Width);
453 #endif
454
455
456 /*
457 * Platform and hardware-independent physical memory interfaces
458 */
459 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadMemory
460 ACPI_STATUS
461 AcpiOsReadMemory (
462 ACPI_PHYSICAL_ADDRESS Address,
463 UINT64 *Value,
464 UINT32 Width);
465 #endif
466
467 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWriteMemory
468 ACPI_STATUS
469 AcpiOsWriteMemory (
470 ACPI_PHYSICAL_ADDRESS Address,
471 UINT64 Value,
472 UINT32 Width);
473 #endif
474
475
476 /*
477 * Platform and hardware-independent PCI configuration space access
478 * Note: Can't use "Register" as a parameter, changed to "Reg" --
479 * certain compilers complain.
480 */
481 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadPciConfiguration
482 ACPI_STATUS
483 AcpiOsReadPciConfiguration (
484 ACPI_PCI_ID *PciId,
485 UINT32 Reg,
486 UINT64 *Value,
487 UINT32 Width);
488 #endif
489
490 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritePciConfiguration
491 ACPI_STATUS
492 AcpiOsWritePciConfiguration (
493 ACPI_PCI_ID *PciId,
494 UINT32 Reg,
495 UINT64 Value,
496 UINT32 Width);
497 #endif
498
499
500 /*
501 * Miscellaneous
502 */
503 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadable
504 BOOLEAN
505 AcpiOsReadable (
506 void *Pointer,
507 ACPI_SIZE Length);
508 #endif
509
510 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritable
511 BOOLEAN
512 AcpiOsWritable (
513 void *Pointer,
514 ACPI_SIZE Length);
515 #endif
516
517 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTimer
518 UINT64
519 AcpiOsGetTimer (
520 void);
521 #endif
522
523 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsSignal
524 ACPI_STATUS
525 AcpiOsSignal (
526 UINT32 Function,
527 void *Info);
528 #endif
529
530
531 /*
532 * Debug print routines
533 */
534 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPrintf
535 void ACPI_INTERNAL_VAR_XFACE
536 AcpiOsPrintf (
537 const char *Format,
538 ...);
539 #endif
540
541 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsVprintf
542 void
543 AcpiOsVprintf (
544 const char *Format,
545 va_list Args);
546 #endif
547
548 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsRedirectOutput
549 void
550 AcpiOsRedirectOutput (
551 void *Destination);
552 #endif
553
554
555 /*
556 * Debug input
557 */
558 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetLine
559 ACPI_STATUS
560 AcpiOsGetLine (
561 char *Buffer,
562 UINT32 BufferLength,
563 UINT32 *BytesRead);
564 #endif
565
566
567 /*
568 * Obtain ACPI table(s)
569 */
570 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByName
571 ACPI_STATUS
572 AcpiOsGetTableByName (
573 char *Signature,
574 UINT32 Instance,
575 ACPI_TABLE_HEADER **Table,
576 ACPI_PHYSICAL_ADDRESS *Address);
577 #endif
578
579 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByIndex
580 ACPI_STATUS
581 AcpiOsGetTableByIndex (
582 UINT32 Index,
583 ACPI_TABLE_HEADER **Table,
584 UINT32 *Instance,
585 ACPI_PHYSICAL_ADDRESS *Address);
586 #endif
587
588 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByAddress
589 ACPI_STATUS
590 AcpiOsGetTableByAddress (
591 ACPI_PHYSICAL_ADDRESS Address,
592 ACPI_TABLE_HEADER **Table);
593 #endif
594
595
596 /*
597 * Directory manipulation
598 */
599 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsOpenDirectory
600 void *
601 AcpiOsOpenDirectory (
602 char *Pathname,
603 char *WildcardSpec,
604 char RequestedFileType);
605 #endif
606
607 /* RequesteFileType values */
608
609 #define REQUEST_FILE_ONLY 0
610 #define REQUEST_DIR_ONLY 1
611
612
613 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetNextFilename
614 char *
615 AcpiOsGetNextFilename (
616 void *DirHandle);
617 #endif
618
619 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCloseDirectory
620 void
621 AcpiOsCloseDirectory (
622 void *DirHandle);
623 #endif
624
625
626 #endif /* __ACPIOSXF_H__ */