]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Omap35xxPkg/InterruptDxe/HardwareInterrupt.c
BaseTools: ignore the binary LIB file in gen_libs
[mirror_edk2.git] / Omap35xxPkg / InterruptDxe / HardwareInterrupt.c
index 8ffdc0bec1e1a9e522f81906ced0c9bf9fe365e4..09e22b5921b0fd10c40dea6e91173c605890ee75 100644 (file)
@@ -1,9 +1,9 @@
 /** @file\r
-  Handle OMAP35xx interrupt controller \r
+  Handle OMAP35xx interrupt controller\r
 \r
-  Copyright (c) 2008-2010, Apple Inc. All rights reserved.\r
-  \r
-  All rights reserved. This program and the accompanying materials\r
+  Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>\r
+\r
+  This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
   http://opensource.org/licenses/bsd-license.php\r
@@ -31,8 +31,6 @@
 //\r
 // Notifications\r
 //\r
-VOID      *CpuProtocolNotificationToken = NULL;\r
-EFI_EVENT CpuProtocolNotificationEvent  = (EFI_EVENT)NULL;\r
 EFI_EVENT EfiExitBootServicesEvent      = (EFI_EVENT)NULL;\r
 \r
 \r
@@ -40,7 +38,7 @@ HARDWARE_INTERRUPT_HANDLER  gRegisteredInterruptHandlers[INT_NROF_VECTORS];
 \r
 /**\r
   Shutdown our hardware\r
-  \r
+\r
   DXE Core will disable interrupts and turn off the timer and disable interrupts\r
   after all the event handlers have run.\r
 \r
@@ -85,16 +83,16 @@ RegisterInterruptSource (
   if (Source > MAX_VECTOR) {\r
     ASSERT(FALSE);\r
     return EFI_UNSUPPORTED;\r
-  } \r
-  \r
+  }\r
+\r
   if ((MmioRead32 (INTCPS_ILR(Source)) & INTCPS_ILR_FIQ) == INTCPS_ILR_FIQ) {\r
     // This vector has been programmed as FIQ so we can't use it for IRQ\r
-    // EFI does not use FIQ, but the debugger can use it to check for \r
+    // EFI does not use FIQ, but the debugger can use it to check for\r
     // ctrl-c. So this ASSERT means you have a conflict with the debug agent\r
     ASSERT (FALSE);\r
     return EFI_UNSUPPORTED;\r
   }\r
-  \r
+\r
   if ((Handler == NULL) && (gRegisteredInterruptHandlers[Source] == NULL)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
@@ -127,17 +125,17 @@ EnableInterruptSource (
 {\r
   UINTN Bank;\r
   UINTN Bit;\r
-  \r
+\r
   if (Source > MAX_VECTOR) {\r
     ASSERT(FALSE);\r
     return EFI_UNSUPPORTED;\r
   }\r
-  \r
+\r
   Bank = Source / 32;\r
   Bit  = 1UL << (Source % 32);\r
-  \r
+\r
   MmioWrite32 (INTCPS_MIR_CLEAR(Bank), Bit);\r
-  \r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -161,17 +159,17 @@ DisableInterruptSource (
 {\r
   UINTN Bank;\r
   UINTN Bit;\r
-  \r
+\r
   if (Source > MAX_VECTOR) {\r
     ASSERT(FALSE);\r
     return EFI_UNSUPPORTED;\r
   }\r
-  \r
+\r
   Bank = Source / 32;\r
   Bit  = 1UL << (Source % 32);\r
-  \r
+\r
   MmioWrite32 (INTCPS_MIR_SET(Bank), Bit);\r
-  \r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -198,11 +196,11 @@ GetInterruptSourceState (
 {\r
   UINTN Bank;\r
   UINTN Bit;\r
-  \r
+\r
   if (InterruptState == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-  \r
+\r
   if (Source > MAX_VECTOR) {\r
     ASSERT(FALSE);\r
     return EFI_UNSUPPORTED;\r
@@ -210,18 +208,18 @@ GetInterruptSourceState (
 \r
   Bank = Source / 32;\r
   Bit  = 1UL << (Source % 32);\r
-    \r
+\r
   if ((MmioRead32(INTCPS_MIR(Bank)) & Bit) == Bit) {\r
     *InterruptState = FALSE;\r
   } else {\r
     *InterruptState = TRUE;\r
   }\r
-  \r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r
 /**\r
-  Signal to the hardware that the End Of Intrrupt state \r
+  Signal to the hardware that the End Of Intrrupt state\r
   has been reached.\r
 \r
   @param This     Instance pointer for this protocol\r
@@ -239,7 +237,7 @@ EndOfInterrupt (
   )\r
 {\r
   MmioWrite32 (INTCPS_CONTROL, INTCPS_CONTROL_NEWIRQAGR);\r
-  ArmDataSyncronizationBarrier ();\r
+  ArmDataSynchronizationBarrier ();\r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -264,22 +262,22 @@ IrqInterruptHandler (
 {\r
   UINT32                     Vector;\r
   HARDWARE_INTERRUPT_HANDLER InterruptHandler;\r
-  \r
+\r
   Vector = MmioRead32 (INTCPS_SIR_IRQ) & INTCPS_SIR_IRQ_MASK;\r
 \r
   // Needed to prevent infinite nesting when Time Driver lowers TPL\r
   MmioWrite32 (INTCPS_CONTROL, INTCPS_CONTROL_NEWIRQAGR);\r
-  ArmDataSyncronizationBarrier ();\r
-  \r
+  ArmDataSynchronizationBarrier ();\r
+\r
   InterruptHandler = gRegisteredInterruptHandlers[Vector];\r
   if (InterruptHandler != NULL) {\r
     // Call the registered interrupt handler.\r
     InterruptHandler (Vector, SystemContext);\r
   }\r
-  \r
+\r
   // Needed to clear after running the handler\r
   MmioWrite32 (INTCPS_CONTROL, INTCPS_CONTROL_NEWIRQAGR);\r
-  ArmDataSyncronizationBarrier ();\r
+  ArmDataSynchronizationBarrier ();\r
 }\r
 \r
 //\r
@@ -298,37 +296,6 @@ EFI_HARDWARE_INTERRUPT_PROTOCOL gHardwareInterruptProtocol = {
   EndOfInterrupt\r
 };\r
 \r
-//\r
-// Notification routines\r
-//\r
-VOID\r
-CpuProtocolInstalledNotification (\r
-  IN EFI_EVENT   Event,\r
-  IN VOID        *Context\r
-  )\r
-{\r
-  EFI_STATUS              Status;\r
-  EFI_CPU_ARCH_PROTOCOL   *Cpu;\r
-  \r
-  //\r
-  // Get the cpu protocol that this driver requires.\r
-  //\r
-  Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **)&Cpu);\r
-  ASSERT_EFI_ERROR(Status);\r
-\r
-  //\r
-  // Unregister the default exception handler.\r
-  //\r
-  Status = Cpu->RegisterInterruptHandler (Cpu, EXCEPT_ARM_IRQ, NULL);\r
-  ASSERT_EFI_ERROR(Status);\r
-\r
-  //\r
-  // Register to receive interrupts\r
-  //\r
-  Status = Cpu->RegisterInterruptHandler (Cpu, EXCEPT_ARM_IRQ, IrqInterruptHandler);\r
-  ASSERT_EFI_ERROR(Status);\r
-}\r
-\r
 /**\r
   Initialize the state information for the CPU Architectural Protocol\r
 \r
@@ -347,6 +314,7 @@ InterruptDxeInitialize (
   )\r
 {\r
   EFI_STATUS  Status;\r
+  EFI_CPU_ARCH_PROTOCOL   *Cpu;\r
 \r
   // Make sure the Interrupt Controller Protocol is not already installed in the system.\r
   ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gHardwareInterruptProtocolGuid);\r
@@ -356,17 +324,28 @@ InterruptDxeInitialize (
   MmioWrite32 (INTCPS_MIR(1), 0xFFFFFFFF);\r
   MmioWrite32 (INTCPS_MIR(2), 0xFFFFFFFF);\r
   MmioOr32 (INTCPS_CONTROL, INTCPS_CONTROL_NEWIRQAGR);\r
\r
+\r
   Status = gBS->InstallMultipleProtocolInterfaces(&gHardwareInterruptHandle,\r
                                                   &gHardwareInterruptProtocolGuid,   &gHardwareInterruptProtocol,\r
                                                   NULL);\r
   ASSERT_EFI_ERROR(Status);\r
-  \r
-  // Set up to be notified when the Cpu protocol is installed.\r
-  Status = gBS->CreateEvent(EVT_NOTIFY_SIGNAL, TPL_CALLBACK, CpuProtocolInstalledNotification, NULL, &CpuProtocolNotificationEvent);    \r
+\r
+  //\r
+  // Get the CPU protocol that this driver requires.\r
+  //\r
+  Status = gBS->LocateProtocol(&gEfiCpuArchProtocolGuid, NULL, (VOID **)&Cpu);\r
   ASSERT_EFI_ERROR(Status);\r
 \r
-  Status = gBS->RegisterProtocolNotify(&gEfiCpuArchProtocolGuid, CpuProtocolNotificationEvent, (VOID *)&CpuProtocolNotificationToken);\r
+  //\r
+  // Unregister the default exception handler.\r
+  //\r
+  Status = Cpu->RegisterInterruptHandler(Cpu, EXCEPT_ARM_IRQ, NULL);\r
+  ASSERT_EFI_ERROR(Status);\r
+\r
+  //\r
+  // Register to receive interrupts\r
+  //\r
+  Status = Cpu->RegisterInterruptHandler(Cpu, EXCEPT_ARM_IRQ, IrqInterruptHandler);\r
   ASSERT_EFI_ERROR(Status);\r
 \r
   // Register for an ExitBootServicesEvent\r