[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

iop(4) bus_dmamap_sync() fix



the iop driver as it is today can result in erroneous calls to
bus_dmamap_sync() when initializing the adapter, with different
side-effects on different architectures.

that said, iop(4) users are strongly recommended to test the following
patch, which is the result of a discussion between myself and mickey_(_at_)__(_dot_)_

since i386 does not have bus_dmamap_sync() implemented really and macppc
does not really require it, reports from other architectures are
especially welcome.

-p.

Index: iop.c
===================================================================
RCS file: /cvs/src/sys/dev/i2o/iop.c,v
retrieving revision 1.24
diff -u -r1.24 iop.c
--- iop.c	4 Sep 2003 03:45:53 -0000	1.24
+++ iop.c	16 Jun 2004 14:43:14 -0000
@@ -1958,11 +1958,6 @@
 	printf("mfa = %u\n", mfa);
 #endif
 
-	/* Perform reply buffer DMA synchronisation.  XXX This is rubbish. */
-	if (sc->sc_curib++ == 0)
-		bus_dmamap_sync(sc->sc_dmat, sc->sc_rep_dmamap, 0,
-		    sc->sc_rep_size, BUS_DMASYNC_PREREAD);
-
 	/* Copy out the message frame. */
 	bus_space_write_region_4(sc->sc_iot, sc->sc_ioh, mfa, mb,
 	    size / sizeof *mb);
@@ -1989,6 +1984,11 @@
 	/* Terminate the scatter/gather list chain. */
 	if ((im->im_flags & IM_SGLOFFADJ) != 0)
 		mb[size - 2] |= I2O_SGL_END;
+
+	/* Perform reply buffer DMA synchronisation. */
+	if (sc->sc_curib++ == 0)
+		bus_dmamap_sync(sc->sc_dmat, sc->sc_rep_dmamap, 0,
+		    sc->sc_rep_size, BUS_DMASYNC_PREREAD);
 
 	if ((rv = iop_post(sc, mb)) != 0)
 		return (rv);



Visit your host, monkey.org