[U-Boot] [PATCH 2/2] pci: Change the first CFG read to Vendor ID in enumeration

Zhiqiang Hou Zhiqiang.Hou at nxp.com
Mon Oct 8 08:35:48 UTC 2018


From: Hou Zhiqiang <Zhiqiang.Hou at nxp.com>

As the PCIe specification recommend reading the Vendor ID register
to determine if a Function is present, read the Vendor ID of a
non-existent Function must not result in system error, so we'd better
make the first CFG read to Vendor ID instead of Header Type register
in the PCIe enumeration.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou at nxp.com>
---
 drivers/pci/pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 221054593e..590f7b123a 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -361,13 +361,13 @@ int pci_hose_scan_bus(struct pci_controller *hose, int bus)
 		if (PCI_FUNC(dev) && !found_multi)
 			continue;
 
-		pci_hose_read_config_byte(hose, dev, PCI_HEADER_TYPE, &header_type);
-
 		pci_hose_read_config_word(hose, dev, PCI_VENDOR_ID, &vendor);
 
 		if (vendor == 0xffff || vendor == 0x0000)
 			continue;
 
+		pci_hose_read_config_byte(hose, dev, PCI_HEADER_TYPE, &header_type);
+
 		if (!PCI_FUNC(dev))
 			found_multi = header_type & 0x80;
 
-- 
2.17.1



More information about the U-Boot mailing list