Subversion Repositories Kolibri OS

Rev

Rev 1498 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1498 serge 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
 *
12
 * 1. Copyright Notice
13
 *
14
 * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
2216 Serge 15
 * All rights reserved.
1498 serge 16
 *
17
 * 2. License
18
 *
19
 * 2.1. This is your license from Intel Corp. under its intellectual property
20
 * rights.  You may have additional license terms from the party that provided
21
 * you this software, covering your right to use that party's intellectual
22
 * property rights.
23
 *
24
 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
25
 * copy of the source code appearing in this file ("Covered Code") an
26
 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
27
 * base code distributed originally by Intel ("Original Intel Code") to copy,
28
 * make derivatives, distribute, use and display any portion of the Covered
29
 * Code in any form, with the right to sublicense such rights; and
30
 *
31
 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
32
 * license (with the right to sublicense), under only those claims of Intel
33
 * patents that are infringed by the Original Intel Code, to make, use, sell,
34
 * offer to sell, and import the Covered Code and derivative works thereof
35
 * solely to the minimum extent necessary to exer
36
 se the above copyright
37
 * license, and in no event shall the patent license extend to any additions
38
 * to or modifications of the Original Intel Code.  No other license or right
39
 * is granted directly or by implication, estoppel or otherwise;
40
 *
41
 * The above copyright and patent license is granted only if the following
42
 * conditions are met:
43
 *
44
 * 3. Conditions
45
 *
46
 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
47
 * Redistribution of source code of any substantial portion of the Covered
48
 * Code or modification with rights to further distribute source must include
49
 * the above Copyright Notice, the above License, this list of Conditions,
50
 * and the following Disclaimer and Export Compliance provision.  In addition,
51
 * Licensee must cause all Covered Code to which Licensee contributes to
52
 * contain a file documenting the changes Licensee made to create that Covered
53
 * Code and the date of any change.  Licensee must include in that file the
54
 * documentation of any changes made by any predecessor Licensee.  Licensee
55
 * must include a prominent statement that the modification is derived,
56
 * directly or indirectly, from Original Intel Code.
57
 *
58
 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
59
 * Redistribution of source code of any substantial portion of the Covered
60
 * Code or modification without rights to further distribute source must
61
 * include the following Disclaimer and Export Compliance provision in the
62
 * documentation and/or other materials provided with distribution.  In
63
 * addition, Licensee may not authorize further sublicense of source of any
64
 * portion of the Covered Code, and must include terms to the effect that the
65
 * license from Licensee to its licensee is limited to the intellectual
66
 * property embodied in the software Licensee provides to its licensee, and
67
 * not to intellectual property embodied in modifications its licensee may
68
 * make.
69
 *
70
 * 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
 
121
#define __ACPIOSXF_H__
122
123
 
124
#include "actypes.h"
125
126
 
127
 
128
129
 
