167754Smsmith/******************************************************************************
267754Smsmith *
367754Smsmith * Module Name: hwgpe - Low level GPE enable/disable/clear functions
467754Smsmith *
567754Smsmith *****************************************************************************/
667754Smsmith
7217365Sjkim/*
8281075Sdim * Copyright (C) 2000 - 2015, Intel Corp.
970243Smsmith * All rights reserved.
1067754Smsmith *
11217365Sjkim * Redistribution and use in source and binary forms, with or without
12217365Sjkim * modification, are permitted provided that the following conditions
13217365Sjkim * are met:
14217365Sjkim * 1. Redistributions of source code must retain the above copyright
15217365Sjkim *    notice, this list of conditions, and the following disclaimer,
16217365Sjkim *    without modification.
17217365Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18217365Sjkim *    substantially similar to the "NO WARRANTY" disclaimer below
19217365Sjkim *    ("Disclaimer") and any redistribution must be conditioned upon
20217365Sjkim *    including a substantially similar Disclaimer requirement for further
21217365Sjkim *    binary redistribution.
22217365Sjkim * 3. Neither the names of the above-listed copyright holders nor the names
23217365Sjkim *    of any contributors may be used to endorse or promote products derived
24217365Sjkim *    from this software without specific prior written permission.
2567754Smsmith *
26217365Sjkim * Alternatively, this software may be distributed under the terms of the
27217365Sjkim * GNU General Public License ("GPL") version 2 as published by the Free
28217365Sjkim * Software Foundation.
2967754Smsmith *
30217365Sjkim * NO WARRANTY
31217365Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32217365Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33217365Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34217365Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35217365Sjkim * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36217365Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37217365Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38217365Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39217365Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40217365Sjkim * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41217365Sjkim * POSSIBILITY OF SUCH DAMAGES.
42217365Sjkim */
4367754Smsmith
44193341Sjkim#include <contrib/dev/acpica/include/acpi.h>
45193341Sjkim#include <contrib/dev/acpica/include/accommon.h>
46193341Sjkim#include <contrib/dev/acpica/include/acevents.h>
4767754Smsmith
4877424Smsmith#define _COMPONENT          ACPI_HARDWARE
4991116Smsmith        ACPI_MODULE_NAME    ("hwgpe")
5067754Smsmith
51231844Sjkim#if (!ACPI_REDUCED_HARDWARE) /* Entire module */
52231844Sjkim
53151937Sjkim/* Local prototypes */
5467754Smsmith
55151937Sjkimstatic ACPI_STATUS
56151937SjkimAcpiHwEnableWakeupGpeBlock (
57151937Sjkim    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
58193267Sjkim    ACPI_GPE_BLOCK_INFO     *GpeBlock,
59193267Sjkim    void                    *Context);
60151937Sjkim
61281075Sdimstatic ACPI_STATUS
62281075SdimAcpiHwGpeEnableWrite (
63281075Sdim    UINT8                   EnableMask,
64281075Sdim    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo);
65151937Sjkim
66281075Sdim
6767754Smsmith/******************************************************************************
6867754Smsmith *
69209746Sjkim * FUNCTION:    AcpiHwGetGpeRegisterBit
70193267Sjkim *
71209746Sjkim * PARAMETERS:  GpeEventInfo        - Info block for the GPE
72209746Sjkim *
73209746Sjkim * RETURN:      Register mask with a one in the GPE bit position
74209746Sjkim *
75209746Sjkim * DESCRIPTION: Compute the register mask for this GPE. One bit is set in the
76209746Sjkim *              correct position for the input GPE.
77209746Sjkim *
78209746Sjkim ******************************************************************************/
79209746Sjkim
80209746SjkimUINT32
81209746SjkimAcpiHwGetGpeRegisterBit (
82239340Sjkim    ACPI_GPE_EVENT_INFO     *GpeEventInfo)
83209746Sjkim{
84209746Sjkim
85209746Sjkim    return ((UINT32) 1 <<
86239340Sjkim        (GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber));
87209746Sjkim}
88209746Sjkim
89209746Sjkim
90209746Sjkim/******************************************************************************
91209746Sjkim *
92209746Sjkim * FUNCTION:    AcpiHwLowSetGpe
93209746Sjkim *
94193267Sjkim * PARAMETERS:  GpeEventInfo        - Info block for the GPE to be disabled
95209746Sjkim *              Action              - Enable or disable
96193267Sjkim *
97193267Sjkim * RETURN:      Status
98193267Sjkim *
99209746Sjkim * DESCRIPTION: Enable or disable a single GPE in the parent enable register.
100193267Sjkim *
101193267Sjkim ******************************************************************************/
102193267Sjkim
103193267SjkimACPI_STATUS
104209746SjkimAcpiHwLowSetGpe (
105209746Sjkim    ACPI_GPE_EVENT_INFO     *GpeEventInfo,
106209746Sjkim    UINT32                  Action)
107193267Sjkim{
108193267Sjkim    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
109193267Sjkim    ACPI_STATUS             Status;
110193267Sjkim    UINT32                  EnableMask;
111209746Sjkim    UINT32                  RegisterBit;
112193267Sjkim
113193267Sjkim
114209746Sjkim    ACPI_FUNCTION_ENTRY ();
115209746Sjkim
116209746Sjkim
117193267Sjkim    /* Get the info block for the entire GPE register */
118193267Sjkim
119193267Sjkim    GpeRegisterInfo = GpeEventInfo->RegisterInfo;
120193267Sjkim    if (!GpeRegisterInfo)
121193267Sjkim    {
122193267Sjkim        return (AE_NOT_EXIST);
123193267Sjkim    }
124193267Sjkim
125193267Sjkim    /* Get current value of the enable register that contains this GPE */
126193267Sjkim
127197104Sjkim    Status = AcpiHwRead (&EnableMask, &GpeRegisterInfo->EnableAddress);
128193267Sjkim    if (ACPI_FAILURE (Status))
129193267Sjkim    {
130193267Sjkim        return (Status);
131193267Sjkim    }
132193267Sjkim
133209746Sjkim    /* Set or clear just the bit that corresponds to this GPE */
134193267Sjkim
135239340Sjkim    RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo);
136281075Sdim    switch (Action & ~ACPI_GPE_SAVE_MASK)
137209746Sjkim    {
138209746Sjkim    case ACPI_GPE_CONDITIONAL_ENABLE:
139193267Sjkim
140281075Sdim        /* Only enable if the corresponding EnableMask bit is set */
141193267Sjkim
142281075Sdim        if (!(RegisterBit & GpeRegisterInfo->EnableMask))
143209746Sjkim        {
144209746Sjkim            return (AE_BAD_PARAMETER);
145209746Sjkim        }
146193267Sjkim
147209746Sjkim        /*lint -fallthrough */
148193267Sjkim
149209746Sjkim    case ACPI_GPE_ENABLE:
150250838Sjkim
151209746Sjkim        ACPI_SET_BIT (EnableMask, RegisterBit);
152209746Sjkim        break;
153193267Sjkim
154209746Sjkim    case ACPI_GPE_DISABLE:
155250838Sjkim
156209746Sjkim        ACPI_CLEAR_BIT (EnableMask, RegisterBit);
157209746Sjkim        break;
15867754Smsmith
159209746Sjkim    default:
160250838Sjkim
161245582Sjkim        ACPI_ERROR ((AE_INFO, "Invalid GPE Action, %u", Action));
162209746Sjkim        return (AE_BAD_PARAMETER);
163114237Snjl    }
16467754Smsmith
165209746Sjkim    /* Write the updated enable mask */
16684491Smsmith
167209746Sjkim    Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress);
168281075Sdim    if (ACPI_SUCCESS (Status) && (Action & ACPI_GPE_SAVE_MASK))
169281075Sdim    {
170281075Sdim        GpeRegisterInfo->EnableMask = (UINT8) EnableMask;
171281075Sdim    }
172129684Snjl    return (Status);
17367754Smsmith}
17467754Smsmith
17591116Smsmith
17684491Smsmith/******************************************************************************
17784491Smsmith *
17867754Smsmith * FUNCTION:    AcpiHwClearGpe
17967754Smsmith *
180128212Snjl * PARAMETERS:  GpeEventInfo        - Info block for the GPE to be cleared
18167754Smsmith *
182138287Smarks * RETURN:      Status
18367754Smsmith *
184128212Snjl * DESCRIPTION: Clear the status bit for a single GPE.
18567754Smsmith *
18667754Smsmith ******************************************************************************/
18767754Smsmith
18899679SiwasakiACPI_STATUS
18967754SmsmithAcpiHwClearGpe (
190114237Snjl    ACPI_GPE_EVENT_INFO     *GpeEventInfo)
19167754Smsmith{
192209746Sjkim    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
19399679Siwasaki    ACPI_STATUS             Status;
194209746Sjkim    UINT32                  RegisterBit;
19567754Smsmith
19680062Smsmith
19791116Smsmith    ACPI_FUNCTION_ENTRY ();
19883174Smsmith
199209746Sjkim    /* Get the info block for the entire GPE register */
20083174Smsmith
201209746Sjkim    GpeRegisterInfo = GpeEventInfo->RegisterInfo;
202209746Sjkim    if (!GpeRegisterInfo)
203209746Sjkim    {
204209746Sjkim        return (AE_NOT_EXIST);
205209746Sjkim    }
206167802Sjkim
20767754Smsmith    /*
20867754Smsmith     * Write a one to the appropriate bit in the status register to
20967754Smsmith     * clear this GPE.
21067754Smsmith     */
211239340Sjkim    RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo);
212209746Sjkim
213197104Sjkim    Status = AcpiHwWrite (RegisterBit,
214209746Sjkim                    &GpeRegisterInfo->StatusAddress);
21599679Siwasaki
21699679Siwasaki    return (Status);
21767754Smsmith}
21867754Smsmith
21967754Smsmith
22067754Smsmith/******************************************************************************
22167754Smsmith *
22267754Smsmith * FUNCTION:    AcpiHwGetGpeStatus
22367754Smsmith *
224128212Snjl * PARAMETERS:  GpeEventInfo        - Info block for the GPE to queried
225128212Snjl *              EventStatus         - Where the GPE status is returned
22667754Smsmith *
227128212Snjl * RETURN:      Status
22867754Smsmith *
22967754Smsmith * DESCRIPTION: Return the status of a single GPE.
23067754Smsmith *
23167754Smsmith ******************************************************************************/
23267754Smsmith
23399679SiwasakiACPI_STATUS
23467754SmsmithAcpiHwGetGpeStatus (
235117521Snjl    ACPI_GPE_EVENT_INFO     *GpeEventInfo,
23667754Smsmith    ACPI_EVENT_STATUS       *EventStatus)
23767754Smsmith{
238114237Snjl    UINT32                  InByte;
239209746Sjkim    UINT32                  RegisterBit;
24091116Smsmith    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
241209746Sjkim    ACPI_EVENT_STATUS       LocalEventStatus = 0;
24299679Siwasaki    ACPI_STATUS             Status;
24367754Smsmith
24480062Smsmith
24591116Smsmith    ACPI_FUNCTION_ENTRY ();
24683174Smsmith
24783174Smsmith
24867754Smsmith    if (!EventStatus)
24967754Smsmith    {
25099679Siwasaki        return (AE_BAD_PARAMETER);
25167754Smsmith    }
25267754Smsmith
253281075Sdim    /* GPE currently handled? */
254281075Sdim
255281075Sdim    if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) !=
256281075Sdim            ACPI_GPE_DISPATCH_NONE)
257281075Sdim    {
258281075Sdim        LocalEventStatus |= ACPI_EVENT_FLAG_HAS_HANDLER;
259281075Sdim    }
260281075Sdim
261114237Snjl    /* Get the info block for the entire GPE register */
26267754Smsmith
263114237Snjl    GpeRegisterInfo = GpeEventInfo->RegisterInfo;
26467754Smsmith
26591116Smsmith    /* Get the register bitmask for this GPE */
26691116Smsmith
267239340Sjkim    RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo);
26891116Smsmith
269129684Snjl    /* GPE currently enabled? (enabled for runtime?) */
27091116Smsmith
271129684Snjl    if (RegisterBit & GpeRegisterInfo->EnableForRun)
27299679Siwasaki    {
273114237Snjl        LocalEventStatus |= ACPI_EVENT_FLAG_ENABLED;
27467754Smsmith    }
27567754Smsmith
276129684Snjl    /* GPE enabled for wake? */
27791116Smsmith
278129684Snjl    if (RegisterBit & GpeRegisterInfo->EnableForWake)
27984491Smsmith    {
280114237Snjl        LocalEventStatus |= ACPI_EVENT_FLAG_WAKE_ENABLED;
28184491Smsmith    }
28284491Smsmith
283281687Sjkim    /* GPE currently enabled (enable bit == 1)? */
284281687Sjkim
285281687Sjkim    Status = AcpiHwRead (&InByte, &GpeRegisterInfo->EnableAddress);
286281687Sjkim    if (ACPI_FAILURE (Status))
287281687Sjkim    {
288281687Sjkim        return (Status);
289281687Sjkim    }
290281687Sjkim
291281687Sjkim    if (RegisterBit & InByte)
292281687Sjkim    {
293281687Sjkim        LocalEventStatus |= ACPI_EVENT_FLAG_ENABLE_SET;
294281687Sjkim    }
295281687Sjkim
296129684Snjl    /* GPE currently active (status bit == 1)? */
29791116Smsmith
298197104Sjkim    Status = AcpiHwRead (&InByte, &GpeRegisterInfo->StatusAddress);
29999679Siwasaki    if (ACPI_FAILURE (Status))
30099679Siwasaki    {
301202771Sjkim        return (Status);
30299679Siwasaki    }
30399679Siwasaki
304129684Snjl    if (RegisterBit & InByte)
30567754Smsmith    {
306281687Sjkim        LocalEventStatus |= ACPI_EVENT_FLAG_STATUS_SET;
30767754Smsmith    }
308114237Snjl
309114237Snjl    /* Set return value */
310114237Snjl
311114237Snjl    (*EventStatus) = LocalEventStatus;
312202771Sjkim    return (AE_OK);
313117521Snjl}
314117521Snjl
315117521Snjl
316117521Snjl/******************************************************************************
317117521Snjl *
318281075Sdim * FUNCTION:    AcpiHwGpeEnableWrite
319281075Sdim *
320281075Sdim * PARAMETERS:  EnableMask          - Bit mask to write to the GPE register
321281075Sdim *              GpeRegisterInfo     - Gpe Register info
322281075Sdim *
323281075Sdim * RETURN:      Status
324281075Sdim *
325281075Sdim * DESCRIPTION: Write the enable mask byte to the given GPE register.
326281075Sdim *
327281075Sdim ******************************************************************************/
328281075Sdim
329281075Sdimstatic ACPI_STATUS
330281075SdimAcpiHwGpeEnableWrite (
331281075Sdim    UINT8                   EnableMask,
332281075Sdim    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo)
333281075Sdim{
334281075Sdim    ACPI_STATUS             Status;
335281075Sdim
336281075Sdim
337281075Sdim    Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress);
338281075Sdim    if (ACPI_SUCCESS (Status))
339281075Sdim    {
340281075Sdim        GpeRegisterInfo->EnableMask = EnableMask;
341281075Sdim    }
342281075Sdim
343281075Sdim    return (Status);
344281075Sdim}
345281075Sdim
346281075Sdim
347281075Sdim/******************************************************************************
348281075Sdim *
349117521Snjl * FUNCTION:    AcpiHwDisableGpeBlock
350117521Snjl *
351117521Snjl * PARAMETERS:  GpeXruptInfo        - GPE Interrupt info
352117521Snjl *              GpeBlock            - Gpe Block info
353117521Snjl *
354117521Snjl * RETURN:      Status
355117521Snjl *
356151937Sjkim * DESCRIPTION: Disable all GPEs within a single GPE block
357117521Snjl *
358117521Snjl ******************************************************************************/
359117521Snjl
360117521SnjlACPI_STATUS
361117521SnjlAcpiHwDisableGpeBlock (
362117521Snjl    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
363193267Sjkim    ACPI_GPE_BLOCK_INFO     *GpeBlock,
364193267Sjkim    void                    *Context)
365117521Snjl{
366117521Snjl    UINT32                  i;
367117521Snjl    ACPI_STATUS             Status;
368117521Snjl
369117521Snjl
370117521Snjl    /* Examine each GPE Register within the block */
371117521Snjl
372117521Snjl    for (i = 0; i < GpeBlock->RegisterCount; i++)
373117521Snjl    {
374126372Snjl        /* Disable all GPEs in this register */
375126372Snjl
376281075Sdim        Status = AcpiHwGpeEnableWrite (0x00, &GpeBlock->RegisterInfo[i]);
377117521Snjl        if (ACPI_FAILURE (Status))
378117521Snjl        {
379117521Snjl            return (Status);
380117521Snjl        }
381117521Snjl    }
382117521Snjl
38399679Siwasaki    return (AE_OK);
38467754Smsmith}
38584491Smsmith
38691116Smsmith
38784491Smsmith/******************************************************************************
38884491Smsmith *
389117521Snjl * FUNCTION:    AcpiHwClearGpeBlock
390117521Snjl *
391117521Snjl * PARAMETERS:  GpeXruptInfo        - GPE Interrupt info
392117521Snjl *              GpeBlock            - Gpe Block info
393117521Snjl *
394117521Snjl * RETURN:      Status
395117521Snjl *
396151937Sjkim * DESCRIPTION: Clear status bits for all GPEs within a single GPE block
397117521Snjl *
398117521Snjl ******************************************************************************/
399117521Snjl
400117521SnjlACPI_STATUS
401117521SnjlAcpiHwClearGpeBlock (
402117521Snjl    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
403193267Sjkim    ACPI_GPE_BLOCK_INFO     *GpeBlock,
404193267Sjkim    void                    *Context)
405117521Snjl{
406117521Snjl    UINT32                  i;
407117521Snjl    ACPI_STATUS             Status;
408117521Snjl
409117521Snjl
410117521Snjl    /* Examine each GPE Register within the block */
411117521Snjl
412117521Snjl    for (i = 0; i < GpeBlock->RegisterCount; i++)
413117521Snjl    {
414128212Snjl        /* Clear status on all GPEs in this register */
415126372Snjl
416197104Sjkim        Status = AcpiHwWrite (0xFF, &GpeBlock->RegisterInfo[i].StatusAddress);
417117521Snjl        if (ACPI_FAILURE (Status))
418117521Snjl        {
419117521Snjl            return (Status);
420117521Snjl        }
421117521Snjl    }
422117521Snjl
423117521Snjl    return (AE_OK);
424117521Snjl}
425117521Snjl
426117521Snjl
427117521Snjl/******************************************************************************
428117521Snjl *
429129684Snjl * FUNCTION:    AcpiHwEnableRuntimeGpeBlock
430117521Snjl *
431117521Snjl * PARAMETERS:  GpeXruptInfo        - GPE Interrupt info
432117521Snjl *              GpeBlock            - Gpe Block info
433117521Snjl *
434117521Snjl * RETURN:      Status
435117521Snjl *
436151937Sjkim * DESCRIPTION: Enable all "runtime" GPEs within a single GPE block. Includes
437151937Sjkim *              combination wake/run GPEs.
438117521Snjl *
439117521Snjl ******************************************************************************/
440117521Snjl
441129684SnjlACPI_STATUS
442129684SnjlAcpiHwEnableRuntimeGpeBlock (
443117521Snjl    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
444193267Sjkim    ACPI_GPE_BLOCK_INFO     *GpeBlock,
445193267Sjkim    void                    *Context)
446117521Snjl{
447117521Snjl    UINT32                  i;
448117521Snjl    ACPI_STATUS             Status;
449281075Sdim    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
450117521Snjl
451117521Snjl
452129684Snjl    /* NOTE: assumes that all GPEs are currently disabled */
453117521Snjl
454117521Snjl    /* Examine each GPE Register within the block */
455117521Snjl
456117521Snjl    for (i = 0; i < GpeBlock->RegisterCount; i++)
457117521Snjl    {
458281075Sdim        GpeRegisterInfo = &GpeBlock->RegisterInfo[i];
459281075Sdim        if (!GpeRegisterInfo->EnableForRun)
460117521Snjl        {
461129684Snjl            continue;
462117521Snjl        }
463117521Snjl
464129684Snjl        /* Enable all "runtime" GPEs in this register */
465117521Snjl
466281075Sdim        Status = AcpiHwGpeEnableWrite (GpeRegisterInfo->EnableForRun,
467281075Sdim                    GpeRegisterInfo);
468117521Snjl        if (ACPI_FAILURE (Status))
469117521Snjl        {
470117521Snjl            return (Status);
471117521Snjl        }
472117521Snjl    }
473117521Snjl
474117521Snjl    return (AE_OK);
475117521Snjl}
476117521Snjl
477117521Snjl
478117521Snjl/******************************************************************************
479117521Snjl *
480129684Snjl * FUNCTION:    AcpiHwEnableWakeupGpeBlock
48184491Smsmith *
482129684Snjl * PARAMETERS:  GpeXruptInfo        - GPE Interrupt info
483129684Snjl *              GpeBlock            - Gpe Block info
48484491Smsmith *
485128212Snjl * RETURN:      Status
48684491Smsmith *
487151937Sjkim * DESCRIPTION: Enable all "wake" GPEs within a single GPE block. Includes
488151937Sjkim *              combination wake/run GPEs.
48984491Smsmith *
49084491Smsmith ******************************************************************************/
49184491Smsmith
492151937Sjkimstatic ACPI_STATUS
493129684SnjlAcpiHwEnableWakeupGpeBlock (
494129684Snjl    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
495193267Sjkim    ACPI_GPE_BLOCK_INFO     *GpeBlock,
496193267Sjkim    void                    *Context)
49784491Smsmith{
498129684Snjl    UINT32                  i;
49999679Siwasaki    ACPI_STATUS             Status;
500281075Sdim    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
50184491Smsmith
50284491Smsmith
503129684Snjl    /* Examine each GPE Register within the block */
50491116Smsmith
505129684Snjl    for (i = 0; i < GpeBlock->RegisterCount; i++)
506129684Snjl    {
507281075Sdim        GpeRegisterInfo = &GpeBlock->RegisterInfo[i];
50891116Smsmith
509281075Sdim        /*
510281075Sdim         * Enable all "wake" GPEs in this register and disable the
511281075Sdim         * remaining ones.
512281075Sdim         */
513281075Sdim        Status = AcpiHwGpeEnableWrite (GpeRegisterInfo->EnableForWake,
514281075Sdim                    GpeRegisterInfo);
515129684Snjl        if (ACPI_FAILURE (Status))
516129684Snjl        {
517129684Snjl            return (Status);
518129684Snjl        }
519129684Snjl    }
520129684Snjl
521129684Snjl    return (AE_OK);
522117521Snjl}
52384491Smsmith
52499679Siwasaki
525117521Snjl/******************************************************************************
526117521Snjl *
527129684Snjl * FUNCTION:    AcpiHwDisableAllGpes
528117521Snjl *
529151937Sjkim * PARAMETERS:  None
530117521Snjl *
531117521Snjl * RETURN:      Status
532117521Snjl *
533151937Sjkim * DESCRIPTION: Disable and clear all GPEs in all GPE blocks
534117521Snjl *
535117521Snjl ******************************************************************************/
536114237Snjl
537129684SnjlACPI_STATUS
538129684SnjlAcpiHwDisableAllGpes (
539151937Sjkim    void)
540117521Snjl{
541117521Snjl    ACPI_STATUS             Status;
542114237Snjl
543117521Snjl
544167802Sjkim    ACPI_FUNCTION_TRACE (HwDisableAllGpes);
545117521Snjl
546117521Snjl
547193267Sjkim    Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, NULL);
548193267Sjkim    Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock, NULL);
549129684Snjl    return_ACPI_STATUS (Status);
550129684Snjl}
551117521Snjl
552117521Snjl
553129684Snjl/******************************************************************************
554129684Snjl *
555129684Snjl * FUNCTION:    AcpiHwEnableAllRuntimeGpes
556129684Snjl *
557151937Sjkim * PARAMETERS:  None
558129684Snjl *
559129684Snjl * RETURN:      Status
560129684Snjl *
561151937Sjkim * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks
562129684Snjl *
563129684Snjl ******************************************************************************/
564126372Snjl
565129684SnjlACPI_STATUS
566129684SnjlAcpiHwEnableAllRuntimeGpes (
567151937Sjkim    void)
568129684Snjl{
569129684Snjl    ACPI_STATUS             Status;
570126372Snjl
571114237Snjl
572167802Sjkim    ACPI_FUNCTION_TRACE (HwEnableAllRuntimeGpes);
573128212Snjl
574114237Snjl
575193267Sjkim    Status = AcpiEvWalkGpeList (AcpiHwEnableRuntimeGpeBlock, NULL);
576129684Snjl    return_ACPI_STATUS (Status);
57784491Smsmith}
57884491Smsmith
57991116Smsmith
58084491Smsmith/******************************************************************************
58184491Smsmith *
582129684Snjl * FUNCTION:    AcpiHwEnableAllWakeupGpes
58384491Smsmith *
584151937Sjkim * PARAMETERS:  None
58584491Smsmith *
586128212Snjl * RETURN:      Status
58784491Smsmith *
588151937Sjkim * DESCRIPTION: Enable all "wakeup" GPEs, in all GPE blocks
58984491Smsmith *
59084491Smsmith ******************************************************************************/
59184491Smsmith
59299679SiwasakiACPI_STATUS
593129684SnjlAcpiHwEnableAllWakeupGpes (
594151937Sjkim    void)
59584491Smsmith{
59699679Siwasaki    ACPI_STATUS             Status;
59784491Smsmith
59884491Smsmith
599167802Sjkim    ACPI_FUNCTION_TRACE (HwEnableAllWakeupGpes);
60091116Smsmith
60191116Smsmith
602193267Sjkim    Status = AcpiEvWalkGpeList (AcpiHwEnableWakeupGpeBlock, NULL);
603129684Snjl    return_ACPI_STATUS (Status);
60484491Smsmith}
605129684Snjl
606231844Sjkim#endif /* !ACPI_REDUCED_HARDWARE */
607