Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 19 Apr 2003 19:52:40 +0100 (BST)
From:      Damion Yates <damiony@rd.bbc.co.uk>
To:        hackers@freebsd.org
Subject:   Fixes to a weird de0: Digital 21041 Ethernet
Message-ID:  <Pine.GSO.4.50.0304191935200.5048-100000@sunf8>

next in thread | raw e-mail | index | archive | help
Hi,
I've recently tried to sort my dec tulip card out under a stock FreeBSD4.8
install (It also didn't work in 5.0).  The boot up would find it but fail to
like it:

Apr  6 12:14:25  /kernel: de0: <Digital 21041 Ethernet> port 0x1000-0x107f mem 0xd0004800-0xd000487f irq 11 at device 13.0 on pci0
Apr  6 12:14:25  /kernel: de0: can't read ENET ROM (why=-4) (0000000000000000ffff000000000000000001010000c03e9cd4001e00000008
Apr  6 12:14:25  /kernel: de0: 21041 [10Mb/s] pass 1.1
Apr  6 12:14:25  /kernel: de0: address unknown

After taking a look in the src for this in:
/usr/src/sys/pci/if_de.c

I started pissing around removing some of the checks to force it to thing it
was happy.  I thought this was highly unlikely to work as I'd assumed that
all of the complex part about being an ethernet driver wouldn't just rely on
the card being happy at boot time as far as the kernel was concerned.
However after turning off two main checks in tulip_read_macaddr() and hard
wiring the ethernet address (which you can actually see above in the ENET
ROM).  The resulting build actually worked fine!  I was pretty surprised.

I've got the diff below, it's just commenting two blocks and manually setting
the ethernet address (the bcopy above fails).  Near that section of code are
several workarounds for known weird variations of the 21041, I can only guess
that mine is yet another weird variation that needs to be worked around.
Sadly my C is utter bollocks (it's been years, I shouldn't try and make
excuses really).

I'll happily try some patches to better match my style of card (checking
various parts of the ROM string
0000000000000000ffff000000000000000001010000c03e9cd4001e00000008 perhaps) and
make this a generic fix.

Thanks for any response I get,

Damion


pants# diff -u if_de.c*
--- if_de.c     Sat Apr 19 19:08:36 2003
+++ if_de.c-orig        Sat Apr 19 19:14:19 2003
@@ -2812,29 +2812,20 @@
         * ZNYX?) (well sometimes they put in a checksum so we'll
         * start at 8).
         */
-/* DMY */
-/*     for (idx = 8; idx < 32; idx++) {
+       for (idx = 8; idx < 32; idx++) {
            if (sc->tulip_rombuf[idx] != 0xFF)
                return -4;
-       } */
+       }
        /*
         * Make sure the address is not multicast or locally assigned
         * that the OUI is not 00-00-00.
         */
-/* DMY */
-       /* if ((sc->tulip_rombuf[0] & 3) != 0)
+       if ((sc->tulip_rombuf[0] & 3) != 0)
            return -4;
        if (sc->tulip_rombuf[0] == 0 && sc->tulip_rombuf[1] == 0
                && sc->tulip_rombuf[2] == 0)
-           return -4; */
+           return -4;
        bcopy(sc->tulip_rombuf, sc->tulip_enaddr, 6);
-/* DMY */
-       sc->tulip_enaddr[0] = 0x00;
-       sc->tulip_enaddr[1] = 0x00;
-       sc->tulip_enaddr[2] = 0xc0;
-       sc->tulip_enaddr[3] = 0x3e;
-       sc->tulip_enaddr[4] = 0x9c;
-       sc->tulip_enaddr[5] = 0xd4;
        sc->tulip_features |= TULIP_HAVE_OKROM;
        goto check_oui;
     } else {
@@ -5273,8 +5264,6 @@
                   33MHz that comes to two microseconds but wait a
                   bit longer anyways) */

-/* DMY */
-    /* if ((retval = tulip_read_macaddr(sc)) < -4) { */
     if ((retval = tulip_read_macaddr(sc)) < 0) {
        printf("%s%d", sc->tulip_name, sc->tulip_unit);
        printf(": can't read ENET ROM (why=%d) (", retval);
pants#

After this patch:

pants# ifconfig
de0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet 172.29.17.2 netmask 0xffffff00 broadcast 172.29.17.255
        inet6 fe80::200:c0ff:fe3e:9cd4%de0 prefixlen 64 scopeid 0x1
        ether 00:00:c0:3e:9c:d4
        media: Ethernet autoselect (10baseT/UTP)
        status: active
lp0: flags=8810<POINTOPOINT,SIMPLEX,MULTICAST> mtu 1500
ed1: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
        ether 00:00:e8:18:77:10
sl0: flags=c010<POINTOPOINT,LINK2,MULTICAST> mtu 552
faith0: flags=8002<BROADCAST,MULTICAST> mtu 1500
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x6
        inet 127.0.0.1 netmask 0xff000000
ppp0: flags=8010<POINTOPOINT,MULTICAST> mtu 1500
pants# ping 172.29.17.1
PING 172.29.17.1 (172.29.17.1): 56 data bytes
64 bytes from 172.29.17.1: icmp_seq=0 ttl=255 time=1.420 ms
64 bytes from 172.29.17.1: icmp_seq=1 ttl=255 time=1.336 ms
^C
pants# dmesg |grep de0
de0: <Digital 21041 Ethernet> port 0x1000-0x107f mem 0xd0004800-0xd000487f
irq 11 at device 13.0 on pci0
de0: SMC 21041 [10Mb/s] pass 1.1
de0: address 00:00:c0:3e:9c:d4
de0: enabling 10baseT port


-- 
Damion Yates - Maiden House, Vanwall Business estate, Maidenhead
email: Damion.Yates@bbc.co.uk - phone: +44 (0) 1628 407759 (or ex: 37759)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.50.0304191935200.5048-100000>