[U-Boot] [PATCH 04/25] dm: pci: scsi: Use driver-model PCI API

Bin Meng bmeng.cn at gmail.com
Wed Nov 18 05:26:59 CET 2015


Hi Simon,

On Tue, Nov 17, 2015 at 11:53 AM, Simon Glass <sjg at chromium.org> wrote:
> Adjust the SCSI command to use driver model for its PCI interface.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
>  common/cmd_scsi.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
> index 31c4319..855016d 100644
> --- a/common/cmd_scsi.c
> +++ b/common/cmd_scsi.c
> @@ -184,7 +184,7 @@ int scsi_get_disk_count(void)
>  #if defined(CONFIG_PCI) && !defined(CONFIG_SCSI_AHCI_PLAT)
>  void scsi_init(void)
>  {
> -       int busdevfunc;
> +       int busdevfunc = -1;
>         int i;
>         /*
>          * Find a device from the list, this driver will support a single
> @@ -192,9 +192,21 @@ void scsi_init(void)
>          */
>         for (i = 0; i < ARRAY_SIZE(scsi_device_list); i++) {
>                 /* get PCI Device ID */
> +#ifdef CONFIG_DM_PCI
> +               struct udevice *dev;
> +               int ret;
> +
> +               ret = dm_pci_find_device(scsi_device_list[i].vendor,
> +                                        scsi_device_list[i].device, 0, &dev);
> +               if (!ret) {
> +                       busdevfunc = pci_get_bdf(dev);

To keep naming consistency, can we rename pci_get_bdf() to dm_pci_get_bdf()?

> +                       break;
> +               }
> +#else
>                 busdevfunc = pci_find_device(scsi_device_list[i].vendor,
>                                              scsi_device_list[i].device,
>                                              0);
> +#endif
>                 if (busdevfunc != -1)
>                         break;
>         }
> --

Regards,
Bin


More information about the U-Boot mailing list