hwgpe.c revision 284583
167754Smsmith/******************************************************************************
267754Smsmith *
367754Smsmith * Module Name: hwgpe - Low level GPE enable/disable/clear functions
467754Smsmith *
567754Smsmith *****************************************************************************/
667754Smsmith
7217365Sjkim/*
8278970Sjkim * 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
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
211197104Sjkim    Status = AcpiHwWrite (RegisterBit,
212209746Sjkim                    &GpeRegisterInfo->StatusAddress);
21399679Siwasaki
21499679Siwasaki    return (Status);
21567754Smsmith}
21667754Smsmith
21767754Smsmith
21867754Smsmith/******************************************************************************
21967754Smsmith *
22067754Smsmith * FUNCTION:    AcpiHwGetGpeStatus
22167754Smsmith *
222128212Snjl * PARAMETERS:  GpeEventInfo        - Info block for the GPE to queried
223128212Snjl *              EventStatus         - Where the GPE status is returned
22467754Smsmith *
225128212Snjl * RETURN:      Status
22667754Smsmith *
22767754Smsmith * DESCRIPTION: Return the status of a single GPE.
22867754Smsmith *
22967754Smsmith ******************************************************************************/
23067754Smsmith
23199679SiwasakiACPI_STATUS
23267754SmsmithAcpiHwGetGpeStatus (
233117521Snjl    ACPI_GPE_EVENT_INFO     *GpeEventInfo,
23467754Smsmith    ACPI_EVENT_STATUS       *EventStatus)
23567754Smsmith{
236114237Snjl    UINT32                  InByte;
237209746Sjkim    UINT32                  RegisterBit;
23891116Smsmith    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
239209746Sjkim    ACPI_EVENT_STATUS       LocalEventStatus = 0;
24099679Siwasaki    ACPI_STATUS             Status;
24167754Smsmith
24280062Smsmith
24391116Smsmith    ACPI_FUNCTION_ENTRY ();
24483174Smsmith
24583174Smsmith
24667754Smsmith    if (!EventStatus)
24767754Smsmith    {
24899679Siwasaki        return (AE_BAD_PARAMETER);
24967754Smsmith    }
25067754Smsmith
251272444Sjkim    /* GPE currently handled? */
252272444Sjkim
253278970Sjkim    if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) !=
254272444Sjkim            ACPI_GPE_DISPATCH_NONE)
255272444Sjkim    {
256272444Sjkim        LocalEventStatus |= ACPI_EVENT_FLAG_HAS_HANDLER;
257272444Sjkim    }
258272444Sjkim
259114237Snjl    /* Get the info block for the entire GPE register */
26067754Smsmith
261114237Snjl    GpeRegisterInfo = GpeEventInfo->RegisterInfo;
26267754Smsmith
26391116Smsmith    /* Get the register bitmask for this GPE */
26491116Smsmith
265239340Sjkim    RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo);
26691116Smsmith
267129684Snjl    /* GPE currently enabled? (enabled for runtime?) */
26891116Smsmith
269129684Snjl    if (RegisterBit & GpeRegisterInfo->EnableForRun)
27099679Siwasaki    {
271114237Snjl        LocalEventStatus |= ACPI_EVENT_FLAG_ENABLED;
27267754Smsmith    }
27367754Smsmith
274129684Snjl    /* GPE enabled for wake? */
27591116Smsmith
276129684Snjl    if (RegisterBit & GpeRegisterInfo->EnableForWake)
27784491Smsmith    {
278114237Snjl        LocalEventStatus |= ACPI_EVENT_FLAG_WAKE_ENABLED;
27984491Smsmith    }
28084491Smsmith
281281396Sjkim    /* GPE currently enabled (enable bit == 1)? */
282281396Sjkim
283281396Sjkim    Status = AcpiHwRead (&InByte, &GpeRegisterInfo->EnableAddress);
284281396Sjkim    if (ACPI_FAILURE (Status))
285281396Sjkim    {
286281396Sjkim        return (Status);
287281396Sjkim    }
288281396Sjkim
289281396Sjkim    if (RegisterBit & InByte)
290281396Sjkim    {
291281396Sjkim        LocalEventStatus |= ACPI_EVENT_FLAG_ENABLE_SET;
292281396Sjkim    }
293281396Sjkim
294129684Snjl    /* GPE currently active (status bit == 1)? */
29591116Smsmith
296197104Sjkim    Status = AcpiHwRead (&InByte, &GpeRegisterInfo->StatusAddress);
29799679Siwasaki    if (ACPI_FAILURE (Status))
29899679Siwasaki    {
299202771Sjkim        return (Status);
30099679Siwasaki    }
30199679Siwasaki
302129684Snjl    if (RegisterBit & InByte)
30367754Smsmith    {
304281396Sjkim        LocalEventStatus |= ACPI_EVENT_FLAG_STATUS_SET;
30567754Smsmith    }
306114237Snjl
307114237Snjl    /* Set return value */
308114237Snjl
309114237Snjl    (*EventStatus) = LocalEventStatus;
310202771Sjkim    return (AE_OK);
311117521Snjl}
312117521Snjl
313117521Snjl
314117521Snjl/******************************************************************************
315117521Snjl *
316278970Sjkim * FUNCTION:    AcpiHwGpeEnableWrite
317278970Sjkim *
318278970Sjkim * PARAMETERS:  EnableMask          - Bit mask to write to the GPE register
319278970Sjkim *              GpeRegisterInfo     - Gpe Register info
320278970Sjkim *
321278970Sjkim * RETURN:      Status
322278970Sjkim *
323278970Sjkim * DESCRIPTION: Write the enable mask byte to the given GPE register.
324278970Sjkim *
325278970Sjkim ******************************************************************************/
326278970Sjkim
327278970Sjkimstatic ACPI_STATUS
328278970SjkimAcpiHwGpeEnableWrite (
329278970Sjkim    UINT8                   EnableMask,
330278970Sjkim    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo)
331278970Sjkim{
332278970Sjkim    ACPI_STATUS             Status;
333278970Sjkim
334278970Sjkim
335284583Sjkim    GpeRegisterInfo->EnableMask = EnableMask;
336278970Sjkim    Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress);
337278970Sjkim
338278970Sjkim    return (Status);
339278970Sjkim}
340278970Sjkim
341278970Sjkim
342278970Sjkim/******************************************************************************
343278970Sjkim *
344117521Snjl * FUNCTION:    AcpiHwDisableGpeBlock
345117521Snjl *
346117521Snjl * PARAMETERS:  GpeXruptInfo        - GPE Interrupt info
347117521Snjl *              GpeBlock            - Gpe Block info
348117521Snjl *
349117521Snjl * RETURN:      Status
350117521Snjl *
351151937Sjkim * DESCRIPTION: Disable all GPEs within a single GPE block
352117521Snjl *
353117521Snjl ******************************************************************************/
354117521Snjl
355117521SnjlACPI_STATUS
356117521SnjlAcpiHwDisableGpeBlock (
357117521Snjl    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
358193267Sjkim    ACPI_GPE_BLOCK_INFO     *GpeBlock,
359193267Sjkim    void                    *Context)
360117521Snjl{
361117521Snjl    UINT32                  i;
362117521Snjl    ACPI_STATUS             Status;
363117521Snjl
364117521Snjl
365117521Snjl    /* Examine each GPE Register within the block */
366117521Snjl
367117521Snjl    for (i = 0; i < GpeBlock->RegisterCount; i++)
368117521Snjl    {
369126372Snjl        /* Disable all GPEs in this register */
370126372Snjl
371278970Sjkim        Status = AcpiHwGpeEnableWrite (0x00, &GpeBlock->RegisterInfo[i]);
372117521Snjl        if (ACPI_FAILURE (Status))
373117521Snjl        {
374117521Snjl            return (Status);
375117521Snjl        }
376117521Snjl    }
377117521Snjl
37899679Siwasaki    return (AE_OK);
37967754Smsmith}
38084491Smsmith
38191116Smsmith
38284491Smsmith/******************************************************************************
38384491Smsmith *
384117521Snjl * FUNCTION:    AcpiHwClearGpeBlock
385117521Snjl *
386117521Snjl * PARAMETERS:  GpeXruptInfo        - GPE Interrupt info
387117521Snjl *              GpeBlock            - Gpe Block info
388117521Snjl *
389117521Snjl * RETURN:      Status
390117521Snjl *
391151937Sjkim * DESCRIPTION: Clear status bits for all GPEs within a single GPE block
392117521Snjl *
393117521Snjl ******************************************************************************/
394117521Snjl
395117521SnjlACPI_STATUS
396117521SnjlAcpiHwClearGpeBlock (
397117521Snjl    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
398193267Sjkim    ACPI_GPE_BLOCK_INFO     *GpeBlock,
399193267Sjkim    void                    *Context)
400117521Snjl{
401117521Snjl    UINT32                  i;
402117521Snjl    ACPI_STATUS             Status;
403117521Snjl
404117521Snjl
405117521Snjl    /* Examine each GPE Register within the block */
406117521Snjl
407117521Snjl    for (i = 0; i < GpeBlock->RegisterCount; i++)
408117521Snjl    {
409128212Snjl        /* Clear status on all GPEs in this register */
410126372Snjl
411197104Sjkim        Status = AcpiHwWrite (0xFF, &GpeBlock->RegisterInfo[i].StatusAddress);
412117521Snjl        if (ACPI_FAILURE (Status))
413117521Snjl        {
414117521Snjl            return (Status);
415117521Snjl        }
416117521Snjl    }
417117521Snjl
418117521Snjl    return (AE_OK);
419117521Snjl}
420117521Snjl
421117521Snjl
422117521Snjl/******************************************************************************
423117521Snjl *
424129684Snjl * FUNCTION:    AcpiHwEnableRuntimeGpeBlock
425117521Snjl *
426117521Snjl * PARAMETERS:  GpeXruptInfo        - GPE Interrupt info
427117521Snjl *              GpeBlock            - Gpe Block info
428117521Snjl *
429117521Snjl * RETURN:      Status
430117521Snjl *
431151937Sjkim * DESCRIPTION: Enable all "runtime" GPEs within a single GPE block. Includes
432151937Sjkim *              combination wake/run GPEs.
433117521Snjl *
434117521Snjl ******************************************************************************/
435117521Snjl
436129684SnjlACPI_STATUS
437129684SnjlAcpiHwEnableRuntimeGpeBlock (
438117521Snjl    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
439193267Sjkim    ACPI_GPE_BLOCK_INFO     *GpeBlock,
440193267Sjkim    void                    *Context)
441117521Snjl{
442117521Snjl    UINT32                  i;
443117521Snjl    ACPI_STATUS             Status;
444278970Sjkim    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
445117521Snjl
446117521Snjl
447129684Snjl    /* NOTE: assumes that all GPEs are currently disabled */
448117521Snjl
449117521Snjl    /* Examine each GPE Register within the block */
450117521Snjl
451117521Snjl    for (i = 0; i < GpeBlock->RegisterCount; i++)
452117521Snjl    {
453278970Sjkim        GpeRegisterInfo = &GpeBlock->RegisterInfo[i];
454278970Sjkim        if (!GpeRegisterInfo->EnableForRun)
455117521Snjl        {
456129684Snjl            continue;
457117521Snjl        }
458117521Snjl
459129684Snjl        /* Enable all "runtime" GPEs in this register */
460117521Snjl
461278970Sjkim        Status = AcpiHwGpeEnableWrite (GpeRegisterInfo->EnableForRun,
462278970Sjkim                    GpeRegisterInfo);
463117521Snjl        if (ACPI_FAILURE (Status))
464117521Snjl        {
465117521Snjl            return (Status);
466117521Snjl        }
467117521Snjl    }
468117521Snjl
469117521Snjl    return (AE_OK);
470117521Snjl}
471117521Snjl
472117521Snjl
473117521Snjl/******************************************************************************
474117521Snjl *
475129684Snjl * FUNCTION:    AcpiHwEnableWakeupGpeBlock
47684491Smsmith *
477129684Snjl * PARAMETERS:  GpeXruptInfo        - GPE Interrupt info
478129684Snjl *              GpeBlock            - Gpe Block info
47984491Smsmith *
480128212Snjl * RETURN:      Status
48184491Smsmith *
482151937Sjkim * DESCRIPTION: Enable all "wake" GPEs within a single GPE block. Includes
483151937Sjkim *              combination wake/run GPEs.
48484491Smsmith *
48584491Smsmith ******************************************************************************/
48684491Smsmith
487151937Sjkimstatic ACPI_STATUS
488129684SnjlAcpiHwEnableWakeupGpeBlock (
489129684Snjl    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
490193267Sjkim    ACPI_GPE_BLOCK_INFO     *GpeBlock,
491193267Sjkim    void                    *Context)
49284491Smsmith{
493129684Snjl    UINT32                  i;
49499679Siwasaki    ACPI_STATUS             Status;
495278970Sjkim    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
49684491Smsmith
49784491Smsmith
498129684Snjl    /* Examine each GPE Register within the block */
49991116Smsmith
500129684Snjl    for (i = 0; i < GpeBlock->RegisterCount; i++)
501129684Snjl    {
502278970Sjkim        GpeRegisterInfo = &GpeBlock->RegisterInfo[i];
50391116Smsmith
504278970Sjkim        /*
505278970Sjkim         * Enable all "wake" GPEs in this register and disable the
506278970Sjkim         * remaining ones.
507278970Sjkim         */
508278970Sjkim        Status = AcpiHwGpeEnableWrite (GpeRegisterInfo->EnableForWake,
509278970Sjkim                    GpeRegisterInfo);
510129684Snjl        if (ACPI_FAILURE (Status))
511129684Snjl        {
512129684Snjl            return (Status);
513129684Snjl        }
514129684Snjl    }
515129684Snjl
516129684Snjl    return (AE_OK);
517117521Snjl}
51884491Smsmith
51999679Siwasaki
520117521Snjl/******************************************************************************
521117521Snjl *
522129684Snjl * FUNCTION:    AcpiHwDisableAllGpes
523117521Snjl *
524151937Sjkim * PARAMETERS:  None
525117521Snjl *
526117521Snjl * RETURN:      Status
527117521Snjl *
528151937Sjkim * DESCRIPTION: Disable and clear all GPEs in all GPE blocks
529117521Snjl *
530117521Snjl ******************************************************************************/
531114237Snjl
532129684SnjlACPI_STATUS
533129684SnjlAcpiHwDisableAllGpes (
534151937Sjkim    void)
535117521Snjl{
536117521Snjl    ACPI_STATUS             Status;
537114237Snjl
538117521Snjl
539167802Sjkim    ACPI_FUNCTION_TRACE (HwDisableAllGpes);
540117521Snjl
541117521Snjl
542193267Sjkim    Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, NULL);
543193267Sjkim    Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock, NULL);
544129684Snjl    return_ACPI_STATUS (Status);
545129684Snjl}
546117521Snjl
547117521Snjl
548129684Snjl/******************************************************************************
549129684Snjl *
550129684Snjl * FUNCTION:    AcpiHwEnableAllRuntimeGpes
551129684Snjl *
552151937Sjkim * PARAMETERS:  None
553129684Snjl *
554129684Snjl * RETURN:      Status
555129684Snjl *
556151937Sjkim * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks
557129684Snjl *
558129684Snjl ******************************************************************************/
559126372Snjl
560129684SnjlACPI_STATUS
561129684SnjlAcpiHwEnableAllRuntimeGpes (
562151937Sjkim    void)
563129684Snjl{
564129684Snjl    ACPI_STATUS             Status;
565126372Snjl
566114237Snjl
567167802Sjkim    ACPI_FUNCTION_TRACE (HwEnableAllRuntimeGpes);
568128212Snjl
569114237Snjl
570193267Sjkim    Status = AcpiEvWalkGpeList (AcpiHwEnableRuntimeGpeBlock, NULL);
571129684Snjl    return_ACPI_STATUS (Status);
57284491Smsmith}
57384491Smsmith
57491116Smsmith
57584491Smsmith/******************************************************************************
57684491Smsmith *
577129684Snjl * FUNCTION:    AcpiHwEnableAllWakeupGpes
57884491Smsmith *
579151937Sjkim * PARAMETERS:  None
58084491Smsmith *
581128212Snjl * RETURN:      Status
58284491Smsmith *
583151937Sjkim * DESCRIPTION: Enable all "wakeup" GPEs, in all GPE blocks
58484491Smsmith *
58584491Smsmith ******************************************************************************/
58684491Smsmith
58799679SiwasakiACPI_STATUS
588129684SnjlAcpiHwEnableAllWakeupGpes (
589151937Sjkim    void)
59084491Smsmith{
59199679Siwasaki    ACPI_STATUS             Status;
59284491Smsmith
59384491Smsmith
594167802Sjkim    ACPI_FUNCTION_TRACE (HwEnableAllWakeupGpes);
59591116Smsmith
59691116Smsmith
597193267Sjkim    Status = AcpiEvWalkGpeList (AcpiHwEnableWakeupGpeBlock, NULL);
598129684Snjl    return_ACPI_STATUS (Status);
59984491Smsmith}
600129684Snjl
601231844Sjkim#endif /* !ACPI_REDUCED_HARDWARE */
602