diff --git a/ArmPkg/Drivers/CpuDxe/CpuDxe.c b/ArmPkg/Drivers/CpuDxe/CpuDxe.c index 2b43d2a9c9..d3f0ff505d 100644 --- a/ArmPkg/Drivers/CpuDxe/CpuDxe.c +++ b/ArmPkg/Drivers/CpuDxe/CpuDxe.c @@ -14,7 +14,6 @@ #include "CpuDxe.h" -BOOLEAN gExceptionContext = FALSE; BOOLEAN mInterruptState = FALSE; EFI_STATUS @@ -49,9 +48,7 @@ CpuEnableInterrupt ( IN EFI_CPU_ARCH_PROTOCOL *This ) { - if (!gExceptionContext) { - ArmEnableInterrupts (); - } + ArmEnableInterrupts (); mInterruptState = TRUE; return EFI_SUCCESS; @@ -64,9 +61,7 @@ CpuDisableInterrupt ( IN EFI_CPU_ARCH_PROTOCOL *This ) { - if (!gExceptionContext) { - ArmDisableInterrupts (); - } + ArmDisableInterrupts (); mInterruptState = FALSE; return EFI_SUCCESS; diff --git a/ArmPkg/Drivers/CpuDxe/Exception.c b/ArmPkg/Drivers/CpuDxe/Exception.c index 8859ca8667..9910bd2b88 100644 --- a/ArmPkg/Drivers/CpuDxe/Exception.c +++ b/ArmPkg/Drivers/CpuDxe/Exception.c @@ -15,8 +15,6 @@ #include "CpuDxe.h" #include -extern BOOLEAN gExceptionContext; - VOID ExceptionHandlersStart ( VOID @@ -142,8 +140,7 @@ CommonCExceptionHandler ( { BOOLEAN Dispatched = FALSE; - gExceptionContext = TRUE; - + if (ExceptionType <= MAX_ARM_EXCEPTION) { if (gDebuggerExceptionHandlers[ExceptionType]) { // @@ -162,8 +159,6 @@ CommonCExceptionHandler ( ASSERT (FALSE); } - gExceptionContext = FALSE; - if (Dispatched) { // // We did work so this was an expected ExceptionType diff --git a/BeagleBoardPkg/InterruptDxe/HardwareInterrupt.c b/BeagleBoardPkg/InterruptDxe/HardwareInterrupt.c index 3e69515dfe..c87d564063 100644 --- a/BeagleBoardPkg/InterruptDxe/HardwareInterrupt.c +++ b/BeagleBoardPkg/InterruptDxe/HardwareInterrupt.c @@ -234,12 +234,16 @@ IrqInterruptHandler ( Vector = MmioRead32(INTCPS_SIR_IRQ) & INTCPS_SIR_IRQ_MASK; + // Needed to prevent infinite nesting if Time Driver lowers TPL + MmioWrite32(INTCPS_CONTROL, INTCPS_CONTROL_NEWIRQAGR); + InterruptHandler = gRegisteredInterruptHandlers[Vector]; if (InterruptHandler != NULL) { // Call the registered interrupt handler. InterruptHandler(Vector, SystemContext); } + // Needed to clear after running the handler MmioWrite32(INTCPS_CONTROL, INTCPS_CONTROL_NEWIRQAGR); }