]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/PL180MciDxe: Increased the TPL at the highest priority to disable...
authorOlivier Martin <olivier.martin@arm.com>
Tue, 6 Aug 2013 12:11:13 +0000 (12:11 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 6 Aug 2013 12:11:13 +0000 (12:11 +0000)
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 <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14526 6f19259b-4bc3-4df7-8a09-765794883524

ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.c

index d9de4a8fdfd998798f4dc2350e541c422d3b9967..db8b29fac3ac85007d31748a56e86bc0b6f8ba13 100644 (file)
@@ -217,12 +217,17 @@ MciReadBlockData (
   UINTN Status;\r
   EFI_STATUS RetVal;\r
   UINTN  DataCtrlReg;\r
+  EFI_TPL Tpl;\r
 \r
   RetVal = EFI_SUCCESS;\r
 \r
   // Read data from the RX FIFO\r
   Loop   = 0;\r
   Finish = MMCI0_BLOCKLEN / 4;\r
+  \r
+  // Raise the TPL at the highest level to disable Interrupts.\r
+  Tpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);\r
+\r
   do {\r
     // Read the Status flags\r
     Status = MmioRead32 (MCI_STATUS_REG);\r
@@ -270,6 +275,9 @@ MciReadBlockData (
     }\r
   } while ((Loop < Finish));\r
 \r
+  // Restore Tpl\r
+  gBS->RestoreTPL (Tpl);\r
+\r
   // Clear Status flags\r
   MmioWrite32 (MCI_CLEAR_STATUS_REG, MCI_CLR_ALL_STATUS);\r
 \r
@@ -294,6 +302,7 @@ MciWriteBlockData (
   UINTN Status;\r
   EFI_STATUS RetVal;\r
   UINTN  DataCtrlReg;\r
+  EFI_TPL Tpl;\r
 \r
   RetVal = EFI_SUCCESS;\r
 \r
@@ -301,6 +310,10 @@ MciWriteBlockData (
   Loop   = 0;\r
   Finish = MMCI0_BLOCKLEN / 4;\r
   Timer  = MMCI0_TIMEOUT * 100;\r
+\r
+  // Raise the TPL at the highest level to disable Interrupts.\r
+  Tpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);\r
+\r
   do {\r
     // Read the Status flags\r
     Status = MmioRead32 (MCI_STATUS_REG);\r
@@ -345,6 +358,9 @@ MciWriteBlockData (
     }\r
   } while (Loop < Finish);\r
 \r
+  // Restore Tpl\r
+  gBS->RestoreTPL (Tpl);\r
+\r
   // Wait for FIFO to drain\r
   Timer  = MMCI0_TIMEOUT * 60;\r
   Status = MmioRead32 (MCI_STATUS_REG);\r