xref: /onnv-gate/usr/src/uts/intel/io/acpica/events/evgpe.c (revision 11225:eb6056029d84)
13446Smrj /******************************************************************************
23446Smrj  *
33446Smrj  * Module Name: evgpe - General Purpose Event handling and dispatch
43446Smrj  *
53446Smrj  *****************************************************************************/
63446Smrj 
73446Smrj /******************************************************************************
83446Smrj  *
93446Smrj  * 1. Copyright Notice
103446Smrj  *
119980SDana.Myers@Sun.COM  * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
123446Smrj  * All rights reserved.
133446Smrj  *
143446Smrj  * 2. License
153446Smrj  *
163446Smrj  * 2.1. This is your license from Intel Corp. under its intellectual property
173446Smrj  * rights.  You may have additional license terms from the party that provided
183446Smrj  * you this software, covering your right to use that party's intellectual
193446Smrj  * property rights.
203446Smrj  *
213446Smrj  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
223446Smrj  * copy of the source code appearing in this file ("Covered Code") an
233446Smrj  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
243446Smrj  * base code distributed originally by Intel ("Original Intel Code") to copy,
253446Smrj  * make derivatives, distribute, use and display any portion of the Covered
263446Smrj  * Code in any form, with the right to sublicense such rights; and
273446Smrj  *
283446Smrj  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
293446Smrj  * license (with the right to sublicense), under only those claims of Intel
303446Smrj  * patents that are infringed by the Original Intel Code, to make, use, sell,
313446Smrj  * offer to sell, and import the Covered Code and derivative works thereof
323446Smrj  * solely to the minimum extent necessary to exercise the above copyright
333446Smrj  * license, and in no event shall the patent license extend to any additions
343446Smrj  * to or modifications of the Original Intel Code.  No other license or right
353446Smrj  * is granted directly or by implication, estoppel or otherwise;
363446Smrj  *
373446Smrj  * The above copyright and patent license is granted only if the following
383446Smrj  * conditions are met:
393446Smrj  *
403446Smrj  * 3. Conditions
413446Smrj  *
423446Smrj  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
433446Smrj  * Redistribution of source code of any substantial portion of the Covered
443446Smrj  * Code or modification with rights to further distribute source must include
453446Smrj  * the above Copyright Notice, the above License, this list of Conditions,
463446Smrj  * and the following Disclaimer and Export Compliance provision.  In addition,
473446Smrj  * Licensee must cause all Covered Code to which Licensee contributes to
483446Smrj  * contain a file documenting the changes Licensee made to create that Covered
493446Smrj  * Code and the date of any change.  Licensee must include in that file the
503446Smrj  * documentation of any changes made by any predecessor Licensee.  Licensee
513446Smrj  * must include a prominent statement that the modification is derived,
523446Smrj  * directly or indirectly, from Original Intel Code.
533446Smrj  *
543446Smrj  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
553446Smrj  * Redistribution of source code of any substantial portion of the Covered
563446Smrj  * Code or modification without rights to further distribute source must
573446Smrj  * include the following Disclaimer and Export Compliance provision in the
583446Smrj  * documentation and/or other materials provided with distribution.  In
593446Smrj  * addition, Licensee may not authorize further sublicense of source of any
603446Smrj  * portion of the Covered Code, and must include terms to the effect that the
613446Smrj  * license from Licensee to its licensee is limited to the intellectual
623446Smrj  * property embodied in the software Licensee provides to its licensee, and
633446Smrj  * not to intellectual property embodied in modifications its licensee may
643446Smrj  * make.
653446Smrj  *
663446Smrj  * 3.3. Redistribution of Executable. Redistribution in executable form of any
673446Smrj  * substantial portion of the Covered Code or modification must reproduce the
683446Smrj  * above Copyright Notice, and the following Disclaimer and Export Compliance
693446Smrj  * provision in the documentation and/or other materials provided with the
703446Smrj  * distribution.
713446Smrj  *
723446Smrj  * 3.4. Intel retains all right, title, and interest in and to the Original
733446Smrj  * Intel Code.
743446Smrj  *
753446Smrj  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
763446Smrj  * Intel shall be used in advertising or otherwise to promote the sale, use or
773446Smrj  * other dealings in products derived from or relating to the Covered Code
783446Smrj  * without prior written authorization from Intel.
793446Smrj  *
803446Smrj  * 4. Disclaimer and Export Compliance
813446Smrj  *
823446Smrj  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
833446Smrj  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
843446Smrj  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
853446Smrj  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
863446Smrj  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
873446Smrj  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
883446Smrj  * PARTICULAR PURPOSE.
893446Smrj  *
903446Smrj  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
913446Smrj  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
923446Smrj  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
933446Smrj  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
943446Smrj  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
953446Smrj  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
963446Smrj  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
973446Smrj  * LIMITED REMEDY.
983446Smrj  *
993446Smrj  * 4.3. Licensee shall not export, either directly or indirectly, any of this
1003446Smrj  * software or system incorporating such software without first obtaining any
1013446Smrj  * required license or other approval from the U. S. Department of Commerce or
1023446Smrj  * any other agency or department of the United States Government.  In the
1033446Smrj  * event Licensee exports any such software from the United States or
1043446Smrj  * re-exports any such software from a foreign destination, Licensee shall
1053446Smrj  * ensure that the distribution and export/re-export of the software is in
1063446Smrj  * compliance with all laws, regulations, orders, or other restrictions of the
1073446Smrj  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
1083446Smrj  * any of its subsidiaries will export/re-export any technical data, process,
1093446Smrj  * software, or service, directly or indirectly, to any country for which the
1103446Smrj  * United States government or any agency thereof requires an export license,
1113446Smrj  * other governmental approval, or letter of assurance, without first obtaining
1123446Smrj  * such license, approval or letter.
1133446Smrj  *
1143446Smrj  *****************************************************************************/
1153446Smrj 
1163446Smrj #include "acpi.h"
1179980SDana.Myers@Sun.COM #include "accommon.h"
1183446Smrj #include "acevents.h"
1193446Smrj #include "acnamesp.h"
1203446Smrj 
1213446Smrj #define _COMPONENT          ACPI_EVENTS
1223446Smrj         ACPI_MODULE_NAME    ("evgpe")
1233446Smrj 
1243446Smrj /* Local prototypes */
1253446Smrj 
1263446Smrj static void ACPI_SYSTEM_XFACE
1273446Smrj AcpiEvAsynchExecuteGpeMethod (
1283446Smrj     void                    *Context);
1293446Smrj 
1307851SDana.Myers@Sun.COM static void ACPI_SYSTEM_XFACE
1317851SDana.Myers@Sun.COM AcpiEvAsynchEnableGpe (
1327851SDana.Myers@Sun.COM     void                    *Context);
1337851SDana.Myers@Sun.COM 
1343446Smrj 
1353446Smrj /*******************************************************************************
1363446Smrj  *
1373446Smrj  * FUNCTION:    AcpiEvSetGpeType
1383446Smrj  *
1393446Smrj  * PARAMETERS:  GpeEventInfo            - GPE to set
1403446Smrj  *              Type                    - New type
1413446Smrj  *
1423446Smrj  * RETURN:      Status
1433446Smrj  *
1443446Smrj  * DESCRIPTION: Sets the new type for the GPE (wake, run, or wake/run)
1453446Smrj  *
1463446Smrj  ******************************************************************************/
1473446Smrj 
1483446Smrj ACPI_STATUS
AcpiEvSetGpeType(ACPI_GPE_EVENT_INFO * GpeEventInfo,UINT8 Type)1493446Smrj AcpiEvSetGpeType (
1503446Smrj     ACPI_GPE_EVENT_INFO     *GpeEventInfo,
1513446Smrj     UINT8                   Type)
1523446Smrj {
1533446Smrj     ACPI_STATUS             Status;
1543446Smrj 
1553446Smrj 
1563446Smrj     ACPI_FUNCTION_TRACE (EvSetGpeType);
1573446Smrj 
1583446Smrj 
1593446Smrj     /* Validate type and update register enable masks */
1603446Smrj 
1613446Smrj     switch (Type)
1623446Smrj     {
1633446Smrj     case ACPI_GPE_TYPE_WAKE:
1643446Smrj     case ACPI_GPE_TYPE_RUNTIME:
1653446Smrj     case ACPI_GPE_TYPE_WAKE_RUN:
1663446Smrj         break;
1673446Smrj 
1683446Smrj     default:
1693446Smrj         return_ACPI_STATUS (AE_BAD_PARAMETER);
1703446Smrj     }
1713446Smrj 
1723446Smrj     /* Disable the GPE if currently enabled */
1733446Smrj 
1743446Smrj     Status = AcpiEvDisableGpe (GpeEventInfo);
1753446Smrj 
1769980SDana.Myers@Sun.COM     /* Clear the type bits and insert the new Type */
1773446Smrj 
1789980SDana.Myers@Sun.COM     GpeEventInfo->Flags &= ~ACPI_GPE_TYPE_MASK;
1799980SDana.Myers@Sun.COM     GpeEventInfo->Flags |= Type;
1803446Smrj     return_ACPI_STATUS (Status);
1813446Smrj }
1823446Smrj 
1833446Smrj 
1843446Smrj /*******************************************************************************
1853446Smrj  *
1863446Smrj  * FUNCTION:    AcpiEvUpdateGpeEnableMasks
1873446Smrj  *
1883446Smrj  * PARAMETERS:  GpeEventInfo            - GPE to update
1893446Smrj  *              Type                    - What to do: ACPI_GPE_DISABLE or
1903446Smrj  *                                        ACPI_GPE_ENABLE
1913446Smrj  *
1923446Smrj  * RETURN:      Status
1933446Smrj  *
1943446Smrj  * DESCRIPTION: Updates GPE register enable masks based on the GPE type
1953446Smrj  *
1963446Smrj  ******************************************************************************/
1973446Smrj 
1983446Smrj ACPI_STATUS
AcpiEvUpdateGpeEnableMasks(ACPI_GPE_EVENT_INFO * GpeEventInfo,UINT8 Type)1993446Smrj AcpiEvUpdateGpeEnableMasks (
2003446Smrj     ACPI_GPE_EVENT_INFO     *GpeEventInfo,
2013446Smrj     UINT8                   Type)
2023446Smrj {
2033446Smrj     ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
2043446Smrj     UINT8                   RegisterBit;
2053446Smrj 
2063446Smrj 
2073446Smrj     ACPI_FUNCTION_TRACE (EvUpdateGpeEnableMasks);
2083446Smrj 
2093446Smrj 
2103446Smrj     GpeRegisterInfo = GpeEventInfo->RegisterInfo;
2113446Smrj     if (!GpeRegisterInfo)
2123446Smrj     {
2133446Smrj         return_ACPI_STATUS (AE_NOT_EXIST);
2143446Smrj     }
2159980SDana.Myers@Sun.COM 
2167851SDana.Myers@Sun.COM     RegisterBit = (UINT8)
2177851SDana.Myers@Sun.COM         (1 << (GpeEventInfo->GpeNumber - GpeRegisterInfo->BaseGpeNumber));
2183446Smrj 
2199980SDana.Myers@Sun.COM     /* 1) Disable case. Simply clear all enable bits */
2203446Smrj 
2213446Smrj     if (Type == ACPI_GPE_DISABLE)
2223446Smrj     {
2233446Smrj         ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForWake, RegisterBit);
2243446Smrj         ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForRun, RegisterBit);
2253446Smrj         return_ACPI_STATUS (AE_OK);
2263446Smrj     }
2273446Smrj 
2289980SDana.Myers@Sun.COM     /* 2) Enable case. Set/Clear the appropriate enable bits */
2293446Smrj 
2303446Smrj     switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK)
2313446Smrj     {
2323446Smrj     case ACPI_GPE_TYPE_WAKE:
2333446Smrj         ACPI_SET_BIT   (GpeRegisterInfo->EnableForWake, RegisterBit);
2343446Smrj         ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForRun, RegisterBit);
2353446Smrj         break;
2363446Smrj 
2373446Smrj     case ACPI_GPE_TYPE_RUNTIME:
2383446Smrj         ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForWake, RegisterBit);
2393446Smrj         ACPI_SET_BIT   (GpeRegisterInfo->EnableForRun, RegisterBit);
2403446Smrj         break;
2413446Smrj 
2423446Smrj     case ACPI_GPE_TYPE_WAKE_RUN:
2433446Smrj         ACPI_SET_BIT   (GpeRegisterInfo->EnableForWake, RegisterBit);
2443446Smrj         ACPI_SET_BIT   (GpeRegisterInfo->EnableForRun, RegisterBit);
2453446Smrj         break;
2463446Smrj 
2473446Smrj     default:
2483446Smrj         return_ACPI_STATUS (AE_BAD_PARAMETER);
2493446Smrj     }
2503446Smrj 
2513446Smrj     return_ACPI_STATUS (AE_OK);
2523446Smrj }
2533446Smrj 
2543446Smrj 
2553446Smrj /*******************************************************************************
2563446Smrj  *
2573446Smrj  * FUNCTION:    AcpiEvEnableGpe
2583446Smrj  *
2593446Smrj  * PARAMETERS:  GpeEventInfo            - GPE to enable
2603446Smrj  *              WriteToHardware         - Enable now, or just mark data structs
2613446Smrj  *                                        (WAKE GPEs should be deferred)
2623446Smrj  *
2633446Smrj  * RETURN:      Status
2643446Smrj  *
2653446Smrj  * DESCRIPTION: Enable a GPE based on the GPE type
2663446Smrj  *
2673446Smrj  ******************************************************************************/
2683446Smrj 
2693446Smrj ACPI_STATUS
AcpiEvEnableGpe(ACPI_GPE_EVENT_INFO * GpeEventInfo,BOOLEAN WriteToHardware)2703446Smrj AcpiEvEnableGpe (
2713446Smrj     ACPI_GPE_EVENT_INFO     *GpeEventInfo,
2723446Smrj     BOOLEAN                 WriteToHardware)
2733446Smrj {
2743446Smrj     ACPI_STATUS             Status;
2753446Smrj 
2763446Smrj 
2773446Smrj     ACPI_FUNCTION_TRACE (EvEnableGpe);
2783446Smrj 
2793446Smrj 
2803446Smrj     /* Make sure HW enable masks are updated */
2813446Smrj 
2823446Smrj     Status = AcpiEvUpdateGpeEnableMasks (GpeEventInfo, ACPI_GPE_ENABLE);
2833446Smrj     if (ACPI_FAILURE (Status))
2843446Smrj     {
2853446Smrj         return_ACPI_STATUS (Status);
2863446Smrj     }
2873446Smrj 
2883446Smrj     /* Mark wake-enabled or HW enable, or both */
2893446Smrj 
2903446Smrj     switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK)
2913446Smrj     {
2923446Smrj     case ACPI_GPE_TYPE_WAKE:
2933446Smrj 
2943446Smrj         ACPI_SET_BIT (GpeEventInfo->Flags, ACPI_GPE_WAKE_ENABLED);
2953446Smrj         break;
2963446Smrj 
2973446Smrj     case ACPI_GPE_TYPE_WAKE_RUN:
2983446Smrj 
2993446Smrj         ACPI_SET_BIT (GpeEventInfo->Flags, ACPI_GPE_WAKE_ENABLED);
3003446Smrj 
3013446Smrj         /*lint -fallthrough */
3023446Smrj 
3033446Smrj     case ACPI_GPE_TYPE_RUNTIME:
3043446Smrj 
3053446Smrj         ACPI_SET_BIT (GpeEventInfo->Flags, ACPI_GPE_RUN_ENABLED);
3063446Smrj 
3073446Smrj         if (WriteToHardware)
3083446Smrj         {
3093446Smrj             /* Clear the GPE (of stale events), then enable it */
3103446Smrj 
3113446Smrj             Status = AcpiHwClearGpe (GpeEventInfo);
3123446Smrj             if (ACPI_FAILURE (Status))
3133446Smrj             {
3143446Smrj                 return_ACPI_STATUS (Status);
3153446Smrj             }
3163446Smrj 
3173446Smrj             /* Enable the requested runtime GPE */
3183446Smrj 
3193446Smrj             Status = AcpiHwWriteGpeEnableReg (GpeEventInfo);
3203446Smrj         }
3213446Smrj         break;
3223446Smrj 
3233446Smrj     default:
3243446Smrj         return_ACPI_STATUS (AE_BAD_PARAMETER);
3253446Smrj     }
3263446Smrj 
3273446Smrj     return_ACPI_STATUS (AE_OK);
3283446Smrj }
3293446Smrj 
3303446Smrj 
3313446Smrj /*******************************************************************************
3323446Smrj  *
3333446Smrj  * FUNCTION:    AcpiEvDisableGpe
3343446Smrj  *
3353446Smrj  * PARAMETERS:  GpeEventInfo            - GPE to disable
3363446Smrj  *
3373446Smrj  * RETURN:      Status
3383446Smrj  *
3393446Smrj  * DESCRIPTION: Disable a GPE based on the GPE type
3403446Smrj  *
3413446Smrj  ******************************************************************************/
3423446Smrj 
3433446Smrj ACPI_STATUS
AcpiEvDisableGpe(ACPI_GPE_EVENT_INFO * GpeEventInfo)3443446Smrj AcpiEvDisableGpe (
3453446Smrj     ACPI_GPE_EVENT_INFO     *GpeEventInfo)
3463446Smrj {
3473446Smrj     ACPI_STATUS             Status;
3483446Smrj 
3493446Smrj 
3503446Smrj     ACPI_FUNCTION_TRACE (EvDisableGpe);
3513446Smrj 
3523446Smrj 
3537851SDana.Myers@Sun.COM     /*
3547851SDana.Myers@Sun.COM      * Note: Always disable the GPE, even if we think that that it is already
3557851SDana.Myers@Sun.COM      * disabled. It is possible that the AML or some other code has enabled
3567851SDana.Myers@Sun.COM      * the GPE behind our back.
3577851SDana.Myers@Sun.COM      */
3583446Smrj 
3593446Smrj     /* Make sure HW enable masks are updated */
3603446Smrj 
3613446Smrj     Status = AcpiEvUpdateGpeEnableMasks (GpeEventInfo, ACPI_GPE_DISABLE);
3623446Smrj     if (ACPI_FAILURE (Status))
3633446Smrj     {
3643446Smrj         return_ACPI_STATUS (Status);
3653446Smrj     }
3663446Smrj 
3677851SDana.Myers@Sun.COM     /* Clear the appropriate enabled flags for this GPE */
3683446Smrj 
3693446Smrj     switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK)
3703446Smrj     {
3713446Smrj     case ACPI_GPE_TYPE_WAKE:
3727851SDana.Myers@Sun.COM 
3733446Smrj         ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_WAKE_ENABLED);
3743446Smrj         break;
3753446Smrj 
3763446Smrj     case ACPI_GPE_TYPE_WAKE_RUN:
3777851SDana.Myers@Sun.COM 
3783446Smrj         ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_WAKE_ENABLED);
3793446Smrj 
3803446Smrj         /*lint -fallthrough */
3813446Smrj 
3823446Smrj     case ACPI_GPE_TYPE_RUNTIME:
3833446Smrj 
3843446Smrj         /* Disable the requested runtime GPE */
3853446Smrj 
3863446Smrj         ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_RUN_ENABLED);
3873446Smrj         break;
3883446Smrj 
3893446Smrj     default:
3907851SDana.Myers@Sun.COM         break;
3913446Smrj     }
3923446Smrj 
3937851SDana.Myers@Sun.COM     /*
3947851SDana.Myers@Sun.COM      * Always H/W disable this GPE, even if we don't know the GPE type.
3957851SDana.Myers@Sun.COM      * Simply clear the enable bit for this particular GPE, but do not
3967851SDana.Myers@Sun.COM      * write out the current GPE enable mask since this may inadvertently
3977851SDana.Myers@Sun.COM      * enable GPEs too early. An example is a rogue GPE that has arrived
3987851SDana.Myers@Sun.COM      * during ACPICA initialization - possibly because AML or other code
3997851SDana.Myers@Sun.COM      * has enabled the GPE.
4007851SDana.Myers@Sun.COM      */
4017851SDana.Myers@Sun.COM     Status = AcpiHwLowDisableGpe (GpeEventInfo);
4027851SDana.Myers@Sun.COM     return_ACPI_STATUS (Status);
4033446Smrj }
4043446Smrj 
4053446Smrj 
4063446Smrj /*******************************************************************************
4073446Smrj  *
4083446Smrj  * FUNCTION:    AcpiEvGetGpeEventInfo
4093446Smrj  *
4109980SDana.Myers@Sun.COM  * PARAMETERS:  GpeDevice           - Device node. NULL for GPE0/GPE1
4113446Smrj  *              GpeNumber           - Raw GPE number
4123446Smrj  *
4139980SDana.Myers@Sun.COM  * RETURN:      A GPE EventInfo struct. NULL if not a valid GPE
4143446Smrj  *
4153446Smrj  * DESCRIPTION: Returns the EventInfo struct associated with this GPE.
4163446Smrj  *              Validates the GpeBlock and the GpeNumber
4173446Smrj  *
4183446Smrj  *              Should be called only when the GPE lists are semaphore locked
4193446Smrj  *              and not subject to change.
4203446Smrj  *
4213446Smrj  ******************************************************************************/
4223446Smrj 
4233446Smrj ACPI_GPE_EVENT_INFO *
AcpiEvGetGpeEventInfo(ACPI_HANDLE GpeDevice,UINT32 GpeNumber)4243446Smrj AcpiEvGetGpeEventInfo (
4253446Smrj     ACPI_HANDLE             GpeDevice,
4263446Smrj     UINT32                  GpeNumber)
4273446Smrj {
4283446Smrj     ACPI_OPERAND_OBJECT     *ObjDesc;
4293446Smrj     ACPI_GPE_BLOCK_INFO     *GpeBlock;
4307851SDana.Myers@Sun.COM     UINT32                  i;
4313446Smrj 
4323446Smrj 
4333446Smrj     ACPI_FUNCTION_ENTRY ();
4343446Smrj 
4353446Smrj 
4363446Smrj     /* A NULL GpeBlock means use the FADT-defined GPE block(s) */
4373446Smrj 
4383446Smrj     if (!GpeDevice)
4393446Smrj     {
4403446Smrj         /* Examine GPE Block 0 and 1 (These blocks are permanent) */
4413446Smrj 
4423446Smrj         for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++)
4433446Smrj         {
4443446Smrj             GpeBlock = AcpiGbl_GpeFadtBlocks[i];
4453446Smrj             if (GpeBlock)
4463446Smrj             {
4473446Smrj                 if ((GpeNumber >= GpeBlock->BlockBaseNumber) &&
4483446Smrj                     (GpeNumber < GpeBlock->BlockBaseNumber +
4493446Smrj                         (GpeBlock->RegisterCount * 8)))
4503446Smrj                 {
4513446Smrj                     return (&GpeBlock->EventInfo[GpeNumber -
4523446Smrj                         GpeBlock->BlockBaseNumber]);
4533446Smrj                 }
4543446Smrj             }
4553446Smrj         }
4563446Smrj 
4573446Smrj         /* The GpeNumber was not in the range of either FADT GPE block */
4583446Smrj 
4593446Smrj         return (NULL);
4603446Smrj     }
4613446Smrj 
4623446Smrj     /* A Non-NULL GpeDevice means this is a GPE Block Device */
4633446Smrj 
4643446Smrj     ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) GpeDevice);
4653446Smrj     if (!ObjDesc ||
4663446Smrj         !ObjDesc->Device.GpeBlock)
4673446Smrj     {
4683446Smrj         return (NULL);
4693446Smrj     }
4703446Smrj 
4713446Smrj     GpeBlock = ObjDesc->Device.GpeBlock;
4723446Smrj 
4733446Smrj     if ((GpeNumber >= GpeBlock->BlockBaseNumber) &&
4743446Smrj         (GpeNumber < GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8)))
4753446Smrj     {
4763446Smrj         return (&GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber]);
4773446Smrj     }
4783446Smrj 
4793446Smrj     return (NULL);
4803446Smrj }
4813446Smrj 
4823446Smrj 
4833446Smrj /*******************************************************************************
4843446Smrj  *
4853446Smrj  * FUNCTION:    AcpiEvGpeDetect
4863446Smrj  *
4873446Smrj  * PARAMETERS:  GpeXruptList        - Interrupt block for this interrupt.
4883446Smrj  *                                    Can have multiple GPE blocks attached.
4893446Smrj  *
4903446Smrj  * RETURN:      INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
4913446Smrj  *
4929980SDana.Myers@Sun.COM  * DESCRIPTION: Detect if any GP events have occurred. This function is
4933446Smrj  *              executed at interrupt level.
4943446Smrj  *
4953446Smrj  ******************************************************************************/
4963446Smrj 
4973446Smrj UINT32
AcpiEvGpeDetect(ACPI_GPE_XRUPT_INFO * GpeXruptList)4983446Smrj AcpiEvGpeDetect (
4993446Smrj     ACPI_GPE_XRUPT_INFO     *GpeXruptList)
5003446Smrj {
5013446Smrj     ACPI_STATUS             Status;
5023446Smrj     ACPI_GPE_BLOCK_INFO     *GpeBlock;
5033446Smrj     ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
5043446Smrj     UINT32                  IntStatus = ACPI_INTERRUPT_NOT_HANDLED;
5053446Smrj     UINT8                   EnabledStatusByte;
5063446Smrj     UINT32                  StatusReg;
5073446Smrj     UINT32                  EnableReg;
5083446Smrj     ACPI_CPU_FLAGS          Flags;
5097851SDana.Myers@Sun.COM     UINT32                  i;
5107851SDana.Myers@Sun.COM     UINT32                  j;
5113446Smrj 
5123446Smrj 
5133446Smrj     ACPI_FUNCTION_NAME (EvGpeDetect);
5143446Smrj 
5153446Smrj     /* Check for the case where there are no GPEs */
5163446Smrj 
5173446Smrj     if (!GpeXruptList)
5183446Smrj     {
5193446Smrj         return (IntStatus);
5203446Smrj     }
5213446Smrj 
5223446Smrj     /*
5233446Smrj      * We need to obtain the GPE lock for both the data structs and registers
5249980SDana.Myers@Sun.COM      * Note: Not necessary to obtain the hardware lock, since the GPE
5259980SDana.Myers@Sun.COM      * registers are owned by the GpeLock.
5263446Smrj      */
5273446Smrj     Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
5283446Smrj 
5293446Smrj     /* Examine all GPE blocks attached to this interrupt level */
5303446Smrj 
5313446Smrj     GpeBlock = GpeXruptList->GpeBlockListHead;
5323446Smrj     while (GpeBlock)
5333446Smrj     {
5343446Smrj         /*
5359980SDana.Myers@Sun.COM          * Read all of the 8-bit GPE status and enable registers in this GPE
5369980SDana.Myers@Sun.COM          * block, saving all of them. Find all currently active GP events.
5373446Smrj          */
5383446Smrj         for (i = 0; i < GpeBlock->RegisterCount; i++)
5393446Smrj         {
5403446Smrj             /* Get the next status/enable pair */
5413446Smrj 
5423446Smrj             GpeRegisterInfo = &GpeBlock->RegisterInfo[i];
5433446Smrj 
5443446Smrj             /* Read the Status Register */
5453446Smrj 
546*11225SDana.Myers@Sun.COM             Status = AcpiHwRead (&StatusReg, &GpeRegisterInfo->StatusAddress);
5473446Smrj             if (ACPI_FAILURE (Status))
5483446Smrj             {
5493446Smrj                 goto UnlockAndExit;
5503446Smrj             }
5513446Smrj 
5523446Smrj             /* Read the Enable Register */
5533446Smrj 
554*11225SDana.Myers@Sun.COM             Status = AcpiHwRead (&EnableReg, &GpeRegisterInfo->EnableAddress);
5553446Smrj             if (ACPI_FAILURE (Status))
5563446Smrj             {
5573446Smrj                 goto UnlockAndExit;
5583446Smrj             }
5593446Smrj 
5603446Smrj             ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
5613446Smrj                 "Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n",
5623446Smrj                 GpeRegisterInfo->BaseGpeNumber, StatusReg, EnableReg));
5633446Smrj 
5643446Smrj             /* Check if there is anything active at all in this register */
5653446Smrj 
5663446Smrj             EnabledStatusByte = (UINT8) (StatusReg & EnableReg);
5673446Smrj             if (!EnabledStatusByte)
5683446Smrj             {
5693446Smrj                 /* No active GPEs in this register, move on */
5703446Smrj 
5713446Smrj                 continue;
5723446Smrj             }
5733446Smrj 
5743446Smrj             /* Now look at the individual GPEs in this byte register */
5753446Smrj 
5763446Smrj             for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
5773446Smrj             {
5783446Smrj                 /* Examine one GPE bit */
5793446Smrj 
5807851SDana.Myers@Sun.COM                 if (EnabledStatusByte & (1 << j))
5813446Smrj                 {
5823446Smrj                     /*
5833446Smrj                      * Found an active GPE. Dispatch the event to a handler
5843446Smrj                      * or method.
5853446Smrj                      */
5863446Smrj                     IntStatus |= AcpiEvGpeDispatch (
5879980SDana.Myers@Sun.COM                         &GpeBlock->EventInfo[((ACPI_SIZE) i *
5889980SDana.Myers@Sun.COM                             ACPI_GPE_REGISTER_WIDTH) + j],
5897851SDana.Myers@Sun.COM                         j + GpeRegisterInfo->BaseGpeNumber);
5903446Smrj                 }
5913446Smrj             }
5923446Smrj         }
5933446Smrj 
5943446Smrj         GpeBlock = GpeBlock->Next;
5953446Smrj     }
5963446Smrj 
5973446Smrj UnlockAndExit:
5983446Smrj 
5993446Smrj     AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
6003446Smrj     return (IntStatus);
6013446Smrj }
6023446Smrj 
6033446Smrj 
6043446Smrj /*******************************************************************************
6053446Smrj  *
6063446Smrj  * FUNCTION:    AcpiEvAsynchExecuteGpeMethod
6073446Smrj  *
6083446Smrj  * PARAMETERS:  Context (GpeEventInfo) - Info for this GPE
6093446Smrj  *
6103446Smrj  * RETURN:      None
6113446Smrj  *
6123446Smrj  * DESCRIPTION: Perform the actual execution of a GPE control method. This
6133446Smrj  *              function is called from an invocation of AcpiOsExecute and
6143446Smrj  *              therefore does NOT execute at interrupt level - so that
6153446Smrj  *              the control method itself is not executed in the context of
6163446Smrj  *              an interrupt handler.
6173446Smrj  *
6183446Smrj  ******************************************************************************/
6193446Smrj 
6203446Smrj static void ACPI_SYSTEM_XFACE
AcpiEvAsynchExecuteGpeMethod(void * Context)6213446Smrj AcpiEvAsynchExecuteGpeMethod (
6223446Smrj     void                    *Context)
6233446Smrj {
6247851SDana.Myers@Sun.COM     ACPI_GPE_EVENT_INFO     *GpeEventInfo = Context;
6253446Smrj     ACPI_STATUS             Status;
6267851SDana.Myers@Sun.COM     ACPI_GPE_EVENT_INFO     *LocalGpeEventInfo;
6273446Smrj     ACPI_EVALUATE_INFO      *Info;
6283446Smrj 
6293446Smrj 
6303446Smrj     ACPI_FUNCTION_TRACE (EvAsynchExecuteGpeMethod);
6313446Smrj 
6323446Smrj 
6337851SDana.Myers@Sun.COM     /* Allocate a local GPE block */
6347851SDana.Myers@Sun.COM 
6357851SDana.Myers@Sun.COM     LocalGpeEventInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_EVENT_INFO));
6367851SDana.Myers@Sun.COM     if (!LocalGpeEventInfo)
6377851SDana.Myers@Sun.COM     {
6387851SDana.Myers@Sun.COM         ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY,
6397851SDana.Myers@Sun.COM             "while handling a GPE"));
6407851SDana.Myers@Sun.COM         return_VOID;
6417851SDana.Myers@Sun.COM     }
6427851SDana.Myers@Sun.COM 
6433446Smrj     Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
6443446Smrj     if (ACPI_FAILURE (Status))
6453446Smrj     {
6463446Smrj         return_VOID;
6473446Smrj     }
6483446Smrj 
6493446Smrj     /* Must revalidate the GpeNumber/GpeBlock */
6503446Smrj 
6513446Smrj     if (!AcpiEvValidGpeEvent (GpeEventInfo))
6523446Smrj     {
6533446Smrj         Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
6543446Smrj         return_VOID;
6553446Smrj     }
6563446Smrj 
6573446Smrj     /* Set the GPE flags for return to enabled state */
6583446Smrj 
6593446Smrj     (void) AcpiEvEnableGpe (GpeEventInfo, FALSE);
6603446Smrj 
6613446Smrj     /*
6629980SDana.Myers@Sun.COM      * Take a snapshot of the GPE info for this level - we copy the info to
6639980SDana.Myers@Sun.COM      * prevent a race condition with RemoveHandler/RemoveBlock.
6643446Smrj      */
6657851SDana.Myers@Sun.COM     ACPI_MEMCPY (LocalGpeEventInfo, GpeEventInfo,
6663446Smrj         sizeof (ACPI_GPE_EVENT_INFO));
6673446Smrj 
6683446Smrj     Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
6693446Smrj     if (ACPI_FAILURE (Status))
6703446Smrj     {
6713446Smrj         return_VOID;
6723446Smrj     }
6733446Smrj 
6743446Smrj     /*
6759980SDana.Myers@Sun.COM      * Must check for control method type dispatch one more time to avoid a
6769980SDana.Myers@Sun.COM      * race with EvGpeInstallHandler
6773446Smrj      */
6787851SDana.Myers@Sun.COM     if ((LocalGpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
6793446Smrj             ACPI_GPE_DISPATCH_METHOD)
6803446Smrj     {
6813446Smrj         /* Allocate the evaluation information block */
6823446Smrj 
6833446Smrj         Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
6843446Smrj         if (!Info)
6853446Smrj         {
6863446Smrj             Status = AE_NO_MEMORY;
6873446Smrj         }
6883446Smrj         else
6893446Smrj         {
6903446Smrj             /*
6913446Smrj              * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx
6923446Smrj              * control method that corresponds to this GPE
6933446Smrj              */
6947851SDana.Myers@Sun.COM             Info->PrefixNode = LocalGpeEventInfo->Dispatch.MethodNode;
6953446Smrj             Info->Flags = ACPI_IGNORE_RETURN_VALUE;
6963446Smrj 
6973446Smrj             Status = AcpiNsEvaluate (Info);
6983446Smrj             ACPI_FREE (Info);
6993446Smrj         }
7003446Smrj 
7013446Smrj         if (ACPI_FAILURE (Status))
7023446Smrj         {
7033446Smrj             ACPI_EXCEPTION ((AE_INFO, Status,
7047851SDana.Myers@Sun.COM                 "while evaluating GPE method [%4.4s]",
7057851SDana.Myers@Sun.COM                 AcpiUtGetNodeName (LocalGpeEventInfo->Dispatch.MethodNode)));
7063446Smrj         }
7073446Smrj     }
7083446Smrj 
7097851SDana.Myers@Sun.COM     /* Defer enabling of GPE until all notify handlers are done */
7107851SDana.Myers@Sun.COM 
7117851SDana.Myers@Sun.COM     Status = AcpiOsExecute (OSL_NOTIFY_HANDLER,
7127851SDana.Myers@Sun.COM                 AcpiEvAsynchEnableGpe, LocalGpeEventInfo);
7137851SDana.Myers@Sun.COM     if (ACPI_FAILURE (Status))
7147851SDana.Myers@Sun.COM     {
7157851SDana.Myers@Sun.COM         ACPI_FREE (LocalGpeEventInfo);
7167851SDana.Myers@Sun.COM     }
7177851SDana.Myers@Sun.COM     return_VOID;
7187851SDana.Myers@Sun.COM }
7197851SDana.Myers@Sun.COM 
7207851SDana.Myers@Sun.COM 
7217851SDana.Myers@Sun.COM /*******************************************************************************
7227851SDana.Myers@Sun.COM  *
7237851SDana.Myers@Sun.COM  * FUNCTION:    AcpiEvAsynchEnableGpe
7247851SDana.Myers@Sun.COM  *
7257851SDana.Myers@Sun.COM  * PARAMETERS:  Context (GpeEventInfo) - Info for this GPE
7267851SDana.Myers@Sun.COM  *
7277851SDana.Myers@Sun.COM  * RETURN:      None
7287851SDana.Myers@Sun.COM  *
7297851SDana.Myers@Sun.COM  * DESCRIPTION: Asynchronous clear/enable for GPE. This allows the GPE to
7307851SDana.Myers@Sun.COM  *              complete (i.e., finish execution of Notify)
7317851SDana.Myers@Sun.COM  *
7327851SDana.Myers@Sun.COM  ******************************************************************************/
7337851SDana.Myers@Sun.COM 
7347851SDana.Myers@Sun.COM static void ACPI_SYSTEM_XFACE
AcpiEvAsynchEnableGpe(void * Context)7357851SDana.Myers@Sun.COM AcpiEvAsynchEnableGpe (
7367851SDana.Myers@Sun.COM     void                    *Context)
7377851SDana.Myers@Sun.COM {
7387851SDana.Myers@Sun.COM     ACPI_GPE_EVENT_INFO     *GpeEventInfo = Context;
7397851SDana.Myers@Sun.COM     ACPI_STATUS             Status;
7407851SDana.Myers@Sun.COM 
7417851SDana.Myers@Sun.COM 
7427851SDana.Myers@Sun.COM     if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
7433446Smrj             ACPI_GPE_LEVEL_TRIGGERED)
7443446Smrj     {
7453446Smrj         /*
7469980SDana.Myers@Sun.COM          * GPE is level-triggered, we clear the GPE status bit after handling
7479980SDana.Myers@Sun.COM          * the event.
7483446Smrj          */
7497851SDana.Myers@Sun.COM         Status = AcpiHwClearGpe (GpeEventInfo);
7503446Smrj         if (ACPI_FAILURE (Status))
7513446Smrj         {
7527851SDana.Myers@Sun.COM             goto Exit;
7533446Smrj         }
7543446Smrj     }
7553446Smrj 
7563446Smrj     /* Enable this GPE */
7573446Smrj 
7587851SDana.Myers@Sun.COM     (void) AcpiHwWriteGpeEnableReg (GpeEventInfo);
7597851SDana.Myers@Sun.COM 
7607851SDana.Myers@Sun.COM Exit:
7617851SDana.Myers@Sun.COM     ACPI_FREE (GpeEventInfo);
7627851SDana.Myers@Sun.COM     return;
7633446Smrj }
7643446Smrj 
7653446Smrj 
7663446Smrj /*******************************************************************************
7673446Smrj  *
7683446Smrj  * FUNCTION:    AcpiEvGpeDispatch
7693446Smrj  *
7703446Smrj  * PARAMETERS:  GpeEventInfo    - Info for this GPE
7713446Smrj  *              GpeNumber       - Number relative to the parent GPE block
7723446Smrj  *
7733446Smrj  * RETURN:      INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
7743446Smrj  *
7753446Smrj  * DESCRIPTION: Dispatch a General Purpose Event to either a function (e.g. EC)
7763446Smrj  *              or method (e.g. _Lxx/_Exx) handler.
7773446Smrj  *
7783446Smrj  *              This function executes at interrupt level.
7793446Smrj  *
7803446Smrj  ******************************************************************************/
7813446Smrj 
7823446Smrj UINT32
AcpiEvGpeDispatch(ACPI_GPE_EVENT_INFO * GpeEventInfo,UINT32 GpeNumber)7833446Smrj AcpiEvGpeDispatch (
7843446Smrj     ACPI_GPE_EVENT_INFO     *GpeEventInfo,
7853446Smrj     UINT32                  GpeNumber)
7863446Smrj {
7873446Smrj     ACPI_STATUS             Status;
7883446Smrj 
7893446Smrj 
7903446Smrj     ACPI_FUNCTION_TRACE (EvGpeDispatch);
7913446Smrj 
7923446Smrj 
7937851SDana.Myers@Sun.COM     AcpiGpeCount++;
7947851SDana.Myers@Sun.COM 
7953446Smrj     /*
7969980SDana.Myers@Sun.COM      * If edge-triggered, clear the GPE status bit now. Note that
7973446Smrj      * level-triggered events are cleared after the GPE is serviced.
7983446Smrj      */
7993446Smrj     if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
8003446Smrj             ACPI_GPE_EDGE_TRIGGERED)
8013446Smrj     {
8023446Smrj         Status = AcpiHwClearGpe (GpeEventInfo);
8033446Smrj         if (ACPI_FAILURE (Status))
8043446Smrj         {
8053446Smrj             ACPI_EXCEPTION ((AE_INFO, Status,
8063446Smrj                 "Unable to clear GPE[%2X]", GpeNumber));
8073446Smrj             return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED);
8083446Smrj         }
8093446Smrj     }
8103446Smrj 
8113446Smrj     /*
8127851SDana.Myers@Sun.COM      * Dispatch the GPE to either an installed handler, or the control method
8137851SDana.Myers@Sun.COM      * associated with this GPE (_Lxx or _Exx). If a handler exists, we invoke
8147851SDana.Myers@Sun.COM      * it and do not attempt to run the method. If there is neither a handler
8157851SDana.Myers@Sun.COM      * nor a method, we disable this GPE to prevent further such pointless
8167851SDana.Myers@Sun.COM      * events from firing.
8173446Smrj      */
8183446Smrj     switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK)
8193446Smrj     {
8203446Smrj     case ACPI_GPE_DISPATCH_HANDLER:
8213446Smrj 
8223446Smrj         /*
8233446Smrj          * Invoke the installed handler (at interrupt level)
8249980SDana.Myers@Sun.COM          * Ignore return status for now.
8259980SDana.Myers@Sun.COM          * TBD: leave GPE disabled on error?
8263446Smrj          */
8273446Smrj         (void) GpeEventInfo->Dispatch.Handler->Address (
8283446Smrj                         GpeEventInfo->Dispatch.Handler->Context);
8293446Smrj 
8303446Smrj         /* It is now safe to clear level-triggered events. */
8313446Smrj 
8323446Smrj         if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
8333446Smrj                 ACPI_GPE_LEVEL_TRIGGERED)
8343446Smrj         {
8353446Smrj             Status = AcpiHwClearGpe (GpeEventInfo);
8363446Smrj             if (ACPI_FAILURE (Status))
8373446Smrj             {
8383446Smrj                 ACPI_EXCEPTION ((AE_INFO, Status,
8393446Smrj                     "Unable to clear GPE[%2X]", GpeNumber));
8403446Smrj                 return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED);
8413446Smrj             }
8423446Smrj         }
8433446Smrj         break;
8443446Smrj 
8453446Smrj     case ACPI_GPE_DISPATCH_METHOD:
8463446Smrj 
8473446Smrj         /*
8487851SDana.Myers@Sun.COM          * Disable the GPE, so it doesn't keep firing before the method has a
8497851SDana.Myers@Sun.COM          * chance to run (it runs asynchronously with interrupts enabled).
8503446Smrj          */
8513446Smrj         Status = AcpiEvDisableGpe (GpeEventInfo);
8523446Smrj         if (ACPI_FAILURE (Status))
8533446Smrj         {
8543446Smrj             ACPI_EXCEPTION ((AE_INFO, Status,
8553446Smrj                 "Unable to disable GPE[%2X]", GpeNumber));
8563446Smrj             return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED);
8573446Smrj         }
8583446Smrj 
8593446Smrj         /*
8603446Smrj          * Execute the method associated with the GPE
8613446Smrj          * NOTE: Level-triggered GPEs are cleared after the method completes.
8623446Smrj          */
8633446Smrj         Status = AcpiOsExecute (OSL_GPE_HANDLER,
8643446Smrj                     AcpiEvAsynchExecuteGpeMethod, GpeEventInfo);
8653446Smrj         if (ACPI_FAILURE (Status))
8663446Smrj         {
8673446Smrj             ACPI_EXCEPTION ((AE_INFO, Status,
8683446Smrj                 "Unable to queue handler for GPE[%2X] - event disabled",
8693446Smrj                 GpeNumber));
8703446Smrj         }
8713446Smrj         break;
8723446Smrj 
8733446Smrj     default:
8743446Smrj 
8753446Smrj         /* No handler or method to run! */
8763446Smrj 
8773446Smrj         ACPI_ERROR ((AE_INFO,
8783446Smrj             "No handler or method for GPE[%2X], disabling event",
8793446Smrj             GpeNumber));
8803446Smrj 
8813446Smrj         /*
8829980SDana.Myers@Sun.COM          * Disable the GPE. The GPE will remain disabled until the ACPICA
8833446Smrj          * Core Subsystem is restarted, or a handler is installed.
8843446Smrj          */
8853446Smrj         Status = AcpiEvDisableGpe (GpeEventInfo);
8863446Smrj         if (ACPI_FAILURE (Status))
8873446Smrj         {
8883446Smrj             ACPI_EXCEPTION ((AE_INFO, Status,
8893446Smrj                 "Unable to disable GPE[%2X]", GpeNumber));
8903446Smrj             return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED);
8913446Smrj         }
8923446Smrj         break;
8933446Smrj     }
8943446Smrj 
8953446Smrj     return_UINT32 (ACPI_INTERRUPT_HANDLED);
8963446Smrj }
8973446Smrj 
898