aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/controller/pci-aardvark.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/controller/pci-aardvark.c')
-rw-r--r--drivers/pci/controller/pci-aardvark.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
index d3172d5d3d35..7b363437d851 100644
--- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c
@@ -433,6 +433,15 @@ static int advk_pcie_wait_pio(struct advk_pcie *pcie)
433 return -ETIMEDOUT; 433 return -ETIMEDOUT;
434} 434}
435 435
436static bool advk_pcie_valid_device(struct advk_pcie *pcie, struct pci_bus *bus,
437 int devfn)
438{
439 if ((bus->number == pcie->root_bus_nr) && PCI_SLOT(devfn) != 0)
440 return false;
441
442 return true;
443}
444
436static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn, 445static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn,
437 int where, int size, u32 *val) 446 int where, int size, u32 *val)
438{ 447{
@@ -440,7 +449,7 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn,
440 u32 reg; 449 u32 reg;
441 int ret; 450 int ret;
442 451
443 if ((bus->number == pcie->root_bus_nr) && PCI_SLOT(devfn) != 0) { 452 if (!advk_pcie_valid_device(pcie, bus, devfn)) {
444 *val = 0xffffffff; 453 *val = 0xffffffff;
445 return PCIBIOS_DEVICE_NOT_FOUND; 454 return PCIBIOS_DEVICE_NOT_FOUND;
446 } 455 }
@@ -494,7 +503,7 @@ static int advk_pcie_wr_conf(struct pci_bus *bus, u32 devfn,
494 int offset; 503 int offset;
495 int ret; 504 int ret;
496 505
497 if ((bus->number == pcie->root_bus_nr) && PCI_SLOT(devfn) != 0) 506 if (!advk_pcie_valid_device(pcie, bus, devfn))
498 return PCIBIOS_DEVICE_NOT_FOUND; 507 return PCIBIOS_DEVICE_NOT_FOUND;
499 508
500 if (where % size) 509 if (where % size)