Subject: bpp news
To: None <port-sparc@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: port-sparc
Date: 02/01/2000 00:52:03
I finally sat down and started working with the bpp driver this
evening.

It doens't work (yet), but I've made progress.  First, I found that it
suffered from a classic race condition; bppwrite() does DMA_GO() and
then tsleep()...at spl0.  If the DMA engine is at all efficient, it is
likely to finish DMA, and call bppintr(), before tsleep() puts the
process to sleep.

Adding "s = splbpp();" before DMA_GO and "splx(s);" after tsleep fixed
that.  Then it was infinite-looping, apparently because len was never
being changed within the inner loop.  Diffs for these changes (and one
typo in a comment) are below.

Now the problem is, nothing happens.  The cable is plugged in, with the
other end hooked up to a printer (which is known to work; it works fine
on the parallel port of my /i386 machine).  And the bpp driver seems to
think it's pumping bits out.  But the printer just sits there looking
stupid, rather than actually doing anything.

I've been playing with various bits, comparing against the i386 lpt
driver, that sort of thing, so far with no success.  If anyone has any
ideas, I'd love to hear them.

					der Mouse

			       mouse@rodents.montreal.qc.ca
		     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B

--- OLD/bpp.c	Sun Jan 16 14:08:03 2000
+++ NEW/bpp.c	Tue Feb  1 00:04:28 2000
@@ -301,7 +301,7 @@
 	int s;
 
 	/*
-	 * Wait until the DMA engibe is free.
+	 * Wait until the DMA engine is free.
 	 */
 	s = splbpp();
 	while ((sc->sc_flags & BPP_LOCKED) != 0) {
@@ -344,14 +344,18 @@
 					  L64854_REG_TCR, tcr);
 
 			/* Enable DMA */
+s = splbpp();
 			DMA_GO(lsi);
 			error = tsleep(sc, PZERO|PCATCH, "bppdma", 0);
+splx(s);
 			if (error != 0)
 				goto out;
 
 			/* Bail out if bottom half reported an error */
 			if ((error = sc->sc_error) != 0)
 				goto out;
+
+			len -= size;
 		}
 	}