Date: Fri, 24 Mar 1995 17:52:52 -0500 (GMT-0500) From: "Serge A. Babkin" <babkin@hq.icb.chel.su> To: davidg@Root.COM Cc: mmead@goof.com, freebsd-hackers@FreeBSD.org Subject: Re: Fix for 3C509 (ep) driver Message-ID: <199503242252.RAA01136@hq.icb.chel.su> In-Reply-To: <199503230451.UAA02437@corbin.Root.COM> from "David Greenman" at Mar 22, 95 08:51:37 pm
next in thread | previous in thread | raw e-mail | index | archive | help
I have fixed another bug in 3C509 driver that prevents FBSD from network booting through other connectors than BNC. Now it will use transceiver specified in the EEPROM instead of select based on interface flags. Here is context diff for /usr/src/sys/i386/isa/* (relative to 2.0-950210-SNAP): *** 1.1 1995/03/24 12:12:08 --- if_ep.c 1995/03/24 12:38:58 *************** *** 37,42 **** --- 37,54 ---- * avega@sophia.inria.fr */ + /* + * March 24 1995 + * + * Promiscuous mode added and interrupt logic slightly changed + * to reduce the number of adapter failures. Transceiver select + * logic changed to use value from EEPROM. + * Done by: + * Serge Babkin + * Chelindbank (Chelyabinsk, Russia) + * babkin@hq.icb.chel.su + */ + #include "ep.h" #if NEP > 0 *************** *** 308,314 **** sc->ep_connectors = 0; i = inw(IS_BASE + EP_W0_CONFIG_CTRL); ! j = inw(IS_BASE + EP_W0_ADDRESS_CFG) >> 14; if (i & IS_AUI) { printf("aui"); sc->ep_connectors |= AUI; --- 320,326 ---- sc->ep_connectors = 0; i = inw(IS_BASE + EP_W0_CONFIG_CTRL); ! j = inw(IS_BASE + EP_W0_ADDRESS_CFG) >> ACF_CONNECTOR_BITS; if (i & IS_AUI) { printf("aui"); sc->ep_connectors |= AUI; *************** *** 414,420 **** { register struct ep_softc *sc = &ep_softc[unit]; register struct ifnet *ifp = &sc->arpcom.ac_if; ! int s, i; if (ifp->if_addrlist == (struct ifaddr *) 0) return; --- 426,432 ---- { register struct ep_softc *sc = &ep_softc[unit]; register struct ifnet *ifp = &sc->arpcom.ac_if; ! int s, i, j; if (ifp->if_addrlist == (struct ifaddr *) 0) return; *************** *** 451,458 **** outw(BASE + EP_COMMAND, SET_INTR_MASK | S_5_INTS); ! outw(BASE + EP_COMMAND, SET_RX_FILTER | FIL_INDIVIDUAL | ! FIL_GROUP | FIL_BRDCST); /* * you can `ifconfig ep0 (bnc|aui)' to get the following --- 463,474 ---- outw(BASE + EP_COMMAND, SET_INTR_MASK | S_5_INTS); ! if(ep_ftst(F_PROMISC)) ! outw(BASE + EP_COMMAND, SET_RX_FILTER | FIL_INDIVIDUAL | ! FIL_GROUP | FIL_BRDCST | FIL_ALL); ! else ! outw(BASE + EP_COMMAND, SET_RX_FILTER | FIL_INDIVIDUAL | ! FIL_GROUP | FIL_BRDCST); /* * you can `ifconfig ep0 (bnc|aui)' to get the following *************** *** 463,485 **** * seems you have to be careful to not plug things * into both AUI & UTP. */ ! #if defined(__NetBSD__) ! if (!(ifp->if_flags & IFF_LINK0) && (sc->ep_connectors & BNC)) { ! #else ! if (!(ifp->if_flags & IFF_ALTPHYS) && (sc->ep_connectors & BNC)) { ! #endif ! outw(BASE + EP_COMMAND, START_TRANSCEIVER); ! DELAY(1000); ! } ! #if defined(__NetBSD__) ! if ((ifp->if_flags & IFF_LINK0) && (sc->ep_connectors & UTP)) { ! #else ! if ((ifp->if_flags & IFF_ALTPHYS) && (sc->ep_connectors & UTP)) { ! #endif ! GO_WINDOW(4); ! outw(BASE + EP_W4_MEDIA_TYPE, ENABLE_UTP); ! GO_WINDOW(1); ! } outw(BASE + EP_COMMAND, RX_ENABLE); outw(BASE + EP_COMMAND, TX_ENABLE); --- 479,518 ---- * seems you have to be careful to not plug things * into both AUI & UTP. */ ! ! /* ! * S.B. ! * ! * Now behavior was slightly changed: ! * connector specified in the EEPROM is used ! * anyway (if present on card or AUI if not). ! * ! */ ! ! j = inw(BASE + EP_W0_ADDRESS_CFG) >> ACF_CONNECTOR_BITS; ! switch(j) { ! case ACF_CONNECTOR_UTP: ! if(sc->ep_connectors & UTP) { ! GO_WINDOW(4); ! outw(BASE + EP_W4_MEDIA_TYPE, ENABLE_UTP); ! GO_WINDOW(1); ! } ! break; ! case ACF_CONNECTOR_BNC: ! if(sc->ep_connectors & BNC) { ! outw(BASE + EP_COMMAND, START_TRANSCEIVER); ! DELAY(1000); ! } ! break; ! case ACF_CONNECTOR_AUI: ! /* nothing to do */ ! break; ! default: ! printf("ep%d: strange connector type in EEPROM: assuming AUI\n", ! unit); ! break; ! } ! outw(BASE + EP_COMMAND, RX_ENABLE); outw(BASE + EP_COMMAND, TX_ENABLE); *************** *** 643,650 **** struct ifnet *ifp = &sc->arpcom.ac_if; struct mbuf *m; ! outw(BASE + EP_COMMAND, SET_INTR_MASK); /* disable all Ints */ ! outw(BASE + EP_COMMAND, C_INTR_LATCH); /* ACK int Latch */ while ((status = inw(BASE + EP_STATUS)) & S_5_INTS) { if (status & (S_RX_COMPLETE | S_RX_EARLY)) { --- 676,683 ---- struct ifnet *ifp = &sc->arpcom.ac_if; struct mbuf *m; ! rescan: ! /* outw(BASE + EP_COMMAND, SET_INTR_MASK); /* disable all Ints */ while ((status = inw(BASE + EP_STATUS)) & S_5_INTS) { if (status & (S_RX_COMPLETE | S_RX_EARLY)) { *************** *** 672,678 **** sc->rx_no_first, sc->rx_no_mbuf, sc->rx_bpf_disc, sc->rx_overrunf, sc->rx_overrunl, sc->tx_underrun); #else ! printf("ep%d: Status: %x\n", unit, status); #endif epinit(unit); return; --- 705,711 ---- sc->rx_no_first, sc->rx_no_mbuf, sc->rx_bpf_disc, sc->rx_overrunf, sc->rx_overrunl, sc->tx_underrun); #else ! printf("ep%d: Status: %x\n", unit, status); #endif epinit(unit); return; *************** *** 716,722 **** } /* end TX_COMPLETE */ } /* re-enable ints */ ! outw(BASE + EP_COMMAND, SET_INTR_MASK | S_5_INTS); } void --- 749,760 ---- } /* end TX_COMPLETE */ } /* re-enable ints */ ! /* outw(BASE + EP_COMMAND, SET_INTR_MASK | S_5_INTS); */ ! ! outw(BASE + EP_COMMAND, C_INTR_LATCH); /* ACK int Latch */ ! ! if ((status = inw(BASE + EP_STATUS)) & S_5_INTS) ! goto rescan; } void *************** *** 1016,1021 **** --- 1054,1069 ---- } if (ifp->if_flags & IFF_UP && (ifp->if_flags & IFF_RUNNING) == 0) epinit(ifp->if_unit); + + if ( (ifp->if_flags & IFF_PROMISC) && !ep_ftst(F_PROMISC) ) { + ep_fset(F_PROMISC); + epinit(ifp->if_unit); + } + else if( !(ifp->if_flags & IFF_PROMISC) && ep_ftst(F_PROMISC) ) { + ep_frst(F_PROMISC); + epinit(ifp->if_unit); + } + break; #ifdef notdef case SIOCGHWADDR: *** 1.1 1995/03/24 12:12:08 --- if_epreg.h 1995/03/24 12:39:24 *************** *** 30,35 **** --- 30,46 ---- finger: avega@pax.inria.fr */ + /* + * March 24 1995 + * + * Promiscuous mode added and interrupt logic slightly changed + * to reduce the number of adapter failures. Transceiver select + * logic changed to use value from EEPROM. + * Done by: + * Serge Babkin + * Chelindbank (Chelyabinsk, Russia) + * babkin@hq.icb.chel.su + */ /* * Ethernet software status per interface. *************** *** 55,60 **** --- 66,72 ---- #define F_RX_FIRST 0x1 #define F_WAIT_TRAIL 0x2 #define F_RX_TRAILER 0x4 + #define F_PROMISC 0x8 #define F_ACCESS_32_BITS 0x100 *************** *** 316,321 **** --- 328,343 ---- #define S_5_INTS (S_CARD_FAILURE|S_TX_COMPLETE|\ S_TX_AVAIL|S_RX_COMPLETE|S_RX_EARLY) #define S_COMMAND_IN_PROGRESS (u_short) (0x1000) + + /* Address Config. Register. + * Window 0/Port 06 + */ + + #define ACF_CONNECTOR_BITS 14 + #define ACF_CONNECTOR_UTP 0 + #define ACF_CONNECTOR_AUI 1 + #define ACF_CONNECTOR_BNC 3 + /* * FIFO Registers. Serge Babkin ! (babkin@hq.icb.chel.su) ! Headquarter of Joint Stock Bank "Chelindbank" ! Chelyabinsk, Russia
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199503242252.RAA01136>