Subject: port-i386/22058: duplicate detection of isa ep card
To: None <gnats-bugs@gnats.netbsd.org>
From: None <o.vd.linden@quicknet.nl>
List: netbsd-bugs
Date: 07/05/2003 11:48:02
>Number:         22058
>Category:       port-i386
>Synopsis:       duplicate detection of isa ep
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jul 05 09:49:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Onno van der Linden
>Release:        NetBSD 1.6U
>Organization:
	
>Environment:
	
	
System: NetBSD sheep 1.6U NetBSD 1.6U (SHEEP) #0: Mon Jun 30 16:15:30 MEST 2003 root@sheep:/usr/src/sys/arch/i386/compile/SHEEP i386
Architecture: i386
Machine: i386
>Description:
	duplicate detection of an ep network card can take place when both
        ep at isa and ep at isapnp are in the config file.
>How-To-Repeat:
	boot with a generic kernel and an ep card that's still in its
        default state
>Fix:
Sometimes an isa ep network card will be detected twice: as isa and
isapnp. Three runs with 3c5x9cfg (3com config program for this card)
each followed by a netbsd boot with an ep driver that dumped its
eeprom contents showed the following:

Duplicate detection takes place when bits 2 and 3 of eeprom[0x13] are
both unset AND bit 7 of eeprom[8] is set (I don't know what happens
when bit 7 is unset in this case but I believe this can't happen via
3c5x9cfg.com).

------- After running 3c5x9cfg /pnprst ------------------
eeprom[8] = 0x81; eeprom[0x13] = 0
isa0 at pcib0
EEPROM contents:
0050 da36 fe68 9550 c743 0036 4b57 6d50
0081 9f00 0050 da36 fe68 1320 0000 562d
2083 0000 0000 0000 0001 0000 0000 9701
6d50 9550 fe68 da36 0aa4 1010 1982 3300
ep0 at isa0 port 0x210-0x21f irq 9: 3Com 3C509 Ethernet
ep0: address 00:50:da:36:fe:68, 8KB byte-wide FIFO, 5:3 Rx:Tx split
ep0: 10baseT (default 10baseT)
isapnp0: read port 0x203
ep1 at isapnp0 port 0x220/16 irq 3
ep1: 3Com 3C509B EtherLink III
ep1: address 00:50:da:36:fe:68, 8KB byte-wide FIFO, 5:3 Rx:Tx split
ep1: 10baseT (default 10baseT)
isa0 at pcib0

------- After running 3c5x9cfg /pnprst /pnp:disabled ------------------
eeprom[8] = 1; eeprom[0x13] = 4
EEPROM contents:
0050 da36 fe68 9550 c743 0036 4b57 6d50
0001 9f00 0050 da36 fe68 1320 0000 56ad
2083 0000 0000 0004 0001 0000 0000 9705
6d50 9550 fe68 da36 0aa4 1010 1982 3300
ep0 at isa0 port 0x210-0x21f irq 9: 3Com 3C509 Ethernet
ep0: address 00:50:da:36:fe:68, 8KB byte-wide FIFO, 5:3 Rx:Tx split
ep0: 10baseT (default 10baseT)
isapnp0: no ISA Plug 'n Play devices found


------- After running 3c5x9cfg /pnprst /pnp:enabled ------------------
eeprom[8] = 1; eeprom[0x13] = 0xc
isa0 at pcib0
EEPROM contents:
0050 da36 fe68 9550 c743 0036 4b57 6d50
0001 9f00 0050 da36 fe68 1320 0000 56ad
2083 0000 0000 000c 0001 0000 0000 970d
6d50 9550 fe68 da36 0aa4 1010 1982 3300
3COM 3C509B Ethernet card in PnP mode
...
isapnp0: read port 0x203
ep0 at isapnp0 port 0x210/16 irq 3
ep0: 3Com 3C509B EtherLink III
ep0: address 00:50:da:36:fe:68, 8KB byte-wide FIFO, 5:3 Rx:Tx split
ep0: 10baseT (default 10baseT)


*** /usr/src/sys/dev/isa/if_ep_isa.c	Sun Oct  6 09:28:22 2002
--- /usr/src/sys/dev/isa/if_ep_isa.c.new	Sat Jul  5 11:39:30 2003
***************
*** 165,171 ****
  	bus_space_tag_t iot = ia->ia_iot;
  	bus_space_handle_t ioh;
  	int slot, iobase, irq, i;
! 	u_int16_t vendor, model;
  	struct ep_isa_done_probe *er;
  	int bus = parent->dv_unit;
  
--- 165,171 ----
  	bus_space_tag_t iot = ia->ia_iot;
  	bus_space_handle_t ioh;
  	int slot, iobase, irq, i;
! 	u_int16_t vendor, model, pnp;
  	struct ep_isa_done_probe *er;
  	int bus = parent->dv_unit;
  
***************
*** 230,235 ****
--- 230,237 ----
  			}
  
  		iobase = epreadeeprom(iot, ioh, EEPROM_ADDR_CFG);
+ /* Undocumented pnp bit when EEPROM_CONFIG_HIGH bits 3 and 2 are both unset */
+ 		pnp = iobase & 0x80;
  		iobase = (iobase & 0x1f) * 0x10 + 0x200;
  
  		irq = epreadeeprom(iot, ioh, EEPROM_RESOURCE_CFG);
***************
*** 293,302 ****
  			else
  			  /*
  			   * we have a 3c509B with PnP capabilities.
! 			   * Test partly documented bit which toggles when
! 			   * in  PnP mode.
  			   */
! 			if ((eeprom_hi & 8) != 0) {
  				printf("3COM 3C509B Ethernet card in PnP mode\n");
  				continue;
  			}
--- 295,305 ----
  			else
  			  /*
  			   * we have a 3c509B with PnP capabilities.
! 			   * Test partly documented bits which toggle when
! 			   * in PnP mode.
  			   */
! 			if ((eeprom_hi & 8) != 0 ||
! 			    ((eeprom_hi & 12) == 0 && pnp != 0)) {
  				printf("3COM 3C509B Ethernet card in PnP mode\n");
  				continue;
  			}
>Release-Note:
>Audit-Trail:
>Unformatted: