Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1498 serge 1
 
2
 *
3
 * Module Name: hwgpe - Low level GPE enable/disable/clear functions
4
 *
5
 *****************************************************************************/
6
7
 
8
 *
9
 * 1. Copyright Notice
10
 *
11
 * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
12
 * All rights reserved.
13
 *
14
 * 2. License
15
 *
16
 * 2.1. This is your license from Intel Corp. under its intellectual property
17
 * rights.  You may have additional license terms from the party that provided
18
 * you this software, covering your right to use that party's intellectual
19
 * property rights.
20
 *
21
 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22
 * copy of the source code appearing in this file ("Covered Code") an
23
 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24
 * base code distributed originally by Intel ("Original Intel Code") to copy,
25
 * make derivatives, distribute, use and display any portion of the Covered
26
 * Code in any form, with the right to sublicense such rights; and
27
 *
28
 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29
 * license (with the right to sublicense), under only those claims of Intel
30
 * patents that are infringed by the Original Intel Code, to make, use, sell,
31
 * offer to sell, and import the Covered Code and derivative works thereof
32
 * solely to the minimum extent necessary to exercise the above copyright
33
 * license, and in no event shall the patent license extend to any additions
34
 * to or modifications of the Original Intel Code.  No other license or right
35
 * is granted directly or by implication, estoppel or otherwise;
36
 *
37
 * The above copyright and patent license is granted only if the following
38
 * conditions are met:
39
 *
40
 * 3. Conditions
41
 *
42
 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43
 * Redistribution of source code of any substantial portion of the Covered
44
 * Code or modification with rights to further distribute source must include
45
 * the above Copyright Notice, the above License, this list of Conditions,
46
 * and the following Disclaimer and Export Compliance provision.  In addition,
47
 * Licensee must cause all Covered Code to which Licensee contributes to
48
 * contain a file documenting the changes Licensee made to create that Covered
49
 * Code and the date of any change.  Licensee must include in that file the
50
 * documentation of any changes made by any predecessor Licensee.  Licensee
51
 * must include a prominent statement that the modification is derived,
52
 * directly or indirectly, from Original Intel Code.
53
 *
54
 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55
 * Redistribution of source code of any substantial portion of the Covered
56
 * Code or modification without rights to further distribute source must
57
 * include the following Disclaimer and Export Compliance provision in the
58
 * documentation and/or other materials provided with distribution.  In
59
 * addition, Licensee may not authorize further sublicense of source of any
60
 * portion of the Covered Code, and must include terms to the effect that the
61
 * license from Licensee to its licensee is limited to the intellectual
62
 * property embodied in the software Licensee provides to its licensee, and
63
 * not to intellectual property embodied in modifications its licensee may
64
 * make.
65
 *
66
 * 3.3. Redistribution of Executable. Redistribution in executable form of any
67
 * substantial portion of the Covered Code or modification must reproduce the
68
 * above Copyright Notice, and the following Disclaimer and Export Compliance
69
 * provision in the documentation and/or other materials provided with the
70
 * distribution.
71
 *
72
 * 3.4. Intel retains all right, title, and interest in and to the Original
73
 * Intel Code.
74
 *
75
 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76
 * Intel shall be used in advertising or otherwise to promote the sale, use or
77
 * other dealings in products derived from or relating to the Covered Code
78
 * without prior written authorization from Intel.
79
 *
80
 * 4. Disclaimer and Export Compliance
81
 *
82
 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83
 * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84
 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
85
 * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
86
 * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
87
 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88
 * PARTICULAR PURPOSE.
89
 *
90
 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91
 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92
 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93
 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94
 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95
 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
96
 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97
 * LIMITED REMEDY.
98
 *
99
 * 4.3. Licensee shall not export, either directly or indirectly, any of this
100
 * software or system incorporating such software without first obtaining any
101
 * required license or other approval from the U. S. Department of Commerce or
102
 * any other agency or department of the United States Government.  In the
