diff options
53 files changed, 968 insertions, 250 deletions
diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c index 98e2276..991bfd9 100644 --- a/sys/amd64/amd64/fpu.c +++ b/sys/amd64/amd64/fpu.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)npx.c 7.2 (Berkeley) 5/12/91 - * $Id: npx.c,v 1.13 1994/09/22 14:44:16 davidg Exp $ + * $Id: npx.c,v 1.14 1994/10/08 22:27:58 phk Exp $ */ #include "npx.h" @@ -43,11 +43,14 @@ #include <sys/conf.h> #include <sys/file.h> #include <sys/proc.h> +#include <sys/devconf.h> +#include <sys/ioctl.h> + #include <machine/cpu.h> #include <machine/pcb.h> #include <machine/trap.h> -#include <sys/ioctl.h> #include <machine/specialreg.h> + #include <i386/isa/icu.h> #include <i386/isa/isa_device.h> #include <i386/isa/isa.h> @@ -302,6 +305,26 @@ npxprobe1(dvp) return (-1); } +static struct kern_devconf kdc_npx[NNPX] = { { + 0, 0, 0, /* filled in by dev_attach */ + "npx", 0, { MDDT_ISA, 0 }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_UNKNOWN, /* not supported */ + "Floating-point unit" +} }; + +static inline void +npx_registerdev(struct isa_device *id) +{ + if(id->id_unit) + kdc_npx[id->id_unit] = kdc_npx[0]; + kdc_npx[id->id_unit].kdc_unit = id->id_unit; + kdc_npx[id->id_unit].kdc_isa = id; + dev_attach(&kdc_npx[id->id_unit]); +} + /* * Attach routine - announce which it is, and wire into system */ @@ -318,6 +341,7 @@ npxattach(dvp) } } npxinit(__INITIAL_NPXCW__); + npx_registerdev(dvp); return (1); /* XXX unused */ } diff --git a/sys/amd64/isa/isa.c b/sys/amd64/isa/isa.c index 90dd24d..e2b0028 100644 --- a/sys/amd64/isa/isa.c +++ b/sys/amd64/isa/isa.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 - * $Id: isa.c,v 1.30 1994/10/19 01:59:06 wollman Exp $ + * $Id: isa.c,v 1.31 1994/10/19 21:57:51 bde Exp $ */ /* @@ -106,6 +106,16 @@ inthand2_t *intr_handler[ICU_LEN]; u_int intr_mask[ICU_LEN]; int intr_unit[ICU_LEN]; +struct kern_devconf kdc_isa0 = { + 0, 0, 0, /* filled in by dev_attach */ + "isa", 0, { MDDT_BUS, 0 }, + 0, 0, 0, BUS_EXTERNALLEN, + 0, /* no parent yet; parent should be CPU */ + 0, /* no parentdata */ + DC_BUSY, /* busses are always busy */ + "ISA or EISA bus" +}; + static inthand_t *fastintr[ICU_LEN] = { &IDTVEC(fastintr0), &IDTVEC(fastintr1), &IDTVEC(fastintr2), &IDTVEC(fastintr3), @@ -270,6 +280,8 @@ void isa_configure() { struct isa_device *dvp; + dev_attach(&kdc_isa0); + splhigh(); enable_intr(); INTREN(IRQ_SLAVE); diff --git a/sys/amd64/isa/npx.c b/sys/amd64/isa/npx.c index 98e2276..991bfd9 100644 --- a/sys/amd64/isa/npx.c +++ b/sys/amd64/isa/npx.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)npx.c 7.2 (Berkeley) 5/12/91 - * $Id: npx.c,v 1.13 1994/09/22 14:44:16 davidg Exp $ + * $Id: npx.c,v 1.14 1994/10/08 22:27:58 phk Exp $ */ #include "npx.h" @@ -43,11 +43,14 @@ #include <sys/conf.h> #include <sys/file.h> #include <sys/proc.h> +#include <sys/devconf.h> +#include <sys/ioctl.h> + #include <machine/cpu.h> #include <machine/pcb.h> #include <machine/trap.h> -#include <sys/ioctl.h> #include <machine/specialreg.h> + #include <i386/isa/icu.h> #include <i386/isa/isa_device.h> #include <i386/isa/isa.h> @@ -302,6 +305,26 @@ npxprobe1(dvp) return (-1); } +static struct kern_devconf kdc_npx[NNPX] = { { + 0, 0, 0, /* filled in by dev_attach */ + "npx", 0, { MDDT_ISA, 0 }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_UNKNOWN, /* not supported */ + "Floating-point unit" +} }; + +static inline void +npx_registerdev(struct isa_device *id) +{ + if(id->id_unit) + kdc_npx[id->id_unit] = kdc_npx[0]; + kdc_npx[id->id_unit].kdc_unit = id->id_unit; + kdc_npx[id->id_unit].kdc_isa = id; + dev_attach(&kdc_npx[id->id_unit]); +} + /* * Attach routine - announce which it is, and wire into system */ @@ -318,6 +341,7 @@ npxattach(dvp) } } npxinit(__INITIAL_NPXCW__); + npx_registerdev(dvp); return (1); /* XXX unused */ } 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 <sys/ioctl.h> #include <sys/errno.h> #include <sys/syslog.h> +#include <sys/devconf.h> #if defined(__NetBSD__) #include <sys/select.h> #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 <sys/errno.h> #include <sys/dkbad.h> #include <sys/disklabel.h> +#include <sys/devconf.h> + #include <i386/isa/isa.h> #include <i386/isa/isa_device.h> #include <i386/isa/mcdreg.h> @@ -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<<part); if (part == RAW_PART && phys != 0) cd->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 <sys/ioctl.h> #include <sys/tty.h> #include <sys/uio.h> +#include <sys/devconf.h> #include <i386/isa/isa_device.h> #include <i386/isa/icu.h> @@ -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 <sys/kernel.h> #include <sys/malloc.h> #include <sys/syslog.h> +#include <sys/devconf.h> #include <machine/clock.h> @@ -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 <sys/syslog.h> #include <sys/errno.h> #include <sys/malloc.h> +#include <sys/devconf.h> + #include <machine/console.h> #include <machine/psl.h> #include <machine/frame.h> #include <machine/pc/display.h> + #include <i386/isa/isa.h> #include <i386/isa/isa_device.h> #include <i386/isa/timerreg.h> @@ -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; } diff --git a/sys/i386/eisa/aha1742.c b/sys/i386/eisa/aha1742.c index 945e8ea..dff406b 100644 --- a/sys/i386/eisa/aha1742.c +++ b/sys/i386/eisa/aha1742.c @@ -14,7 +14,7 @@ * * commenced: Sun Sep 27 18:14:01 PDT 1992 * - * $Id: aha1742.c,v 1.22 1994/09/16 13:33:34 davidg Exp $ + * $Id: aha1742.c,v 1.23 1994/10/19 01:58:51 wollman Exp $ */ #include <sys/types.h> @@ -319,8 +319,12 @@ struct scsi_device ahb_dev = static struct kern_devconf kdc_ahb[NAHB] = { { 0, 0, 0, /* filled in by dev_attach */ - "ahb", 0, { "isa0", MDDT_ISA, 0 }, - isa_generic_externalize, 0, 0, ISA_EXTERNALLEN + "ahb", 0, { MDDT_ISA, 0, "bio" }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_BUSY, /* host adapters are always ``in use'' */ + "Adaptec 174x-series SCSI host adapter" } }; static inline void @@ -329,7 +333,7 @@ ahb_registerdev(struct isa_device *id) if(id->id_unit) kdc_ahb[id->id_unit] = kdc_ahb[0]; kdc_ahb[id->id_unit].kdc_unit = id->id_unit; - kdc_ahb[id->id_unit].kdc_isa = id; + kdc_ahb[id->id_unit].kdc_parentdata = id; dev_attach(&kdc_ahb[id->id_unit]); } diff --git a/sys/i386/include/devconf.h b/sys/i386/include/devconf.h index 6a50508..55017f0 100644 --- a/sys/i386/include/devconf.h +++ b/sys/i386/include/devconf.h @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: devconf.h,v 1.2 1994/10/17 23:33:52 wollman Exp $ + * $Id: devconf.h,v 1.4 1994/10/19 01:58:42 wollman Exp $ */ /* * devconf.h - machine-dependent device configuration table @@ -50,23 +50,21 @@ enum machdep_devtype { MDDT_CPU, MDDT_ISA, MDDT_EISA, MDDT_PCI, MDDT_SCSI, } struct machdep_devconf { - char mddc_parent[PARENTNAMELEN]; enum machdep_devtype mddc_devtype; int mddc_flags; - /* - * The user doesn't need to see this, but it's useful in the kernel code. - */ - union { - struct isa_device *mddcu_isa; - struct scsi_link *mddcu_scsi; - } mddc_un; + char mddc_imask[4]; }; -#define dc_parent dc_md.mddc_parent +#define MDDC_SCSI { MDDT_SCSI, 0 } +#define MDDC_SCBUS { MDDT_BUS, 0 } + +#define machdep_kdevconf machdep_devconf +#define MACHDEP_COPYDEV(dc, kdc) ((dc)->dc_md = (kdc)->kdc_md) + #define dc_devtype dc_md.mddc_devtype #define dc_flags dc_md.mddc_flags -#define kdc_isa kdc_md.mddc_un.mddcu_isa -#define kdc_scsi kdc_md.mddc_un.mddcu_scsi +#define kdc_isa kdc_parentdata +#define kdc_scsi kdc_parentdata #include <i386/isa/isa_device.h> #include <i386/pci/pcireg.h> diff --git a/sys/i386/isa/aha1542.c b/sys/i386/isa/aha1542.c index ad14148..a09b4ee 100644 --- a/sys/i386/isa/aha1542.c +++ b/sys/i386/isa/aha1542.c @@ -12,7 +12,7 @@ * on the understanding that TFS is not responsible for the correct * functioning of this software in any circumstances. * - * $Id: aha1542.c,v 1.36 1994/10/10 01:12:23 phk Exp $ + * $Id: aha1542.c,v 1.37 1994/10/19 01:58:50 wollman Exp $ */ /* @@ -347,8 +347,12 @@ struct isa_driver ahadriver = static struct kern_devconf kdc_aha[NAHA] = { { 0, 0, 0, /* filled in by dev_attach */ - "aha", 0, { "isa0", MDDT_ISA, 0 }, - isa_generic_externalize, 0, 0, ISA_EXTERNALLEN + "aha", 0, { MDDT_ISA, 0, "bio" }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_BUSY, /* host adapters are always busy */ + "Adaptec 154x-series SCSI host adapter" } }; static inline void @@ -357,7 +361,7 @@ aha_registerdev(struct isa_device *id) if(id->id_unit) kdc_aha[id->id_unit] = kdc_aha[0]; kdc_aha[id->id_unit].kdc_unit = id->id_unit; - kdc_aha[id->id_unit].kdc_isa = id; + kdc_aha[id->id_unit].kdc_parentdata = id; dev_attach(&kdc_aha[id->id_unit]); } diff --git a/sys/i386/isa/aha1742.c b/sys/i386/isa/aha1742.c index 945e8ea..dff406b 100644 --- a/sys/i386/isa/aha1742.c +++ b/sys/i386/isa/aha1742.c @@ -14,7 +14,7 @@ * * commenced: Sun Sep 27 18:14:01 PDT 1992 * - * $Id: aha1742.c,v 1.22 1994/09/16 13:33:34 davidg Exp $ + * $Id: aha1742.c,v 1.23 1994/10/19 01:58:51 wollman Exp $ */ #include <sys/types.h> @@ -319,8 +319,12 @@ struct scsi_device ahb_dev = static struct kern_devconf kdc_ahb[NAHB] = { { 0, 0, 0, /* filled in by dev_attach */ - "ahb", 0, { "isa0", MDDT_ISA, 0 }, - isa_generic_externalize, 0, 0, ISA_EXTERNALLEN + "ahb", 0, { MDDT_ISA, 0, "bio" }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_BUSY, /* host adapters are always ``in use'' */ + "Adaptec 174x-series SCSI host adapter" } }; static inline void @@ -329,7 +333,7 @@ ahb_registerdev(struct isa_device *id) if(id->id_unit) kdc_ahb[id->id_unit] = kdc_ahb[0]; kdc_ahb[id->id_unit].kdc_unit = id->id_unit; - kdc_ahb[id->id_unit].kdc_isa = id; + kdc_ahb[id->id_unit].kdc_parentdata = id; dev_attach(&kdc_ahb[id->id_unit]); } diff --git a/sys/i386/isa/aic6360.c b/sys/i386/isa/aic6360.c index f091bb0..c4b1089 100644 --- a/sys/i386/isa/aic6360.c +++ b/sys/i386/isa/aic6360.c @@ -31,7 +31,7 @@ */ /* - * $Id: aic6360.c,v 1.1 1994/09/26 16:15:45 jkh Exp $ + * $Id: aic6360.c,v 1.2 1994/10/19 01:58:53 wollman Exp $ * * Acknowledgements: Many of the algorithms used in this driver are * inspired by the work of Julian Elischer (julian@tfs.com) and @@ -751,8 +751,12 @@ struct scsi_device aic_dev = { static struct kern_devconf kdc_aic[NAIC] = { { 0, 0, 0, /* filled in by dev_attach */ - "aic", 0, { "isa0", MDDT_ISA, 0 }, - isa_generic_externalize, 0, 0, ISA_EXTERNALLEN + "aic", 0, { MDDT_ISA, 0, "bio" }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_BUSY, /* host adapters are always busy */ + "Adaptec AIC-6360 SCSI host adapter chipset" } }; static inline void @@ -761,7 +765,7 @@ aic_registerdev(struct isa_device *id) if(id->id_unit) kdc_aic[id->id_unit] = kdc_aic[0]; kdc_aic[id->id_unit].kdc_unit = id->id_unit; - kdc_aic[id->id_unit].kdc_isa = id; + kdc_aic[id->id_unit].kdc_parentdata = id; dev_attach(&kdc_aic[id->id_unit]); } diff --git a/sys/i386/isa/b004.c b/sys/i386/isa/b004.c index e3fa922..d654135 100644 --- a/sys/i386/isa/b004.c +++ b/sys/i386/isa/b004.c @@ -518,8 +518,12 @@ bquioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p) static struct kern_devconf kdc_bqu[NBQU] = { { 0, 0, 0, /* filled in by dev_attach */ - "bqu", 0, { "isa0", MDDT_ISA, 0 }, - isa_generic_externalize, 0, 0, ISA_EXTERNALLEN + "bqu", 0, { MDDT_ISA, 0 }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_UNKNOWN, /* we don't support this yet */ + "B004-compatible Transputer board" } }; static inline void @@ -528,7 +532,7 @@ bqu_registerdev(struct isa_device *id) if(id->id_unit) kdc_bqu[id->id_unit] = kdc_bqu[0]; kdc_bqu[id->id_unit].kdc_unit = id->id_unit; - kdc_bqu[id->id_unit].kdc_isa = id; + kdc_bqu[id->id_unit].kdc_parentdata = id; dev_attach(&kdc_bqu[id->id_unit]); } diff --git a/sys/i386/isa/bt742a.c b/sys/i386/isa/bt742a.c index edbc240..72585b7 100644 --- a/sys/i386/isa/bt742a.c +++ b/sys/i386/isa/bt742a.c @@ -12,7 +12,7 @@ * on the understanding that TFS is not responsible for the correct * functioning of this software in any circumstances. * - * $Id: bt742a.c,v 1.27 1994/10/12 04:15:30 phk Exp $ + * $Id: bt742a.c,v 1.28 1994/10/17 21:16:35 phk Exp $ */ /* @@ -51,6 +51,7 @@ #include <i386/isa/isa_device.h> #include <scsi/scsi_all.h> #include <scsi/scsiconf.h> +#include <sys/devconf.h> #ifdef KERNEL #include <sys/kernel.h> @@ -435,6 +436,26 @@ struct scsi_device bt_dev = { 0, 0 } }; +static struct kern_devconf kdc_bt[NBT] = { { + 0, 0, 0, /* filled in by dev_attach */ + "bt", 0, { MDDT_ISA, 0, "bio" }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_BUSY, /* host adapters are always busy */ + "Buslogic 742-compatible SCSI host adapter" +} }; + +static inline void +bt_registerdev(struct isa_device *id) +{ + if(id->id_unit) + kdc_bt[id->id_unit] = kdc_bt[0]; + kdc_bt[id->id_unit].kdc_unit = id->id_unit; + kdc_bt[id->id_unit].kdc_parentdata = id; + dev_attach(&kdc_bt[id->id_unit]); +} + #endif /*KERNEL */ #define BT_RESET_TIMEOUT 1000 @@ -658,6 +679,7 @@ btattach(dev) bt->sc_link.device = &bt_dev; bt->sc_link.flags = SDEV_BOUNCE; + bt_registerdev(dev); /* * ask the adapter what subunits are present */ diff --git a/sys/i386/isa/ctx.c b/sys/i386/isa/ctx.c index 8930d27..9d0f621 100644 --- a/sys/i386/isa/ctx.c +++ b/sys/i386/isa/ctx.c @@ -8,7 +8,7 @@ * of this software, nor does the author assume any responsibility * for damages incurred with its use. * - * $Id: ctx.c,v 1.2 1994/10/19 01:58:55 wollman Exp $ + * $Id: ctx.c,v 1.3 1994/10/21 01:19:05 wollman Exp $ */ /* @@ -156,8 +156,12 @@ struct ctx_soft_registers { static struct kern_devconf kdc_ctx[NCTX] = { { 0, 0, 0, /* filled in by dev_attach */ - "ctx", 0, { "isa0", MDDT_ISA, 0 }, - isa_generic_externalize, 0, 0, ISA_EXTERNALLEN + "ctx", 0, { MDDT_ISA, 0 }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_UNKNOWN, /* not supported */ + "CORTEX-I frame grabber" } }; static inline void diff --git a/sys/i386/isa/fd.c b/sys/i386/isa/fd.c index edbb903..a000acf 100644 --- a/sys/i386/isa/fd.c +++ b/sys/i386/isa/fd.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/i386/isa/ft.c b/sys/i386/isa/ft.c index e45b4e8..b0a2bd9 100644 --- a/sys/i386/isa/ft.c +++ b/sys/i386/isa/ft.c @@ -17,7 +17,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * ft.c - QIC-40/80 floppy tape driver - * $Id: ft.c,v 1.7 1994/06/22 05:52:36 jkh Exp $ + * $Id: ft.c,v 1.12 1994/09/25 06:04:23 phk Exp $ * * 06/07/94 v0.9 ++sg * Tape stuck on segment problem should be gone. Re-wrote buffering @@ -75,6 +75,8 @@ #include <sys/buf.h> #include <sys/uio.h> #include <sys/ftape.h> +#include <sys/devconf.h> + #include <machine/cpufunc.h> #include <i386/isa/isa_device.h> #include <i386/isa/fdreg.h> @@ -392,6 +394,39 @@ segio_free(ft_p ft, SegReq *sp) DPRT(("segio_free: nfree=%d ndone=%d nreq=%d\n", ft->nfreelist, ft->ndoneq, ft->nsegq)); } +static int ft_externalize(struct proc *, struct kern_devconf *, void *, + size_t); + +extern struct kern_devconf kdc_fdc[]; +static struct kern_devconf kdc_ft[NFT] = { { + 0, 0, 0, /* filled in by kern_devconf.c */ + "ft", 0, { MDDT_DISK, 0 }, + ft_externalize, 0, 0, DISK_EXTERNALLEN, + 0, /* parent */ + 0, /* parentdata */ + DC_UNKNOWN, /* state */ + "floppy tape" +} }; + +static inline void +ft_registerdev(int ctlr, int unit) +{ + if(unit != 0) + kdc_ft[unit] = kdc_ft[0]; + + kdc_ft[unit].kdc_unit = unit; + kdc_ft[unit].kdc_parent = &kdc_fdc[ctlr]; + kdc_ft[unit].kdc_parentdata = 0; + dev_attach(&kdc_ft[unit]); +} + + +static int +ft_externalize(struct proc *p, struct kern_devconf *kdc, void *userp, + size_t len) +{ + return disk_externalize(ft_data[kdc->kdc_unit].ftsu, userp, &len); +} /* * Probe/attach floppy tapes. @@ -503,6 +538,7 @@ out: break; } printf(" [%d: ft%d: %s tape]", fdup->id_physid, fdup->id_unit, manu); + ft_registerdev(fdcu, ftu); } ft->attaching = 0; return(ft->type); diff --git a/sys/i386/isa/if_ed.c b/sys/i386/isa/if_ed.c index d663bbc..ce0f700 100644 --- a/sys/i386/isa/if_ed.c +++ b/sys/i386/isa/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/i386/isa/if_el.c b/sys/i386/isa/if_el.c index c0f52a2..afc51d7 100644 --- a/sys/i386/isa/if_el.c +++ b/sys/i386/isa/if_el.c @@ -6,7 +6,7 @@ * * Questions, comments, bug reports and fixes to kimmel@cs.umass.edu. * - * $Id: if_el.c,v 1.6 1994/10/19 01:58:59 wollman Exp $ + * $Id: if_el.c,v 1.7 1994/10/21 01:19:06 wollman Exp $ */ /* Except of course for the portions of code lifted from other FreeBSD * drivers (mainly elread, elget and el_ioctl) @@ -100,8 +100,12 @@ struct isa_driver eldriver = { static struct kern_devconf kdc_el[NEL] = { { 0, 0, 0, /* filled in by dev_attach */ - "el", 0, { "isa0", MDDT_ISA, 0 }, - isa_generic_externalize, 0, 0, ISA_EXTERNALLEN + "el", 0, { MDDT_ISA, 0, "net" }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_BUSY, /* network interfaces are always busy */ + "3Com 3C501 Ethernet adapter" } }; static inline void diff --git a/sys/i386/isa/if_ep.c b/sys/i386/isa/if_ep.c index 5868576..a526ca3 100644 --- a/sys/i386/isa/if_ep.c +++ b/sys/i386/isa/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 <sys/ioctl.h> #include <sys/errno.h> #include <sys/syslog.h> +#include <sys/devconf.h> #if defined(__NetBSD__) #include <sys/select.h> #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/i386/isa/if_ie.c b/sys/i386/isa/if_ie.c index 43bd9cc..fc42848 100644 --- a/sys/i386/isa/if_ie.c +++ b/sys/i386/isa/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/i386/isa/if_is.c b/sys/i386/isa/if_is.c index 1254f7f..64c7abe 100644 --- a/sys/i386/isa/if_is.c +++ b/sys/i386/isa/if_is.c @@ -11,7 +11,7 @@ * of this software, nor does the author assume any responsibility * for damages incurred with its use. * - * $Id: if_is.c,v 1.27 1994/09/21 18:33:23 davidg Exp $ + * $Id: if_is.c,v 1.28 1994/10/19 01:59:02 wollman Exp $ */ /* TODO @@ -142,8 +142,12 @@ u_short isrdcsr(unit,port) static struct kern_devconf kdc_is[NIS] = { { 0, 0, 0, /* filled in by dev_attach */ - "is", 0, { "isa0", MDDT_ISA, 0 }, - isa_generic_externalize, 0, 0, ISA_EXTERNALLEN + "is", 0, { MDDT_ISA, 0, "net" }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_BUSY, /* network interfaces are always busy */ + "Isolan AT 4141-0, Isolink 4110, or NE2100 Ethernet adapter" } }; static inline void diff --git a/sys/i386/isa/if_le.c b/sys/i386/isa/if_le.c index cfe00cb..d3ab8cf 100644 --- a/sys/i386/isa/if_le.c +++ b/sys/i386/isa/if_le.c @@ -21,9 +21,13 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: if_le.c,v 1.7 1994/10/12 11:39:37 se Exp $ + * $Id: if_le.c,v 1.8 1994/10/19 01:59:03 wollman Exp $ * * $Log: if_le.c,v $ + * Revision 1.8 1994/10/19 01:59:03 wollman + * Add support for devconf to a large number of device drivers, and do + * the right thing in dev_goawayall() when kdc_goaway is null. + * * Revision 1.7 1994/10/12 11:39:37 se * Submitted by: Matt Thomas <thomas@lkg.dec.com> * #ifdef MULTICAST removed. @@ -337,8 +341,12 @@ unsigned le_intrs[NLE]; static struct kern_devconf kdc_le[NLE] = { { 0, 0, 0, /* filled in by dev_attach */ - "le", 0, { "isa0", MDDT_ISA, 0 }, - isa_generic_externalize, 0, 0, ISA_EXTERNALLEN + "le", 0, { MDDT_ISA, 0, "net" }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_BUSY, /* network interfaces are always busy */ + "DEC EtherWorks II or EtherWorks III Ethernet adapter" } }; static inline void diff --git a/sys/i386/isa/if_lnc.c b/sys/i386/isa/if_lnc.c index 1c6911a..ae3dd1c 100644 --- a/sys/i386/isa/if_lnc.c +++ b/sys/i386/isa/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/i386/isa/if_ze.c b/sys/i386/isa/if_ze.c index c3b9399..31835cc 100644 --- a/sys/i386/isa/if_ze.c +++ b/sys/i386/isa/if_ze.c @@ -46,6 +46,10 @@ * ETO, Toshihisa <eto@osl.fujitsu.co.jp> */ +/* + * $Id$ + */ + #include "ze.h" #if NZE > 0 #include "bpfilter.h" diff --git a/sys/i386/isa/isa.c b/sys/i386/isa/isa.c index 90dd24d..e2b0028 100644 --- a/sys/i386/isa/isa.c +++ b/sys/i386/isa/isa.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 - * $Id: isa.c,v 1.30 1994/10/19 01:59:06 wollman Exp $ + * $Id: isa.c,v 1.31 1994/10/19 21:57:51 bde Exp $ */ /* @@ -106,6 +106,16 @@ inthand2_t *intr_handler[ICU_LEN]; u_int intr_mask[ICU_LEN]; int intr_unit[ICU_LEN]; +struct kern_devconf kdc_isa0 = { + 0, 0, 0, /* filled in by dev_attach */ + "isa", 0, { MDDT_BUS, 0 }, + 0, 0, 0, BUS_EXTERNALLEN, + 0, /* no parent yet; parent should be CPU */ + 0, /* no parentdata */ + DC_BUSY, /* busses are always busy */ + "ISA or EISA bus" +}; + static inthand_t *fastintr[ICU_LEN] = { &IDTVEC(fastintr0), &IDTVEC(fastintr1), &IDTVEC(fastintr2), &IDTVEC(fastintr3), @@ -270,6 +280,8 @@ void isa_configure() { struct isa_device *dvp; + dev_attach(&kdc_isa0); + splhigh(); enable_intr(); INTREN(IRQ_SLAVE); diff --git a/sys/i386/isa/isa_device.h b/sys/i386/isa/isa_device.h index fdd702a..8f76a14 100644 --- a/sys/i386/isa/isa_device.h +++ b/sys/i386/isa/isa_device.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)isa_device.h 7.1 (Berkeley) 5/9/91 - * $Id: isa_device.h,v 1.12 1994/10/17 21:16:39 phk Exp $ + * $Id: isa_device.h,v 1.14 1994/10/19 01:59:07 wollman Exp $ */ #ifndef _I386_ISA_ISA_DEVICE_H_ @@ -142,6 +142,7 @@ extern int eisa_externalize(struct isa_device *, int, void *, size_t *); struct kern_devconf; extern int isa_generic_externalize(struct proc *, struct kern_devconf *, void *, size_t); extern int eisa_generic_externalize(struct proc *,struct kern_devconf *, void *, size_t); +extern struct kern_devconf kdc_isa0; #endif /* KERNEL */ #endif /* _I386_ISA_ISA_DEVICE_H_ */ diff --git a/sys/i386/isa/lpt.c b/sys/i386/isa/lpt.c index 58bbd20..ad9fde1 100644 --- a/sys/i386/isa/lpt.c +++ b/sys/i386/isa/lpt.c @@ -46,7 +46,7 @@ * SUCH DAMAGE. * * from: unknown origin, 386BSD 0.1 - * $Id: lpt.c,v 1.19 1994/09/18 06:12:45 phk Exp $ + * $Id: lpt.c,v 1.20 1994/10/10 01:12:27 phk Exp $ */ /* @@ -112,6 +112,7 @@ #include <sys/tty.h> #include <sys/uio.h> #include <sys/syslog.h> +#include <sys/devconf.h> #include <i386/isa/isa.h> #include <i386/isa/isa_device.h> @@ -254,6 +255,27 @@ struct isa_driver lptdriver = { }; +static struct kern_devconf kdc_lpt[NLPT] = { { + 0, 0, 0, /* filled in by dev_attach */ + "lpt", 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 +lpt_registerdev(struct isa_device *id) +{ + if(id->id_unit) + kdc_lpt[id->id_unit] = kdc_lpt[0]; + kdc_lpt[id->id_unit].kdc_unit = id->id_unit; + kdc_lpt[id->id_unit].kdc_isa = id; + dev_attach(&kdc_lpt[id->id_unit]); +} + + /* * Internal routine to lptprobe to do port tests of one byte value @@ -406,6 +428,8 @@ lptattach(struct isa_device *isdp) } lprintf("irq %x\n", sc->sc_irq); + lpt_registerdev(isdp); + return (1); } diff --git a/sys/i386/isa/mcd.c b/sys/i386/isa/mcd.c index 53b6fee..e27f600 100644 --- a/sys/i386/isa/mcd.c +++ b/sys/i386/isa/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 <sys/errno.h> #include <sys/dkbad.h> #include <sys/disklabel.h> +#include <sys/devconf.h> + #include <i386/isa/isa.h> #include <i386/isa/isa_device.h> #include <i386/isa/mcdreg.h> @@ -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<<part); if (part == RAW_PART && phys != 0) cd->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/i386/isa/mse.c b/sys/i386/isa/mse.c index 6337fde..c9b8344 100644 --- a/sys/i386/isa/mse.c +++ b/sys/i386/isa/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 <sys/ioctl.h> #include <sys/tty.h> #include <sys/uio.h> +#include <sys/devconf.h> #include <i386/isa/isa_device.h> #include <i386/isa/icu.h> @@ -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/i386/isa/npx.c b/sys/i386/isa/npx.c index 98e2276..991bfd9 100644 --- a/sys/i386/isa/npx.c +++ b/sys/i386/isa/npx.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)npx.c 7.2 (Berkeley) 5/12/91 - * $Id: npx.c,v 1.13 1994/09/22 14:44:16 davidg Exp $ + * $Id: npx.c,v 1.14 1994/10/08 22:27:58 phk Exp $ */ #include "npx.h" @@ -43,11 +43,14 @@ #include <sys/conf.h> #include <sys/file.h> #include <sys/proc.h> +#include <sys/devconf.h> +#include <sys/ioctl.h> + #include <machine/cpu.h> #include <machine/pcb.h> #include <machine/trap.h> -#include <sys/ioctl.h> #include <machine/specialreg.h> + #include <i386/isa/icu.h> #include <i386/isa/isa_device.h> #include <i386/isa/isa.h> @@ -302,6 +305,26 @@ npxprobe1(dvp) return (-1); } +static struct kern_devconf kdc_npx[NNPX] = { { + 0, 0, 0, /* filled in by dev_attach */ + "npx", 0, { MDDT_ISA, 0 }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_UNKNOWN, /* not supported */ + "Floating-point unit" +} }; + +static inline void +npx_registerdev(struct isa_device *id) +{ + if(id->id_unit) + kdc_npx[id->id_unit] = kdc_npx[0]; + kdc_npx[id->id_unit].kdc_unit = id->id_unit; + kdc_npx[id->id_unit].kdc_isa = id; + dev_attach(&kdc_npx[id->id_unit]); +} + /* * Attach routine - announce which it is, and wire into system */ @@ -318,6 +341,7 @@ npxattach(dvp) } } npxinit(__INITIAL_NPXCW__); + npx_registerdev(dvp); return (1); /* XXX unused */ } diff --git a/sys/i386/isa/pas.c b/sys/i386/isa/pas.c index 9a528fa..2bd8718 100644 --- a/sys/i386/isa/pas.c +++ b/sys/i386/isa/pas.c @@ -14,7 +14,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id: pas.c,v 1.4 1994/09/16 13:33:46 davidg Exp $ + * $Id: pas.c,v 1.5 1994/10/18 03:53:12 phk Exp $ * * This is a driver for the one particular kind of the "ProAudioSpectrum" * card from MediaVision. To find out if your card is supported, you can @@ -70,14 +70,15 @@ #include "pas.h" #if NPAS > 0 -#include "param.h" -#include "systm.h" -#include "types.h" -#include "buf.h" -#include "i386/isa/isa_device.h" +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/buf.h> +#include <sys/devconf.h> + +#include <i386/isa/isa_device.h> +#include <i386/isa/ic/ncr_5380.h> #include <scsi/scsi_all.h> #include <scsi/scsiconf.h> -#include "ic/ncr_5380.h" /* * Define this macro to disable the PSEUDO-DMA transfers. @@ -306,6 +307,26 @@ pas_adapter_info(int adapter_number) return 1; } +static struct kern_devconf kdc_pas[NPAS] = { { + 0, 0, 0, /* filled in by dev_attach */ + "pas", 0, { MDDT_ISA, 0, "bio" }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_BUSY, /* host adapters are always busy */ + "Media Vision ProAudioSpectrum SCSI host adapter" +} }; + +static inline void +pas_registerdev(struct isa_device *id) +{ + if(id->id_unit) + kdc_pas[id->id_unit] = kdc_pas[0]; + kdc_pas[id->id_unit].kdc_unit = id->id_unit; + kdc_pas[id->id_unit].kdc_parentdata = id; + dev_attach(&kdc_pas[id->id_unit]); +} + int pasattach(struct isa_device *dev) { @@ -336,6 +357,7 @@ pasattach(struct isa_device *dev) outb(base^0xbc00,0x01); outb(base^0x8003,0x4d); + pas_registerdev(dev); scsi_attachdevs(&(ppas->sc_link)); pas_reset(dev->id_unit); return 1; diff --git a/sys/i386/isa/sio.c b/sys/i386/isa/sio.c index 54133ab..df925dc 100644 --- a/sys/i386/isa/sio.c +++ b/sys/i386/isa/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 <sys/kernel.h> #include <sys/malloc.h> #include <sys/syslog.h> +#include <sys/devconf.h> #include <machine/clock.h> @@ -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/i386/isa/syscons.c b/sys/i386/isa/syscons.c index 229b981..5b45dd4 100644 --- a/sys/i386/isa/syscons.c +++ b/sys/i386/isa/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 <sys/syslog.h> #include <sys/errno.h> #include <sys/malloc.h> +#include <sys/devconf.h> + #include <machine/console.h> #include <machine/psl.h> #include <machine/frame.h> #include <machine/pc/display.h> + #include <i386/isa/isa.h> #include <i386/isa/isa_device.h> #include <i386/isa/timerreg.h> @@ -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; } diff --git a/sys/i386/isa/ultra14f.c b/sys/i386/isa/ultra14f.c index 774e466d..9c8b98a 100644 --- a/sys/i386/isa/ultra14f.c +++ b/sys/i386/isa/ultra14f.c @@ -22,7 +22,7 @@ * today: Fri Jun 2 17:21:03 EST 1994 * added 24F support ++sg * - * $Id: ultra14f.c,v 1.24 1994/08/28 16:08:51 bde Exp $ + * $Id: ultra14f.c,v 1.25 1994/09/16 13:33:50 davidg Exp $ */ #include <sys/types.h> @@ -38,6 +38,7 @@ #include <sys/buf.h> #include <sys/proc.h> #include <sys/user.h> +#include <sys/devconf.h> #include <i386/isa/isa_device.h> #endif /*KERNEL */ @@ -313,6 +314,26 @@ struct scsi_device uha_dev = { 0, 0 } }; +static struct kern_devconf kdc_uha[NUHA] = { { + 0, 0, 0, /* filled in by dev_attach */ + "uha", 0, { MDDT_ISA, 0, "bio" }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_BUSY, /* host adapters are always busy */ + "UltraStore 14F or 34F SCSI host adapter" +} }; + +static inline void +uha_registerdev(struct isa_device *id) +{ + if(id->id_unit) + kdc_uha[id->id_unit] = kdc_uha[0]; + kdc_uha[id->id_unit].kdc_unit = id->id_unit; + kdc_uha[id->id_unit].kdc_parentdata = id; + dev_attach(&kdc_uha[id->id_unit]); +} + #endif /*KERNEL */ #ifndef KERNEL @@ -522,6 +543,7 @@ uha_attach(dev) uha->sc_link.device = &uha_dev; uha->sc_link.flags = SDEV_BOUNCE; + uha_registerdev(dev); /* * ask the adapter what subunits are present */ diff --git a/sys/i386/isa/wd.c b/sys/i386/isa/wd.c index 71220a8..9e7cd51 100644 --- a/sys/i386/isa/wd.c +++ b/sys/i386/isa/wd.c @@ -37,7 +37,7 @@ static int wdtest = 0; * SUCH DAMAGE. * * from: @(#)wd.c 7.2 (Berkeley) 5/9/91 - * $Id: wd.c,v 1.54 1994/10/20 00:08:22 phk Exp $ + * $Id: wd.c,v 1.55 1994/10/22 01:57:12 phk Exp $ */ /* TODO: @@ -116,29 +116,48 @@ static int wdc_externalize(struct proc *, struct kern_devconf *, void *, size_t) /* * Templates for the kern_devconf structures used when we attach. */ -static struct kern_devconf kdc_wd_template = { +static struct kern_devconf kdc_wd[NWD] = { { 0, 0, 0, /* filled in by kern_devconf.c */ - "wd", 0, { "wdc0", MDDT_DISK, 0 }, - wd_externalize, 0, wd_goaway, DISK_EXTERNALLEN -}; - -static struct kern_devconf kdc_wdc_template = { + "wd", 0, { MDDT_DISK, 0 }, + wd_externalize, 0, wd_goaway, DISK_EXTERNALLEN, + 0, /* parent */ + 0, /* parentdata */ + DC_UNKNOWN, /* don't support state yet */ + "ST506/ESDI/IDE disk" +} }; + +static struct kern_devconf kdc_wdc[NWDC] = { { 0, 0, 0, /* filled in by kern_devconf.c */ - "wdc", 0, { "isa0", MDDT_ISA, 0 }, - wdc_externalize, 0, wdc_goaway, ISA_EXTERNALLEN -}; + "wdc", 0, { MDDT_ISA, 0 }, + isa_generic_externalize, 0, wdc_goaway, ISA_EXTERNALLEN, + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_UNKNOWN, /* state */ + "ST506/ESDI/IDE disk controller" +} }; static inline void wd_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_wd_template; - kdc->kdc_unit = unit; - sprintf(kdc->kdc_md.mddc_parent, "wdc%d", ctlr); - dev_attach(kdc); + if(unit != 0) + kdc_wd[unit] = kdc_wd[0]; + + kdc_wd[unit].kdc_unit = unit; + kdc_wd[unit].kdc_parent = &kdc_wdc[ctlr]; + dev_attach(&kdc_wd[unit]); +} + +static inline void +wdc_registerdev(struct isa_device *dvp) +{ + int unit = dvp->id_unit; + + if(unit != 0) + kdc_wd[unit] = kdc_wd[0]; + + kdc_wdc[unit].kdc_unit = unit; + kdc_wdc[unit].kdc_parentdata = dvp; + dev_attach(&kdc_wdc[unit]); } static int @@ -146,7 +165,6 @@ wdc_goaway(struct kern_devconf *kdc, int force) { if(force) { dev_detach(kdc); - FREE(kdc, M_TEMP); return 0; } else { return EBUSY; /* XXX fix */ @@ -157,7 +175,6 @@ static int wd_goaway(struct kern_devconf *kdc, int force) { dev_detach(kdc); - FREE(kdc, M_TEMP); return 0; } @@ -213,7 +230,6 @@ struct disk { long dk_badsect[127]; /* 126 plus trailing -1 marker */ }; -static struct isa_device *wdcdevs[NWDC]; static struct disk *wddrives[NWD]; /* table of units */ static struct buf wdtab[NWDC]; static struct buf wdutab[NWD]; /* head of queue per drive */ @@ -251,12 +267,6 @@ wd_externalize(struct proc *p, struct kern_devconf *kdc, void *userp, size_t len return disk_externalize(wddrives[kdc->kdc_unit]->dk_unit, userp, &len); } -static int -wdc_externalize(struct proc *p, struct kern_devconf *kdc, void *userp, size_t len) -{ - return isa_externalize(wdcdevs[kdc->kdc_unit], userp, &len); -} - struct isa_driver wdcdriver = { wdprobe, wdattach, "wdc", }; @@ -274,7 +284,6 @@ wdprobe(struct isa_device *dvp) if (unit >= NWDC) return (0); - wdcdevs[unit] = dvp; du = malloc(sizeof *du, M_TEMP, M_NOWAIT); if (du == NULL) @@ -350,17 +359,11 @@ wdattach(struct isa_device *dvp) int unit, lunit; struct isa_device *wdup; struct disk *du; - struct kern_devconf *kdc; if (dvp->id_unit >= NWDC) return (0); - MALLOC(kdc, struct kern_devconf *, sizeof *kdc, M_TEMP, M_NOWAIT); - if(!kdc) - return 0; - *kdc = kdc_wdc_template; - kdc->kdc_unit = dvp->id_unit; - dev_attach(kdc); + wdc_registerdev(dvp); for (wdup = isa_biotab_wdc; wdup->id_driver != 0; wdup++) { if (wdup->id_iobase != dvp->id_iobase) diff --git a/sys/i386/isa/wt.c b/sys/i386/isa/wt.c index 822b4c5..312de15 100644 --- a/sys/i386/isa/wt.c +++ b/sys/i386/isa/wt.c @@ -19,7 +19,7 @@ * the original CMU copyright notice. * * Version 1.3, Thu Nov 11 12:09:13 MSK 1993 - * $Id: wt.c,v 1.10 1994/08/23 07:52:29 paul Exp $ + * $Id: wt.c,v 1.11 1994/09/16 13:33:51 davidg Exp $ * */ @@ -61,7 +61,9 @@ #include <sys/malloc.h> #include <sys/ioctl.h> #include <sys/mtio.h> +#include <sys/devconf.h> #include <vm/vm_param.h> + #include <i386/isa/isa_device.h> #include <i386/isa/wtreg.h> @@ -209,6 +211,27 @@ int wtprobe (struct isa_device *id) return (0); } +static struct kern_devconf kdc_wt[NWT] = { { + 0, 0, 0, /* filled in by dev_attach */ + "wt", 0, { MDDT_ISA, 0, "bio" }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_UNKNOWN, /* host adapters are always busy */ + "Archive or Wangtek QIC-02/QIC-36 tape controller" +} }; + +static inline void +wt_registerdev(struct isa_device *id) +{ + if(id->id_unit) + kdc_wt[id->id_unit] = kdc_wt[0]; + kdc_wt[id->id_unit].kdc_unit = id->id_unit; + kdc_wt[id->id_unit].kdc_parentdata = id; + dev_attach(&kdc_wt[id->id_unit]); +} + + /* * Device is found, configure it. */ @@ -223,6 +246,7 @@ int wtattach (struct isa_device *id) printf ("wt%d: type <Wangtek>\n", t->unit); t->flags = TPSTART; /* tape is rewound */ t->dens = -1; /* unknown density */ + wt_registerdev(id); return (1); } diff --git a/sys/isa/fd.c b/sys/isa/fd.c index edbb903..a000acf 100644 --- a/sys/isa/fd.c +++ b/sys/isa/fd.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/isa/sio.c b/sys/isa/sio.c index 54133ab..df925dc 100644 --- a/sys/isa/sio.c +++ b/sys/isa/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 <sys/kernel.h> #include <sys/malloc.h> #include <sys/syslog.h> +#include <sys/devconf.h> #include <machine/clock.h> @@ -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/isa/syscons.c b/sys/isa/syscons.c index 229b981..5b45dd4 100644 --- a/sys/isa/syscons.c +++ b/sys/isa/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 <sys/syslog.h> #include <sys/errno.h> #include <sys/malloc.h> +#include <sys/devconf.h> + #include <machine/console.h> #include <machine/psl.h> #include <machine/frame.h> #include <machine/pc/display.h> + #include <i386/isa/isa.h> #include <i386/isa/isa_device.h> #include <i386/isa/timerreg.h> @@ -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; } diff --git a/sys/kern/kern_devconf.c b/sys/kern/kern_devconf.c index 39f728c..1e2c159 100644 --- a/sys/kern/kern_devconf.c +++ b/sys/kern/kern_devconf.c @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: kern_devconf.c,v 1.1 1994/10/16 03:52:13 wollman Exp $ + * $Id: kern_devconf.c,v 1.3 1994/10/19 01:59:11 wollman Exp $ */ /* @@ -103,11 +103,27 @@ static void make_devconf(struct kern_devconf *kdc, struct devconf *dc) { strncpy(dc->dc_name, kdc->kdc_name, sizeof dc->dc_name); - dc->dc_name[sizeof dc->dc_name - 1] = '\0'; + dc->dc_name[(sizeof dc->dc_name) - 1] = '\0'; dc->dc_unit = kdc->kdc_unit; - dc->dc_md = kdc->kdc_md; dc->dc_number = kdc->kdc_number; + + if(kdc->kdc_parent) { + strncpy(dc->dc_pname, kdc->kdc_parent->kdc_name, sizeof dc->dc_pname); + dc->dc_pname[(sizeof dc->dc_pname) - 1] = '\0'; + dc->dc_punit = kdc->kdc_parent->kdc_unit; + dc->dc_pnumber = kdc->kdc_parent->kdc_number; + } else { + bzero(dc->dc_pname, sizeof dc->dc_pname); + dc->dc_punit = -1; + dc->dc_pnumber = -1; + } + + MACHDEP_COPYDEV(dc, kdc); + dc->dc_state = kdc->kdc_state; dc->dc_datalen = kdc->kdc_datalen; + + strncpy(dc->dc_descr, kdc->kdc_description, sizeof dc->dc_descr); + dc->dc_descr[(sizeof dc->dc_descr) - 1] = '\0'; } int diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c index 1a39293..9c94bb3 100644 --- a/sys/scsi/cd.c +++ b/sys/scsi/cd.c @@ -14,7 +14,7 @@ * * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 * - * $Id: cd.c,v 1.25 1994/10/08 22:26:35 phk Exp $ + * $Id: cd.c,v 1.26 1994/10/19 00:09:42 wollman Exp $ */ #define SPLCD splbio @@ -136,8 +136,12 @@ cd_externalize(struct proc *p, struct kern_devconf *kdc, void *userp, static struct kern_devconf kdc_cd_template = { 0, 0, 0, /* filled in by dev_attach */ - "cd", 0, { "scsi", MDDT_SCSI, 0 }, - cd_externalize, 0, cd_goaway, SCSI_EXTERNALLEN + "cd", 0, MDDC_SCSI, + cd_externalize, 0, cd_goaway, SCSI_EXTERNALLEN, + &kdc_scbus0, /* parent - XXX should be host adapter*/ + 0, /* parentdata */ + DC_UNKNOWN, /* not supported */ + "SCSI CD-ROM drive" }; static inline void @@ -149,6 +153,7 @@ cd_registerdev(int unit) if(!kdc) return; *kdc = kdc_cd_template; kdc->kdc_unit = unit; + /* XXX should set parentdata */ dev_attach(kdc); if(dk_ndrive < DK_NDRIVE) { sprintf(dk_names[dk_ndrive], "cd%d", unit); diff --git a/sys/scsi/ch.c b/sys/scsi/ch.c index ea7a168..662038e 100644 --- a/sys/scsi/ch.c +++ b/sys/scsi/ch.c @@ -2,7 +2,7 @@ * Written by grefen@????? * Based on scsi drivers by Julian Elischer (julian@tfs.com) * - * $Id: ch.c,v 1.9 1994/10/19 00:09:44 wollman Exp $ + * $Id: ch.c,v 1.10 1994/10/21 01:19:20 wollman Exp $ */ #include <sys/types.h> @@ -94,8 +94,12 @@ ch_externalize(struct proc *p, struct kern_devconf *kdc, void *userp, static struct kern_devconf kdc_ch_template = { 0, 0, 0, /* filled in by dev_attach */ - "ch", 0, { "scsi", MDDT_SCSI, 0 }, - ch_externalize, 0, ch_goaway, SCSI_EXTERNALLEN + "ch", 0, MDDC_SCSI, + ch_externalize, 0, ch_goaway, SCSI_EXTERNALLEN, + &kdc_scbus0, /* parent */ + 0, /* parentdata */ + DC_UNKNOWN, /* not supported */ + "SCSI media changer" }; static inline void diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c index 2a3ee8d..8ea5657 100644 --- a/sys/scsi/scsiconf.c +++ b/sys/scsi/scsiconf.c @@ -14,7 +14,7 @@ * * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 * - * $Id: scsiconf.c,v 1.10 1994/10/08 22:26:38 phk Exp $ + * $Id: scsiconf.c,v 1.11 1994/10/19 20:34:15 wollman Exp $ */ #include <sys/types.h> @@ -22,6 +22,8 @@ #include <sys/systm.h> #include <sys/malloc.h> +#include <sys/devconf.h> + #include "st.h" #include "sd.h" #include "ch.h" @@ -349,6 +351,24 @@ struct scsi_device probe_switch = int32 scsibus = 0x0; /* This is the Nth scsibus we've seen */ /* + * XXX + * This is BOGUS. + * We do this because it was easier than adding the requisite information + * to the scsi_link structure and modifying everything to use that. + * Someday, we will do just that, and users will be able to nail down their + * preferred SCSI ids. + */ +struct kern_devconf kdc_scbus0 = { + 0, 0, 0, /* filled in by dev_attach */ + "scbus", 0, MDDC_SCBUS, + 0, 0, 0, 0, /* no external data */ + 0, /* no parent */ + 0, /* no parentdata */ + DC_BUSY, /* busses are always busy */ + "SCSI subsystem" +}; + +/* * The routine called by the adapter boards to get all their * devices configured in. */ @@ -356,6 +376,10 @@ void scsi_attachdevs(sc_link_proto) struct scsi_link *sc_link_proto; { + static int timesthru = 0; + if(!timesthru++) { + dev_attach(&kdc_scbus0); + } if(scsibus >= NSCBUS) { printf("too many scsi busses, reconfigure the kernel\n"); diff --git a/sys/scsi/scsiconf.h b/sys/scsi/scsiconf.h index a2d1ae9..fd4bbc5 100644 --- a/sys/scsi/scsiconf.h +++ b/sys/scsi/scsiconf.h @@ -14,7 +14,7 @@ * * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 * - * $Id: scsiconf.h,v 1.11 1994/10/19 01:20:44 wollman Exp $ + * $Id: scsiconf.h,v 1.12 1994/10/19 01:49:23 wollman Exp $ */ #ifndef SCSI_SCSICONF_H #define SCSI_SCSICONF_H 1 @@ -290,6 +290,7 @@ extern void sc_print_addr(struct scsi_link *); extern int scsi_externalize(struct scsi_link *, void *, size_t *); extern int scsi_internalize(struct scsi_link *, void **, size_t *); +extern struct kern_devconf kdc_scbus0; /* XXX should go away */ #endif diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index 9ef1357..6bfb807 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -14,7 +14,7 @@ * * Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992 * - * $Id: sd.c,v 1.35 1994/10/19 00:09:45 wollman Exp $ + * $Id: sd.c,v 1.36 1994/10/20 00:08:31 phk Exp $ */ #define SPLSD splbio @@ -137,8 +137,12 @@ sd_externalize(struct proc *p, struct kern_devconf *kdc, void *userp, static struct kern_devconf kdc_sd_template = { 0, 0, 0, /* filled in by dev_attach */ - "sd", 0, { "scsi", MDDT_SCSI, 0 }, - sd_externalize, 0, sd_goaway, SCSI_EXTERNALLEN + "sd", 0, MDDC_SCSI, + sd_externalize, 0, sd_goaway, SCSI_EXTERNALLEN, + &kdc_scbus0, /* XXX parent */ + 0, /* parentdata */ + DC_UNKNOWN, /* not supported */ + "SCSI disk" }; static inline void diff --git a/sys/scsi/st.c b/sys/scsi/st.c index c234255..8cfbf8d 100644 --- a/sys/scsi/st.c +++ b/sys/scsi/st.c @@ -12,7 +12,7 @@ * on the understanding that TFS is not responsible for the correct * functioning of this software in any circumstances. * - * $Id: st.c,v 1.19 1994/09/28 20:16:45 se Exp $ + * $Id: st.c,v 1.20 1994/10/19 00:09:47 wollman Exp $ */ /* @@ -33,7 +33,7 @@ #include <sys/param.h> #include <sys/systm.h> -#include <fcntl.h> +#include <sys/fcntl.h> #include <sys/errno.h> #include <sys/ioctl.h> #include <sys/malloc.h> @@ -273,8 +273,12 @@ st_externalize(struct proc *p, struct kern_devconf *kdc, void *userp, static struct kern_devconf kdc_st_template = { 0, 0, 0, /* filled in by dev_attach */ - "st", 0, { "scsi", MDDT_SCSI, 0 }, - st_externalize, 0, st_goaway, SCSI_EXTERNALLEN + "st", 0, MDDC_SCSI, + st_externalize, 0, st_goaway, SCSI_EXTERNALLEN, + &kdc_scbus0, /* XXX parent */ + 0, /* parentdata */ + DC_UNKNOWN, /* not supported */ + "SCSI tape drive" }; static inline void diff --git a/sys/sys/devconf.h b/sys/sys/devconf.h index d681878..1413af6 100644 --- a/sys/sys/devconf.h +++ b/sys/sys/devconf.h @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: devconf.h,v 1.1 1994/10/16 03:52:59 wollman Exp $ + * $Id: devconf.h,v 1.2 1994/10/19 00:10:10 wollman Exp $ */ /* @@ -37,14 +37,27 @@ #include <machine/devconf.h> #define MAXDEVNAME 32 +#define MAXDEVDESCR 64 + +enum dc_state { + DC_UNKNOWN = 0, /* don't know the state or driver doesn't support */ + DC_UNCONFIGURED, /* driver is present but not configured */ + DC_IDLE, /* driver supports state and is not in use */ + DC_BUSY /* driver supports state and is currently busy */ +}; struct devconf { - char dc_name[MAXDEVNAME]; /* name of the device */ - int dc_unit; /* unit number of the device */ - int dc_number; /* device unique id */ - struct machdep_devconf dc_md; /* machine-dependent stuff */ - size_t dc_datalen; /* length of data */ - char dc_data[1]; /* variable-length data */ + char dc_name[MAXDEVNAME]; /* name */ + char dc_descr[MAXDEVDESCR]; /* description */ + int dc_unit; /* unit number */ + int dc_number; /* unique id */ + char dc_pname[MAXDEVNAME]; /* name of the parent device */ + int dc_punit; /* unit number of the parent */ + int dc_pnumber; /* unique id of the parent */ + struct machdep_devconf dc_md; /* machine-dependent stuff */ + enum dc_state dc_state; /* state of the device (see above) */ + size_t dc_datalen; /* length of data */ + char dc_data[1]; /* variable-length data */ }; #ifdef KERNEL @@ -78,11 +91,15 @@ struct kern_devconf { int kdc_number; /* filled in by kern_devconf */ const char *kdc_name; /* filled in by driver */ int kdc_unit; /* filled in by driver */ - struct machdep_devconf kdc_md; /* filled in by driver */ + struct machdep_kdevconf kdc_md; /* filled in by driver */ kdc_externalize_t kdc_externalize; /* filled in by driver */ kdc_internalize_t kdc_internalize; /* filled in by driver */ kdc_goaway_t kdc_goaway; /* filled in by driver */ size_t kdc_datalen; /* filled in by driver */ + struct kern_devconf *kdc_parent; /* filled in by driver */ + void *kdc_parentdata; /* filled in by driver */ + enum dc_state kdc_state; /* filled in by driver dynamically */ + const char *kdc_description; /* filled in by driver; maybe dyn. */ }; int dev_attach(struct kern_devconf *); @@ -97,7 +114,7 @@ int dev_goawayall(int); #define DEVCONF_NUMBER 0 /* get number of devices */ #define DEVCONF_MAXID 1 /* number of items (not really) */ -#define CTL_DEVCONF_NAMES { \ +#define HW_DEVCONF_NAMES { \ { "number", CTLTYPE_INT }, \ } |