ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

evgpeblk.c
Go to the documentation of this file.
00001 /******************************************************************************
00002  *
00003  * Module Name: evgpeblk - GPE block creation and initialization.
00004  *
00005  *****************************************************************************/
00006 
00007 /******************************************************************************
00008  *
00009  * 1. Copyright Notice
00010  *
00011  * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
00012  * All rights reserved.
00013  *
00014  * 2. License
00015  *
00016  * 2.1. This is your license from Intel Corp. under its intellectual property
00017  * rights.  You may have additional license terms from the party that provided
00018  * you this software, covering your right to use that party's intellectual
00019  * property rights.
00020  *
00021  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
00022  * copy of the source code appearing in this file ("Covered Code") an
00023  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
00024  * base code distributed originally by Intel ("Original Intel Code") to copy,
00025  * make derivatives, distribute, use and display any portion of the Covered
00026  * Code in any form, with the right to sublicense such rights; and
00027  *
00028  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
00029  * license (with the right to sublicense), under only those claims of Intel
00030  * patents that are infringed by the Original Intel Code, to make, use, sell,
00031  * offer to sell, and import the Covered Code and derivative works thereof
00032  * solely to the minimum extent necessary to exercise the above copyright
00033  * license, and in no event shall the patent license extend to any additions
00034  * to or modifications of the Original Intel Code.  No other license or right
00035  * is granted directly or by implication, estoppel or otherwise;
00036  *
00037  * The above copyright and patent license is granted only if the following
00038  * conditions are met:
00039  *
00040  * 3. Conditions
00041  *
00042  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
00043  * Redistribution of source code of any substantial portion of the Covered
00044  * Code or modification with rights to further distribute source must include
00045  * the above Copyright Notice, the above License, this list of Conditions,
00046  * and the following Disclaimer and Export Compliance provision.  In addition,
00047  * Licensee must cause all Covered Code to which Licensee contributes to
00048  * contain a file documenting the changes Licensee made to create that Covered
00049  * Code and the date of any change.  Licensee must include in that file the
00050  * documentation of any changes made by any predecessor Licensee.  Licensee
00051  * must include a prominent statement that the modification is derived,
00052  * directly or indirectly, from Original Intel Code.
00053  *
00054  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
00055  * Redistribution of source code of any substantial portion of the Covered
00056  * Code or modification without rights to further distribute source must
00057  * include the following Disclaimer and Export Compliance provision in the
00058  * documentation and/or other materials provided with distribution.  In
00059  * addition, Licensee may not authorize further sublicense of source of any
00060  * portion of the Covered Code, and must include terms to the effect that the
00061  * license from Licensee to its licensee is limited to the intellectual
00062  * property embodied in the software Licensee provides to its licensee, and
00063  * not to intellectual property embodied in modifications its licensee may
00064  * make.
00065  *
00066  * 3.3. Redistribution of Executable. Redistribution in executable form of any
00067  * substantial portion of the Covered Code or modification must reproduce the
00068  * above Copyright Notice, and the following Disclaimer and Export Compliance
00069  * provision in the documentation and/or other materials provided with the
00070  * distribution.
00071  *
00072  * 3.4. Intel retains all right, title, and interest in and to the Original
00073  * Intel Code.
00074  *
00075  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
00076  * Intel shall be used in advertising or otherwise to promote the sale, use or
00077  * other dealings in products derived from or relating to the Covered Code
00078  * without prior written authorization from Intel.
00079  *
00080  * 4. Disclaimer and Export Compliance
00081  *
00082  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
00083  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
00084  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
00085  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
00086  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
00087  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
00088  * PARTICULAR PURPOSE.
00089  *
00090  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
00091  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
00092  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
00093  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
00094  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
00095  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
00096  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
00097  * LIMITED REMEDY.
00098  *
00099  * 4.3. Licensee shall not export, either directly or indirectly, any of this
00100  * software or system incorporating such software without first obtaining any
00101  * required license or other approval from the U. S. Department of Commerce or
00102  * any other agency or department of the United States Government.  In the
00103  * event Licensee exports any such software from the United States or
00104  * re-exports any such software from a foreign destination, Licensee shall
00105  * ensure that the distribution and export/re-export of the software is in
00106  * compliance with all laws, regulations, orders, or other restrictions of the
00107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
00108  * any of its subsidiaries will export/re-export any technical data, process,
00109  * software, or service, directly or indirectly, to any country for which the
00110  * United States government or any agency thereof requires an export license,
00111  * other governmental approval, or letter of assurance, without first obtaining
00112  * such license, approval or letter.
00113  *
00114  *****************************************************************************/
00115 
00116 #include "acpi.h"
00117 #include "accommon.h"
00118 #include "acevents.h"
00119 #include "acnamesp.h"
00120 
00121 #define _COMPONENT          ACPI_EVENTS
00122         ACPI_MODULE_NAME    ("evgpeblk")
00123 
00124 /* Local prototypes */
00125 
00126 static ACPI_STATUS
00127 AcpiEvInstallGpeBlock (
00128     ACPI_GPE_BLOCK_INFO     *GpeBlock,
00129     UINT32                  InterruptNumber);
00130 
00131 static ACPI_STATUS
00132 AcpiEvCreateGpeInfoBlocks (
00133     ACPI_GPE_BLOCK_INFO     *GpeBlock);
00134 
00135 
00136 /*******************************************************************************
00137  *
00138  * FUNCTION:    AcpiEvInstallGpeBlock
00139  *
00140  * PARAMETERS:  GpeBlock                - New GPE block
00141  *              InterruptNumber         - Xrupt to be associated with this
00142  *                                        GPE block
00143  *
00144  * RETURN:      Status
00145  *
00146  * DESCRIPTION: Install new GPE block with mutex support
00147  *
00148  ******************************************************************************/
00149 
00150 static ACPI_STATUS
00151 AcpiEvInstallGpeBlock (
00152     ACPI_GPE_BLOCK_INFO     *GpeBlock,
00153     UINT32                  InterruptNumber)
00154 {
00155     ACPI_GPE_BLOCK_INFO     *NextGpeBlock;
00156     ACPI_GPE_XRUPT_INFO     *GpeXruptBlock;
00157     ACPI_STATUS             Status;
00158     ACPI_CPU_FLAGS          Flags;
00159 
00160 
00161     ACPI_FUNCTION_TRACE (EvInstallGpeBlock);
00162 
00163 
00164     Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
00165     if (ACPI_FAILURE (Status))
00166     {
00167         return_ACPI_STATUS (Status);
00168     }
00169 
00170     GpeXruptBlock = AcpiEvGetGpeXruptBlock (InterruptNumber);
00171     if (!GpeXruptBlock)
00172     {
00173         Status = AE_NO_MEMORY;
00174         goto UnlockAndExit;
00175     }
00176 
00177     /* Install the new block at the end of the list with lock */
00178 
00179     Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
00180     if (GpeXruptBlock->GpeBlockListHead)
00181     {
00182         NextGpeBlock = GpeXruptBlock->GpeBlockListHead;
00183         while (NextGpeBlock->Next)
00184         {
00185             NextGpeBlock = NextGpeBlock->Next;
00186         }
00187 
00188         NextGpeBlock->Next = GpeBlock;
00189         GpeBlock->Previous = NextGpeBlock;
00190     }
00191     else
00192     {
00193         GpeXruptBlock->GpeBlockListHead = GpeBlock;
00194     }
00195 
00196     GpeBlock->XruptBlock = GpeXruptBlock;
00197     AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
00198 
00199 
00200 UnlockAndExit:
00201     Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
00202     return_ACPI_STATUS (Status);
00203 }
00204 
00205 
00206 /*******************************************************************************
00207  *
00208  * FUNCTION:    AcpiEvDeleteGpeBlock
00209  *
00210  * PARAMETERS:  GpeBlock            - Existing GPE block
00211  *
00212  * RETURN:      Status
00213  *
00214  * DESCRIPTION: Remove a GPE block
00215  *
00216  ******************************************************************************/
00217 
00218 ACPI_STATUS
00219 AcpiEvDeleteGpeBlock (
00220     ACPI_GPE_BLOCK_INFO     *GpeBlock)
00221 {
00222     ACPI_STATUS             Status;
00223     ACPI_CPU_FLAGS          Flags;
00224 
00225 
00226     ACPI_FUNCTION_TRACE (EvInstallGpeBlock);
00227 
00228 
00229     Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
00230     if (ACPI_FAILURE (Status))
00231     {
00232         return_ACPI_STATUS (Status);
00233     }
00234 
00235     /* Disable all GPEs in this block */
00236 
00237     Status = AcpiHwDisableGpeBlock (GpeBlock->XruptBlock, GpeBlock, NULL);
00238 
00239     if (!GpeBlock->Previous && !GpeBlock->Next)
00240     {
00241         /* This is the last GpeBlock on this interrupt */
00242 
00243         Status = AcpiEvDeleteGpeXrupt (GpeBlock->XruptBlock);
00244         if (ACPI_FAILURE (Status))
00245         {
00246             goto UnlockAndExit;
00247         }
00248     }
00249     else
00250     {
00251         /* Remove the block on this interrupt with lock */
00252 
00253         Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
00254         if (GpeBlock->Previous)
00255         {
00256             GpeBlock->Previous->Next = GpeBlock->Next;
00257         }
00258         else
00259         {
00260             GpeBlock->XruptBlock->GpeBlockListHead = GpeBlock->Next;
00261         }
00262 
00263         if (GpeBlock->Next)
00264         {
00265             GpeBlock->Next->Previous = GpeBlock->Previous;
00266         }
00267         AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
00268     }
00269 
00270     AcpiCurrentGpeCount -= GpeBlock->GpeCount;
00271 
00272     /* Free the GpeBlock */
00273 
00274     ACPI_FREE (GpeBlock->RegisterInfo);
00275     ACPI_FREE (GpeBlock->EventInfo);
00276     ACPI_FREE (GpeBlock);
00277 
00278 UnlockAndExit:
00279     Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
00280     return_ACPI_STATUS (Status);
00281 }
00282 
00283 
00284 /*******************************************************************************
00285  *
00286  * FUNCTION:    AcpiEvCreateGpeInfoBlocks
00287  *
00288  * PARAMETERS:  GpeBlock    - New GPE block
00289  *
00290  * RETURN:      Status
00291  *
00292  * DESCRIPTION: Create the RegisterInfo and EventInfo blocks for this GPE block
00293  *
00294  ******************************************************************************/
00295 
00296 static ACPI_STATUS
00297 AcpiEvCreateGpeInfoBlocks (
00298     ACPI_GPE_BLOCK_INFO     *GpeBlock)
00299 {
00300     ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo = NULL;
00301     ACPI_GPE_EVENT_INFO     *GpeEventInfo = NULL;
00302     ACPI_GPE_EVENT_INFO     *ThisEvent;
00303     ACPI_GPE_REGISTER_INFO  *ThisRegister;
00304     UINT32                  i;
00305     UINT32                  j;
00306     ACPI_STATUS             Status;
00307 
00308 
00309     ACPI_FUNCTION_TRACE (EvCreateGpeInfoBlocks);
00310 
00311 
00312     /* Allocate the GPE register information block */
00313 
00314     GpeRegisterInfo = ACPI_ALLOCATE_ZEROED (
00315                         (ACPI_SIZE) GpeBlock->RegisterCount *
00316                         sizeof (ACPI_GPE_REGISTER_INFO));
00317     if (!GpeRegisterInfo)
00318     {
00319         ACPI_ERROR ((AE_INFO,
00320             "Could not allocate the GpeRegisterInfo table"));
00321         return_ACPI_STATUS (AE_NO_MEMORY);
00322     }
00323 
00324     /*
00325      * Allocate the GPE EventInfo block. There are eight distinct GPEs
00326      * per register. Initialization to zeros is sufficient.
00327      */
00328     GpeEventInfo = ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) GpeBlock->GpeCount *
00329                     sizeof (ACPI_GPE_EVENT_INFO));
00330     if (!GpeEventInfo)
00331     {
00332         ACPI_ERROR ((AE_INFO,
00333             "Could not allocate the GpeEventInfo table"));
00334         Status = AE_NO_MEMORY;
00335         goto ErrorExit;
00336     }
00337 
00338     /* Save the new Info arrays in the GPE block */
00339 
00340     GpeBlock->RegisterInfo = GpeRegisterInfo;
00341     GpeBlock->EventInfo    = GpeEventInfo;
00342 
00343     /*
00344      * Initialize the GPE Register and Event structures. A goal of these
00345      * tables is to hide the fact that there are two separate GPE register
00346      * sets in a given GPE hardware block, the status registers occupy the
00347      * first half, and the enable registers occupy the second half.
00348      */
00349     ThisRegister = GpeRegisterInfo;
00350     ThisEvent    = GpeEventInfo;
00351 
00352     for (i = 0; i < GpeBlock->RegisterCount; i++)
00353     {
00354         /* Init the RegisterInfo for this GPE register (8 GPEs) */
00355 
00356         ThisRegister->BaseGpeNumber = (UINT8) (GpeBlock->BlockBaseNumber +
00357                                              (i * ACPI_GPE_REGISTER_WIDTH));
00358 
00359         ThisRegister->StatusAddress.Address =
00360             GpeBlock->BlockAddress.Address + i;
00361 
00362         ThisRegister->EnableAddress.Address =
00363             GpeBlock->BlockAddress.Address + i + GpeBlock->RegisterCount;
00364 
00365         ThisRegister->StatusAddress.SpaceId   = GpeBlock->BlockAddress.SpaceId;
00366         ThisRegister->EnableAddress.SpaceId   = GpeBlock->BlockAddress.SpaceId;
00367         ThisRegister->StatusAddress.BitWidth  = ACPI_GPE_REGISTER_WIDTH;
00368         ThisRegister->EnableAddress.BitWidth  = ACPI_GPE_REGISTER_WIDTH;
00369         ThisRegister->StatusAddress.BitOffset = 0;
00370         ThisRegister->EnableAddress.BitOffset = 0;
00371 
00372         /* Init the EventInfo for each GPE within this register */
00373 
00374         for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
00375         {
00376             ThisEvent->GpeNumber = (UINT8) (ThisRegister->BaseGpeNumber + j);
00377             ThisEvent->RegisterInfo = ThisRegister;
00378             ThisEvent++;
00379         }
00380 
00381         /* Disable all GPEs within this register */
00382 
00383         Status = AcpiHwWrite (0x00, &ThisRegister->EnableAddress);
00384         if (ACPI_FAILURE (Status))
00385         {
00386             goto ErrorExit;
00387         }
00388 
00389         /* Clear any pending GPE events within this register */
00390 
00391         Status = AcpiHwWrite (0xFF, &ThisRegister->StatusAddress);
00392         if (ACPI_FAILURE (Status))
00393         {
00394             goto ErrorExit;
00395         }
00396 
00397         ThisRegister++;
00398     }
00399 
00400     return_ACPI_STATUS (AE_OK);
00401 
00402 
00403 ErrorExit:
00404     if (GpeRegisterInfo)
00405     {
00406         ACPI_FREE (GpeRegisterInfo);
00407     }
00408     if (GpeEventInfo)
00409     {
00410         ACPI_FREE (GpeEventInfo);
00411     }
00412 
00413     return_ACPI_STATUS (Status);
00414 }
00415 
00416 
00417 /*******************************************************************************
00418  *
00419  * FUNCTION:    AcpiEvCreateGpeBlock
00420  *
00421  * PARAMETERS:  GpeDevice           - Handle to the parent GPE block
00422  *              GpeBlockAddress     - Address and SpaceID
00423  *              RegisterCount       - Number of GPE register pairs in the block
00424  *              GpeBlockBaseNumber  - Starting GPE number for the block
00425  *              InterruptNumber     - H/W interrupt for the block
00426  *              ReturnGpeBlock      - Where the new block descriptor is returned
00427  *
00428  * RETURN:      Status
00429  *
00430  * DESCRIPTION: Create and Install a block of GPE registers. All GPEs within
00431  *              the block are disabled at exit.
00432  *              Note: Assumes namespace is locked.
00433  *
00434  ******************************************************************************/
00435 
00436 ACPI_STATUS
00437 AcpiEvCreateGpeBlock (
00438     ACPI_NAMESPACE_NODE     *GpeDevice,
00439     ACPI_GENERIC_ADDRESS    *GpeBlockAddress,
00440     UINT32                  RegisterCount,
00441     UINT8                   GpeBlockBaseNumber,
00442     UINT32                  InterruptNumber,
00443     ACPI_GPE_BLOCK_INFO     **ReturnGpeBlock)
00444 {
00445     ACPI_STATUS             Status;
00446     ACPI_GPE_BLOCK_INFO     *GpeBlock;
00447     ACPI_GPE_WALK_INFO      WalkInfo;
00448 
00449 
00450     ACPI_FUNCTION_TRACE (EvCreateGpeBlock);
00451 
00452 
00453     if (!RegisterCount)
00454     {
00455         return_ACPI_STATUS (AE_OK);
00456     }
00457 
00458     /* Allocate a new GPE block */
00459 
00460     GpeBlock = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_BLOCK_INFO));
00461     if (!GpeBlock)
00462     {
00463         return_ACPI_STATUS (AE_NO_MEMORY);
00464     }
00465 
00466     /* Initialize the new GPE block */
00467 
00468     GpeBlock->Node = GpeDevice;
00469     GpeBlock->GpeCount = (UINT16) (RegisterCount * ACPI_GPE_REGISTER_WIDTH);
00470     GpeBlock->Initialized = FALSE;
00471     GpeBlock->RegisterCount = RegisterCount;
00472     GpeBlock->BlockBaseNumber = GpeBlockBaseNumber;
00473 
00474     ACPI_MEMCPY (&GpeBlock->BlockAddress, GpeBlockAddress,
00475         sizeof (ACPI_GENERIC_ADDRESS));
00476 
00477     /*
00478      * Create the RegisterInfo and EventInfo sub-structures
00479      * Note: disables and clears all GPEs in the block
00480      */
00481     Status = AcpiEvCreateGpeInfoBlocks (GpeBlock);
00482     if (ACPI_FAILURE (Status))
00483     {
00484         ACPI_FREE (GpeBlock);
00485         return_ACPI_STATUS (Status);
00486     }
00487 
00488     /* Install the new block in the global lists */
00489 
00490     Status = AcpiEvInstallGpeBlock (GpeBlock, InterruptNumber);
00491     if (ACPI_FAILURE (Status))
00492     {
00493         ACPI_FREE (GpeBlock);
00494         return_ACPI_STATUS (Status);
00495     }
00496 
00497     AcpiGbl_AllGpesInitialized = FALSE;
00498 
00499     /* Find all GPE methods (_Lxx or_Exx) for this block */
00500 
00501     WalkInfo.GpeBlock = GpeBlock;
00502     WalkInfo.GpeDevice = GpeDevice;
00503     WalkInfo.ExecuteByOwnerId = FALSE;
00504 
00505     Status = AcpiNsWalkNamespace (ACPI_TYPE_METHOD, GpeDevice,
00506                 ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
00507                 AcpiEvMatchGpeMethod, NULL, &WalkInfo, NULL);
00508 
00509     /* Return the new block */
00510 
00511     if (ReturnGpeBlock)
00512     {
00513         (*ReturnGpeBlock) = GpeBlock;
00514     }
00515 
00516     ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
00517         "GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n",
00518         (UINT32) GpeBlock->BlockBaseNumber,
00519         (UINT32) (GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1)),
00520         GpeDevice->Name.Ascii, GpeBlock->RegisterCount,
00521         InterruptNumber));
00522 
00523     /* Update global count of currently available GPEs */
00524 
00525     AcpiCurrentGpeCount += GpeBlock->GpeCount;
00526     return_ACPI_STATUS (AE_OK);
00527 }
00528 
00529 
00530 /*******************************************************************************
00531  *
00532  * FUNCTION:    AcpiEvInitializeGpeBlock
00533  *
00534  * PARAMETERS:  ACPI_GPE_CALLBACK
00535  *
00536  * RETURN:      Status
00537  *
00538  * DESCRIPTION: Initialize and enable a GPE block. Enable GPEs that have
00539  *              associated methods.
00540  *              Note: Assumes namespace is locked.
00541  *
00542  ******************************************************************************/
00543 
00544 ACPI_STATUS
00545 AcpiEvInitializeGpeBlock (
00546     ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
00547     ACPI_GPE_BLOCK_INFO     *GpeBlock,
00548     void                    *Ignored)
00549 {
00550     ACPI_STATUS             Status;
00551     ACPI_GPE_EVENT_INFO     *GpeEventInfo;
00552     UINT32                  GpeEnabledCount;
00553     UINT32                  GpeIndex;
00554     UINT32                  i;
00555     UINT32                  j;
00556 
00557 
00558     ACPI_FUNCTION_TRACE (EvInitializeGpeBlock);
00559 
00560 
00561     /*
00562      * Ignore a null GPE block (e.g., if no GPE block 1 exists), and
00563      * any GPE blocks that have been initialized already.
00564      */
00565     if (!GpeBlock || GpeBlock->Initialized)
00566     {
00567         return_ACPI_STATUS (AE_OK);
00568     }
00569 
00570     /*
00571      * Enable all GPEs that have a corresponding method and have the
00572      * ACPI_GPE_CAN_WAKE flag unset. Any other GPEs within this block
00573      * must be enabled via the acpi_enable_gpe() interface.
00574      */
00575     GpeEnabledCount = 0;
00576 
00577     for (i = 0; i < GpeBlock->RegisterCount; i++)
00578     {
00579         for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
00580         {
00581             /* Get the info block for this particular GPE */
00582 
00583             GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j;
00584             GpeEventInfo = &GpeBlock->EventInfo[GpeIndex];
00585 
00586             /*
00587              * Ignore GPEs that have no corresponding _Lxx/_Exx method
00588              * and GPEs that are used to wake the system
00589              */
00590             if (((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_NONE) ||
00591                 ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER) ||
00592                 (GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE))
00593             {
00594                 continue;
00595             }
00596 
00597             Status = AcpiEvAddGpeReference (GpeEventInfo);
00598             if (ACPI_FAILURE (Status))
00599             {
00600                 ACPI_EXCEPTION ((AE_INFO, Status,
00601                     "Could not enable GPE 0x%02X",
00602                     GpeIndex + GpeBlock->BlockBaseNumber));
00603                 continue;
00604             }
00605 
00606             GpeEnabledCount++;
00607         }
00608     }
00609 
00610     if (GpeEnabledCount)
00611     {
00612         ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
00613             "Enabled %u GPEs in this block\n", GpeEnabledCount));
00614     }
00615 
00616     GpeBlock->Initialized = TRUE;
00617     return_ACPI_STATUS (AE_OK);
00618 }
00619 

Generated on Sun May 27 2012 04:27:15 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.