aboutsummaryrefslogtreecommitdiff
path: root/drivers/pci/pci-uclass.c
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2021-09-07 18:07:08 +0200
committerSimon Glass <sjg@chromium.org>2021-09-25 09:46:15 -0600
commit2348e72d6d56129cf84c5c98cf9d5631efb098e9 (patch)
tree7018d691acd767ce4bfcda07420a3bc3ce947d8e /drivers/pci/pci-uclass.c
parent8ae8da10b339349586daad0ceb5c0cb655b5ef6d (diff)
downloadu-boot-2348e72d6d56129cf84c5c98cf9d5631efb098e9.zip
u-boot-2348e72d6d56129cf84c5c98cf9d5631efb098e9.tar.gz
u-boot-2348e72d6d56129cf84c5c98cf9d5631efb098e9.tar.bz2
dm: pci: Fix handling of errors when scanning device
Some PCIe controller's read_config() method support indicating error directly via return value, but some cannot distinguish all-ones (or all-zeros) read response from an error. The current code in pci_bind_bus_devices() interprets all-ones / all-zeros in PCI_VENDOR_ID register as "nothing connected", and continues the cycle, but an error returned via return value breaks the cycle. This is wrong for the PCIe controllers which return this error via return value. Handle all errors when reading PCI_VENDOR_ID the same way. This fixes enumeration of PCI devices for example when there is a PCI bridge connected behind another PCI bridge and not all ports are connected to a device, and the controller (for example Aardvark) translates the UR error (Unsupported Request) as -EOPNOTSUPP. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'drivers/pci/pci-uclass.c')
-rw-r--r--drivers/pci/pci-uclass.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index ce2eb5d..4d0e938 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -856,10 +856,7 @@ int pci_bind_bus_devices(struct udevice *bus)
/* Check only the first access, we don't expect problems */
ret = pci_bus_read_config(bus, bdf, PCI_VENDOR_ID, &vendor,
PCI_SIZE_16);
- if (ret)
- goto error;
-
- if (vendor == 0xffff || vendor == 0x0000)
+ if (ret || vendor == 0xffff || vendor == 0x0000)
continue;
pci_bus_read_config(bus, bdf, PCI_HEADER_TYPE,
@@ -940,10 +937,6 @@ int pci_bind_bus_devices(struct udevice *bus)
}
return 0;
-error:
- printf("Cannot read bus configuration: %d\n", ret);
-
- return ret;
}
static void decode_regions(struct pci_controller *hose, ofnode parent_node,