Subject: kern/5552: Starlan ethernet driver problems
To: None <gnats-bugs@gnats.netbsd.org>
From: Brad Spencer <brad@anduin.eldar.org>
List: netbsd-bugs
Date: 06/07/1998 17:36:54
>Number:         5552
>Category:       kern
>Synopsis:       Starlan ethernet driver problems
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jun  7 14:50:01 1998
>Last-Modified:
>Originator:     Brad Spencer
>Organization:
	sitting at home
>Release:        1.3E as of end of May source
>Environment:
	
System: NetBSD treebeard.eldar.org 1.3E NetBSD 1.3E (NEW_ANDUIN) #11: Sat Jun  6 22:42:02 EDT 1998     brad@treebeard.eldar.org:/usr/src/sys/arch/i386/compile/NEW_ANDUIN i386

>Description:

When the ie driver was broken apart and buss-ified a number of bugs
were introduced:

1) A logic bug was introduced such that the driver would never find a
valid card during the probe.

2) The version [really the type of card] string was stored in a
variable called "version", which just happens to be the same one used
to store the version of the OS.  Thus the OS version would be
overwritten with the version [or type] of the card.

3) The probe for the amount of memory on the card causes my machine to
reboot.  No panic, just a reboot.  I don't know how to fix this one
and have no real information about the possible Starlan card
configurations.  The patch which follows has a simple hack which sets
the size to 16k.  At least my machine does not panic any more.

Other things:

1) There might be a bug in the "card revision" detection.  I seem to
remember that the old driver detected my card as a revision 1, but it
show up as 0 now.  I don't have any information which would tell one
which way is correct.

2) There seems to be noise generated by the fe_simple_probe function
in the ate and fmv ethernet drivers.  The noise is in the form of:

fe_simple_probe: ff & 70 != 0
ate_match: ate_find failed
fe_simple_probe: ff & 70 != 0
fmv_match: fmv_find failed

3) When the networks are being brought up at boot time, the following
messages are generated by the driver:

ai0: 16 frames 48 bufs
ai0: reserved 16344 bytes
ai0: i82586_intr: 1 spurious interrupts

I presume that these are just noise more then anything.


[The Starlan card I have is an 8 bit full length ISA card labled
EN100.  It is placed in a brand new 233MHZ AMD based machine.  This
was the only spare ethernet card I had on hand and the use of this
card should not be considered a bug.  8-)]

>How-To-Repeat:

Put a EN100 Starlan card in your machine and boot NetBSD-current.

>Fix:

Here is a patch:

*** if_ai.c.DIST	Wed Apr 15 07:13:01 1998
--- if_ai.c	Sun Jun  7 16:37:37 1998
***************
*** 99,106 ****
--- 99,108 ----
  static void	ai_write_24 __P((struct ie_softc *, int, int));
  
  /* Local support functions */
+ #if 0
  static int 	check_ie_present __P((struct ie_softc*, bus_space_tag_t,
  					bus_space_handle_t, bus_size_t));
+ #endif
  static int	ai_find_mem_size __P((struct ai_softc*, bus_space_tag_t,
  					bus_size_t));
  
***************
*** 278,284 ****
  	val = bus_space_read_1(iot, ioh, AI_REVISION);
  
  	type = SL_BOARD(val);
! 	if (type != SL10_BOARD || type != EN100_BOARD ||
  	    type != SLFIBER_BOARD) {
  		DPRINTF(("ai_match: unknown board code 0x%02x @ 0x%x\n",
  			 type, ia->ia_iobase));
--- 280,286 ----
  	val = bus_space_read_1(iot, ioh, AI_REVISION);
  
  	type = SL_BOARD(val);
! 	if (type != SL10_BOARD && type != EN100_BOARD &&
  	    type != SLFIBER_BOARD) {
  		DPRINTF(("ai_match: unknown board code 0x%02x @ 0x%x\n",
  			 type, ia->ia_iobase));
***************
*** 299,304 ****
--- 301,308 ----
  		goto out;
  	}
  
+ 	memsize = 16384;
+ 
  	if (!ia->ia_msize)
  		ia->ia_msize = memsize;
  	else if (ia->ia_msize != memsize) {
***************
*** 331,336 ****
--- 335,341 ----
  	u_int8_t val = 0;
  	bus_space_handle_t ioh, memh;
  	u_int8_t ethaddr[ETHER_ADDR_LEN];
+ 	char ai_version[80];
  
  	if (bus_space_map(ia->ia_iot, ia->ia_iobase,
  			  ia->ia_iosize, 0, &ioh) != 0) {
***************
*** 409,418 ****
  	val = bus_space_read_1(asc->sc_regt, asc->sc_regh, AI_REVISION);
  	asc->card_rev = SL_REV(val);
  	asc->card_type = SL_BOARD(val) - 1;
! 	sprintf(version, "%s, rev. %d",
  		ai_names[asc->card_type], asc->card_rev);
  
! 	i82586_attach(sc, version, ethaddr, NULL, 0, 0);
  
  	asc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE,
  					IPL_NET, i82586_intr, sc);
--- 414,423 ----
  	val = bus_space_read_1(asc->sc_regt, asc->sc_regh, AI_REVISION);
  	asc->card_rev = SL_REV(val);
  	asc->card_type = SL_BOARD(val) - 1;
! 	sprintf(ai_version, "%s, rev. %d",
  		ai_names[asc->card_type], asc->card_rev);
  
! 	i82586_attach(sc, ai_version, ethaddr, NULL, 0, 0);
  
  	asc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE,
  					IPL_NET, i82586_intr, sc);
***************
*** 425,431 ****
  /*
   * Divine the memory size of this board.
   * Better hope there's nothing important hiding just below the card...
!  */
  static int
  ai_find_mem_size(asc, memt, maddr)
  	struct ai_softc* asc;
--- 430,436 ----
  /*
   * Divine the memory size of this board.
   * Better hope there's nothing important hiding just below the card...
! */
  static int
  ai_find_mem_size(asc, memt, maddr)
  	struct ai_softc* asc;
***************
*** 433,441 ****
--- 438,456 ----
  	bus_size_t maddr;
  {
  	int size;
+ #if 0
  	bus_space_handle_t memh;
  	struct ie_softc* sc = &asc->sc_ie;
+ #endif
+ 
+ 	/* XXX - lie about this, maybe.  The following probe causes a reboot
+ 	 on my system */
+ 
+ 	size = 16384;
  
+ 	return size;
+ 
+ #if 0
  	for (size = 65536; size >= 16384; size -= 16384) {
  		if (bus_space_map(memt, maddr, size, 0, &memh) == 0) {
  			size = check_ie_present(sc, memt, maddr, size);
***************
*** 447,454 ****
--- 462,474 ----
  	}
  
  	return (0);
+ #endif
  }
  
+ #if 0
+ 
+ /* XXX - or it could be this */
+ 
  /*
   * Check to see if there's an 82586 out there.
   */
***************
*** 494,499 ****
--- 514,520 ----
  
  	return (size);
  }
+ #endif
  
  struct cfattach ai_ca = {
  	sizeof(struct ai_softc), ai_match, ai_attach
>Audit-Trail:
>Unformatted: