On Tue, 29 Oct 2019 at 14:08, Suneel Garapati <suneelgli...@gmail.com> wrote:
>
> From: Suneel Garapati <sgarap...@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 <sgarap...@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
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to