diff options
author | mdodd <mdodd@FreeBSD.org> | 2000-01-15 05:21:43 +0000 |
---|---|---|
committer | mdodd <mdodd@FreeBSD.org> | 2000-01-15 05:21:43 +0000 |
commit | 7bf29ac9f9661300db9a7fd2022c42900b4f542d (patch) | |
tree | edfd51cc9b88ef2feb90185da0408316b41552bc /sys/dev | |
parent | ef76bd553b66e64952bc8185d013bc4f4039b847 (diff) | |
download | FreeBSD-src-7bf29ac9f9661300db9a7fd2022c42900b4f542d.zip FreeBSD-src-7bf29ac9f9661300db9a7fd2022c42900b4f542d.tar.gz |
Fix driver to restore function on 3c574 adapters. The panic on
ifconfig and bogus ethernet address (4b:57:4b:57:4b:57) has been
hacked around. I'll revisit this when I have a clue whats going on.
Reviewed by: obrien
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ep/if_ep.c | 25 | ||||
-rw-r--r-- | sys/dev/ep/if_ep_pccard.c | 6 | ||||
-rw-r--r-- | sys/dev/ep/if_epvar.h | 1 |
3 files changed, 23 insertions, 9 deletions
diff --git a/sys/dev/ep/if_ep.c b/sys/dev/ep/if_ep.c index 7c5d2ff..de0dd28 100644 --- a/sys/dev/ep/if_ep.c +++ b/sys/dev/ep/if_ep.c @@ -112,7 +112,6 @@ static void ep_if_watchdog __P((struct ifnet *)); static int ep_ifmedia_upd __P((struct ifnet *)); static void ep_ifmedia_sts __P((struct ifnet *, struct ifmediareq *)); -static void ep_get_macaddr __P((struct ep_softc *, u_char *)); static void epstop __P((struct ep_softc *)); static void epread __P((struct ep_softc *)); static int eeprom_rdy __P((struct ep_softc *)); @@ -127,8 +126,9 @@ eeprom_rdy(sc) { int i; - for (i = 0; is_eeprom_busy(BASE) && i < MAX_EEPROMBUSY; i++) - continue; + for (i = 0; is_eeprom_busy(BASE) && i < MAX_EEPROMBUSY; i++) { + DELAY(100); + } if (i >= MAX_EEPROMBUSY) { printf("ep%d: eeprom failed to come ready.\n", sc->unit); return (0); @@ -143,17 +143,17 @@ eeprom_rdy(sc) u_int16_t get_e(sc, offset) struct ep_softc *sc; - int offset; + u_int16_t offset; { if (!eeprom_rdy(sc)) - return (0xffff); + return (0); outw(BASE + EP_W0_EEPROM_COMMAND, (EEPROM_CMD_RD << sc->epb.cmd_off) | offset); if (!eeprom_rdy(sc)) - return (0xffff); + return (0); return (inw(BASE + EP_W0_EEPROM_DATA)); } -static void +void ep_get_macaddr(sc, addr) struct ep_softc * sc; u_char * addr; @@ -206,6 +206,7 @@ ep_alloc(device_t dev) sc->ep_connectors = 0; sc->ep_connector = 0; + GO_WINDOW(0); sc->epb.cmd_off = 0; sc->epb.prod_id = get_e(sc, EEPROM_PROD_ID); sc->epb.res_cfg = get_e(sc, EEPROM_RESOURCE_CFG); @@ -397,7 +398,9 @@ ep_if_init(xsc) outw(BASE + EP_COMMAND, SET_RX_FILTER | FIL_INDIVIDUAL | FIL_GROUP | FIL_BRDCST); - ep_ifmedia_upd(ifp); + if (!sc->epb.mii_trans) { + ep_ifmedia_upd(ifp); + } outw(BASE + EP_COMMAND, RX_ENABLE); outw(BASE + EP_COMMAND, TX_ENABLE); @@ -925,7 +928,11 @@ ep_if_ioctl(ifp, cmd, data) break; case SIOCSIFMEDIA: case SIOCGIFMEDIA: - error = ifmedia_ioctl(ifp, ifr, &sc->ifmedia, cmd); + if (!sc->epb.mii_trans) { + error = ifmedia_ioctl(ifp, ifr, &sc->ifmedia, cmd); + } else { + error = EINVAL; + } break; default: error = EINVAL; diff --git a/sys/dev/ep/if_ep_pccard.c b/sys/dev/ep/if_ep_pccard.c index 037af33..30eefb20 100644 --- a/sys/dev/ep/if_ep_pccard.c +++ b/sys/dev/ep/if_ep_pccard.c @@ -98,6 +98,12 @@ ep_pccard_probe(device_t dev) } } device_set_desc(dev, desc); + + /* + * For some reason the 3c574 needs this. + */ + ep_get_macaddr(sc, (u_char *)&sc->arpcom.ac_enaddr); + ep_free(dev); return (0); } diff --git a/sys/dev/ep/if_epvar.h b/sys/dev/ep/if_epvar.h index 397a6b9..9329e27 100644 --- a/sys/dev/ep/if_epvar.h +++ b/sys/dev/ep/if_epvar.h @@ -81,3 +81,4 @@ void ep_get_media (struct ep_softc *); int ep_attach (struct ep_softc *); void ep_intr (void *); u_int16_t get_e (struct ep_softc *, int); +void ep_get_macaddr (struct ep_softc *, u_char *); |