Changeset View
Changeset View
Standalone View
Standalone View
sys/arm/xscale/ixp425/ixp425.c
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
if (hw == NULL) | if (hw == NULL) | ||||
return (ENOENT); | return (ENOENT); | ||||
*vbase = hwbase - hw->hwbase + hw->vbase; | *vbase = hwbase - hw->hwbase + hw->vbase; | ||||
return (0); | return (0); | ||||
} | } | ||||
static struct resource * | static struct resource * | ||||
ixp425_alloc_resource(device_t dev, device_t child, int type, int *rid, | ixp425_alloc_resource(device_t dev, device_t child, int type, int *rid, | ||||
u_long start, u_long end, u_long count, u_int flags) | rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) | ||||
{ | { | ||||
struct ixp425_softc *sc = device_get_softc(dev); | struct ixp425_softc *sc = device_get_softc(dev); | ||||
const struct hwvtrans *vtrans; | const struct hwvtrans *vtrans; | ||||
struct resource *rv; | struct resource *rv; | ||||
uint32_t addr; | uint32_t addr; | ||||
int needactivate = flags & RF_ACTIVE; | int needactivate = flags & RF_ACTIVE; | ||||
int irq; | int irq; | ||||
Show All 20 Lines | |||||
* Assign the entire mapped region; this may | * Assign the entire mapped region; this may | ||||
* not be correct but without more info from | * not be correct but without more info from | ||||
* the caller we cannot tell. | * the caller we cannot tell. | ||||
*/ | */ | ||||
end = start + vtrans->size - | end = start + vtrans->size - | ||||
(start - vtrans->hwbase); | (start - vtrans->hwbase); | ||||
if (bootverbose) | if (bootverbose) | ||||
device_printf(child, | device_printf(child, | ||||
"%s: assign 0x%lx:0x%lx%s\n", | "%s: assign 0x%jx:0x%jx%s\n", | ||||
__func__, start, end - start, | __func__, start, end - start, | ||||
vtrans->isa4x ? " A4X" : | vtrans->isa4x ? " A4X" : | ||||
vtrans->isslow ? " SLOW" : ""); | vtrans->isslow ? " SLOW" : ""); | ||||
} | } | ||||
} else | } else | ||||
vtrans = gethwvtrans(start, end - start); | vtrans = gethwvtrans(start, end - start); | ||||
if (vtrans == NULL) { | if (vtrans == NULL) { | ||||
/* likely means above table needs to be updated */ | /* likely means above table needs to be updated */ | ||||
device_printf(child, "%s: no mapping for 0x%lx:0x%lx\n", | device_printf(child, "%s: no mapping for 0x%jx:0x%jx\n", | ||||
__func__, start, end - start); | __func__, start, end - start); | ||||
return NULL; | return NULL; | ||||
} | } | ||||
rv = rman_reserve_resource(&sc->sc_mem_rman, start, end, | rv = rman_reserve_resource(&sc->sc_mem_rman, start, end, | ||||
end - start, flags, child); | end - start, flags, child); | ||||
if (rv == NULL) { | if (rv == NULL) { | ||||
device_printf(child, "%s: cannot reserve 0x%lx:0x%lx\n", | device_printf(child, "%s: cannot reserve 0x%jx:0x%jx\n", | ||||
__func__, start, end - start); | __func__, start, end - start); | ||||
return NULL; | return NULL; | ||||
} | } | ||||
rman_set_rid(rv, *rid); | rman_set_rid(rv, *rid); | ||||
break; | break; | ||||
default: | default: | ||||
rv = NULL; | rv = NULL; | ||||
break; | break; | ||||
Show All 20 Lines | |||||
struct resource *r) | struct resource *r) | ||||
{ | { | ||||
struct ixp425_softc *sc = device_get_softc(dev); | struct ixp425_softc *sc = device_get_softc(dev); | ||||
const struct hwvtrans *vtrans; | const struct hwvtrans *vtrans; | ||||
if (type == SYS_RES_MEMORY) { | if (type == SYS_RES_MEMORY) { | ||||
vtrans = gethwvtrans(rman_get_start(r), rman_get_size(r)); | vtrans = gethwvtrans(rman_get_start(r), rman_get_size(r)); | ||||
if (vtrans == NULL) { /* NB: should not happen */ | if (vtrans == NULL) { /* NB: should not happen */ | ||||
device_printf(child, "%s: no mapping for 0x%lx:0x%lx\n", | device_printf(child, "%s: no mapping for 0x%jx:0x%jx\n", | ||||
__func__, rman_get_start(r), rman_get_size(r)); | __func__, rman_get_start(r), rman_get_size(r)); | ||||
return (ENOENT); | return (ENOENT); | ||||
} | } | ||||
if (vtrans->isa4x) | if (vtrans->isa4x) | ||||
rman_set_bustag(r, &ixp425_a4x_bs_tag); | rman_set_bustag(r, &ixp425_a4x_bs_tag); | ||||
else if (vtrans->isslow) | else if (vtrans->isslow) | ||||
rman_set_bustag(r, &cambria_exp_bs_tag); | rman_set_bustag(r, &cambria_exp_bs_tag); | ||||
else | else | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |