if_sf.c (142398) | if_sf.c (142407) |
---|---|
1/*- 2 * Copyright (c) 1997, 1998, 1999 3 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30 * THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1997, 1998, 1999 3 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30 * THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/dev/sf/if_sf.c 142398 2005-02-24 21:32:56Z imp $"); | 34__FBSDID("$FreeBSD: head/sys/dev/sf/if_sf.c 142407 2005-02-24 22:33:05Z imp $"); |
35 36/* 37 * Adaptec AIC-6915 "Starfire" PCI fast ethernet driver for FreeBSD. 38 * Programming manual is available from: 39 * http://download.adaptec.com/pdfs/user_guides/aic6915_pg.pdf. 40 * 41 * Written by Bill Paul <wpaul@ctr.columbia.edu> 42 * Department of Electical Engineering --- 80 unchanged lines hidden (view full) --- 123MODULE_DEPEND(sf, miibus, 1, 1, 1); 124 125static struct sf_type sf_devs[] = { 126 { AD_VENDORID, AD_DEVICEID_STARFIRE, 127 "Adaptec AIC-6915 10/100BaseTX" }, 128 { 0, 0, NULL } 129}; 130 | 35 36/* 37 * Adaptec AIC-6915 "Starfire" PCI fast ethernet driver for FreeBSD. 38 * Programming manual is available from: 39 * http://download.adaptec.com/pdfs/user_guides/aic6915_pg.pdf. 40 * 41 * Written by Bill Paul <wpaul@ctr.columbia.edu> 42 * Department of Electical Engineering --- 80 unchanged lines hidden (view full) --- 123MODULE_DEPEND(sf, miibus, 1, 1, 1); 124 125static struct sf_type sf_devs[] = { 126 { AD_VENDORID, AD_DEVICEID_STARFIRE, 127 "Adaptec AIC-6915 10/100BaseTX" }, 128 { 0, 0, NULL } 129}; 130 |
131static int sf_probe (device_t); 132static int sf_attach (device_t); 133static int sf_detach (device_t); 134static void sf_intr (void *); 135static void sf_stats_update (void *); 136static void sf_rxeof (struct sf_softc *); 137static void sf_txeof (struct sf_softc *); 138static int sf_encap (struct sf_softc *, 139 struct sf_tx_bufdesc_type0 *, 140 struct mbuf *); 141static void sf_start (struct ifnet *); 142static int sf_ioctl (struct ifnet *, u_long, caddr_t); 143static void sf_init (void *); 144static void sf_stop (struct sf_softc *); 145static void sf_watchdog (struct ifnet *); 146static void sf_shutdown (device_t); 147static int sf_ifmedia_upd (struct ifnet *); 148static void sf_ifmedia_sts (struct ifnet *, struct ifmediareq *); 149static void sf_reset (struct sf_softc *); 150static int sf_init_rx_ring (struct sf_softc *); 151static void sf_init_tx_ring (struct sf_softc *); 152static int sf_newbuf (struct sf_softc *, 153 struct sf_rx_bufdesc_type0 *, 154 struct mbuf *); 155static void sf_setmulti (struct sf_softc *); 156static int sf_setperf (struct sf_softc *, int, caddr_t); 157static int sf_sethash (struct sf_softc *, caddr_t, int); | 131static int sf_probe(device_t); 132static int sf_attach(device_t); 133static int sf_detach(device_t); 134static void sf_intr(void *); 135static void sf_stats_update(void *); 136static void sf_rxeof(struct sf_softc *); 137static void sf_txeof(struct sf_softc *); 138static int sf_encap(struct sf_softc *, struct sf_tx_bufdesc_type0 *, 139 struct mbuf *); 140static void sf_start(struct ifnet *); 141static int sf_ioctl(struct ifnet *, u_long, caddr_t); 142static void sf_init(void *); 143static void sf_stop(struct sf_softc *); 144static void sf_watchdog(struct ifnet *); 145static void sf_shutdown(device_t); 146static int sf_ifmedia_upd(struct ifnet *); 147static void sf_ifmedia_sts(struct ifnet *, struct ifmediareq *); 148static void sf_reset(struct sf_softc *); 149static int sf_init_rx_ring(struct sf_softc *); 150static void sf_init_tx_ring(struct sf_softc *); 151static int sf_newbuf(struct sf_softc *, struct sf_rx_bufdesc_type0 *, 152 struct mbuf *); 153static void sf_setmulti(struct sf_softc *); 154static int sf_setperf(struct sf_softc *, int, caddr_t); 155static int sf_sethash(struct sf_softc *, caddr_t, int); |
158#ifdef notdef | 156#ifdef notdef |
159static int sf_setvlan (struct sf_softc *, int, u_int32_t); | 157static int sf_setvlan(struct sf_softc *, int, u_int32_t); |
160#endif 161 | 158#endif 159 |
162static u_int8_t sf_read_eeprom (struct sf_softc *, int); | 160static u_int8_t sf_read_eeprom(struct sf_softc *, int); |
163 | 161 |
164static int sf_miibus_readreg (device_t, int, int); 165static int sf_miibus_writereg (device_t, int, int, int); 166static void sf_miibus_statchg (device_t); | 162static int sf_miibus_readreg(device_t, int, int); 163static int sf_miibus_writereg(device_t, int, int, int); 164static void sf_miibus_statchg(device_t); |
167#ifdef DEVICE_POLLING | 165#ifdef DEVICE_POLLING |
168static void sf_poll (struct ifnet *ifp, enum poll_cmd cmd, | 166static void sf_poll(struct ifnet *ifp, enum poll_cmd cmd, |
169 int count); | 167 int count); |
170static void sf_poll_locked (struct ifnet *ifp, enum poll_cmd cmd, | 168static void sf_poll_locked(struct ifnet *ifp, enum poll_cmd cmd, |
171 int count); 172#endif /* DEVICE_POLLING */ 173 | 169 int count); 170#endif /* DEVICE_POLLING */ 171 |
174static u_int32_t csr_read_4 (struct sf_softc *, int); 175static void csr_write_4 (struct sf_softc *, int, u_int32_t); 176static void sf_txthresh_adjust (struct sf_softc *); | 172static u_int32_t csr_read_4(struct sf_softc *, int); 173static void csr_write_4(struct sf_softc *, int, u_int32_t); 174static void sf_txthresh_adjust(struct sf_softc *); |
177 178#ifdef SF_USEIOSPACE 179#define SF_RES SYS_RES_IOPORT 180#define SF_RID SF_PCI_LOIO 181#else 182#define SF_RES SYS_RES_MEMORY 183#define SF_RID SF_PCI_LOMEM 184#endif --- 1378 unchanged lines hidden --- | 175 176#ifdef SF_USEIOSPACE 177#define SF_RES SYS_RES_IOPORT 178#define SF_RID SF_PCI_LOIO 179#else 180#define SF_RES SYS_RES_MEMORY 181#define SF_RID SF_PCI_LOMEM 182#endif --- 1378 unchanged lines hidden --- |