Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/scc/scc_core.c
Show First 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
struct resource_list_entry *rle; | struct resource_list_entry *rle; | ||||
struct scc_chan *ch; | struct scc_chan *ch; | ||||
struct scc_class *cl; | struct scc_class *cl; | ||||
struct scc_mode *m; | struct scc_mode *m; | ||||
struct scc_softc *sc, *sc0; | struct scc_softc *sc, *sc0; | ||||
const char *sep; | const char *sep; | ||||
bus_space_handle_t bh; | bus_space_handle_t bh; | ||||
u_long base, size, start, sz; | rman_res_t base, size, start, sz; | ||||
int c, error, mode, sysdev; | int c, error, mode, sysdev; | ||||
/* | /* | ||||
* The sc_class field defines the type of SCC we're going to work | * The sc_class field defines the type of SCC we're going to work | ||||
* with and thus the size of the softc. Replace the generic softc | * with and thus the size of the softc. Replace the generic softc | ||||
* with one that matches the SCC now that we're certain we handle | * with one that matches the SCC now that we're certain we handle | ||||
* the device. | * the device. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 287 Lines • ▼ Show 20 Lines | scc_bfe_probe(device_t dev, u_int regshft, u_int rclk, u_int rid) | ||||
error = SCC_PROBE(sc); | error = SCC_PROBE(sc); | ||||
bus_release_resource(dev, sc->sc_rtype, sc->sc_rrid, sc->sc_rres); | bus_release_resource(dev, sc->sc_rtype, sc->sc_rrid, sc->sc_rres); | ||||
return ((error == 0) ? BUS_PROBE_DEFAULT : error); | return ((error == 0) ? BUS_PROBE_DEFAULT : error); | ||||
} | } | ||||
struct resource * | struct resource * | ||||
scc_bus_alloc_resource(device_t dev, device_t child, int type, int *rid, | scc_bus_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 resource_list_entry *rle; | struct resource_list_entry *rle; | ||||
struct scc_chan *ch; | struct scc_chan *ch; | ||||
struct scc_mode *m; | struct scc_mode *m; | ||||
if (device_get_parent(child) != dev) | if (device_get_parent(child) != dev) | ||||
return (NULL); | return (NULL); | ||||
/* We only support default allocations. */ | /* We only support default allocations. */ | ||||
if (start != 0UL || end != ~0UL) | if (start != 0UL || end != ~0UL) | ||||
return (NULL); | return (NULL); | ||||
m = device_get_ivars(child); | m = device_get_ivars(child); | ||||
ch = m->m_chan; | ch = m->m_chan; | ||||
rle = resource_list_find(&ch->ch_rlist, type, 0); | rle = resource_list_find(&ch->ch_rlist, type, 0); | ||||
if (rle == NULL) | if (rle == NULL) | ||||
return (NULL); | return (NULL); | ||||
*rid = 0; | *rid = 0; | ||||
return (rle->res); | return (rle->res); | ||||
} | } | ||||
int | int | ||||
scc_bus_get_resource(device_t dev, device_t child, int type, int rid, | scc_bus_get_resource(device_t dev, device_t child, int type, int rid, | ||||
u_long *startp, u_long *countp) | rman_res_t *startp, rman_res_t *countp) | ||||
{ | { | ||||
struct resource_list_entry *rle; | struct resource_list_entry *rle; | ||||
struct scc_chan *ch; | struct scc_chan *ch; | ||||
struct scc_mode *m; | struct scc_mode *m; | ||||
if (device_get_parent(child) != dev) | if (device_get_parent(child) != dev) | ||||
return (EINVAL); | return (EINVAL); | ||||
▲ Show 20 Lines • Show All 142 Lines • Show Last 20 Lines |