diff options
author | Brooks Davis <brooks@FreeBSD.org> | 2005-06-10 16:49:24 +0000 |
---|---|---|
committer | Brooks Davis <brooks@FreeBSD.org> | 2005-06-10 16:49:24 +0000 |
commit | fc74a9f93a5fbc83262aa12084404ac953c854b5 (patch) | |
tree | f65b6d7834b40dfcd48534829a0a1e9529ab87ee /sys/dev/ex | |
parent | 7f1d8b7517a6a93379974243551e0ec0a96cb54e (diff) |
Notes
Diffstat (limited to 'sys/dev/ex')
-rw-r--r-- | sys/dev/ex/if_ex.c | 29 | ||||
-rw-r--r-- | sys/dev/ex/if_ex_isa.c | 2 | ||||
-rw-r--r-- | sys/dev/ex/if_ex_pccard.c | 2 | ||||
-rw-r--r-- | sys/dev/ex/if_exvar.h | 3 |
4 files changed, 22 insertions, 14 deletions
diff --git a/sys/dev/ex/if_ex.c b/sys/dev/ex/if_ex.c index 33598ba0a155e..300e433d7fec5 100644 --- a/sys/dev/ex/if_ex.c +++ b/sys/dev/ex/if_ex.c @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include <net/if_arp.h> #include <net/if_dl.h> #include <net/if_media.h> +#include <net/if_types.h> #include <net/ethernet.h> #include <net/bpf.h> @@ -202,12 +203,17 @@ int ex_attach(device_t dev) { struct ex_softc * sc = device_get_softc(dev); - struct ifnet * ifp = &sc->arpcom.ac_if; + struct ifnet * ifp; struct ifmedia * ifm; uint16_t temp; + ifp = sc->ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + device_printf(dev, "can not if_alloc()\n"); + return (ENOSPC); + } /* work out which set of irq <-> internal tables to use */ - if (ex_card_type(sc->arpcom.ac_enaddr) == CARD_TYPE_EX_10_PLUS) { + if (ex_card_type(sc->enaddr) == CARD_TYPE_EX_10_PLUS) { sc->irq2ee = plus_irq2eemap; sc->ee2irq = plus_ee2irqmap; } else { @@ -252,7 +258,7 @@ ex_attach(device_t dev) /* * Attach the interface. */ - ether_ifattach(ifp, sc->arpcom.ac_enaddr); + ether_ifattach(ifp, sc->enaddr); return(0); } @@ -264,12 +270,13 @@ ex_detach(device_t dev) struct ifnet *ifp; sc = device_get_softc(dev); - ifp = &sc->arpcom.ac_if; + ifp = sc->ifp; ex_stop(sc); ifp->if_flags &= ~IFF_RUNNING; ether_ifdetach(ifp); + if_free(ifp); ex_release_resources(dev); @@ -280,7 +287,7 @@ static void ex_init(void *xsc) { struct ex_softc * sc = (struct ex_softc *) xsc; - struct ifnet * ifp = &sc->arpcom.ac_if; + struct ifnet * ifp = sc->ifp; int s; int i; unsigned short temp_reg; @@ -299,7 +306,7 @@ ex_init(void *xsc) CSR_WRITE_1(sc, EEPROM_REG, temp_reg & ~Trnoff_Enable); } for (i = 0; i < ETHER_ADDR_LEN; i++) { - CSR_WRITE_1(sc, I_ADDR_REG0 + i, sc->arpcom.ac_enaddr[i]); + CSR_WRITE_1(sc, I_ADDR_REG0 + i, IFP2ENADDR(sc->ifp)[i]); } /* * - Setup transmit chaining and discard bad received frames. @@ -574,7 +581,7 @@ void ex_intr(void *arg) { struct ex_softc *sc = (struct ex_softc *)arg; - struct ifnet *ifp = &sc->arpcom.ac_if; + struct ifnet *ifp = sc->ifp; int int_status, send_pkts; int loops = 100; @@ -613,7 +620,7 @@ ex_intr(void *arg) static void ex_tx_intr(struct ex_softc *sc) { - struct ifnet * ifp = &sc->arpcom.ac_if; + struct ifnet * ifp = sc->ifp; int tx_status; DODEBUG(Start_End, printf("ex_tx_intr%d: start\n", unit);); @@ -660,7 +667,7 @@ ex_tx_intr(struct ex_softc *sc) static void ex_rx_intr(struct ex_softc *sc) { - struct ifnet * ifp = &sc->arpcom.ac_if; + struct ifnet * ifp = sc->ifp; int rx_status; int pkt_len; int QQQ; @@ -830,7 +837,7 @@ ex_setmulti(struct ex_softc *sc) int count; int timeout, status; - ifp = &sc->arpcom.ac_if; + ifp = sc->ifp; count = 0; TAILQ_FOREACH(maddr, &ifp->if_multiaddrs, ifma_link) { @@ -879,7 +886,7 @@ ex_setmulti(struct ex_softc *sc) /* Program our MAC address as well */ /* XXX: Is this necessary? The Linux driver does this * but the NetBSD driver does not */ - addr = (uint16_t*)(&sc->arpcom.ac_enaddr); + addr = (uint16_t*)(&IFP2ENADDR(sc->ifp)); CSR_WRITE_2(sc, IO_PORT_REG, *addr++); CSR_WRITE_2(sc, IO_PORT_REG, *addr++); CSR_WRITE_2(sc, IO_PORT_REG, *addr++); diff --git a/sys/dev/ex/if_ex_isa.c b/sys/dev/ex/if_ex_isa.c index 310f554ae22d0..214a53e12e846 100644 --- a/sys/dev/ex/if_ex_isa.c +++ b/sys/dev/ex/if_ex_isa.c @@ -296,7 +296,7 @@ ex_isa_attach(device_t dev) */ sc->irq_no = rman_get_start(sc->irq); - ex_get_address(sc, sc->arpcom.ac_enaddr); + ex_get_address(sc, sc->enaddr); temp = ex_eeprom_read(sc, EE_W0); device_printf(sc->dev, "%s config, %s bus, ", diff --git a/sys/dev/ex/if_ex_pccard.c b/sys/dev/ex/if_ex_pccard.c index 16b9d2045f9ee..8671e87d00bff 100644 --- a/sys/dev/ex/if_ex_pccard.c +++ b/sys/dev/ex/if_ex_pccard.c @@ -231,7 +231,7 @@ ex_pccard_attach(device_t dev) error = ENXIO; goto bad; } - bcopy(ether_addr, sc->arpcom.ac_enaddr, ETHER_ADDR_LEN); + bcopy(ether_addr, sc->enaddr, ETHER_ADDR_LEN); if ((error = ex_attach(dev)) != 0) { device_printf(dev, "ex_attach() failed!\n"); diff --git a/sys/dev/ex/if_exvar.h b/sys/dev/ex/if_exvar.h index 6427f1fcd4942..5e2f001b52b86 100644 --- a/sys/dev/ex/if_exvar.h +++ b/sys/dev/ex/if_exvar.h @@ -30,8 +30,9 @@ */ struct ex_softc { - struct arpcom arpcom; /* Ethernet common data */ + struct ifnet *ifp; struct ifmedia ifmedia; + u_char enaddr[6]; device_t dev; struct resource *ioport; |