Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/pci/pci_host_generic.c
Show First 20 Lines • Show All 360 Lines • ▼ Show 20 Lines | generic_pcie_activate_resource(device_t dev, device_t child, int type, | ||||
case SYS_RES_IOPORT: | case SYS_RES_IOPORT: | ||||
case SYS_RES_MEMORY: | case SYS_RES_MEMORY: | ||||
found = 0; | found = 0; | ||||
for (i = 0; i < MAX_RANGES_TUPLES; i++) { | for (i = 0; i < MAX_RANGES_TUPLES; i++) { | ||||
pci_base = sc->ranges[i].pci_base; | pci_base = sc->ranges[i].pci_base; | ||||
phys_base = sc->ranges[i].phys_base; | phys_base = sc->ranges[i].phys_base; | ||||
size = sc->ranges[i].size; | size = sc->ranges[i].size; | ||||
if ((rman_get_start(r) >= pci_base) && (rman_get_start(r) < (pci_base + size))) { | if ((rman_get_start(r) >= pci_base) && (rman_get_start(r) < (pci_base + size))) { | ||||
markj: Shouldn't it be using rman_get_end() in the second part of this condition? | |||||
found = 1; | found = 1; | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
if (found) { | if (found) { | ||||
rman_set_start(r, rman_get_start(r) - pci_base + phys_base); | rman_set_start(r, rman_get_start(r) - pci_base + phys_base); | ||||
rman_set_end(r, rman_get_end(r) - pci_base + phys_base); | rman_set_end(r, rman_get_end(r) - pci_base + phys_base); | ||||
res = BUS_ACTIVATE_RESOURCE(device_get_parent(dev), | res = BUS_ACTIVATE_RESOURCE(device_get_parent(dev), | ||||
child, type, rid, r); | child, type, rid, r); | ||||
} else { | } else { | ||||
device_printf(dev, | device_printf(dev, | ||||
"Failed to activate %s resource\n", | "Failed to activate %s resource\n", | ||||
type == SYS_RES_IOPORT ? "IOPORT" : "MEMORY"); | type == SYS_RES_IOPORT ? "IOPORT" : "MEMORY"); | ||||
res = 0; | res = ENXIO; | ||||
} | } | ||||
break; | break; | ||||
case SYS_RES_IRQ: | case SYS_RES_IRQ: | ||||
res = BUS_ACTIVATE_RESOURCE(device_get_parent(dev), child, | res = BUS_ACTIVATE_RESOURCE(device_get_parent(dev), child, | ||||
type, rid, r); | type, rid, r); | ||||
break; | break; | ||||
default: | default: | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 81 Lines • Show Last 20 Lines |
Shouldn't it be using rman_get_end() in the second part of this condition?