[U-Boot] [RFC PATCH 16/29] drivers: ata: ahci: fill upper 32bit buffer address in sg descriptor

Simon Glass sjg at chromium.org
Wed Nov 20 03:00:28 UTC 2019


On Tue, 29 Oct 2019 at 14:08, Suneel Garapati <suneelglinux at gmail.com> wrote:
>
> From: Suneel Garapati <sgarapati at marvell.com>
>
> For platforms that support 64bit physical address, fill upper 32bit
> of buffer address in scatter-gather descriptor. This is needed for
> platforms with more than 4GB DRAM.
>
> Signed-off-by: Suneel Garapati <sgarapati at marvell.com>
> ---
>  drivers/ata/ahci.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
> index ca075b58bc..5f929700c0 100644
> --- a/drivers/ata/ahci.c
> +++ b/drivers/ata/ahci.c
> @@ -506,6 +506,11 @@ static int ahci_fill_sg(struct ahci_uc_priv *uc_priv, u8 port,
>                 ahci_sg->addr =
>                     cpu_to_le32((unsigned long) buf + i * MAX_DATA_BYTE_COUNT);
>                 ahci_sg->addr_hi = 0;
> +#ifdef CONFIG_PHYS_64BIT
> +               ahci_sg->addr_hi =
> +                   cpu_to_le32((u32)(((u64)(buf + i * MAX_DATA_BYTE_COUNT)
> +                                     >> 16) >> 16));

How about something like:

ulong addr = (ulong)buf + i * MAX_DATA_BYTE_COUNT;

  ahci_sg->addr = cpu_to_le32(addr);
  ahci_sg->addr_hi = 0;
#ifdef CONFIG_PHYS_64BIT
  ahci_sg->addr_hi = addr >> 32ULL;
#endif

Regards,
Simon


More information about the U-Boot mailing list