From: oliviermartin Date: Mon, 15 Aug 2011 16:38:27 +0000 (+0000) Subject: EmbeddedPkg/MmcDxe: Set the BlockLength at the beginning of the BlockIo transfer X-Git-Tag: edk2-stable201903~14401 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=e0932788c3b2b9e57f1546cb201d355c11f308cd;hp=bb0f9e9ba31f9722faa84c5d57195df013660214 EmbeddedPkg/MmcDxe: Set the BlockLength at the beginning of the BlockIo transfer 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 --- diff --git a/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c b/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c index 8fd86f7244..e222a784b7 100644 --- a/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c +++ b/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c @@ -498,6 +498,18 @@ MmcIoBlocks ( DEBUG((EFI_D_ERROR, "MmcIdentificationMode() : Error MmcTransferState\n")); return Status; } + + // Set Block Length + Status = MmcHost->SendCommand(MMC_CMD16, This->Media->BlockSize); + if (EFI_ERROR(Status)) { + DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD16): Error This->Media->BlockSize: %d and Error = %r\n",This->Media->BlockSize, Status)); + return Status; + } + + // Block Count (not used). Could return an error for SD card + if (MmcHostInstance->CardInfo.CardType == MMC_CARD) { + MmcHost->SendCommand(MMC_CMD23, BlockCount); + } } else { // Maybe test if the card has changed to update gMmcMedia information if (MmcHostInstance->State == MmcTransferState) { @@ -548,16 +560,6 @@ MmcIoBlocks ( return EFI_NOT_READY; } - // Set Block Length - Status = MmcHost->SendCommand(MMC_CMD16, This->Media->BlockSize); - if (EFI_ERROR(Status)) { - DEBUG((EFI_D_ERROR, "MmcIdentificationMode(MMC_CMD16): Error This->Media->BlockSize:%d and Error = %r\n",This->Media->BlockSize, Status)); - return Status; - } - - // Block Count (not used). Could return an error for SD card - MmcHost->SendCommand(MMC_CMD23, BlockCount); - //Set command argument based on the card access mode (Byte mode or Block mode) if (MmcHostInstance->CardInfo.OCRData.AccessMode & BIT1) { CmdArg = Lba;