]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BeagleBoardPkg/InterruptDxe/HardwareInterrupt.c
Fixed a bug in the HardwareInterrupt handler that would blow the stack if you reenabl...
[mirror_edk2.git] / BeagleBoardPkg / InterruptDxe / HardwareInterrupt.c
index 97361ffbc1d0c0ec4a0249d9f7145f5bfb0389e8..c87d56406391935897906655b267d9f1b7f72b36 100644 (file)
@@ -93,7 +93,6 @@ RegisterInterruptSource (
   }\r
 \r
   gRegisteredInterruptHandlers[Source] = Handler;\r
   }\r
 \r
   gRegisteredInterruptHandlers[Source] = Handler;\r
-\r
   return This->EnableInterruptSource(This, Source);\r
 }\r
 \r
   return This->EnableInterruptSource(This, Source);\r
 }\r
 \r
@@ -235,12 +234,16 @@ IrqInterruptHandler (
   \r
   Vector = MmioRead32(INTCPS_SIR_IRQ) & INTCPS_SIR_IRQ_MASK;\r
 \r
   \r
   Vector = MmioRead32(INTCPS_SIR_IRQ) & INTCPS_SIR_IRQ_MASK;\r
 \r
+  // Needed to prevent infinite nesting if Time Driver lowers TPL\r
+  MmioWrite32(INTCPS_CONTROL, INTCPS_CONTROL_NEWIRQAGR);\r
+\r
   InterruptHandler = gRegisteredInterruptHandlers[Vector];\r
   if (InterruptHandler != NULL) {\r
     // Call the registered interrupt handler.\r
     InterruptHandler(Vector, SystemContext);\r
   }\r
   \r
   InterruptHandler = gRegisteredInterruptHandlers[Vector];\r
   if (InterruptHandler != NULL) {\r
     // Call the registered interrupt handler.\r
     InterruptHandler(Vector, SystemContext);\r
   }\r
   \r
+  // Needed to clear after running the handler\r
   MmioWrite32(INTCPS_CONTROL, INTCPS_CONTROL_NEWIRQAGR);\r
 }\r
 \r
   MmioWrite32(INTCPS_CONTROL, INTCPS_CONTROL_NEWIRQAGR);\r
 }\r
 \r