if_sf.c (155671) | if_sf.c (162315) |
---|---|
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 155671 2006-02-14 12:44:56Z glebius $"); | 34__FBSDID("$FreeBSD: head/sys/dev/sf/if_sf.c 162315 2006-09-15 10:40:54Z glebius $"); |
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 --- 568 unchanged lines hidden (view full) --- 611 612 for (i = 0; i < SF_TIMEOUT; i++) { 613 DELAY(10); 614 if (!(csr_read_4(sc, SF_PCI_DEVCFG) & SF_PCIDEVCFG_RESET)) 615 break; 616 } 617 618 if (i == SF_TIMEOUT) | 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 --- 568 unchanged lines hidden (view full) --- 611 612 for (i = 0; i < SF_TIMEOUT; i++) { 613 DELAY(10); 614 if (!(csr_read_4(sc, SF_PCI_DEVCFG) & SF_PCIDEVCFG_RESET)) 615 break; 616 } 617 618 if (i == SF_TIMEOUT) |
619 if_printf(sc->sf_ifp, "reset never completed!\n"); | 619 device_printf(sc->sf_dev, "reset never completed!\n"); |
620 621 /* Wait a little while for the chip to get its brains in order. */ 622 DELAY(1000); 623} 624 625/* 626 * Probe for an Adaptec AIC-6915 chip. Check the PCI vendor and device 627 * IDs against our list and return a device name if we find a match. --- 57 unchanged lines hidden (view full) --- 685{ 686 int i; 687 struct sf_softc *sc; 688 struct ifnet *ifp; 689 int rid, error = 0; 690 u_char eaddr[6]; 691 692 sc = device_get_softc(dev); | 620 621 /* Wait a little while for the chip to get its brains in order. */ 622 DELAY(1000); 623} 624 625/* 626 * Probe for an Adaptec AIC-6915 chip. Check the PCI vendor and device 627 * IDs against our list and return a device name if we find a match. --- 57 unchanged lines hidden (view full) --- 685{ 686 int i; 687 struct sf_softc *sc; 688 struct ifnet *ifp; 689 int rid, error = 0; 690 u_char eaddr[6]; 691 692 sc = device_get_softc(dev); |
693 sc->sf_dev = dev; |
|
693 694 mtx_init(&sc->sf_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, 695 MTX_DEF); 696 /* 697 * Map control/status registers. 698 */ 699 pci_enable_busmaster(dev); 700 --- 375 unchanged lines hidden (view full) --- 1076 1077 txfctl = csr_read_4(sc, SF_TX_FRAMCTL); 1078 txthresh = txfctl & SF_TXFRMCTL_TXTHRESH; 1079 if (txthresh < 0xFF) { 1080 txthresh++; 1081 txfctl &= ~SF_TXFRMCTL_TXTHRESH; 1082 txfctl |= txthresh; 1083#ifdef DIAGNOSTIC | 694 695 mtx_init(&sc->sf_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, 696 MTX_DEF); 697 /* 698 * Map control/status registers. 699 */ 700 pci_enable_busmaster(dev); 701 --- 375 unchanged lines hidden (view full) --- 1077 1078 txfctl = csr_read_4(sc, SF_TX_FRAMCTL); 1079 txthresh = txfctl & SF_TXFRMCTL_TXTHRESH; 1080 if (txthresh < 0xFF) { 1081 txthresh++; 1082 txfctl &= ~SF_TXFRMCTL_TXTHRESH; 1083 txfctl |= txthresh; 1084#ifdef DIAGNOSTIC |
1084 if_printf(sc->sf_ifp, "tx underrun, increasing " | 1085 device_printf(sc->sf_dev, "tx underrun, increasing " |
1085 "tx threshold to %d bytes\n", 1086 txthresh * 4); 1087#endif 1088 csr_write_4(sc, SF_TX_FRAMCTL, txfctl); 1089 } 1090} 1091 1092#ifdef DEVICE_POLLING --- 145 unchanged lines hidden (view full) --- 1238 (i + sizeof(u_int32_t)), 0); 1239 1240 /* Init our MAC address */ 1241 csr_write_4(sc, SF_PAR0, *(u_int32_t *)(&IF_LLADDR(sc->sf_ifp)[0])); 1242 csr_write_4(sc, SF_PAR1, *(u_int32_t *)(&IF_LLADDR(sc->sf_ifp)[4])); 1243 sf_setperf(sc, 0, IF_LLADDR(sc->sf_ifp)); 1244 1245 if (sf_init_rx_ring(sc) == ENOBUFS) { | 1086 "tx threshold to %d bytes\n", 1087 txthresh * 4); 1088#endif 1089 csr_write_4(sc, SF_TX_FRAMCTL, txfctl); 1090 } 1091} 1092 1093#ifdef DEVICE_POLLING --- 145 unchanged lines hidden (view full) --- 1239 (i + sizeof(u_int32_t)), 0); 1240 1241 /* Init our MAC address */ 1242 csr_write_4(sc, SF_PAR0, *(u_int32_t *)(&IF_LLADDR(sc->sf_ifp)[0])); 1243 csr_write_4(sc, SF_PAR1, *(u_int32_t *)(&IF_LLADDR(sc->sf_ifp)[4])); 1244 sf_setperf(sc, 0, IF_LLADDR(sc->sf_ifp)); 1245 1246 if (sf_init_rx_ring(sc) == ENOBUFS) { |
1246 if_printf(sc->sf_ifp, | 1247 device_printf(sc->sf_dev, |
1247 "initialization failed: no memory for rx buffers\n"); 1248 return; 1249 } 1250 1251 sf_init_tx_ring(sc); 1252 1253 csr_write_4(sc, SF_RXFILT, SF_PERFMODE_NORMAL|SF_HASHMODE_WITHVLAN); 1254 --- 347 unchanged lines hidden --- | 1248 "initialization failed: no memory for rx buffers\n"); 1249 return; 1250 } 1251 1252 sf_init_tx_ring(sc); 1253 1254 csr_write_4(sc, SF_RXFILT, SF_PERFMODE_NORMAL|SF_HASHMODE_WITHVLAN); 1255 --- 347 unchanged lines hidden --- |