Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Nov 2006 03:22:42 GMT
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 110093 for review
Message-ID:  <200611160322.kAG3MgXL058846@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=110093

Change 110093 by marcel@marcel_nfs on 2006/11/16 03:22:07

	Allow the range of a SCC class to be 0. This gives all child
	devices the same I/O range, which is useful for embedded
	communications controllers.

Affected files ...

.. //depot/projects/uart/dev/scc/scc_core.c#25 edit

Differences ...

==== //depot/projects/uart/dev/scc/scc_core.c#25 (text) ====

@@ -101,7 +101,7 @@
 	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;
 
 	/*
@@ -153,6 +153,7 @@
 	 */
 	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];
@@ -160,11 +161,11 @@
 		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));
 
@@ -334,7 +335,7 @@
 {
 	struct scc_softc *sc;
 	struct scc_class *cl;
-	u_long size;
+	u_long size, sz;
 	int error;
 
 	/*
@@ -376,9 +377,10 @@
 	 * 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;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200611160322.kAG3MgXL058846>