[U-Boot] [PATCH] pci: gate print info of reading vender id with CONFIG_DM_PCI
Gong Qianyu
Qianyu.Gong at nxp.com
Thu Jan 28 08:15:00 CET 2016
From: Mingkai Hu <Mingkai.Hu at freescale.com>
Referring to 'commit ff3e077bd23c ("dm: pci: Add a uclass for PCI")'.
For legacy PCIe driver, it needs loop to read the vender_id from
devie 0 to devie 255 to check if there is device available.
Reading non-existen device will trigger the "Cannot read bus
configuration: -1" information.
Signed-off-by: Mingkai Hu <Mingkai.Hu at freescale.com>
Signed-off-by: Gong Qianyu <Qianyu.Gong at nxp.com>
---
common/cmd_pci.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/common/cmd_pci.c b/common/cmd_pci.c
index 4e0951f..d94f90d 100644
--- a/common/cmd_pci.c
+++ b/common/cmd_pci.c
@@ -324,7 +324,9 @@ void pciinfo(int bus_num, int short_pci_listing)
unsigned char header_type;
unsigned short vendor_id;
pci_dev_t dev;
+#ifdef CONFIG_DM_PCI
int ret;
+#endif
if (!hose)
return;
@@ -348,10 +350,14 @@ void pciinfo(int bus_num, int short_pci_listing)
if (pci_skip_dev(hose, dev))
continue;
+#ifdef CONFIG_DM_PCI
ret = pci_read_config_word(dev, PCI_VENDOR_ID,
&vendor_id);
if (ret)
goto error;
+#else
+ pci_read_config_word(dev, PCI_VENDOR_ID, &vendor_id);
+#endif
if ((vendor_id == 0xFFFF) || (vendor_id == 0x0000))
continue;
@@ -373,8 +379,10 @@ void pciinfo(int bus_num, int short_pci_listing)
}
return;
+#ifdef CONFIG_DM_PCI
error:
printf("Cannot read bus configuration: %d\n", ret);
+#endif
}
#endif
--
2.1.0.27.g96db324
More information about the U-Boot
mailing list