Subject: kern/4308: lc0 wildcard search locks up my ne2000 ethernet card
To: None <gnats-bugs@gnats.netbsd.org, matt@3am-software.com>
From: Bill Studenmund <wrstuden@landau.Stanford.EDU>
List: netbsd-bugs
Date: 10/20/1997 17:59:51
>Number:         4308
>Category:       kern
>Synopsis:       lc0 wildcard search locks up my ne2000 ethernet card
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 20 18:05:05 1997
>Last-Modified:
>Originator:     Bill Studenmund
>Organization:
>Release:        NetBSD-current as of 10/15/97, but checked source as of 10/20
>Environment:
	i486 AST motherboard w/ cheep ne2000 card
System: NetBSD landau.Stanford.EDU 1.2G NetBSD 1.2G (LANDAU) #38: Mon Oct 20 17:26:49 PDT 1997 wrstuden@landau.Stanford.EDU:/y1/working/src/sys/arch/i386/compile/LANDAU i386

>Description:

When lemac_isa_probe gets called for a wild-carded entry such as:
lc0     at isa? port ? iomem ? irq ?            # DEC EtherWORKS III (LEMAC)

it looks at all IO candidates between 0x200 and 0x400.

When it looks at 0x300 (where my card, which comes up as ne1, is), the
computer hangs hard. Only the reset button works, and then the BIOS
goes through a power-up boot (checks RAM, etc).

lemac_isa_probe calls lemac_port_check, which calls lemac_read_macaddr.
Basically the ne2000 card I have hates this.

>How-To-Repeat:

Try to boot any GENERIC kernel, or other kernel w/ lc0 wildcarded, with
this ne2000 card. It'll hang.

I can't test to see if it's true of all ne2000 cards.

>Fix:
Either don't wildcard lc0, or make sure all neX cards get attached first.
lemac_isa_probe checks to see that it can map an io region covering the
candidate card first. If the card's been attached already, the mapping will
fail.

The probe sequence is dictated by position in sys/conf/files, not
position in the kernel config. So the lc spec needs to come after
all other network cards (well, all ne2000 cards). I think it'd be
best if this test could come at the very end of the isa checks as
there might be custom hardware in the computer which does not
appreciate getting read from before it's ready.

Here's the patch to sys/conf/files which got my computer up again:

--- files	Sat Oct 18 12:25:09 1997
+++ /sys/conf/files	Mon Oct 20 17:22:52 1997
@@ -94,10 +94,6 @@
 device	ep: arp, ether, ifnet
 file	dev/ic/elink3.c			ep
 
-# DEC EtherWORKS III (LEMAC) Ethernet controllers
-device	lc: arp, ether, ifnet
-file	dev/ic/lemac.c			lc
-
 # LANCE and PCnet Ethernet controllers
 device	le: arp, ether, ifnet
 file	dev/ic/am7990.c			le
@@ -147,6 +143,10 @@
 # National Semiconductor DS8390.
 device	ne: ether, ifnet, arp, dp8390nic
 file	dev/ic/ne2000.c			ne
+
+# DEC EtherWORKS III (LEMAC) Ethernet controllers
+device	lc: arp, ether, ifnet
+file	dev/ic/lemac.c			lc
 
 # 8250/16[45]50-based "com" ports
 # XXX In a perfect world, this would be done with attributes
>Audit-Trail:
>Unformatted: