X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=ArmPkg%2FDrivers%2FPL390Gic%2FPL390GicSec.c;fp=ArmPkg%2FDrivers%2FPL390Gic%2FPL390GicSec.c;h=6244575772bf67d25d15e7f1afa1c9dc1321a537;hp=e47e23d58103b84e16d663b617372feedef5cf5c;hb=81742bb085522dc9120af1b7cc1a1dc959afa7b9;hpb=5ab765a7ad42933b4ea51a1f9593c37f7b32e6d7 diff --git a/ArmPkg/Drivers/PL390Gic/PL390GicSec.c b/ArmPkg/Drivers/PL390Gic/PL390GicSec.c index e47e23d581..6244575772 100644 --- a/ArmPkg/Drivers/PL390Gic/PL390GicSec.c +++ b/ArmPkg/Drivers/PL390Gic/PL390GicSec.c @@ -39,14 +39,15 @@ ArmGicSetupNonSecure ( // Set priority Mask so that no interrupts get through to CPU MmioWrite32 (GicInterruptInterfaceBase + ARM_GIC_ICCPMR, 0); - // Check if there are any pending interrupts - //TODO: could be extended to take Peripheral interrupts into consideration, but at the moment only SGI's are taken into consideration. - while(0 != (MmioRead32 (GicDistributorBase + ARM_GIC_ICDICPR) & 0xF)) { - // Some of the SGI's are still pending, read Ack register and send End of Interrupt Signal - InterruptId = MmioRead32 (GicInterruptInterfaceBase + ARM_GIC_ICCIAR); + InterruptId = MmioRead32 (GicInterruptInterfaceBase + ARM_GIC_ICCIAR); - // Write to End of interrupt signal + // Only try to clear valid interrupts. Ignore spurious interrupts. + while ((InterruptId & 0x3FF) < ArmGicGetMaxNumInterrupts (GicDistributorBase)) { + // Some of the SGI's are still pending, read Ack register and send End of Interrupt Signal MmioWrite32 (GicInterruptInterfaceBase + ARM_GIC_ICCEIOR, InterruptId); + + // Next + InterruptId = MmioRead32 (GicInterruptInterfaceBase + ARM_GIC_ICCIAR); } // Only the primary core should set the Non Secure bit to the SPIs (Shared Peripheral Interrupt).