From c4529f416185f13ab20bda5ac8281f441ad682f9 Mon Sep 17 00:00:00 2001 From: Michael Reifenberger Date: Tue, 25 Apr 2006 15:56:52 +0000 Subject: [PATCH] make BGE_FAKE_AUTONEG a tunable. This allows one to change the behavior of the driver pre-boot. NOTE: This patch was made for DragonFly BSD by Sepherosa Ziehau. PR: kern/94833 Submitted by: Devon H. O'Dell Obtained from: DragonFly MFC after: 1 month --- sys/conf/options | 3 --- sys/dev/bge/if_bge.c | 8 +++++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/sys/conf/options b/sys/conf/options index ef1664d69faa..083339082892 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -640,9 +640,6 @@ ED_SIC opt_ed.h # bce driver BCE_DEBUG opt_bce.h -# bge driver -BGE_FAKE_AUTONEG opt_bge.h - # wi driver WI_SYMBOL_FIRMWARE opt_wi.h diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c index 0a30a31afa19..1ed2ceda76ee 100644 --- a/sys/dev/bge/if_bge.c +++ b/sys/dev/bge/if_bge.c @@ -306,6 +306,9 @@ static devclass_t bge_devclass; 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; +TUNABLE_INT("hw.bge.fake_autoneg", &bge_fake_autoneg); + static u_int32_t bge_readmem_ind(sc, off) struct bge_softc *sc; @@ -3341,13 +3344,13 @@ bge_ifmedia_upd(ifp) return(EINVAL); switch(IFM_SUBTYPE(ifm->ifm_media)) { case IFM_AUTO: -#ifndef BGE_FAKE_AUTONEG /* * The BCM5704 ASIC appears to have a special * mechanism for programming the autoneg * advertisement registers in TBI mode. */ - if (sc->bge_asicrev == BGE_ASICREV_BCM5704) { + if (bge_fake_autoneg == 0 && + 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); @@ -3359,7 +3362,6 @@ bge_ifmedia_upd(ifp) DELAY(5); CSR_WRITE_4(sc, BGE_SGDIG_CFG, sgdig); } -#endif break; case IFM_1000_SX: if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX) {