Print this page
update to acpica-unix2-20140114
update to acpica-unix2-20131218
acpica-unix2-20130823
PANKOVs restructure

@@ -3,11 +3,11 @@
  * Module Name: evgpeutil - GPE utilities
  *
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2014, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:

@@ -39,19 +39,19 @@
  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include "acpi.h"
 #include "accommon.h"
 #include "acevents.h"
 
 #define _COMPONENT          ACPI_EVENTS
         ACPI_MODULE_NAME    ("evgpeutil")
 
 
+#if (!ACPI_REDUCED_HARDWARE) /* Entire module */
 /*******************************************************************************
  *
  * FUNCTION:    AcpiEvWalkGpeList
  *
  * PARAMETERS:  GpeWalkCallback     - Routine called for each GPE block

@@ -215,23 +215,25 @@
 /*******************************************************************************
  *
  * FUNCTION:    AcpiEvGetGpeXruptBlock
  *
  * PARAMETERS:  InterruptNumber      - Interrupt for a GPE block
+ *              GpeXruptBlock               - Where the block is returned
  *
- * RETURN:      A GPE interrupt block
+ * RETURN:      Status
  *
  * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt
  *              block per unique interrupt level used for GPEs. Should be
  *              called only when the GPE lists are semaphore locked and not
  *              subject to change.
  *
  ******************************************************************************/
 
-ACPI_GPE_XRUPT_INFO *
+ACPI_STATUS
 AcpiEvGetGpeXruptBlock (
-    UINT32                  InterruptNumber)
+    UINT32                  InterruptNumber,
+    ACPI_GPE_XRUPT_INFO     **GpeXruptBlock)
 {
     ACPI_GPE_XRUPT_INFO     *NextGpeXrupt;
     ACPI_GPE_XRUPT_INFO     *GpeXrupt;
     ACPI_STATUS             Status;
     ACPI_CPU_FLAGS          Flags;

@@ -245,11 +247,12 @@
     NextGpeXrupt = AcpiGbl_GpeXruptListHead;
     while (NextGpeXrupt)
     {
         if (NextGpeXrupt->InterruptNumber == InterruptNumber)
         {
-            return_PTR (NextGpeXrupt);
+            *GpeXruptBlock = NextGpeXrupt;
+            return_ACPI_STATUS (AE_OK);
         }
 
         NextGpeXrupt = NextGpeXrupt->Next;
     }
 

@@ -256,11 +259,11 @@
     /* Not found, must allocate a new xrupt descriptor */
 
     GpeXrupt = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_XRUPT_INFO));
     if (!GpeXrupt)
     {
-        return_PTR (NULL);
+        return_ACPI_STATUS (AE_NO_MEMORY);
     }
 
     GpeXrupt->InterruptNumber = InterruptNumber;
 
     /* Install new interrupt descriptor with spin lock */

@@ -279,10 +282,11 @@
     }
     else
     {
         AcpiGbl_GpeXruptListHead = GpeXrupt;
     }
+
     AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
 
     /* Install new interrupt handler if not SCI_INT */
 
     if (InterruptNumber != AcpiGbl_FADT.SciInterrupt)

@@ -289,18 +293,19 @@
     {
         Status = AcpiOsInstallInterruptHandler (InterruptNumber,
                     AcpiEvGpeXruptHandler, GpeXrupt);
         if (ACPI_FAILURE (Status))
         {
-            ACPI_ERROR ((AE_INFO,
+            ACPI_EXCEPTION ((AE_INFO, Status,
                 "Could not install GPE interrupt handler at level 0x%X",
                 InterruptNumber));
-            return_PTR (NULL);
+            return_ACPI_STATUS (Status);
         }
     }
 
-    return_PTR (GpeXrupt);
+    *GpeXruptBlock = GpeXrupt;
+    return_ACPI_STATUS (AE_OK);
 }
 
 
 /*******************************************************************************
  *

@@ -389,10 +394,12 @@
     ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
     ACPI_GPE_BLOCK_INFO     *GpeBlock,
     void                    *Context)
 {
     ACPI_GPE_EVENT_INFO     *GpeEventInfo;
+    ACPI_GPE_NOTIFY_INFO    *Notify;
+    ACPI_GPE_NOTIFY_INFO    *Next;
     UINT32                  i;
     UINT32                  j;
 
 
     ACPI_FUNCTION_TRACE (EvDeleteGpeHandlers);

@@ -410,15 +417,33 @@
                 ACPI_GPE_REGISTER_WIDTH) + j];
 
             if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
                     ACPI_GPE_DISPATCH_HANDLER)
             {
+                /* Delete an installed handler block */
+
                 ACPI_FREE (GpeEventInfo->Dispatch.Handler);
                 GpeEventInfo->Dispatch.Handler = NULL;
                 GpeEventInfo->Flags &= ~ACPI_GPE_DISPATCH_MASK;
             }
+            else if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
+                    ACPI_GPE_DISPATCH_NOTIFY)
+            {
+                /* Delete the implicit notification device list */
+
+                Notify = GpeEventInfo->Dispatch.NotifyList;
+                while (Notify)
+                {
+                    Next = Notify->Next;
+                    ACPI_FREE (Notify);
+                    Notify = Next;
         }
+                GpeEventInfo->Dispatch.NotifyList = NULL;
+                GpeEventInfo->Flags &= ~ACPI_GPE_DISPATCH_MASK;
     }
+        }
+    }
 
     return_ACPI_STATUS (AE_OK);
 }
 
+#endif /* !ACPI_REDUCED_HARDWARE */