]> git.proxmox.com Git - mirror_edk2.git/commitdiff
EmbeddedPkg/MmcDxe: Set the BlockLength at the beginning of the BlockIo transfer
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 15 Aug 2011 16:38:27 +0000 (16:38 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 15 Aug 2011 16:38:27 +0000 (16:38 +0000)
Before the SetBlockLength command was called prior to a Read or Write command.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12133 6f19259b-4bc3-4df7-8a09-765794883524

EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c

index 8fd86f72440db9a1600ffb859b3aeb29882b5048..e222a784b7f4739b12986b0003ab7bd201703a2a 100644 (file)
@@ -498,6 +498,18 @@ MmcIoBlocks (
       DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcTransferState\n"));\r
       return Status;\r
     }\r
       DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcTransferState\n"));\r
       return Status;\r
     }\r
+\r
+    // Set Block Length\r
+    Status = MmcHost->SendCommand(MMC_CMD16, This->Media->BlockSize);\r
+    if (EFI_ERROR(Status)) {\r
+      DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD16): Error This->Media->BlockSize: %d and Error = %r\n",This->Media->BlockSize, Status));\r
+      return Status;\r
+    }\r
+\r
+    // Block Count (not used). Could return an error for SD card\r
+    if (MmcHostInstance->CardInfo.CardType == MMC_CARD) {\r
+      MmcHost->SendCommand(MMC_CMD23, BlockCount);\r
+    }\r
   } else {\r
     // Maybe test if the card has changed to update gMmcMedia information\r
     if (MmcHostInstance->State == MmcTransferState) {\r
   } else {\r
     // Maybe test if the card has changed to update gMmcMedia information\r
     if (MmcHostInstance->State == MmcTransferState) {\r
@@ -548,16 +560,6 @@ MmcIoBlocks (
       return EFI_NOT_READY;\r
     }\r
 \r
       return EFI_NOT_READY;\r
     }\r
 \r
-    // Set Block Length\r
-    Status = MmcHost->SendCommand(MMC_CMD16, This->Media->BlockSize);\r
-    if (EFI_ERROR(Status)) {\r
-      DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD16): Error This->Media->BlockSize:%d and Error = %r\n",This->Media->BlockSize, Status));\r
-      return Status;\r
-    }\r
-\r
-    // Block Count (not used). Could return an error for SD card\r
-    MmcHost->SendCommand(MMC_CMD23, BlockCount);\r
-\r
     //Set command argument based on the card access mode (Byte mode or Block mode)\r
     if (MmcHostInstance->CardInfo.OCRData.AccessMode & BIT1) {\r
       CmdArg = Lba;\r
     //Set command argument based on the card access mode (Byte mode or Block mode)\r
     if (MmcHostInstance->CardInfo.OCRData.AccessMode & BIT1) {\r
       CmdArg = Lba;\r