Subject: Re: FIFO errors after install
To: None <pk@cs.few.eur.nl>
From: David S. Miller <davem@caip.rutgers.edu>
List: port-sparc
Date: 12/02/1995 19:27:12
   From: Paul Kranenburg <pk@cs.few.eur.nl>
   Date: Sat, 2 Dec 1995 23:51:13 +0100 (MET)

   > and I managed to boot to netbsd without any problems. But I am getting a LOT
   > of this message on the console, and finally it kept on printing it non-stop:
   > 
   > dma0: errorempty FIFO of 1 empty FIFO of 16

   This error has been seen by others as well. I've never been able to
   reproduce this on any of my disks and, unfortunately, could not squash
   the bug it before 1.1 went out. The `dma: error' indicates some bad address
   was presented to DMA to/from causing an SBus timeout or protection violation.
   I don't know why it happens.

If you don't drain the dma fifo correctly during dmaintr() you will
see all kinds of garbage in there at the most inopportune times.  It
shows up usually with old slow scsi1 pre-ccs devices.  Before you
disable DMA on the dvma chip you must:

dma_rev1/dma_revplus/dma_rev2:
	if draining bit set in the condition register, set
	the condition register to 0x40 | DMA_INTENAB which
	forces the chip to flush it's fifo.  Then spin in a while
	loop until the "is draining" bit clears or a timeout
	occurs so that you don't hang.

dma_esc  /* The ESC dvma gate arrays */
	wait in a similar time-out/non-hanging loop for the
        no-flush-allowed bit (0x400) to clear, then do a timeout
	spin-loop for "is draining" to clear in the same manner as
	above.

Then for all chips, you or-in the "fifo invalidate" bit into the dvma
control register.  This also prevents 'late drippage' from the dvma
fifo into a data buffer (the kernel thinks the buffer is completely
transferred when in fact the dvma still has a few bytes to trickle out
into/from ram to/from the esp).

Later,
David S. Miller
davem@caip.rutgers.edu