Date: Wed, 30 Aug 2006 23:16:38 +0200 From: Patrick Hurrelmann <outi@bytephobia.de> To: David Christensen <davidch@broadcom.com> Cc: freebsd-current@freebsd.org, LI Xin <delphij@delphij.net> Subject: Re: bge(4) on BCM 5752 A02 panic due to media autoselect Message-ID: <44F60036.7030105@bytephobia.de> In-Reply-To: <09BFF2FA5EAB4A45B6655E151BBDD90301E2F1CF@NT-IRVA-0750.brcm.ad.broadcom.com> References: <09BFF2FA5EAB4A45B6655E151BBDD90301E2F1CF@NT-IRVA-0750.brcm.ad.broadcom.com>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------020304090702080801070901 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit David Christensen wrote: >> Recently one of my colleagues found that BCM 5752 A02 on Dell Latitude >> D820 would get "panic: invalid ife->ifm_data (0xa) in >> mii_phy_setmedia". >> After some investigation I have found that removing BCMR_ANEG from >> mii_capabilities in ukphy.c would work around the problem, >> and it turns >> out that without explicitly specifying media type, the code >> 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 >> said to work >> there, though. Is there anyone can shed some light to me about how 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 >> like to see >> if there is someone to give appropriate review for it. > > Try the attached patch instead and let me know if it works. When > FastBoot > is enabled on supported Broadcom controllers it allows the controller to > skip rereading firmware after a reset, allowing the driver to complete > its initialization more quickly. The Linux driver specifically disables > FastBoot because it performs some read/write tests to controller memory, > potentially corrupting the firmware, so FastBoot is disabled to insure > 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 initializes > too fast for the driver. > > Dave > > > ------------------------------------------------------------------------ > > Index: if_bge.c > =================================================================== > RCS file: /home/ncvs/src/sys/dev/bge/if_bge.c,v > retrieving revision 1.140 > diff -p -u -r1.140 if_bge.c > --- if_bge.c 24 Aug 2006 14:41:16 -0000 1.140 > +++ if_bge.c 30 Aug 2006 18:50:19 -0000 > @@ -2326,6 +2326,12 @@ bge_reset(struct bge_softc *sc) > } > } > > + /* > + * 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); > > @@ -2362,11 +2368,6 @@ bge_reset(struct bge_softc *sc) > CSR_WRITE_4(sc, BGE_MARB_MODE, BGE_MARBMODE_ENABLE); > > /* > - * 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: if_bgereg.h > =================================================================== > RCS file: /home/ncvs/src/sys/dev/bge/if_bgereg.h,v > retrieving revision 1.52 > diff -p -u -r1.52 if_bgereg.h > --- if_bgereg.h 23 Aug 2006 11:32:54 -0000 1.52 > +++ if_bgereg.h 30 Aug 2006 18:50:20 -0000 > @@ -1768,10 +1768,11 @@ > } while(0) > > /* > - * 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 > > > > ------------------------------------------------------------------------ > > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" Try making the bge card attach to brgphy instead of ukphy. This fixed the panic for and a Dell Latidue D620. The only remaining issue were the annoying messages of "firmware handshake timeout". I'll try the patch for that tomorrow. I have a local patch to workaround the panic. Maybe you can try it. A different and probably more complete one is floating on stable@. -- ==================================================================== Patrick Hurrelmann | "Programming today is a race between software Mannheim, Germany | engineers striving to build bigger and better | idiot-proof programs, and the Universe trying outi@bytephobia.de | to produce bigger and better idiots. So far, www.bytephobia.de | the Universe is winning." - Rich Cook /"\ \ / ASCII Ribbon Campaign X against HTML email & vCards / \ --------------020304090702080801070901 Content-Type: text/x-patch; name="bge.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="bge.diff" diff -ruN /usr/src/sys/dev/mii/brgphy.c /usr/src.old/sys/dev/mii/brgphy.c --- /usr/src/sys/dev/mii/brgphy.c Mon Jul 3 10:01:27 2006 +++ /usr/src.old/sys/dev/mii/brgphy.c Sat Jul 15 16:04:18 2006 @@ -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: diff -ruN /usr/src/sys/dev/mii/miidevs /usr/src.old/sys/dev/mii/miidevs --- /usr/src/sys/dev/mii/miidevs Mon Apr 10 21:55:23 2006 +++ /usr/src.old/sys/dev/mii/miidevs Sat Jul 15 16:04:18 2006 @@ -117,6 +117,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 --------------020304090702080801070901--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44F60036.7030105>