hwgpe.c revision 197104
167754Smsmith
267754Smsmith/******************************************************************************
367754Smsmith *
467754Smsmith * Module Name: hwgpe - Low level GPE enable/disable/clear functions
567754Smsmith *
667754Smsmith *****************************************************************************/
7217365Sjkim
8281075Sdim/******************************************************************************
970243Smsmith *
1067754Smsmith * 1. Copyright Notice
11217365Sjkim *
12217365Sjkim * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
13217365Sjkim * All rights reserved.
14217365Sjkim *
15217365Sjkim * 2. License
16217365Sjkim *
17217365Sjkim * 2.1. This is your license from Intel Corp. under its intellectual property
18217365Sjkim * rights.  You may have additional license terms from the party that provided
19217365Sjkim * you this software, covering your right to use that party's intellectual
20217365Sjkim * property rights.
21217365Sjkim *
22217365Sjkim * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23217365Sjkim * copy of the source code appearing in this file ("Covered Code") an
24217365Sjkim * irrevocable, perpetual, worldwide license under Intel's copyrights in the
2567754Smsmith * base code distributed originally by Intel ("Original Intel Code") to copy,
26217365Sjkim * make derivatives, distribute, use and display any portion of the Covered
27217365Sjkim * Code in any form, with the right to sublicense such rights; and
28217365Sjkim *
2967754Smsmith * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30217365Sjkim * license (with the right to sublicense), under only those claims of Intel
31217365Sjkim * patents that are infringed by the Original Intel Code, to make, use, sell,
32217365Sjkim * offer to sell, and import the Covered Code and derivative works thereof
33217365Sjkim * solely to the minimum extent necessary to exercise the above copyright
34217365Sjkim * license, and in no event shall the patent license extend to any additions
35217365Sjkim * to or modifications of the Original Intel Code.  No other license or right
36217365Sjkim * is granted directly or by implication, estoppel or otherwise;
37217365Sjkim *
38217365Sjkim * The above copyright and patent license is granted only if the following
39217365Sjkim * conditions are met:
40217365Sjkim *
41217365Sjkim * 3. Conditions
42217365Sjkim *
4367754Smsmith * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44193341Sjkim * Redistribution of source code of any substantial portion of the Covered
45193341Sjkim * Code or modification with rights to further distribute source must include
46193341Sjkim * the above Copyright Notice, the above License, this list of Conditions,
4767754Smsmith * and the following Disclaimer and Export Compliance provision.  In addition,
4877424Smsmith * Licensee must cause all Covered Code to which Licensee contributes to
4991116Smsmith * contain a file documenting the changes Licensee made to create that Covered
5067754Smsmith * Code and the date of any change.  Licensee must include in that file the
51231844Sjkim * documentation of any changes made by any predecessor Licensee.  Licensee
52231844Sjkim * must include a prominent statement that the modification is derived,
53151937Sjkim * directly or indirectly, from Original Intel Code.
5467754Smsmith *
55151937Sjkim * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56151937Sjkim * Redistribution of source code of any substantial portion of the Covered
57151937Sjkim * Code or modification without rights to further distribute source must
58193267Sjkim * include the following Disclaimer and Export Compliance provision in the
59193267Sjkim * documentation and/or other materials provided with distribution.  In
60151937Sjkim * addition, Licensee may not authorize further sublicense of source of any
61281075Sdim * portion of the Covered Code, and must include terms to the effect that the
62281075Sdim * license from Licensee to its licensee is limited to the intellectual
63281075Sdim * property embodied in the software Licensee provides to its licensee, and
64281075Sdim * not to intellectual property embodied in modifications its licensee may
65151937Sjkim * make.
66281075Sdim *
6767754Smsmith * 3.3. Redistribution of Executable. Redistribution in executable form of any
6867754Smsmith * substantial portion of the Covered Code or modification must reproduce the
69209746Sjkim * above Copyright Notice, and the following Disclaimer and Export Compliance
70193267Sjkim * provision in the documentation and/or other materials provided with the
71209746Sjkim * distribution.
72209746Sjkim *
73209746Sjkim * 3.4. Intel retains all right, title, and interest in and to the Original
74209746Sjkim * Intel Code.
75209746Sjkim *
76209746Sjkim * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77209746Sjkim * Intel shall be used in advertising or otherwise to promote the sale, use or
78209746Sjkim * other dealings in products derived from or relating to the Covered Code
79209746Sjkim * without prior written authorization from Intel.
80209746Sjkim *
81209746Sjkim * 4. Disclaimer and Export Compliance
82239340Sjkim *
83209746Sjkim * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84209746Sjkim * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85209746Sjkim * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
86239340Sjkim * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
87209746Sjkim * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
88209746Sjkim * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89209746Sjkim * PARTICULAR PURPOSE.
90209746Sjkim *
91209746Sjkim * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92209746Sjkim * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93209746Sjkim * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94193267Sjkim * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95209746Sjkim * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96193267Sjkim * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
97193267Sjkim * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98193267Sjkim * LIMITED REMEDY.
99209746Sjkim *
100193267Sjkim * 4.3. Licensee shall not export, either directly or indirectly, any of this
101193267Sjkim * software or system incorporating such software without first obtaining any
102193267Sjkim * required license or other approval from the U. S. Department of Commerce or
103193267Sjkim * any other agency or department of the United States Government.  In the
104209746Sjkim * event Licensee exports any such software from the United States or
105209746Sjkim * re-exports any such software from a foreign destination, Licensee shall
106209746Sjkim * ensure that the distribution and export/re-export of the software is in
107193267Sjkim * compliance with all laws, regulations, orders, or other restrictions of the
108193267Sjkim * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109193267Sjkim * any of its subsidiaries will export/re-export any technical data, process,
110193267Sjkim * software, or service, directly or indirectly, to any country for which the
111209746Sjkim * United States government or any agency thereof requires an export license,
112193267Sjkim * other governmental approval, or letter of assurance, without first obtaining
113193267Sjkim * such license, approval or letter.
114209746Sjkim *
115209746Sjkim *****************************************************************************/
116209746Sjkim
117193267Sjkim#include <contrib/dev/acpica/include/acpi.h>
118193267Sjkim#include <contrib/dev/acpica/include/accommon.h>
119193267Sjkim#include <contrib/dev/acpica/include/acevents.h>
120193267Sjkim
121193267Sjkim#define _COMPONENT          ACPI_HARDWARE
122193267Sjkim        ACPI_MODULE_NAME    ("hwgpe")
123193267Sjkim
124193267Sjkim/* Local prototypes */
125193267Sjkim
126193267Sjkimstatic ACPI_STATUS
127197104SjkimAcpiHwEnableWakeupGpeBlock (
128193267Sjkim    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
129193267Sjkim    ACPI_GPE_BLOCK_INFO     *GpeBlock,
130193267Sjkim    void                    *Context);
131193267Sjkim
132193267Sjkim
133209746Sjkim/******************************************************************************
134193267Sjkim *
135239340Sjkim * FUNCTION:    AcpiHwLowDisableGpe
136281075Sdim *
137209746Sjkim * PARAMETERS:  GpeEventInfo        - Info block for the GPE to be disabled
138209746Sjkim *
139193267Sjkim * RETURN:      Status
140281075Sdim *
141193267Sjkim * DESCRIPTION: Disable a single GPE in the enable register.
142281075Sdim *
143209746Sjkim ******************************************************************************/
144209746Sjkim
145209746SjkimACPI_STATUS
146193267SjkimAcpiHwLowDisableGpe (
147209746Sjkim    ACPI_GPE_EVENT_INFO     *GpeEventInfo)
148193267Sjkim{
149209746Sjkim    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
150250838Sjkim    ACPI_STATUS             Status;
151209746Sjkim    UINT32                  EnableMask;
152209746Sjkim
153193267Sjkim
154209746Sjkim    /* Get the info block for the entire GPE register */
155250838Sjkim
156209746Sjkim    GpeRegisterInfo = GpeEventInfo->RegisterInfo;
157209746Sjkim    if (!GpeRegisterInfo)
15867754Smsmith    {
159209746Sjkim        return (AE_NOT_EXIST);
160250838Sjkim    }
161245582Sjkim
162209746Sjkim    /* Get current value of the enable register that contains this GPE */
163114237Snjl
16467754Smsmith    Status = AcpiHwRead (&EnableMask, &GpeRegisterInfo->EnableAddress);
165209746Sjkim    if (ACPI_FAILURE (Status))
16684491Smsmith    {
167209746Sjkim        return (Status);
168281075Sdim    }
169281075Sdim
170281075Sdim    /* Clear just the bit that corresponds to this GPE */
171281075Sdim
172129684Snjl    ACPI_CLEAR_BIT (EnableMask, ((UINT32) 1 <<
17367754Smsmith        (GpeEventInfo->GpeNumber - GpeRegisterInfo->BaseGpeNumber)));
17467754Smsmith
17591116Smsmith
17684491Smsmith    /* Write the updated enable mask */
17784491Smsmith
17867754Smsmith    Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress);
17967754Smsmith    return (Status);
180128212Snjl}
18167754Smsmith
182138287Smarks
18367754Smsmith/******************************************************************************
184128212Snjl *
18567754Smsmith * FUNCTION:    AcpiHwWriteGpeEnableReg
18667754Smsmith *
18767754Smsmith * PARAMETERS:  GpeEventInfo        - Info block for the GPE to be enabled
18899679Siwasaki *
18967754Smsmith * RETURN:      Status
190114237Snjl *
19167754Smsmith * DESCRIPTION: Write a GPE enable register.  Note: The bit for this GPE must
192209746Sjkim *              already be cleared or set in the parent register
19399679Siwasaki *              EnableForRun mask.
194209746Sjkim *
19567754Smsmith ******************************************************************************/
19680062Smsmith
19791116SmsmithACPI_STATUS
19883174SmsmithAcpiHwWriteGpeEnableReg (
199209746Sjkim    ACPI_GPE_EVENT_INFO     *GpeEventInfo)
20083174Smsmith{
201209746Sjkim    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
202209746Sjkim    ACPI_STATUS             Status;
203209746Sjkim
204209746Sjkim
205209746Sjkim    ACPI_FUNCTION_ENTRY ();
206167802Sjkim
20767754Smsmith
20867754Smsmith    /* Get the info block for the entire GPE register */
20967754Smsmith
21067754Smsmith    GpeRegisterInfo = GpeEventInfo->RegisterInfo;
211239340Sjkim    if (!GpeRegisterInfo)
212209746Sjkim    {
213197104Sjkim        return (AE_NOT_EXIST);
214209746Sjkim    }
21599679Siwasaki
21699679Siwasaki    /* Write the entire GPE (runtime) enable register */
21767754Smsmith
21867754Smsmith    Status = AcpiHwWrite (GpeRegisterInfo->EnableForRun,
21967754Smsmith                    &GpeRegisterInfo->EnableAddress);
22067754Smsmith
22167754Smsmith    return (Status);
22267754Smsmith}
22367754Smsmith
224128212Snjl
225128212Snjl/******************************************************************************
22667754Smsmith *
227128212Snjl * FUNCTION:    AcpiHwClearGpe
22867754Smsmith *
22967754Smsmith * PARAMETERS:  GpeEventInfo        - Info block for the GPE to be cleared
23067754Smsmith *
23167754Smsmith * RETURN:      Status
23267754Smsmith *
23399679Siwasaki * DESCRIPTION: Clear the status bit for a single GPE.
23467754Smsmith *
235117521Snjl ******************************************************************************/
23667754Smsmith
23767754SmsmithACPI_STATUS
238114237SnjlAcpiHwClearGpe (
239209746Sjkim    ACPI_GPE_EVENT_INFO     *GpeEventInfo)
24091116Smsmith{
241209746Sjkim    ACPI_STATUS             Status;
24299679Siwasaki    UINT8                   RegisterBit;
24367754Smsmith
24480062Smsmith
24591116Smsmith    ACPI_FUNCTION_ENTRY ();
24683174Smsmith
24783174Smsmith
24867754Smsmith    RegisterBit = (UINT8) (1 <<
24967754Smsmith        (GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber));
25099679Siwasaki
25167754Smsmith    /*
25267754Smsmith     * Write a one to the appropriate bit in the status register to
253281075Sdim     * clear this GPE.
254281075Sdim     */
255281075Sdim    Status = AcpiHwWrite (RegisterBit,
256281075Sdim                    &GpeEventInfo->RegisterInfo->StatusAddress);
257281075Sdim
258281075Sdim    return (Status);
259281075Sdim}
260281075Sdim
261114237Snjl
26267754Smsmith/******************************************************************************
263114237Snjl *
26467754Smsmith * FUNCTION:    AcpiHwGetGpeStatus
26591116Smsmith *
26691116Smsmith * PARAMETERS:  GpeEventInfo        - Info block for the GPE to queried
267239340Sjkim *              EventStatus         - Where the GPE status is returned
26891116Smsmith *
269129684Snjl * RETURN:      Status
27091116Smsmith *
271129684Snjl * DESCRIPTION: Return the status of a single GPE.
27299679Siwasaki *
273114237Snjl ******************************************************************************/
27467754Smsmith
27567754SmsmithACPI_STATUS
276129684SnjlAcpiHwGetGpeStatus (
27791116Smsmith    ACPI_GPE_EVENT_INFO     *GpeEventInfo,
278129684Snjl    ACPI_EVENT_STATUS       *EventStatus)
27984491Smsmith{
280114237Snjl    UINT32                  InByte;
28184491Smsmith    UINT8                   RegisterBit;
28284491Smsmith    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
283129684Snjl    ACPI_STATUS             Status;
28491116Smsmith    ACPI_EVENT_STATUS       LocalEventStatus = 0;
285197104Sjkim
28699679Siwasaki
28799679Siwasaki    ACPI_FUNCTION_ENTRY ();
288202771Sjkim
28999679Siwasaki
29099679Siwasaki    if (!EventStatus)
291129684Snjl    {
29267754Smsmith        return (AE_BAD_PARAMETER);
293114237Snjl    }
29467754Smsmith
295114237Snjl    /* Get the info block for the entire GPE register */
296114237Snjl
297114237Snjl    GpeRegisterInfo = GpeEventInfo->RegisterInfo;
298114237Snjl
299202771Sjkim    /* Get the register bitmask for this GPE */
300117521Snjl
301117521Snjl    RegisterBit = (UINT8) (1 <<
302117521Snjl        (GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber));
303117521Snjl
304117521Snjl    /* GPE currently enabled? (enabled for runtime?) */
305281075Sdim
306281075Sdim    if (RegisterBit & GpeRegisterInfo->EnableForRun)
307281075Sdim    {
308281075Sdim        LocalEventStatus |= ACPI_EVENT_FLAG_ENABLED;
309281075Sdim    }
310281075Sdim
311281075Sdim    /* GPE enabled for wake? */
312281075Sdim
313281075Sdim    if (RegisterBit & GpeRegisterInfo->EnableForWake)
314281075Sdim    {
315281075Sdim        LocalEventStatus |= ACPI_EVENT_FLAG_WAKE_ENABLED;
316281075Sdim    }
317281075Sdim
318281075Sdim    /* GPE currently active (status bit == 1)? */
319281075Sdim
320281075Sdim    Status = AcpiHwRead (&InByte, &GpeRegisterInfo->StatusAddress);
321281075Sdim    if (ACPI_FAILURE (Status))
322281075Sdim    {
323281075Sdim        goto UnlockAndExit;
324281075Sdim    }
325281075Sdim
326281075Sdim    if (RegisterBit & InByte)
327281075Sdim    {
328281075Sdim        LocalEventStatus |= ACPI_EVENT_FLAG_SET;
329281075Sdim    }
330281075Sdim
331281075Sdim    /* Set return value */
332281075Sdim
333281075Sdim    (*EventStatus) = LocalEventStatus;
334281075Sdim
335281075Sdim
336117521SnjlUnlockAndExit:
337117521Snjl    return (Status);
338117521Snjl}
339117521Snjl
340117521Snjl
341117521Snjl/******************************************************************************
342117521Snjl *
343151937Sjkim * FUNCTION:    AcpiHwDisableGpeBlock
344117521Snjl *
345117521Snjl * PARAMETERS:  GpeXruptInfo        - GPE Interrupt info
346117521Snjl *              GpeBlock            - Gpe Block info
347117521Snjl *
348117521Snjl * RETURN:      Status
349117521Snjl *
350193267Sjkim * DESCRIPTION: Disable all GPEs within a single GPE block
351193267Sjkim *
352117521Snjl ******************************************************************************/
353117521Snjl
354117521SnjlACPI_STATUS
355117521SnjlAcpiHwDisableGpeBlock (
356117521Snjl    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
357117521Snjl    ACPI_GPE_BLOCK_INFO     *GpeBlock,
358117521Snjl    void                    *Context)
359117521Snjl{
360117521Snjl    UINT32                  i;
361126372Snjl    ACPI_STATUS             Status;
362126372Snjl
363281075Sdim
364117521Snjl    /* Examine each GPE Register within the block */
365117521Snjl
366117521Snjl    for (i = 0; i < GpeBlock->RegisterCount; i++)
367117521Snjl    {
368117521Snjl        /* Disable all GPEs in this register */
369117521Snjl
37099679Siwasaki        Status = AcpiHwWrite (0x00, &GpeBlock->RegisterInfo[i].EnableAddress);
37167754Smsmith        if (ACPI_FAILURE (Status))
37284491Smsmith        {
37391116Smsmith            return (Status);
37484491Smsmith        }
37584491Smsmith    }
376117521Snjl
377117521Snjl    return (AE_OK);
378117521Snjl}
379117521Snjl
380117521Snjl
381117521Snjl/******************************************************************************
382117521Snjl *
383151937Sjkim * FUNCTION:    AcpiHwClearGpeBlock
384117521Snjl *
385117521Snjl * PARAMETERS:  GpeXruptInfo        - GPE Interrupt info
386117521Snjl *              GpeBlock            - Gpe Block info
387117521Snjl *
388117521Snjl * RETURN:      Status
389117521Snjl *
390193267Sjkim * DESCRIPTION: Clear status bits for all GPEs within a single GPE block
391193267Sjkim *
392117521Snjl ******************************************************************************/
393117521Snjl
394117521SnjlACPI_STATUS
395117521SnjlAcpiHwClearGpeBlock (
396117521Snjl    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
397117521Snjl    ACPI_GPE_BLOCK_INFO     *GpeBlock,
398117521Snjl    void                    *Context)
399117521Snjl{
400117521Snjl    UINT32                  i;
401128212Snjl    ACPI_STATUS             Status;
402126372Snjl
403197104Sjkim
404117521Snjl    /* Examine each GPE Register within the block */
405117521Snjl
406117521Snjl    for (i = 0; i < GpeBlock->RegisterCount; i++)
407117521Snjl    {
408117521Snjl        /* Clear status on all GPEs in this register */
409117521Snjl
410117521Snjl        Status = AcpiHwWrite (0xFF, &GpeBlock->RegisterInfo[i].StatusAddress);
411117521Snjl        if (ACPI_FAILURE (Status))
412117521Snjl        {
413117521Snjl            return (Status);
414117521Snjl        }
415117521Snjl    }
416129684Snjl
417117521Snjl    return (AE_OK);
418117521Snjl}
419117521Snjl
420117521Snjl
421117521Snjl/******************************************************************************
422117521Snjl *
423151937Sjkim * FUNCTION:    AcpiHwEnableRuntimeGpeBlock
424151937Sjkim *
425117521Snjl * PARAMETERS:  GpeXruptInfo        - GPE Interrupt info
426117521Snjl *              GpeBlock            - Gpe Block info
427117521Snjl *
428129684Snjl * RETURN:      Status
429129684Snjl *
430117521Snjl * DESCRIPTION: Enable all "runtime" GPEs within a single GPE block. Includes
431193267Sjkim *              combination wake/run GPEs.
432193267Sjkim *
433117521Snjl ******************************************************************************/
434117521Snjl
435117521SnjlACPI_STATUS
436281075SdimAcpiHwEnableRuntimeGpeBlock (
437117521Snjl    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
438117521Snjl    ACPI_GPE_BLOCK_INFO     *GpeBlock,
439129684Snjl    void                    *Context)
440117521Snjl{
441117521Snjl    UINT32                  i;
442117521Snjl    ACPI_STATUS             Status;
443117521Snjl
444117521Snjl
445281075Sdim    /* NOTE: assumes that all GPEs are currently disabled */
446281075Sdim
447117521Snjl    /* Examine each GPE Register within the block */
448129684Snjl
449117521Snjl    for (i = 0; i < GpeBlock->RegisterCount; i++)
450117521Snjl    {
451129684Snjl        if (!GpeBlock->RegisterInfo[i].EnableForRun)
452117521Snjl        {
453281075Sdim            continue;
454281075Sdim        }
455117521Snjl
456117521Snjl        /* Enable all "runtime" GPEs in this register */
457117521Snjl
458117521Snjl        Status = AcpiHwWrite (GpeBlock->RegisterInfo[i].EnableForRun,
459117521Snjl                    &GpeBlock->RegisterInfo[i].EnableAddress);
460117521Snjl        if (ACPI_FAILURE (Status))
461117521Snjl        {
462117521Snjl            return (Status);
463117521Snjl        }
464117521Snjl    }
465117521Snjl
466117521Snjl    return (AE_OK);
467129684Snjl}
46884491Smsmith
469129684Snjl
470129684Snjl/******************************************************************************
47184491Smsmith *
472128212Snjl * FUNCTION:    AcpiHwEnableWakeupGpeBlock
47384491Smsmith *
474151937Sjkim * PARAMETERS:  GpeXruptInfo        - GPE Interrupt info
475151937Sjkim *              GpeBlock            - Gpe Block info
47684491Smsmith *
47784491Smsmith * RETURN:      Status
47884491Smsmith *
479151937Sjkim * DESCRIPTION: Enable all "wake" GPEs within a single GPE block. Includes
480129684Snjl *              combination wake/run GPEs.
481129684Snjl *
482193267Sjkim ******************************************************************************/
483193267Sjkim
48484491Smsmithstatic ACPI_STATUS
485129684SnjlAcpiHwEnableWakeupGpeBlock (
48699679Siwasaki    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
487281075Sdim    ACPI_GPE_BLOCK_INFO     *GpeBlock,
48884491Smsmith    void                    *Context)
48984491Smsmith{
490129684Snjl    UINT32                  i;
49191116Smsmith    ACPI_STATUS             Status;
492129684Snjl
493129684Snjl
494281075Sdim    /* Examine each GPE Register within the block */
49591116Smsmith
496281075Sdim    for (i = 0; i < GpeBlock->RegisterCount; i++)
497281075Sdim    {
498281075Sdim        if (!GpeBlock->RegisterInfo[i].EnableForWake)
499281075Sdim        {
500281075Sdim            continue;
501281075Sdim        }
502129684Snjl
503129684Snjl        /* Enable all "wake" GPEs in this register */
504129684Snjl
505129684Snjl        Status = AcpiHwWrite (GpeBlock->RegisterInfo[i].EnableForWake,
506129684Snjl                    &GpeBlock->RegisterInfo[i].EnableAddress);
507129684Snjl        if (ACPI_FAILURE (Status))
508129684Snjl        {
509117521Snjl            return (Status);
51084491Smsmith        }
51199679Siwasaki    }
512117521Snjl
513117521Snjl    return (AE_OK);
514129684Snjl}
515117521Snjl
516151937Sjkim
517117521Snjl/******************************************************************************
518117521Snjl *
519117521Snjl * FUNCTION:    AcpiHwDisableAllGpes
520151937Sjkim *
521117521Snjl * PARAMETERS:  None
522117521Snjl *
523114237Snjl * RETURN:      Status
524129684Snjl *
525129684Snjl * DESCRIPTION: Disable and clear all GPEs in all GPE blocks
526151937Sjkim *
527117521Snjl ******************************************************************************/
528117521Snjl
529114237SnjlACPI_STATUS
530117521SnjlAcpiHwDisableAllGpes (
531167802Sjkim    void)
532117521Snjl{
533117521Snjl    ACPI_STATUS             Status;
534193267Sjkim
535193267Sjkim
536129684Snjl    ACPI_FUNCTION_TRACE (HwDisableAllGpes);
537129684Snjl
538117521Snjl
539117521Snjl    Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, NULL);
540129684Snjl    Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock, NULL);
541129684Snjl    return_ACPI_STATUS (Status);
542129684Snjl}
543129684Snjl
544151937Sjkim
545129684Snjl/******************************************************************************
546129684Snjl *
547129684Snjl * FUNCTION:    AcpiHwEnableAllRuntimeGpes
548151937Sjkim *
549129684Snjl * PARAMETERS:  None
550129684Snjl *
551126372Snjl * RETURN:      Status
552129684Snjl *
553129684Snjl * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks
554151937Sjkim *
555129684Snjl ******************************************************************************/
556129684Snjl
557126372SnjlACPI_STATUS
558114237SnjlAcpiHwEnableAllRuntimeGpes (
559167802Sjkim    void)
560128212Snjl{
561114237Snjl    ACPI_STATUS             Status;
562193267Sjkim
563129684Snjl
56484491Smsmith    ACPI_FUNCTION_TRACE (HwEnableAllRuntimeGpes);
56584491Smsmith
56691116Smsmith
56784491Smsmith    Status = AcpiEvWalkGpeList (AcpiHwEnableRuntimeGpeBlock, NULL);
56884491Smsmith    return_ACPI_STATUS (Status);
569129684Snjl}
57084491Smsmith
571151937Sjkim
57284491Smsmith/******************************************************************************
573128212Snjl *
57484491Smsmith * FUNCTION:    AcpiHwEnableAllWakeupGpes
575151937Sjkim *
57684491Smsmith * PARAMETERS:  None
57784491Smsmith *
57884491Smsmith * RETURN:      Status
57999679Siwasaki *
580129684Snjl * DESCRIPTION: Enable all "wakeup" GPEs, in all GPE blocks
581151937Sjkim *
58284491Smsmith ******************************************************************************/
58399679Siwasaki
58484491SmsmithACPI_STATUS
58584491SmsmithAcpiHwEnableAllWakeupGpes (
586167802Sjkim    void)
58791116Smsmith{
58891116Smsmith    ACPI_STATUS             Status;
589193267Sjkim
590129684Snjl
59184491Smsmith    ACPI_FUNCTION_TRACE (HwEnableAllWakeupGpes);
592129684Snjl
593231844Sjkim
594    Status = AcpiEvWalkGpeList (AcpiHwEnableWakeupGpeBlock, NULL);
595    return_ACPI_STATUS (Status);
596}
597
598