Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:02

0001 /******************************************************************************
0002  *
0003  * Module Name: evgpeinit - System GPE initialization and update
0004  *
0005  *****************************************************************************/
0006 
0007 /******************************************************************************
0008  *
0009  * 1. Copyright Notice
0010  *
0011  * Some or all of this work - Copyright (c) 1999 - 2024, Intel Corp.
0012  * All rights reserved.
0013  *
0014  * 2. License
0015  *
0016  * 2.1. This is your license from Intel Corp. under its intellectual property
0017  * rights. You may have additional license terms from the party that provided
0018  * you this software, covering your right to use that party's intellectual
0019  * property rights.
0020  *
0021  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
0022  * copy of the source code appearing in this file ("Covered Code") an
0023  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
0024  * base code distributed originally by Intel ("Original Intel Code") to copy,
0025  * make derivatives, distribute, use and display any portion of the Covered
0026  * Code in any form, with the right to sublicense such rights; and
0027  *
0028  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
0029  * license (with the right to sublicense), under only those claims of Intel
0030  * patents that are infringed by the Original Intel Code, to make, use, sell,
0031  * offer to sell, and import the Covered Code and derivative works thereof
0032  * solely to the minimum extent necessary to exercise the above copyright
0033  * license, and in no event shall the patent license extend to any additions
0034  * to or modifications of the Original Intel Code. No other license or right
0035  * is granted directly or by implication, estoppel or otherwise;
0036  *
0037  * The above copyright and patent license is granted only if the following
0038  * conditions are met:
0039  *
0040  * 3. Conditions
0041  *
0042  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
0043  * Redistribution of source code of any substantial portion of the Covered
0044  * Code or modification with rights to further distribute source must include
0045  * the above Copyright Notice, the above License, this list of Conditions,
0046  * and the following Disclaimer and Export Compliance provision. In addition,
0047  * Licensee must cause all Covered Code to which Licensee contributes to
0048  * contain a file documenting the changes Licensee made to create that Covered
0049  * Code and the date of any change. Licensee must include in that file the
0050  * documentation of any changes made by any predecessor Licensee. Licensee
0051  * must include a prominent statement that the modification is derived,
0052  * directly or indirectly, from Original Intel Code.
0053  *
0054  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
0055  * Redistribution of source code of any substantial portion of the Covered
0056  * Code or modification without rights to further distribute source must
0057  * include the following Disclaimer and Export Compliance provision in the
0058  * documentation and/or other materials provided with distribution. In
0059  * addition, Licensee may not authorize further sublicense of source of any
0060  * portion of the Covered Code, and must include terms to the effect that the
0061  * license from Licensee to its licensee is limited to the intellectual
0062  * property embodied in the software Licensee provides to its licensee, and
0063  * not to intellectual property embodied in modifications its licensee may
0064  * make.
0065  *
0066  * 3.3. Redistribution of Executable. Redistribution in executable form of any
0067  * substantial portion of the Covered Code or modification must reproduce the
0068  * above Copyright Notice, and the following Disclaimer and Export Compliance
0069  * provision in the documentation and/or other materials provided with the
0070  * distribution.
0071  *
0072  * 3.4. Intel retains all right, title, and interest in and to the Original
0073  * Intel Code.
0074  *
0075  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
0076  * Intel shall be used in advertising or otherwise to promote the sale, use or
0077  * other dealings in products derived from or relating to the Covered Code
0078  * without prior written authorization from Intel.
0079  *
0080  * 4. Disclaimer and Export Compliance
0081  *
0082  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
0083  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
0084  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
0085  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
0086  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
0087  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
0088  * PARTICULAR PURPOSE.
0089  *
0090  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
0091  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
0092  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
0093  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
0094  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
0095  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
0096  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
0097  * LIMITED REMEDY.
0098  *
0099  * 4.3. Licensee shall not export, either directly or indirectly, any of this
0100  * software or system incorporating such software without first obtaining any
0101  * required license or other approval from the U. S. Department of Commerce or
0102  * any other agency or department of the United States Government. In the
0103  * event Licensee exports any such software from the United States or
0104  * re-exports any such software from a foreign destination, Licensee shall
0105  * ensure that the distribution and export/re-export of the software is in
0106  * compliance with all laws, regulations, orders, or other restrictions of the
0107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
0108  * any of its subsidiaries will export/re-export any technical data, process,
0109  * software, or service, directly or indirectly, to any country for which the
0110  * United States government or any agency thereof requires an export license,
0111  * other governmental approval, or letter of assurance, without first obtaining
0112  * such license, approval or letter.
0113  *
0114  *****************************************************************************
0115  *
0116  * Alternatively, you may choose to be licensed under the terms of the
0117  * following license:
0118  *
0119  * Redistribution and use in source and binary forms, with or without
0120  * modification, are permitted provided that the following conditions
0121  * are met:
0122  * 1. Redistributions of source code must retain the above copyright
0123  *    notice, this list of conditions, and the following disclaimer,
0124  *    without modification.
0125  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
0126  *    substantially similar to the "NO WARRANTY" disclaimer below
0127  *    ("Disclaimer") and any redistribution must be conditioned upon
0128  *    including a substantially similar Disclaimer requirement for further
0129  *    binary redistribution.
0130  * 3. Neither the names of the above-listed copyright holders nor the names
0131  *    of any contributors may be used to endorse or promote products derived
0132  *    from this software without specific prior written permission.
0133  *
0134  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0135  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0136  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0137  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0138  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0139  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0140  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0141  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0142  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0143  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0144  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0145  *
0146  * Alternatively, you may choose to be licensed under the terms of the
0147  * GNU General Public License ("GPL") version 2 as published by the Free
0148  * Software Foundation.
0149  *
0150  *****************************************************************************/
0151 
0152 #include "acpi.h"
0153 #include "accommon.h"
0154 #include "acevents.h"
0155 #include "acnamesp.h"
0156 
0157 #define _COMPONENT          ACPI_EVENTS
0158         ACPI_MODULE_NAME    ("evgpeinit")
0159 
0160 #if (!ACPI_REDUCED_HARDWARE) /* Entire module */
0161 
0162 /*
0163  * Note: History of _PRW support in ACPICA
0164  *
0165  * Originally (2000 - 2010), the GPE initialization code performed a walk of
0166  * the entire namespace to execute the _PRW methods and detect all GPEs
0167  * capable of waking the system.
0168  *
0169  * As of 10/2010, the _PRW method execution has been removed since it is
0170  * actually unnecessary. The host OS must in fact execute all _PRW methods
0171  * in order to identify the device/power-resource dependencies. We now put
0172  * the onus on the host OS to identify the wake GPEs as part of this process
0173  * and to inform ACPICA of these GPEs via the AcpiSetupGpeForWake interface. This
0174  * not only reduces the complexity of the ACPICA initialization code, but in
0175  * some cases (on systems with very large namespaces) it should reduce the
0176  * kernel boot time as well.
0177  */
0178 
0179 /*******************************************************************************
0180  *
0181  * FUNCTION:    AcpiEvGpeInitialize
0182  *
0183  * PARAMETERS:  None
0184  *
0185  * RETURN:      Status
0186  *
0187  * DESCRIPTION: Initialize the GPE data structures and the FADT GPE 0/1 blocks
0188  *
0189  ******************************************************************************/
0190 
0191 ACPI_STATUS
0192 AcpiEvGpeInitialize (
0193     void)
0194 {
0195     UINT32                  RegisterCount0 = 0;
0196     UINT32                  RegisterCount1 = 0;
0197     UINT32                  GpeNumberMax = 0;
0198     ACPI_STATUS             Status;
0199 
0200 
0201     ACPI_FUNCTION_TRACE (EvGpeInitialize);
0202 
0203 
0204     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
0205         "Initializing General Purpose Events (GPEs):\n"));
0206 
0207     Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
0208     if (ACPI_FAILURE (Status))
0209     {
0210         return_ACPI_STATUS (Status);
0211     }
0212 
0213     /*
0214      * Initialize the GPE Block(s) defined in the FADT
0215      *
0216      * Why the GPE register block lengths are divided by 2:  From the ACPI
0217      * Spec, section "General-Purpose Event Registers", we have:
0218      *
0219      * "Each register block contains two registers of equal length
0220      *  GPEx_STS and GPEx_EN (where x is 0 or 1). The length of the
0221      *  GPE0_STS and GPE0_EN registers is equal to half the GPE0_LEN
0222      *  The length of the GPE1_STS and GPE1_EN registers is equal to
0223      *  half the GPE1_LEN. If a generic register block is not supported
0224      *  then its respective block pointer and block length values in the
0225      *  FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need
0226      *  to be the same size."
0227      */
0228 
0229     /*
0230      * Determine the maximum GPE number for this machine.
0231      *
0232      * Note: both GPE0 and GPE1 are optional, and either can exist without
0233      * the other.
0234      *
0235      * If EITHER the register length OR the block address are zero, then that
0236      * particular block is not supported.
0237      */
0238     if (AcpiGbl_FADT.Gpe0BlockLength &&
0239         AcpiGbl_FADT.XGpe0Block.Address)
0240     {
0241         /* GPE block 0 exists (has both length and address > 0) */
0242 
0243         RegisterCount0 = (UINT16) (AcpiGbl_FADT.Gpe0BlockLength / 2);
0244         GpeNumberMax = (RegisterCount0 * ACPI_GPE_REGISTER_WIDTH) - 1;
0245 
0246         /* Install GPE Block 0 */
0247 
0248         Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice,
0249             AcpiGbl_FADT.XGpe0Block.Address,
0250             AcpiGbl_FADT.XGpe0Block.SpaceId,
0251             RegisterCount0, 0,
0252             AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[0]);
0253 
0254         if (ACPI_FAILURE (Status))
0255         {
0256             ACPI_EXCEPTION ((AE_INFO, Status,
0257                 "Could not create GPE Block 0"));
0258         }
0259     }
0260 
0261     if (AcpiGbl_FADT.Gpe1BlockLength &&
0262         AcpiGbl_FADT.XGpe1Block.Address)
0263     {
0264         /* GPE block 1 exists (has both length and address > 0) */
0265 
0266         RegisterCount1 = (UINT16) (AcpiGbl_FADT.Gpe1BlockLength / 2);
0267 
0268         /* Check for GPE0/GPE1 overlap (if both banks exist) */
0269 
0270         if ((RegisterCount0) &&
0271             (GpeNumberMax >= AcpiGbl_FADT.Gpe1Base))
0272         {
0273             ACPI_ERROR ((AE_INFO,
0274                 "GPE0 block (GPE 0 to %u) overlaps the GPE1 block "
0275                 "(GPE %u to %u) - Ignoring GPE1",
0276                 GpeNumberMax, AcpiGbl_FADT.Gpe1Base,
0277                 AcpiGbl_FADT.Gpe1Base +
0278                 ((RegisterCount1 * ACPI_GPE_REGISTER_WIDTH) - 1)));
0279 
0280             /* Ignore GPE1 block by setting the register count to zero */
0281 
0282             RegisterCount1 = 0;
0283         }
0284         else
0285         {
0286             /* Install GPE Block 1 */
0287 
0288             Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice,
0289                 AcpiGbl_FADT.XGpe1Block.Address,
0290                 AcpiGbl_FADT.XGpe1Block.SpaceId,
0291                 RegisterCount1,
0292                 AcpiGbl_FADT.Gpe1Base,
0293                 AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[1]);
0294 
0295             if (ACPI_FAILURE (Status))
0296             {
0297                 ACPI_EXCEPTION ((AE_INFO, Status,
0298                     "Could not create GPE Block 1"));
0299             }
0300 
0301             /*
0302              * GPE0 and GPE1 do not have to be contiguous in the GPE number
0303              * space. However, GPE0 always starts at GPE number zero.
0304              */
0305         }
0306     }
0307 
0308     /* Exit if there are no GPE registers */
0309 
0310     if ((RegisterCount0 + RegisterCount1) == 0)
0311     {
0312         /* GPEs are not required by ACPI, this is OK */
0313 
0314         ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
0315             "There are no GPE blocks defined in the FADT\n"));
0316         goto Cleanup;
0317     }
0318 
0319 
0320 Cleanup:
0321     (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
0322     return_ACPI_STATUS (AE_OK);
0323 }
0324 
0325 
0326 /*******************************************************************************
0327  *
0328  * FUNCTION:    AcpiEvUpdateGpes
0329  *
0330  * PARAMETERS:  TableOwnerId        - ID of the newly-loaded ACPI table
0331  *
0332  * RETURN:      None
0333  *
0334  * DESCRIPTION: Check for new GPE methods (_Lxx/_Exx) made available as a
0335  *              result of a Load() or LoadTable() operation. If new GPE
0336  *              methods have been installed, register the new methods.
0337  *
0338  ******************************************************************************/
0339 
0340 void
0341 AcpiEvUpdateGpes (
0342     ACPI_OWNER_ID           TableOwnerId)
0343 {
0344     ACPI_GPE_XRUPT_INFO     *GpeXruptInfo;
0345     ACPI_GPE_BLOCK_INFO     *GpeBlock;
0346     ACPI_GPE_WALK_INFO      WalkInfo;
0347     ACPI_STATUS             Status = AE_OK;
0348 
0349 
0350     /*
0351      * Find any _Lxx/_Exx GPE methods that have just been loaded.
0352      *
0353      * Any GPEs that correspond to new _Lxx/_Exx methods are immediately
0354      * enabled.
0355      *
0356      * Examine the namespace underneath each GpeDevice within the
0357      * GpeBlock lists.
0358      */
0359     Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
0360     if (ACPI_FAILURE (Status))
0361     {
0362         return;
0363     }
0364 
0365     WalkInfo.Count = 0;
0366     WalkInfo.OwnerId = TableOwnerId;
0367     WalkInfo.ExecuteByOwnerId = TRUE;
0368 
0369     /* Walk the interrupt level descriptor list */
0370 
0371     GpeXruptInfo = AcpiGbl_GpeXruptListHead;
0372     while (GpeXruptInfo)
0373     {
0374         /* Walk all Gpe Blocks attached to this interrupt level */
0375 
0376         GpeBlock = GpeXruptInfo->GpeBlockListHead;
0377         while (GpeBlock)
0378         {
0379             WalkInfo.GpeBlock = GpeBlock;
0380             WalkInfo.GpeDevice = GpeBlock->Node;
0381 
0382             Status = AcpiNsWalkNamespace (ACPI_TYPE_METHOD,
0383                 WalkInfo.GpeDevice, ACPI_UINT32_MAX,
0384                 ACPI_NS_WALK_NO_UNLOCK, AcpiEvMatchGpeMethod,
0385                 NULL, &WalkInfo, NULL);
0386             if (ACPI_FAILURE (Status))
0387             {
0388                 ACPI_EXCEPTION ((AE_INFO, Status,
0389                     "While decoding _Lxx/_Exx methods"));
0390             }
0391 
0392             GpeBlock = GpeBlock->Next;
0393         }
0394 
0395         GpeXruptInfo = GpeXruptInfo->Next;
0396     }
0397 
0398     if (WalkInfo.Count)
0399     {
0400         ACPI_INFO (("Enabled %u new GPEs", WalkInfo.Count));
0401     }
0402 
0403     (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
0404     return;
0405 }
0406 
0407 
0408 /*******************************************************************************
0409  *
0410  * FUNCTION:    AcpiEvMatchGpeMethod
0411  *
0412  * PARAMETERS:  Callback from WalkNamespace
0413  *
0414  * RETURN:      Status
0415  *
0416  * DESCRIPTION: Called from AcpiWalkNamespace. Expects each object to be a
0417  *              control method under the _GPE portion of the namespace.
0418  *              Extract the name and GPE type from the object, saving this
0419  *              information for quick lookup during GPE dispatch. Allows a
0420  *              per-OwnerId evaluation if ExecuteByOwnerId is TRUE in the
0421  *              WalkInfo parameter block.
0422  *
0423  *              The name of each GPE control method is of the form:
0424  *              "_Lxx" or "_Exx", where:
0425  *                  L      - means that the GPE is level triggered
0426  *                  E      - means that the GPE is edge triggered
0427  *                  xx     - is the GPE number [in HEX]
0428  *
0429  * If WalkInfo->ExecuteByOwnerId is TRUE, we only execute examine GPE methods
0430  * with that owner.
0431  *
0432  ******************************************************************************/
0433 
0434 ACPI_STATUS
0435 AcpiEvMatchGpeMethod (
0436     ACPI_HANDLE             ObjHandle,
0437     UINT32                  Level,
0438     void                    *Context,
0439     void                    **ReturnValue)
0440 {
0441     ACPI_NAMESPACE_NODE     *MethodNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle);
0442     ACPI_GPE_WALK_INFO      *WalkInfo = ACPI_CAST_PTR (ACPI_GPE_WALK_INFO, Context);
0443     ACPI_GPE_EVENT_INFO     *GpeEventInfo;
0444     ACPI_STATUS             Status;
0445     UINT32                  GpeNumber;
0446     UINT8                   TempGpeNumber;
0447     char                    Name[ACPI_NAMESEG_SIZE + 1];
0448     UINT8                   Type;
0449 
0450 
0451     ACPI_FUNCTION_TRACE (EvMatchGpeMethod);
0452 
0453 
0454     /* Check if requested OwnerId matches this OwnerId */
0455 
0456     if ((WalkInfo->ExecuteByOwnerId) &&
0457         (MethodNode->OwnerId != WalkInfo->OwnerId))
0458     {
0459         return_ACPI_STATUS (AE_OK);
0460     }
0461 
0462     /*
0463      * Match and decode the _Lxx and _Exx GPE method names
0464      *
0465      * 1) Extract the method name and null terminate it
0466      */
0467     ACPI_MOVE_32_TO_32 (Name, &MethodNode->Name.Integer);
0468     Name[ACPI_NAMESEG_SIZE] = 0;
0469 
0470     /* 2) Name must begin with an underscore */
0471 
0472     if (Name[0] != '_')
0473     {
0474         return_ACPI_STATUS (AE_OK); /* Ignore this method */
0475     }
0476 
0477     /*
0478      * 3) Edge/Level determination is based on the 2nd character
0479      *    of the method name
0480      */
0481     switch (Name[1])
0482     {
0483     case 'L':
0484 
0485         Type = ACPI_GPE_LEVEL_TRIGGERED;
0486         break;
0487 
0488     case 'E':
0489 
0490         Type = ACPI_GPE_EDGE_TRIGGERED;
0491         break;
0492 
0493     default:
0494 
0495         /* Unknown method type, just ignore it */
0496 
0497         ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
0498             "Ignoring unknown GPE method type: %s "
0499             "(name not of form _Lxx or _Exx)", Name));
0500         return_ACPI_STATUS (AE_OK);
0501     }
0502 
0503     /* 4) The last two characters of the name are the hex GPE Number */
0504 
0505     Status = AcpiUtAsciiToHexByte (&Name[2], &TempGpeNumber);
0506     if (ACPI_FAILURE (Status))
0507     {
0508         /* Conversion failed; invalid method, just ignore it */
0509 
0510         ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
0511             "Could not extract GPE number from name: %s "
0512             "(name is not of form _Lxx or _Exx)", Name));
0513         return_ACPI_STATUS (AE_OK);
0514     }
0515 
0516     /* Ensure that we have a valid GPE number for this GPE block */
0517 
0518     GpeNumber = (UINT32) TempGpeNumber;
0519     GpeEventInfo = AcpiEvLowGetGpeInfo (GpeNumber, WalkInfo->GpeBlock);
0520     if (!GpeEventInfo)
0521     {
0522         /*
0523          * This GpeNumber is not valid for this GPE block, just ignore it.
0524          * However, it may be valid for a different GPE block, since GPE0
0525          * and GPE1 methods both appear under \_GPE.
0526          */
0527         return_ACPI_STATUS (AE_OK);
0528     }
0529 
0530     if ((ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) ==
0531             ACPI_GPE_DISPATCH_HANDLER) ||
0532         (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) ==
0533             ACPI_GPE_DISPATCH_RAW_HANDLER))
0534     {
0535         /* If there is already a handler, ignore this GPE method */
0536 
0537         return_ACPI_STATUS (AE_OK);
0538     }
0539 
0540     if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) ==
0541         ACPI_GPE_DISPATCH_METHOD)
0542     {
0543         /*
0544          * If there is already a method, ignore this method. But check
0545          * for a type mismatch (if both the _Lxx AND _Exx exist)
0546          */
0547         if (Type != (GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK))
0548         {
0549             ACPI_ERROR ((AE_INFO,
0550                 "For GPE 0x%.2X, found both _L%2.2X and _E%2.2X methods",
0551                 GpeNumber, GpeNumber, GpeNumber));
0552         }
0553         return_ACPI_STATUS (AE_OK);
0554     }
0555 
0556     /* Disable the GPE in case it's been enabled already. */
0557 
0558     (void) AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE);
0559 
0560     /*
0561      * Add the GPE information from above to the GpeEventInfo block for
0562      * use during dispatch of this GPE.
0563      */
0564     GpeEventInfo->Flags &= ~(ACPI_GPE_DISPATCH_MASK);
0565     GpeEventInfo->Flags |= (UINT8) (Type | ACPI_GPE_DISPATCH_METHOD);
0566     GpeEventInfo->Dispatch.MethodNode = MethodNode;
0567     WalkInfo->Count++;
0568 
0569     ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
0570         "Registered GPE method %s as GPE number 0x%.2X\n",
0571         Name, GpeNumber));
0572     return_ACPI_STATUS (AE_OK);
0573 }
0574 
0575 #endif /* !ACPI_REDUCED_HARDWARE */