diff options
author | Michal Meloun <mmel@FreeBSD.org> | 2020-10-31 16:18:55 +0000 |
---|---|---|
committer | Michal Meloun <mmel@FreeBSD.org> | 2020-10-31 16:18:55 +0000 |
commit | 0567959f00ed5ba0198cad6f127ab2aaa794208c (patch) | |
tree | 4ce41c78cfedf9230211f55e56cc757290f4fce8 /sys/dev/pci | |
parent | ca08e3312173ed08ccd49e581ca4526f68777013 (diff) | |
download | src-0567959f00ed5ba0198cad6f127ab2aaa794208c.tar.gz src-0567959f00ed5ba0198cad6f127ab2aaa794208c.zip |
MFC r362387:
Improve DesignWare PCIe driver: - only normal memory window is mandatory,
prefetchable memory and
I/O windows should be optional
- full PCIe configuration space is supported - remove duplicated check from
function for accessing configuration space.
It is already contained in pci_dw_check_dev()
Notes
Notes:
svn path=/stable/12/; revision=367219
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/pci_dw.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/sys/dev/pci/pci_dw.c b/sys/dev/pci/pci_dw.c index de9bc354d283..aa3e5d6d6d33 100644 --- a/sys/dev/pci/pci_dw.c +++ b/sys/dev/pci/pci_dw.c @@ -156,7 +156,7 @@ pci_dw_check_dev(struct pci_dw_softc *sc, u_int bus, u_int slot, u_int func, int rv; if (bus < sc->bus_start || bus > sc->bus_end || slot > PCI_SLOTMAX || - func > PCI_FUNCMAX || reg > PCI_REGMAX) + func > PCI_FUNCMAX || reg > PCIE_REGMAX) return (false); /* link is needed for access to all non-root busses */ @@ -234,7 +234,7 @@ pci_dw_setup_hw(struct pci_dw_softc *sc) return (rv); /* If we have enouht viewports ..*/ - if (sc->num_viewport >= 3) { + if (sc->num_viewport >= 3 && sc->io_range.size != 0) { /* Setup outbound I/O window */ rv = pci_dw_map_out_atu(sc, 0, IATU_CTRL1_TYPE_MEM, sc->io_range.host, sc->io_range.pci, sc->io_range.size); @@ -345,7 +345,7 @@ pci_dw_decode_ranges(struct pci_dw_softc *sc, struct ofw_pci_range *ranges, } } } - if ((sc->io_range.size == 0) || (sc->mem_range.size == 0)) { + if (sc->mem_range.size == 0) { device_printf(sc->dev, " Not all required ranges are found in DT\n"); return (ENXIO); @@ -375,10 +375,6 @@ pci_dw_read_config(device_t dev, u_int bus, u_int slot, if (!pci_dw_check_dev(sc, bus, slot, func, reg)) return (0xFFFFFFFFU); - if ((slot > PCI_SLOTMAX) || (func > PCI_FUNCMAX) || - (reg > PCI_REGMAX)) - return (0xFFFFFFFFU); - if (bus == sc->root_bus) { res = (sc->dbi_res); } else { @@ -426,10 +422,6 @@ pci_dw_write_config(device_t dev, u_int bus, u_int slot, if (!pci_dw_check_dev(sc, bus, slot, func, reg)) return; - if ((slot > PCI_SLOTMAX) || (func > PCI_FUNCMAX) || - (reg > PCI_REGMAX)) - return; - if (bus == sc->root_bus) { res = (sc->dbi_res); } else { |