diff options
author | marcel <marcel@FreeBSD.org> | 2007-03-28 06:45:33 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2007-03-28 06:45:33 +0000 |
commit | e5b7fa1b9f7f3ed1d3bb27b6fae45ad995f86ed8 (patch) | |
tree | f5803e7527917e05b3a1edf9907d176d6a3b6fa4 /sys/dev/scc | |
parent | d7602774b516e75f375c5127f4cca86337d9add6 (diff) | |
download | FreeBSD-src-e5b7fa1b9f7f3ed1d3bb27b6fae45ad995f86ed8.zip FreeBSD-src-e5b7fa1b9f7f3ed1d3bb27b6fae45ad995f86ed8.tar.gz |
Allow the range of a SCC class to be 0. This gives all child
devices the same (overlapping) I/O range. This is useful for
embedded communications controllers like the CPM of various
models of the PowerQUICC.
Diffstat (limited to 'sys/dev/scc')
-rw-r--r-- | sys/dev/scc/scc_core.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/dev/scc/scc_core.c b/sys/dev/scc/scc_core.c index 3432dc3..e8d77f65 100644 --- a/sys/dev/scc/scc_core.c +++ b/sys/dev/scc/scc_core.c @@ -103,7 +103,7 @@ scc_bfe_attach(device_t dev) struct scc_softc *sc, *sc0; const char *sep; bus_space_handle_t bh; - u_long base, size, start; + u_long base, size, start, sz; int c, error, mode, sysdev; /* @@ -155,6 +155,7 @@ scc_bfe_attach(device_t dev) */ sysdev = 0; base = rman_get_start(sc->sc_rres); + sz = (size != 0) ? size : rman_get_size(sc->sc_rres); start = base + ((cl->cl_range < 0) ? size * (cl->cl_channels - 1) : 0); for (c = 0; c < cl->cl_channels; c++) { ch = &sc->sc_chan[c]; @@ -162,11 +163,11 @@ scc_bfe_attach(device_t dev) ch->ch_nr = c + 1; resource_list_add(&ch->ch_rlist, sc->sc_rtype, 0, start, - start + size - 1, size); + start + sz - 1, sz); rle = resource_list_find(&ch->ch_rlist, sc->sc_rtype, 0); rle->res = &ch->ch_rres; bus_space_subregion(rman_get_bustag(sc->sc_rres), - rman_get_bushandle(sc->sc_rres), start - base, size, &bh); + rman_get_bushandle(sc->sc_rres), start - base, sz, &bh); rman_set_bushandle(rle->res, bh); rman_set_bustag(rle->res, rman_get_bustag(sc->sc_rres)); @@ -336,7 +337,7 @@ scc_bfe_probe(device_t dev, u_int regshft, u_int rclk, u_int rid) { struct scc_softc *sc; struct scc_class *cl; - u_long size; + u_long size, sz; int error; /* @@ -378,9 +379,10 @@ scc_bfe_probe(device_t dev, u_int regshft, u_int rclk, u_int rid) * Fill in the bus access structure and call the hardware specific * probe method. */ + sz = (size != 0) ? size : rman_get_size(sc->sc_rres); sc->sc_bas.bsh = rman_get_bushandle(sc->sc_rres); sc->sc_bas.bst = rman_get_bustag(sc->sc_rres); - sc->sc_bas.range = size; + sc->sc_bas.range = sz; sc->sc_bas.rclk = rclk; sc->sc_bas.regshft = regshft; |