103
 * event Licensee exports any such software from the United States or
104
 * re-exports any such software from a foreign destination, Licensee shall
105
 * ensure that the distribution and export/re-export of the software is in
106
 * compliance with all laws, regulations, orders, or other restrictions of the
107
 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108
 * any of its subsidiaries will export/re-export any technical data, process,
109
 * software, or service, directly or indirectly, to any country for which the
110
 * United States government or any agency thereof requires an export license,
111
 * other governmental approval, or letter of assurance, without first obtaining
112
 * such license, approval or letter.
113
 *
114
 *****************************************************************************/
115
116
 
117
#include "accommon.h"
118
#include "acevents.h"
119
120
 
121
        ACPI_MODULE_NAME    ("hwgpe")
122
123
 
124
125
 
126
AcpiHwEnableWakeupGpeBlock (
127
    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
128
    ACPI_GPE_BLOCK_INFO     *GpeBlock,
129
    void                    *Context);
130
131
 
132
 
133
 *
134
 * FUNCTION:    AcpiHwLowDisableGpe
135
 *
136
 * PARAMETERS:  GpeEventInfo        - Info block for the GPE to be disabled
137
 *
138
 * RETURN:      Status
139
 *
140
 * DESCRIPTION: Disable a single GPE in the enable register.
141
 *
142
 ******************************************************************************/
143
144
 
145
AcpiHwLowDisableGpe (
146
    ACPI_GPE_EVENT_INFO     *GpeEventInfo)
147
{
148
    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
149
    ACPI_STATUS             Status;
150
    UINT32                  EnableMask;
151
152
 
153
 
154
155
 
156
    if (!GpeRegisterInfo)
157
    {
158
        return (AE_NOT_EXIST);
159
    }
160
161
 
162
163
 
164
    if (ACPI_FAILURE (Status))
165
    {
166
        return (Status);
167
    }
168
169
 
170
171
 
172
        (GpeEventInfo->GpeNumber - GpeRegisterInfo->BaseGpeNumber)));
173
174
 
175
 
176
177
 
178
    return (Status);
179
}
180
181
 
182
 
183
 *
184
 * FUNCTION:    AcpiHwWriteGpeEnableReg
185
 *
186
 * PARAMETERS:  GpeEventInfo        - Info block for the GPE to be enabled
187
 *
188
 * RETURN:      Status
189
 *
190
 * DESCRIPTION: Write a GPE enable register.  Note: The bit for this GPE must
191
 *              already be cleared or set in the parent register
192
 *              EnableForRun mask.
193
 *
194
 ******************************************************************************/
195
196
 
197
AcpiHwWriteGpeEnableReg (
198
    ACPI_GPE_EVENT_INFO     *GpeEventInfo)
199
{
200
    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
201
    ACPI_STATUS             Status;
202
203
 
204
 
205
206
 
207
 
208
209
 
210
    if (!GpeRegisterInfo)
211
    {
212
        return (AE_NOT_EXIST);
213
    }
214
215
 
216
217
 
218
                    &GpeRegisterInfo->EnableAddress);
219
220
 
221
}
222
223
 
224
 
225
 *
226
 * FUNCTION:    AcpiHwClearGpe
227
 *
228
 * PARAMETERS:  GpeEventInfo        - Info block for the GPE to be cleared
229
 *
230
 * RETURN:      Status
231
 *
232
 * DESCRIPTION: Clear the status bit for a single GPE.
233
 *
234
 ******************************************************************************/
235
236
 
237
AcpiHwClearGpe (
238
    ACPI_GPE_EVENT_INFO     *GpeEventInfo)
239
{
240
    ACPI_STATUS             Status;
241
    UINT8                   RegisterBit;
242
243
 
244
 
245
246
 
247
 
248
        (GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber));
249
250
 
251
     * Write a one to the appropriate bit in the status register to
252
     * clear this GPE.
253
     */
254
    Status = AcpiHwWrite (RegisterBit,
255
                    &GpeEventInfo->RegisterInfo->StatusAddress);
