From olli@lurza.secnetix.de  Fri Jan 24 09:24:02 2003
Return-Path: <olli@lurza.secnetix.de>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 3ABAE37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 24 Jan 2003 09:24:02 -0800 (PST)
Received: from lurza.secnetix.de (lurza.secnetix.de [212.66.1.130])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 1B4E243F18
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 24 Jan 2003 09:24:01 -0800 (PST)
	(envelope-from olli@lurza.secnetix.de)
Received: from lurza.secnetix.de (localhost [IPv6:::1])
	by lurza.secnetix.de (8.12.6/8.12.5) with ESMTP id h0OHNndK063885;
	Fri, 24 Jan 2003 18:23:49 +0100 (CET)
	(envelope-from oliver.fromme@secnetix.de)
Received: (from olli@localhost)
	by lurza.secnetix.de (8.12.6/8.12.5/Submit) id h0OHNmts063884;
	Fri, 24 Jan 2003 18:23:48 +0100 (CET)
Message-Id: <200301241723.h0OHNmts063884@lurza.secnetix.de>
Date: Fri, 24 Jan 2003 18:23:48 +0100 (CET)
From: Oliver Fromme <olli@secnetix.de>
Reply-To: Oliver Fromme <olli@secnetix.de>
To: FreeBSD-gnats-submit@freebsd.org
Cc: Oliver Fromme <olli@secnetix.de>
Subject: dc0 driver in 5.0 broken for Macronix 98715/98715A chip
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         47440
>Category:       kern
>Synopsis:       dc0 driver in 5.0 broken for Macronix 98715/98715A chip
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    mbr
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jan 24 09:30:01 PST 2003
>Closed-Date:    Wed Feb 12 15:01:35 PST 2003
>Last-Modified:  Wed Feb 12 15:01:35 PST 2003
>Originator:     Oliver Fromme <olli@secnetix.de>
>Release:        FreeBSD 5.0-RELEASE i386
>Organization:
secnetix GmbH & Co KG, http://www.secnetix.de/
>Environment:
FreeBSD 5.0-RELEASE i386

>Description:

   I've got a machine (dual Celeron-466) with a Macronix
   98715/98715A fast ethernet NIC.  It had been running an
   old version of 5-current from August 3rd 2001 without
   any problems.

   Yesterday I decided to upgrade the machine to 5.0-Release,
   via FTP using boot floppies.  However, it just hang when
   trying to resolve the name of the FTP server.  A tcpdump
   on the router showed zero activity from that machine, as
   if the interface was dead.

   On sysinstall's debug screen (Alt-F2) I got the following
   information.  I've copied it manually (no serial console),
   so there might be typos.

   DEBUG: Loading module if_dc.ko (DEC/Intel 21143 (and clones) PCI fast ethernet card)
   dc0: <Macronix 98715/98715A 10/100BaseTX> port 0xe400-0xe4ff mem 0xe5000000-0xe50000ff irq 5 at device 8.0 on pci0
   dc0: Ethernet address: 00:00:00:00:00:00
   miibus0: <MII bus> on dc0
   dcphy0: <Intel 21143 NWAY media interface> on miibus0
   dcphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto

   Note that the ethernet address (MAC) is not detected
   correctly!

   Then I decided to install a current 4-stable snapshot
   (4.7-20030120-STABLE).  It seems to work fine, and
   detects the card like this:

   dc0: <Macronix 98715/98715A 10/100BaseTX> port 0xe400-0xe4ff mem 0xe5000000-0xe50000ff irq 2 at device 8.0 on pci0
   dc0: Ethernet address: 00:00:e8:59:a3:47
   miibus0: <MII bus> on dc0
   dcphy0: <Intel 21143 NWAY media interface> on miibus0
   dcphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto

>How-To-Repeat:

   Try to install 5.0-RELEASE on an i386 machine (via FTP)
   with a Macronix 98715/98715A NIC.

>Fix:

   None known.

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->mbr 
Responsible-Changed-By: mbr 
Responsible-Changed-When: Thu Jan 30 15:49:11 PST 2003 
Responsible-Changed-Why:  
I'll look at this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=47440 
State-Changed-From-To: open->analyzed 
State-Changed-By: mbr 
State-Changed-When: Fri Feb 7 08:47:30 PST 2003 
State-Changed-Why:  
Hi, 

Can you try the following patch and report back if it works ? 

http://people.freebsd.org/~mbr/patches/if_dc.c.diff 

--- sys/pci/if_dc.c.orig	Fri Feb  7 17:43:19 2003 
+++ sys/pci/if_dc.c	Fri Feb  7 17:40:48 2003 
@@ -1958,13 +1958,15 @@ 
sc->dc_info = dc_devtype(dev); 
revision = pci_read_config(dev, DC_PCI_CFRV, 4) & 0x000000FF; 

+	if (! (DC_IS_PNIC(sc) || DC_IS_XIRCOM(sc))) 
+		dc_eeprom_width(sc); 
+ 
switch(sc->dc_info->dc_did) { 
case DC_DEVICEID_21143: 
sc->dc_type = DC_TYPE_21143; 
sc->dc_flags |= DC_TX_POLL|DC_TX_USE_TX_INTR; 
sc->dc_flags |= DC_REDUCED_MII_POLL; 
/* Save EEPROM contents so we can parse them later. */ 
-		dc_eeprom_width(sc); 
dc_read_srom(sc, sc->dc_romwidth); 
break; 
case DC_DEVICEID_DM9009: 
@@ -1985,7 +1987,6 @@ 
sc->dc_flags |= DC_TX_USE_TX_INTR; 
sc->dc_flags |= DC_TX_ADMTEK_WAR; 
sc->dc_pmode = DC_PMODE_MII; 
-		dc_eeprom_width(sc); 
dc_read_srom(sc, sc->dc_romwidth); 
break; 
case DC_DEVICEID_AN985: 
@@ -1996,7 +1997,6 @@ 
sc->dc_flags |= DC_TX_USE_TX_INTR; 
sc->dc_flags |= DC_TX_ADMTEK_WAR; 
sc->dc_pmode = DC_PMODE_MII; 
-		dc_eeprom_width(sc); 
dc_read_srom(sc, sc->dc_romwidth); 
break; 
case DC_DEVICEID_98713: 
@@ -2067,7 +2067,6 @@ 
sc->dc_flags |= DC_TX_INTR_ALWAYS; 
sc->dc_flags |= DC_REDUCED_MII_POLL; 
sc->dc_pmode = DC_PMODE_MII; 
-		dc_eeprom_width(sc); 
dc_read_srom(sc, sc->dc_romwidth); 
break; 
default: 

Martin 


http://www.freebsd.org/cgi/query-pr.cgi?pr=47440 
State-Changed-From-To: analyzed->closed 
State-Changed-By: mbr 
State-Changed-When: Wed Feb 12 15:01:17 PST 2003 
State-Changed-Why:  
Fixed in CURRENT and STABLE. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=47440 
>Unformatted:
