Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Aug 2006 16:16:49 +0800
From:      LI Xin <delphij@delphij.net>
To:        pyunyh@gmail.com
Cc:        David Christensen <davidch@broadcom.com>, freebsd-current@freebsd.org
Subject:   Re: bge(4) on BCM 5752 A02 panic due to media autoselect
Message-ID:  <44F69AF1.5090205@delphij.net>
In-Reply-To: <20060831033716.GB52038@cdnetworks.co.kr>
References:  <09BFF2FA5EAB4A45B6655E151BBDD90301E2F1CF@NT-IRVA-0750.brcm.ad.broadcom.com> <44F65687.2050108@delphij.net> <20060831033716.GB52038@cdnetworks.co.kr>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enigAE848947F2CD79EB6652402B
Content-Type: multipart/mixed; boundary="------------060201090700040904030903"

This is a multi-part message in MIME format.
--------------060201090700040904030903
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Pyun YongHyeon wrote:
> On Thu, Aug 31, 2006 at 11:24:55AM +0800, LI Xin wrote:
>  > David Christensen wrote:
>  > >> Recently one of my colleagues found that BCM 5752 A02 on Dell Lat=
itude
>  > >> D820 would get "panic: invalid ife->ifm_data (0xa) in=20
>  > >> mii_phy_setmedia".
>  > >>  After some investigation I have found that removing BCMR_ANEG fr=
om
>  > >> mii_capabilities in ukphy.c would work around the problem,=20
>  > >> and it turns
>  > >> out that without explicitly specifying media type, the code=20
>  > >> will finally
>  > >> get to pass the "intentionally invalid index" to mii_phy_setmedia=
 and
>  > >> trigger an assertion fail.
>  > >>
>  > >> I have not tested the situation in -STABLE yet, but it was=20
>  > >> said to work
>  > >> there, though.  Is there anyone can shed some light to me about h=
ow to
>  > >> debug the issue?  Thanks in advance!
>  > >>
>  > >> PS. During the debugging I have found that the attached patch can=
 make
>  > >> "bge0: firmware handshake timeout" issue disappear from the said =
chip.
>  > >> Because I do not have Broadcom specification at hand I would=20
>  > >> like to see
>  > >> if there is someone to give appropriate review for it.
>  > >=20
>  > > Try the attached patch instead and let me know if it works.  When
>  > > FastBoot
>  > > is enabled on supported Broadcom controllers it allows the control=
ler to
>  > > skip rereading firmware after a reset, allowing the driver to comp=
lete=20
>  > > its initialization more quickly.  The Linux driver specifically di=
sables
>  > > FastBoot because it performs some read/write tests to controller m=
emory,
>  > > potentially corrupting the firmware, so FastBoot is disabled to in=
sure
>  > > an
>  > > error free firmware reload.  We don't do the same test so the same=

>  > > change
>  > > isn't necessary.  The patch happens to work because the bge driver=

>  > > doesn't
>  > > perform firmware synchronization correctly, and the firmware initi=
alizes
>  > > too fast for the driver.
>  >=20
>  > Thank you for the patch.  I have just tested the patch under
>  > FreeBSD/i386 -CURRENT and the I can confirm that the firmware timeou=
t
>  > goes away.  Will you please commit it?
>  >=20
>  > (Note that the panic still persists, I will try to get brgphy attach=
 to
>  > see if things changes).
>  >=20
>=20
> It would be great if you can test the brgphy patch. I'll commit the
> patch if it work on your box.

Sure, I would be more than happy to do that.  Which brgphy patch do you
want me to test?  (I have patched brgphy.c and miidevs to make BCM5752
to attach as brgphy and it resolved the panic, but I am not quite sure
if that is what you want, though)

The attached patch is what I have tested on Dell D820 with BCM 5752 A2
chip, and it seems to work well.

Please let me know if you want additional tests for whatever patch.

Cheers,
--=20
Xin LI <delphij@delphij.net>	http://www.delphij.net/
FreeBSD - The Power to Serve!

--------------060201090700040904030903
Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0";
	name="patch-bge-d820"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline;
 filename="patch-bge-d820"

Index: bge/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: /home/ncvs/src/sys/dev/bge/if_bge.c,v
retrieving revision 1.140
diff -u -r1.140 if_bge.c
--- bge/if_bge.c	24 Aug 2006 14:41:16 -0000	1.140
+++ bge/if_bge.c	31 Aug 2006 03:00:43 -0000
@@ -2326,6 +2326,12 @@
 		}
 	}
