Print this page
update to acpica-unix2-20140114
update to acpica-unix2-20130927
acpica-unix2-20130823
PANKOVs restructure
   1 /******************************************************************************
   2  *
   3  * Module Name: evgpe - General Purpose Event handling and dispatch
   4  *
   5  *****************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2011, Intel Corp.
   9  * All rights reserved.
  10  *
  11  * Redistribution and use in source and binary forms, with or without
  12  * modification, are permitted provided that the following conditions
  13  * are met:
  14  * 1. Redistributions of source code must retain the above copyright
  15  *    notice, this list of conditions, and the following disclaimer,
  16  *    without modification.
  17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  18  *    substantially similar to the "NO WARRANTY" disclaimer below
  19  *    ("Disclaimer") and any redistribution must be conditioned upon
  20  *    including a substantially similar Disclaimer requirement for further
  21  *    binary redistribution.
  22  * 3. Neither the names of the above-listed copyright holders nor the names
  23  *    of any contributors may be used to endorse or promote products derived
  24  *    from this software without specific prior written permission.
  25  *
  26  * Alternatively, this software may be distributed under the terms of the
  27  * GNU General Public License ("GPL") version 2 as published by the Free
  28  * Software Foundation.


  32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  41  * POSSIBILITY OF SUCH DAMAGES.
  42  */
  43 
  44 #include "acpi.h"
  45 #include "accommon.h"
  46 #include "acevents.h"
  47 #include "acnamesp.h"
  48 
  49 #define _COMPONENT          ACPI_EVENTS
  50         ACPI_MODULE_NAME    ("evgpe")
  51 


  52 /* Local prototypes */
  53 
  54 static void ACPI_SYSTEM_XFACE
  55 AcpiEvAsynchExecuteGpeMethod (
  56     void                    *Context);
  57 
  58 static void ACPI_SYSTEM_XFACE
  59 AcpiEvAsynchEnableGpe (
  60     void                    *Context);
  61 
  62 
  63 /*******************************************************************************
  64  *
  65  * FUNCTION:    AcpiEvUpdateGpeEnableMask
  66  *
  67  * PARAMETERS:  GpeEventInfo            - GPE to update
  68  *
  69  * RETURN:      Status
  70  *
  71  * DESCRIPTION: Updates GPE register enable mask based upon whether there are


  73  *
  74  ******************************************************************************/
  75 
  76 ACPI_STATUS
  77 AcpiEvUpdateGpeEnableMask (
  78     ACPI_GPE_EVENT_INFO     *GpeEventInfo)
  79 {
  80     ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
  81     UINT32                  RegisterBit;
  82 
  83 
  84     ACPI_FUNCTION_TRACE (EvUpdateGpeEnableMask);
  85 
  86 
  87     GpeRegisterInfo = GpeEventInfo->RegisterInfo;
  88     if (!GpeRegisterInfo)
  89     {
  90         return_ACPI_STATUS (AE_NOT_EXIST);
  91     }
  92 
  93     RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo);
  94 
  95     /* Clear the run bit up front */
  96 
  97     ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForRun, RegisterBit);
  98 
  99     /* Set the mask bit only if there are references to this GPE */
 100 
 101     if (GpeEventInfo->RuntimeCount)
 102     {
 103         ACPI_SET_BIT (GpeRegisterInfo->EnableForRun, (UINT8) RegisterBit);
 104     }
 105 
 106     return_ACPI_STATUS (AE_OK);
 107 }
 108 
 109 
 110 /*******************************************************************************
 111  *
 112  * FUNCTION:    AcpiEvEnableGpe
 113  *


 412     GpeBlock = GpeXruptList->GpeBlockListHead;
 413     while (GpeBlock)
 414     {
 415         /*
 416          * Read all of the 8-bit GPE status and enable registers in this GPE
 417          * block, saving all of them. Find all currently active GP events.
 418          */
 419         for (i = 0; i < GpeBlock->RegisterCount; i++)
 420         {
 421             /* Get the next status/enable pair */
 422 
 423             GpeRegisterInfo = &GpeBlock->RegisterInfo[i];
 424 
 425             /*
 426              * Optimization: If there are no GPEs enabled within this
 427              * register, we can safely ignore the entire register.
 428              */
 429             if (!(GpeRegisterInfo->EnableForRun |
 430                   GpeRegisterInfo->EnableForWake))
 431             {







 432                 continue;
 433             }
 434 
 435             /* Read the Status Register */
 436 
 437             Status = AcpiHwRead (&StatusReg, &GpeRegisterInfo->StatusAddress);
 438             if (ACPI_FAILURE (Status))
 439             {
 440                 goto UnlockAndExit;
 441             }
 442 
 443             /* Read the Enable Register */
 444 
 445             Status = AcpiHwRead (&EnableReg, &GpeRegisterInfo->EnableAddress);
 446             if (ACPI_FAILURE (Status))
 447             {
 448                 goto UnlockAndExit;
 449             }
 450 
 451             ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
 452                 "Read GPE Register at GPE%02X: Status=%02X, Enable=%02X\n",
 453                 GpeRegisterInfo->BaseGpeNumber, StatusReg, EnableReg));





 454 
 455             /* Check if there is anything active at all in this register */
 456 
 457             EnabledStatusByte = (UINT8) (StatusReg & EnableReg);
 458             if (!EnabledStatusByte)
 459             {
 460                 /* No active GPEs in this register, move on */
 461 
 462                 continue;
 463             }
 464 
 465             /* Now look at the individual GPEs in this byte register */
 466 
 467             for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
 468             {
 469                 /* Examine one GPE bit */
 470 
 471                 if (EnabledStatusByte & (1 << j))
 472                 {
 473                     /*


 499  * PARAMETERS:  Context (GpeEventInfo) - Info for this GPE
 500  *
 501  * RETURN:      None
 502  *
 503  * DESCRIPTION: Perform the actual execution of a GPE control method. This
 504  *              function is called from an invocation of AcpiOsExecute and
 505  *              therefore does NOT execute at interrupt level - so that
 506  *              the control method itself is not executed in the context of
 507  *              an interrupt handler.
 508  *
 509  ******************************************************************************/
 510 
 511 static void ACPI_SYSTEM_XFACE
 512 AcpiEvAsynchExecuteGpeMethod (
 513     void                    *Context)
 514 {
 515     ACPI_GPE_EVENT_INFO     *GpeEventInfo = Context;
 516     ACPI_STATUS             Status;
 517     ACPI_GPE_EVENT_INFO     *LocalGpeEventInfo;
 518     ACPI_EVALUATE_INFO      *Info;

 519 
 520 
 521     ACPI_FUNCTION_TRACE (EvAsynchExecuteGpeMethod);
 522 
 523 
 524     /* Allocate a local GPE block */
 525 
 526     LocalGpeEventInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_EVENT_INFO));
 527     if (!LocalGpeEventInfo)
 528     {
 529         ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY,
 530             "while handling a GPE"));
 531         return_VOID;
 532     }
 533 
 534     Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
 535     if (ACPI_FAILURE (Status))
 536     {

 537         return_VOID;
 538     }
 539 
 540     /* Must revalidate the GpeNumber/GpeBlock */
 541 
 542     if (!AcpiEvValidGpeEvent (GpeEventInfo))
 543     {
 544         Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);

 545         return_VOID;
 546     }
 547 
 548     /*
 549      * Take a snapshot of the GPE info for this level - we copy the info to
 550      * prevent a race condition with RemoveHandler/RemoveBlock.
 551      */
 552     ACPI_MEMCPY (LocalGpeEventInfo, GpeEventInfo,
 553         sizeof (ACPI_GPE_EVENT_INFO));
 554 
 555     Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
 556     if (ACPI_FAILURE (Status))
 557     {

 558         return_VOID;
 559     }
 560 
 561     /* Do the correct dispatch - normal method or implicit notify */
 562 
 563     switch (LocalGpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK)
 564     {
 565     case ACPI_GPE_DISPATCH_NOTIFY:
 566 
 567         /*
 568          * Implicit notify.
 569          * Dispatch a DEVICE_WAKE notify to the appropriate handler.
 570          * NOTE: the request is queued for execution after this method
 571          * completes. The notify handlers are NOT invoked synchronously
 572          * from this thread -- because handlers may in turn run other
 573          * control methods.



 574          */
 575         Status = AcpiEvQueueNotifyRequest (
 576                     LocalGpeEventInfo->Dispatch.DeviceNode,


 577                     ACPI_NOTIFY_DEVICE_WAKE);



 578         break;
 579 
 580     case ACPI_GPE_DISPATCH_METHOD:
 581 
 582         /* Allocate the evaluation information block */
 583 
 584         Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
 585         if (!Info)
 586         {
 587             Status = AE_NO_MEMORY;
 588         }
 589         else
 590         {
 591             /*
 592              * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the
 593              * _Lxx/_Exx control method that corresponds to this GPE
 594              */
 595             Info->PrefixNode = LocalGpeEventInfo->Dispatch.MethodNode;
 596             Info->Flags = ACPI_IGNORE_RETURN_VALUE;
 597 
 598             Status = AcpiNsEvaluate (Info);
 599             ACPI_FREE (Info);
 600         }
 601 
 602         if (ACPI_FAILURE (Status))
 603         {
 604             ACPI_EXCEPTION ((AE_INFO, Status,
 605                 "while evaluating GPE method [%4.4s]",
 606                 AcpiUtGetNodeName (LocalGpeEventInfo->Dispatch.MethodNode)));
 607         }
 608 
 609         break;
 610 
 611     default:

 612         return_VOID; /* Should never happen */
 613     }
 614 
 615     /* Defer enabling of GPE until all notify handlers are done */
 616 
 617     Status = AcpiOsExecute (OSL_NOTIFY_HANDLER,
 618                 AcpiEvAsynchEnableGpe, LocalGpeEventInfo);
 619     if (ACPI_FAILURE (Status))
 620     {
 621         ACPI_FREE (LocalGpeEventInfo);
 622     }
 623     return_VOID;
 624 }
 625 
 626 
 627 /*******************************************************************************
 628  *
 629  * FUNCTION:    AcpiEvAsynchEnableGpe
 630  *
 631  * PARAMETERS:  Context (GpeEventInfo) - Info for this GPE


 778     switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK)
 779     {
 780     case ACPI_GPE_DISPATCH_HANDLER:
 781 
 782         /* Invoke the installed handler (at interrupt level) */
 783 
 784         ReturnValue = GpeEventInfo->Dispatch.Handler->Address (
 785             GpeDevice, GpeNumber,
 786             GpeEventInfo->Dispatch.Handler->Context);
 787 
 788         /* If requested, clear (if level-triggered) and reenable the GPE */
 789 
 790         if (ReturnValue & ACPI_REENABLE_GPE)
 791         {
 792             (void) AcpiEvFinishGpe (GpeEventInfo);
 793         }
 794         break;
 795 
 796     case ACPI_GPE_DISPATCH_METHOD:
 797     case ACPI_GPE_DISPATCH_NOTIFY:
 798 
 799         /*
 800          * Execute the method associated with the GPE
 801          * NOTE: Level-triggered GPEs are cleared after the method completes.
 802          */
 803         Status = AcpiOsExecute (OSL_GPE_HANDLER,
 804                     AcpiEvAsynchExecuteGpeMethod, GpeEventInfo);
 805         if (ACPI_FAILURE (Status))
 806         {
 807             ACPI_EXCEPTION ((AE_INFO, Status,
 808                 "Unable to queue handler for GPE%02X - event disabled",
 809                 GpeNumber));
 810         }
 811         break;
 812 
 813     default:
 814 
 815         /*
 816          * No handler or method to run!
 817          * 03/2010: This case should no longer be possible. We will not allow
 818          * a GPE to be enabled if it has no handler or method.
 819          */
 820         ACPI_ERROR ((AE_INFO,
 821             "No handler or method for GPE%02X, disabling event",
 822             GpeNumber));
 823         break;
 824     }
 825 
 826     return_UINT32 (ACPI_INTERRUPT_HANDLED);
 827 }
 828 

   1 /******************************************************************************
   2  *
   3  * Module Name: evgpe - General Purpose Event handling and dispatch
   4  *
   5  *****************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2014, Intel Corp.
   9  * All rights reserved.
  10  *
  11  * Redistribution and use in source and binary forms, with or without
  12  * modification, are permitted provided that the following conditions
  13  * are met:
  14  * 1. Redistributions of source code must retain the above copyright
  15  *    notice, this list of conditions, and the following disclaimer,
  16  *    without modification.
  17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  18  *    substantially similar to the "NO WARRANTY" disclaimer below
  19  *    ("Disclaimer") and any redistribution must be conditioned upon
  20  *    including a substantially similar Disclaimer requirement for further
  21  *    binary redistribution.
  22  * 3. Neither the names of the above-listed copyright holders nor the names
  23  *    of any contributors may be used to endorse or promote products derived
  24  *    from this software without specific prior written permission.
  25  *
  26  * Alternatively, this software may be distributed under the terms of the
  27  * GNU General Public License ("GPL") version 2 as published by the Free
  28  * Software Foundation.


  32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  41  * POSSIBILITY OF SUCH DAMAGES.
  42  */
  43 
  44 #include "acpi.h"
  45 #include "accommon.h"
  46 #include "acevents.h"
  47 #include "acnamesp.h"
  48 
  49 #define _COMPONENT          ACPI_EVENTS
  50         ACPI_MODULE_NAME    ("evgpe")
  51 
  52 #if (!ACPI_REDUCED_HARDWARE) /* Entire module */
  53 
  54 /* Local prototypes */
  55 
  56 static void ACPI_SYSTEM_XFACE
  57 AcpiEvAsynchExecuteGpeMethod (
  58     void                    *Context);
  59 
  60 static void ACPI_SYSTEM_XFACE
  61 AcpiEvAsynchEnableGpe (
  62     void                    *Context);
  63 
  64 
  65 /*******************************************************************************
  66  *
  67  * FUNCTION:    AcpiEvUpdateGpeEnableMask
  68  *
  69  * PARAMETERS:  GpeEventInfo            - GPE to update
  70  *
  71  * RETURN:      Status
  72  *
  73  * DESCRIPTION: Updates GPE register enable mask based upon whether there are


  75  *
  76  ******************************************************************************/
  77 
  78 ACPI_STATUS
  79 AcpiEvUpdateGpeEnableMask (
  80     ACPI_GPE_EVENT_INFO     *GpeEventInfo)
  81 {
  82     ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo;
  83     UINT32                  RegisterBit;
  84 
  85 
  86     ACPI_FUNCTION_TRACE (EvUpdateGpeEnableMask);
  87 
  88 
  89     GpeRegisterInfo = GpeEventInfo->RegisterInfo;
  90     if (!GpeRegisterInfo)
  91     {
  92         return_ACPI_STATUS (AE_NOT_EXIST);
  93     }
  94 
  95     RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo);
  96 
  97     /* Clear the run bit up front */
  98 
  99     ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForRun, RegisterBit);
 100 
 101     /* Set the mask bit only if there are references to this GPE */
 102 
 103     if (GpeEventInfo->RuntimeCount)
 104     {
 105         ACPI_SET_BIT (GpeRegisterInfo->EnableForRun, (UINT8) RegisterBit);
 106     }
 107 
 108     return_ACPI_STATUS (AE_OK);
 109 }
 110 
 111 
 112 /*******************************************************************************
 113  *
 114  * FUNCTION:    AcpiEvEnableGpe
 115  *


 414     GpeBlock = GpeXruptList->GpeBlockListHead;
 415     while (GpeBlock)
 416     {
 417         /*
 418          * Read all of the 8-bit GPE status and enable registers in this GPE
 419          * block, saving all of them. Find all currently active GP events.
 420          */
 421         for (i = 0; i < GpeBlock->RegisterCount; i++)
 422         {
 423             /* Get the next status/enable pair */
 424 
 425             GpeRegisterInfo = &GpeBlock->RegisterInfo[i];
 426 
 427             /*
 428              * Optimization: If there are no GPEs enabled within this
 429              * register, we can safely ignore the entire register.
 430              */
 431             if (!(GpeRegisterInfo->EnableForRun |
 432                   GpeRegisterInfo->EnableForWake))
 433             {
 434                 ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
 435                     "Ignore disabled registers for GPE%02X-GPE%02X: "
 436                     "RunEnable=%02X, WakeEnable=%02X\n",
 437                     GpeRegisterInfo->BaseGpeNumber,
 438                     GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1),
 439                     GpeRegisterInfo->EnableForRun,
 440                     GpeRegisterInfo->EnableForWake));
 441                 continue;
 442             }
 443 
 444             /* Read the Status Register */
 445 
 446             Status = AcpiHwRead (&StatusReg, &GpeRegisterInfo->StatusAddress);
 447             if (ACPI_FAILURE (Status))
 448             {
 449                 goto UnlockAndExit;
 450             }
 451 
 452             /* Read the Enable Register */
 453 
 454             Status = AcpiHwRead (&EnableReg, &GpeRegisterInfo->EnableAddress);
 455             if (ACPI_FAILURE (Status))
 456             {
 457                 goto UnlockAndExit;
 458             }
 459 
 460             ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
 461                 "Read registers for GPE%02X-GPE%02X: Status=%02X, Enable=%02X, "
 462                 "RunEnable=%02X, WakeEnable=%02X\n",
 463                 GpeRegisterInfo->BaseGpeNumber,
 464                 GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1),
 465                 StatusReg, EnableReg,
 466                 GpeRegisterInfo->EnableForRun,
 467                 GpeRegisterInfo->EnableForWake));
 468 
 469             /* Check if there is anything active at all in this register */
 470 
 471             EnabledStatusByte = (UINT8) (StatusReg & EnableReg);
 472             if (!EnabledStatusByte)
 473             {
 474                 /* No active GPEs in this register, move on */
 475 
 476                 continue;
 477             }
 478 
 479             /* Now look at the individual GPEs in this byte register */
 480 
 481             for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
 482             {
 483                 /* Examine one GPE bit */
 484 
 485                 if (EnabledStatusByte & (1 << j))
 486                 {
 487                     /*


 513  * PARAMETERS:  Context (GpeEventInfo) - Info for this GPE
 514  *
 515  * RETURN:      None
 516  *
 517  * DESCRIPTION: Perform the actual execution of a GPE control method. This
 518  *              function is called from an invocation of AcpiOsExecute and
 519  *              therefore does NOT execute at interrupt level - so that
 520  *              the control method itself is not executed in the context of
 521  *              an interrupt handler.
 522  *
 523  ******************************************************************************/
 524 
 525 static void ACPI_SYSTEM_XFACE
 526 AcpiEvAsynchExecuteGpeMethod (
 527     void                    *Context)
 528 {
 529     ACPI_GPE_EVENT_INFO     *GpeEventInfo = Context;
 530     ACPI_STATUS             Status;
 531     ACPI_GPE_EVENT_INFO     *LocalGpeEventInfo;
 532     ACPI_EVALUATE_INFO      *Info;
 533     ACPI_GPE_NOTIFY_INFO    *Notify;
 534 
 535 
 536     ACPI_FUNCTION_TRACE (EvAsynchExecuteGpeMethod);
 537 
 538 
 539     /* Allocate a local GPE block */
 540 
 541     LocalGpeEventInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_EVENT_INFO));
 542     if (!LocalGpeEventInfo)
 543     {
 544         ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY,
 545             "while handling a GPE"));
 546         return_VOID;
 547     }
 548 
 549     Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
 550     if (ACPI_FAILURE (Status))
 551     {
 552         ACPI_FREE (LocalGpeEventInfo);
 553         return_VOID;
 554     }
 555 
 556     /* Must revalidate the GpeNumber/GpeBlock */
 557 
 558     if (!AcpiEvValidGpeEvent (GpeEventInfo))
 559     {
 560         Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
 561         ACPI_FREE (LocalGpeEventInfo);
 562         return_VOID;
 563     }
 564 
 565     /*
 566      * Take a snapshot of the GPE info for this level - we copy the info to
 567      * prevent a race condition with RemoveHandler/RemoveBlock.
 568      */
 569     ACPI_MEMCPY (LocalGpeEventInfo, GpeEventInfo,
 570         sizeof (ACPI_GPE_EVENT_INFO));
 571 
 572     Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
 573     if (ACPI_FAILURE (Status))
 574     {
 575         ACPI_FREE (LocalGpeEventInfo);
 576         return_VOID;
 577     }
 578 
 579     /* Do the correct dispatch - normal method or implicit notify */
 580 
 581     switch (LocalGpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK)
 582     {
 583     case ACPI_GPE_DISPATCH_NOTIFY:

 584         /*
 585          * Implicit notify.
 586          * Dispatch a DEVICE_WAKE notify to the appropriate handler.
 587          * NOTE: the request is queued for execution after this method
 588          * completes. The notify handlers are NOT invoked synchronously
 589          * from this thread -- because handlers may in turn run other
 590          * control methods.
 591          *
 592          * June 2012: Expand implicit notify mechanism to support
 593          * notifies on multiple device objects.
 594          */
 595         Notify = LocalGpeEventInfo->Dispatch.NotifyList;
 596         while (ACPI_SUCCESS (Status) && Notify)
 597         {
 598             Status = AcpiEvQueueNotifyRequest (Notify->DeviceNode,
 599                         ACPI_NOTIFY_DEVICE_WAKE);
 600 
 601             Notify = Notify->Next;
 602         }
 603         break;
 604 
 605     case ACPI_GPE_DISPATCH_METHOD:
 606 
 607         /* Allocate the evaluation information block */
 608 
 609         Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
 610         if (!Info)
 611         {
 612             Status = AE_NO_MEMORY;
 613         }
 614         else
 615         {
 616             /*
 617              * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the
 618              * _Lxx/_Exx control method that corresponds to this GPE
 619              */
 620             Info->PrefixNode = LocalGpeEventInfo->Dispatch.MethodNode;
 621             Info->Flags = ACPI_IGNORE_RETURN_VALUE;
 622 
 623             Status = AcpiNsEvaluate (Info);
 624             ACPI_FREE (Info);
 625         }
 626 
 627         if (ACPI_FAILURE (Status))
 628         {
 629             ACPI_EXCEPTION ((AE_INFO, Status,
 630                 "while evaluating GPE method [%4.4s]",
 631                 AcpiUtGetNodeName (LocalGpeEventInfo->Dispatch.MethodNode)));
 632         }

 633         break;
 634 
 635     default:
 636 
 637         return_VOID; /* Should never happen */
 638     }
 639 
 640     /* Defer enabling of GPE until all notify handlers are done */
 641 
 642     Status = AcpiOsExecute (OSL_NOTIFY_HANDLER,
 643                 AcpiEvAsynchEnableGpe, LocalGpeEventInfo);
 644     if (ACPI_FAILURE (Status))
 645     {
 646         ACPI_FREE (LocalGpeEventInfo);
 647     }
 648     return_VOID;
 649 }
 650 
 651 
 652 /*******************************************************************************
 653  *
 654  * FUNCTION:    AcpiEvAsynchEnableGpe
 655  *
 656  * PARAMETERS:  Context (GpeEventInfo) - Info for this GPE


 803     switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK)
 804     {
 805     case ACPI_GPE_DISPATCH_HANDLER:
 806 
 807         /* Invoke the installed handler (at interrupt level) */
 808 
 809         ReturnValue = GpeEventInfo->Dispatch.Handler->Address (
 810             GpeDevice, GpeNumber,
 811             GpeEventInfo->Dispatch.Handler->Context);
 812 
 813         /* If requested, clear (if level-triggered) and reenable the GPE */
 814 
 815         if (ReturnValue & ACPI_REENABLE_GPE)
 816         {
 817             (void) AcpiEvFinishGpe (GpeEventInfo);
 818         }
 819         break;
 820 
 821     case ACPI_GPE_DISPATCH_METHOD:
 822     case ACPI_GPE_DISPATCH_NOTIFY:

 823         /*
 824          * Execute the method associated with the GPE
 825          * NOTE: Level-triggered GPEs are cleared after the method completes.
 826          */
 827         Status = AcpiOsExecute (OSL_GPE_HANDLER,
 828                     AcpiEvAsynchExecuteGpeMethod, GpeEventInfo);
 829         if (ACPI_FAILURE (Status))
 830         {
 831             ACPI_EXCEPTION ((AE_INFO, Status,
 832                 "Unable to queue handler for GPE%02X - event disabled",
 833                 GpeNumber));
 834         }
 835         break;
 836 
 837     default:

 838         /*
 839          * No handler or method to run!
 840          * 03/2010: This case should no longer be possible. We will not allow
 841          * a GPE to be enabled if it has no handler or method.
 842          */
 843         ACPI_ERROR ((AE_INFO,
 844             "No handler or method for GPE%02X, disabling event",
 845             GpeNumber));
 846         break;
 847     }
 848 
 849     return_UINT32 (ACPI_INTERRUPT_HANDLED);
 850 }
 851 
 852 #endif /* !ACPI_REDUCED_HARDWARE */