256
257
 
258
}
259
260
 
261
 
262
 *
263
 * FUNCTION:    AcpiHwGetGpeStatus
264
 *
265
 * PARAMETERS:  GpeEventInfo        - Info block for the GPE to queried
266
 *              EventStatus         - Where the GPE status is returned
267
 *
268
 * RETURN:      Status
269
 *
270
 * DESCRIPTION: Return the status of a single GPE.
271
 *
272
 ******************************************************************************/
273
274
 
275
AcpiHwGetGpeStatus (
276
    ACPI_GPE_EVENT_INFO     *GpeEventInfo,
277
    ACPI_EVENT_STATUS       *EventStatus)
278
{
279
    UINT32                  InByte;
280
    UINT8                   RegisterBit;
281
    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
282
    ACPI_STATUS             Status;
283
    ACPI_EVENT_STATUS       LocalEventStatus = 0;
284
285
 
286
 
287
288
 
289
 
290
    {
291
        return (AE_BAD_PARAMETER);
292
    }
293
294
 
295
296
 
297
298
 
299
300
 
301
        (GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber));
302
303
 
304
305
 
306
    {
307
        LocalEventStatus |= ACPI_EVENT_FLAG_ENABLED;
308
    }
309
310
 
311
312
 
313
    {
314
        LocalEventStatus |= ACPI_EVENT_FLAG_WAKE_ENABLED;
315
    }
316
317
 
318
319
 
320
    if (ACPI_FAILURE (Status))
321
    {
322
        return (Status);
323
    }
324
325
 
326
    {
327
        LocalEventStatus |= ACPI_EVENT_FLAG_SET;
328
    }
329
330
 
331
332
 
333
    return (AE_OK);
334
}
335
336
 
337
 
338
 *
339
 * FUNCTION:    AcpiHwDisableGpeBlock
340
 *
341
 * PARAMETERS:  GpeXruptInfo        - GPE Interrupt info
342
 *              GpeBlock            - Gpe Block info
343
 *
344
 * RETURN:      Status
345
 *
346
 * DESCRIPTION: Disable all GPEs within a single GPE block
347
 *
348
 ******************************************************************************/
349
350
 
351
AcpiHwDisableGpeBlock (
352
    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
353
    ACPI_GPE_BLOCK_INFO     *GpeBlock,
354
    void                    *Context)
355
{
356
    UINT32                  i;
357
    ACPI_STATUS             Status;
358
359
 
360
 
361
362
 
363
    {
364
        /* Disable all GPEs in this register */
365
366
 
367
        if (ACPI_FAILURE (Status))
368
        {
369
            return (Status);
370
        }
371
    }
372
373
 
374
}
375
376
 
377
 
378
 *
379
 * FUNCTION:    AcpiHwClearGpeBlock
380
 *
381
 * PARAMETERS:  GpeXruptInfo        - GPE Interrupt info
382
 *              GpeBlock            - Gpe Block info
383
 *
384
 * RETURN:      Status
385
 *
386
 * DESCRIPTION: Clear status bits for all GPEs within a single GPE block
387
 *
388
 ******************************************************************************/
389
390
 
391
AcpiHwClearGpeBlock (
392
    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
393
    ACPI_GPE_BLOCK_INFO     *GpeBlock,
394
    void                    *Context)
395
{
396
    UINT32                  i;
397
    ACPI_STATUS             Status;
398
399
 
400
 
401
402
 
403
    {
404
        /* Clear status on all GPEs in this register */
405
406
 
407
        if (ACPI_FAILURE (Status))
408
        {
409
            return (Status);
410
        }
411
    }
412
413
 
414
}
415
416
 
417
 
418
 *
419
 * FUNCTION:    AcpiHwEnableRuntimeGpeBlock
420
 *
421
 * PARAMETERS:  GpeXruptInfo        - GPE Interrupt info
422
 *              GpeBlock            - Gpe Block info
