Subject: Re: [netbsd-4] bge(4) regression in RC2
To: None <hf@spg.tu-darmstadt.de>
From: SAITOH Masanobu <masanobu@iij.ad.jp>
List: current-users
Date: 10/02/2007 21:22:31
 Please try following patch (if_bge rev. 1.139) and report to me.

 If there is no objecton, I'll send the pullup request for netbsd-4.


Index: if_bge.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/sys/dev/pci/if_bge.c,v
retrieving revision 1.138
retrieving revision 1.139
diff -u -r1.138 -r1.139
--- if_bge.c	24 Sep 2007 21:25:45 -0000	1.138
+++ if_bge.c	28 Sep 2007 15:37:45 -0000	1.139
@@ -1103,7 +1103,7 @@
 	/* NIC-memory send ring  not used; initialize to zero. */
 	CSR_WRITE_4(sc, BGE_MBX_TX_NIC_PROD0_LO, 0);
 	if (sc->bge_quirks & BGE_QUIRK_PRODUCER_BUG)	/* 5700 b2 errata */
-		CSR_WRITE_4(sc, BGE_MBX_TX_HOST_PROD0_LO, 0);
+		CSR_WRITE_4(sc, BGE_MBX_TX_NIC_PROD0_LO, 0);
 =

 	SLIST_INIT(&sc->txdma_list);
 	for (i =3D 0; i < BGE_RSLOTS; i++) {
@@ -2831,11 +2831,6 @@
 			val |=3D (1<<29);
 		}
 	}
-	/*
-	 * Write the magic number to the firmware mailbox at 0xb50
-	 * so that the driver can synchronize with the firmware.
-	 */
-	bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM, BGE_MAGIC_NUMBER);
 =

 	/* Issue global reset */
 	bge_writereg_ind(sc, BGE_MISC_CFG, val);
@@ -2884,6 +2879,12 @@
 	}
 =

 	/*
+	 * Write the magic number to the firmware mailbox at 0xb50
+	 * so that the driver can synchronize with the firmware.
+	 */
+	bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM, BGE_MAGIC_NUMBER);
+
+	/*
 	 * Poll the value location we just wrote until
 	 * we see the 1's complement of the magic number.
 	 * This indicates that the firmware initialization
@@ -2916,7 +2917,7 @@
 	 * from the device's non-PCI registers may yield garbage
 	 * results.
 	 */
-	for (i =3D 0; i < BGE_TIMEOUT; i++) {
+	for (i =3D 0; i < 10000; i++) {
 		new_pcistate =3D pci_conf_read(pa->pa_pc, pa->pa_tag,
 		    BGE_PCI_PCISTATE);
 		if ((new_pcistate & ~BGE_PCISTATE_RESERVED) =3D=3D


 > Hi,
 > =

 > when I started an i386 server with a NetBSD 4 RC2 kernel[1], I hit w=
hat =

 > seems to be a regression in the bge(4) driver. A NetBSD 4 beta 2 ker=
nel =

 > from 2007-08-27 works fine.
 > =

 > <snip>
 > Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, =

 > 2005, 2006
 >      The NetBSD Foundation, Inc.  All rights reserved.
 > Copyright (c) 1982, 1986, 1989, 1991, 1993
 >      The Regents of the University of California.  All rights reserv=
ed.
 > =

 > NetBSD 4.0_RC2 (FOO) #0: Tue Oct  2 11:51:33 CEST 2007
 >        hf@foo:/var/obj/netbsd-builds/4/i386/sys/arch/i386/compile/FO=
O
 > total memory =3D 1023 MB
 > avail memory =3D 1001 MB
 > =

 > [...]
 > =

 > bge0 at pci2 dev 3 function 0: Broadcom BCM5704C Dual Gigabit Ethern=
et
 > bge0: interrupting at ioapic1 pin 8 (irq 11)
 > bge0: ASIC unknown BCM5704 (0x2100), Ethernet address 00:30:48:58:5f=
:64
 > brgphy0 at bge0 phy 1: BCM5704 1000BASE-T media interface, rev. 0
 > brgphy0: using BCM5704 DSP patch
 > brgphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, =

 > 1000baseT-FDX, auto
 > bge1 at pci2 dev 3 function 1: Broadcom BCM5704C Dual Gigabit Ethern=
et
 > bge1: interrupting at ioapic1 pin 9 (irq 9)
 > bge1: ASIC unknown BCM5704 (0x2100), Ethernet address 00:30:48:58:5f=
:65
 > brgphy1 at bge1 phy 1: BCM5704 1000BASE-T media interface, rev. 0
 > brgphy1: using BCM5704 DSP patch
 > brgphy1: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, =

 > 1000baseT-FDX, auto
 > =

 > [...]
 > =

 > Mounting all filesystems...
 > Clearing /tmp.
 > Starting amd.
 > bge0: watchdog timeout -- resetting
 > bge0: block failed to stop: reg 0x1400, bit 0x00000002
 > Oct  2 12:43:27 foo amd[415]/info:  using configuration file /etc/am=
d.conf
 > Oct  2 12:43:27 foo amd[430]: failed to initialize map amd.media
 > Oct  2 12:43:27 foo amd[430]: mapc_sync: map amd.media is down: not =

 > clearing map
 > Oct  2 12:43:27 foo amd[430]: failed to initialize map amd.misc
 > Oct  2 12:43:27 foo amd[430]: mapc_sync: map amd.misc is down: not =

 > clearing map
 > =

 > [...]
 > =

 > Starting sendmail.
 > bge0: watchdog timeout -^@- resetting
 > bge0: block failed to stop: reg 0x2000, bit 0x00000002
 > bge0: block failed to stop: reg 0x1400, bit 0x00000002
 > bge0: watchdog timeout -- resetting
 > bge0: block failed to stop: reg 0x1400, bit 0x00000002
 > =

 > </snip>
 > =

 > [root] ~ # ifconfig bge0
 > bge0: flags=3D8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 =

 > capabilities=3D3f00<IP4CSUM_Rx,IP4CSUM_Tx,TCP4CSUM_Rx,TCP4CSUM_Tx,UD=
P4CSUM_Rx,UDP4CSUM_Tx> =

 >  =

 > enabled=3D3f00<IP4CSUM_Rx,IP4CSUM_Tx,TCP4CSUM_Rx,TCP4CSUM_Tx,UDP4CSU=
M_Rx,UDP4CSUM_Tx>
 >          address: 00:30:48:58:5f:64
 >          media: Ethernet autoselect
 >          status: no carrier
 >          inet aa.bb.cc.dd netmask 0xfffffff0 broadcast aa.bb.cc.ee
 >          inet6 <line noise>%bge0 prefixlen 64 scopeid 0x1
 > =

 > =

 > -- any ideas? I see quite a lot of bge related pullups in doc/CHANGE=
S-4, =

 > unfortunately CHANGES* does not have time stamps for the changes. Sh=
ould =

 > I send-pr?
 > =

 > 	hauke
 > =

 > =

 > =

 > =

 > [1] intending to test a patch for PR 36920
 > =

 > -- =

 >       The ASCII Ribbon Campaign                    Hauke Fath
 > ()     No HTML/RTF in email	        Institut f=FCr Nachrichtentechni=
k
 > /\     No Word docs in email                     TU Darmstadt
 >       Respect for open standards              Ruf +49-6151-16-3281

----------------------------------------------------------
		SAITOH Masanobu (masanobu@iij.ad.jp
				  msaitoh@netbsd.org)