aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/pci_dw.c14
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 {