Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/bhnd/cores/chipc/chipc.c
| Show First 20 Lines • Show All 867 Lines • ▼ Show 20 Lines | if (rle != NULL) { | ||||
| rle->end = rman_get_end(rv); | rle->end = rman_get_end(rv); | ||||
| rle->count = rman_get_size(rv); | rle->count = rman_get_size(rv); | ||||
| } | } | ||||
| return (rv); | return (rv); | ||||
| } | } | ||||
| static int | static int | ||||
| chipc_release_resource(device_t dev, device_t child, int type, int rid, | chipc_release_resource(device_t dev, device_t child, struct resource *r) | ||||
| struct resource *r) | |||||
| { | { | ||||
| struct chipc_softc *sc; | struct chipc_softc *sc; | ||||
| struct chipc_region *cr; | struct chipc_region *cr; | ||||
| struct rman *rm; | struct rman *rm; | ||||
| struct resource_list_entry *rle; | struct resource_list_entry *rle; | ||||
| int error; | int error; | ||||
| sc = device_get_softc(dev); | sc = device_get_softc(dev); | ||||
| /* Handled by parent bus? */ | /* Handled by parent bus? */ | ||||
| rm = chipc_get_rman(dev, type, rman_get_flags(r)); | rm = chipc_get_rman(dev, rman_get_type(r), rman_get_flags(r)); | ||||
| if (rm == NULL || !rman_is_region_manager(r, rm)) { | if (rm == NULL || !rman_is_region_manager(r, rm)) { | ||||
| return (bus_generic_rl_release_resource(dev, child, type, rid, | return (bus_generic_rl_release_resource(dev, child, r)); | ||||
| r)); | |||||
| } | } | ||||
| /* Locate the mapping region */ | /* Locate the mapping region */ | ||||
| cr = chipc_find_region(sc, rman_get_start(r), rman_get_end(r)); | cr = chipc_find_region(sc, rman_get_start(r), rman_get_end(r)); | ||||
| if (cr == NULL) | if (cr == NULL) | ||||
| return (EINVAL); | return (EINVAL); | ||||
| /* Deactivate resources */ | /* Deactivate resources */ | ||||
| error = bus_generic_rman_release_resource(dev, child, type, rid, r); | error = bus_generic_rman_release_resource(dev, child, r); | ||||
| if (error != 0) | if (error != 0) | ||||
| return (error); | return (error); | ||||
| /* Drop allocation reference */ | /* Drop allocation reference */ | ||||
| chipc_release_region(sc, cr, RF_ALLOCATED); | chipc_release_region(sc, cr, RF_ALLOCATED); | ||||
| /* Clear reference from the resource list entry if exists */ | /* Clear reference from the resource list entry if exists */ | ||||
| rle = resource_list_find(BUS_GET_RESOURCE_LIST(dev, child), type, rid); | rle = resource_list_find(BUS_GET_RESOURCE_LIST(dev, child), | ||||
| rman_get_type(r), rman_get_rid(r)); | |||||
| if (rle != NULL) | if (rle != NULL) | ||||
| rle->res = NULL; | rle->res = NULL; | ||||
| return (0); | return (0); | ||||
| } | } | ||||
| static int | static int | ||||
| chipc_adjust_resource(device_t dev, device_t child, | chipc_adjust_resource(device_t dev, device_t child, | ||||
| ▲ Show 20 Lines • Show All 476 Lines • Show Last 20 Lines | |||||