aboutsummaryrefslogtreecommitdiff
path: root/drivers/pci
diff options
context:
space:
mode:
authorMichael Walle2019-12-01 17:45:18 +0100
committerTom Rini2019-12-05 10:28:38 -0500
commita6cd597a78dd9b7fcaba6fe4891f29e86646541b (patch)
tree8564bfe6a5a0898a019d29043af1c1687fc89534 /drivers/pci
parent7e5ee346fc4c26c5f96ae13d599cf31d05fa6772 (diff)
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 <michael@walle.cc> Reviewed-by: Alex Marginean <alexandru.marginean@nxp.com> Tested-by: Alex Marginean <alexandru.marginean@nxp.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pci-uclass.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index 896cb6b23a1..fab20fc60e5 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++) {