Changeset View
Changeset View
Standalone View
Standalone View
sys/arm/cavium/cns11xx/econa.c
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
bus_generic_attach(dev); | bus_generic_attach(dev); | ||||
enable_interrupts(PSR_I | PSR_F); | enable_interrupts(PSR_I | PSR_F); | ||||
return (0); | return (0); | ||||
} | } | ||||
static struct resource * | static struct resource * | ||||
econa_alloc_resource(device_t dev, device_t child, int type, int *rid, | econa_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 econa_softc *sc = device_get_softc(dev); | struct econa_softc *sc = device_get_softc(dev); | ||||
struct resource_list_entry *rle; | struct resource_list_entry *rle; | ||||
struct econa_ivar *ivar = device_get_ivars(child); | struct econa_ivar *ivar = device_get_ivars(child); | ||||
struct resource_list *rl = &ivar->resources; | struct resource_list *rl = &ivar->resources; | ||||
if (device_get_parent(child) != dev) | if (device_get_parent(child) != dev) | ||||
return (BUS_ALLOC_RESOURCE(device_get_parent(dev), child, | return (BUS_ALLOC_RESOURCE(device_get_parent(dev), child, | ||||
type, rid, start, end, count, flags)); | type, rid, start, end, count, flags)); | ||||
rle = resource_list_find(rl, type, *rid); | rle = resource_list_find(rl, type, *rid); | ||||
if (rle == NULL) { | if (rle == NULL) { | ||||
return (NULL); | return (NULL); | ||||
} | } | ||||
if (rle->res) | if (rle->res) | ||||
panic("Resource rid %d type %d already in use", *rid, type); | panic("Resource rid %d type %d already in use", *rid, type); | ||||
if (start == 0UL && end == ~0UL) { | if (start == 0 && end == ~0) { | ||||
start = rle->start; | start = rle->start; | ||||
count = ulmax(count, rle->count); | count = ulmax(count, rle->count); | ||||
end = ulmax(rle->end, start + count - 1); | end = ulmax(rle->end, start + count - 1); | ||||
} | } | ||||
switch (type) | switch (type) | ||||
{ | { | ||||
case SYS_RES_IRQ: | case SYS_RES_IRQ: | ||||
rle->res = rman_reserve_resource(&sc->ec_irq_rman, | rle->res = rman_reserve_resource(&sc->ec_irq_rman, | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |