diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2005-04-30 19:24:01 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2005-04-30 19:24:01 +0000 |
commit | 0595aee715987bfd0dd0e5bd9cb72f9d6262ab7c (patch) | |
tree | 7f6a5d75858d548d73028b464b676c0339900a4b /sys/dev | |
parent | 45c34dfcf4328bf70c93243bbfaceb50126db088 (diff) |
- Correct the if_link_state_change() logic.
- Reading the EEPROM to learn the station address doesn't seem to work
on boards with VIA gigE controllers that are embedded in VIA chipsets.
Presumably, they don't have an external EEPROM and store the MAC
address somewhere else. To get around this, read the station
address from the RX filter registers instead. This has been tested
to work on both embedded and standalone controllers.
From FreeBSD
ok pvalchev@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/if_vge.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sys/dev/pci/if_vge.c b/sys/dev/pci/if_vge.c index 92c814f5389..fb8bae660d8 100644 --- a/sys/dev/pci/if_vge.c +++ b/sys/dev/pci/if_vge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vge.c,v 1.11 2005/04/25 17:55:51 brad Exp $ */ +/* $OpenBSD: if_vge.c,v 1.12 2005/04/30 19:24:00 brad Exp $ */ /* $FreeBSD: if_vge.c,v 1.3 2004/09/11 22:13:25 wpaul Exp $ */ /* * Copyright (c) 2004 @@ -146,7 +146,9 @@ void vge_watchdog (struct ifnet *); int vge_ifmedia_upd (struct ifnet *); void vge_ifmedia_sts (struct ifnet *, struct ifmediareq *); +#ifdef VGE_EEPROM void vge_eeprom_getword (struct vge_softc *, int, u_int16_t *); +#endif void vge_read_eeprom (struct vge_softc *, caddr_t, int, int, int); void vge_miipoll_start (struct vge_softc *); @@ -179,6 +181,7 @@ const struct pci_matchid vge_devices[] = { { PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT612x }, }; +#ifdef VGE_EEPROM /* * Read a word of data stored in the EEPROM at address 'addr.' */ @@ -223,6 +226,7 @@ vge_eeprom_getword(struct vge_softc *sc, int addr, u_int16_t *dest) *dest = word; } +#endif /* * Read a sequence of words from the EEPROM. @@ -232,6 +236,7 @@ vge_read_eeprom(struct vge_softc *sc, caddr_t dest, int off, int cnt, int swap) { int i; +#ifdef VGE_EEPROM u_int16_t word = 0, *ptr; for (i = 0; i < cnt; i++) { @@ -242,6 +247,10 @@ vge_read_eeprom(struct vge_softc *sc, caddr_t dest, int off, int cnt, else *ptr = word; } +#else + for (i = 0; i < ETHER_ADDR_LEN; i++) + dest[i] = CSR_READ_1(sc, VGE_PAR0 + i); +#endif } void @@ -1229,13 +1238,13 @@ vge_tick(void *xsc) if (sc->vge_link) { if (!(mii->mii_media_status & IFM_ACTIVE)) sc->vge_link = 0; - ifp->if_link_state = LINK_STATE_UP; + ifp->if_link_state = LINK_STATE_DOWN; if_link_state_change(ifp); } else { if (mii->mii_media_status & IFM_ACTIVE && IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { sc->vge_link = 1; - ifp->if_link_state = LINK_STATE_DOWN; + ifp->if_link_state = LINK_STATE_UP; if_link_state_change(ifp); if (!IFQ_IS_EMPTY(&ifp->if_snd)) vge_start(ifp); |