Jun, Haojian - any comments?
On Wed, Jan 16, 2019 at 06:51:36PM +0530, Meenakshi Aggarwal wrote: > Issue : SD read failure for high capacity cards e.g. 64 GB > i > Reason : Command argument value exceeds 32 bit for block number 0x3787FFF > and cant be fit into 32 bit wide SD host controller register. > > Fix : > AccessMode bits [29:30] of OCR is a valid definition to calculate > data address for eMMC cards. > > For SD cards, data address is calculated on the basis of > card capacity status bit[30] of OCR. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Meenakshi Aggarwal <meenakshi.aggar...@nxp.com> > --- > EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c | 19 ++++++++++++++----- > 1 file changed, 14 insertions(+), 5 deletions(-) > > diff --git a/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c > b/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c > index a2b9232..625a59e 100644 > --- a/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c > +++ b/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c > @@ -148,12 +148,21 @@ MmcTransferBlock ( > MmcHostInstance = MMC_HOST_INSTANCE_FROM_BLOCK_IO_THIS (This); > MmcHost = MmcHostInstance->MmcHost; > > - //Set command argument based on the card access mode (Byte mode or Block > mode) > - if ((MmcHostInstance->CardInfo.OCRData.AccessMode & MMC_OCR_ACCESS_MASK) == > - MMC_OCR_ACCESS_SECTOR) { > - CmdArg = Lba; > + if (MmcHostInstance->CardInfo.CardType != EMMC_CARD) { > + //Set command argument based on the card capacity (SDSC or SDXC/SDHC) > + if (MmcHostInstance->CardInfo.OCRData.AccessMode & BIT1) { > + CmdArg = Lba; > + } else { > + CmdArg = Lba * This->Media->BlockSize; > + } > } else { > - CmdArg = Lba * This->Media->BlockSize; > + //Set command argument based on the card access mode (Byte mode or Block > mode) > + if ((MmcHostInstance->CardInfo.OCRData.AccessMode & MMC_OCR_ACCESS_MASK) > == > + MMC_OCR_ACCESS_SECTOR) { > + CmdArg = Lba; > + } else { > + CmdArg = Lba * This->Media->BlockSize; > + } > } > > Status = MmcHost->SendCommand (MmcHost, Cmd, CmdArg); > -- > 1.9.1 > _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel