public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	edk2-devel@ml01.01.org, feng.tian@intel.com, star.zeng@intel.com,
	liming.gao@intel.com
Cc: leif.lindholm@linaro.org
Subject: Re: [PATCH 5/7] MdeModulePkg/XhciDxe: enable 64-bit PCI DMA
Date: Mon, 5 Sep 2016 14:14:10 +0200	[thread overview]
Message-ID: <13a48ed9-27c3-d7a7-48d2-4443d19008c5@redhat.com> (raw)
In-Reply-To: <1473067049-16252-6-git-send-email-ard.biesheuvel@linaro.org>

On 09/05/16 11:17, Ard Biesheuvel wrote:
> PCI controller drivers must set the EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE
> attribute if the controller supports 64-bit DMA addressing.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 22 +++++++++++++++++++-
>  MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h |  2 ++
>  2 files changed, 23 insertions(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> index 4798bea86061..cdff1c3b8849 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> @@ -125,7 +125,7 @@ XhcGetCapability (
>    Xhc             = XHC_FROM_THIS (This);
>    *MaxSpeed       = EFI_USB_SPEED_SUPER;
>    *PortNumber     = (UINT8) (Xhc->HcSParams1.Data.MaxPorts);
> -  *Is64BitCapable = (UINT8) (Xhc->HcCParams.Data.Ac64);
> +  *Is64BitCapable = (UINT8) Xhc->Support64BitDma;
>    DEBUG ((EFI_D_INFO, "XhcGetCapability: %d ports, 64 bit %d\n", *PortNumber, *Is64BitCapable));
>  
>    gBS->RestoreTPL (OldTpl);
> @@ -2020,6 +2020,26 @@ XhcDriverBindingStart (
>      return EFI_OUT_OF_RESOURCES;
>    }
>  
> +  //
> +  // Enable 64-bit DMA support in the PCI layer if this controller
> +  // supports it.
> +  //
> +  if ((Xhc->HcCParams.Data.Ac64) != 0) {

I think the inner parens are superfluous.

> +    Status = PciIo->Attributes (
> +                      PciIo,
> +                      EfiPciIoAttributeOperationEnable,
> +                      EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE,
> +                      NULL
> +                      );
> +    if (!EFI_ERROR (Status)) {
> +      Xhc->Support64BitDma = TRUE;
> +    } else {
> +      DEBUG ((EFI_D_WARN,
> +        "XhcDriverBindingStart: failed to enable 64-bit DMA on 64-bit capable controller @ %p (%r)\n",

I prefer to use "%a" with __FUNCTION__, rather than open-coding the
containing function's name; for brevity and for robustness against code
movement.

I'll leave it to you if you want to change these things.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>

Thanks
Laszlo

> +        Controller, Status));
> +    }
> +  }
> +
>    XhcSetBiosOwnership (Xhc);
>  
>    XhcResetHC (Xhc, XHC_RESET_TIMEOUT);
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
> index 7999151b3fde..0f53bb0eff7c 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
> @@ -256,6 +256,8 @@ struct _USB_XHCI_INSTANCE {
>    // The array supports up to 255 devices, entry 0 is reserved and should not be used.
>    //
>    USB_DEV_CONTEXT           UsbDevContext[256];
> +
> +  BOOLEAN                   Support64BitDma; // Whether 64 bit DMA may be used with this device
>  };
>  
>  
> 



  reply	other threads:[~2016-09-05 12:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-05  9:17 [PATCH 0/7] MdeModulePkg ArmVirtPkg: fixes for 64-bit PCI DMA Ard Biesheuvel
2016-09-05  9:17 ` [PATCH 1/7] MdeModulePkg/AtaAtapiPassThru: enable " Ard Biesheuvel
2016-09-05  9:17 ` [PATCH 2/7] MdeModulePkg/EhciDxe: " Ard Biesheuvel
2016-09-05 12:19   ` Laszlo Ersek
2016-09-05 12:44     ` Ard Biesheuvel
2016-09-05 13:06       ` Laszlo Ersek
2016-09-05  9:17 ` [PATCH 3/7] MdeModulePkg/NvmExpressDxe: " Ard Biesheuvel
2016-09-05  9:17 ` [PATCH 4/7] MdeModulePkg/SdMmcPciHcDxe: " Ard Biesheuvel
2016-09-05  9:17 ` [PATCH 5/7] MdeModulePkg/XhciDxe: " Ard Biesheuvel
2016-09-05 12:14   ` Laszlo Ersek [this message]
2016-09-05  9:17 ` [PATCH 6/7] MdeModulePkg/PciHostBridgeDxe: restrict 64-bit DMA to devices that support it Ard Biesheuvel
2016-09-05 12:04   ` Laszlo Ersek
2016-09-05  9:17 ` [PATCH 7/7] ArmVirtPkg/FdtPciHostBridgeLib: enable 64-bit PCI DMA Ard Biesheuvel
2016-09-05 12:04   ` Laszlo Ersek
2016-09-06  7:48 ` [PATCH 0/7] MdeModulePkg ArmVirtPkg: fixes for " Ard Biesheuvel
2016-09-06  8:04   ` Zeng, Star
2016-09-06  8:54   ` Ni, Ruiyu
2016-09-06 10:36     ` Ard Biesheuvel
2016-09-06 12:41       ` Tian, Feng
2016-09-06 14:48         ` Ard Biesheuvel

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=13a48ed9-27c3-d7a7-48d2-4443d19008c5@redhat.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