* [PATCH 1/1] MdeModulePkg/Sd: append CMD12 for multiple blocks @ 2018-04-28 5:24 Haojian Zhuang 2018-05-03 2:45 ` Wu, Hao A 0 siblings, 1 reply; 3+ messages in thread From: Haojian Zhuang @ 2018-04-28 5:24 UTC (permalink / raw) To: edk2-devel Cc: Haojian Zhuang, Star Zeng, Eric Dong, Ruiyu Ni, Leif Lindholm, Ard Biesheuvel Send CMD12 to stop transimission for accessing multiple blocks. It's required by SD Card protocol. Cc: Star Zeng <star.zeng@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Leif Lindholm <leif.lindholm@linaro.org> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org> --- MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c index 516c3e704288..64259f99f9bc 100644 --- a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c +++ b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c @@ -426,6 +426,36 @@ Error: return Status; } +EFI_STATUS +SdStopTrans ( + IN SD_DEVICE *Device + ) +{ + EFI_STATUS Status; + EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru; + EFI_SD_MMC_COMMAND_BLOCK SdMmcCmdBlk; + EFI_SD_MMC_STATUS_BLOCK SdMmcStatusBlk; + EFI_SD_MMC_PASS_THRU_COMMAND_PACKET Packet; + + PassThru = Device->Private->PassThru; + + ZeroMem (&SdMmcCmdBlk, sizeof (SdMmcCmdBlk)); + ZeroMem (&SdMmcStatusBlk, sizeof (SdMmcStatusBlk)); + ZeroMem (&Packet, sizeof (Packet)); + + Packet.SdMmcCmdBlk = &SdMmcCmdBlk; + Packet.SdMmcStatusBlk = &SdMmcStatusBlk; + Packet.Timeout = SD_GENERIC_TIMEOUT; + + SdMmcCmdBlk.CommandIndex = SD_STOP_TRANSMISSION; + SdMmcCmdBlk.CommandType = SdMmcCommandTypeAc; + SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR1b; + SdMmcCmdBlk.CommandArgument = 0; + + Status = PassThru->PassThru (PassThru, Device->Slot, &Packet, NULL); + return Status; +} + /** Read/write multiple blocks through sync or async I/O request. @@ -555,6 +585,11 @@ Error: } } + if (EFI_ERROR (Status)) { + return Status; + } + + Status = SdStopTrans (Device); return Status; } -- 2.7.4 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] MdeModulePkg/Sd: append CMD12 for multiple blocks 2018-04-28 5:24 [PATCH 1/1] MdeModulePkg/Sd: append CMD12 for multiple blocks Haojian Zhuang @ 2018-05-03 2:45 ` Wu, Hao A 2018-05-09 9:56 ` Haojian Zhuang 0 siblings, 1 reply; 3+ messages in thread From: Wu, Hao A @ 2018-05-03 2:45 UTC (permalink / raw) To: Haojian Zhuang, edk2-devel@lists.01.org Cc: Ni, Ruiyu, Dong, Eric, Ard Biesheuvel, Leif Lindholm, Zeng, Star Hi Haojian, Sorry for the delayed response. As far as I know, we enabled the auto CMD12 feature within: SdMmcExecTrb(), MdeModulePkg\Bus\Pci\SdMmcPciHcDxe\SdMmcPciHci.c // // Only SD memory card needs to use AUTO CMD12 feature. // if (Private->Slot[Trb->Slot].CardType == SdCardType) { if (BlkCount > 1) { TransMode |= BIT2; } } So I think the explicitly sending CMD12 in SdRwMultiBlocks() is not needed. Have you met problems when using SdRwMultiBlocks()? Could you help to provide detailed device information when you meet the problem? Thanks in advance. Best Regards, Hao Wu > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Haojian Zhuang > Sent: Saturday, April 28, 2018 1:24 PM > To: edk2-devel@lists.01.org > Cc: Ni, Ruiyu; Dong, Eric; Ard Biesheuvel; Leif Lindholm; Haojian Zhuang; Zeng, > Star > Subject: [edk2] [PATCH 1/1] MdeModulePkg/Sd: append CMD12 for multiple > blocks > > Send CMD12 to stop transimission for accessing multiple blocks. It's > required by SD Card protocol. > > Cc: Star Zeng <star.zeng@intel.com> > Cc: Eric Dong <eric.dong@intel.com> > Cc: Ruiyu Ni <ruiyu.ni@intel.com> > Cc: Leif Lindholm <leif.lindholm@linaro.org> > Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org> > --- > MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c | 35 > +++++++++++++++++++++++++++++++++++ > 1 file changed, 35 insertions(+) > > diff --git a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c > b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c > index 516c3e704288..64259f99f9bc 100644 > --- a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c > +++ b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c > @@ -426,6 +426,36 @@ Error: > return Status; > } > > +EFI_STATUS > +SdStopTrans ( > + IN SD_DEVICE *Device > + ) > +{ > + EFI_STATUS Status; > + EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru; > + EFI_SD_MMC_COMMAND_BLOCK SdMmcCmdBlk; > + EFI_SD_MMC_STATUS_BLOCK SdMmcStatusBlk; > + EFI_SD_MMC_PASS_THRU_COMMAND_PACKET Packet; > + > + PassThru = Device->Private->PassThru; > + > + ZeroMem (&SdMmcCmdBlk, sizeof (SdMmcCmdBlk)); > + ZeroMem (&SdMmcStatusBlk, sizeof (SdMmcStatusBlk)); > + ZeroMem (&Packet, sizeof (Packet)); > + > + Packet.SdMmcCmdBlk = &SdMmcCmdBlk; > + Packet.SdMmcStatusBlk = &SdMmcStatusBlk; > + Packet.Timeout = SD_GENERIC_TIMEOUT; > + > + SdMmcCmdBlk.CommandIndex = SD_STOP_TRANSMISSION; > + SdMmcCmdBlk.CommandType = SdMmcCommandTypeAc; > + SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR1b; > + SdMmcCmdBlk.CommandArgument = 0; > + > + Status = PassThru->PassThru (PassThru, Device->Slot, &Packet, NULL); > + return Status; > +} > + > /** > Read/write multiple blocks through sync or async I/O request. > > @@ -555,6 +585,11 @@ Error: > } > } > > + if (EFI_ERROR (Status)) { > + return Status; > + } > + > + Status = SdStopTrans (Device); > return Status; > } > > -- > 2.7.4 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] MdeModulePkg/Sd: append CMD12 for multiple blocks 2018-05-03 2:45 ` Wu, Hao A @ 2018-05-09 9:56 ` Haojian Zhuang 0 siblings, 0 replies; 3+ messages in thread From: Haojian Zhuang @ 2018-05-09 9:56 UTC (permalink / raw) To: Wu, Hao A Cc: edk2-devel@lists.01.org, Ni, Ruiyu, Dong, Eric, Ard Biesheuvel, Leif Lindholm, Zeng, Star Hi Hao, OK. I tried to enable auto stop command in Designware MMC driver. So this patch could be ignored. Thanks Haojian On 3 May 2018 at 10:45, Wu, Hao A <hao.a.wu@intel.com> wrote: > Hi Haojian, > > Sorry for the delayed response. > > As far as I know, we enabled the auto CMD12 feature within: > SdMmcExecTrb(), MdeModulePkg\Bus\Pci\SdMmcPciHcDxe\SdMmcPciHci.c > > // > // Only SD memory card needs to use AUTO CMD12 feature. > // > if (Private->Slot[Trb->Slot].CardType == SdCardType) { > if (BlkCount > 1) { > TransMode |= BIT2; > } > } > > So I think the explicitly sending CMD12 in SdRwMultiBlocks() is not needed. > > Have you met problems when using SdRwMultiBlocks()? Could you help to > provide detailed device information when you meet the problem? > > Thanks in advance. > > Best Regards, > Hao Wu > >> -----Original Message----- >> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of >> Haojian Zhuang >> Sent: Saturday, April 28, 2018 1:24 PM >> To: edk2-devel@lists.01.org >> Cc: Ni, Ruiyu; Dong, Eric; Ard Biesheuvel; Leif Lindholm; Haojian Zhuang; Zeng, >> Star >> Subject: [edk2] [PATCH 1/1] MdeModulePkg/Sd: append CMD12 for multiple >> blocks >> >> Send CMD12 to stop transimission for accessing multiple blocks. It's >> required by SD Card protocol. >> >> Cc: Star Zeng <star.zeng@intel.com> >> Cc: Eric Dong <eric.dong@intel.com> >> Cc: Ruiyu Ni <ruiyu.ni@intel.com> >> Cc: Leif Lindholm <leif.lindholm@linaro.org> >> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> >> Contributed-under: TianoCore Contribution Agreement 1.1 >> Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org> >> --- >> MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c | 35 >> +++++++++++++++++++++++++++++++++++ >> 1 file changed, 35 insertions(+) >> >> diff --git a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c >> b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c >> index 516c3e704288..64259f99f9bc 100644 >> --- a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c >> +++ b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c >> @@ -426,6 +426,36 @@ Error: >> return Status; >> } >> >> +EFI_STATUS >> +SdStopTrans ( >> + IN SD_DEVICE *Device >> + ) >> +{ >> + EFI_STATUS Status; >> + EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru; >> + EFI_SD_MMC_COMMAND_BLOCK SdMmcCmdBlk; >> + EFI_SD_MMC_STATUS_BLOCK SdMmcStatusBlk; >> + EFI_SD_MMC_PASS_THRU_COMMAND_PACKET Packet; >> + >> + PassThru = Device->Private->PassThru; >> + >> + ZeroMem (&SdMmcCmdBlk, sizeof (SdMmcCmdBlk)); >> + ZeroMem (&SdMmcStatusBlk, sizeof (SdMmcStatusBlk)); >> + ZeroMem (&Packet, sizeof (Packet)); >> + >> + Packet.SdMmcCmdBlk = &SdMmcCmdBlk; >> + Packet.SdMmcStatusBlk = &SdMmcStatusBlk; >> + Packet.Timeout = SD_GENERIC_TIMEOUT; >> + >> + SdMmcCmdBlk.CommandIndex = SD_STOP_TRANSMISSION; >> + SdMmcCmdBlk.CommandType = SdMmcCommandTypeAc; >> + SdMmcCmdBlk.ResponseType = SdMmcResponseTypeR1b; >> + SdMmcCmdBlk.CommandArgument = 0; >> + >> + Status = PassThru->PassThru (PassThru, Device->Slot, &Packet, NULL); >> + return Status; >> +} >> + >> /** >> Read/write multiple blocks through sync or async I/O request. >> >> @@ -555,6 +585,11 @@ Error: >> } >> } >> >> + if (EFI_ERROR (Status)) { >> + return Status; >> + } >> + >> + Status = SdStopTrans (Device); >> return Status; >> } >> >> -- >> 2.7.4 >> >> _______________________________________________ >> edk2-devel mailing list >> edk2-devel@lists.01.org >> https://lists.01.org/mailman/listinfo/edk2-devel ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-05-09 9:56 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-04-28 5:24 [PATCH 1/1] MdeModulePkg/Sd: append CMD12 for multiple blocks Haojian Zhuang 2018-05-03 2:45 ` Wu, Hao A 2018-05-09 9:56 ` Haojian Zhuang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox