xref: /onnv-gate/usr/src/uts/intel/io/acpica/hardware/hwgpe.c (revision 7851:e828bbb1689c)
13446Smrj 
23446Smrj /******************************************************************************
33446Smrj  *
43446Smrj  * Module Name: hwgpe - Low level GPE enable/disable/clear functions
5*7851SDana.Myers@Sun.COM  *              $Revision: 1.76 $
63446Smrj  *
73446Smrj  *****************************************************************************/
83446Smrj 
93446Smrj /******************************************************************************
103446Smrj  *
113446Smrj  * 1. Copyright Notice
123446Smrj  *
13*7851SDana.Myers@Sun.COM  * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
143446Smrj  * All rights reserved.
153446Smrj  *
163446Smrj  * 2. License
173446Smrj  *
183446Smrj  * 2.1. This is your license from Intel Corp. under its intellectual property
193446Smrj  * rights.  You may have additional license terms from the party that provided
203446Smrj  * you this software, covering your right to use that party's intellectual
213446Smrj  * property rights.
223446Smrj  *
233446Smrj  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
243446Smrj  * copy of the source code appearing in this file ("Covered Code") an
253446Smrj  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
263446Smrj  * base code distributed originally by Intel ("Original Intel Code") to copy,
273446Smrj  * make derivatives, distribute, use and display any portion of the Covered
283446Smrj  * Code in any form, with the right to sublicense such rights; and
293446Smrj  *
303446Smrj  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
313446Smrj  * license (with the right to sublicense), under only those claims of Intel
323446Smrj  * patents that are infringed by the Original Intel Code, to make, use, sell,
333446Smrj  * offer to sell, and import the Covered Code and derivative works thereof
343446Smrj  * solely to the minimum extent necessary to exercise the above copyright
353446Smrj  * license, and in no event shall the patent license extend to any additions
363446Smrj  * to or modifications of the Original Intel Code.  No other license or right
373446Smrj  * is granted directly or by implication, estoppel or otherwise;
383446Smrj  *
393446Smrj  * The above copyright and patent license is granted only if the following
403446Smrj  * conditions are met:
413446Smrj  *
423446Smrj  * 3. Conditions
433446Smrj  *
443446Smrj  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
453446Smrj  * Redistribution of source code of any substantial portion of the Covered
463446Smrj  * Code or modification with rights to further distribute source must include
473446Smrj  * the above Copyright Notice, the above License, this list of Conditions,
483446Smrj  * and the following Disclaimer and Export Compliance provision.  In addition,
493446Smrj  * Licensee must cause all Covered Code to which Licensee contributes to
503446Smrj  * contain a file documenting the changes Licensee made to create that Covered
513446Smrj  * Code and the date of any change.  Licensee must include in that file the
523446Smrj  * documentation of any changes made by any predecessor Licensee.  Licensee
533446Smrj  * must include a prominent statement that the modification is derived,
543446Smrj  * directly or indirectly, from Original Intel Code.
553446Smrj  *
563446Smrj  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
573446Smrj  * Redistribution of source code of any substantial portion of the Covered
583446Smrj  * Code or modification without rights to further distribute source must
593446Smrj  * include the following Disclaimer and Export Compliance provision in the
603446Smrj  * documentation and/or other materials provided with distribution.  In
613446Smrj  * addition, Licensee may not authorize further sublicense of source of any
623446Smrj  * portion of the Covered Code, and must include terms to the effect that the
633446Smrj  * license from Licensee to its licensee is limited to the intellectual
643446Smrj  * property embodied in the software Licensee provides to its licensee, and
653446Smrj  * not to intellectual property embodied in modifications its licensee may
663446Smrj  * make.
673446Smrj  *
683446Smrj  * 3.3. Redistribution of Executable. Redistribution in executable form of any
693446Smrj  * substantial portion of the Covered Code or modification must reproduce the
703446Smrj  * above Copyright Notice, and the following Disclaimer and Export Compliance
713446Smrj  * provision in the documentation and/or other materials provided with the
723446Smrj  * distribution.
733446Smrj  *
743446Smrj  * 3.4. Intel retains all right, title, and interest in and to the Original
753446Smrj  * Intel Code.
763446Smrj  *
773446Smrj  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
783446Smrj  * Intel shall be used in advertising or otherwise to promote the sale, use or
793446Smrj  * other dealings in products derived from or relating to the Covered Code
803446Smrj  * without prior written authorization from Intel.
813446Smrj  *
823446Smrj  * 4. Disclaimer and Export Compliance
833446Smrj  *
843446Smrj  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
853446Smrj  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
863446Smrj  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
873446Smrj  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
883446Smrj  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
893446Smrj  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
903446Smrj  * PARTICULAR PURPOSE.
913446Smrj  *
923446Smrj  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
933446Smrj  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
943446Smrj  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
953446Smrj  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
963446Smrj  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
973446Smrj  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
983446Smrj  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
993446Smrj  * LIMITED REMEDY.
1003446Smrj  *
1013446Smrj  * 4.3. Licensee shall not export, either directly or indirectly, any of this
1023446Smrj  * software or system incorporating such software without first obtaining any
1033446Smrj  * required license or other approval from the U. S. Department of Commerce or
1043446Smrj  * any other agency or department of the United States Government.  In the
1053446Smrj  * event Licensee exports any such software from the United States or
1063446Smrj  * re-exports any such software from a foreign destination, Licensee shall
1073446Smrj  * ensure that the distribution and export/re-export of the software is in
1083446Smrj  * compliance with all laws, regulations, orders, or other restrictions of the
1093446Smrj  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
1103446Smrj  * any of its subsidiaries will export/re-export any technical data, process,
1113446Smrj  * software, or service, directly or indirectly, to any country for which the
1123446Smrj  * United States government or any agency thereof requires an export license,
1133446Smrj  * other governmental approval, or letter of assurance, without first obtaining
1143446Smrj  * such license, approval or letter.
1153446Smrj  *
1163446Smrj  *****************************************************************************/
1173446Smrj 
1183446Smrj #include "acpi.h"
1193446Smrj #include "acevents.h"
1203446Smrj 
1213446Smrj #define _COMPONENT          ACPI_HARDWARE
1223446Smrj         ACPI_MODULE_NAME    ("hwgpe")
1233446Smrj 
1243446Smrj /* Local prototypes */
1253446Smrj 
1263446Smrj static ACPI_STATUS
1273446Smrj AcpiHwEnableWakeupGpeBlock (
1283446Smrj     ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
1293446Smrj     ACPI_GPE_BLOCK_INFO     *GpeBlock);
1303446Smrj 
1313446Smrj 
132*7851SDana.Myers@Sun.COM 
133*7851SDana.Myers@Sun.COM /******************************************************************************
134*7851SDana.Myers@Sun.COM  *
135*7851SDana.Myers@Sun.COM  * FUNCTION:    AcpiHwLowDisableGpe
136*7851SDana.Myers@Sun.COM  *
137*7851SDana.Myers@Sun.COM  * PARAMETERS:  GpeEventInfo        - Info block for the GPE to be disabled
138*7851SDana.Myers@Sun.COM  *
139*7851SDana.Myers@Sun.COM  * RETURN:      Status
140*7851SDana.Myers@Sun.COM  *
141*7851SDana.Myers@Sun.COM  * DESCRIPTION: Disable a single GPE in the enable register.
142*7851SDana.Myers@Sun.COM  *
143*7851SDana.Myers@Sun.COM  ******************************************************************************/
144*7851SDana.Myers@Sun.COM 
145*7851SDana.Myers@Sun.COM ACPI_STATUS
146*7851SDana.Myers@Sun.COM AcpiHwLowDisableGpe (
147*7851SDana.Myers@Sun.COM     ACPI_GPE_EVENT_INFO     *GpeEventInfo)
148*7851SDana.Myers@Sun.COM {
149*7851SDana.Myers@Sun.COM     ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
150*7851SDana.Myers@Sun.COM     ACPI_STATUS             Status;
151*7851SDana.Myers@Sun.COM     UINT32                  EnableMask;
152*7851SDana.Myers@Sun.COM 
153*7851SDana.Myers@Sun.COM 
154*7851SDana.Myers@Sun.COM     /* Get the info block for the entire GPE register */
155*7851SDana.Myers@Sun.COM 
156*7851SDana.Myers@Sun.COM     GpeRegisterInfo = GpeEventInfo->RegisterInfo;
157*7851SDana.Myers@Sun.COM     if (!GpeRegisterInfo)
158*7851SDana.Myers@Sun.COM     {
159*7851SDana.Myers@Sun.COM         return (AE_NOT_EXIST);
160*7851SDana.Myers@Sun.COM     }
161*7851SDana.Myers@Sun.COM 
162*7851SDana.Myers@Sun.COM     /* Get current value of the enable register that contains this GPE */
163*7851SDana.Myers@Sun.COM 
164*7851SDana.Myers@Sun.COM     Status = AcpiHwLowLevelRead (ACPI_GPE_REGISTER_WIDTH, &EnableMask,
165*7851SDana.Myers@Sun.COM                 &GpeRegisterInfo->EnableAddress);
166*7851SDana.Myers@Sun.COM     if (ACPI_FAILURE (Status))
167*7851SDana.Myers@Sun.COM     {
168*7851SDana.Myers@Sun.COM         return (Status);
169*7851SDana.Myers@Sun.COM     }
170*7851SDana.Myers@Sun.COM 
171*7851SDana.Myers@Sun.COM     /* Clear just the bit that corresponds to this GPE */
172*7851SDana.Myers@Sun.COM 
173*7851SDana.Myers@Sun.COM     ACPI_CLEAR_BIT (EnableMask,
174*7851SDana.Myers@Sun.COM         ((UINT32) 1 << (GpeEventInfo->GpeNumber - GpeRegisterInfo->BaseGpeNumber)));
175*7851SDana.Myers@Sun.COM 
176*7851SDana.Myers@Sun.COM 
177*7851SDana.Myers@Sun.COM     /* Write the updated enable mask */
178*7851SDana.Myers@Sun.COM 
179*7851SDana.Myers@Sun.COM     Status = AcpiHwLowLevelWrite (ACPI_GPE_REGISTER_WIDTH, EnableMask,
180*7851SDana.Myers@Sun.COM                 &GpeRegisterInfo->EnableAddress);
181*7851SDana.Myers@Sun.COM 
182*7851SDana.Myers@Sun.COM     return (Status);
183*7851SDana.Myers@Sun.COM }
184*7851SDana.Myers@Sun.COM 
185*7851SDana.Myers@Sun.COM 
1863446Smrj /******************************************************************************
1873446Smrj  *
1883446Smrj  * FUNCTION:    AcpiHwWriteGpeEnableReg
1893446Smrj  *
1903446Smrj  * PARAMETERS:  GpeEventInfo        - Info block for the GPE to be enabled
1913446Smrj  *
1923446Smrj  * RETURN:      Status
1933446Smrj  *
1943446Smrj  * DESCRIPTION: Write a GPE enable register.  Note: The bit for this GPE must
1953446Smrj  *              already be cleared or set in the parent register
1963446Smrj  *              EnableForRun mask.
1973446Smrj  *
1983446Smrj  ******************************************************************************/
1993446Smrj 
2003446Smrj ACPI_STATUS
2013446Smrj AcpiHwWriteGpeEnableReg (
2023446Smrj     ACPI_GPE_EVENT_INFO     *GpeEventInfo)
2033446Smrj {
2043446Smrj     ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
2053446Smrj     ACPI_STATUS             Status;
2063446Smrj 
2073446Smrj 
2083446Smrj     ACPI_FUNCTION_ENTRY ();
2093446Smrj 
2103446Smrj 
2113446Smrj     /* Get the info block for the entire GPE register */
2123446Smrj 
2133446Smrj     GpeRegisterInfo = GpeEventInfo->RegisterInfo;
2143446Smrj     if (!GpeRegisterInfo)
2153446Smrj     {
2163446Smrj         return (AE_NOT_EXIST);
2173446Smrj     }
2183446Smrj 
2193446Smrj     /* Write the entire GPE (runtime) enable register */
2203446Smrj 
2213446Smrj     Status = AcpiHwLowLevelWrite (8, GpeRegisterInfo->EnableForRun,
2223446Smrj                     &GpeRegisterInfo->EnableAddress);
2233446Smrj 
2243446Smrj     return (Status);
2253446Smrj }
2263446Smrj 
2273446Smrj 
2283446Smrj /******************************************************************************
2293446Smrj  *
2303446Smrj  * FUNCTION:    AcpiHwClearGpe
2313446Smrj  *
2323446Smrj  * PARAMETERS:  GpeEventInfo        - Info block for the GPE to be cleared
2333446Smrj  *
2343446Smrj  * RETURN:      Status
2353446Smrj  *
2363446Smrj  * DESCRIPTION: Clear the status bit for a single GPE.
2373446Smrj  *
2383446Smrj  ******************************************************************************/
2393446Smrj 
2403446Smrj ACPI_STATUS
2413446Smrj AcpiHwClearGpe (
2423446Smrj     ACPI_GPE_EVENT_INFO     *GpeEventInfo)
2433446Smrj {
2443446Smrj     ACPI_STATUS             Status;
245*7851SDana.Myers@Sun.COM     UINT8                   RegisterBit;
2463446Smrj 
2473446Smrj 
2483446Smrj     ACPI_FUNCTION_ENTRY ();
2493446Smrj 
2503446Smrj 
251*7851SDana.Myers@Sun.COM     RegisterBit = (UINT8)
252*7851SDana.Myers@Sun.COM         (1 << (GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber));
253*7851SDana.Myers@Sun.COM 
2543446Smrj     /*
2553446Smrj      * Write a one to the appropriate bit in the status register to
2563446Smrj      * clear this GPE.
2573446Smrj      */
258*7851SDana.Myers@Sun.COM     Status = AcpiHwLowLevelWrite (8, RegisterBit,
2593446Smrj                     &GpeEventInfo->RegisterInfo->StatusAddress);
2603446Smrj 
2613446Smrj     return (Status);
2623446Smrj }
2633446Smrj 
2643446Smrj 
2653446Smrj /******************************************************************************
2663446Smrj  *
2673446Smrj  * FUNCTION:    AcpiHwGetGpeStatus
2683446Smrj  *
2693446Smrj  * PARAMETERS:  GpeEventInfo        - Info block for the GPE to queried
2703446Smrj  *              EventStatus         - Where the GPE status is returned
2713446Smrj  *
2723446Smrj  * RETURN:      Status
2733446Smrj  *
2743446Smrj  * DESCRIPTION: Return the status of a single GPE.
2753446Smrj  *
2763446Smrj  ******************************************************************************/
2773446Smrj 
2783446Smrj ACPI_STATUS
2793446Smrj AcpiHwGetGpeStatus (
2803446Smrj     ACPI_GPE_EVENT_INFO     *GpeEventInfo,
2813446Smrj     ACPI_EVENT_STATUS       *EventStatus)
2823446Smrj {
2833446Smrj     UINT32                  InByte;
2843446Smrj     UINT8                   RegisterBit;
2853446Smrj     ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
2863446Smrj     ACPI_STATUS             Status;
2873446Smrj     ACPI_EVENT_STATUS       LocalEventStatus = 0;
2883446Smrj 
2893446Smrj 
2903446Smrj     ACPI_FUNCTION_ENTRY ();
2913446Smrj 
2923446Smrj 
2933446Smrj     if (!EventStatus)
2943446Smrj     {
2953446Smrj         return (AE_BAD_PARAMETER);
2963446Smrj     }
2973446Smrj 
2983446Smrj     /* Get the info block for the entire GPE register */
2993446Smrj 
3003446Smrj     GpeRegisterInfo = GpeEventInfo->RegisterInfo;
3013446Smrj 
3023446Smrj     /* Get the register bitmask for this GPE */
3033446Smrj 
304*7851SDana.Myers@Sun.COM     RegisterBit = (UINT8)
305*7851SDana.Myers@Sun.COM         (1 << (GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber));
3063446Smrj 
3073446Smrj     /* GPE currently enabled? (enabled for runtime?) */
3083446Smrj 
3093446Smrj     if (RegisterBit & GpeRegisterInfo->EnableForRun)
3103446Smrj     {
3113446Smrj         LocalEventStatus |= ACPI_EVENT_FLAG_ENABLED;
3123446Smrj     }
3133446Smrj 
3143446Smrj     /* GPE enabled for wake? */
3153446Smrj 
3163446Smrj     if (RegisterBit & GpeRegisterInfo->EnableForWake)
3173446Smrj     {
3183446Smrj         LocalEventStatus |= ACPI_EVENT_FLAG_WAKE_ENABLED;
3193446Smrj     }
3203446Smrj 
3213446Smrj     /* GPE currently active (status bit == 1)? */
3223446Smrj 
3233446Smrj     Status = AcpiHwLowLevelRead (8, &InByte, &GpeRegisterInfo->StatusAddress);
3243446Smrj     if (ACPI_FAILURE (Status))
3253446Smrj     {
3263446Smrj         goto UnlockAndExit;
3273446Smrj     }
3283446Smrj 
3293446Smrj     if (RegisterBit & InByte)
3303446Smrj     {
3313446Smrj         LocalEventStatus |= ACPI_EVENT_FLAG_SET;
3323446Smrj     }
3333446Smrj 
3343446Smrj     /* Set return value */
3353446Smrj 
3363446Smrj     (*EventStatus) = LocalEventStatus;
3373446Smrj 
3383446Smrj 
3393446Smrj UnlockAndExit:
3403446Smrj     return (Status);
3413446Smrj }
3423446Smrj 
3433446Smrj 
3443446Smrj /******************************************************************************
3453446Smrj  *
3463446Smrj  * FUNCTION:    AcpiHwDisableGpeBlock
3473446Smrj  *
3483446Smrj  * PARAMETERS:  GpeXruptInfo        - GPE Interrupt info
3493446Smrj  *              GpeBlock            - Gpe Block info
3503446Smrj  *
3513446Smrj  * RETURN:      Status
3523446Smrj  *
3533446Smrj  * DESCRIPTION: Disable all GPEs within a single GPE block
3543446Smrj  *
3553446Smrj  ******************************************************************************/
3563446Smrj 
3573446Smrj ACPI_STATUS
3583446Smrj AcpiHwDisableGpeBlock (
3593446Smrj     ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
3603446Smrj     ACPI_GPE_BLOCK_INFO     *GpeBlock)
3613446Smrj {
3623446Smrj     UINT32                  i;
3633446Smrj     ACPI_STATUS             Status;
3643446Smrj 
3653446Smrj 
3663446Smrj     /* Examine each GPE Register within the block */
3673446Smrj 
3683446Smrj     for (i = 0; i < GpeBlock->RegisterCount; i++)
3693446Smrj     {
3703446Smrj         /* Disable all GPEs in this register */
3713446Smrj 
3723446Smrj         Status = AcpiHwLowLevelWrite (8, 0x00,
3733446Smrj                     &GpeBlock->RegisterInfo[i].EnableAddress);
3743446Smrj         if (ACPI_FAILURE (Status))
3753446Smrj         {
3763446Smrj             return (Status);
3773446Smrj         }
3783446Smrj     }
3793446Smrj 
3803446Smrj     return (AE_OK);
3813446Smrj }
3823446Smrj 
3833446Smrj 
3843446Smrj /******************************************************************************
3853446Smrj  *
3863446Smrj  * FUNCTION:    AcpiHwClearGpeBlock
3873446Smrj  *
3883446Smrj  * PARAMETERS:  GpeXruptInfo        - GPE Interrupt info
3893446Smrj  *              GpeBlock            - Gpe Block info
3903446Smrj  *
3913446Smrj  * RETURN:      Status
3923446Smrj  *
3933446Smrj  * DESCRIPTION: Clear status bits for all GPEs within a single GPE block
3943446Smrj  *
3953446Smrj  ******************************************************************************/
3963446Smrj 
3973446Smrj ACPI_STATUS
3983446Smrj AcpiHwClearGpeBlock (
3993446Smrj     ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
4003446Smrj     ACPI_GPE_BLOCK_INFO     *GpeBlock)
4013446Smrj {
4023446Smrj     UINT32                  i;
4033446Smrj     ACPI_STATUS             Status;
4043446Smrj 
4053446Smrj 
4063446Smrj     /* Examine each GPE Register within the block */
4073446Smrj 
4083446Smrj     for (i = 0; i < GpeBlock->RegisterCount; i++)
4093446Smrj     {
4103446Smrj         /* Clear status on all GPEs in this register */
4113446Smrj 
4123446Smrj         Status = AcpiHwLowLevelWrite (8, 0xFF,
4133446Smrj                     &GpeBlock->RegisterInfo[i].StatusAddress);
4143446Smrj         if (ACPI_FAILURE (Status))
4153446Smrj         {
4163446Smrj             return (Status);
4173446Smrj         }
4183446Smrj     }
4193446Smrj 
4203446Smrj     return (AE_OK);
4213446Smrj }
4223446Smrj 
4233446Smrj 
4243446Smrj /******************************************************************************
4253446Smrj  *
4263446Smrj  * FUNCTION:    AcpiHwEnableRuntimeGpeBlock
4273446Smrj  *
4283446Smrj  * PARAMETERS:  GpeXruptInfo        - GPE Interrupt info
4293446Smrj  *              GpeBlock            - Gpe Block info
4303446Smrj  *
4313446Smrj  * RETURN:      Status
4323446Smrj  *
4333446Smrj  * DESCRIPTION: Enable all "runtime" GPEs within a single GPE block. Includes
4343446Smrj  *              combination wake/run GPEs.
4353446Smrj  *
4363446Smrj  ******************************************************************************/
4373446Smrj 
4383446Smrj ACPI_STATUS
4393446Smrj AcpiHwEnableRuntimeGpeBlock (
4403446Smrj     ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
4413446Smrj     ACPI_GPE_BLOCK_INFO     *GpeBlock)
4423446Smrj {
4433446Smrj     UINT32                  i;
4443446Smrj     ACPI_STATUS             Status;
4453446Smrj 
4463446Smrj 
4473446Smrj     /* NOTE: assumes that all GPEs are currently disabled */
4483446Smrj 
4493446Smrj     /* Examine each GPE Register within the block */
4503446Smrj 
4513446Smrj     for (i = 0; i < GpeBlock->RegisterCount; i++)
4523446Smrj     {
4533446Smrj         if (!GpeBlock->RegisterInfo[i].EnableForRun)
4543446Smrj         {
4553446Smrj             continue;
4563446Smrj         }
4573446Smrj 
4583446Smrj         /* Enable all "runtime" GPEs in this register */
4593446Smrj 
4603446Smrj         Status = AcpiHwLowLevelWrite (8, GpeBlock->RegisterInfo[i].EnableForRun,
4613446Smrj                     &GpeBlock->RegisterInfo[i].EnableAddress);
4623446Smrj         if (ACPI_FAILURE (Status))
4633446Smrj         {
4643446Smrj             return (Status);
4653446Smrj         }
4663446Smrj     }
4673446Smrj 
4683446Smrj     return (AE_OK);
4693446Smrj }
4703446Smrj 
4713446Smrj 
4723446Smrj /******************************************************************************
4733446Smrj  *
4743446Smrj  * FUNCTION:    AcpiHwEnableWakeupGpeBlock
4753446Smrj  *
4763446Smrj  * PARAMETERS:  GpeXruptInfo        - GPE Interrupt info
4773446Smrj  *              GpeBlock            - Gpe Block info
4783446Smrj  *
4793446Smrj  * RETURN:      Status
4803446Smrj  *
4813446Smrj  * DESCRIPTION: Enable all "wake" GPEs within a single GPE block. Includes
4823446Smrj  *              combination wake/run GPEs.
4833446Smrj  *
4843446Smrj  ******************************************************************************/
4853446Smrj 
4863446Smrj static ACPI_STATUS
4873446Smrj AcpiHwEnableWakeupGpeBlock (
4883446Smrj     ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
4893446Smrj     ACPI_GPE_BLOCK_INFO     *GpeBlock)
4903446Smrj {
4913446Smrj     UINT32                  i;
4923446Smrj     ACPI_STATUS             Status;
4933446Smrj 
4943446Smrj 
4953446Smrj     /* Examine each GPE Register within the block */
4963446Smrj 
4973446Smrj     for (i = 0; i < GpeBlock->RegisterCount; i++)
4983446Smrj     {
4993446Smrj         if (!GpeBlock->RegisterInfo[i].EnableForWake)
5003446Smrj         {
5013446Smrj             continue;
5023446Smrj         }
5033446Smrj 
5043446Smrj         /* Enable all "wake" GPEs in this register */
5053446Smrj 
5063446Smrj         Status = AcpiHwLowLevelWrite (8,
5073446Smrj                     GpeBlock->RegisterInfo[i].EnableForWake,
5083446Smrj                     &GpeBlock->RegisterInfo[i].EnableAddress);
5093446Smrj         if (ACPI_FAILURE (Status))
5103446Smrj         {
5113446Smrj             return (Status);
5123446Smrj         }
5133446Smrj     }
5143446Smrj 
5153446Smrj     return (AE_OK);
5163446Smrj }
5173446Smrj 
5183446Smrj 
5193446Smrj /******************************************************************************
5203446Smrj  *
5213446Smrj  * FUNCTION:    AcpiHwDisableAllGpes
5223446Smrj  *
5233446Smrj  * PARAMETERS:  None
5243446Smrj  *
5253446Smrj  * RETURN:      Status
5263446Smrj  *
5273446Smrj  * DESCRIPTION: Disable and clear all GPEs in all GPE blocks
5283446Smrj  *
5293446Smrj  ******************************************************************************/
5303446Smrj 
5313446Smrj ACPI_STATUS
5323446Smrj AcpiHwDisableAllGpes (
5333446Smrj     void)
5343446Smrj {
5353446Smrj     ACPI_STATUS             Status;
5363446Smrj 
5373446Smrj 
5383446Smrj     ACPI_FUNCTION_TRACE (HwDisableAllGpes);
5393446Smrj 
5403446Smrj 
5413446Smrj     Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock);
5423446Smrj     Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock);
5433446Smrj     return_ACPI_STATUS (Status);
5443446Smrj }
5453446Smrj 
5463446Smrj 
5473446Smrj /******************************************************************************
5483446Smrj  *
5493446Smrj  * FUNCTION:    AcpiHwEnableAllRuntimeGpes
5503446Smrj  *
5513446Smrj  * PARAMETERS:  None
5523446Smrj  *
5533446Smrj  * RETURN:      Status
5543446Smrj  *
5553446Smrj  * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks
5563446Smrj  *
5573446Smrj  ******************************************************************************/
5583446Smrj 
5593446Smrj ACPI_STATUS
5603446Smrj AcpiHwEnableAllRuntimeGpes (
5613446Smrj     void)
5623446Smrj {
5633446Smrj     ACPI_STATUS             Status;
5643446Smrj 
5653446Smrj 
5663446Smrj     ACPI_FUNCTION_TRACE (HwEnableAllRuntimeGpes);
5673446Smrj 
5683446Smrj 
5693446Smrj     Status = AcpiEvWalkGpeList (AcpiHwEnableRuntimeGpeBlock);
5703446Smrj     return_ACPI_STATUS (Status);
5713446Smrj }
5723446Smrj 
5733446Smrj 
5743446Smrj /******************************************************************************
5753446Smrj  *
5763446Smrj  * FUNCTION:    AcpiHwEnableAllWakeupGpes
5773446Smrj  *
5783446Smrj  * PARAMETERS:  None
5793446Smrj  *
5803446Smrj  * RETURN:      Status
5813446Smrj  *
5823446Smrj  * DESCRIPTION: Enable all "wakeup" GPEs, in all GPE blocks
5833446Smrj  *
5843446Smrj  ******************************************************************************/
5853446Smrj 
5863446Smrj ACPI_STATUS
5873446Smrj AcpiHwEnableAllWakeupGpes (
5883446Smrj     void)
5893446Smrj {
5903446Smrj     ACPI_STATUS             Status;
5913446Smrj 
5923446Smrj 
5933446Smrj     ACPI_FUNCTION_TRACE (HwEnableAllWakeupGpes);
5943446Smrj 
5953446Smrj 
5963446Smrj     Status = AcpiEvWalkGpeList (AcpiHwEnableWakeupGpeBlock);
5973446Smrj     return_ACPI_STATUS (Status);
5983446Smrj }
5993446Smrj 
600