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