From 24e218260af83b7292524d1581b8dfcf5d3c8c5b Mon Sep 17 00:00:00 2001 From: wollman Date: Wed, 19 Oct 1994 01:59:11 +0000 Subject: Add support for devconf to a large number of device drivers, and do the right thing in dev_goawayall() when kdc_goaway is null. --- sys/dev/ed/if_ed.c | 20 +++++++++++++++++- sys/dev/fdc/fdc.c | 4 ++-- sys/dev/ie/if_ie.c | 21 ++++++++++++++++++- sys/dev/lnc/if_lnc.c | 57 ++++++++++++++++++++++++++++++++++------------------ 4 files changed, 79 insertions(+), 23 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/ed/if_ed.c b/sys/dev/ed/if_ed.c index 38b7f44..a3479f6 100644 --- a/sys/dev/ed/if_ed.c +++ b/sys/dev/ed/if_ed.c @@ -13,7 +13,7 @@ * the SMC Elite Ultra (8216), the 3Com 3c503, the NE1000 and NE2000, * and a variety of similar clones. * - * $Id: if_ed.c,v 1.50 1994/10/14 11:56:36 davidg Exp $ + * $Id: if_ed.c,v 1.51 1994/10/17 21:16:37 phk Exp $ */ #include "ed.h" @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -166,6 +167,22 @@ static unsigned short ed_790_intr_mask[] = { #define ETHER_ADDR_LEN 6 #define ETHER_HDR_SIZE 14 +static struct kern_devconf kdc_ed[NED] = { { + 0, 0, 0, /* filled in by dev_attach */ + "ed", 0, { "isa0", MDDT_ISA, 0 }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN +} }; + +static inline void +ed_registerdev(struct isa_device *id) +{ + if(id->id_unit) + kdc_ed[id->id_unit] = kdc_ed[0]; + kdc_ed[id->id_unit].kdc_unit = id->id_unit; + kdc_ed[id->id_unit].kdc_isa = id; + dev_attach(&kdc_ed[id->id_unit]); +} + /* * Determine if the device is present * @@ -1097,6 +1114,7 @@ ed_attach(isa_dev) * Attach the interface */ if_attach(ifp); + ed_registerdev(isa_dev); /* * Print additional info when attached diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c index 89885a1..a645d34 100644 --- a/sys/dev/fdc/fdc.c +++ b/sys/dev/fdc/fdc.c @@ -81,7 +81,6 @@ static int fd_goaway(struct kern_devconf *, int); static int fdc_goaway(struct kern_devconf *, int); static int fd_externalize(struct proc *, struct kern_devconf *, void *, size_t); -static int fdc_externalize(struct proc *, struct kern_devconf *, void *, size_t); /* * Templates for the kern_devconf structures used when we attach. @@ -95,7 +94,7 @@ static struct kern_devconf kdc_fd_template = { static struct kern_devconf kdc_fdc_template = { 0, 0, 0, /* filled in by kern_devconf.c */ "fdc", 0, { "isa0", MDDT_ISA, 0 }, - fdc_externalize, 0, fdc_goaway, ISA_EXTERNALLEN + isa_generic_externalize, 0, fdc_goaway, ISA_EXTERNALLEN }; static inline void @@ -380,6 +379,7 @@ fdattach(dev) return 0; *kdc = kdc_fdc_template; kdc->kdc_unit = fdcu; + kdc->kdc_isa = dev; dev_attach(kdc); fdc->fdcu = fdcu; diff --git a/sys/dev/ie/if_ie.c b/sys/dev/ie/if_ie.c index 0371610..43bd9cc 100644 --- a/sys/dev/ie/if_ie.c +++ b/sys/dev/ie/if_ie.c @@ -43,7 +43,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: if_ie.c,v 1.14 1994/09/05 22:28:31 ats Exp $ + * $Id: if_ie.c,v 1.15 1994/09/07 03:34:12 wollman Exp $ */ /* @@ -115,6 +115,7 @@ iomem, and to make 16-pointers, we subtract iomem and and with 0xffff. #include #include #include +#include #include #include @@ -305,6 +306,22 @@ static int sl_probe(struct isa_device *); static int el_probe(struct isa_device *); static int ni_probe(struct isa_device *); +static struct kern_devconf kdc_ie[NIE] = { { + 0, 0, 0, /* filled in by dev_attach */ + "ie", 0, { "isa0", MDDT_ISA, 0 }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN +} }; + +static inline void +ie_registerdev(struct isa_device *id) +{ + if(id->id_unit) + kdc_ie[id->id_unit] = kdc_ie[0]; + kdc_ie[id->id_unit].kdc_unit = id->id_unit; + kdc_ie[id->id_unit].kdc_isa = id; + dev_attach(&kdc_ie[id->id_unit]); +} + /* This routine written by Charles Martin Hannum. */ int ieprobe(dvp) struct isa_device *dvp; @@ -569,6 +586,8 @@ ieattach(dvp) #endif if_attach(ifp); + ie_registerdev(dvp); + { struct ifaddr *ifa = ifp->if_addrlist; struct sockaddr_dl *sdl; diff --git a/sys/dev/lnc/if_lnc.c b/sys/dev/lnc/if_lnc.c index 89cec80..1c6911a 100644 --- a/sys/dev/lnc/if_lnc.c +++ b/sys/dev/lnc/if_lnc.c @@ -51,31 +51,34 @@ #define MULTICAST_ADDR_LEN 8 #define ETHER_MIN_LEN 64 -#include "param.h" -#include "systm.h" -#include "errno.h" -#include "ioctl.h" -#include "mbuf.h" -#include "socket.h" -#include "syslog.h" -#include "net/if.h" -#include "net/if_dl.h" -#include "net/if_types.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include #ifdef INET -#include "netinet/in.h" -#include "netinet/in_systm.h" -#include "netinet/in_var.h" -#include "netinet/ip.h" -#include "netinet/if_ether.h" +#include +#include +#include +#include +#include #endif #if NBPFILTER > 0 -#include "net/bpf.h" -#include "net/bpfdesc.h" +#include +#include #endif -#include "i386/isa/isa_device.h" -#include "i386/isa/if_lnc.h" +#include +#include struct lnc_softc { struct arpcom arpcom; /* see ../../netinet/if_ether.h */ @@ -725,6 +728,22 @@ lnc_tint(int unit) } +static struct kern_devconf kdc_lnc[NLNC] = { { + 0, 0, 0, /* filled in by dev_attach */ + "lnc", 0, { "isa0", MDDT_ISA, 0 }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN +} }; + +static inline void +lnc_registerdev(struct isa_device *id) +{ + if(id->id_unit) + kdc_lnc[id->id_unit] = kdc_lnc[0]; + kdc_lnc[id->id_unit].kdc_unit = id->id_unit; + kdc_lnc[id->id_unit].kdc_isa = id; + dev_attach(&kdc_lnc[id->id_unit]); +} + int lnc_probe(struct isa_device * isa_dev) { -- cgit v1.1