Subject: Re: ep driver lossage
To: Jonathan Stone <jonathan@DSG.Stanford.EDU>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: tech-net
Date: 04/13/1999 23:46:32
Ok, I quickly tried your elink3.c file on my system: I don't get the message,
but the system still hang at reboot. Unfortunably as I didn't have debugger
compiled it I can't tell where it's hung.
I tried back-porting this patch to 1.3.3: I still got the message and the
hung. But it was a quick and dirty work, I may have missed something.

A big problem I've seen is that the 1.4 kernel dectects the board 2 times:
once as isa and once as isapnp (it is set up for isapnp). This doesn't
happen with 1.3.3 and may be the reason for the hang in 1.4 (if shutdownhook
is called 2 times ....).
With 1.3.3 I properly get "3COM 3C509 Ethernet card in PnP mode". 
I didn't investigate further, it's time to go to bed :)

On Apr 13, Jonathan Stone wrote
> [...]
> 
> --- elink3.c	Tue Apr 13 13:03:06 1999
> +++ elink3.c.jrs-shutdown-hack	Tue Apr 13 12:55:19 1999
> @@ -224,6 +224,14 @@
>  					u_int cmd, u_int arg));
>  static __inline int ep_w1_reg __P((struct ep_softc *, int));
>  
> +/* 
> + * How long to delay when waiting for a reset to complete. (We cannot
> + * use S_COMMAND_IN_PROGRESS since some older boards do not implement
> + * that on RESET commands).  Documentation says we need at least 1 ms,
> + * but be generous for original 3c509 boards.
> + */
> +#define ELINK_RESET_DELAY	100000
> +
>  /*
>   * Some chips (3c515 [Corkscrew] and 3c574 [RoadRunner]) have
>   * Window 1 registers offset!
> @@ -274,7 +282,7 @@
>  		;
>  	else
>  #else
> -	DELAY(100000);	/* need at least 1 ms, but be generous. */
> +	DELAY(ELINK_RESET_DELAY);	/* need at least 1 ms, be generous. */
>  #endif
>  }
>  
> @@ -690,8 +698,15 @@
>  	bus_space_handle_t ioh = sc->sc_ioh;
>  	int i;
>  
> +#if 0	/*
> +	 * cannot use S_COMMAND_IN_PROGRESS, since we may be in a RESET,
> +	 * and some boards do not implement it there. See ep_complete_cmd().
> +	 */
>  	while (bus_space_read_2(iot, ioh, ELINK_STATUS) & S_COMMAND_IN_PROGRESS)
>  		;
> +#else
> +	DELAY(ELINK_RESET_DELAY);
> +#endif
>  
>  	if (sc->bustype != ELINK_BUS_PCI) {
>  		GO_WINDOW(0);
> @@ -1836,8 +1851,11 @@
>  	register struct ep_softc *sc = arg;
>  
>  	if (sc->enabled) {
> +		int s = splnet();
> +
>  		epstop(sc);
>  		ep_complete_cmd(sc, ELINK_COMMAND, GLOBAL_RESET);
> +		splx(s);
>  	}
>  }
>  

-- 
--
Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
     {Net,Free}BSD: 22 ans d'experience feront toujours la difference
--