From 7b8e09399aded7c12a148b104ccf05419e73ba88 Mon Sep 17 00:00:00 2001 From: wollman Date: Sun, 23 Oct 1994 21:28:03 +0000 Subject: Finished device configuration database work for all ISA devices (except `ze') and all SCSI devices (except that it's not done quite the way I want). New information added includes: - A text description of the device - A ``state''---unknown, unconfigured, idle, or busy - A generic parent device (with support in the m.i. code) - An interrupt mask type field (which will hopefully go away) so that . ``doconfig'' can be written This requires a new version of the `lsdev' program as well (next commit). --- sys/dev/ed/if_ed.c | 17 +++++++----- sys/dev/ep/if_ep.c | 26 ++++++++++++++++-- sys/dev/fdc/fdc.c | 68 ++++++++++++++++++++++++++++------------------- sys/dev/ie/if_ie.c | 15 +++++++---- sys/dev/lnc/if_lnc.c | 8 ++++-- sys/dev/mcd/mcd.c | 28 ++++++++++++++++++- sys/dev/mse/mse.c | 24 ++++++++++++++++- sys/dev/sio/sio.c | 26 +++++++++++++++++- sys/dev/syscons/syscons.c | 27 ++++++++++++++++++- 9 files changed, 192 insertions(+), 47 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/ed/if_ed.c b/sys/dev/ed/if_ed.c index d663bbc..ce0f700 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.52 1994/10/19 01:58:58 wollman Exp $ + * $Id: if_ed.c,v 1.53 1994/10/22 17:52:22 phk Exp $ */ #include "ed.h" @@ -173,17 +173,22 @@ static unsigned short ed_790_intr_mask[] = { 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 + "ed", 0, { MDDT_ISA, 0, "net" }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_BUSY, /* network interfaces are always ``open'' */ + "" /* description */ } }; static inline void -ed_registerdev(struct isa_device *id) +ed_registerdev(struct isa_device *id, const char *descr) { 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; + kdc_ed[id->id_unit].kdc_parentdata = id; + kdc_ed[id->id_unit].kdc_description = descr; dev_attach(&kdc_ed[id->id_unit]); } @@ -1120,7 +1125,7 @@ ed_attach(isa_dev) * Attach the interface */ if_attach(ifp); - ed_registerdev(isa_dev); + ed_registerdev(isa_dev, sc->type_str ? sc->type_str : "Ethernet adapter"); /* * Print additional info when attached diff --git a/sys/dev/ep/if_ep.c b/sys/dev/ep/if_ep.c index 5868576..a526ca3 100644 --- a/sys/dev/ep/if_ep.c +++ b/sys/dev/ep/if_ep.c @@ -21,8 +21,8 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * From: if_ep.c,v 1.9 1994/01/25 10:46:29 deraadt Exp $ - * $Id: if_ep.c,v 1.12 1994/09/03 18:10:43 ats Exp $ + * From: if_ep.c,v 1.9 1994/01/25 10:46:29 deraadt Exp + * $Id: if_ep.c,v 1.13 1994/09/16 13:33:41 davidg Exp $ */ #include "ep.h" @@ -40,6 +40,7 @@ #include #include #include +#include #if defined(__NetBSD__) #include #endif @@ -119,6 +120,26 @@ struct isa_driver epdriver = { "ep" }; +static struct kern_devconf kdc_ep[NEP] = { { + 0, 0, 0, /* filled in by dev_attach */ + "ep", 0, { MDDT_ISA, 0, "net" }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_BUSY, /* network interfaces are always ``open'' */ + "3Com 3C509 Ethernet adapter" +} }; + +static inline void +ep_registerdev(struct isa_device *id) +{ + if(id->id_unit) + kdc_ep[id->id_unit] = kdc_ep[0]; + kdc_ep[id->id_unit].kdc_unit = id->id_unit; + kdc_ep[id->id_unit].kdc_parentdata = id; + dev_attach(&kdc_ep[id->id_unit]); +} + static int send_ID_sequence __P((u_short)); static u_short epreadeeprom __P((int, int)); static int epbusyeeprom __P((int, ushort)); @@ -377,6 +398,7 @@ epattach(is) ifp->if_watchdog = epwatchdog; if_attach(ifp); + ep_registerdev(is); /* * Fill the hardware address into ifa_addr if we find an diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c index edbb903..a000acf 100644 --- a/sys/dev/fdc/fdc.c +++ b/sys/dev/fdc/fdc.c @@ -40,7 +40,7 @@ * SUCH DAMAGE. * * from: @(#)fd.c 7.4 (Berkeley) 5/25/91 - * $Id: fd.c,v 1.35 1994/10/19 01:58:56 wollman Exp $ + * $Id: fd.c,v 1.36 1994/10/21 16:58:50 joerg Exp $ * */ @@ -85,29 +85,50 @@ static int fd_externalize(struct proc *, struct kern_devconf *, void *, size_t); /* * Templates for the kern_devconf structures used when we attach. */ -static struct kern_devconf kdc_fd_template = { +static struct kern_devconf kdc_fd[NFD] = { { 0, 0, 0, /* filled in by kern_devconf.c */ - "fd", 0, { "fdc0", MDDT_DISK, 0 }, - fd_externalize, 0, fd_goaway, DISK_EXTERNALLEN -}; - -static struct kern_devconf kdc_fdc_template = { + "fd", 0, { MDDT_DISK, 0 }, + fd_externalize, 0, fd_goaway, DISK_EXTERNALLEN, + 0, /* parent */ + 0, /* parentdata */ + DC_UNKNOWN, /* state */ + "floppy disk" +} }; + +struct kern_devconf kdc_fdc[NFDC] = { { 0, 0, 0, /* filled in by kern_devconf.c */ - "fdc", 0, { "isa0", MDDT_ISA, 0 }, - isa_generic_externalize, 0, fdc_goaway, ISA_EXTERNALLEN -}; + "fdc", 0, { MDDT_ISA, 0, "bio" }, + isa_generic_externalize, 0, fdc_goaway, ISA_EXTERNALLEN, + 0, /* parent */ + 0, /* parentdata */ + DC_UNKNOWN, /* state */ + "floppy disk/tape controller" +} }; static inline void fd_registerdev(int ctlr, int unit) { - struct kern_devconf *kdc; - - MALLOC(kdc, struct kern_devconf *, sizeof *kdc, M_TEMP, M_NOWAIT); - if(!kdc) return; - *kdc = kdc_fd_template; - kdc->kdc_unit = unit; - sprintf(kdc->kdc_md.mddc_parent, "fdc%d", ctlr); - dev_attach(kdc); + if(unit != 0) + kdc_fd[unit] = kdc_fd[0]; + + kdc_fd[unit].kdc_unit = unit; + kdc_fd[unit].kdc_parent = &kdc_fdc[ctlr]; + kdc_fd[unit].kdc_parentdata = 0; + dev_attach(&kdc_fd[unit]); +} + +static inline void +fdc_registerdev(struct isa_device *dvp) +{ + int unit = dvp->id_unit; + + if(unit != 0) + kdc_fdc[unit] = kdc_fdc[0]; + + kdc_fdc[unit].kdc_unit = unit; + kdc_fdc[unit].kdc_parent = &kdc_isa0; + kdc_fdc[unit].kdc_parentdata = dvp; + dev_attach(&kdc_fdc[unit]); } static int @@ -115,7 +136,6 @@ fdc_goaway(struct kern_devconf *kdc, int force) { if(force) { dev_detach(kdc); - FREE(kdc, M_TEMP); return 0; } else { return EBUSY; /* XXX fix */ @@ -126,7 +146,6 @@ static int fd_goaway(struct kern_devconf *kdc, int force) { dev_detach(kdc); - FREE(kdc, M_TEMP); return 0; } @@ -372,15 +391,8 @@ fdattach(dev) fd_p fd; int fdsu, st0, i; struct isa_device *fdup; - struct kern_devconf *kdc; - MALLOC(kdc, struct kern_devconf *, sizeof *kdc, M_TEMP, M_NOWAIT); - if(!kdc) - return 0; - *kdc = kdc_fdc_template; - kdc->kdc_unit = fdcu; - kdc->kdc_isa = dev; - dev_attach(kdc); + fdc_registerdev(dev); fdc->fdcu = fdcu; fdc->flags |= FDC_ATTACHED; diff --git a/sys/dev/ie/if_ie.c b/sys/dev/ie/if_ie.c index 43bd9cc..fc42848 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.15 1994/09/07 03:34:12 wollman Exp $ + * $Id: if_ie.c,v 1.16 1994/10/19 01:59:00 wollman Exp $ */ /* @@ -308,17 +308,22 @@ 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 + "ie", 0, { MDDT_ISA, 0, "net" }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_BUSY, /* network interfaces are always ``busy'' */ + "" } }; static inline void -ie_registerdev(struct isa_device *id) +ie_registerdev(struct isa_device *id, const char *descr) { 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; + kdc_ie[id->id_unit].kdc_description = descr; dev_attach(&kdc_ie[id->id_unit]); } @@ -586,7 +591,7 @@ ieattach(dvp) #endif if_attach(ifp); - ie_registerdev(dvp); + ie_registerdev(dvp, ie_hardware_names[ie_softc[unit].hard_type]); { struct ifaddr *ifa = ifp->if_addrlist; diff --git a/sys/dev/lnc/if_lnc.c b/sys/dev/lnc/if_lnc.c index 1c6911a..ae3dd1c 100644 --- a/sys/dev/lnc/if_lnc.c +++ b/sys/dev/lnc/if_lnc.c @@ -730,8 +730,12 @@ 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 + "lnc", 0, { MDDT_ISA, 0, "net" }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_BUSY, + "Generic LANCE-based Ethernet adapter" } }; static inline void diff --git a/sys/dev/mcd/mcd.c b/sys/dev/mcd/mcd.c index 53b6fee..e27f600 100644 --- a/sys/dev/mcd/mcd.c +++ b/sys/dev/mcd/mcd.c @@ -39,7 +39,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: mcd.c,v 1.24 1994/09/06 21:56:09 se Exp $ + * $Id: mcd.c,v 1.25 1994/09/14 20:28:25 ache Exp $ */ static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore"; @@ -58,6 +58,8 @@ static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore"; #include #include #include +#include + #include #include #include @@ -197,6 +199,27 @@ struct isa_driver mcddriver = { mcd_probe, mcd_attach, "mcd" }; #define MIN_DELAY 15 #define DELAY_GETREPLY 1300000 +static struct kern_devconf kdc_mcd[NMCD] = { { + 0, 0, 0, /* filled in by dev_attach */ + "mcd", 0, { MDDT_ISA, 0, "bio" }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_IDLE, /* status */ + "Mitsumi CD-ROM controller" +} }; + +static inline void +mcd_registerdev(struct isa_device *id) +{ + if(id->id_unit) + kdc_mcd[id->id_unit] = kdc_mcd[0]; + kdc_mcd[id->id_unit].kdc_unit = id->id_unit; + kdc_mcd[id->id_unit].kdc_isa = id; + dev_attach(&kdc_mcd[id->id_unit]); +} + + int mcd_attach(struct isa_device *dev) { struct mcd_data *cd = mcd_data + dev->id_unit; @@ -210,6 +233,7 @@ int mcd_attach(struct isa_device *dev) /* wire controller for interrupts and dma */ mcd_configure(cd); #endif + mcd_registerdev(dev); return 1; } @@ -266,6 +290,7 @@ MCD_TRACE("open: partition=%d, disksize = %d, blksize=%d\n", cd->openflags |= (1<partflags[part] |= MCDREADRAW; + kdc_mcd[unit].kdc_state = DC_BUSY; return 0; } @@ -288,6 +313,7 @@ int mcdclose(dev_t dev) if (!(cd->flags & MCDINIT)) return ENXIO; + kdc_mcd[unit].kdc_state = DC_IDLE; if (mcd_getstat(unit,1) == -2) return 0; diff --git a/sys/dev/mse/mse.c b/sys/dev/mse/mse.c index 6337fde..c9b8344 100644 --- a/sys/dev/mse/mse.c +++ b/sys/dev/mse/mse.c @@ -11,7 +11,7 @@ * this software for any purpose. It is provided "as is" * without express or implied warranty. * - * $Id: mse.c,v 1.6 1994/08/13 03:50:10 wollman Exp $ + * $Id: mse.c,v 1.7 1994/10/21 01:19:07 wollman Exp $ */ /* * Driver for the Logitech and ATI Inport Bus mice for use with 386bsd and @@ -53,6 +53,7 @@ #include #include #include +#include #include #include @@ -174,6 +175,26 @@ mseprobe(idp) return (0); } +static struct kern_devconf kdc_mse[NMSE] = { { + 0, 0, 0, /* filled in by dev_attach */ + "mse", 0, { MDDT_ISA, 0, "tty" }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_UNKNOWN, /* not supported */ + "ATI or Logitech bus mouse adapter" +} }; + +static inline void +mse_registerdev(struct isa_device *id) +{ + if(id->id_unit) + kdc_mse[id->id_unit] = kdc_mse[0]; + kdc_mse[id->id_unit].kdc_unit = id->id_unit; + kdc_mse[id->id_unit].kdc_isa = id; + dev_attach(&kdc_mse[id->id_unit]); +} + int mseattach(idp) struct isa_device *idp; @@ -181,6 +202,7 @@ mseattach(idp) struct mse_softc *sc = &mse_sc[idp->id_unit]; sc->sc_port = idp->id_iobase; + mse_registerdev(idp); return (1); } diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index 54133ab..df925dc 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.56 1994/10/19 21:38:19 bde Exp $ + * $Id: sio.c,v 1.57 1994/10/20 00:45:36 phk Exp $ */ #include "sio.h" @@ -57,6 +57,7 @@ #include #include #include +#include #include @@ -526,6 +527,27 @@ sioprobe(dev) return (result); } +static struct kern_devconf kdc_sio[NSIO] = { { + 0, 0, 0, /* filled in by dev_attach */ + "sio", 0, { MDDT_ISA, 0, "tty" }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_UNKNOWN, /* not supported */ + "RS-232 serial port" +} }; + +static inline void +sio_registerdev(struct isa_device *id) +{ + if(id->id_unit) + kdc_sio[id->id_unit] = kdc_sio[0]; + kdc_sio[id->id_unit].kdc_unit = id->id_unit; + kdc_sio[id->id_unit].kdc_isa = id; + dev_attach(&kdc_sio[id->id_unit]); +} + + static int sioattach(isdp) struct isa_device *isdp; @@ -660,6 +682,8 @@ determined_type: ; #endif /* COM_MULTIPORT */ printf("\n"); + sio_registerdev(isdp); + #ifdef KGDB if (kgdb_dev == makedev(commajor, unit)) { if (unit == comconsole) diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index 229b981..5b45dd4 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -35,7 +35,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: syscons.c,v 1.69 1994/10/18 03:34:53 ache Exp $ + * $Id: syscons.c,v 1.70 1994/10/20 00:08:20 phk Exp $ */ #include "sc.h" @@ -55,10 +55,13 @@ #include #include #include +#include + #include #include #include #include + #include #include #include @@ -336,6 +339,27 @@ gotack: return (IO_KBDSIZE); } +static struct kern_devconf kdc_sc[NSC] = { { + 0, 0, 0, /* filled in by dev_attach */ + "sc", 0, { MDDT_ISA, 0, "tty" }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_UNKNOWN, /* not supported */ + "Parallel printer adapter" +} }; + +static inline void +sc_registerdev(struct isa_device *id) +{ + if(id->id_unit) + kdc_sc[id->id_unit] = kdc_sc[0]; + kdc_sc[id->id_unit].kdc_unit = id->id_unit; + kdc_sc[id->id_unit].kdc_isa = id; + dev_attach(&kdc_sc[id->id_unit]); +} + + int pcattach(struct isa_device *dev) { @@ -386,6 +410,7 @@ pcattach(struct isa_device *dev) /* get cursor going */ cursor_pos(1); update_leds(console[0].status); + sc_registerdev(dev); return 0; } -- cgit v1.1