=20
+	/*
+	 * 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, reset);
=20
@@ -2362,11 +2368,6 @@
 		CSR_WRITE_4(sc, BGE_MARB_MODE, BGE_MARBMODE_ENABLE);
=20
 	/*
-	 * Prevent PXE restart: write a magic number to the
-	 * general communications memory at 0xB50.
-	 */
-	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
Index: bge/if_bgereg.h
=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: /home/ncvs/src/sys/dev/bge/if_bgereg.h,v
retrieving revision 1.52
diff -u -r1.52 if_bgereg.h
--- bge/if_bgereg.h	23 Aug 2006 11:32:54 -0000	1.52
+++ bge/if_bgereg.h	31 Aug 2006 03:02:00 -0000
@@ -1768,10 +1768,11 @@
 	} while(0)
=20
 /*
- * This magic number is used to prevent PXE restart when we
- * issue a software reset. We write this magic number to the
- * firmware mailbox at 0xB50 in order to prevent the PXE boot
- * code from running.
+ * This magic number is written to the firmware mailbox at 0xb50
+ * before a software reset is issued.  After the internal firmware
+ * has completed its initialization it will write the opposite of
+ * this value, ~BGE_MAGIC_NUMBER, to the same location, allowing
+ * the driver to synchronize with the firmware.
  */
 #define BGE_MAGIC_NUMBER                0x4B657654
=20
Index: mii/brgphy.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: /home/ncvs/src/sys/dev/mii/brgphy.c,v
retrieving revision 1.45
diff -u -r1.45 brgphy.c
--- mii/brgphy.c	23 Aug 2006 15:37:07 -0000	1.45
+++ mii/brgphy.c	31 Aug 2006 03:27:03 -0000
@@ -107,6 +107,7 @@
 	MII_PHY_DESC(xxBROADCOM, BCM5704),
 	MII_PHY_DESC(xxBROADCOM, BCM5705),
 	MII_PHY_DESC(xxBROADCOM, BCM5750),
+	MII_PHY_DESC(xxBROADCOM, BCM5752),
 	MII_PHY_DESC(xxBROADCOM, BCM5714),
 	MII_PHY_DESC(xxBROADCOM, BCM5780),
 	MII_PHY_DESC(xxBROADCOM, BCM5706C),
@@ -607,6 +608,7 @@
 		bcm5704_load_dspcode(sc);
 		break;
 	case MII_MODEL_xxBROADCOM_BCM5750:
+	case MII_MODEL_xxBROADCOM_BCM5752:
 	case MII_MODEL_xxBROADCOM_BCM5714:
 	case MII_MODEL_xxBROADCOM_BCM5780:
 	case MII_MODEL_xxBROADCOM_BCM5706C:
Index: mii/miidevs
=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: /home/ncvs/src/sys/dev/mii/miidevs,v
retrieving revision 1.33
diff -u -r1.33 miidevs
--- mii/miidevs	25 Jul 2006 00:14:00 -0000	1.33
+++ mii/miidevs	31 Aug 2006 03:27:57 -0000
@@ -118,6 +118,7 @@
 model xxBROADCOM BCM5400	0x0004 Broadcom 1000baseTX PHY
 model xxBROADCOM BCM5401	0x0005 BCM5401 10/100/1000baseTX PHY
 model xxBROADCOM BCM5411	0x0007 BCM5411 10/100/1000baseTX PHY
+model xxBROADCOM BCM5752	0x0010 BCM5752 10/100/1000baseTX PHY
 model xxBROADCOM BCM5701	0x0011 BCM5701 10/100/1000baseTX PHY
 model xxBROADCOM BCM5703	0x0016 BCM5703 10/100/1000baseTX PHY
 model xxBROADCOM BCM5704	0x0019 BCM5704 10/100/1000baseTX PHY

--------------060201090700040904030903--

--------------enigAE848947F2CD79EB6652402B
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE9prxOfuToMruuMARA4iLAJ961ymlLvsz11CyAEKhKgrJTwqo5ACfXV33
5Djc2dw8nYWHp5Avr3aXT+c=
=IsqI
-----END PGP SIGNATURE-----

--------------enigAE848947F2CD79EB6652402B--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44F69AF1.5090205>