diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-05-09 22:40:03 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-05-09 22:40:03 +0000 |
commit | ef4bbe04287b9bc9e7725b58234e1f8e12c50d03 (patch) | |
tree | 29936f3dfbff1d31db0624ba92ca8df08cdc311b /sys | |
parent | dbbd0bbcc2473d3a9bbd70ecc40e0fc4e83152e0 (diff) |
From NetBSD:
Changed struct ifnet to have a pointer to the softc of the underlying
device and a printable "external name" (name + unit number), thus eliminating
if_name and if_unit. Updated interface to (*if_watchdog)() and (*if_start)()
to take a struct ifnet *, rather than a unit number.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/amiga/dev/if_ae.c | 20 | ||||
-rw-r--r-- | sys/arch/amiga/dev/if_bah.c | 28 | ||||
-rw-r--r-- | sys/arch/amiga/dev/if_ed.c | 20 | ||||
-rw-r--r-- | sys/arch/amiga/dev/if_es.c | 20 | ||||
-rw-r--r-- | sys/arch/amiga/dev/if_levar.h | 39 | ||||
-rw-r--r-- | sys/arch/amiga/dev/if_qn.c | 20 |
6 files changed, 55 insertions, 92 deletions
diff --git a/sys/arch/amiga/dev/if_ae.c b/sys/arch/amiga/dev/if_ae.c index 57d9e7f9983..a0ac1f62833 100644 --- a/sys/arch/amiga/dev/if_ae.c +++ b/sys/arch/amiga/dev/if_ae.c @@ -1,5 +1,5 @@ -/* $OpenBSD: if_ae.c,v 1.6 1996/05/05 13:36:23 mickey Exp $ */ -/* $NetBSD: if_ae.c,v 1.7 1996/04/21 21:11:40 veego Exp $ */ +/* $OpenBSD: if_ae.c,v 1.7 1996/05/09 22:39:58 niklas Exp $ */ +/* $NetBSD: if_ae.c,v 1.8 1996/05/07 00:46:37 thorpej Exp $ */ /* * Copyright (c) 1995 Bernd Ernesti and Klaus Burkert. All rights reserved. @@ -121,7 +121,7 @@ static u_int16_t revision; int aematch __P((struct device *, void *, void *)); void aeattach __P((struct device *, struct device *, void *)); -void aewatchdog __P((int)); +void aewatchdog __P((struct ifnet *)); void aestop __P((struct ae_softc *)); void aememinit __P((struct ae_softc *)); void aereset __P((struct ae_softc *)); @@ -221,8 +221,8 @@ aeattach(parent, self, aux) splx (s); - ifp->if_unit = sc->sc_dev.dv_unit; - ifp->if_name = ae_cd.cd_name; + bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); + ifp->if_softc = sc; ifp->if_ioctl = aeioctl; ifp->if_watchdog = aewatchdog; ifp->if_output = ether_output; @@ -244,10 +244,10 @@ aeattach(parent, self, aux) } void -aewatchdog(unit) - int unit; +aewatchdog(ifp) + struct ifnet *ifp; { - struct ae_softc *sc = ae_cd.cd_devs[unit]; + struct ae_softc *sc = ifp->if_softc; log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname); ++sc->sc_arpcom.ac_if.if_oerrors; @@ -432,7 +432,7 @@ void aestart(ifp) struct ifnet *ifp; { - register struct ae_softc *sc = ae_cd.cd_devs[ifp->if_unit]; + register struct ae_softc *sc = ifp->if_softc; register int bix; register struct aetmd *tmd; register struct mbuf *m; @@ -943,7 +943,7 @@ aeioctl(ifp, cmd, data) u_long cmd; caddr_t data; { - struct ae_softc *sc = ae_cd.cd_devs[ifp->if_unit]; + struct ae_softc *sc = ifp->if_softc; struct ifaddr *ifa = (struct ifaddr *)data; struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; diff --git a/sys/arch/amiga/dev/if_bah.c b/sys/arch/amiga/dev/if_bah.c index cc6913b2bb3..4c63ea441e6 100644 --- a/sys/arch/amiga/dev/if_bah.c +++ b/sys/arch/amiga/dev/if_bah.c @@ -1,5 +1,5 @@ -/* $OpenBSD: if_bah.c,v 1.5 1996/05/02 06:44:03 niklas Exp $ */ -/* $NetBSD: if_bah.c,v 1.17 1996/04/21 21:11:42 veego Exp $ */ +/* $OpenBSD: if_bah.c,v 1.6 1996/05/09 22:39:59 niklas Exp $ */ +/* $NetBSD: if_bah.c,v 1.18 1996/05/07 00:46:39 thorpej Exp $ */ /* * Copyright (c) 1994, 1995 Ignatios Souvatzis @@ -184,7 +184,7 @@ void bah_stop __P((struct bah_softc *)); void bah_start __P((struct ifnet *)); int bahintr __P((void *)); int bah_ioctl __P((struct ifnet *, unsigned long, caddr_t)); -void bah_watchdog __P((int)); +void bah_watchdog __P((struct ifnet *)); void movepout __P((u_char *from, u_char __volatile *to, int len)); void movepin __P((u_char __volatile *from, u_char *to, int len)); void bah_srint __P((void *vsc, void *dummy)); @@ -271,8 +271,8 @@ bah_zbus_attach(parent, self, aux) */ bah_stop(sc); - ifp->if_unit = sc->sc_dev.dv_unit; - ifp->if_name = bah_cd.cd_name; + bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); + ifp->if_softc = sc; ifp->if_output = arc_output; ifp->if_start = bah_start; ifp->if_ioctl = bah_ioctl; @@ -359,8 +359,8 @@ bah_reset(sc) linkaddress = sc->sc_base->dipswitches; #if defined(BAH_DEBUG) && (BAH_DEBUG > 2) - printf("bah%ld: reset: card reset, link addr = 0x%02x (%ld)\n", - ifp->if_unit, linkaddress, linkaddress); + printf("%s: reset: card reset, link addr = 0x%02x (%ld)\n", + sc->sc_dev.dv_xname, linkaddress, linkaddress); #endif sc->sc_arccom.ac_anaddr = linkaddress; @@ -539,7 +539,7 @@ bah_start(ifp) u_long copystart, lencopy, perbyte; #endif - sc = bah_cd.cd_devs[ifp->if_unit]; + sc = ifp->if_softc; #if defined(BAH_DEBUG) && (BAH_DEBUG > 3) printf("%s: start(0x%x)\n", sc->sc_dev.dv_xname, ifp); @@ -1150,7 +1150,7 @@ bah_ioctl(ifp, command, data) int s, error; error = 0; - sc = bah_cd.cd_devs[ifp->if_unit]; + sc = ifp->if_softc; ifa = (struct ifaddr *)data; s = splnet(); @@ -1217,14 +1217,10 @@ bah_ioctl(ifp, command, data) */ void -bah_watchdog(unit) -int unit; -{ - struct bah_softc *sc; +bah_watchdog(ifp) struct ifnet *ifp; - - sc = bah_cd.cd_devs[unit]; - ifp = &(sc->sc_arccom.ac_if); +{ + struct bah_softc *sc = ifp->if_softc;; sc->sc_base->command = ARC_TXDIS; return; diff --git a/sys/arch/amiga/dev/if_ed.c b/sys/arch/amiga/dev/if_ed.c index 8ae6d2e6f62..65fcdb55c69 100644 --- a/sys/arch/amiga/dev/if_ed.c +++ b/sys/arch/amiga/dev/if_ed.c @@ -1,5 +1,5 @@ -/* $OpenBSD: if_ed.c,v 1.6 1996/05/06 08:10:17 mickey Exp $ */ -/* $NetBSD: if_ed.c,v 1.20 1996/04/21 21:11:44 veego Exp $ */ +/* $OpenBSD: if_ed.c,v 1.7 1996/05/09 22:40:00 niklas Exp $ */ +/* $NetBSD: if_ed.c,v 1.21 1996/05/07 00:46:41 thorpej Exp $ */ /* * Device driver for National Semiconductor DS8390/WD83C690 based ethernet @@ -96,7 +96,7 @@ void ed_zbus_attach __P((struct device *, struct device *, void *)); int edintr __P((void *)); int ed_ioctl __P((struct ifnet *, u_long, caddr_t)); void ed_start __P((struct ifnet *)); -void ed_watchdog __P((int)); +void ed_watchdog __P((struct ifnet *)); void ed_reset __P((struct ed_softc *)); void ed_init __P((struct ed_softc *)); void ed_stop __P((struct ed_softc *)); @@ -256,8 +256,8 @@ ed_zbus_attach(parent, self, aux) ed_stop(sc); /* Initialize ifnet structure. */ - ifp->if_unit = sc->sc_dev.dv_unit; - ifp->if_name = ed_cd.cd_name; + bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); + ifp->if_softc = sc; ifp->if_start = ed_start; ifp->if_ioctl = ed_ioctl; ifp->if_watchdog = ed_watchdog; @@ -322,10 +322,10 @@ ed_stop(sc) * an interrupt after a transmit has been started on it. */ void -ed_watchdog(unit) - int unit; +ed_watchdog(ifp) + struct ifnet *ifp; { - struct ed_softc *sc = ed_cd.cd_devs[unit]; + struct ed_softc *sc = ifp->if_softc; log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname); ++sc->sc_arpcom.ac_if.if_oerrors; @@ -498,7 +498,7 @@ void ed_start(ifp) struct ifnet *ifp; { - struct ed_softc *sc = ed_cd.cd_devs[ifp->if_unit]; + struct ed_softc *sc = ifp->if_softc; struct mbuf *m0, *m; caddr_t buffer; int len; @@ -858,7 +858,7 @@ ed_ioctl(ifp, command, data) u_long command; caddr_t data; { - struct ed_softc *sc = ed_cd.cd_devs[ifp->if_unit]; + struct ed_softc *sc = ifp->if_softc; register struct ifaddr *ifa = (struct ifaddr *)data; struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; diff --git a/sys/arch/amiga/dev/if_es.c b/sys/arch/amiga/dev/if_es.c index 375b38de25b..798b7f9d607 100644 --- a/sys/arch/amiga/dev/if_es.c +++ b/sys/arch/amiga/dev/if_es.c @@ -1,5 +1,5 @@ -/* $OpenBSD: if_es.c,v 1.8 1996/05/06 09:21:45 niklas Exp $ */ -/* $NetBSD: if_es.c,v 1.12 1996/05/01 15:55:28 mhitch Exp $ */ +/* $OpenBSD: if_es.c,v 1.9 1996/05/09 22:40:01 niklas Exp $ */ +/* $NetBSD: if_es.c,v 1.13 1996/05/07 00:46:44 thorpej Exp $ */ /* * Copyright (c) 1995 Michael L. Hitch @@ -110,7 +110,7 @@ void es_dump_smcregs __P((char *, union smcregs *)); int esintr __P((void *)); void esstart __P((struct ifnet *)); -void eswatchdog __P((int)); +void eswatchdog __P((struct ifnet *)); int esioctl __P((struct ifnet *, u_long, caddr_t)); void esrint __P((struct es_softc *)); void estint __P((struct es_softc *)); @@ -178,8 +178,8 @@ esattach(parent, self, aux) sc->sc_arpcom.ac_enaddr[5] = (ser ) & 0xff; /* Initialize ifnet structure. */ - ifp->if_unit = sc->sc_dev.dv_unit; - ifp->if_name = es_cd.cd_name; + bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); + ifp->if_softc = sc; ifp->if_output = ether_output; ifp->if_ioctl = esioctl; ifp->if_start = esstart; @@ -751,7 +751,7 @@ void esstart(ifp) struct ifnet *ifp; { - struct es_softc *sc = es_cd.cd_devs[ifp->if_unit]; + struct es_softc *sc = ifp->if_softc; union smcregs *smc = sc->sc_base; struct mbuf *m0, *m; #ifdef USEPKTBUF @@ -960,7 +960,7 @@ esioctl(ifp, command, data) u_long command; caddr_t data; { - struct es_softc *sc = es_cd.cd_devs[ifp->if_unit]; + struct es_softc *sc = ifp->if_softc; register struct ifaddr *ifa = (struct ifaddr *)data; struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; @@ -1062,10 +1062,10 @@ esreset(sc) } void -eswatchdog(unit) - int unit; +eswatchdog(ifp) + struct ifnet *ifp; { - struct es_softc *sc = es_cd.cd_devs[unit]; + struct es_softc *sc = ifp->if_softc; log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname); ++sc->sc_arpcom.ac_if.if_oerrors; diff --git a/sys/arch/amiga/dev/if_levar.h b/sys/arch/amiga/dev/if_levar.h index 42268bfe37d..2a2676424ee 100644 --- a/sys/arch/amiga/dev/if_levar.h +++ b/sys/arch/amiga/dev/if_levar.h @@ -1,5 +1,5 @@ -/* $OpenBSD: if_levar.h,v 1.2 1996/05/02 06:44:07 niklas Exp $ */ -/* $NetBSD: if_levar.h,v 1.2 1996/04/21 21:11:48 veego Exp $ */ +/* $OpenBSD: if_levar.h,v 1.3 1996/05/09 22:40:01 niklas Exp $ */ +/* $NetBSD: if_levar.h,v 1.3 1996/05/07 00:46:45 thorpej Exp $ */ /* * Copyright (c) 1982, 1990 The Regents of the University of California. @@ -50,40 +50,7 @@ struct lereg1 { * This structure contains the output queue for the interface, its address, ... */ struct le_softc { - struct device sc_dev; /* base structure */ - struct arpcom sc_arpcom; /* Ethernet common part */ - - void (*sc_copytodesc) /* Copy to descriptor */ - __P((struct le_softc *, void *, int, int)); - void (*sc_copyfromdesc) /* Copy from descriptor */ - __P((struct le_softc *, void *, int, int)); - void (*sc_copytobuf) /* Copy to buffer */ - __P((struct le_softc *, void *, int, int)); - void (*sc_copyfrombuf) /* Copy from buffer */ - __P((struct le_softc *, void *, int, int)); - void (*sc_zerobuf) /* and Zero bytes in buffer */ - __P((struct le_softc *, int, int)); - - u_int16_t sc_conf3; /* CSR3 value */ - - void *sc_mem; /* base address of RAM -- CPU's view */ - u_long sc_addr; /* base address of RAM -- LANCE's view */ - u_long sc_memsize; /* size of RAM */ - - int sc_nrbuf; /* number of receive buffers */ - int sc_ntbuf; /* number of transmit buffers */ - int sc_last_rd; - int sc_first_td, sc_last_td, sc_no_td; - - int sc_initaddr; - int sc_rmdaddr; - int sc_tmdaddr; - int sc_rbufaddr; - int sc_tbufaddr; - -#ifdef LEDEBUG - int sc_debug; -#endif + struct am7990_softc sc_am7990; /* glue to MI code */ struct isr sc_isr; struct lereg1 *sc_r1; /* LANCE registers */ diff --git a/sys/arch/amiga/dev/if_qn.c b/sys/arch/amiga/dev/if_qn.c index 4541be7a4bf..eba8567bc5a 100644 --- a/sys/arch/amiga/dev/if_qn.c +++ b/sys/arch/amiga/dev/if_qn.c @@ -1,5 +1,5 @@ -/* $OpenBSD: if_qn.c,v 1.7 1996/05/06 08:10:30 mickey Exp $ */ -/* $NetBSD: if_qn.c,v 1.5 1996/04/21 21:11:50 veego Exp $ */ +/* $OpenBSD: if_qn.c,v 1.8 1996/05/09 22:40:02 niklas Exp $ */ +/* $NetBSD: if_qn.c,v 1.6 1996/05/07 00:46:47 thorpej Exp $ */ /* * Copyright (c) 1995 Mika Kortelainen @@ -156,7 +156,7 @@ void qnattach __P((struct device *, struct device *, void *)); int qnintr __P((void *)); int qnioctl __P((struct ifnet *, u_long, caddr_t)); void qnstart __P((struct ifnet *)); -void qnwatchdog __P((int)); +void qnwatchdog __P((struct ifnet *)); void qnreset __P((struct qn_softc *)); void qninit __P((struct qn_softc *)); void qnstop __P((struct qn_softc *)); @@ -238,8 +238,8 @@ qnattach(parent, self, aux) /* set interface to stopped condition (reset) */ qnstop(sc); - ifp->if_unit = sc->sc_dev.dv_unit; - ifp->if_name = qn_cd.cd_name; + bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); + ifp->if_softc = sc; ifp->if_ioctl = qnioctl; ifp->if_watchdog = qnwatchdog; ifp->if_output = ether_output; @@ -318,10 +318,10 @@ qninit(sc) * generate an interrupt after a transmit has been started on it. */ void -qnwatchdog(unit) - int unit; +qnwatchdog(ifp) + struct ifnet *ifp; { - struct qn_softc *sc = qn_cd.cd_devs[unit]; + struct qn_softc *sc = ifp->if_softc; log(LOG_INFO, "qn: device timeout (watchdog)\n"); ++sc->sc_arpcom.ac_if.if_oerrors; @@ -404,7 +404,7 @@ void qnstart(ifp) struct ifnet *ifp; { - struct qn_softc *sc = qn_cd.cd_devs[ifp->if_unit]; + struct qn_softc *sc = ifp->if_softc; struct mbuf *m; u_short len; int timout = 60000; @@ -863,7 +863,7 @@ qnioctl(ifp, command, data) u_long command; caddr_t data; { - struct qn_softc *sc = qn_cd.cd_devs[ifp->if_unit]; + struct qn_softc *sc = ifp->if_softc; register struct ifaddr *ifa = (struct ifaddr *)data; #if 0 struct ifreg *ifr = (struct ifreg *)data; |