423
 *
424
 * RETURN:      Status
425
 *
426
 * DESCRIPTION: Enable all "runtime" GPEs within a single GPE block. Includes
427
 *              combination wake/run GPEs.
428
 *
429
 ******************************************************************************/
430
431
 
432
AcpiHwEnableRuntimeGpeBlock (
433
    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
434
    ACPI_GPE_BLOCK_INFO     *GpeBlock,
435
    void                    *Context)
436
{
437
    UINT32                  i;
438
    ACPI_STATUS             Status;
439
440
 
441
 
442
443
 
444
445
 
446
    {
447
        if (!GpeBlock->RegisterInfo[i].EnableForRun)
448
        {
449
            continue;
450
        }
451
452
 
453
454
 
455
                    &GpeBlock->RegisterInfo[i].EnableAddress);
456
        if (ACPI_FAILURE (Status))
457
        {
458
            return (Status);
459
        }
460
    }
461
462
 
463
}
464
465
 
466
 
467
 *
468
 * FUNCTION:    AcpiHwEnableWakeupGpeBlock
469
 *
470
 * PARAMETERS:  GpeXruptInfo        - GPE Interrupt info
471
 *              GpeBlock            - Gpe Block info
472
 *
473
 * RETURN:      Status
474
 *
475
 * DESCRIPTION: Enable all "wake" GPEs within a single GPE block. Includes
476
 *              combination wake/run GPEs.
477
 *
478
 ******************************************************************************/
479
480
 
481
AcpiHwEnableWakeupGpeBlock (
482
    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
483
    ACPI_GPE_BLOCK_INFO     *GpeBlock,
484
    void                    *Context)
485
{
486
    UINT32                  i;
487
    ACPI_STATUS             Status;
488
489
 
490
 
491
492
 
493
    {
494
        if (!GpeBlock->RegisterInfo[i].EnableForWake)
495
        {
496
            continue;
497
        }
498
499
 
500
501
 
502
                    &GpeBlock->RegisterInfo[i].EnableAddress);
503
        if (ACPI_FAILURE (Status))
504
        {
505
            return (Status);
506
        }
507
    }
508
509
 
510
}
511
512
 
513
 
514
 *
515
 * FUNCTION:    AcpiHwDisableAllGpes
516
 *
517
 * PARAMETERS:  None
518
 *
519
 * RETURN:      Status
520
 *
521
 * DESCRIPTION: Disable and clear all GPEs in all GPE blocks
522
 *
523
 ******************************************************************************/
524
525
 
526
AcpiHwDisableAllGpes (
527
    void)
528
{
529
    ACPI_STATUS             Status;
530
531
 
532
 
533
534
 
535
 
536
    Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock, NULL);
537
    return_ACPI_STATUS (Status);
538
}
539
540
 
541
 
542
 *
543
 * FUNCTION:    AcpiHwEnableAllRuntimeGpes
544
 *
545
 * PARAMETERS:  None
546
 *
547
 * RETURN:      Status
548
 *
549
 * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks
550
 *
551
 ******************************************************************************/
552
553
 
554
AcpiHwEnableAllRuntimeGpes (
555
    void)
556
{
557
    ACPI_STATUS             Status;
558
559
 
560
 
561
562
 
563
 
564
    return_ACPI_STATUS (Status);
565
}
566
567
 
568
 
569
 *
570
 * FUNCTION:    AcpiHwEnableAllWakeupGpes
571
 *
572
 * PARAMETERS:  None
573
 *
574
 * RETURN:      Status
575
 *
576
 * DESCRIPTION: Enable all "wakeup" GPEs, in all GPE blocks
577
 *
578
 ******************************************************************************/
579
580
 
581
AcpiHwEnableAllWakeupGpes (
582
    void)
583
{
584
    ACPI_STATUS             Status;
585
586
 
587
 
588
589
 
590
 
591
    return_ACPI_STATUS (Status);
592
}
593
>
594