Deleted Added
full compact
if_dc.c (105219) if_dc.c (106936)
1/*
2 * Copyright (c) 1997, 1998, 1999
3 * Bill Paul <wpaul@ee.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@ee.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/dc/if_dc.c 105219 2002-10-16 09:04:52Z phk $
32 * $FreeBSD: head/sys/dev/dc/if_dc.c 106936 2002-11-14 23:49:09Z sam $
33 */
34
35/*
36 * DEC "tulip" clone ethernet driver. Supports the DEC/Intel 21143
37 * series chips and several workalikes including the following:
38 *
39 * Macronix 98713/98715/98725/98727/98732 PMAC (www.macronix.com)
40 * Macronix/Lite-On 82c115 PNIC II (www.macronix.com)

--- 91 unchanged lines hidden (view full) ---

132
133MODULE_DEPEND(dc, miibus, 1, 1, 1);
134
135/* "controller miibus0" required. See GENERIC if you get errors here. */
136#include "miibus_if.h"
137
138#ifndef lint
139static const char rcsid[] =
33 */
34
35/*
36 * DEC "tulip" clone ethernet driver. Supports the DEC/Intel 21143
37 * series chips and several workalikes including the following:
38 *
39 * Macronix 98713/98715/98725/98727/98732 PMAC (www.macronix.com)
40 * Macronix/Lite-On 82c115 PNIC II (www.macronix.com)

--- 91 unchanged lines hidden (view full) ---

132
133MODULE_DEPEND(dc, miibus, 1, 1, 1);
134
135/* "controller miibus0" required. See GENERIC if you get errors here. */
136#include "miibus_if.h"
137
138#ifndef lint
139static const char rcsid[] =
140 "$FreeBSD: head/sys/dev/dc/if_dc.c 105219 2002-10-16 09:04:52Z phk $";
140 "$FreeBSD: head/sys/dev/dc/if_dc.c 106936 2002-11-14 23:49:09Z sam $";
141#endif
142
143/*
144 * Various supported device vendors/types and their names.
145 */
146static struct dc_type dc_devs[] = {
147 { DC_VENDORID_DEC, DC_DEVICEID_21143,
148 "Intel 21143 10/100BaseTX" },

--- 2108 unchanged lines hidden (view full) ---

2257 CSR_WRITE_4(sc, DC_SIAGP, DC_SIAGP_INT1_EN |
2258 DC_SIAGP_MD_GP2_OUTPUT | DC_SIAGP_MD_GP0_OUTPUT);
2259 DELAY(10);
2260 }
2261
2262 /*
2263 * Call MI attach routine.
2264 */
141#endif
142
143/*
144 * Various supported device vendors/types and their names.
145 */
146static struct dc_type dc_devs[] = {
147 { DC_VENDORID_DEC, DC_DEVICEID_21143,
148 "Intel 21143 10/100BaseTX" },

--- 2108 unchanged lines hidden (view full) ---

2257 CSR_WRITE_4(sc, DC_SIAGP, DC_SIAGP_INT1_EN |
2258 DC_SIAGP_MD_GP2_OUTPUT | DC_SIAGP_MD_GP0_OUTPUT);
2259 DELAY(10);
2260 }
2261
2262 /*
2263 * Call MI attach routine.
2264 */
2265 ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
2265 ether_ifattach(ifp, eaddr);
2266
2267 /*
2268 * Tell the upper layer(s) we support long frames.
2269 */
2270 ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header);
2266
2267 /*
2268 * Tell the upper layer(s) we support long frames.
2269 */
2270 ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header);
2271 ifp->if_capabilities |= IFCAP_VLAN_MTU;
2271
2272 callout_init(&sc->dc_stat_ch, IS_MPSAFE);
2273
2274#ifdef SRM_MEDIA
2275 sc->dc_srm_media = 0;
2276
2277 /* Remember the SRM console media setting */
2278 if (DC_IS_INTEL(sc)) {

--- 38 unchanged lines hidden (view full) ---

2317
2318 sc = device_get_softc(dev);
2319
2320 DC_LOCK(sc);
2321
2322 ifp = &sc->arpcom.ac_if;
2323
2324 dc_stop(sc);
2272
2273 callout_init(&sc->dc_stat_ch, IS_MPSAFE);
2274
2275#ifdef SRM_MEDIA
2276 sc->dc_srm_media = 0;
2277
2278 /* Remember the SRM console media setting */
2279 if (DC_IS_INTEL(sc)) {

--- 38 unchanged lines hidden (view full) ---

2318
2319 sc = device_get_softc(dev);
2320
2321 DC_LOCK(sc);
2322
2323 ifp = &sc->arpcom.ac_if;
2324
2325 dc_stop(sc);
2325 ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
2326 ether_ifdetach(ifp);
2326
2327 bus_generic_detach(dev);
2328 device_delete_child(dev, sc->dc_miibus);
2329
2330 bus_teardown_intr(dev, sc->dc_irq, sc->dc_intrhand);
2331 bus_release_resource(dev, SYS_RES_IRQ, 0, sc->dc_irq);
2332 bus_release_resource(dev, DC_RES, DC_RID, sc->dc_res);
2333

--- 270 unchanged lines hidden (view full) ---

2604/*
2605 * A frame has been uploaded: pass the resulting mbuf chain up to
2606 * the higher level protocols.
2607 */
2608static void
2609dc_rxeof(sc)
2610 struct dc_softc *sc;
2611{
2327
2328 bus_generic_detach(dev);
2329 device_delete_child(dev, sc->dc_miibus);
2330
2331 bus_teardown_intr(dev, sc->dc_irq, sc->dc_intrhand);
2332 bus_release_resource(dev, SYS_RES_IRQ, 0, sc->dc_irq);
2333 bus_release_resource(dev, DC_RES, DC_RID, sc->dc_res);
2334

--- 270 unchanged lines hidden (view full) ---

2605/*
2606 * A frame has been uploaded: pass the resulting mbuf chain up to
2607 * the higher level protocols.
2608 */
2609static void
2610dc_rxeof(sc)
2611 struct dc_softc *sc;
2612{
2612 struct ether_header *eh;
2613 struct mbuf *m;
2614 struct ifnet *ifp;
2615 struct dc_desc *cur_rx;
2616 int i, total_len = 0;
2617 u_int32_t rxstat;
2618
2619 ifp = &sc->arpcom.ac_if;
2620 i = sc->dc_cdata.dc_rx_prod;

--- 82 unchanged lines hidden (view full) ---

2703 if (m0 == NULL) {
2704 ifp->if_ierrors++;
2705 continue;
2706 }
2707 m = m0;
2708 }
2709
2710 ifp->if_ipackets++;
2613 struct mbuf *m;
2614 struct ifnet *ifp;
2615 struct dc_desc *cur_rx;
2616 int i, total_len = 0;
2617 u_int32_t rxstat;
2618
2619 ifp = &sc->arpcom.ac_if;
2620 i = sc->dc_cdata.dc_rx_prod;

--- 82 unchanged lines hidden (view full) ---

2703 if (m0 == NULL) {
2704 ifp->if_ierrors++;
2705 continue;
2706 }
2707 m = m0;
2708 }
2709
2710 ifp->if_ipackets++;
2711 eh = mtod(m, struct ether_header *);
2712
2713 /* Remove header from mbuf and pass it on. */
2714 m_adj(m, sizeof(struct ether_header));
2715 ether_input(ifp, eh, m);
2711 (*ifp->if_input)(ifp, m);
2716 }
2717
2718 sc->dc_cdata.dc_rx_prod = i;
2719}
2720
2721/*
2722 * A frame was downloaded to the chip. It's safe for us to clean up
2723 * the list buffers.

--- 531 unchanged lines hidden (view full) ---

3255 ifp->if_flags |= IFF_OACTIVE;
3256 break;
3257 }
3258
3259 /*
3260 * If there's a BPF listener, bounce a copy of this frame
3261 * to him.
3262 */
2712 }
2713
2714 sc->dc_cdata.dc_rx_prod = i;
2715}
2716
2717/*
2718 * A frame was downloaded to the chip. It's safe for us to clean up
2719 * the list buffers.

--- 531 unchanged lines hidden (view full) ---

3251 ifp->if_flags |= IFF_OACTIVE;
3252 break;
3253 }
3254
3255 /*
3256 * If there's a BPF listener, bounce a copy of this frame
3257 * to him.
3258 */
3263 if (ifp->if_bpf)
3264 bpf_mtap(ifp, m_head);
3259 BPF_MTAP(ifp, m_head);
3265
3266 if (sc->dc_flags & DC_TX_ONE) {
3267 ifp->if_flags |= IFF_OACTIVE;
3268 break;
3269 }
3270 }
3271
3272 /* Transmit */

