EmbeddedPkg/MmcDxe: Avoid nanosecond delay when command succeeds
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 2 Aug 2012 10:14:52 +0000 (10:14 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 2 Aug 2012 10:14:52 +0000 (10:14 +0000)
Check response just after receiving it to avoid the delay.

Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13584 6f19259b-4bc3-4df7-8a09-765794883524

EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c

index 32a8519..7452b55 100644 (file)
@@ -628,7 +628,10 @@ MmcIoBlocks (
     while(!(Response[0] & MMC_R0_READY_FOR_DATA) && (MMC_R0_CURRENTSTATE(Response) != MMC_R0_STATE_TRAN) && Timeout--) {\r
       Status = MmcHost->SendCommand (MmcHost, MMC_CMD13, CmdArg);\r
       if (!EFI_ERROR(Status)) {\r
-        MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R1,Response);\r
+        MmcHost->ReceiveResponse (MmcHost, MMC_RESPONSE_TYPE_R1, Response);\r
+        if ((Response[0] & MMC_R0_READY_FOR_DATA)) {\r
+          break;  // Prevents delay once finished\r
+        }\r
       }\r
       NanoSecondDelay(100);\r
       Timeout--;\r