Subject: Re: Alas...
To: Krister Walfridsson <cato@df.lth.se>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: port-sparc
Date: 05/28/1996 16:19:05
On Sun, 26 May 1996 19:29:03 +0200 (CED) 
 Krister Walfridsson <cato@df.lth.se> wrote:

 > Hi!

Mellow greetings.

 > scsibus at esp0
 > dma0: xfer (-65492) > req (44)
 > esp0: !TC [intr 10, stat 83, step 4] prevphase 1, resid 2c

Interesting ... After a peek at the SunOS header file:

	/usr/include/scsi/adapters/espreg.h

...it looks like we treat the "TC" bit differently ... SunOS calls it:

#define ESP_STAT_XZERO  0x10    /* transfer counter zero */

...where we call it:

#define  ESPSTAT_TC     0x10            /*      Terminal Count          */

I would guess from the SunOS name for the bit that they treat the 
presence of that bit as "zero bytes transfered".  From looking at our 
handling of this in dma.c (line 450), I'm not entirely certain that 
setting resid to 64k is a wise idea ... it _seems_ like it should be set 
to sc->sc_dmasize (the size of the request).

Note that the chunk of code in espdmaintr() looks like this:

        if (resid == 0 && (sc->sc_esp->sc_rev <= ESP100A) &&
            (sc->sc_esp->sc_espstat & ESPSTAT_TC) == 0)
                resid = 65536;

        trans = sc->sc_dmasize - resid;
        if (trans < 0) {                        /* transferred < 0 ? */
                printf("%s: xfer (%d) > req (%d)\n",
                    sc->sc_dev.dv_xname, trans, sc->sc_dmasize);
                trans = sc->sc_dmasize;
        }

Now, if it is indeed an indication that nothing was actually transfered, 
then that chunk of code "feels wrong"...

 > sd0 at scsibus0 targ 3 lun 0: <QUANTUM, TRB850S, 0404> SCSI2 0/direct fixed
 > sd0: dma0: xfer (-65528) > req (8)
 > esp0: !TC [intr 10, stat 83, step 4] prevphase 1, resid 8
 > 810MB 3653 cyl, 4 head 113, sec, 512 bytes/sec
 > dma0: xfer (-65492) > req (44)
 > esp0: !TC [intr 10, stat 83, step 4] prevphase 1, resid 2c
 > dma0: xfer (-65492) > req (44)
 > esp0: !TC [intr 10, stat 83, step 4] prevphase 1, resid 2c
 > 
 > and so it goes for a while, and then does the same for my 2nd disk...
 > 
 >     /Krister
 > 

----save the ancient forests - http://www.bayarea.net/~thorpej/forest/----
Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939