]> git.baikalelectronics.ru Git - uboot.git/commit
dm: pci: Fix handling of errors when scanning device
authorPali Rohár <pali@kernel.org>
Tue, 7 Sep 2021 16:07:08 +0000 (18:07 +0200)
committerSimon Glass <sjg@chromium.org>
Sat, 25 Sep 2021 15:46:15 +0000 (09:46 -0600)
commita5603d9fa83ea67ea4bd3c02b1a8e5620ec2da1b
tree7018d691acd767ce4bfcda07420a3bc3ce947d8e
parent0333396aebddd9af5524a9a2797c5ab34a33eb27
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>
drivers/pci/pci-uclass.c