Subject: kern/7483: ex driver gets bogus MAC address with 3c905B
To: None <>
From: Dean Huxley <>
List: netbsd-bugs
Date: 04/26/1999 21:51:22
>Number:         7483
>Category:       kern
>Synopsis:       ex driver gets bogus MAC address with 3c905B
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 26 21:50:00 1999
>Originator:     Dean Huxley
>Release:        NetBSD-1.4_BETA
System: NetBSD jalapeno 1.4_BETA NetBSD 1.4_BETA (GENERIC) #7: Mon Apr 26 22:23:59 MDT 1999 dean@jalapeno:/usr/src/sys/arch/i386/compile/GENERIC i386

On a new Pentium III 500Mhz, the ex driver was getting different MAC
addresses each time I rebooted.  Further investigation revealed that
the ex_reset was returning prematurely and the MAC address was read
before the reset was complete.  I tried two 3c905B's known to work in
another computer, and the results were identical.

The ex_waitcmd macro waits for a S_COMMAND_IN_PROGRESS to be cleared.
During the reset, the bit is supposed to be set until the reset is
done, but two thirds through the reset, it clears this bit and quickly
sets it back on.  On a fast machine, ex_waitcmd will return two thirds
of the way through the reset.

On a fast PC with a 3c905b, boot and check the MAC address.

Double check that the S_COMMAND_IN_PROGRESS bit is cleared, with a
short delay between the checks.

*** src/sys/dev/ic/elinkxl.c.orig      Sat Apr 24 15:21:41 1999
--- src/sys/dev/ic/elinkxl.c   Mon Apr 26 22:22:42 1999
*** 1409,1414 ****
--- 1409,1416 ----
        bus_space_write_2(sc->sc_iot, sc->sc_ioh, ELINK_COMMAND, GLOBAL_RESET);
+       DELAY(50);
+       ex_waitcmd(sc);