public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Wu, Hao A" <hao.a.wu@intel.com>
To: Haojian Zhuang <haojian.zhuang@linaro.org>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Ni, Ruiyu" <ruiyu.ni@intel.com>,
	"Dong, Eric" <eric.dong@intel.com>,
	"Ard Biesheuvel" <ard.biesheuvel@linaro.org>,
	Leif Lindholm <leif.lindholm@linaro.org>,
	"Zeng, Star" <star.zeng@intel.com>
Subject: Re: [PATCH 1/1] MdeModulePkg/Sd: append CMD12 for multiple blocks
Date: Thu, 3 May 2018 02:45:06 +0000	[thread overview]
Message-ID: <B80AF82E9BFB8E4FBD8C89DA810C6A0931D98E2A@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <1524893045-2958-1-git-send-email-haojian.zhuang@linaro.org>

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


  reply	other threads:[~2018-05-03  2:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2018-05-09  9:56   ` Haojian Zhuang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B80AF82E9BFB8E4FBD8C89DA810C6A0931D98E2A@SHSMSX104.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox