Subject: Re: VS4000/60 SCSI update
To: J. Buck Caldwell <buckaroo@igps.org>
From: Michael L. Hitch <mhitch@lightning.msu.montana.edu>
List: port-vax
Date: 03/29/2000 10:31:33
On Tue, 21 Mar 2000, J. Buck Caldwell wrote:

> So I tried getting my VS4000/60 to newfs it's drives after disklabeling
> them correctly (thanks Chuck), and I'm getting a blowup. It actually
> happened also when I disklabel -e'ed the drive, but when I rebooted, the
> disklabel was correctly changed. The newfs appears to go according to
> plan, but when finishing, it pauses, then writes the following errors:
> 
> sd0(asc0:0:0): asc0: timed out [ecb 0x867b70d8 (flags 0x3, dleft 4000,
> stat 0)], <state 4, nexus 0x867b70d8, phase(l 97, c0, p 0), resid 400,
> msg(q 0,o 0) DMA active>

  OK, I think I've figured out what is happening here.  I think the DMA on
the VS4000 will pre-fetch memory data when doing output to a device.  If
the buffer ends on a page boundary, the DMA engine would then attempt to
read the data following the buffer and fails because it isn't mapped.  Try
the following patch to see if this works for you.  The patch will cause an
additional 2 bytes to be mapped, which will map an additional page when
the buffer terminates on a page boundary.

  I think this needs to be fixed differently, since it probably maps an
incorrect page at the end of the buffer.  A read that overruns the buffer
could destroy random data (although the 53C94 shouldn't be transferring
more data than requested).  Attempting to map the page following the
buffer may also fail if there is no valid page following the buffer.  I
think I'll see if there's a way to deal with the error in a fashion that
wouldn't need allocating an extra page.


--- asc_vsbus.c.orig    Fri Mar 10 23:07:19 2000
+++ asc_vsbus.c Wed Mar 29 10:09:07 2000
@@ -385,7 +498,7 @@

        if (asc->sc_dmasize) {
                if (bus_dmamap_load(asc->sc_dmat, asc->sc_dmamap,
-                               *asc->sc_dmaaddr, asc->sc_dmasize,
+                               *asc->sc_dmaaddr, asc->sc_dmasize + 2,
                                NULL /* kernel address */,
                                BUS_DMA_NOWAIT))
                        panic("%s: cannot load dma map",  sc->sc_dev.dv_xname);


--
Michael L. Hitch			mhitch@montana.edu
Computer Consultant
Information Technology Center
Montana State University	Bozeman, MT	USA