]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Omap35xxPkg/InterruptDxe/HardwareInterrupt.c
Enhance Shell 2.0 to not depend on keyboard driver implementation to fix the "CTRL...
[mirror_edk2.git] / Omap35xxPkg / InterruptDxe / HardwareInterrupt.c
index 55e137361598e2943f2c0c311e804741522d981b..5040c4b152c568045180d3dc647d92955df1d758 100644 (file)
@@ -1,9 +1,9 @@
 /** @file\r
   Handle OMAP35xx interrupt controller \r
 \r
-  Copyright (c) 2008-2010, Apple Inc. All rights reserved.\r
+  Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>\r
   \r
-  All rights reserved. This program and the accompanying materials\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
@@ -59,6 +57,8 @@ ExitBootServicesEvent (
   MmioWrite32 (INTCPS_MIR(1), 0xFFFFFFFF);\r
   MmioWrite32 (INTCPS_MIR(2), 0xFFFFFFFF);\r
   MmioWrite32 (INTCPS_CONTROL, INTCPS_CONTROL_NEWIRQAGR);\r
+\r
+  // Add code here to disable all FIQs as debugger may have turned one on\r
 }\r
 \r
 /**\r
@@ -85,6 +85,14 @@ RegisterInterruptSource (
     return EFI_UNSUPPORTED;\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
+    // ctrl-c. So this ASSERT means you have a conflict with the debug agent\r
+    ASSERT (FALSE);\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+  \r
   if ((Handler == NULL) && (gRegisteredInterruptHandlers[Source] == NULL)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
@@ -288,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
@@ -337,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
@@ -352,11 +330,22 @@ InterruptDxeInitialize (
                                                   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
+  // 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