diff options
author | Jason Wright <jason@cvs.openbsd.org> | 1998-09-29 02:14:30 +0000 |
---|---|---|
committer | Jason Wright <jason@cvs.openbsd.org> | 1998-09-29 02:14:30 +0000 |
commit | b99c022ac52cacfe900228889fabc33a251894dd (patch) | |
tree | 22cf1d1e9e628fd7366f911ffad11c03d0b02458 /sys/dev/pci/if_xl.c | |
parent | 356d663415d88b2c5a5e9d90427a8e98a8587fbd (diff) |
Merge with FreeBSD: if_xlreg.h(1.5) & if_xl.c(1.12)
o workaround for ifmedia_set panic
o make sure tx isn't wedged if tx queue is full
o increase TX queue from 10 -> 16 descriptors
Diffstat (limited to 'sys/dev/pci/if_xl.c')
-rw-r--r-- | sys/dev/pci/if_xl.c | 57 |
1 files changed, 33 insertions, 24 deletions
diff --git a/sys/dev/pci/if_xl.c b/sys/dev/pci/if_xl.c index 2c598717880..e0231c4cee5 100644 --- a/sys/dev/pci/if_xl.c +++ b/sys/dev/pci/if_xl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_xl.c,v 1.10 1998/09/23 20:48:46 jason Exp $ */ +/* $OpenBSD: if_xl.c,v 1.11 1998/09/29 02:14:29 jason Exp $ */ /* * Copyright (c) 1997, 1998 @@ -31,7 +31,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: if_xl.c,v 1.11 1998/09/08 23:42:10 wpaul Exp $ + * $FreeBSD: if_xl.c,v 1.12 1998/09/25 17:34:19 wpaul Exp $ */ /* @@ -194,7 +194,7 @@ #if !defined(lint) && !defined(__OpenBSD__) static char rcsid[] = - "$FreeBSD: if_xl.c,v 1.11 1998/09/08 23:42:10 wpaul Exp $"; + "$FreeBSD: if_xl.c,v 1.12 1998/09/25 17:34:19 wpaul Exp $"; #endif #ifdef __FreeBSD__ @@ -871,6 +871,14 @@ static void xl_autoneg_mii(sc, flag, verbose) if (verbose) printf("xl%d: autonegotiation not supported\n", sc->xl_unit); + ifm->ifm_media = IFM_ETHER|IFM_10_T|IFM_HDX; + media = xl_phy_readreg(sc, PHY_BMCR); + media &= ~PHY_BMCR_SPEEDSEL; + media &= ~PHY_BMCR_DUPLEX; + xl_phy_writereg(sc, PHY_BMCR, media); + CSR_WRITE_1(sc, XL_W3_MAC_CTRL, + (CSR_READ_1(sc, XL_W3_MAC_CTRL) & + ~XL_MACCTRL_DUPLEX)); return; } #endif @@ -972,7 +980,14 @@ static void xl_autoneg_mii(sc, flag, verbose) xl_phy_writereg(sc, PHY_BMCR, media); } else { if (verbose) - printf("no carrier\n"); + printf("no carrier (forcing half-duplex, 10Mbps)\n"); + ifm->ifm_media = IFM_ETHER|IFM_10_T|IFM_HDX; + media &= ~PHY_BMCR_SPEEDSEL; + media &= ~PHY_BMCR_DUPLEX; + xl_phy_writereg(sc, PHY_BMCR, media); + CSR_WRITE_1(sc, XL_W3_MAC_CTRL, + (CSR_READ_1(sc, XL_W3_MAC_CTRL) & + ~XL_MACCTRL_DUPLEX)); } xl_init(sc); @@ -1705,12 +1720,12 @@ xl_attach(config_id, unit) xl_setmode(sc, media); break; case XL_XCVR_AUTO: - media = IFM_ETHER|IFM_AUTO; #ifdef XL_BACKGROUND_AUTONEG xl_autoneg_mii(sc, XL_FLAG_SCHEDDELAY, 1); #else xl_autoneg_mii(sc, XL_FLAG_FORCEDELAY, 1); #endif + media = sc->ifmedia.ifm_media; break; case XL_XCVR_100BTX: case XL_XCVR_MII: @@ -2322,28 +2337,16 @@ static void xl_start(ifp) } /* - * If the OACTIVE flag is set, make sure the transmitter - * isn't wedged. Call the txeoc handler to make sure the - * transmitter is enabled and then call the txeof handler - * to see if any descriptors can be reclaimed and reload - * the downlist pointer register if necessary. If after - * that the OACTIVE flag is still set, return, otherwise - * proceed and queue up some more frames. - */ - if (ifp->if_flags & IFF_OACTIVE) { - xl_txeoc(sc); - xl_txeof(sc); - if (ifp->if_flags & IFF_OACTIVE) - return; - } - - /* * Check for an available queue slot. If there are none, * punt. */ if (sc->xl_cdata.xl_tx_free == NULL) { - ifp->if_flags |= IFF_OACTIVE; - return; + xl_txeoc(sc); + xl_txeof(sc); + if (sc->xl_cdata.xl_tx_free == NULL) { + ifp->if_flags |= IFF_OACTIVE; + return; + } } start_tx = sc->xl_cdata.xl_tx_free; @@ -2817,6 +2820,12 @@ static void xl_watchdog(ifp) printf("xl%d: no carrier - transceiver cable problem?\n", sc->xl_unit); xl_txeoc(sc); + xl_txeof(sc); + xl_rxeof(sc); + xl_init(sc); + + if (ifp->if_snd.ifq_head != NULL) + xl_start(ifp); return; } @@ -3270,12 +3279,12 @@ xl_attach(parent, self, aux) xl_setmode(sc, media); break; case XL_XCVR_AUTO: - media = IFM_ETHER|IFM_AUTO; #ifdef XL_BACKGROUND_AUTONEG xl_autoneg_mii(sc, XL_FLAG_SCHEDDELAY, 1); #else xl_autoneg_mii(sc, XL_FLAG_FORCEDELAY, 1); #endif + media = sc->ifmedia.ifm_media; break; case XL_XCVR_100BTX: case XL_XCVR_MII: |