130
{
131
    OSL_GLOBAL_LOCK_HANDLER,
132
    OSL_NOTIFY_HANDLER,
133
    OSL_GPE_HANDLER,
134
    OSL_DEBUGGER_THREAD,
135
    OSL_EC_POLL_HANDLER,
136
    OSL_EC_BURST_HANDLER
137
138
 
139
140
 
141
#define ACPI_MUTEX_SEM              1
142
143
 
144
 
145
146
 
147
#define ACPI_SIGNAL_BREAKPOINT      1
148
149
 
150
{
151
    UINT32                  Type;
152
    UINT32                  Code;
153
    UINT32                  Argument;
154
155
 
156
157
 
158
 
159
 * OSL Initialization and shutdown primitives
160
 */
161
ACPI_STATUS
162
AcpiOsInitialize (
163
    void);
164
165
 
166
AcpiOsTerminate (
167
    void);
168
169
 
170
 
171
 * ACPI Table interfaces
172
 */
173
ACPI_PHYSICAL_ADDRESS
174
AcpiOsGetRootPointer (
175
    void);
176
177
 
178
AcpiOsPredefinedOverride (
179
    const ACPI_PREDEFINED_NAMES *InitVal,
180
    ACPI_STRING                 *NewVal);
181
182
 
183
AcpiOsTableOverride (
184
    ACPI_TABLE_HEADER       *ExistingTable,
185
    ACPI_TABLE_HEADER       **NewTable);
186
187
 
188
 
189
 * Spinlock primitives
190
 */
191
ACPI_STATUS
192
AcpiOsCreateLock (
193
    ACPI_SPINLOCK           *OutHandle);
194
195
 
196
AcpiOsDeleteLock (
197
    ACPI_SPINLOCK           Handle);
198
199
 
200
AcpiOsAcquireLock (
201
    ACPI_SPINLOCK           Handle);
202
203
 
204
AcpiOsReleaseLock (
205
    ACPI_SPINLOCK           Handle,
206
    ACPI_CPU_FLAGS          Flags);
207
208
 
209
 
210
 * Semaphore primitives
211
 */
212
ACPI_STATUS
213
AcpiOsCreateSemaphore (
214
    UINT32                  MaxUnits,
215
    UINT32                  InitialUnits,
216
    ACPI_SEMAPHORE          *OutHandle);
217
218
 
219
AcpiOsDeleteSemaphore (
220
    ACPI_SEMAPHORE          Handle);
221
222
 
223
AcpiOsWaitSemaphore (
224
    ACPI_SEMAPHORE          Handle,
225
    UINT32                  Units,
226
    UINT16                  Timeout);
227
228
 
229
AcpiOsSignalSemaphore (
230
    ACPI_SEMAPHORE          Handle,
231
    UINT32                  Units);
232
233
 
234
 
235
 * Mutex primitives. May be configured to use semaphores instead via
236
 * ACPI_MUTEX_TYPE (see platform/acenv.h)
237
 */
238
#if (ACPI_MUTEX_TYPE != ACPI_BINARY_SEMAPHORE)
239
240
 
241
AcpiOsCreateMutex (
242
    ACPI_MUTEX              *OutHandle);
243
244
 
245
AcpiOsDeleteMutex (
246
    ACPI_MUTEX              Handle);
247
248
 
249
AcpiOsAcquireMutex (
250
    ACPI_MUTEX              Handle,
251
    UINT16                  Timeout);
252
253
 
254
AcpiOsReleaseMutex (
255
    ACPI_MUTEX              Handle);
256
#endif
257
258
 
259
 
260
 * Memory allocation and mapping
261
 */
262
void *
263
AcpiOsAllocate (
264
    ACPI_SIZE               Size);
265
266
 
267
AcpiOsFree (
268
    void *                  Memory);
269
270
 
271
AcpiOsMapMemory (
272
    ACPI_PHYSICAL_ADDRESS   Where,
273
    ACPI_SIZE               Length);
274
275
 
276
AcpiOsUnmapMemory (
277
    void                    *LogicalAddress,
278
    ACPI_SIZE               Size);
279
280
 
281
AcpiOsGetPhysicalAddress (
282
    void                    *LogicalAddress,
283
    ACPI_PHYSICAL_ADDRESS   *PhysicalAddress);
284
285
 
286
 
287
 * Memory/Object Cache
288
 */
289
ACPI_STATUS
290
AcpiOsCreateCache (
291
    char                    *CacheName,
292
    UINT16                  ObjectSize,
293
    UINT16                  MaxDepth,
294
    ACPI_CACHE_T            **ReturnCache);
295
296
 
297
AcpiOsDeleteCache (
298
    ACPI_CACHE_T            *Cache);
299
300
 
301
AcpiOsPurgeCache (
302
    ACPI_CACHE_T            *Cache);
303
304
 
305
AcpiOsAcquireObject (
306
    ACPI_CACHE_T            *Cache);
307
308
 
309
AcpiOsReleaseObject (
310
    ACPI_CACHE_T            *Cache,
311
    void                    *Object);
312
313
 
314
 
315
 * Interrupt handlers
316
 */
317
ACPI_STATUS
318
AcpiOsInstallInterruptHandler (
319
    UINT32                  InterruptNumber,
320
    ACPI_OSD_HANDLER        ServiceRoutine,
321
    void                    *Context);
322
323
 
324
AcpiOsRemoveInterruptHandler (
325
    UINT32                  InterruptNumber,
326
    ACPI_OSD_HANDLER        ServiceRoutine);
327
328
 
329
 
330
 * Threads and Scheduling
331
 */
332
ACPI_THREAD_ID
333
AcpiOsGetThreadId (
334
    void);
335
336
 
337
AcpiOsExecute (
338
    ACPI_EXECUTE_TYPE       Type,
339
    ACPI_OSD_EXEC_CALLBACK  Function,
340
    void                    *Context);
341
342
 
343
AcpiOsWaitEventsComplete (
344
    void                    *Context);
345
346
 
347
AcpiOsSleep (
348
    UINT64                  Milliseconds);
349
350
 
351
AcpiOsStall (
352
    UINT32                  Microseconds);
353
354
 
355
 
356
 * Platform and hardware-independent I/O interfaces
357
 */
358
ACPI_STATUS
359
AcpiOsReadPort (
360
    ACPI_IO_ADDRESS         Address,
361
    UINT32                  *Value,
362
    UINT32                  Width);
363
364
 
365
AcpiOsWritePort (
366
    ACPI_IO_ADDRESS         Address,
367
    UINT32                  Value,
368
    UINT32                  Width);
369
370
 
371
 
372
 * Platform and hardware-independent physical memory interfaces
373
 */
374
ACPI_STATUS
375
AcpiOsReadMemory (
376
    ACPI_PHYSICAL_ADDRESS   Address,
377
    UINT32                  *Value,
378
    UINT32                  Width);
379
380
 
381
AcpiOsWriteMemory (
382
    ACPI_PHYSICAL_ADDRESS   Address,
383
    UINT32                  Value,
384
    UINT32                  Width);
385
386
 
387
 
388
 * Platform and hardware-independent PCI configuration space access
389
 * Note: Can't use "Register" as a parameter, changed to "Reg" --
390
 * certain compilers complain.
391
 */
392
ACPI_STATUS
393
AcpiOsReadPciConfiguration (
394
    ACPI_PCI_ID             *PciId,
395
    UINT32                  Reg,
396
    UINT64                  *Value,
2216 Serge 397
    UINT32                  Width);
1498 serge 398
399
 
400
AcpiOsWritePciConfiguration (
401
    ACPI_PCI_ID             *PciId,
402
    UINT32                  Reg,
403
    UINT64                  Value,
404
    UINT32                  Width);
405
406
 
407
 
408
 * Miscellaneous
409
 */
410
BOOLEAN
411
AcpiOsReadable (
412
    void                    *Pointer,
413
    ACPI_SIZE               Length);
414
415
 
416
AcpiOsWritable (
417
    void                    *Pointer,
418
    ACPI_SIZE               Length);
419
420
 
421
AcpiOsGetTimer (
422
    void);
423
424
 
425
AcpiOsSignal (
426
    UINT32                  Function,
427
    void                    *Info);
428
429
 
430
 
431
 * Debug print routines
432
 */
433
void ACPI_INTERNAL_VAR_XFACE
434
AcpiOsPrintf (
435
    const char              *Format,
436
    ...);
437
438
 
439
AcpiOsVprintf (
440
    const char              *Format,
441
    va_list                 Args);
442
443
 
444
AcpiOsRedirectOutput (
445
    void                    *Destination);
446
447
 
448
 
449
 * Debug input
450
 */
451
ACPI_STATUS
2216 Serge 452
AcpiOsGetLine (
1498 serge 453
    char                    *Buffer,
2216 Serge 454
    UINT32                  BufferLength,
455
    UINT32                  *BytesRead);
456
1498 serge 457
 
458
 
459
 * Directory manipulation
460
 */
461
void *
462
AcpiOsOpenDirectory (
463
    char                    *Pathname,
464
    char                    *WildcardSpec,
465
    char                    RequestedFileType);
466
467
 
468
469
 
470
#define REQUEST_DIR_ONLY                    1
471
472
 
473
 
474
AcpiOsGetNextFilename (
475
    void                    *DirHandle);
476
477
 
478
AcpiOsCloseDirectory (
479
    void                    *DirHandle);
480
481
 
482
 
483