From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::344; helo=mail-wm1-x344.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 89865211B6C22 for ; Thu, 17 Jan 2019 03:23:42 -0800 (PST) Received: by mail-wm1-x344.google.com with SMTP id n190so674472wmd.0 for ; Thu, 17 Jan 2019 03:23:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=8EEKt6jPRAiv+4exWVriTrj996WaZmC/2edFqBDDju4=; b=BaJYl+jIjbP9GUN2cpssnQFoEMdLR4W33IhnJuWrLFp9B6kqoiLx9HMW2r5YG0aIZn ZUbeLOwlx9sK+7oCTFzeTE69FUKhBFTsadupEzPSl2vSUXcMV2hvki4HQ7QBJhjgs5yj TArfB6Z2c3bWW9t1Y3ny09Xg8/YVbarP79bCs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=8EEKt6jPRAiv+4exWVriTrj996WaZmC/2edFqBDDju4=; b=rsknoi+hc0nSkJIztjGtj2GFYfpRpluvLOtqCsFoVyYm88t+kj2TAhCbtpVDGdMnBs eTXc1lqoEBn0FdjrgEKkabYARwY55+lfhqCTFy7XG8HQOs/d/GrPBEBe8oswU0nx2jPQ IKt72C5pFRRxi7Vq5u8UnBtc33UHhaaei67pgoJY1as55hGxjAxugVviO77ioqrXYVYw 7Yz+aY8nS4Xt4LlpNnwJY1LyP/RvFLAKtMClbXN4xbd/4Vvu0n+SH98gV7/UYGFEbOpt A297+OLUWhBLAGCXYkTAujuB/qG6puY2NAaVrNDAQeIvfno2AfOBd6lC8ZmDbmahMWB5 xLUQ== X-Gm-Message-State: AJcUukeHE+GvJpb8WOcOra5GrVme2zOHhZMuDqNs8o2n1MnVKoEX4yH5 CAtnlBgiYXBq2Xs8RKp7AuFSW45nZr0= X-Google-Smtp-Source: ALg8bN4lfHIO8Hg0klfMz7jFLbM2/Hs9g0ibP56dlppQ6uYUvbXi26xuxp0eKCRvWt1UtUmJEYX8Jg== X-Received: by 2002:a1c:180a:: with SMTP id 10mr11292566wmy.92.1547724220706; Thu, 17 Jan 2019 03:23:40 -0800 (PST) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id o5sm17325611wrw.46.2019.01.17.03.23.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Jan 2019 03:23:39 -0800 (PST) Date: Thu, 17 Jan 2019 11:23:38 +0000 From: Leif Lindholm To: Meenakshi Aggarwal Cc: ard.biesheuvel@linaro.org, edk2-devel@lists.01.org, Jun Nie , Haojian Zhuang Message-ID: <20190117112338.llv64ylvwywtezof@bivouac.eciton.net> References: <1547644896-7721-1-git-send-email-meenakshi.aggarwal@nxp.com> MIME-Version: 1.0 In-Reply-To: <1547644896-7721-1-git-send-email-meenakshi.aggarwal@nxp.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [PATCH] SD/eMMC : Fix Command Argument for SD/eMMC R/W operation. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jan 2019 11:23:42 -0000 X-List-Received-Date: Thu, 17 Jan 2019 11:23:42 -0000 X-List-Received-Date: Thu, 17 Jan 2019 11:23:42 -0000 X-List-Received-Date: Thu, 17 Jan 2019 11:23:42 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 > --- > 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 >