[U-Boot] [RFC PATCH 10/29] drivers: pci-uclass: Add support for Alternate-RoutingID capability

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


On Tue, 29 Oct 2019 at 14:08, Suneel Garapati <suneelglinux at gmail.com> wrote:
>
> From: Suneel Garapati <sgarapati at marvell.com>
>
> If ARI capability is found on device, use it to update next function
> number in bus scan and also helps to skip unnecessary bdf scans.
>
> Signed-off-by: Suneel Garapati <sgarapati at marvell.com>
> ---
>  drivers/pci/pci-uclass.c | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg at chromium.org>

>
> diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
> index f9823231b1..b02588b552 100644
> --- a/drivers/pci/pci-uclass.c
> +++ b/drivers/pci/pci-uclass.c
> @@ -773,7 +773,7 @@ int pci_bind_bus_devices(struct udevice *bus)
>         ulong header_type;
>         pci_dev_t bdf, end;
>         bool found_multi;
> -       int ret;
> +       int ret, ari_off;
>
>         found_multi = false;
>         end = PCI_BDF(bus->seq, PCI_MAX_PCI_DEVICES - 1,
> @@ -846,6 +846,22 @@ int pci_bind_bus_devices(struct udevice *bus)
>                 pplat->vendor = vendor;
>                 pplat->device = device;
>                 pplat->class = class;
> +
> +               ari_off = dm_pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ARI);
> +               if (ari_off) {
> +                       u16 ari_cap;
> +
> +                       /* Read Next Function number in ARI Cap Register */
> +                       dm_pci_read_config16(dev, ari_off + 4, &ari_cap);
> +                       /* Update next scan on this function number,

/*
 * Update ...

(please fix globally)

Also again I think this needs to be behind a Kconfig.

> +                        * subtract 1 in BDF to satisfy loop increment.
> +                        */
> +                       if (ari_cap & 0xff00) {
> +                               bdf = PCI_BDF(PCI_BUS(bdf), PCI_DEV(ari_cap),
> +                                             PCI_FUNC(ari_cap));
> +                               bdf = bdf - 0x100;
> +                       }
> +               }
>         }
>
>         return 0;
> --
> 2.23.0
>

Regards,
Simon


More information about the U-Boot mailing list