Date: Wed, 2 May 2007 13:09:27 -0400 From: Jung-uk Kim <jkim@FreeBSD.org> To: freebsd-net@FreeBSD.org Subject: [PATCH] hw.bge.fake_autoneg removal for bge(4) Message-ID: <200705021309.28908.jkim@FreeBSD.org>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
I think I have found a way to get rid of infamous
'hw.bge.fake_autoneg' tunable for BCM5704S. The patch works for me
but I'd like to see more test results in various environments. If
you have one of those BCM5704S (fiber) and set
'hw.bge.fake_autoneg="1"' in your /boot/loader.conf, please test and
let me know.
Thanks,
Jung-uk Kim
[-- Attachment #2 --]
Index: sys/dev/bge/if_bge.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/bge/if_bge.c,v
retrieving revision 1.189
diff -u -r1.189 if_bge.c
--- sys/dev/bge/if_bge.c 1 May 2007 19:18:12 -0000 1.189
+++ sys/dev/bge/if_bge.c 2 May 2007 16:58:29 -0000
@@ -424,15 +424,11 @@
DRIVER_MODULE(bge, pci, bge_driver, bge_devclass, 0, 0);
DRIVER_MODULE(miibus, bge, miibus_driver, miibus_devclass, 0, 0);
-static int bge_fake_autoneg = 0;
static int bge_allow_asf = 1;
-TUNABLE_INT("hw.bge.fake_autoneg", &bge_fake_autoneg);
TUNABLE_INT("hw.bge.allow_asf", &bge_allow_asf);
SYSCTL_NODE(_hw, OID_AUTO, bge, CTLFLAG_RD, 0, "BGE driver parameters");
-SYSCTL_INT(_hw_bge, OID_AUTO, fake_autoneg, CTLFLAG_RD, &bge_fake_autoneg, 0,
- "Enable fake autonegotiation for certain blade systems");
SYSCTL_INT(_hw_bge, OID_AUTO, allow_asf, CTLFLAG_RD, &bge_allow_asf, 0,
"Allow ASF mode if available");
@@ -3732,18 +3728,20 @@
* mechanism for programming the autoneg
* advertisement registers in TBI mode.
*/
- if (bge_fake_autoneg == 0 &&
- sc->bge_asicrev == BGE_ASICREV_BCM5704) {
+ if (sc->bge_asicrev == BGE_ASICREV_BCM5704) {
uint32_t sgdig;
- CSR_WRITE_4(sc, BGE_TX_TBI_AUTONEG, 0);
- sgdig = CSR_READ_4(sc, BGE_SGDIG_CFG);
- sgdig |= BGE_SGDIGCFG_AUTO |
- BGE_SGDIGCFG_PAUSE_CAP |
- BGE_SGDIGCFG_ASYM_PAUSE;
- CSR_WRITE_4(sc, BGE_SGDIG_CFG,
- sgdig | BGE_SGDIGCFG_SEND);
- DELAY(5);
- CSR_WRITE_4(sc, BGE_SGDIG_CFG, sgdig);
+ sgdig = CSR_READ_4(sc, BGE_SGDIG_STS);
+ if (sgdig & BGE_SGDIGSTS_DONE) {
+ CSR_WRITE_4(sc, BGE_TX_TBI_AUTONEG, 0);
+ sgdig = CSR_READ_4(sc, BGE_SGDIG_CFG);
+ sgdig |= BGE_SGDIGCFG_AUTO |
+ BGE_SGDIGCFG_PAUSE_CAP |
+ BGE_SGDIGCFG_ASYM_PAUSE;
+ CSR_WRITE_4(sc, BGE_SGDIG_CFG,
+ sgdig | BGE_SGDIGCFG_SEND);
+ DELAY(5);
+ CSR_WRITE_4(sc, BGE_SGDIG_CFG, sgdig);
+ }
}
break;
case IFM_1000_SX:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200705021309.28908.jkim>
