From: Olivier Martin Date: Tue, 6 Aug 2013 12:11:13 +0000 (+0000) Subject: ArmPlatformPkg/PL180MciDxe: Increased the TPL at the highest priority to disable... X-Git-Tag: edk2-stable201903~12380 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=bb058bcdfbfeb91e3c6c3f61559ca3d7239062f9 ArmPlatformPkg/PL180MciDxe: Increased the TPL at the highest priority to disable interrupts This change prevent any interrupt to disturb the PL180 data transfer. If the data transfer is not fast enough, we get UNDERRUN error. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14526 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.c b/ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.c index d9de4a8fdf..db8b29fac3 100644 --- a/ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.c +++ b/ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.c @@ -217,12 +217,17 @@ MciReadBlockData ( UINTN Status; EFI_STATUS RetVal; UINTN DataCtrlReg; + EFI_TPL Tpl; RetVal = EFI_SUCCESS; // Read data from the RX FIFO Loop = 0; Finish = MMCI0_BLOCKLEN / 4; + + // Raise the TPL at the highest level to disable Interrupts. + Tpl = gBS->RaiseTPL (TPL_HIGH_LEVEL); + do { // Read the Status flags Status = MmioRead32 (MCI_STATUS_REG); @@ -270,6 +275,9 @@ MciReadBlockData ( } } while ((Loop < Finish)); + // Restore Tpl + gBS->RestoreTPL (Tpl); + // Clear Status flags MmioWrite32 (MCI_CLEAR_STATUS_REG, MCI_CLR_ALL_STATUS); @@ -294,6 +302,7 @@ MciWriteBlockData ( UINTN Status; EFI_STATUS RetVal; UINTN DataCtrlReg; + EFI_TPL Tpl; RetVal = EFI_SUCCESS; @@ -301,6 +310,10 @@ MciWriteBlockData ( Loop = 0; Finish = MMCI0_BLOCKLEN / 4; Timer = MMCI0_TIMEOUT * 100; + + // Raise the TPL at the highest level to disable Interrupts. + Tpl = gBS->RaiseTPL (TPL_HIGH_LEVEL); + do { // Read the Status flags Status = MmioRead32 (MCI_STATUS_REG); @@ -345,6 +358,9 @@ MciWriteBlockData ( } } while (Loop < Finish); + // Restore Tpl + gBS->RestoreTPL (Tpl); + // Wait for FIFO to drain Timer = MMCI0_TIMEOUT * 60; Status = MmioRead32 (MCI_STATUS_REG);