Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/dpaa/fman.c
| Show First 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | for (i = 0; i < sc->sc_base.nranges; i++) { | ||||
| } | } | ||||
| } | } | ||||
| return (EINVAL); | return (EINVAL); | ||||
| } | } | ||||
| return (bus_generic_activate_resource(bus, child, res)); | return (bus_generic_activate_resource(bus, child, res)); | ||||
| } | } | ||||
| int | int | ||||
| fman_release_resource(device_t bus, device_t child, int type, int rid, | fman_release_resource(device_t bus, device_t child, struct resource *res) | ||||
| struct resource *res) | |||||
| { | { | ||||
| struct resource_list *rl; | struct resource_list *rl; | ||||
| struct resource_list_entry *rle; | struct resource_list_entry *rle; | ||||
| int passthrough, rv; | int passthrough, rv; | ||||
| passthrough = (device_get_parent(child) != bus); | passthrough = (device_get_parent(child) != bus); | ||||
| rl = BUS_GET_RESOURCE_LIST(bus, child); | rl = BUS_GET_RESOURCE_LIST(bus, child); | ||||
| if (type != SYS_RES_IRQ) { | if (rman_get_type(res) != SYS_RES_IRQ) { | ||||
| if ((rman_get_flags(res) & RF_ACTIVE) != 0 ){ | if ((rman_get_flags(res) & RF_ACTIVE) != 0 ){ | ||||
| rv = bus_deactivate_resource(child, type, rid, res); | rv = bus_deactivate_resource(child, res); | ||||
| if (rv != 0) | if (rv != 0) | ||||
| return (rv); | return (rv); | ||||
| } | } | ||||
| rv = rman_release_resource(res); | rv = rman_release_resource(res); | ||||
| if (rv != 0) | if (rv != 0) | ||||
| return (rv); | return (rv); | ||||
| if (!passthrough) { | if (!passthrough) { | ||||
| rle = resource_list_find(rl, type, rid); | rle = resource_list_find(rl, rman_get_type(res), | ||||
| rman_get_rid(res)); | |||||
| KASSERT(rle != NULL, | KASSERT(rle != NULL, | ||||
| ("%s: resource entry not found!", __func__)); | ("%s: resource entry not found!", __func__)); | ||||
| KASSERT(rle->res != NULL, | KASSERT(rle->res != NULL, | ||||
| ("%s: resource entry is not busy", __func__)); | ("%s: resource entry is not busy", __func__)); | ||||
| rle->res = NULL; | rle->res = NULL; | ||||
| } | } | ||||
| return (0); | return (0); | ||||
| } | } | ||||
| return (resource_list_release(rl, bus, child, type, rid, res)); | return (resource_list_release(rl, bus, child, res)); | ||||
| } | } | ||||
| struct resource * | struct resource * | ||||
| fman_alloc_resource(device_t bus, device_t child, int type, int *rid, | fman_alloc_resource(device_t bus, device_t child, int type, int *rid, | ||||
| rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) | rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) | ||||
| { | { | ||||
| struct fman_softc *sc; | struct fman_softc *sc; | ||||
| struct resource_list *rl; | struct resource_list *rl; | ||||
| ▲ Show 20 Lines • Show All 399 Lines • Show Last 20 Lines | |||||