if_sf.c (51533) | if_sf.c (51583) |
---|---|
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 --- 15 unchanged lines hidden (view full) --- 24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 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 * | 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 --- 15 unchanged lines hidden (view full) --- 24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 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 * $FreeBSD: head/sys/dev/sf/if_sf.c 51533 1999-09-22 06:08:11Z wpaul $ | 32 * $FreeBSD: head/sys/dev/sf/if_sf.c 51583 1999-09-23 03:32:57Z wpaul $ |
33 */ 34 35/* 36 * Adaptec AIC-6915 "Starfire" PCI fast ethernet driver for FreeBSD. 37 * Programming manual is available from www.adaptec.com. 38 * 39 * Written by Bill Paul <wpaul@ctr.columbia.edu> 40 * Department of Electical Engineering --- 32 unchanged lines hidden (view full) --- 73 * Starfire has a 512K internal register space. When programmed for 74 * PCI memory mapped mode, the entire register space can be accessed 75 * directly. However in I/O space mode, only 256 bytes are directly 76 * mapped into PCI I/O space. The other registers can be accessed 77 * indirectly using the SF_INDIRECTIO_ADDR and SF_INDIRECTIO_DATA 78 * registers inside the 256-byte I/O window. 79 */ 80 | 33 */ 34 35/* 36 * Adaptec AIC-6915 "Starfire" PCI fast ethernet driver for FreeBSD. 37 * Programming manual is available from www.adaptec.com. 38 * 39 * Written by Bill Paul <wpaul@ctr.columbia.edu> 40 * Department of Electical Engineering --- 32 unchanged lines hidden (view full) --- 73 * Starfire has a 512K internal register space. When programmed for 74 * PCI memory mapped mode, the entire register space can be accessed 75 * directly. However in I/O space mode, only 256 bytes are directly 76 * mapped into PCI I/O space. The other registers can be accessed 77 * indirectly using the SF_INDIRECTIO_ADDR and SF_INDIRECTIO_DATA 78 * registers inside the 256-byte I/O window. 79 */ 80 |
81#include "bpf.h" 82 | |
83#include <sys/param.h> 84#include <sys/systm.h> 85#include <sys/sockio.h> 86#include <sys/mbuf.h> 87#include <sys/malloc.h> 88#include <sys/kernel.h> 89#include <sys/socket.h> 90 91#include <net/if.h> 92#include <net/if_arp.h> 93#include <net/ethernet.h> 94#include <net/if_dl.h> 95#include <net/if_media.h> 96 | 81#include <sys/param.h> 82#include <sys/systm.h> 83#include <sys/sockio.h> 84#include <sys/mbuf.h> 85#include <sys/malloc.h> 86#include <sys/kernel.h> 87#include <sys/socket.h> 88 89#include <net/if.h> 90#include <net/if_arp.h> 91#include <net/ethernet.h> 92#include <net/if_dl.h> 93#include <net/if_media.h> 94 |
97#if NBPF > 0 | |
98#include <net/bpf.h> | 95#include <net/bpf.h> |
99#endif | |
100 101#include <vm/vm.h> /* for vtophys */ 102#include <vm/pmap.h> /* for vtophys */ 103#include <machine/clock.h> /* for DELAY */ 104#include <machine/bus_pio.h> 105#include <machine/bus_memio.h> 106#include <machine/bus.h> 107#include <machine/resource.h> --- 10 unchanged lines hidden (view full) --- 118#include <pci/pcivar.h> 119 120#define SF_USEIOSPACE 121 122#include <pci/if_sfreg.h> 123 124#ifndef lint 125static const char rcsid[] = | 96 97#include <vm/vm.h> /* for vtophys */ 98#include <vm/pmap.h> /* for vtophys */ 99#include <machine/clock.h> /* for DELAY */ 100#include <machine/bus_pio.h> 101#include <machine/bus_memio.h> 102#include <machine/bus.h> 103#include <machine/resource.h> --- 10 unchanged lines hidden (view full) --- 114#include <pci/pcivar.h> 115 116#define SF_USEIOSPACE 117 118#include <pci/if_sfreg.h> 119 120#ifndef lint 121static const char rcsid[] = |
126 "$FreeBSD: head/sys/dev/sf/if_sf.c 51533 1999-09-22 06:08:11Z wpaul $"; | 122 "$FreeBSD: head/sys/dev/sf/if_sf.c 51583 1999-09-23 03:32:57Z wpaul $"; |
127#endif 128 129static struct sf_type sf_devs[] = { 130 { AD_VENDORID, AD_DEVICEID_STARFIRE, 131 "Adaptec AIC-6915 10/100BaseTX" }, 132 { 0, 0, NULL } 133}; 134 --- 675 unchanged lines hidden (view full) --- 810 ifp->if_snd.ifq_maxlen = SF_TX_DLIST_CNT - 1; 811 812 /* 813 * Call MI attach routines. 814 */ 815 if_attach(ifp); 816 ether_ifattach(ifp); 817 | 123#endif 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 --- 675 unchanged lines hidden (view full) --- 806 ifp->if_snd.ifq_maxlen = SF_TX_DLIST_CNT - 1; 807 808 /* 809 * Call MI attach routines. 810 */ 811 if_attach(ifp); 812 ether_ifattach(ifp); 813 |
818#if NBPF > 0 | |
819 bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header)); | 814 bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header)); |
820#endif | |
821 822fail: 823 splx(s); 824 return(error); 825} 826 827static int sf_detach(dev) 828 device_t dev; --- 168 unchanged lines hidden (view full) --- 997 continue; 998 } 999 m_adj(m0, ETHER_ALIGN); 1000 m = m0; 1001 1002 eh = mtod(m, struct ether_header *); 1003 ifp->if_ipackets++; 1004 | 815 816fail: 817 splx(s); 818 return(error); 819} 820 821static int sf_detach(dev) 822 device_t dev; --- 168 unchanged lines hidden (view full) --- 991 continue; 992 } 993 m_adj(m0, ETHER_ALIGN); 994 m = m0; 995 996 eh = mtod(m, struct ether_header *); 997 ifp->if_ipackets++; 998 |
1005#if NBPF > 0 | |
1006 if (ifp->if_bpf) { 1007 bpf_mtap(ifp, m); 1008 if (ifp->if_flags & IFF_PROMISC && 1009 (bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr, 1010 ETHER_ADDR_LEN) && !(eh->ether_dhost[0] & 1))) { 1011 m_freem(m); 1012 continue; 1013 } 1014 } | 999 if (ifp->if_bpf) { 1000 bpf_mtap(ifp, m); 1001 if (ifp->if_flags & IFF_PROMISC && 1002 (bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr, 1003 ETHER_ADDR_LEN) && !(eh->ether_dhost[0] & 1))) { 1004 m_freem(m); 1005 continue; 1006 } 1007 } |
1015#endif | |
1016 1017 /* Remove header from mbuf and pass it on. */ 1018 m_adj(m, sizeof(struct ether_header)); 1019 ether_input(ifp, eh, m); 1020 1021 } 1022 1023 csr_write_4(sc, SF_CQ_CONSIDX, --- 304 unchanged lines hidden (view full) --- 1328 1329 cur_tx = &sc->sf_ldata->sf_tx_dlist[i]; 1330 sf_encap(sc, cur_tx, m_head); 1331 1332 /* 1333 * If there's a BPF listener, bounce a copy of this frame 1334 * to him. 1335 */ | 1008 1009 /* Remove header from mbuf and pass it on. */ 1010 m_adj(m, sizeof(struct ether_header)); 1011 ether_input(ifp, eh, m); 1012 1013 } 1014 1015 csr_write_4(sc, SF_CQ_CONSIDX, --- 304 unchanged lines hidden (view full) --- 1320 1321 cur_tx = &sc->sf_ldata->sf_tx_dlist[i]; 1322 sf_encap(sc, cur_tx, m_head); 1323 1324 /* 1325 * If there's a BPF listener, bounce a copy of this frame 1326 * to him. 1327 */ |
1336#if NBPF > 0 | |
1337 if (ifp->if_bpf) 1338 bpf_mtap(ifp, m_head); | 1328 if (ifp->if_bpf) 1329 bpf_mtap(ifp, m_head); |
1339#endif | 1330 |
1340 SF_INC(i, SF_TX_DLIST_CNT); 1341 sc->sf_tx_cnt++; 1342 if (sc->sf_tx_cnt == (SF_TX_DLIST_CNT - 2)) 1343 break; 1344 } 1345 1346 if (cur_tx == NULL) 1347 return; --- 126 unchanged lines hidden --- | 1331 SF_INC(i, SF_TX_DLIST_CNT); 1332 sc->sf_tx_cnt++; 1333 if (sc->sf_tx_cnt == (SF_TX_DLIST_CNT - 2)) 1334 break; 1335 } 1336 1337 if (cur_tx == NULL) 1338 return; --- 126 unchanged lines hidden --- |