167754Smsmith/******************************************************************************
267754Smsmith *
367754Smsmith * Module Name: hwgpe - Low level GPE enable/disable/clear functions
467754Smsmith *
567754Smsmith *****************************************************************************/
667754Smsmith
7217365Sjkim/*
8298714Sjkim * Copyright (C) 2000 - 2016, 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
61278970Sjkimstatic ACPI_STATUS
62278970SjkimAcpiHwGpeEnableWrite (
63278970Sjkim    UINT8                   EnableMask,
64278970Sjkim    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo);
65151937Sjkim
66278970Sjkim
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.
100284583Sjkim *              The EnableMask field of the involved GPE register must be
101284583Sjkim *              updated by the caller if necessary.
102193267Sjkim *
103193267Sjkim ******************************************************************************/
104193267Sjkim
105193267SjkimACPI_STATUS
106209746SjkimAcpiHwLowSetGpe (
107209746Sjkim    ACPI_GPE_EVENT_INFO     *GpeEventInfo,
108209746Sjkim    UINT32                  Action)
109193267Sjkim{
110193267Sjkim    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
111193267Sjkim    ACPI_STATUS             Status;
112193267Sjkim    UINT32                  EnableMask;
113209746Sjkim    UINT32                  RegisterBit;
114193267Sjkim
115193267Sjkim
116209746Sjkim    ACPI_FUNCTION_ENTRY ();
117209746Sjkim
118209746Sjkim
119193267Sjkim    /* Get the info block for the entire GPE register */
120193267Sjkim
121193267Sjkim    GpeRegisterInfo = GpeEventInfo->RegisterInfo;
122193267Sjkim    if (!GpeRegisterInfo)
123193267Sjkim    {
124193267Sjkim        return (AE_NOT_EXIST);
125193267Sjkim    }
126193267Sjkim
127193267Sjkim    /* Get current value of the enable register that contains this GPE */
128193267Sjkim
129197104Sjkim    Status = AcpiHwRead (&EnableMask, &GpeRegisterInfo->EnableAddress);
130193267Sjkim    if (ACPI_FAILURE (Status))
131193267Sjkim    {
132193267Sjkim        return (Status);
133193267Sjkim    }
134193267Sjkim
135209746Sjkim    /* Set or clear just the bit that corresponds to this GPE */
136193267Sjkim
137239340Sjkim    RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo);
138284583Sjkim    switch (Action)
139209746Sjkim    {
140209746Sjkim    case ACPI_GPE_CONDITIONAL_ENABLE:
141193267Sjkim
142278970Sjkim        /* Only enable if the corresponding EnableMask bit is set */
143193267Sjkim
144278970Sjkim        if (!(RegisterBit & GpeRegisterInfo->EnableMask))
145209746Sjkim        {
146209746Sjkim            return (AE_BAD_PARAMETER);
147209746Sjkim        }
148193267Sjkim
149209746Sjkim        /*lint -fallthrough */
150193267Sjkim
151209746Sjkim    case ACPI_GPE_ENABLE:
152250838Sjkim
153209746Sjkim        ACPI_SET_BIT (EnableMask, RegisterBit);
154209746Sjkim        break;
155193267Sjkim
156209746Sjkim    case ACPI_GPE_DISABLE:
157250838Sjkim
158209746Sjkim        ACPI_CLEAR_BIT (EnableMask, RegisterBit);
159209746Sjkim        break;
16067754Smsmith
161209746Sjkim    default:
162250838Sjkim
163245582Sjkim        ACPI_ERROR ((AE_INFO, "Invalid GPE Action, %u", Action));
164209746Sjkim        return (AE_BAD_PARAMETER);
165114237Snjl    }
16667754Smsmith
167209746Sjkim    /* Write the updated enable mask */
16884491Smsmith
169209746Sjkim    Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress);
170129684Snjl    return (Status);
17167754Smsmith}
17267754Smsmith
17391116Smsmith
17484491Smsmith/******************************************************************************
17584491Smsmith *
17667754Smsmith * FUNCTION:    AcpiHwClearGpe
17767754Smsmith *
178128212Snjl * PARAMETERS:  GpeEventInfo        - Info block for the GPE to be cleared
17967754Smsmith *
180138287Smarks * RETURN:      Status
18167754Smsmith *
182128212Snjl * DESCRIPTION: Clear the status bit for a single GPE.
18367754Smsmith *
18467754Smsmith ******************************************************************************/
18567754Smsmith
18699679SiwasakiACPI_STATUS
18767754SmsmithAcpiHwClearGpe (
188114237Snjl    ACPI_GPE_EVENT_INFO     *GpeEventInfo)
18967754Smsmith{
190209746Sjkim    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
19199679Siwasaki    ACPI_STATUS             Status;
192209746Sjkim    UINT32                  RegisterBit;
19367754Smsmith
19480062Smsmith
19591116Smsmith    ACPI_FUNCTION_ENTRY ();
19683174Smsmith
197209746Sjkim    /* Get the info block for the entire GPE register */
19883174Smsmith
199209746Sjkim    GpeRegisterInfo = GpeEventInfo->RegisterInfo;
200209746Sjkim    if (!GpeRegisterInfo)
201209746Sjkim    {
202209746Sjkim        return (AE_NOT_EXIST);
203209746Sjkim    }
204167802Sjkim
20567754Smsmith    /*
20667754Smsmith     * Write a one to the appropriate bit in the status register to
20767754Smsmith     * clear this GPE.
20867754Smsmith     */
209239340Sjkim    RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo);
210209746Sjkim
211298714Sjkim    Status = AcpiHwWrite (RegisterBit, &GpeRegisterInfo->StatusAddress);
21299679Siwasaki    return (Status);
21367754Smsmith}
21467754Smsmith
21567754Smsmith
21667754Smsmith/******************************************************************************
21767754Smsmith *
21867754Smsmith * FUNCTION:    AcpiHwGetGpeStatus
21967754Smsmith *
220128212Snjl * PARAMETERS:  GpeEventInfo        - Info block for the GPE to queried
221128212Snjl *              EventStatus         - Where the GPE status is returned
22267754Smsmith *
223128212Snjl * RETURN:      Status
22467754Smsmith *
22567754Smsmith * DESCRIPTION: Return the status of a single GPE.
22667754Smsmith *
22767754Smsmith ******************************************************************************/
22867754Smsmith
22999679SiwasakiACPI_STATUS
23067754SmsmithAcpiHwGetGpeStatus (
231117521Snjl    ACPI_GPE_EVENT_INFO     *GpeEventInfo,
23267754Smsmith    ACPI_EVENT_STATUS       *EventStatus)
23367754Smsmith{
234114237Snjl    UINT32                  InByte;
235209746Sjkim    UINT32                  RegisterBit;
23691116Smsmith    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
237209746Sjkim    ACPI_EVENT_STATUS       LocalEventStatus = 0;
23899679Siwasaki    ACPI_STATUS             Status;
23967754Smsmith
24080062Smsmith
24191116Smsmith    ACPI_FUNCTION_ENTRY ();
24283174Smsmith
24383174Smsmith
24467754Smsmith    if (!EventStatus)
24567754Smsmith    {
24699679Siwasaki        return (AE_BAD_PARAMETER);
24767754Smsmith    }
24867754Smsmith
249272444Sjkim    /* GPE currently handled? */
250272444Sjkim
251278970Sjkim    if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) !=
252298714Sjkim        ACPI_GPE_DISPATCH_NONE)
253272444Sjkim    {
254272444Sjkim        LocalEventStatus |= ACPI_EVENT_FLAG_HAS_HANDLER;
255272444Sjkim    }
256272444Sjkim
257114237Snjl    /* Get the info block for the entire GPE register */
25867754Smsmith
259114237Snjl    GpeRegisterInfo = GpeEventInfo->RegisterInfo;
26067754Smsmith
26191116Smsmith    /* Get the register bitmask for this GPE */
26291116Smsmith
263239340Sjkim    RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo);
26491116Smsmith
265129684Snjl    /* GPE currently enabled? (enabled for runtime?) */
26691116Smsmith
267129684Snjl    if (RegisterBit & GpeRegisterInfo->EnableForRun)
26899679Siwasaki    {
269114237Snjl        LocalEventStatus |= ACPI_EVENT_FLAG_ENABLED;
27067754Smsmith    }
27167754Smsmith
272129684Snjl    /* GPE enabled for wake? */
27391116Smsmith
274129684Snjl    if (RegisterBit & GpeRegisterInfo->EnableForWake)
27584491Smsmith    {
276114237Snjl        LocalEventStatus |= ACPI_EVENT_FLAG_WAKE_ENABLED;
27784491Smsmith    }
27884491Smsmith
279281396Sjkim    /* GPE currently enabled (enable bit == 1)? */
280281396Sjkim
281281396Sjkim    Status = AcpiHwRead (&InByte, &GpeRegisterInfo->EnableAddress);
282281396Sjkim    if (ACPI_FAILURE (Status))
283281396Sjkim    {
284281396Sjkim        return (Status);
285281396Sjkim    }
286281396Sjkim
287281396Sjkim    if (RegisterBit & InByte)
288281396Sjkim    {
289281396Sjkim        LocalEventStatus |= ACPI_EVENT_FLAG_ENABLE_SET;
290281396Sjkim    }
291281396Sjkim
292129684Snjl    /* GPE currently active (status bit == 1)? */
29391116Smsmith
294197104Sjkim    Status = AcpiHwRead (&InByte, &GpeRegisterInfo->StatusAddress);
29599679Siwasaki    if (ACPI_FAILURE (Status))
29699679Siwasaki    {
297202771Sjkim        return (Status);
29899679Siwasaki    }
29999679Siwasaki
300129684Snjl    if (RegisterBit & InByte)
30167754Smsmith    {
302281396Sjkim        LocalEventStatus |= ACPI_EVENT_FLAG_STATUS_SET;
30367754Smsmith    }
304114237Snjl
305114237Snjl    /* Set return value */
306114237Snjl
307114237Snjl    (*EventStatus) = LocalEventStatus;
308202771Sjkim    return (AE_OK);
309117521Snjl}
310117521Snjl
311117521Snjl
312117521Snjl/******************************************************************************
313117521Snjl *
314278970Sjkim * FUNCTION:    AcpiHwGpeEnableWrite
315278970Sjkim *
316278970Sjkim * PARAMETERS:  EnableMask          - Bit mask to write to the GPE register
317278970Sjkim *              GpeRegisterInfo     - Gpe Register info
318278970Sjkim *
319278970Sjkim * RETURN:      Status
320278970Sjkim *
321278970Sjkim * DESCRIPTION: Write the enable mask byte to the given GPE register.
322278970Sjkim *
323278970Sjkim ******************************************************************************/
324278970Sjkim
325278970Sjkimstatic ACPI_STATUS
326278970SjkimAcpiHwGpeEnableWrite (
327278970Sjkim    UINT8                   EnableMask,
328278970Sjkim    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo)
329278970Sjkim{
330278970Sjkim    ACPI_STATUS             Status;
331278970Sjkim
332278970Sjkim
333284583Sjkim    GpeRegisterInfo->EnableMask = EnableMask;
334298714Sjkim
335278970Sjkim    Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress);
336278970Sjkim    return (Status);
337278970Sjkim}
338278970Sjkim
339278970Sjkim
340278970Sjkim/******************************************************************************
341278970Sjkim *
342117521Snjl * FUNCTION:    AcpiHwDisableGpeBlock
343117521Snjl *
344117521Snjl * PARAMETERS:  GpeXruptInfo        - GPE Interrupt info
345117521Snjl *              GpeBlock            - Gpe Block info
346117521Snjl *
347117521Snjl * RETURN:      Status
348117521Snjl *
349151937Sjkim * DESCRIPTION: Disable all GPEs within a single GPE block
350117521Snjl *
351117521Snjl ******************************************************************************/
352117521Snjl
353117521SnjlACPI_STATUS
354117521SnjlAcpiHwDisableGpeBlock (
355117521Snjl    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
356193267Sjkim    ACPI_GPE_BLOCK_INFO     *GpeBlock,
357193267Sjkim    void                    *Context)
358117521Snjl{
359117521Snjl    UINT32                  i;
360117521Snjl    ACPI_STATUS             Status;
361117521Snjl
362117521Snjl
363117521Snjl    /* Examine each GPE Register within the block */
364117521Snjl
365117521Snjl    for (i = 0; i < GpeBlock->RegisterCount; i++)
366117521Snjl    {
367126372Snjl        /* Disable all GPEs in this register */
368126372Snjl
369278970Sjkim        Status = AcpiHwGpeEnableWrite (0x00, &GpeBlock->RegisterInfo[i]);
370117521Snjl        if (ACPI_FAILURE (Status))
371117521Snjl        {
372117521Snjl            return (Status);
373117521Snjl        }
374117521Snjl    }
375117521Snjl
37699679Siwasaki    return (AE_OK);
37767754Smsmith}
37884491Smsmith
37991116Smsmith
38084491Smsmith/******************************************************************************
38184491Smsmith *
382117521Snjl * FUNCTION:    AcpiHwClearGpeBlock
383117521Snjl *
384117521Snjl * PARAMETERS:  GpeXruptInfo        - GPE Interrupt info
385117521Snjl *              GpeBlock            - Gpe Block info
386117521Snjl *
387117521Snjl * RETURN:      Status
388117521Snjl *
389151937Sjkim * DESCRIPTION: Clear status bits for all GPEs within a single GPE block
390117521Snjl *
391117521Snjl ******************************************************************************/
392117521Snjl
393117521SnjlACPI_STATUS
394117521SnjlAcpiHwClearGpeBlock (
395117521Snjl    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
396193267Sjkim    ACPI_GPE_BLOCK_INFO     *GpeBlock,
397193267Sjkim    void                    *Context)
398117521Snjl{
399117521Snjl    UINT32                  i;
400117521Snjl    ACPI_STATUS             Status;
401117521Snjl
402117521Snjl
403117521Snjl    /* Examine each GPE Register within the block */
404117521Snjl
405117521Snjl    for (i = 0; i < GpeBlock->RegisterCount; i++)
406117521Snjl    {
407128212Snjl        /* Clear status on all GPEs in this register */
408126372Snjl
409197104Sjkim        Status = AcpiHwWrite (0xFF, &GpeBlock->RegisterInfo[i].StatusAddress);
410117521Snjl        if (ACPI_FAILURE (Status))
411117521Snjl        {
412117521Snjl            return (Status);
413117521Snjl        }
414117521Snjl    }
415117521Snjl
416117521Snjl    return (AE_OK);
417117521Snjl}
418117521Snjl
419117521Snjl
420117521Snjl/******************************************************************************
421117521Snjl *
422129684Snjl * FUNCTION:    AcpiHwEnableRuntimeGpeBlock
423117521Snjl *
424117521Snjl * PARAMETERS:  GpeXruptInfo        - GPE Interrupt info
425117521Snjl *              GpeBlock            - Gpe Block info
426117521Snjl *
427117521Snjl * RETURN:      Status
428117521Snjl *
429151937Sjkim * DESCRIPTION: Enable all "runtime" GPEs within a single GPE block. Includes
430151937Sjkim *              combination wake/run GPEs.
431117521Snjl *
432117521Snjl ******************************************************************************/
433117521Snjl
434129684SnjlACPI_STATUS
435129684SnjlAcpiHwEnableRuntimeGpeBlock (
436117521Snjl    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
437193267Sjkim    ACPI_GPE_BLOCK_INFO     *GpeBlock,
438193267Sjkim    void                    *Context)
439117521Snjl{
440117521Snjl    UINT32                  i;
441117521Snjl    ACPI_STATUS             Status;
442278970Sjkim    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
443117521Snjl
444117521Snjl
445129684Snjl    /* NOTE: assumes that all GPEs are currently disabled */
446117521Snjl
447117521Snjl    /* Examine each GPE Register within the block */
448117521Snjl
449117521Snjl    for (i = 0; i < GpeBlock->RegisterCount; i++)
450117521Snjl    {
451278970Sjkim        GpeRegisterInfo = &GpeBlock->RegisterInfo[i];
452278970Sjkim        if (!GpeRegisterInfo->EnableForRun)
453117521Snjl        {
454129684Snjl            continue;
455117521Snjl        }
456117521Snjl
457129684Snjl        /* Enable all "runtime" GPEs in this register */
458117521Snjl
459278970Sjkim        Status = AcpiHwGpeEnableWrite (GpeRegisterInfo->EnableForRun,
460298714Sjkim            GpeRegisterInfo);
461117521Snjl        if (ACPI_FAILURE (Status))
462117521Snjl        {
463117521Snjl            return (Status);
464117521Snjl        }
465117521Snjl    }
466117521Snjl
467117521Snjl    return (AE_OK);
468117521Snjl}
469117521Snjl
470117521Snjl
471117521Snjl/******************************************************************************
472117521Snjl *
473129684Snjl * FUNCTION:    AcpiHwEnableWakeupGpeBlock
47484491Smsmith *
475129684Snjl * PARAMETERS:  GpeXruptInfo        - GPE Interrupt info
476129684Snjl *              GpeBlock            - Gpe Block info
47784491Smsmith *
478128212Snjl * RETURN:      Status
47984491Smsmith *
480151937Sjkim * DESCRIPTION: Enable all "wake" GPEs within a single GPE block. Includes
481151937Sjkim *              combination wake/run GPEs.
48284491Smsmith *
48384491Smsmith ******************************************************************************/
48484491Smsmith
485151937Sjkimstatic ACPI_STATUS
486129684SnjlAcpiHwEnableWakeupGpeBlock (
487129684Snjl    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
488193267Sjkim    ACPI_GPE_BLOCK_INFO     *GpeBlock,
489193267Sjkim    void                    *Context)
49084491Smsmith{
491129684Snjl    UINT32                  i;
49299679Siwasaki    ACPI_STATUS             Status;
493278970Sjkim    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
49484491Smsmith
49584491Smsmith
496129684Snjl    /* Examine each GPE Register within the block */
49791116Smsmith
498129684Snjl    for (i = 0; i < GpeBlock->RegisterCount; i++)
499129684Snjl    {
500278970Sjkim        GpeRegisterInfo = &GpeBlock->RegisterInfo[i];
50191116Smsmith
502278970Sjkim        /*
503278970Sjkim         * Enable all "wake" GPEs in this register and disable the
504278970Sjkim         * remaining ones.
505278970Sjkim         */
506278970Sjkim        Status = AcpiHwGpeEnableWrite (GpeRegisterInfo->EnableForWake,
507298714Sjkim            GpeRegisterInfo);
508129684Snjl        if (ACPI_FAILURE (Status))
509129684Snjl        {
510129684Snjl            return (Status);
511129684Snjl        }
512129684Snjl    }
513129684Snjl
514129684Snjl    return (AE_OK);
515117521Snjl}
51684491Smsmith
51799679Siwasaki
518117521Snjl/******************************************************************************
519117521Snjl *
520129684Snjl * FUNCTION:    AcpiHwDisableAllGpes
521117521Snjl *
522151937Sjkim * PARAMETERS:  None
523117521Snjl *
524117521Snjl * RETURN:      Status
525117521Snjl *
526151937Sjkim * DESCRIPTION: Disable and clear all GPEs in all GPE blocks
527117521Snjl *
528117521Snjl ******************************************************************************/
529114237Snjl
530129684SnjlACPI_STATUS
531129684SnjlAcpiHwDisableAllGpes (
532151937Sjkim    void)
533117521Snjl{
534117521Snjl    ACPI_STATUS             Status;
535114237Snjl
536117521Snjl
537167802Sjkim    ACPI_FUNCTION_TRACE (HwDisableAllGpes);
538117521Snjl
539117521Snjl
540193267Sjkim    Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, NULL);
541193267Sjkim    Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock, NULL);
542129684Snjl    return_ACPI_STATUS (Status);
543129684Snjl}
544117521Snjl
545117521Snjl
546129684Snjl/******************************************************************************
547129684Snjl *
548129684Snjl * FUNCTION:    AcpiHwEnableAllRuntimeGpes
549129684Snjl *
550151937Sjkim * PARAMETERS:  None
551129684Snjl *
552129684Snjl * RETURN:      Status
553129684Snjl *
554151937Sjkim * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks
555129684Snjl *
556129684Snjl ******************************************************************************/
557126372Snjl
558129684SnjlACPI_STATUS
559129684SnjlAcpiHwEnableAllRuntimeGpes (
560151937Sjkim    void)
561129684Snjl{
562129684Snjl    ACPI_STATUS             Status;
563126372Snjl
564114237Snjl
565167802Sjkim    ACPI_FUNCTION_TRACE (HwEnableAllRuntimeGpes);
566128212Snjl
567114237Snjl
568193267Sjkim    Status = AcpiEvWalkGpeList (AcpiHwEnableRuntimeGpeBlock, NULL);
569129684Snjl    return_ACPI_STATUS (Status);
57084491Smsmith}
57184491Smsmith
57291116Smsmith
57384491Smsmith/******************************************************************************
57484491Smsmith *
575129684Snjl * FUNCTION:    AcpiHwEnableAllWakeupGpes
57684491Smsmith *
577151937Sjkim * PARAMETERS:  None
57884491Smsmith *
579128212Snjl * RETURN:      Status
58084491Smsmith *
581151937Sjkim * DESCRIPTION: Enable all "wakeup" GPEs, in all GPE blocks
58284491Smsmith *
58384491Smsmith ******************************************************************************/
58484491Smsmith
58599679SiwasakiACPI_STATUS
586129684SnjlAcpiHwEnableAllWakeupGpes (
587151937Sjkim    void)
58884491Smsmith{
58999679Siwasaki    ACPI_STATUS             Status;
59084491Smsmith
59184491Smsmith
592167802Sjkim    ACPI_FUNCTION_TRACE (HwEnableAllWakeupGpes);
59391116Smsmith
59491116Smsmith
595193267Sjkim    Status = AcpiEvWalkGpeList (AcpiHwEnableWakeupGpeBlock, NULL);
596129684Snjl    return_ACPI_STATUS (Status);
59784491Smsmith}
598129684Snjl
599231844Sjkim#endif /* !ACPI_REDUCED_HARDWARE */
600