Changeset View
Changeset View
Standalone View
Standalone View
head/sys/powerpc/ofw/ofw_pci.c
Show First 20 Lines • Show All 378 Lines • ▼ Show 20 Lines | ofw_pci_activate_resource(device_t bus, device_t child, int type, int rid, | ||||
sc = device_get_softc(bus); | sc = device_get_softc(bus); | ||||
if (type == SYS_RES_IRQ) { | if (type == SYS_RES_IRQ) { | ||||
return (bus_activate_resource(bus, type, rid, res)); | return (bus_activate_resource(bus, type, rid, res)); | ||||
} | } | ||||
if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) { | if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) { | ||||
struct ofw_pci_range *rp; | struct ofw_pci_range *rp; | ||||
vm_offset_t start; | vm_paddr_t start; | ||||
int space; | int space; | ||||
start = (vm_offset_t)rman_get_start(res); | start = (vm_paddr_t)rman_get_start(res); | ||||
/* | /* | ||||
* Map this through the ranges list | * Map this through the ranges list | ||||
*/ | */ | ||||
for (rp = sc->sc_range; rp < sc->sc_range + sc->sc_nrange && | for (rp = sc->sc_range; rp < sc->sc_range + sc->sc_nrange && | ||||
rp->pci_hi != 0; rp++) { | rp->pci_hi != 0; rp++) { | ||||
if (start < rp->pci || start >= rp->pci + rp->size) | if (start < rp->pci || start >= rp->pci + rp->size) | ||||
continue; | continue; | ||||
Show All 12 Lines | for (rp = sc->sc_range; rp < sc->sc_range + sc->sc_nrange && | ||||
if (type == space) { | if (type == space) { | ||||
start += (rp->host - rp->pci); | start += (rp->host - rp->pci); | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
if (bootverbose) | if (bootverbose) | ||||
printf("ofw_pci mapdev: start %zx, len %ld\n", start, | printf("ofw_pci mapdev: start %jx, len %jd\n", | ||||
rman_get_size(res)); | (rman_res_t)start, rman_get_size(res)); | ||||
p = pmap_mapdev(start, (vm_size_t)rman_get_size(res)); | p = pmap_mapdev(start, (vm_size_t)rman_get_size(res)); | ||||
if (p == NULL) | if (p == NULL) | ||||
return (ENOMEM); | return (ENOMEM); | ||||
rman_set_virtual(res, p); | rman_set_virtual(res, p); | ||||
rman_set_bustag(res, &bs_le_tag); | rman_set_bustag(res, &bs_le_tag); | ||||
rman_set_bushandle(res, (u_long)p); | rman_set_bushandle(res, (u_long)p); | ||||
▲ Show 20 Lines • Show All 130 Lines • Show Last 20 Lines |