if_de.c (67164) | if_de.c (68021) |
---|---|
1/* $NetBSD: if_de.c,v 1.86 1999/06/01 19:17:59 thorpej Exp $ */ 2 | 1/* $NetBSD: if_de.c,v 1.86 1999/06/01 19:17:59 thorpej Exp $ */ 2 |
3/* $FreeBSD: head/sys/dev/de/if_de.c 67164 2000-10-15 14:19:01Z phk $ */ | 3/* $FreeBSD: head/sys/dev/de/if_de.c 68021 2000-10-31 01:25:10Z markm $ */ |
4 5/*- 6 * Copyright (c) 1994-1997 Matt Thomas (matt@3am-software.com) 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: --- 36 unchanged lines hidden (view full) --- 48#include <sys/malloc.h> 49#include <sys/kernel.h> 50#include <sys/eventhandler.h> 51#include <machine/bus.h> 52#include <machine/resource.h> 53#include <sys/bus.h> 54#include <sys/rman.h> 55 | 4 5/*- 6 * Copyright (c) 1994-1997 Matt Thomas (matt@3am-software.com) 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: --- 36 unchanged lines hidden (view full) --- 48#include <sys/malloc.h> 49#include <sys/kernel.h> 50#include <sys/eventhandler.h> 51#include <machine/bus.h> 52#include <machine/resource.h> 53#include <sys/bus.h> 54#include <sys/rman.h> 55 |
56#include "opt_inet.h" 57#include "opt_ipx.h" 58 | |
59#include <net/if.h> | 56#include <net/if.h> |
57#include <net/if_arp.h> 58#include <net/ethernet.h> |
|
60#include <net/if_media.h> 61#include <net/if_dl.h> 62#ifdef TULIP_USE_SOFTINTR 63#include <net/netisr.h> 64#endif 65 66#include <net/bpf.h> 67 68#ifdef INET 69#include <netinet/in.h> 70#include <netinet/if_ether.h> 71#endif 72 | 59#include <net/if_media.h> 60#include <net/if_dl.h> 61#ifdef TULIP_USE_SOFTINTR 62#include <net/netisr.h> 63#endif 64 65#include <net/bpf.h> 66 67#ifdef INET 68#include <netinet/in.h> 69#include <netinet/if_ether.h> 70#endif 71 |
73#ifdef IPX 74#include <netipx/ipx.h> 75#include <netipx/ipx_if.h> 76#endif 77 78#ifdef NS 79#include <netns/ns.h> 80#include <netns/ns_if.h> 81#endif 82 | |
83#include <vm/vm.h> 84 85#include <net/if_var.h> 86#include <vm/pmap.h> 87#include <pci/pcivar.h> 88#include <pci/pcireg.h> 89#include <pci/dc21040reg.h> 90 --- 29 unchanged lines hidden (view full) --- 120 * the DEC 21040 PCI Ethernet Controller. 121 * the DEC 21041 PCI Ethernet Controller. 122 * the DEC 21140 PCI Fast Ethernet Controller. 123 */ 124static void tulip_mii_autonegotiate(tulip_softc_t * const sc, const unsigned phyaddr); 125static void tulip_intr_shared(void *arg); 126static void tulip_intr_normal(void *arg); 127static void tulip_init(tulip_softc_t * const sc); | 72#include <vm/vm.h> 73 74#include <net/if_var.h> 75#include <vm/pmap.h> 76#include <pci/pcivar.h> 77#include <pci/pcireg.h> 78#include <pci/dc21040reg.h> 79 --- 29 unchanged lines hidden (view full) --- 109 * the DEC 21040 PCI Ethernet Controller. 110 * the DEC 21041 PCI Ethernet Controller. 111 * the DEC 21140 PCI Fast Ethernet Controller. 112 */ 113static void tulip_mii_autonegotiate(tulip_softc_t * const sc, const unsigned phyaddr); 114static void tulip_intr_shared(void *arg); 115static void tulip_intr_normal(void *arg); 116static void tulip_init(tulip_softc_t * const sc); |
117static void tulip_ifinit(void *); |
|
128static void tulip_reset(tulip_softc_t * const sc); 129static void tulip_ifstart_one(struct ifnet *ifp); 130static void tulip_ifstart(struct ifnet *ifp); 131static struct mbuf *tulip_txput(tulip_softc_t * const sc, struct mbuf *m); 132static void tulip_txput_setup(tulip_softc_t * const sc); 133static void tulip_rx_intr(tulip_softc_t * const sc); 134static void tulip_addr_filter(tulip_softc_t * const sc); 135static unsigned tulip_mii_readreg(tulip_softc_t * const sc, unsigned devaddr, unsigned regno); --- 3156 unchanged lines hidden (view full) --- 3292 if (sc->tulip_features & TULIP_HAVE_DUALSENSE) 3293 TULIP_CSR_WRITE(sc, csr_sia_status, TULIP_CSR_READ(sc, csr_sia_status)); 3294 3295 sc->tulip_flags &= ~(TULIP_DOINGSETUP|TULIP_WANTSETUP|TULIP_INRESET 3296 |TULIP_RXACT); 3297 tulip_addr_filter(sc); 3298} 3299 | 118static void tulip_reset(tulip_softc_t * const sc); 119static void tulip_ifstart_one(struct ifnet *ifp); 120static void tulip_ifstart(struct ifnet *ifp); 121static struct mbuf *tulip_txput(tulip_softc_t * const sc, struct mbuf *m); 122static void tulip_txput_setup(tulip_softc_t * const sc); 123static void tulip_rx_intr(tulip_softc_t * const sc); 124static void tulip_addr_filter(tulip_softc_t * const sc); 125static unsigned tulip_mii_readreg(tulip_softc_t * const sc, unsigned devaddr, unsigned regno); --- 3156 unchanged lines hidden (view full) --- 3282 if (sc->tulip_features & TULIP_HAVE_DUALSENSE) 3283 TULIP_CSR_WRITE(sc, csr_sia_status, TULIP_CSR_READ(sc, csr_sia_status)); 3284 3285 sc->tulip_flags &= ~(TULIP_DOINGSETUP|TULIP_WANTSETUP|TULIP_INRESET 3286 |TULIP_RXACT); 3287 tulip_addr_filter(sc); 3288} 3289 |
3290 |
|
3300static void | 3291static void |
3292tulip_ifinit( 3293 void * sc) 3294{ 3295 tulip_init((tulip_softc_t *)sc); 3296} 3297 3298static void |
|
3301tulip_init( 3302 tulip_softc_t * const sc) 3303{ 3304 if (sc->tulip_if.if_flags & IFF_UP) { 3305 if ((sc->tulip_if.if_flags & IFF_RUNNING) == 0) { 3306 /* initialize the media */ 3307 tulip_reset(sc); 3308 } --- 1238 unchanged lines hidden (view full) --- 4547static int 4548tulip_ifioctl( 4549 struct ifnet * ifp, 4550 u_long cmd, 4551 caddr_t data) 4552{ 4553 TULIP_PERFSTART(ifioctl) 4554 tulip_softc_t * const sc = (tulip_softc_t *)ifp->if_softc; | 3299tulip_init( 3300 tulip_softc_t * const sc) 3301{ 3302 if (sc->tulip_if.if_flags & IFF_UP) { 3303 if ((sc->tulip_if.if_flags & IFF_RUNNING) == 0) { 3304 /* initialize the media */ 3305 tulip_reset(sc); 3306 } --- 1238 unchanged lines hidden (view full) --- 4545static int 4546tulip_ifioctl( 4547 struct ifnet * ifp, 4548 u_long cmd, 4549 caddr_t data) 4550{ 4551 TULIP_PERFSTART(ifioctl) 4552 tulip_softc_t * const sc = (tulip_softc_t *)ifp->if_softc; |
4555 struct ifaddr *ifa = (struct ifaddr *)data; | |
4556 struct ifreq *ifr = (struct ifreq *) data; 4557 int s; 4558 int error = 0; 4559 4560#if defined(TULIP_USE_SOFTINTR) 4561 s = splnet(); 4562#else 4563 s = splimp(); 4564#endif 4565 switch (cmd) { | 4553 struct ifreq *ifr = (struct ifreq *) data; 4554 int s; 4555 int error = 0; 4556 4557#if defined(TULIP_USE_SOFTINTR) 4558 s = splnet(); 4559#else 4560 s = splimp(); 4561#endif 4562 switch (cmd) { |
4566 case SIOCSIFADDR: { 4567 ifp->if_flags |= IFF_UP; 4568 switch(ifa->ifa_addr->sa_family) { 4569#ifdef INET 4570 case AF_INET: { 4571 tulip_init(sc); 4572 arp_ifinit(&(sc)->tulip_ac, ifa); 4573 break; 4574 } 4575#endif /* INET */ 4576 4577#ifdef IPX 4578 case AF_IPX: { 4579 struct ipx_addr *ina = &(IA_SIPX(ifa)->sipx_addr); 4580 if (ipx_nullhost(*ina)) { 4581 ina->x_host = *(union ipx_host *)(sc->tulip_enaddr); 4582 } else { 4583 ifp->if_flags &= ~IFF_RUNNING; 4584 bcopy((caddr_t)ina->x_host.c_host, 4585 (caddr_t)sc->tulip_enaddr, 4586 sizeof(sc->tulip_enaddr)); 4587 } 4588 tulip_init(sc); 4589 break; 4590 } 4591#endif /* IPX */ 4592 4593#ifdef NS 4594 /* 4595 * This magic copied from if_is.c; I don't use XNS, 4596 * so I have no way of telling if this actually 4597 * works or not. 4598 */ 4599 case AF_NS: { 4600 struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr); 4601 if (ns_nullhost(*ina)) { 4602 ina->x_host = *(union ns_host *)(sc->tulip_enaddr); 4603 } else { 4604 ifp->if_flags &= ~IFF_RUNNING; 4605 bcopy((caddr_t)ina->x_host.c_host, 4606 (caddr_t)sc->tulip_enaddr, 4607 sizeof(sc->tulip_enaddr)); 4608 } 4609 tulip_init(sc); 4610 break; 4611 } 4612#endif /* NS */ 4613 4614 default: { 4615 tulip_init(sc); 4616 break; 4617 } 4618 } 4619 break; 4620 } | 4563 case SIOCSIFADDR: |
4621 case SIOCGIFADDR: { | 4564 case SIOCGIFADDR: { |
4622 bcopy((caddr_t) sc->tulip_enaddr, 4623 (caddr_t) ((struct sockaddr *)&ifr->ifr_data)->sa_data, 4624 6); | 4565 error = ether_ioctl(ifp, cmd, data); |
4625 break; 4626 } 4627 4628 case SIOCSIFFLAGS: { 4629 tulip_addr_filter(sc); /* reinit multicast filter */ 4630 tulip_init(sc); 4631 break; 4632 } --- 205 unchanged lines hidden (view full) --- 4838 struct ifnet * const ifp = &sc->tulip_if; 4839 4840 ifp->if_flags = IFF_BROADCAST|IFF_SIMPLEX|IFF_MULTICAST; 4841 ifp->if_ioctl = tulip_ifioctl; 4842 ifp->if_start = tulip_ifstart; 4843 ifp->if_watchdog = tulip_ifwatchdog; 4844 ifp->if_timer = 1; 4845 ifp->if_output = ether_output; | 4566 break; 4567 } 4568 4569 case SIOCSIFFLAGS: { 4570 tulip_addr_filter(sc); /* reinit multicast filter */ 4571 tulip_init(sc); 4572 break; 4573 } --- 205 unchanged lines hidden (view full) --- 4779 struct ifnet * const ifp = &sc->tulip_if; 4780 4781 ifp->if_flags = IFF_BROADCAST|IFF_SIMPLEX|IFF_MULTICAST; 4782 ifp->if_ioctl = tulip_ifioctl; 4783 ifp->if_start = tulip_ifstart; 4784 ifp->if_watchdog = tulip_ifwatchdog; 4785 ifp->if_timer = 1; 4786 ifp->if_output = ether_output; |
4787 ifp->if_init = tulip_ifinit; |
|
4846 4847 printf("%s%d: %s%s pass %d.%d%s\n", 4848 sc->tulip_name, sc->tulip_unit, 4849 sc->tulip_boardid, 4850 tulip_chipdescs[sc->tulip_chipid], 4851 (sc->tulip_revinfo & 0xF0) >> 4, 4852 sc->tulip_revinfo & 0x0F, 4853 (sc->tulip_features & (TULIP_HAVE_ISVSROM|TULIP_HAVE_OKSROM)) --- 478 unchanged lines hidden --- | 4788 4789 printf("%s%d: %s%s pass %d.%d%s\n", 4790 sc->tulip_name, sc->tulip_unit, 4791 sc->tulip_boardid, 4792 tulip_chipdescs[sc->tulip_chipid], 4793 (sc->tulip_revinfo & 0xF0) >> 4, 4794 sc->tulip_revinfo & 0x0F, 4795 (sc->tulip_features & (TULIP_HAVE_ISVSROM|TULIP_HAVE_OKSROM)) --- 478 unchanged lines hidden --- |