hwgpe.c revision 99679
171867Smsmith
267754Smsmith/******************************************************************************
367754Smsmith *
467754Smsmith * Module Name: hwgpe - Low level GPE enable/disable/clear functions
599679Siwasaki *              $Revision: 41 $
667754Smsmith *
767754Smsmith *****************************************************************************/
867754Smsmith
967754Smsmith/******************************************************************************
1067754Smsmith *
1167754Smsmith * 1. Copyright Notice
1267754Smsmith *
1391116Smsmith * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
1470243Smsmith * All rights reserved.
1567754Smsmith *
1667754Smsmith * 2. License
1767754Smsmith *
1867754Smsmith * 2.1. This is your license from Intel Corp. under its intellectual property
1967754Smsmith * rights.  You may have additional license terms from the party that provided
2067754Smsmith * you this software, covering your right to use that party's intellectual
2167754Smsmith * property rights.
2267754Smsmith *
2367754Smsmith * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
2467754Smsmith * copy of the source code appearing in this file ("Covered Code") an
2567754Smsmith * irrevocable, perpetual, worldwide license under Intel's copyrights in the
2667754Smsmith * base code distributed originally by Intel ("Original Intel Code") to copy,
2767754Smsmith * make derivatives, distribute, use and display any portion of the Covered
2867754Smsmith * Code in any form, with the right to sublicense such rights; and
2967754Smsmith *
3067754Smsmith * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
3167754Smsmith * license (with the right to sublicense), under only those claims of Intel
3267754Smsmith * patents that are infringed by the Original Intel Code, to make, use, sell,
3367754Smsmith * offer to sell, and import the Covered Code and derivative works thereof
3467754Smsmith * solely to the minimum extent necessary to exercise the above copyright
3567754Smsmith * license, and in no event shall the patent license extend to any additions
3667754Smsmith * to or modifications of the Original Intel Code.  No other license or right
3767754Smsmith * is granted directly or by implication, estoppel or otherwise;
3867754Smsmith *
3967754Smsmith * The above copyright and patent license is granted only if the following
4067754Smsmith * conditions are met:
4167754Smsmith *
4267754Smsmith * 3. Conditions
4367754Smsmith *
4467754Smsmith * 3.1. Redistribution of Source with Rights to Further Distribute Source.
4567754Smsmith * Redistribution of source code of any substantial portion of the Covered
4667754Smsmith * Code or modification with rights to further distribute source must include
4767754Smsmith * the above Copyright Notice, the above License, this list of Conditions,
4867754Smsmith * and the following Disclaimer and Export Compliance provision.  In addition,
4967754Smsmith * Licensee must cause all Covered Code to which Licensee contributes to
5067754Smsmith * contain a file documenting the changes Licensee made to create that Covered
5167754Smsmith * Code and the date of any change.  Licensee must include in that file the
5267754Smsmith * documentation of any changes made by any predecessor Licensee.  Licensee
5367754Smsmith * must include a prominent statement that the modification is derived,
5467754Smsmith * directly or indirectly, from Original Intel Code.
5567754Smsmith *
5667754Smsmith * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
5767754Smsmith * Redistribution of source code of any substantial portion of the Covered
5867754Smsmith * Code or modification without rights to further distribute source must
5967754Smsmith * include the following Disclaimer and Export Compliance provision in the
6067754Smsmith * documentation and/or other materials provided with distribution.  In
6167754Smsmith * addition, Licensee may not authorize further sublicense of source of any
6267754Smsmith * portion of the Covered Code, and must include terms to the effect that the
6367754Smsmith * license from Licensee to its licensee is limited to the intellectual
6467754Smsmith * property embodied in the software Licensee provides to its licensee, and
6567754Smsmith * not to intellectual property embodied in modifications its licensee may
6667754Smsmith * make.
6767754Smsmith *
6867754Smsmith * 3.3. Redistribution of Executable. Redistribution in executable form of any
6967754Smsmith * substantial portion of the Covered Code or modification must reproduce the
7067754Smsmith * above Copyright Notice, and the following Disclaimer and Export Compliance
7167754Smsmith * provision in the documentation and/or other materials provided with the
7267754Smsmith * distribution.
7367754Smsmith *
7467754Smsmith * 3.4. Intel retains all right, title, and interest in and to the Original
7567754Smsmith * Intel Code.
7667754Smsmith *
7767754Smsmith * 3.5. Neither the name Intel nor any other trademark owned or controlled by
7867754Smsmith * Intel shall be used in advertising or otherwise to promote the sale, use or
7967754Smsmith * other dealings in products derived from or relating to the Covered Code
8067754Smsmith * without prior written authorization from Intel.
8167754Smsmith *
8267754Smsmith * 4. Disclaimer and Export Compliance
8367754Smsmith *
8467754Smsmith * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
8567754Smsmith * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
8667754Smsmith * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
8767754Smsmith * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
8867754Smsmith * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
8967754Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
9067754Smsmith * PARTICULAR PURPOSE.
9167754Smsmith *
9267754Smsmith * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
9367754Smsmith * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
9467754Smsmith * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
9567754Smsmith * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
9667754Smsmith * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
9767754Smsmith * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
9867754Smsmith * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
9967754Smsmith * LIMITED REMEDY.
10067754Smsmith *
10167754Smsmith * 4.3. Licensee shall not export, either directly or indirectly, any of this
10267754Smsmith * software or system incorporating such software without first obtaining any
10367754Smsmith * required license or other approval from the U. S. Department of Commerce or
10467754Smsmith * any other agency or department of the United States Government.  In the
10567754Smsmith * event Licensee exports any such software from the United States or
10667754Smsmith * re-exports any such software from a foreign destination, Licensee shall
10767754Smsmith * ensure that the distribution and export/re-export of the software is in
10867754Smsmith * compliance with all laws, regulations, orders, or other restrictions of the
10967754Smsmith * U.S. Export Administration Regulations. Licensee agrees that neither it nor
11067754Smsmith * any of its subsidiaries will export/re-export any technical data, process,
11167754Smsmith * software, or service, directly or indirectly, to any country for which the
11267754Smsmith * United States government or any agency thereof requires an export license,
11367754Smsmith * other governmental approval, or letter of assurance, without first obtaining
11467754Smsmith * such license, approval or letter.
11567754Smsmith *
11667754Smsmith *****************************************************************************/
11767754Smsmith
11867754Smsmith#include "acpi.h"
11967754Smsmith#include "acevents.h"
12067754Smsmith
12177424Smsmith#define _COMPONENT          ACPI_HARDWARE
12291116Smsmith        ACPI_MODULE_NAME    ("hwgpe")
12367754Smsmith
12467754Smsmith
12567754Smsmith/******************************************************************************
12667754Smsmith *
12791116Smsmith * FUNCTION:    AcpiHwGetGpeBitMask
12891116Smsmith *
12991116Smsmith * PARAMETERS:  GpeNumber       - The GPE
13091116Smsmith *
13191116Smsmith * RETURN:      Gpe register bitmask for this gpe level
13291116Smsmith *
13391116Smsmith * DESCRIPTION: Get the bitmask for this GPE
13491116Smsmith *
13591116Smsmith ******************************************************************************/
13691116Smsmith
13799679SiwasakiUINT8
13891116SmsmithAcpiHwGetGpeBitMask (
13991116Smsmith    UINT32                  GpeNumber)
14091116Smsmith{
14191116Smsmith    return (AcpiGbl_GpeNumberInfo [AcpiEvGetGpeNumberIndex (GpeNumber)].BitMask);
14291116Smsmith}
14391116Smsmith
14491116Smsmith
14591116Smsmith/******************************************************************************
14691116Smsmith *
14767754Smsmith * FUNCTION:    AcpiHwEnableGpe
14867754Smsmith *
14967754Smsmith * PARAMETERS:  GpeNumber       - The GPE
15067754Smsmith *
15167754Smsmith * RETURN:      None
15267754Smsmith *
15367754Smsmith * DESCRIPTION: Enable a single GPE.
15467754Smsmith *
15567754Smsmith ******************************************************************************/
15667754Smsmith
15799679SiwasakiACPI_STATUS
15867754SmsmithAcpiHwEnableGpe (
15967754Smsmith    UINT32                  GpeNumber)
16067754Smsmith{
16180062Smsmith    UINT32                  InByte;
16267754Smsmith    UINT32                  RegisterIndex;
16399679Siwasaki    UINT8                   BitMask;
16499679Siwasaki    ACPI_STATUS             Status;
16567754Smsmith
16683174Smsmith
16791116Smsmith    ACPI_FUNCTION_ENTRY ();
16883174Smsmith
16983174Smsmith
17091116Smsmith    /* Translate GPE number to index into global registers array. */
17167754Smsmith
17291116Smsmith    RegisterIndex = AcpiEvGetGpeRegisterIndex (GpeNumber);
17367754Smsmith
17491116Smsmith    /* Get the register bitmask for this GPE */
17591116Smsmith
17691116Smsmith    BitMask = AcpiHwGetGpeBitMask (GpeNumber);
17791116Smsmith
17867754Smsmith    /*
17967754Smsmith     * Read the current value of the register, set the appropriate bit
18067754Smsmith     * to enable the GPE, and write out the new register.
18167754Smsmith     */
18299679Siwasaki    Status = AcpiHwLowLevelRead (8, &InByte,
18399679Siwasaki                    &AcpiGbl_GpeRegisterInfo[RegisterIndex].EnableAddress, 0);
18499679Siwasaki    if (ACPI_FAILURE (Status))
18599679Siwasaki    {
18699679Siwasaki        return (Status);
18799679Siwasaki    }
18899679Siwasaki
18999679Siwasaki    Status = AcpiHwLowLevelWrite (8, (InByte | BitMask),
19099679Siwasaki                    &AcpiGbl_GpeRegisterInfo[RegisterIndex].EnableAddress, 0);
19199679Siwasaki
19299679Siwasaki    return (Status);
19367754Smsmith}
19467754Smsmith
19591116Smsmith
19684491Smsmith/******************************************************************************
19784491Smsmith *
19884491Smsmith * FUNCTION:    AcpiHwEnableGpeForWakeup
19984491Smsmith *
20084491Smsmith * PARAMETERS:  GpeNumber       - The GPE
20184491Smsmith *
20284491Smsmith * RETURN:      None
20384491Smsmith *
20484491Smsmith * DESCRIPTION: Keep track of which GPEs the OS has requested not be
20584491Smsmith *              disabled when going to sleep.
20684491Smsmith *
20784491Smsmith ******************************************************************************/
20867754Smsmith
20984491Smsmithvoid
21084491SmsmithAcpiHwEnableGpeForWakeup (
21184491Smsmith    UINT32                  GpeNumber)
21284491Smsmith{
21384491Smsmith    UINT32                  RegisterIndex;
21499679Siwasaki    UINT8                   BitMask;
21584491Smsmith
21684491Smsmith
21791116Smsmith    ACPI_FUNCTION_ENTRY ();
21884491Smsmith
21984491Smsmith
22091116Smsmith    /* Translate GPE number to index into global registers array. */
22184491Smsmith
22291116Smsmith    RegisterIndex = AcpiEvGetGpeRegisterIndex (GpeNumber);
22384491Smsmith
22491116Smsmith    /* Get the register bitmask for this GPE */
22591116Smsmith
22691116Smsmith    BitMask = AcpiHwGetGpeBitMask (GpeNumber);
22791116Smsmith
22884491Smsmith    /*
22984491Smsmith     * Set the bit so we will not disable this when sleeping
23084491Smsmith     */
23191116Smsmith    AcpiGbl_GpeRegisterInfo[RegisterIndex].WakeEnable |= BitMask;
23284491Smsmith}
23384491Smsmith
23491116Smsmith
23567754Smsmith/******************************************************************************
23667754Smsmith *
23767754Smsmith * FUNCTION:    AcpiHwDisableGpe
23867754Smsmith *
23967754Smsmith * PARAMETERS:  GpeNumber       - The GPE
24067754Smsmith *
24167754Smsmith * RETURN:      None
24267754Smsmith *
24367754Smsmith * DESCRIPTION: Disable a single GPE.
24467754Smsmith *
24567754Smsmith ******************************************************************************/
24667754Smsmith
24799679SiwasakiACPI_STATUS
24867754SmsmithAcpiHwDisableGpe (
24967754Smsmith    UINT32                  GpeNumber)
25067754Smsmith{
25180062Smsmith    UINT32                  InByte;
25267754Smsmith    UINT32                  RegisterIndex;
25399679Siwasaki    UINT8                   BitMask;
25499679Siwasaki    ACPI_STATUS             Status;
25567754Smsmith
25683174Smsmith
25791116Smsmith    ACPI_FUNCTION_ENTRY ();
25883174Smsmith
25983174Smsmith
26091116Smsmith    /* Translate GPE number to index into global registers array. */
26167754Smsmith
26291116Smsmith    RegisterIndex = AcpiEvGetGpeRegisterIndex (GpeNumber);
26367754Smsmith
26491116Smsmith    /* Get the register bitmask for this GPE */
26591116Smsmith
26691116Smsmith    BitMask = AcpiHwGetGpeBitMask (GpeNumber);
26791116Smsmith
26867754Smsmith    /*
26967754Smsmith     * Read the current value of the register, clear the appropriate bit,
27067754Smsmith     * and write out the new register value to disable the GPE.
27167754Smsmith     */
27299679Siwasaki    Status = AcpiHwLowLevelRead (8, &InByte,
27399679Siwasaki                    &AcpiGbl_GpeRegisterInfo[RegisterIndex].EnableAddress, 0);
27499679Siwasaki    if (ACPI_FAILURE (Status))
27599679Siwasaki    {
27699679Siwasaki        return (Status);
27799679Siwasaki    }
27884491Smsmith
27999679Siwasaki    Status = AcpiHwLowLevelWrite (8, (InByte & ~BitMask),
28099679Siwasaki                    &AcpiGbl_GpeRegisterInfo[RegisterIndex].EnableAddress, 0);
28199679Siwasaki    if (ACPI_FAILURE (Status))
28299679Siwasaki    {
28399679Siwasaki        return (Status);
28499679Siwasaki    }
28599679Siwasaki
28684491Smsmith    AcpiHwDisableGpeForWakeup(GpeNumber);
28799679Siwasaki    return (AE_OK);
28867754Smsmith}
28967754Smsmith
29091116Smsmith
29184491Smsmith/******************************************************************************
29284491Smsmith *
29384491Smsmith * FUNCTION:    AcpiHwDisableGpeForWakeup
29484491Smsmith *
29584491Smsmith * PARAMETERS:  GpeNumber       - The GPE
29684491Smsmith *
29784491Smsmith * RETURN:      None
29884491Smsmith *
29984491Smsmith * DESCRIPTION: Keep track of which GPEs the OS has requested not be
30084491Smsmith *              disabled when going to sleep.
30184491Smsmith *
30284491Smsmith ******************************************************************************/
30367754Smsmith
30484491Smsmithvoid
30584491SmsmithAcpiHwDisableGpeForWakeup (
30684491Smsmith    UINT32                  GpeNumber)
30784491Smsmith{
30884491Smsmith    UINT32                  RegisterIndex;
30999679Siwasaki    UINT8                   BitMask;
31084491Smsmith
31184491Smsmith
31291116Smsmith    ACPI_FUNCTION_ENTRY ();
31384491Smsmith
31484491Smsmith
31591116Smsmith    /* Translate GPE number to index into global registers array. */
31684491Smsmith
31791116Smsmith    RegisterIndex = AcpiEvGetGpeRegisterIndex (GpeNumber);
31884491Smsmith
31991116Smsmith    /* Get the register bitmask for this GPE */
32091116Smsmith
32191116Smsmith    BitMask = AcpiHwGetGpeBitMask (GpeNumber);
32291116Smsmith
32384491Smsmith    /*
32484491Smsmith     * Clear the bit so we will disable this when sleeping
32584491Smsmith     */
32691116Smsmith    AcpiGbl_GpeRegisterInfo[RegisterIndex].WakeEnable &= ~BitMask;
32784491Smsmith}
32884491Smsmith
32991116Smsmith
33067754Smsmith/******************************************************************************
33167754Smsmith *
33267754Smsmith * FUNCTION:    AcpiHwClearGpe
33367754Smsmith *
33467754Smsmith * PARAMETERS:  GpeNumber       - The GPE
33567754Smsmith *
33667754Smsmith * RETURN:      None
33767754Smsmith *
33867754Smsmith * DESCRIPTION: Clear a single GPE.
33967754Smsmith *
34067754Smsmith ******************************************************************************/
34167754Smsmith
34299679SiwasakiACPI_STATUS
34367754SmsmithAcpiHwClearGpe (
34467754Smsmith    UINT32                  GpeNumber)
34567754Smsmith{
34667754Smsmith    UINT32                  RegisterIndex;
34799679Siwasaki    UINT8                   BitMask;
34899679Siwasaki    ACPI_STATUS             Status;
34967754Smsmith
35080062Smsmith
35191116Smsmith    ACPI_FUNCTION_ENTRY ();
35283174Smsmith
35383174Smsmith
35491116Smsmith    /* Translate GPE number to index into global registers array. */
35567754Smsmith
35691116Smsmith    RegisterIndex = AcpiEvGetGpeRegisterIndex (GpeNumber);
35767754Smsmith
35891116Smsmith    /* Get the register bitmask for this GPE */
35991116Smsmith
36091116Smsmith    BitMask = AcpiHwGetGpeBitMask (GpeNumber);
36191116Smsmith
36267754Smsmith    /*
36367754Smsmith     * Write a one to the appropriate bit in the status register to
36467754Smsmith     * clear this GPE.
36567754Smsmith     */
36699679Siwasaki    Status = AcpiHwLowLevelWrite (8, BitMask,
36799679Siwasaki                    &AcpiGbl_GpeRegisterInfo[RegisterIndex].StatusAddress, 0);
36899679Siwasaki
36999679Siwasaki    return (Status);
37067754Smsmith}
37167754Smsmith
37267754Smsmith
37367754Smsmith/******************************************************************************
37467754Smsmith *
37567754Smsmith * FUNCTION:    AcpiHwGetGpeStatus
37667754Smsmith *
37767754Smsmith * PARAMETERS:  GpeNumber       - The GPE
37867754Smsmith *
37967754Smsmith * RETURN:      None
38067754Smsmith *
38167754Smsmith * DESCRIPTION: Return the status of a single GPE.
38267754Smsmith *
38367754Smsmith ******************************************************************************/
38467754Smsmith
38599679SiwasakiACPI_STATUS
38667754SmsmithAcpiHwGetGpeStatus (
38767754Smsmith    UINT32                  GpeNumber,
38867754Smsmith    ACPI_EVENT_STATUS       *EventStatus)
38967754Smsmith{
39080062Smsmith    UINT32                  InByte = 0;
39167754Smsmith    UINT32                  RegisterIndex = 0;
39299679Siwasaki    UINT8                   BitMask = 0;
39391116Smsmith    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
39499679Siwasaki    ACPI_STATUS             Status;
39567754Smsmith
39680062Smsmith
39791116Smsmith    ACPI_FUNCTION_ENTRY ();
39883174Smsmith
39983174Smsmith
40067754Smsmith    if (!EventStatus)
40167754Smsmith    {
40299679Siwasaki        return (AE_BAD_PARAMETER);
40367754Smsmith    }
40467754Smsmith
40567754Smsmith    (*EventStatus) = 0;
40667754Smsmith
40791116Smsmith    /* Translate GPE number to index into global registers array. */
40867754Smsmith
40991116Smsmith    RegisterIndex = AcpiEvGetGpeRegisterIndex (GpeNumber);
41091116Smsmith    GpeRegisterInfo = &AcpiGbl_GpeRegisterInfo[RegisterIndex];
41167754Smsmith
41291116Smsmith    /* Get the register bitmask for this GPE */
41391116Smsmith
41491116Smsmith    BitMask = AcpiHwGetGpeBitMask (GpeNumber);
41591116Smsmith
41691116Smsmith    /* GPE Enabled? */
41791116Smsmith
41899679Siwasaki    Status = AcpiHwLowLevelRead (8, &InByte, &GpeRegisterInfo->EnableAddress, 0);
41999679Siwasaki    if (ACPI_FAILURE (Status))
42099679Siwasaki    {
42199679Siwasaki        return (Status);
42299679Siwasaki    }
42399679Siwasaki
42467754Smsmith    if (BitMask & InByte)
42567754Smsmith    {
42667754Smsmith        (*EventStatus) |= ACPI_EVENT_FLAG_ENABLED;
42767754Smsmith    }
42867754Smsmith
42991116Smsmith    /* GPE Enabled for wake? */
43091116Smsmith
43191116Smsmith    if (BitMask & GpeRegisterInfo->WakeEnable)
43284491Smsmith    {
43384491Smsmith        (*EventStatus) |= ACPI_EVENT_FLAG_WAKE_ENABLED;
43484491Smsmith    }
43584491Smsmith
43691116Smsmith    /* GPE active (set)? */
43791116Smsmith
43899679Siwasaki    Status = AcpiHwLowLevelRead (8, &InByte, &GpeRegisterInfo->StatusAddress, 0);
43999679Siwasaki    if (ACPI_FAILURE (Status))
44099679Siwasaki    {
44199679Siwasaki        return (Status);
44299679Siwasaki    }
44399679Siwasaki
44467754Smsmith    if (BitMask & InByte)
44567754Smsmith    {
44667754Smsmith        (*EventStatus) |= ACPI_EVENT_FLAG_SET;
44767754Smsmith    }
44899679Siwasaki    return (AE_OK);
44967754Smsmith}
45084491Smsmith
45191116Smsmith
45284491Smsmith/******************************************************************************
45384491Smsmith *
45484491Smsmith * FUNCTION:    AcpiHwDisableNonWakeupGpes
45584491Smsmith *
45684491Smsmith * PARAMETERS:  None
45784491Smsmith *
45884491Smsmith * RETURN:      None
45984491Smsmith *
46084491Smsmith * DESCRIPTION: Disable all non-wakeup GPEs
46184491Smsmith *              Call with interrupts disabled. The interrupt handler also
46291116Smsmith *              modifies AcpiGbl_GpeRegisterInfo[i].Enable, so it should not be
46384491Smsmith *              given the chance to run until after non-wake GPEs are
46484491Smsmith *              re-enabled.
46584491Smsmith *
46684491Smsmith ******************************************************************************/
46784491Smsmith
46899679SiwasakiACPI_STATUS
46984491SmsmithAcpiHwDisableNonWakeupGpes (
47084491Smsmith    void)
47184491Smsmith{
47284491Smsmith    UINT32                  i;
47391116Smsmith    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
47499679Siwasaki    UINT32                  InValue;
47599679Siwasaki    ACPI_STATUS             Status;
47684491Smsmith
47784491Smsmith
47891116Smsmith    ACPI_FUNCTION_ENTRY ();
47991116Smsmith
48091116Smsmith
48184491Smsmith    for (i = 0; i < AcpiGbl_GpeRegisterCount; i++)
48284491Smsmith    {
48391116Smsmith        GpeRegisterInfo = &AcpiGbl_GpeRegisterInfo[i];
48491116Smsmith
48584491Smsmith        /*
48684491Smsmith         * Read the enabled status of all GPEs. We
48784491Smsmith         * will be using it to restore all the GPEs later.
48884491Smsmith         */
48999679Siwasaki        Status = AcpiHwLowLevelRead (8, &InValue,
49099146Siwasaki                    &GpeRegisterInfo->EnableAddress, 0);
49199679Siwasaki        if (ACPI_FAILURE (Status))
49299679Siwasaki        {
49399679Siwasaki            return (Status);
49499679Siwasaki        }
49584491Smsmith
49699679Siwasaki        GpeRegisterInfo->Enable = (UINT8) InValue;
49799679Siwasaki
49884491Smsmith        /*
49991116Smsmith         * Disable all GPEs except wakeup GPEs.
50084491Smsmith         */
50199679Siwasaki        Status = AcpiHwLowLevelWrite (8, GpeRegisterInfo->WakeEnable,
50299146Siwasaki                &GpeRegisterInfo->EnableAddress, 0);
50399679Siwasaki        if (ACPI_FAILURE (Status))
50499679Siwasaki        {
50599679Siwasaki            return (Status);
50699679Siwasaki        }
50784491Smsmith    }
50899679Siwasaki    return (AE_OK);
50984491Smsmith}
51084491Smsmith
51191116Smsmith
51284491Smsmith/******************************************************************************
51384491Smsmith *
51484491Smsmith * FUNCTION:    AcpiHwEnableNonWakeupGpes
51584491Smsmith *
51684491Smsmith * PARAMETERS:  None
51784491Smsmith *
51884491Smsmith * RETURN:      None
51984491Smsmith *
52084491Smsmith * DESCRIPTION: Enable all non-wakeup GPEs we previously enabled.
52184491Smsmith *
52284491Smsmith ******************************************************************************/
52384491Smsmith
52499679SiwasakiACPI_STATUS
52584491SmsmithAcpiHwEnableNonWakeupGpes (
52684491Smsmith    void)
52784491Smsmith{
52884491Smsmith    UINT32                  i;
52991116Smsmith    ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
53099679Siwasaki    ACPI_STATUS             Status;
53184491Smsmith
53284491Smsmith
53391116Smsmith    ACPI_FUNCTION_ENTRY ();
53491116Smsmith
53591116Smsmith
53684491Smsmith    for (i = 0; i < AcpiGbl_GpeRegisterCount; i++)
53784491Smsmith    {
53891116Smsmith        GpeRegisterInfo = &AcpiGbl_GpeRegisterInfo[i];
53991116Smsmith
54084491Smsmith        /*
54184491Smsmith         * We previously stored the enabled status of all GPEs.
54284491Smsmith         * Blast them back in.
54384491Smsmith         */
54499679Siwasaki        Status = AcpiHwLowLevelWrite (8, GpeRegisterInfo->Enable,
54599679Siwasaki                    &GpeRegisterInfo->EnableAddress, 0);
54699679Siwasaki        if (ACPI_FAILURE (Status))
54799679Siwasaki        {
54899679Siwasaki            return (Status);
54999679Siwasaki        }
55084491Smsmith    }
55199679Siwasaki    return (AE_OK);
55284491Smsmith}
553