public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Wu, Hao A" <hao.a.wu@intel.com>
To: Jeff Brasen <jbrasen@nvidia.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: Edgar Handal <ehandal@nvidia.com>
Subject: Re: [PATCH v2] MdeModulePkg/SdMmcPciHcDxe: Use 16/32-bit IO widths
Date: Wed, 20 Feb 2019 01:12:09 +0000	[thread overview]
Message-ID: <B80AF82E9BFB8E4FBD8C89DA810C6A093C898319@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <f57b59aeda59140a7021d9ed37879eeb59f34a96.1550595728.git.jbrasen@nvidia.com>

Thanks Jeff.

Reviewed-by: Hao Wu <hao.a.wu@intel.com>
And pushed via commit f168816c49e388dcd097dd62d766d63f73aaabb3.

Best Regards,
Hao Wu


> -----Original Message-----
> From: Jeff Brasen [mailto:jbrasen@nvidia.com]
> Sent: Wednesday, February 20, 2019 1:07 AM
> To: edk2-devel@lists.01.org
> Cc: Edgar Handal; Jeff Brasen; Wu, Hao A
> Subject: [PATCH v2] MdeModulePkg/SdMmcPciHcDxe: Use 16/32-bit IO
> widths
> 
> From: Edgar Handal <ehandal@nvidia.com>
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1537
> 
> Use 16-bit and 32-bit IO widths for SDMMC MMIO to prevent all register
> accesses from being split up into 8-bit accesses.
> 
> The SDHCI specification states that the registers shall be accessible in
> byte, word, and double word accesses. (SD Host Controller Simplified
> Specification 4.20 Section 1.2)
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> ---
>  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c | 25
> ++++++++++++++++++++----
>  1 file changed, 21 insertions(+), 4 deletions(-)
> 
> diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
> b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
> index 4c64da3..d73fa10 100644
> --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
> +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
> @@ -154,19 +154,36 @@ SdMmcHcRwMmio (
>    )
>  {
>    EFI_STATUS                   Status;
> +  EFI_PCI_IO_PROTOCOL_WIDTH    Width;
> 
>    if ((PciIo == NULL) || (Data == NULL))  {
>      return EFI_INVALID_PARAMETER;
>    }
> 
> -  if ((Count != 1) && (Count != 2) && (Count != 4) && (Count != 8)) {
> -    return EFI_INVALID_PARAMETER;
> +  switch (Count) {
> +    case 1:
> +      Width = EfiPciIoWidthUint8;
> +      break;
> +    case 2:
> +      Width = EfiPciIoWidthUint16;
> +      Count = 1;
> +      break;
> +    case 4:
> +      Width = EfiPciIoWidthUint32;
> +      Count = 1;
> +      break;
> +    case 8:
> +      Width = EfiPciIoWidthUint32;
> +      Count = 2;
> +      break;
> +    default:
> +      return EFI_INVALID_PARAMETER;
>    }
> 
>    if (Read) {
>      Status = PciIo->Mem.Read (
>                            PciIo,
> -                          EfiPciIoWidthUint8,
> +                          Width,
>                            BarIndex,
>                            (UINT64) Offset,
>                            Count,
> @@ -175,7 +192,7 @@ SdMmcHcRwMmio (
>    } else {
>      Status = PciIo->Mem.Write (
>                            PciIo,
> -                          EfiPciIoWidthUint8,
> +                          Width,
>                            BarIndex,
>                            (UINT64) Offset,
>                            Count,
> --
> 2.7.4



      reply	other threads:[~2019-02-20  1:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-19 17:06 [PATCH v2] MdeModulePkg/SdMmcPciHcDxe: Use 16/32-bit IO widths Jeff Brasen
2019-02-20  1:12 ` Wu, Hao A [this message]

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=B80AF82E9BFB8E4FBD8C89DA810C6A093C898319@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