if_sis.c (105219) | if_sis.c (106936) |
---|---|
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/pci/if_sis.c 105219 2002-10-16 09:04:52Z phk $ | 32 * $FreeBSD: head/sys/pci/if_sis.c 106936 2002-11-14 23:49:09Z sam $ |
33 */ 34 35/* 36 * SiS 900/SiS 7016 fast ethernet PCI NIC driver. Datasheets are 37 * available from http://www.sis.com.tw. 38 * 39 * This driver also supports the NatSemi DP83815. Datasheets are 40 * available from http://www.national.com. --- 54 unchanged lines hidden (view full) --- 95 96MODULE_DEPEND(sis, miibus, 1, 1, 1); 97 98/* "controller miibus0" required. See GENERIC if you get errors here. */ 99#include "miibus_if.h" 100 101#ifndef lint 102static const char rcsid[] = | 33 */ 34 35/* 36 * SiS 900/SiS 7016 fast ethernet PCI NIC driver. Datasheets are 37 * available from http://www.sis.com.tw. 38 * 39 * This driver also supports the NatSemi DP83815. Datasheets are 40 * available from http://www.national.com. --- 54 unchanged lines hidden (view full) --- 95 96MODULE_DEPEND(sis, miibus, 1, 1, 1); 97 98/* "controller miibus0" required. See GENERIC if you get errors here. */ 99#include "miibus_if.h" 100 101#ifndef lint 102static const char rcsid[] = |
103 "$FreeBSD: head/sys/pci/if_sis.c 105219 2002-10-16 09:04:52Z phk $"; | 103 "$FreeBSD: head/sys/pci/if_sis.c 106936 2002-11-14 23:49:09Z sam $"; |
104#endif 105 106/* 107 * Various supported device vendors/types and their names. 108 */ 109static struct sis_type sis_devs[] = { 110 { SIS_VENDORID, SIS_DEVICEID_900, "SiS 900 10/100BaseTX" }, 111 { SIS_VENDORID, SIS_DEVICEID_7016, "SiS 7016 10/100BaseTX" }, --- 1008 unchanged lines hidden (view full) --- 1120 bus_dma_tag_destroy(sc->sis_ldata.sis_tx_tag); 1121 error = ENXIO; 1122 goto fail; 1123 } 1124 1125 /* 1126 * Call MI attach routine. 1127 */ | 104#endif 105 106/* 107 * Various supported device vendors/types and their names. 108 */ 109static struct sis_type sis_devs[] = { 110 { SIS_VENDORID, SIS_DEVICEID_900, "SiS 900 10/100BaseTX" }, 111 { SIS_VENDORID, SIS_DEVICEID_7016, "SiS 7016 10/100BaseTX" }, --- 1008 unchanged lines hidden (view full) --- 1120 bus_dma_tag_destroy(sc->sis_ldata.sis_tx_tag); 1121 error = ENXIO; 1122 goto fail; 1123 } 1124 1125 /* 1126 * Call MI attach routine. 1127 */ |
1128 ether_ifattach(ifp, ETHER_BPF_SUPPORTED); | 1128 ether_ifattach(ifp, eaddr); |
1129 1130 /* 1131 * Tell the upper layer(s) we support long frames. 1132 */ 1133 ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); | 1129 1130 /* 1131 * Tell the upper layer(s) we support long frames. 1132 */ 1133 ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); |
1134 ifp->if_capabilities |= IFCAP_VLAN_MTU; |
|
1134 1135 callout_handle_init(&sc->sis_stat_ch); 1136 return(0); 1137 1138fail: 1139 mtx_destroy(&sc->sis_mtx); 1140 return(error); 1141} --- 7 unchanged lines hidden (view full) --- 1149 1150 1151 sc = device_get_softc(dev); 1152 SIS_LOCK(sc); 1153 ifp = &sc->arpcom.ac_if; 1154 1155 sis_reset(sc); 1156 sis_stop(sc); | 1135 1136 callout_handle_init(&sc->sis_stat_ch); 1137 return(0); 1138 1139fail: 1140 mtx_destroy(&sc->sis_mtx); 1141 return(error); 1142} --- 7 unchanged lines hidden (view full) --- 1150 1151 1152 sc = device_get_softc(dev); 1153 SIS_LOCK(sc); 1154 ifp = &sc->arpcom.ac_if; 1155 1156 sis_reset(sc); 1157 sis_stop(sc); |
1157 ether_ifdetach(ifp, ETHER_BPF_SUPPORTED); | 1158 ether_ifdetach(ifp); |
1158 1159 bus_generic_detach(dev); 1160 device_delete_child(dev, sc->sis_miibus); 1161 1162 bus_teardown_intr(dev, sc->sis_irq, sc->sis_intrhand); 1163 bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sis_irq); 1164 bus_release_resource(dev, SIS_RES, SIS_RID, sc->sis_res); 1165 --- 193 unchanged lines hidden (view full) --- 1359 if (m0 == NULL) { 1360 ifp->if_ierrors++; 1361 continue; 1362 } 1363 m = m0; 1364 } 1365 1366 ifp->if_ipackets++; | 1159 1160 bus_generic_detach(dev); 1161 device_delete_child(dev, sc->sis_miibus); 1162 1163 bus_teardown_intr(dev, sc->sis_irq, sc->sis_intrhand); 1164 bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sis_irq); 1165 bus_release_resource(dev, SIS_RES, SIS_RID, sc->sis_res); 1166 --- 193 unchanged lines hidden (view full) --- 1360 if (m0 == NULL) { 1361 ifp->if_ierrors++; 1362 continue; 1363 } 1364 m = m0; 1365 } 1366 1367 ifp->if_ipackets++; |
1367 ether_input(ifp, NULL, m); | 1368 m->m_pkthdr.rcvif = ifp; 1369 1370 (*ifp->if_input)(ifp, m); |
1368 } 1369 1370 sc->sis_cdata.sis_rx_prod = i; 1371 1372 return; 1373} 1374 1375static void --- 306 unchanged lines hidden (view full) --- 1682 ifp->if_flags |= IFF_OACTIVE; 1683 break; 1684 } 1685 1686 /* 1687 * If there's a BPF listener, bounce a copy of this frame 1688 * to him. 1689 */ | 1371 } 1372 1373 sc->sis_cdata.sis_rx_prod = i; 1374 1375 return; 1376} 1377 1378static void --- 306 unchanged lines hidden (view full) --- 1685 ifp->if_flags |= IFF_OACTIVE; 1686 break; 1687 } 1688 1689 /* 1690 * If there's a BPF listener, bounce a copy of this frame 1691 * to him. 1692 */ |
1690 if (ifp->if_bpf) 1691 bpf_mtap(ifp, m_head); | 1693 BPF_MTAP(ifp, m_head); |
1692 1693 } 1694 1695 /* Transmit */ 1696 sc->sis_cdata.sis_tx_prod = idx; 1697 SIS_SETBIT(sc, SIS_CSR, SIS_CSR_TX_ENABLE); 1698 1699 /* --- 228 unchanged lines hidden (view full) --- 1928 caddr_t data; 1929{ 1930 struct sis_softc *sc = ifp->if_softc; 1931 struct ifreq *ifr = (struct ifreq *) data; 1932 struct mii_data *mii; 1933 int error = 0; 1934 1935 switch(command) { | 1694 1695 } 1696 1697 /* Transmit */ 1698 sc->sis_cdata.sis_tx_prod = idx; 1699 SIS_SETBIT(sc, SIS_CSR, SIS_CSR_TX_ENABLE); 1700 1701 /* --- 228 unchanged lines hidden (view full) --- 1930 caddr_t data; 1931{ 1932 struct sis_softc *sc = ifp->if_softc; 1933 struct ifreq *ifr = (struct ifreq *) data; 1934 struct mii_data *mii; 1935 int error = 0; 1936 1937 switch(command) { |
1936 case SIOCSIFADDR: 1937 case SIOCGIFADDR: 1938 case SIOCSIFMTU: 1939 error = ether_ioctl(ifp, command, data); 1940 break; | |
1941 case SIOCSIFFLAGS: 1942 if (ifp->if_flags & IFF_UP) { 1943 sis_init(sc); 1944 } else { 1945 if (ifp->if_flags & IFF_RUNNING) 1946 sis_stop(sc); 1947 } 1948 error = 0; --- 11 unchanged lines hidden (view full) --- 1960 case SIOCGIFMEDIA: 1961 case SIOCSIFMEDIA: 1962 mii = device_get_softc(sc->sis_miibus); 1963 SIS_LOCK(sc); 1964 error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); 1965 SIS_UNLOCK(sc); 1966 break; 1967 default: | 1938 case SIOCSIFFLAGS: 1939 if (ifp->if_flags & IFF_UP) { 1940 sis_init(sc); 1941 } else { 1942 if (ifp->if_flags & IFF_RUNNING) 1943 sis_stop(sc); 1944 } 1945 error = 0; --- 11 unchanged lines hidden (view full) --- 1957 case SIOCGIFMEDIA: 1958 case SIOCSIFMEDIA: 1959 mii = device_get_softc(sc->sis_miibus); 1960 SIS_LOCK(sc); 1961 error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); 1962 SIS_UNLOCK(sc); 1963 break; 1964 default: |
1968 error = EINVAL; | 1965 error = ether_ioctl(ifp, command, data); |
1969 break; 1970 } 1971 1972 return(error); 1973} 1974 1975static void 1976sis_watchdog(ifp) --- 109 unchanged lines hidden --- | 1966 break; 1967 } 1968 1969 return(error); 1970} 1971 1972static void 1973sis_watchdog(ifp) --- 109 unchanged lines hidden --- |