From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gong Qianyu Date: Thu, 28 Jan 2016 15:15:00 +0800 Subject: [U-Boot] [PATCH] pci: gate print info of reading vender id with CONFIG_DM_PCI Message-ID: <1453965300-24844-1-git-send-email-Qianyu.Gong@nxp.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de From: Mingkai Hu 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 Signed-off-by: Gong Qianyu --- 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