Subject: Re: panic: crazy interrupts
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Eduardo E. Horvath <eeh@one-o.com>
List: port-sparc
Date: 11/03/1997 15:02:02
On Sun, 2 Nov 1997, der Mouse wrote:

> >> I fixed the race condition that was causing this earlier this year
> >> in the previous version of the zs driver.
> 
> > I looked at that when you posted the message, but I thought the new
> > version of the driver was OK.  Maybe I was wrong.
> 
> It sure doesn't seem OK on my machine. :-)
> 
> > It is supposed to work this way:  If the kernel calls zscnputc when
> > the transmitter had been busy, it will wait for it to be non-busy,
> > and then make it busy again.  The interrupt-driven output should
> > still get a transmit-complete interrupt, after the last character
> > written by zscnputc finishes going out.
> 
> Perhaps it will.  But first, it seems, it takes the
> previously-requested interrupt immediately after zs_putc() drops ipl,
> at which point the chip has no interrupt pending 'cause it was cleared
> by writing the character to be transmitted.  From this we can deduce
> that the hardware latches interrupt requests, so that when the chip
> drops its interrupt request the cpu ends up taking the interrupt
> anyway...but broken or not, that is the way it works and NetBSD will
> have to deal with it.

I think the problem is more fundamental than that.  The driver does not
swallow interrupts when running in polled mode.  My quick and dirty fix
involved implementing a zspoll() that disabled the spurious interrupt
checks by setting a global variable.  It's not a very elegant solution,
but it seems to work reasonably well.   If the chip has an interrupt
disable bit, that would be a better thing to flip, but I did not want
to spend the time getting overly familiar with the hardware.  

If polled mode worked properly, and the driver was flipped into polled
mode while spitting out error messages, the crazy interrupts problem
should go away without causing problems for other devices that might be on
the level 12 interrupt.

=========================================================================
Eduardo Horvath				eeh@btr.com
"Cliffs are for climbing.  That's why God invented grappling hooks."
					- Benton Frasier