--- 264 unchanged lines hidden (view full) ---

3537 struct dc_softc *sc = ifp->if_softc;
3538 struct ifreq *ifr = (struct ifreq *) data;
3539 struct mii_data *mii;
3540 int error = 0;
3541
3542 DC_LOCK(sc);
3543
3544 switch(command) {
3260
3261 if (sc->dc_flags & DC_TX_ONE) {
3262 ifp->if_flags |= IFF_OACTIVE;
3263 break;
3264 }
3265 }
3266
3267 /* Transmit */

--- 264 unchanged lines hidden (view full) ---

3532 struct dc_softc *sc = ifp->if_softc;
3533 struct ifreq *ifr = (struct ifreq *) data;
3534 struct mii_data *mii;
3535 int error = 0;
3536
3537 DC_LOCK(sc);
3538
3539 switch(command) {
3545 case SIOCSIFADDR:
3546 case SIOCGIFADDR:
3547 case SIOCSIFMTU:
3548 error = ether_ioctl(ifp, command, data);
3549 break;
3550 case SIOCSIFFLAGS:
3551 if (ifp->if_flags & IFF_UP) {
3552 if (ifp->if_flags & IFF_RUNNING &&
3553 ifp->if_flags & IFF_PROMISC &&
3554 !(sc->dc_if_flags & IFF_PROMISC)) {
3555 dc_setfilt(sc);
3556 } else if (ifp->if_flags & IFF_RUNNING &&
3557 !(ifp->if_flags & IFF_PROMISC) &&

--- 20 unchanged lines hidden (view full) ---

3578 mii = device_get_softc(sc->dc_miibus);
3579 error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command);
3580#ifdef SRM_MEDIA
3581 if (sc->dc_srm_media)
3582 sc->dc_srm_media = 0;
3583#endif
3584 break;
3585 default:
3540 case SIOCSIFFLAGS:
3541 if (ifp->if_flags & IFF_UP) {
3542 if (ifp->if_flags & IFF_RUNNING &&
3543 ifp->if_flags & IFF_PROMISC &&
3544 !(sc->dc_if_flags & IFF_PROMISC)) {
3545 dc_setfilt(sc);
3546 } else if (ifp->if_flags & IFF_RUNNING &&
3547 !(ifp->if_flags & IFF_PROMISC) &&

--- 20 unchanged lines hidden (view full) ---

3568 mii = device_get_softc(sc->dc_miibus);
3569 error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command);
3570#ifdef SRM_MEDIA
3571 if (sc->dc_srm_media)
3572 sc->dc_srm_media = 0;
3573#endif
3574 break;
3575 default:
3586 error = EINVAL;
3576 error = ether_ioctl(ifp, command, data);
3587 break;
3588 }
3589
3590 DC_UNLOCK(sc);
3591
3592 return(error);
3593}
3594

--- 180 unchanged lines hidden ---
3577 break;
3578 }
3579
3580 DC_UNLOCK(sc);
3581
3582 return(error);
3583}
3584

--- 180 unchanged lines hidden ---