Subject: Re: ex0 weird error
To: None <port-alpha@netbsd.org, current-users@netbsd.org>
From: Peter Seebach <seebs@plethora.net>
List: port-alpha
Date: 12/14/2000 14:03:35
In message <20001214132821.A20424@noc.untraceable.net>, Andrew Brown writes:
>i don't think it did.  the first of the two line changes seems to have
>gone in in a slightly altered form.  the second one-liner doesn't look
>like it went in.  here it is again.

On second thought, I'm not sure how to usefully apply this change.

>Index: elinkxl.c
>===================================================================
>RCS file: /cvsroot/syssrc/sys/dev/ic/elinkxl.c,v
>retrieving revision 1.20
>diff -c -r1.20 elinkxl.c
>*** elinkxl.c	1999/11/19 10:42:48	1.20
>--- elinkxl.c	1999/12/07 12:53:49
>***************
>*** 1109,1121 ****
>  	for (;;) {
>  		stat = bus_space_read_2(iot, ioh, ELINK_STATUS);
>! 		if (!(stat & S_MASK))
>  			break;
[...]
>  		bus_space_write_2(iot, ioh, ELINK_COMMAND, ACK_INTR |
>! 				      (stat & S_MASK));
>  		if (sc->intr_ack)
>  		    (*sc->intr_ack)(sc);
>--- 1109,1121 ----
>  	for (;;) {
>  		stat = bus_space_read_2(iot, ioh, ELINK_STATUS);
>! 		if (!(stat & (S_MASK | S_INTR_LATCH)))
>  			break;
[...]
>  		bus_space_write_2(iot, ioh, ELINK_COMMAND, ACK_INTR |
>! 				      (stat & (S_MASK | S_INTR_LATCH)));
>  		if (sc->intr_ack)
>  		    (*sc->intr_ack)(sc);

We now follow the for(;;) with:

		bus_space_write_2(iot, ioh, ELINK_COMMAND, C_INTR_LATCH);
[what does that do? It looks like it acknowledges an INTR_LATCH, but
what does *that* mean?]
		stat = bus_space_read_2(iot, ioh, ELINK_STATUS);

		if ((stat & S_MASK) == 0) {
			if ((stat & S_INTR_LATCH) == 0) {
#if 0
				printf("%s: intr latch cleared\n",
				       sc->sc_dev.dv_xname);
#endif
				break;
			}
		}

Note the subtle difference:
	* Originally, we did the "break" if S_MASK wasn't set.
	* The old patch changed it to break if *neither* S_MASK *nor*
	  S_INTR_LATCH was set.
	* Now we do that to, but we spell it out so we can have an #if'd
	  out printf about clearing an intr_latch.

		bus_space_write_2(iot, ioh, ELINK_COMMAND, ACK_INTR |
				  (stat & S_MASK));

... but we don't seem to have S_INTR_LATCH here.

I'm going to tentatively go ahead and put S_INTR_LATCH back here, but I would
love it if someone who understands the card could explain what's happening.

-s