From owner-freebsd-hackers@FreeBSD.ORG Sat Apr 19 11:52:42 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5DB0F37B401 for ; Sat, 19 Apr 2003 11:52:42 -0700 (PDT) Received: from gateh.kw.bbc.co.uk (gateh.kw.bbc.co.uk [132.185.132.17]) by mx1.FreeBSD.org (Postfix) with ESMTP id F10FC43FDF for ; Sat, 19 Apr 2003 11:52:40 -0700 (PDT) (envelope-from damiony@rd.bbc.co.uk) Received: from sunf8 ([132.185.128.108]) by gateh.kw.bbc.co.uk (8.11.2/8.11.2) with ESMTP id h3JIqdS09957 for ; Sat, 19 Apr 2003 19:52:39 +0100 (BST) Received: from damiony (helo=localhost) by sunf8 with local-esmtp (Exim 3.33 #11) id 196xS4-0003IL-00 for hackers@freebsd.org; Sat, 19 Apr 2003 19:52:40 +0100 Date: Sat, 19 Apr 2003 19:52:40 +0100 (BST) From: Damion Yates X-X-Sender: damiony@sunf8 To: hackers@freebsd.org Message-ID: Subject: Fixes to a weird de0: Digital 21041 Ethernet X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Apr 2003 18:52:42 -0000 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: 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 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 mtu 1500 ed1: flags=8802 mtu 1500 ether 00:00:e8:18:77:10 sl0: flags=c010 mtu 552 faith0: flags=8002 mtu 1500 lo0: flags=8049 mtu 16384 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x6 inet 127.0.0.1 netmask 0xff000000 ppp0: flags=8010 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: 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)