|
@@ -433,6 +433,15 @@ static int advk_pcie_wait_pio(struct advk_pcie *pcie)
|
|
return -ETIMEDOUT;
|
|
return -ETIMEDOUT;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static bool advk_pcie_valid_device(struct advk_pcie *pcie, struct pci_bus *bus,
|
|
|
|
+ int devfn)
|
|
|
|
+{
|
|
|
|
+ if ((bus->number == pcie->root_bus_nr) && PCI_SLOT(devfn) != 0)
|
|
|
|
+ return false;
|
|
|
|
+
|
|
|
|
+ return true;
|
|
|
|
+}
|
|
|
|
+
|
|
static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn,
|
|
static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn,
|
|
int where, int size, u32 *val)
|
|
int where, int size, u32 *val)
|
|
{
|
|
{
|
|
@@ -440,7 +449,7 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn,
|
|
u32 reg;
|
|
u32 reg;
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
- if ((bus->number == pcie->root_bus_nr) && PCI_SLOT(devfn) != 0) {
|
|
|
|
|
|
+ if (!advk_pcie_valid_device(pcie, bus, devfn)) {
|
|
*val = 0xffffffff;
|
|
*val = 0xffffffff;
|
|
return PCIBIOS_DEVICE_NOT_FOUND;
|
|
return PCIBIOS_DEVICE_NOT_FOUND;
|
|
}
|
|
}
|
|
@@ -494,7 +503,7 @@ static int advk_pcie_wr_conf(struct pci_bus *bus, u32 devfn,
|
|
int offset;
|
|
int offset;
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
- if ((bus->number == pcie->root_bus_nr) && PCI_SLOT(devfn) != 0)
|
|
|
|
|
|
+ if (!advk_pcie_valid_device(pcie, bus, devfn))
|
|
return PCIBIOS_DEVICE_NOT_FOUND;
|
|
return PCIBIOS_DEVICE_NOT_FOUND;
|
|
|
|
|
|
if (where % size)
|
|
if (where % size)
|