if_pcn.c (102335) | if_pcn.c (106936) |
---|---|
1/* 2 * Copyright (c) 2000 Berkeley Software Design, Inc. 3 * Copyright (c) 1997, 1998, 1999, 2000 4 * Bill Paul <wpaul@osd.bsdi.com>. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 16 unchanged lines hidden (view full) --- 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 * | 1/* 2 * Copyright (c) 2000 Berkeley Software Design, Inc. 3 * Copyright (c) 1997, 1998, 1999, 2000 4 * Bill Paul <wpaul@osd.bsdi.com>. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 16 unchanged lines hidden (view full) --- 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 * |
33 * $FreeBSD: head/sys/pci/if_pcn.c 102335 2002-08-23 23:49:02Z alfred $ | 33 * $FreeBSD: head/sys/pci/if_pcn.c 106936 2002-11-14 23:49:09Z sam $ |
34 */ 35 36/* 37 * AMD Am79c972 fast ethernet PCI NIC driver. Datatheets are available 38 * from http://www.amd.com. 39 * 40 * Written by Bill Paul <wpaul@osd.bsdi.com> 41 */ --- 50 unchanged lines hidden (view full) --- 92 93MODULE_DEPEND(pcn, miibus, 1, 1, 1); 94 95/* "controller miibus0" required. See GENERIC if you get errors here. */ 96#include "miibus_if.h" 97 98#ifndef lint 99static const char rcsid[] = | 34 */ 35 36/* 37 * AMD Am79c972 fast ethernet PCI NIC driver. Datatheets are available 38 * from http://www.amd.com. 39 * 40 * Written by Bill Paul <wpaul@osd.bsdi.com> 41 */ --- 50 unchanged lines hidden (view full) --- 92 93MODULE_DEPEND(pcn, miibus, 1, 1, 1); 94 95/* "controller miibus0" required. See GENERIC if you get errors here. */ 96#include "miibus_if.h" 97 98#ifndef lint 99static const char rcsid[] = |
100 "$FreeBSD: head/sys/pci/if_pcn.c 102335 2002-08-23 23:49:02Z alfred $"; | 100 "$FreeBSD: head/sys/pci/if_pcn.c 106936 2002-11-14 23:49:09Z sam $"; |
101#endif 102 103/* 104 * Various supported device vendors/types and their names. 105 */ 106static struct pcn_type pcn_devs[] = { 107 { PCN_VENDORID, PCN_DEVICEID_PCNET, "AMD PCnet/PCI 10/100BaseTX" }, 108 { PCN_VENDORID, PCN_DEVICEID_HOME, "AMD PCnet/Home HomePNA" }, --- 551 unchanged lines hidden (view full) --- 660 bus_release_resource(dev, PCN_RES, PCN_RID, sc->pcn_res); 661 error = ENXIO; 662 goto fail; 663 } 664 665 /* 666 * Call MI attach routine. 667 */ | 101#endif 102 103/* 104 * Various supported device vendors/types and their names. 105 */ 106static struct pcn_type pcn_devs[] = { 107 { PCN_VENDORID, PCN_DEVICEID_PCNET, "AMD PCnet/PCI 10/100BaseTX" }, 108 { PCN_VENDORID, PCN_DEVICEID_HOME, "AMD PCnet/Home HomePNA" }, --- 551 unchanged lines hidden (view full) --- 660 bus_release_resource(dev, PCN_RES, PCN_RID, sc->pcn_res); 661 error = ENXIO; 662 goto fail; 663 } 664 665 /* 666 * Call MI attach routine. 667 */ |
668 ether_ifattach(ifp, ETHER_BPF_SUPPORTED); | 668 ether_ifattach(ifp, (u_int8_t *) eaddr); |
669 callout_handle_init(&sc->pcn_stat_ch); 670 PCN_UNLOCK(sc); 671 return(0); 672 673fail: 674 PCN_UNLOCK(sc); 675 mtx_destroy(&sc->pcn_mtx); 676 --- 9 unchanged lines hidden (view full) --- 686 687 sc = device_get_softc(dev); 688 ifp = &sc->arpcom.ac_if; 689 690 PCN_LOCK(sc); 691 692 pcn_reset(sc); 693 pcn_stop(sc); | 669 callout_handle_init(&sc->pcn_stat_ch); 670 PCN_UNLOCK(sc); 671 return(0); 672 673fail: 674 PCN_UNLOCK(sc); 675 mtx_destroy(&sc->pcn_mtx); 676 --- 9 unchanged lines hidden (view full) --- 686 687 sc = device_get_softc(dev); 688 ifp = &sc->arpcom.ac_if; 689 690 PCN_LOCK(sc); 691 692 pcn_reset(sc); 693 pcn_stop(sc); |
694 ether_ifdetach(ifp, ETHER_BPF_SUPPORTED); | 694 ether_ifdetach(ifp); |
695 696 if (sc->pcn_miibus != NULL) { 697 bus_generic_detach(dev); 698 device_delete_child(dev, sc->pcn_miibus); 699 } 700 701 bus_teardown_intr(dev, sc->pcn_irq, sc->pcn_intrhand); 702 bus_release_resource(dev, SYS_RES_IRQ, 0, sc->pcn_irq); --- 147 unchanged lines hidden (view full) --- 850 851 /* No errors; receive the packet. */ 852 ifp->if_ipackets++; 853 eh = mtod(m, struct ether_header *); 854 m->m_len = m->m_pkthdr.len = 855 cur_rx->pcn_rxlen - ETHER_CRC_LEN; 856 m->m_pkthdr.rcvif = ifp; 857 | 695 696 if (sc->pcn_miibus != NULL) { 697 bus_generic_detach(dev); 698 device_delete_child(dev, sc->pcn_miibus); 699 } 700 701 bus_teardown_intr(dev, sc->pcn_irq, sc->pcn_intrhand); 702 bus_release_resource(dev, SYS_RES_IRQ, 0, sc->pcn_irq); --- 147 unchanged lines hidden (view full) --- 850 851 /* No errors; receive the packet. */ 852 ifp->if_ipackets++; 853 eh = mtod(m, struct ether_header *); 854 m->m_len = m->m_pkthdr.len = 855 cur_rx->pcn_rxlen - ETHER_CRC_LEN; 856 m->m_pkthdr.rcvif = ifp; 857 |
858 /* Remove header from mbuf and pass it on. */ 859 m_adj(m, sizeof(struct ether_header)); 860 ether_input(ifp, eh, m); | 858 (*ifp->if_input)(ifp, m); |
861 } 862 863 sc->pcn_cdata.pcn_rx_prod = i; 864 865 return; 866} 867 868/* --- 227 unchanged lines hidden (view full) --- 1096 ifp->if_flags |= IFF_OACTIVE; 1097 break; 1098 } 1099 1100 /* 1101 * If there's a BPF listener, bounce a copy of this frame 1102 * to him. 1103 */ | 859 } 860 861 sc->pcn_cdata.pcn_rx_prod = i; 862 863 return; 864} 865 866/* --- 227 unchanged lines hidden (view full) --- 1094 ifp->if_flags |= IFF_OACTIVE; 1095 break; 1096 } 1097 1098 /* 1099 * If there's a BPF listener, bounce a copy of this frame 1100 * to him. 1101 */ |
1104 if (ifp->if_bpf) 1105 bpf_mtap(ifp, m_head); | 1102 BPF_MTAP(ifp, m_head); |
1106 1107 } 1108 1109 /* Transmit */ 1110 sc->pcn_cdata.pcn_tx_prod = idx; 1111 pcn_csr_write(sc, PCN_CSR_CSR, PCN_CSR_TX|PCN_CSR_INTEN); 1112 1113 /* --- 193 unchanged lines hidden (view full) --- 1307 struct pcn_softc *sc = ifp->if_softc; 1308 struct ifreq *ifr = (struct ifreq *) data; 1309 struct mii_data *mii = NULL; 1310 int error = 0; 1311 1312 PCN_LOCK(sc); 1313 1314 switch(command) { | 1103 1104 } 1105 1106 /* Transmit */ 1107 sc->pcn_cdata.pcn_tx_prod = idx; 1108 pcn_csr_write(sc, PCN_CSR_CSR, PCN_CSR_TX|PCN_CSR_INTEN); 1109 1110 /* --- 193 unchanged lines hidden (view full) --- 1304 struct pcn_softc *sc = ifp->if_softc; 1305 struct ifreq *ifr = (struct ifreq *) data; 1306 struct mii_data *mii = NULL; 1307 int error = 0; 1308 1309 PCN_LOCK(sc); 1310 1311 switch(command) { |
1315 case SIOCSIFADDR: 1316 case SIOCGIFADDR: 1317 case SIOCSIFMTU: 1318 error = ether_ioctl(ifp, command, data); 1319 break; | |
1320 case SIOCSIFFLAGS: 1321 if (ifp->if_flags & IFF_UP) { 1322 if (ifp->if_flags & IFF_RUNNING && 1323 ifp->if_flags & IFF_PROMISC && 1324 !(sc->pcn_if_flags & IFF_PROMISC)) { 1325 PCN_CSR_SETBIT(sc, PCN_CSR_EXTCTL1, 1326 PCN_EXTCTL1_SPND); 1327 pcn_setfilt(ifp); --- 26 unchanged lines hidden (view full) --- 1354 error = 0; 1355 break; 1356 case SIOCGIFMEDIA: 1357 case SIOCSIFMEDIA: 1358 mii = device_get_softc(sc->pcn_miibus); 1359 error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); 1360 break; 1361 default: | 1312 case SIOCSIFFLAGS: 1313 if (ifp->if_flags & IFF_UP) { 1314 if (ifp->if_flags & IFF_RUNNING && 1315 ifp->if_flags & IFF_PROMISC && 1316 !(sc->pcn_if_flags & IFF_PROMISC)) { 1317 PCN_CSR_SETBIT(sc, PCN_CSR_EXTCTL1, 1318 PCN_EXTCTL1_SPND); 1319 pcn_setfilt(ifp); --- 26 unchanged lines hidden (view full) --- 1346 error = 0; 1347 break; 1348 case SIOCGIFMEDIA: 1349 case SIOCSIFMEDIA: 1350 mii = device_get_softc(sc->pcn_miibus); 1351 error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); 1352 break; 1353 default: |
1362 error = EINVAL; | 1354 error = ether_ioctl(ifp, command, data); |
1363 break; 1364 } 1365 1366 PCN_UNLOCK(sc); 1367 1368 return(error); 1369} 1370 --- 94 unchanged lines hidden --- | 1355 break; 1356 } 1357 1358 PCN_UNLOCK(sc); 1359 1360 return(error); 1361} 1362 --- 94 unchanged lines hidden --- |