From: Michael Walle Date: Sun, 1 Dec 2019 16:45:18 +0000 (+0100) Subject: drivers: pci: ignore disabled devices X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=a6cd597a78dd9b7fcaba6fe4891f29e86646541b;p=u-boot.git drivers: pci: ignore disabled devices PCI devices may be disabled in the device tree. Devices which are probed by the device tree handle the "status" property and are skipped if disabled. Devices which are probed by the PCI enumeration don't check that property. Fix it. Signed-off-by: Michael Walle Reviewed-by: Alex Marginean Tested-by: Alex Marginean Reviewed-by: Bin Meng --- diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c index 896cb6b23a..fab20fc60e 100644 --- a/drivers/pci/pci-uclass.c +++ b/drivers/pci/pci-uclass.c @@ -677,6 +677,11 @@ static int pci_find_and_bind_driver(struct udevice *parent, /* Determine optional OF node */ pci_dev_find_ofnode(parent, bdf, &node); + if (ofnode_valid(node) && !ofnode_is_available(node)) { + debug("%s: Ignoring disabled device\n", __func__); + return -EPERM; + } + start = ll_entry_start(struct pci_driver_entry, pci_driver_entry); n_ents = ll_entry_count(struct pci_driver_entry, pci_driver_entry); for (entry = start; entry != start + n_ents; entry++) {