diff options
author | wollman <wollman@FreeBSD.org> | 1995-04-12 20:48:13 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 1995-04-12 20:48:13 +0000 |
commit | 6a8d3a357d2d39cf1274d89e9ee73459574e038d (patch) | |
tree | 3733f361a8298b0f38c2e4586c976a9240816ec2 | |
parent | 669ed5b46ea62e3997fc8495702ddc9078fa7031 (diff) | |
download | FreeBSD-src-6a8d3a357d2d39cf1274d89e9ee73459574e038d.zip FreeBSD-src-6a8d3a357d2d39cf1274d89e9ee73459574e038d.tar.gz |
Add a class field to devconf and mst drivers.
For those where it was easy, drivers were also fixed to call
dev_attach() during probe rather than attach (in keeping with the
new design articulated in a mail message five months ago). For
a few that were really easy, correct state tracking was added as well.
The `fd' driver was fixed to correctly fill in the description.
The CPU identify code was fixed to attach a `cpu' device. The code
was also massively reordered to fill in cpu_model with somethingremotely
resembling what identifycpu() prints out. A few bytes saved by using
%b to format the features list rather than lots of ifs.
53 files changed, 930 insertions, 589 deletions
diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c index 47e43d5..aacff0d 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.20 1995/02/23 17:32:38 bde Exp $ + * $Id: npx.c,v 1.21 1995/03/05 04:06:44 wpaul Exp $ */ #include "npx.h" @@ -148,6 +148,30 @@ _probetrap: iret "); +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_UNCONFIGURED, /* state */ + "Floating-point unit", + DC_CLS_MISC /* class */ +} }; + +static inline void +npx_registerdev(struct isa_device *id) +{ + int unit; + + unit = id->id_unit; + if (unit != 0) + kdc_npx[unit] = kdc_npx[0]; + kdc_npx[unit].kdc_unit = unit; + kdc_npx[unit].kdc_isa = id; + dev_attach(&kdc_npx[unit]); +} + /* * Probe routine. Initialize cr0 to give correct behaviour for [f]wait * whether the device exists or not (XXX should be elsewhere). Set flags @@ -171,6 +195,7 @@ npxprobe(dvp) * install suitable handlers and run with interrupts enabled so we * won't need to do so much here. */ + npx_registerdev(dvp); npx_intrno = NRSVIDT + ffs(dvp->id_irq) - 1; save_eflags = read_eflags(); disable_intr(); @@ -308,29 +333,6 @@ 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_BUSY, - "Floating-point unit" -} }; - -static inline void -npx_registerdev(struct isa_device *id) -{ - int unit; - - unit = id->id_unit; - if (unit != 0) - kdc_npx[unit] = kdc_npx[0]; - kdc_npx[unit].kdc_unit = unit; - kdc_npx[unit].kdc_isa = id; - dev_attach(&kdc_npx[unit]); -} - /* * Attach routine - announce which it is, and wire into system */ @@ -354,8 +356,9 @@ npxattach(dvp) printf("npx%d: no 387 emulator in kernel!\n", dvp->id_unit); #endif npxinit(__INITIAL_NPXCW__); - if (npx_exists) - npx_registerdev(dvp); + if (npx_exists) { + kdc_npx[dvp->id_unit].kdc_state = DC_BUSY; + } return (1); /* XXX unused */ } diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index bd8196a..7e1129b 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.115 1995/03/17 04:19:19 davidg Exp $ + * $Id: machdep.c,v 1.116 1995/04/06 07:55:42 rgrimes Exp $ */ #include "npx.h" @@ -129,7 +129,18 @@ static void identifycpu(void); static void initcpu(void); char machine[] = "i386"; -char cpu_model[sizeof("Cy486DLC") + 1]; +char cpu_model[128]; + +struct kern_devconf kdc_cpu0 = { + 0, 0, 0, /* filled in by dev_attach */ + "cpu", 0, { MDDT_CPU }, + 0, 0, 0, CPU_EXTERNALLEN, + 0, /* CPU has no parent */ + 0, /* no parentdata */ + DC_BUSY, /* the CPU is always busy */ + cpu_model, /* no sense in duplication */ + DC_CLS_CPU /* class */ +}; #ifndef PANIC_REBOOT_WAIT_TIME #define PANIC_REBOOT_WAIT_TIME 15 /* default to 15 seconds */ @@ -404,14 +415,80 @@ identifycpu() printf("CPU: "); if (cpu >= 0 && cpu < (sizeof i386_cpus/sizeof(struct cpu_nameclass))) { - printf("%s", i386_cpus[cpu].cpu_name); cpu_class = i386_cpus[cpu].cpu_class; strncpy(cpu_model, i386_cpus[cpu].cpu_name, sizeof cpu_model); } else { printf("unknown cpu type %d\n", cpu); panic("startup: bad cpu id"); } - printf(" ("); + +#ifdef I586_CPU + if(cpu_class == CPUCLASS_586) { + calibrate_cyclecounter(); + printf("%d-MHz ", pentium_mhz); + } +#endif + if (!strcmp(cpu_vendor,"GenuineIntel")) { + if ((cpu_id & 0xf00) > 3) { + cpu_model[0] = '\0'; + + switch (cpu_id & 0x3000) { + case 0x1000: + strcpy(cpu_model, "Overdrive "); + break; + case 0x2000: + strcpy(cpu_model, "Dual "); + break; + } + if ((cpu_id & 0xf00) == 0x400) { + strcat(cpu_model, "i486 "); + } else if ((cpu_id & 0xf00) == 0x500) { + strcat(cpu_model, "Pentium "); + } else { + strcat(cpu_model, "unknown "); + } + + switch (cpu_id & 0xff0) { + case 0x400: + strcat(cpu_model, "DX"); break; + case 0x410: + strcat(cpu_model, "DX"); break; + case 0x420: + strcat(cpu_model, "SX"); break; + case 0x430: + strcat(cpu_model, "DX2"); break; + case 0x440: + strcat(cpu_model, "SL"); break; + case 0x450: + strcat(cpu_model, "SX2"); break; + case 0x470: + strcat(cpu_model, "DX2 Write-Back Enhanced"); + break; + case 0x480: + strcat(cpu_model, "DX4"); break; + case 0x510: + if (pentium_mhz == 60) { + strcat(cpu_model, "510\\60"); + } else if (pentium_mhz == 66) { + strcat(cpu_model, "567\\66"); + } else { + strcat(cpu_model,"510\\60 or 567\\66"); + } + break; + case 0x520: + if (pentium_mhz == 90) { + strcat(cpu_model, "735\\90"); + } else if (pentium_mhz == 100) { + strcat(cpu_model, "815\\100"); + } else { + strcat(cpu_model,"735\\90 or 815\\100"); + } + break; + } + } + } + + printf("%s (", cpu_model); switch(cpu_class) { case CPUCLASS_286: printf("286"); @@ -428,57 +505,20 @@ identifycpu() default: printf("unknown"); /* will panic below... */ } - printf("-class CPU)"); -#ifdef I586_CPU - if(cpu_class == CPUCLASS_586) { - calibrate_cyclecounter(); - printf(" %d MHz", pentium_mhz); - } -#endif + printf("-class CPU)\n"); if(*cpu_vendor) printf(" Origin = \"%s\"",cpu_vendor); if(cpu_id) printf(" Id = 0x%lx",cpu_id); - printf("\n"); /* cpu speed would be nice, but how? */ - if (!strcmp(cpu_vendor,"GenuineIntel")) { - printf(" This is a"); - if ((cpu_id & 0xf00) > 3) { - switch (cpu_id & 0x3000) { - case 0x1000: printf("Overdrive "); break; - case 0x2000: printf("Dual "); break; - } - if ((cpu_id & 0xf00) == 0x400) - printf("n i486"); - else if ((cpu_id & 0xf00) == 0x500) - printf(" Pentium "); - else - printf(" unknown CPU"); - switch (cpu_id & 0xff0) { - case 0x400: printf("DX"); break; - case 0x410: printf("DX"); break; - case 0x420: printf("SX"); break; - case 0x430: printf("DX2"); break; - case 0x440: printf("SL"); break; - case 0x450: printf("SX2"); break; - case 0x470: printf("DX2 Write-Back Enhanced"); - break; - case 0x480: printf("DX4"); break; - case 0x510: printf("510\\60 or 567\\66"); break; - case 0x520: printf("735\\90 or 815\\100"); break; - } - } - printf(" Stepping=%d\n", cpu_id & 0xf); + + if (!strcmp(cpu_vendor, "GenuineIntel")) { + printf(" Stepping=%d", cpu_id & 0xf); if (cpu_high > 0) { - printf(" Features=0x%lx",cpu_feature); - if (cpu_feature & 0x1) printf(" FPU"); - if (cpu_feature & 0x2) printf(" VME"); - if (cpu_feature & 0x8) printf(" PSE"); - if (cpu_feature & 0x80) printf(" MCE"); - if (cpu_feature & 0x100) printf(" CX8"); - if (cpu_feature & 0x200) printf(" APIC"); - printf("\n"); +#define FEATUREFMT "\020\001FPU\002VME\003PSE\004MCE\005CX8\006APIC" + printf(" Features=0x%b", cpu_feature, FEATUREFMT); } } + printf("\n"); /* * Now that we have told the user what they have, @@ -502,6 +542,7 @@ identifycpu() default: break; } + dev_attach(&kdc_cpu0); } /* diff --git a/sys/amd64/isa/isa.c b/sys/amd64/isa/isa.c index 43b1655..2422893 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.43 1995/04/04 22:48:40 ache Exp $ + * $Id: isa.c,v 1.44 1995/04/06 13:55:56 ache Exp $ */ /* @@ -108,14 +108,17 @@ u_int intr_mask[ICU_LEN]; u_int* intr_mptr[ICU_LEN]; int intr_unit[ICU_LEN]; +extern struct kern_devconf kdc_cpu0; + 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 */ + &kdc_cpu0, /* parent is the CPU */ 0, /* no parentdata */ DC_BUSY, /* busses are always busy */ - "ISA or EISA bus" + "ISA or EISA bus", + DC_CLS_BUS /* class */ }; static inthand_t *fastintr[ICU_LEN] = { diff --git a/sys/amd64/isa/npx.c b/sys/amd64/isa/npx.c index 47e43d5..aacff0d 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.20 1995/02/23 17:32:38 bde Exp $ + * $Id: npx.c,v 1.21 1995/03/05 04:06:44 wpaul Exp $ */ #include "npx.h" @@ -148,6 +148,30 @@ _probetrap: iret "); +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_UNCONFIGURED, /* state */ + "Floating-point unit", + DC_CLS_MISC /* class */ +} }; + +static inline void +npx_registerdev(struct isa_device *id) +{ + int unit; + + unit = id->id_unit; + if (unit != 0) + kdc_npx[unit] = kdc_npx[0]; + kdc_npx[unit].kdc_unit = unit; + kdc_npx[unit].kdc_isa = id; + dev_attach(&kdc_npx[unit]); +} + /* * Probe routine. Initialize cr0 to give correct behaviour for [f]wait * whether the device exists or not (XXX should be elsewhere). Set flags @@ -171,6 +195,7 @@ npxprobe(dvp) * install suitable handlers and run with interrupts enabled so we * won't need to do so much here. */ + npx_registerdev(dvp); npx_intrno = NRSVIDT + ffs(dvp->id_irq) - 1; save_eflags = read_eflags(); disable_intr(); @@ -308,29 +333,6 @@ 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_BUSY, - "Floating-point unit" -} }; - -static inline void -npx_registerdev(struct isa_device *id) -{ - int unit; - - unit = id->id_unit; - if (unit != 0) - kdc_npx[unit] = kdc_npx[0]; - kdc_npx[unit].kdc_unit = unit; - kdc_npx[unit].kdc_isa = id; - dev_attach(&kdc_npx[unit]); -} - /* * Attach routine - announce which it is, and wire into system */ @@ -354,8 +356,9 @@ npxattach(dvp) printf("npx%d: no 387 emulator in kernel!\n", dvp->id_unit); #endif npxinit(__INITIAL_NPXCW__); - if (npx_exists) - npx_registerdev(dvp); + if (npx_exists) { + kdc_npx[dvp->id_unit].kdc_state = DC_BUSY; + } return (1); /* XXX unused */ } diff --git a/sys/dev/ed/if_ed.c b/sys/dev/ed/if_ed.c index e4e71e2..ce1ba4f 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.67 1995/02/26 20:03:53 davidg Exp $ + * $Id: if_ed.c,v 1.68 1995/03/16 18:12:01 bde Exp $ */ #include "ed.h" @@ -180,8 +180,9 @@ static struct kern_devconf kdc_ed_template = { isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, &kdc_isa0, /* parent */ 0, /* parentdata */ - DC_UNCONFIGURED, - "" /* description */ + DC_UNCONFIGURED, /* state */ + "", /* description */ + DC_CLS_NETIF /* class */ }; static inline void @@ -211,7 +212,9 @@ ed_probe(isa_dev) { int nports; +#ifndef DEV_LKM ed_registerdev(isa_dev, "Ethernet adapter"); +#endif /* not DEV_LKM */ nports = ed_probe_WD80x3(isa_dev); if (nports) diff --git a/sys/dev/ep/if_ep.c b/sys/dev/ep/if_ep.c index 68db808..f4c6d95 100644 --- a/sys/dev/ep/if_ep.c +++ b/sys/dev/ep/if_ep.c @@ -38,7 +38,7 @@ */ /* - * $Id: if_ep.c,v 1.13 1995/04/10 07:54:34 root Exp root $ + * $Id: if_ep.c,v 1.25 1995/04/10 21:24:58 jkh Exp $ * * Promiscuous mode added and interrupt logic slightly changed * to reduce the number of adapter failures. Transceiver select @@ -132,13 +132,14 @@ struct isa_driver epdriver = { }; static struct kern_devconf kdc_ep[NEP] = { { - 0, 0, 0, /* filled in by dev_attach */ + 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" + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_UNCONFIGURED, /* state */ + "3Com 3C509 Ethernet adapter", + DC_CLS_NETIF /* class */ } }; static inline void @@ -305,6 +306,8 @@ epprobe(is) u_short k; int i; + ep_registerdev(is); + if (!ep_look_for_board_at(is)) return (0); /* @@ -429,7 +432,7 @@ epattach(is) ifp->if_timer=1; if_attach(ifp); - ep_registerdev(is); + kdc_ep[is->id_unit].kdc_state = DC_BUSY; /* * Fill the hardware address into ifa_addr if we find an AF_LINK entry. diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c index 9a6816f..e755f56 100644 --- a/sys/dev/fdc/fdc.c +++ b/sys/dev/fdc/fdc.c @@ -43,7 +43,7 @@ * SUCH DAMAGE. * * from: @(#)fd.c 7.4 (Berkeley) 5/25/91 - * $Id: fd.c,v 1.55 1995/03/26 19:28:18 rgrimes Exp $ + * $Id: fd.c,v 1.56 1995/04/06 07:20:15 rgrimes Exp $ * */ @@ -101,7 +101,8 @@ static struct kern_devconf kdc_fd[NFD] = { { 0, /* parent */ 0, /* parentdata */ DC_UNCONFIGURED, /* state */ - "floppy disk" + "floppy disk", + DC_CLS_DISK /* class */ } }; struct kern_devconf kdc_fdc[NFDC] = { { @@ -111,7 +112,8 @@ struct kern_devconf kdc_fdc[NFDC] = { { 0, /* parent */ 0, /* parentdata */ DC_UNCONFIGURED, /* state */ - "floppy disk/tape controller" + "floppy disk/tape controller", + DC_CLS_MISC /* class */ } }; static inline void @@ -522,6 +524,10 @@ fdprobe(struct isa_device *dev) fdcdevs[fdcu] = dev; fdc_data[fdcu].baseport = dev->id_iobase; +#ifndef DEV_LKM + fdc_registerdev(dev); +#endif + /* First - lets reset the floppy controller */ outb(dev->id_iobase+FDOUT, 0); DELAY(100); @@ -553,8 +559,6 @@ fdattach(struct isa_device *dev) struct isa_device *fdup; int ic_type = 0; - fdc_registerdev(dev); - fdc->fdcu = fdcu; fdc->flags |= FDC_ATTACHED; fdc->dmachan = dev->id_drq; @@ -619,14 +623,20 @@ fdattach(struct isa_device *dev) case 0x80: printf("NEC 765\n"); fdc->fdct = FDC_NE765; + kdc_fdc[fdcu].kdc_description = + "NEC 765 floppy disk/tape controller"; break; case 0x81: printf("Intel 82077\n"); fdc->fdct = FDC_I82077; + kdc_fdc[fdcu].kdc_description = + "Intel 82077 floppy disk/tape controller"; break; case 0x90: printf("NEC 72065B\n"); fdc->fdct = FDC_NE72065; + kdc_fdc[fdcu].kdc_description = + "NEC 72065B floppy disk/tape controller"; break; default: printf("unknown IC type %02x\n", ic_type); @@ -685,33 +695,43 @@ fdattach(struct isa_device *dev) fd->options = 0; printf("fd%d: ", fdsu, fdu); + fd_registerdev(fdcu, fdu); switch (fdt) { case RTCFDT_12M: printf("1.2MB 5.25in\n"); fd->type = FD_1200; + kdc_fd[fdu].kdc_description = + "1.2MB (1200K) 5.25in floppy disk drive"; break; case RTCFDT_144M: printf("1.44MB 3.5in\n"); fd->type = FD_1440; + kdc_fd[fdu].kdc_description = + "1.44MB (1440K) 3.5in floppy disk drive"; break; case RTCFDT_288M: printf("2.88MB 3.5in - 1.44MB mode\n"); fd->type = FD_1440; + kdc_fd[fdu].kdc_description = + "2.88MB (2880K) 3.5in floppy disk drive in 1.44 mode"; break; case RTCFDT_360K: printf("360KB 5.25in\n"); fd->type = FD_360; + kdc_fd[fdu].kdc_description = + "360KB 5.25in floppy disk drive"; break; case RTCFDT_720K: printf("720KB 3.5in\n"); fd->type = FD_720; + kdc_fd[fdu].kdc_description = + "720KB 3.5in floppy disk drive"; break; default: printf("unknown\n"); fd->type = NO_TYPE; break; } - fd_registerdev(fdcu, fdu); kdc_fd[fdu].kdc_state = DC_IDLE; if (dk_ndrive < DK_NDRIVE) { sprintf(dk_names[dk_ndrive], "fd%d", fdu); diff --git a/sys/dev/ie/if_ie.c b/sys/dev/ie/if_ie.c index 095725f..5e85521 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.21 1995/03/19 14:28:45 davidg Exp $ + * $Id: if_ie.c,v 1.22 1995/03/28 07:55:31 bde Exp $ */ /* @@ -314,18 +314,18 @@ static struct kern_devconf kdc_ie[NIE] = { { isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, &kdc_isa0, /* parent */ 0, /* parentdata */ - DC_BUSY, /* network interfaces are always ``busy'' */ - "" + DC_UNCONFIGURED, /* state */ + "Ethernet adapter", /* description */ + DC_CLS_NETIF /* class */ } }; static inline void -ie_registerdev(struct isa_device *id, const char *descr) +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; - kdc_ie[id->id_unit].kdc_description = descr; dev_attach(&kdc_ie[id->id_unit]); } @@ -335,6 +335,8 @@ int ieprobe(dvp) { int ret; + ie_registerdev(dvp); + ret = sl_probe(dvp); if(!ret) ret = el_probe(dvp); if(!ret) ret = ni_probe(dvp); @@ -591,7 +593,7 @@ ieattach(dvp) #endif if_attach(ifp); - ie_registerdev(dvp, ie_hardware_names[ie_softc[unit].hard_type]); + kdc_ie[unit].kdc_description = 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 305b7fc..e1105eb 100644 --- a/sys/dev/lnc/if_lnc.c +++ b/sys/dev/lnc/if_lnc.c @@ -150,7 +150,8 @@ static struct kern_devconf kdc_lnc = { &kdc_isa0, /* parent */ 0, /* parentdata */ DC_UNCONFIGURED, - "" + "", + DC_CLS_NETIF }; inline void diff --git a/sys/dev/mcd/mcd.c b/sys/dev/mcd/mcd.c index 338fabf..1b96801 100644 --- a/sys/dev/mcd/mcd.c +++ b/sys/dev/mcd/mcd.c @@ -40,7 +40,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.39 1995/02/23 17:40:16 ache Exp $ + * $Id: mcd.c,v 1.40 1995/03/28 07:55:42 bde Exp $ */ static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore"; @@ -223,8 +223,9 @@ static struct kern_devconf kdc_mcd[NMCD] = { { isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, &kdc_isa0, /* parent */ 0, /* parentdata */ - DC_IDLE, /* status */ - "Mitsumi CD-ROM controller" /* properly filled later */ + DC_UNCONFIGURED, /* status */ + "Mitsumi CD-ROM controller", /* properly filled later */ + DC_CLS_RDISK } }; static inline void @@ -250,7 +251,7 @@ int mcd_attach(struct isa_device *dev) /* wire controller for interrupts and dma */ mcd_configure(cd); #endif - mcd_registerdev(dev); + kdc_mcd[dev->id_unit].kdc_state = DC_IDLE; /* name filled in probe */ kdc_mcd[dev->id_unit].kdc_description = mcd_data[dev->id_unit].name; @@ -702,6 +703,7 @@ mcd_probe(struct isa_device *dev) int status; unsigned char stbytes[3]; + mcd_registerdev(dev); mcd_data[unit].flags = MCDPROBING; #ifdef NOTDEF diff --git a/sys/dev/mse/mse.c b/sys/dev/mse/mse.c index de7b26d..a2c5ef3 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.9 1994/11/08 05:41:34 jkh Exp $ + * $Id: mse.c,v 1.10 1995/03/28 07:55:44 bde Exp $ */ /* * Driver for the Logitech and ATI Inport Bus mice for use with 386bsd and @@ -181,6 +181,27 @@ struct mse_types { { 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_UNCONFIGURED, /* state */ + "ATI or Logitech bus mouse adapter", + DC_CLS_MISC /* class */ +} }; + +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 mseprobe(idp) register struct isa_device *idp; @@ -188,6 +209,7 @@ mseprobe(idp) register struct mse_softc *sc = &mse_sc[idp->id_unit]; register int i; + mse_registerdev(idp); /* * Check for each mouse type in the table. */ @@ -205,26 +227,6 @@ 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; @@ -232,7 +234,7 @@ mseattach(idp) struct mse_softc *sc = &mse_sc[idp->id_unit]; sc->sc_port = idp->id_iobase; - mse_registerdev(idp); + kdc_mse[idp->id_unit].kdc_state = DC_IDLE; return (1); } @@ -253,6 +255,7 @@ mseopen(dev, flag) if (sc->sc_flags & MSESC_OPEN) return (EBUSY); sc->sc_flags |= MSESC_OPEN; + kdc_mse[MSE_UNIT(dev)].kdc_state = DC_BUSY; sc->sc_obuttons = sc->sc_buttons = 0x7; sc->sc_deltax = sc->sc_deltay = 0; sc->sc_bytesread = PROTOBYTES; @@ -280,6 +283,7 @@ mseclose(dev, flag) s = spltty(); (*sc->sc_disablemouse)(sc->sc_port); sc->sc_flags &= ~MSESC_OPEN; + kdc_mse[MSE_UNIT(dev)].kdc_state = DC_IDLE; splx(s); return(0); } diff --git a/sys/dev/scd/scd.c b/sys/dev/scd/scd.c index 0959c8e..0f1973f 100644 --- a/sys/dev/scd/scd.c +++ b/sys/dev/scd/scd.c @@ -41,7 +41,7 @@ */ -/* $Id: scd.c,v 1.1 1995/03/24 18:33:00 jkh Exp $ */ +/* $Id: scd.c,v 1.2 1995/03/25 18:14:37 bde Exp $ */ /* Please send any comments to micke@dynas.se */ @@ -194,8 +194,9 @@ static struct kern_devconf kdc_scd[NSCD] = { { isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, &kdc_isa0, /* parent */ 0, /* parentdata */ - DC_IDLE, /* status */ - "Sony CD-ROM drive" /* properly filled later */ + DC_UNCONFIGURED, /* status */ + "Sony CD-ROM drive", /* properly filled later */ + DC_CLS_RDISK /* class */ } }; static inline void @@ -215,7 +216,7 @@ int scd_attach(struct isa_device *dev) cd->iobase = dev->id_iobase; /* Already set by probe, but ... */ - scd_registerdev(dev); + kdc_scd[dev->id_unit].kdc_state = DC_IDLE; /* name filled in probe */ kdc_scd[dev->id_unit].kdc_description = scd_data[dev->id_unit].name; printf("scd%d: <%s>\n", dev->id_unit, scd_data[dev->id_unit].name); @@ -709,6 +710,8 @@ scd_probe(struct isa_device *dev) bzero(&drive_config, sizeof(drive_config)); + scd_registerdev(dev); + again: /* Reset drive */ write_control(dev->id_iobase, CBIT_RESET_DRIVE); diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index f03bdbd..d7d787b 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.88 1995/04/04 16:26:04 ache Exp $ + * $Id: sio.c,v 1.89 1995/04/11 17:58:09 ache Exp $ */ #include "sio.h" @@ -347,6 +347,31 @@ static struct speedtab comspeedtab[] = { /* XXX - configure this list */ static Port_t likely_com_ports[] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, }; +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_UNCONFIGURED, + "RS-232 serial port" +} }; + +static void +sioregisterdev(id) + struct isa_device *id; +{ + int unit; + + unit = id->id_unit; + if (unit != 0) + kdc_sio[unit] = kdc_sio[0]; + kdc_sio[unit].kdc_unit = unit; + kdc_sio[unit].kdc_isa = id; + kdc_sio[unit].kdc_state = DC_IDLE; + dev_attach(&kdc_sio[unit]); +} + static int sioprobe(dev) struct isa_device *dev; @@ -360,6 +385,8 @@ sioprobe(dev) u_char mcr_image; int result; + sioregisterdev(dev); + if (!already_init) { /* * Turn off MCR_IENABLE for all likely serial ports. An unused @@ -535,31 +562,6 @@ 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_UNCONFIGURED, - "RS-232 serial port" -} }; - -static void -sioregisterdev(id) - struct isa_device *id; -{ - int unit; - - unit = id->id_unit; - if (unit != 0) - kdc_sio[unit] = kdc_sio[0]; - kdc_sio[unit].kdc_unit = unit; - kdc_sio[unit].kdc_isa = id; - kdc_sio[unit].kdc_state = DC_IDLE; - dev_attach(&kdc_sio[unit]); -} - static int sioattach(isdp) @@ -634,6 +636,8 @@ sioattach(isdp) #ifdef DSI_SOFT_MODEM if((inb(iobase+7) ^ inb(iobase+7)) & 0x80) { printf(" Digicom Systems, Inc. SoftModem"); + kdc_sio[isdp->id_unit].kdc_description = + "Serial port: Digicom Systems SoftModem"; goto determined_type; } #endif /* DSI_SOFT_MODEM */ @@ -654,6 +658,8 @@ sioattach(isdp) outb(iobase + com_scr, scr); if (scr1 != 0xa5 || scr2 != 0x5a) { printf(" 8250"); + kdc_sio[isdp->id_unit].kdc_description = + "Serial port: National 8250 or compatible"; goto determined_type; } } @@ -662,21 +668,31 @@ sioattach(isdp) switch (inb(com->int_id_port) & IIR_FIFO_MASK) { case FIFO_TRIGGER_1: printf(" 16450"); + kdc_sio[isdp->id_unit].kdc_description = + "Serial port: National 16450 or compatible"; break; case FIFO_TRIGGER_4: printf(" 16450?"); + kdc_sio[isdp->id_unit].kdc_description = + "Serial port: maybe National 16450"; break; case FIFO_TRIGGER_8: printf(" 16550?"); + kdc_sio[isdp->id_unit].kdc_description = + "Serial port: maybe National 16550"; break; case FIFO_TRIGGER_14: printf(" 16550A"); - if (COM_NOFIFO(isdp)) + if (COM_NOFIFO(isdp)) { printf(" fifo disabled"); - else { + kdc_sio[isdp->id_unit].kdc_description = + "Serial port: National 16550A, FIFO disabled"; + } else { com->hasfifo = TRUE; com->ftl_init = FIFO_TRIGGER_14; com->tx_fifo_size = 16; + kdc_sio[isdp->id_unit].kdc_description = + "Serial port: National 16550A or compatible"; } break; } @@ -696,7 +712,8 @@ determined_type: ; #endif /* COM_MULTIPORT */ printf("\n"); - sioregisterdev(isdp); + kdc_sio[unit].kdc_state = + (unit == comconsole) ? DC_BUSY : DC_IDLE; #ifdef KGDB if (kgdb_dev == makedev(commajor, unit)) { @@ -718,6 +735,7 @@ determined_type: ; outb(iobase + com_cfcr, CFCR_8BITS); outb(com->modem_status_port, com->mcr_image |= MCR_DTR | MCR_RTS); + kdc_sio[unit].kdc_state = DC_BUSY; if (kgdb_debug_init) { /* @@ -891,6 +909,7 @@ open_top: disc_optim(tp, &(tp->t_termios), com); if (tp->t_state & TS_ISOPEN && mynor & CALLOUT_MASK) com->active_out = TRUE; + kdc_sio[unit].kdc_state = DC_BUSY; out: splx(s); if (!(tp->t_state & TS_ISOPEN) && com->wopeners == 0) @@ -910,11 +929,13 @@ sioclose(dev, flag, mode, p) int mynor; int s; struct tty *tp; + int unit; mynor = minor(dev); if (mynor & CONTROL_MASK) return (0); - com = com_addr(MINOR_TO_UNIT(mynor)); + unit = MINOR_TO_UNIT(mynor); + com = com_addr(unit); tp = com->tp; s = spltty(); (*linesw[tp->t_line].l_close)(tp, flag); @@ -922,6 +943,7 @@ sioclose(dev, flag, mode, p) siostop(tp, FREAD | FWRITE); comhardclose(com); ttyclose(tp); + kdc_sio[unit].kdc_state = DC_IDLE; splx(s); return (0); } diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index 41fa3eb..020fa13 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -25,7 +25,7 @@ * (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: syscons.c,v 1.107 1995/03/03 08:37:07 sos Exp $ + * $Id: syscons.c,v 1.111 1995/04/04 20:06:26 sos Exp $ */ #include "sc.h" @@ -203,7 +203,8 @@ static struct kern_devconf kdc_sc[NSC] = { &kdc_isa0, /* parent */ 0, /* parentdata */ DC_BUSY, /* the console is almost always busy */ - "Graphics console" + "Graphics console", + DC_CLS_DISPLAY /* class */ }; static inline void diff --git a/sys/i386/eisa/aha1742.c b/sys/i386/eisa/aha1742.c index ebbd4bb..b411f81 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.29 1995/03/23 09:00:18 rgrimes Exp $ + * $Id: aha1742.c,v 1.30 1995/03/28 07:55:23 bde Exp $ */ #include <sys/types.h> @@ -325,8 +325,9 @@ static struct kern_devconf kdc_ahb[NAHB] = { { 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" + DC_UNCONFIGURED, /* always start out here in probe */ + "Adaptec 174x-series SCSI host adapter", + DC_CLS_MISC /* host adapters aren't special */ } }; static inline void @@ -506,6 +507,10 @@ ahbprobe1(dev) bzero(ahb, sizeof(struct ahb_data)); ahbdata[unit] = ahb; ahb->baseport = dev->id_iobase; +#ifndef DEV_LKM + ahb_registerdev(dev); +#endif /* DEV_LKM */ + /* * Try initialise a unit at this location * sets up dma and bus speed, loads ahb->vect @@ -543,7 +548,7 @@ ahb_attach(dev) ahb->sc_link.adapter = &ahb_switch; ahb->sc_link.device = &ahb_dev; - ahb_registerdev(dev); + kdc_ahb[unit].kdc_state = DC_BUSY; /* host adapters are always busy */ /* * ask the adapter what subunits are present */ diff --git a/sys/i386/eisa/aic7770.c b/sys/i386/eisa/aic7770.c index 0fde1ed..2cfb904 100644 --- a/sys/i386/eisa/aic7770.c +++ b/sys/i386/eisa/aic7770.c @@ -19,7 +19,7 @@ * 4. Modifications may be freely made to this file if the above conditions * are met. * - * $Id: aic7770.c,v 1.11 1995/03/07 08:58:22 gibbs Exp $ + * $Id: aic7770.c,v 1.12 1995/03/31 13:36:57 gibbs Exp $ */ #include <sys/param.h> @@ -65,8 +65,9 @@ static struct kern_devconf kdc_aic7770[NAHC] = { { isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, &kdc_isa0, /* parent */ 0, /* parentdata */ - DC_BUSY, /* host adapters are always ``in use'' */ - "Adaptec aic7770 based SCSI host adapter" + DC_UNCONFIGURED, /* always start out here */ + "Adaptec aic7770 based SCSI host adapter", + DC_CLS_MISC /* host adapters aren't special */ } }; static inline void @@ -120,6 +121,9 @@ aic7770probe(struct isa_device *dev) if ( sig_id[3] == valid_ids[i].id ) { int unit = dev->id_unit; dev->id_iobase = port; +#ifndef DEV_LKM + aic7770_registerdev(dev); +#endif /* DEV_LKM */ if(ahcprobe(unit, port, valid_ids[i].type)){ /* @@ -144,7 +148,7 @@ aic7770_attach(dev) struct isa_device *dev; { int unit = dev->id_unit; - aic7770_registerdev(dev); + kdc_aic7770[unit].kdc_state = DC_BUSY; /* host adapters always busy */ return ahc_attach(unit); } diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index bd8196a..7e1129b 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.115 1995/03/17 04:19:19 davidg Exp $ + * $Id: machdep.c,v 1.116 1995/04/06 07:55:42 rgrimes Exp $ */ #include "npx.h" @@ -129,7 +129,18 @@ static void identifycpu(void); static void initcpu(void); char machine[] = "i386"; -char cpu_model[sizeof("Cy486DLC") + 1]; +char cpu_model[128]; + +struct kern_devconf kdc_cpu0 = { + 0, 0, 0, /* filled in by dev_attach */ + "cpu", 0, { MDDT_CPU }, + 0, 0, 0, CPU_EXTERNALLEN, + 0, /* CPU has no parent */ + 0, /* no parentdata */ + DC_BUSY, /* the CPU is always busy */ + cpu_model, /* no sense in duplication */ + DC_CLS_CPU /* class */ +}; #ifndef PANIC_REBOOT_WAIT_TIME #define PANIC_REBOOT_WAIT_TIME 15 /* default to 15 seconds */ @@ -404,14 +415,80 @@ identifycpu() printf("CPU: "); if (cpu >= 0 && cpu < (sizeof i386_cpus/sizeof(struct cpu_nameclass))) { - printf("%s", i386_cpus[cpu].cpu_name); cpu_class = i386_cpus[cpu].cpu_class; strncpy(cpu_model, i386_cpus[cpu].cpu_name, sizeof cpu_model); } else { printf("unknown cpu type %d\n", cpu); panic("startup: bad cpu id"); } - printf(" ("); + +#ifdef I586_CPU + if(cpu_class == CPUCLASS_586) { + calibrate_cyclecounter(); + printf("%d-MHz ", pentium_mhz); + } +#endif + if (!strcmp(cpu_vendor,"GenuineIntel")) { + if ((cpu_id & 0xf00) > 3) { + cpu_model[0] = '\0'; + + switch (cpu_id & 0x3000) { + case 0x1000: + strcpy(cpu_model, "Overdrive "); + break; + case 0x2000: + strcpy(cpu_model, "Dual "); + break; + } + if ((cpu_id & 0xf00) == 0x400) { + strcat(cpu_model, "i486 "); + } else if ((cpu_id & 0xf00) == 0x500) { + strcat(cpu_model, "Pentium "); + } else { + strcat(cpu_model, "unknown "); + } + + switch (cpu_id & 0xff0) { + case 0x400: + strcat(cpu_model, "DX"); break; + case 0x410: + strcat(cpu_model, "DX"); break; + case 0x420: + strcat(cpu_model, "SX"); break; + case 0x430: + strcat(cpu_model, "DX2"); break; + case 0x440: + strcat(cpu_model, "SL"); break; + case 0x450: + strcat(cpu_model, "SX2"); break; + case 0x470: + strcat(cpu_model, "DX2 Write-Back Enhanced"); + break; + case 0x480: + strcat(cpu_model, "DX4"); break; + case 0x510: + if (pentium_mhz == 60) { + strcat(cpu_model, "510\\60"); + } else if (pentium_mhz == 66) { + strcat(cpu_model, "567\\66"); + } else { + strcat(cpu_model,"510\\60 or 567\\66"); + } + break; + case 0x520: + if (pentium_mhz == 90) { + strcat(cpu_model, "735\\90"); + } else if (pentium_mhz == 100) { + strcat(cpu_model, "815\\100"); + } else { + strcat(cpu_model,"735\\90 or 815\\100"); + } + break; + } + } + } + + printf("%s (", cpu_model); switch(cpu_class) { case CPUCLASS_286: printf("286"); @@ -428,57 +505,20 @@ identifycpu() default: printf("unknown"); /* will panic below... */ } - printf("-class CPU)"); -#ifdef I586_CPU - if(cpu_class == CPUCLASS_586) { - calibrate_cyclecounter(); - printf(" %d MHz", pentium_mhz); - } -#endif + printf("-class CPU)\n"); if(*cpu_vendor) printf(" Origin = \"%s\"",cpu_vendor); if(cpu_id) printf(" Id = 0x%lx",cpu_id); - printf("\n"); /* cpu speed would be nice, but how? */ - if (!strcmp(cpu_vendor,"GenuineIntel")) { - printf(" This is a"); - if ((cpu_id & 0xf00) > 3) { - switch (cpu_id & 0x3000) { - case 0x1000: printf("Overdrive "); break; - case 0x2000: printf("Dual "); break; - } - if ((cpu_id & 0xf00) == 0x400) - printf("n i486"); - else if ((cpu_id & 0xf00) == 0x500) - printf(" Pentium "); - else - printf(" unknown CPU"); - switch (cpu_id & 0xff0) { - case 0x400: printf("DX"); break; - case 0x410: printf("DX"); break; - case 0x420: printf("SX"); break; - case 0x430: printf("DX2"); break; - case 0x440: printf("SL"); break; - case 0x450: printf("SX2"); break; - case 0x470: printf("DX2 Write-Back Enhanced"); - break; - case 0x480: printf("DX4"); break; - case 0x510: printf("510\\60 or 567\\66"); break; - case 0x520: printf("735\\90 or 815\\100"); break; - } - } - printf(" Stepping=%d\n", cpu_id & 0xf); + + if (!strcmp(cpu_vendor, "GenuineIntel")) { + printf(" Stepping=%d", cpu_id & 0xf); if (cpu_high > 0) { - printf(" Features=0x%lx",cpu_feature); - if (cpu_feature & 0x1) printf(" FPU"); - if (cpu_feature & 0x2) printf(" VME"); - if (cpu_feature & 0x8) printf(" PSE"); - if (cpu_feature & 0x80) printf(" MCE"); - if (cpu_feature & 0x100) printf(" CX8"); - if (cpu_feature & 0x200) printf(" APIC"); - printf("\n"); +#define FEATUREFMT "\020\001FPU\002VME\003PSE\004MCE\005CX8\006APIC" + printf(" Features=0x%b", cpu_feature, FEATUREFMT); } } + printf("\n"); /* * Now that we have told the user what they have, @@ -502,6 +542,7 @@ identifycpu() default: break; } + dev_attach(&kdc_cpu0); } /* diff --git a/sys/i386/isa/aha1542.c b/sys/i386/isa/aha1542.c index 6082396..33a1c10 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.41 1995/01/31 11:41:36 dufault Exp $ + * $Id: aha1542.c,v 1.42 1995/03/28 07:55:22 bde Exp $ */ /* @@ -361,8 +361,9 @@ static struct kern_devconf kdc_aha[NAHA] = { { 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" + DC_UNCONFIGURED, /* always start out here */ + "Adaptec 154x-series SCSI host adapter", + DC_CLS_MISC /* SCSI host adapters aren't special */ } }; static inline void @@ -573,6 +574,11 @@ ahaprobe(dev) bzero(aha, sizeof(struct aha_data)); ahadata[unit] = aha; aha->aha_base = dev->id_iobase; + +#ifndef DEV_LKM + aha_registerdev(dev); +#endif + /* * Try initialise a unit at this location * sets up dma and bus speed, loads aha->aha_int @@ -628,7 +634,7 @@ ahaattach(dev) /* * ask the adapter what subunits are present */ - aha_registerdev(dev); + kdc_aha[unit].kdc_state = DC_BUSY; /* host adapters are always busy */ scsi_attachdevs(&(aha->sc_link)); return 1; diff --git a/sys/i386/isa/aha1742.c b/sys/i386/isa/aha1742.c index ebbd4bb..b411f81 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.29 1995/03/23 09:00:18 rgrimes Exp $ + * $Id: aha1742.c,v 1.30 1995/03/28 07:55:23 bde Exp $ */ #include <sys/types.h> @@ -325,8 +325,9 @@ static struct kern_devconf kdc_ahb[NAHB] = { { 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" + DC_UNCONFIGURED, /* always start out here in probe */ + "Adaptec 174x-series SCSI host adapter", + DC_CLS_MISC /* host adapters aren't special */ } }; static inline void @@ -506,6 +507,10 @@ ahbprobe1(dev) bzero(ahb, sizeof(struct ahb_data)); ahbdata[unit] = ahb; ahb->baseport = dev->id_iobase; +#ifndef DEV_LKM + ahb_registerdev(dev); +#endif /* DEV_LKM */ + /* * Try initialise a unit at this location * sets up dma and bus speed, loads ahb->vect @@ -543,7 +548,7 @@ ahb_attach(dev) ahb->sc_link.adapter = &ahb_switch; ahb->sc_link.device = &ahb_dev; - ahb_registerdev(dev); + kdc_ahb[unit].kdc_state = DC_BUSY; /* host adapters are always busy */ /* * ask the adapter what subunits are present */ diff --git a/sys/i386/isa/aic6360.c b/sys/i386/isa/aic6360.c index 4d648db..daa9885 100644 --- a/sys/i386/isa/aic6360.c +++ b/sys/i386/isa/aic6360.c @@ -31,7 +31,7 @@ */ /* - * $Id: aic6360.c,v 1.6 1995/03/01 22:30:47 dufault Exp $ + * $Id: aic6360.c,v 1.7 1995/03/28 07:55:24 bde Exp $ * * Acknowledgements: Many of the algorithms used in this driver are * inspired by the work of Julian Elischer (julian@tfs.com) and @@ -756,8 +756,9 @@ static struct kern_devconf kdc_aic[NAIC] = { { 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" + DC_UNCONFIGURED, /* start out in unconfig state */ + "Adaptec AIC-6360 SCSI host adapter chipset", + DC_CLS_MISC /* host adapters aren't special */ } }; static inline void @@ -818,6 +819,9 @@ aicprobe(parent, self, aux) bzero(aic, sizeof(struct aic_data)); aicdata[unit] = aic; aic->iobase = dev->id_iobase; +#ifndef DEV_LKM + aic_registerdev(dev); +#endif /* not DEV_LKM */ if (aic_find(aic) != 0) { aicdata[unit] = NULL; @@ -825,7 +829,6 @@ aicprobe(parent, self, aux) return 0; } aicunit++; - aic_registerdev(dev); return 0x20; #else #ifdef NEWCONFIG @@ -963,6 +966,7 @@ aicattach(parent, self, aux) /* * ask the adapter what subunits are present */ + kdc_aic[unit].kdc_state = DC_BUSY; /* host adapters are always busy */ scsi_attachdevs(&(aic->sc_link)); return 1; diff --git a/sys/i386/isa/aic7770.c b/sys/i386/isa/aic7770.c index 0fde1ed..2cfb904 100644 --- a/sys/i386/isa/aic7770.c +++ b/sys/i386/isa/aic7770.c @@ -19,7 +19,7 @@ * 4. Modifications may be freely made to this file if the above conditions * are met. * - * $Id: aic7770.c,v 1.11 1995/03/07 08:58:22 gibbs Exp $ + * $Id: aic7770.c,v 1.12 1995/03/31 13:36:57 gibbs Exp $ */ #include <sys/param.h> @@ -65,8 +65,9 @@ static struct kern_devconf kdc_aic7770[NAHC] = { { isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, &kdc_isa0, /* parent */ 0, /* parentdata */ - DC_BUSY, /* host adapters are always ``in use'' */ - "Adaptec aic7770 based SCSI host adapter" + DC_UNCONFIGURED, /* always start out here */ + "Adaptec aic7770 based SCSI host adapter", + DC_CLS_MISC /* host adapters aren't special */ } }; static inline void @@ -120,6 +121,9 @@ aic7770probe(struct isa_device *dev) if ( sig_id[3] == valid_ids[i].id ) { int unit = dev->id_unit; dev->id_iobase = port; +#ifndef DEV_LKM + aic7770_registerdev(dev); +#endif /* DEV_LKM */ if(ahcprobe(unit, port, valid_ids[i].type)){ /* @@ -144,7 +148,7 @@ aic7770_attach(dev) struct isa_device *dev; { int unit = dev->id_unit; - aic7770_registerdev(dev); + kdc_aic7770[unit].kdc_state = DC_BUSY; /* host adapters always busy */ return ahc_attach(unit); } diff --git a/sys/i386/isa/b004.c b/sys/i386/isa/b004.c index 02b52eb..654d04d 100644 --- a/sys/i386/isa/b004.c +++ b/sys/i386/isa/b004.c @@ -65,6 +65,17 @@ #include "b004.h" +static struct kern_devconf kdc_bqu[NBQU] = { { + 0, 0, 0, /* filled in by dev_attach */ + "bqu", 0, { MDDT_ISA, 0 }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_UNCONFIGURED, /* always start here */ + "B004-compatible Transputer board", + DC_CLS_MISC +} }; + #define IOCTL_OUT(arg, ret) *(int*)arg = ret #define B004PRI (PZERO+8) @@ -433,6 +444,7 @@ bquopen(dev_t dev, int flag) return EBUSY; } B004_F(dev_min) |= B004_BUSY; + kdc_bqu[dev_min].kdc_state = DC_BUSY; B004_TIMEOUT(dev_min) = 0; DEB(printf( "B004 opened, minor = %d.\n", dev_min );) return 0; @@ -453,6 +465,7 @@ bquclose(dev_t dev, int flag) return ENXIO; } B004_F(dev_min) &= ~B004_BUSY; + kdc_bqu[dev_min].kdc_state = DC_IDLE; DEB(printf("B004(%d) released.\n", dev_min );) return 0; } @@ -518,16 +531,6 @@ bquioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p) } /* bquioctl() */ -static struct kern_devconf kdc_bqu[NBQU] = { { - 0, 0, 0, /* filled in by dev_attach */ - "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 bqu_registerdev(struct isa_device *id) { @@ -541,7 +544,7 @@ bqu_registerdev(struct isa_device *id) int bquattach(struct isa_device *idp) { - bqu_registerdev(idp); + kdc_bqu[idp->id_unit].kdc_state = DC_IDLE; return 1; } @@ -573,6 +576,10 @@ printf("bquprobe::\nIOBASE 0x%x\nIRQ %d\nDRQ %d\nMSIZE %d\nUNIT %d\nFLAGS x0%x\n if(dev_min >= NBQU) return (0); /* No more descriptors */ if ((idp->id_iobase < 0x100) || (idp->id_iobase >= 0x1000)) idp->id_iobase=0; /* Dangerous isa addres ) */ +#ifndef DEV_LKM + bqu_registerdev(idp); +#endif /* not DEV_LKM */ + for (test = 0; (test < B004_CHANCE); test++) { if((idp->id_iobase==0)&&((!b004_base_addresses[test])|| detected(b004_base_addresses[test]))) diff --git a/sys/i386/isa/bt742a.c b/sys/i386/isa/bt742a.c index 4efb7c3..b1f0d7f 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.30 1994/11/08 02:53:42 jkh Exp $ + * $Id: bt742a.c,v 1.31 1995/03/16 18:11:56 bde Exp $ */ /* @@ -446,8 +446,9 @@ static struct kern_devconf kdc_bt[NBT] = { { 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" + DC_UNCONFIGURED, /* always start here */ + "Buslogic 742-compatible SCSI host adapter", + DC_CLS_MISC /* host adapters aren't special */ } }; static inline void @@ -643,6 +644,10 @@ btprobe(dev) btdata[unit] = bt; bt->bt_base = dev->id_iobase; +#ifndef DEV_LKM + bt_registerdev(dev); +#endif /* not DEV_LKM */ + /* * Try initialise a unit at this location * sets up dma and bus speed, loads bt->bt_int @@ -683,7 +688,8 @@ btattach(dev) bt->sc_link.device = &bt_dev; bt->sc_link.flags = SDEV_BOUNCE; - bt_registerdev(dev); + kdc_bt[unit].kdc_state = DC_BUSY; /* host adapters are always busy */ + /* * ask the adapter what subunits are present */ diff --git a/sys/i386/isa/ctx.c b/sys/i386/isa/ctx.c index 9d0f621..3c7f1f3 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.3 1994/10/21 01:19:05 wollman Exp $ + * $Id: ctx.c,v 1.4 1994/10/23 21:27:11 wollman Exp $ */ /* @@ -160,8 +160,9 @@ static struct kern_devconf kdc_ctx[NCTX] = { { isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, &kdc_isa0, /* parent */ 0, /* parentdata */ - DC_UNKNOWN, /* not supported */ - "CORTEX-I frame grabber" + DC_UNCONFIGURED, /* always start out here */ + "CORTEX-I frame grabber", + DC_CLS_MISC } }; static inline void @@ -179,6 +180,8 @@ ctxprobe(struct isa_device * devp) { int status; + ctx_registerdev(devp); + if (inb(devp->id_iobase) == 0xff) /* 0xff only if board absent */ status = 0; else @@ -198,7 +201,7 @@ ctxattach(struct isa_device * devp) sr->iobase = devp->id_iobase; sr->maddr = devp->id_maddr; sr->msize = devp->id_msize; - ctx_registerdev(devp); + kdc_ctx[devp->id_unit].kdc_state = DC_IDLE; return (1); } @@ -227,6 +230,7 @@ ctxopen(dev_t dev, int flag) return (ENOMEM); sr->flag = OPEN; + kdc_ctx[unit].kdc_state = DC_BUSY; /* Set up the shadow registers. We don't actually write these @@ -264,6 +268,7 @@ ctxclose(dev_t dev, int flag) unit = UNIT(minor(dev)); ctx_sr[unit].flag = 0; + kdc_ctx[unit].kdc_state = DC_IDLE; free(ctx_sr[unit].lutp, M_DEVBUF); ctx_sr[unit].lutp = NULL; return (0); diff --git a/sys/i386/isa/fd.c b/sys/i386/isa/fd.c index 9a6816f..e755f56 100644 --- a/sys/i386/isa/fd.c +++ b/sys/i386/isa/fd.c @@ -43,7 +43,7 @@ * SUCH DAMAGE. * * from: @(#)fd.c 7.4 (Berkeley) 5/25/91 - * $Id: fd.c,v 1.55 1995/03/26 19:28:18 rgrimes Exp $ + * $Id: fd.c,v 1.56 1995/04/06 07:20:15 rgrimes Exp $ * */ @@ -101,7 +101,8 @@ static struct kern_devconf kdc_fd[NFD] = { { 0, /* parent */ 0, /* parentdata */ DC_UNCONFIGURED, /* state */ - "floppy disk" + "floppy disk", + DC_CLS_DISK /* class */ } }; struct kern_devconf kdc_fdc[NFDC] = { { @@ -111,7 +112,8 @@ struct kern_devconf kdc_fdc[NFDC] = { { 0, /* parent */ 0, /* parentdata */ DC_UNCONFIGURED, /* state */ - "floppy disk/tape controller" + "floppy disk/tape controller", + DC_CLS_MISC /* class */ } }; static inline void @@ -522,6 +524,10 @@ fdprobe(struct isa_device *dev) fdcdevs[fdcu] = dev; fdc_data[fdcu].baseport = dev->id_iobase; +#ifndef DEV_LKM + fdc_registerdev(dev); +#endif + /* First - lets reset the floppy controller */ outb(dev->id_iobase+FDOUT, 0); DELAY(100); @@ -553,8 +559,6 @@ fdattach(struct isa_device *dev) struct isa_device *fdup; int ic_type = 0; - fdc_registerdev(dev); - fdc->fdcu = fdcu; fdc->flags |= FDC_ATTACHED; fdc->dmachan = dev->id_drq; @@ -619,14 +623,20 @@ fdattach(struct isa_device *dev) case 0x80: printf("NEC 765\n"); fdc->fdct = FDC_NE765; + kdc_fdc[fdcu].kdc_description = + "NEC 765 floppy disk/tape controller"; break; case 0x81: printf("Intel 82077\n"); fdc->fdct = FDC_I82077; + kdc_fdc[fdcu].kdc_description = + "Intel 82077 floppy disk/tape controller"; break; case 0x90: printf("NEC 72065B\n"); fdc->fdct = FDC_NE72065; + kdc_fdc[fdcu].kdc_description = + "NEC 72065B floppy disk/tape controller"; break; default: printf("unknown IC type %02x\n", ic_type); @@ -685,33 +695,43 @@ fdattach(struct isa_device *dev) fd->options = 0; printf("fd%d: ", fdsu, fdu); + fd_registerdev(fdcu, fdu); switch (fdt) { case RTCFDT_12M: printf("1.2MB 5.25in\n"); fd->type = FD_1200; + kdc_fd[fdu].kdc_description = + "1.2MB (1200K) 5.25in floppy disk drive"; break; case RTCFDT_144M: printf("1.44MB 3.5in\n"); fd->type = FD_1440; + kdc_fd[fdu].kdc_description = + "1.44MB (1440K) 3.5in floppy disk drive"; break; case RTCFDT_288M: printf("2.88MB 3.5in - 1.44MB mode\n"); fd->type = FD_1440; + kdc_fd[fdu].kdc_description = + "2.88MB (2880K) 3.5in floppy disk drive in 1.44 mode"; break; case RTCFDT_360K: printf("360KB 5.25in\n"); fd->type = FD_360; + kdc_fd[fdu].kdc_description = + "360KB 5.25in floppy disk drive"; break; case RTCFDT_720K: printf("720KB 3.5in\n"); fd->type = FD_720; + kdc_fd[fdu].kdc_description = + "720KB 3.5in floppy disk drive"; break; default: printf("unknown\n"); fd->type = NO_TYPE; break; } - fd_registerdev(fdcu, fdu); kdc_fd[fdu].kdc_state = DC_IDLE; if (dk_ndrive < DK_NDRIVE) { sprintf(dk_names[dk_ndrive], "fd%d", fdu); diff --git a/sys/i386/isa/ft.c b/sys/i386/isa/ft.c index b6aa35b..9470fb9 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.18 1995/04/06 07:20:16 rgrimes Exp $ + * $Id: ft.c,v 1.19 1995/04/09 06:23:12 rgrimes Exp $ * * 01/19/95 ++sg * Cleaned up recalibrate/seek code at attach time for FreeBSD 2.x. @@ -408,8 +408,9 @@ static struct kern_devconf kdc_ft[NFT] = { { ft_externalize, 0, 0, DISK_EXTERNALLEN, 0, /* parent */ 0, /* parentdata */ - DC_UNKNOWN, /* state */ - "floppy tape" + DC_IDLE, /* state */ + "floppy tape", + DC_CLS_TAPE /* class */ } }; static inline void @@ -512,43 +513,55 @@ out: tape_end(ftu); if (ft->type != NO_TYPE) { fdc->flags |= FDC_HASFTAPE; + ft_registerdev(fdcu, ftu); switch(hw.hw_make) { case 0x0000: - if (ft->type == FT_COLORADO) + if (ft->type == FT_COLORADO) { manu = "Colorado"; - else if (ft->type == FT_INSIGHT) + kdc_ft[ftu].kdc_description = "Colorado floppy tape"; + } else if (ft->type == FT_INSIGHT) { manu = "Insight"; - else if (ft->type == FT_MOUNTAIN && hw.hw_model == 0x05) + kdc_ft[ftu].kdc_description = "Insight floppy tape"; + } else if (ft->type == FT_MOUNTAIN && hw.hw_model == 0x05) { manu = "Archive"; - else if (ft->type == FT_MOUNTAIN) + kdc_ft[ftu].kdc_description = "Archive floppy tape"; + } else if (ft->type == FT_MOUNTAIN) { manu = "Mountain"; - else + kdc_ft[ftu].kdc_description = "Mountain floppy tape"; + } else { manu = "Unknown"; + } break; case 0x0001: manu = "Colorado"; + kdc_ft[ftu].kdc_description = "Colorado floppy tape"; break; case 0x0005: - if (hw.hw_model >= 0x09) + if (hw.hw_model >= 0x09) { manu = "Conner"; - else + kdc_ft[ftu].kdc_description = "Conner floppy tape"; + } else { manu = "Archive"; + kdc_ft[ftu].kdc_description = "Archive floppy tape"; + } break; case 0x0006: manu = "Mountain"; + kdc_ft[ftu].kdc_description = "Mountain floppy tape"; break; case 0x0007: manu = "Wangtek"; + kdc_ft[ftu].kdc_description = "Wangtek floppy tape"; break; case 0x0222: manu = "IOMega"; + kdc_ft[ftu].kdc_description = "IOMega floppy tape"; break; default: manu = "Unknown"; break; } printf("ft%d: %s tape\n", fdup->id_unit, manu); - ft_registerdev(fdcu, ftu); } ft->attaching = 0; return(ft->type); @@ -2078,6 +2091,7 @@ ftopen(dev_t dev, int arg2) { return(ENODEV); fdc->fdu = ftu; fdc->flags |= FDC_TAPE_BUSY; + kdc_ft[ftu].kdc_state = DC_BUSY; return(set_fdcmode(dev, FDC_TAPE_MODE)); /* try to switch to tape */ } @@ -2099,6 +2113,7 @@ ftclose(dev_t dev, int flags) tape_cmd(ftu, QC_PRIMARY); tape_state(ftu, 0, QS_READY, 60); ftreq_rewind(ftu); + kdc_ft[ftu].kdc_state = DC_IDLE; return(set_fdcmode(dev, FDC_DISK_MODE)); /* Otherwise, close tape */ } diff --git a/sys/i386/isa/if_cx.c b/sys/i386/isa/if_cx.c index 81bc7a3..113578b 100644 --- a/sys/i386/isa/if_cx.c +++ b/sys/i386/isa/if_cx.c @@ -128,7 +128,7 @@ static char cxdescription [80]; struct kern_devconf kdc_cx [NCX] = { { 0, 0, 0, "cx", 0, { MDDT_ISA, 0, "net" }, isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, &kdc_isa0, 0, - DC_IDLE, cxdescription, + DC_IDLE, cxdescription, DC_CLS_SERIAL } }; #endif diff --git a/sys/i386/isa/if_ed.c b/sys/i386/isa/if_ed.c index e4e71e2..ce1ba4f 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.67 1995/02/26 20:03:53 davidg Exp $ + * $Id: if_ed.c,v 1.68 1995/03/16 18:12:01 bde Exp $ */ #include "ed.h" @@ -180,8 +180,9 @@ static struct kern_devconf kdc_ed_template = { isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, &kdc_isa0, /* parent */ 0, /* parentdata */ - DC_UNCONFIGURED, - "" /* description */ + DC_UNCONFIGURED, /* state */ + "", /* description */ + DC_CLS_NETIF /* class */ }; static inline void @@ -211,7 +212,9 @@ ed_probe(isa_dev) { int nports; +#ifndef DEV_LKM ed_registerdev(isa_dev, "Ethernet adapter"); +#endif /* not DEV_LKM */ nports = ed_probe_WD80x3(isa_dev); if (nports) diff --git a/sys/i386/isa/if_eg.c b/sys/i386/isa/if_eg.c index bde3400..00b5038 100644 --- a/sys/i386/isa/if_eg.c +++ b/sys/i386/isa/if_eg.c @@ -27,7 +27,7 @@ * (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_eg.c,v 1.1 1995/04/08 09:39:34 phk Exp $ + * $Id: if_eg.c,v 1.2 1995/04/12 07:50:44 phk Exp $ */ /* To do: @@ -125,7 +125,8 @@ static struct kern_devconf kdc_eg_template = { &kdc_isa0, /* parent */ 0, /* parentdata */ DC_UNCONFIGURED, - "" /* description */ + "", /* description */ + DC_CLS_NETIF /* class */ }; static inline void @@ -306,7 +307,9 @@ egprobe(struct isa_device * id) struct eg_softc *sc = &eg_softc[id->id_unit]; int i; +#ifndef DEV_LKM eg_registerdev(id, "Ethernet adapter"); +#endif /* not DEV_LKM */ if (id->id_iobase & ~0x07f0 != 0) { dprintf(("eg#: Weird iobase %x\n", id->id_iobase)); @@ -390,6 +393,8 @@ egattach (struct isa_device *id) ether_sprintf(sc->sc_arpcom.ac_enaddr), sc->eg_rom_major, sc->eg_rom_minor, sc->eg_ram); + sc->kdc.kdc_description = "Ethernet adapter: 3Com 3C505"; + sc->eg_pcb[0] = EG_CMD_SETEADDR; /* Set station address */ if (egwritePCB(sc) != 0) { dprintf(("eg#: write error2\n")); diff --git a/sys/i386/isa/if_el.c b/sys/i386/isa/if_el.c index 6a60e6a..baaa3ba 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.10 1994/12/22 21:56:06 wollman Exp $ + * $Id: if_el.c,v 1.11 1995/03/28 07:55:29 bde Exp $ */ /* Except of course for the portions of code lifted from other FreeBSD * drivers (mainly elread, elget and el_ioctl) @@ -106,8 +106,9 @@ static struct kern_devconf kdc_el[NEL] = { { isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, &kdc_isa0, /* parent */ 0, /* parentdata */ - DC_BUSY, /* network interfaces are always busy */ - "3Com 3C501 Ethernet adapter" + DC_UNCONFIGURED, /* state */ + "Ethernet adapter: 3Com 3C501", + DC_CLS_NETIF /* class */ } }; static inline void @@ -133,6 +134,10 @@ int el_probe(struct isa_device *idev) sc->el_base = idev->id_iobase; base = sc->el_base; +#ifndef DEV_LKM + el_registerdev(idev); +#endif + /* First check the base */ if((base < 0x280) || (base > 0x3f0)) { printf("el%d: ioaddr must be between 0x280 and 0x3f0\n", @@ -212,7 +217,7 @@ int el_attach(struct isa_device *idev) /* Now we can attach the interface */ dprintf(("Attaching interface...\n")); if_attach(ifp); - el_registerdev(idev); + kdc_el[idev->id_unit].kdc_state = DC_BUSY; /* Put the station address in the ifa address list's AF_LINK * entry, if any. diff --git a/sys/i386/isa/if_ep.c b/sys/i386/isa/if_ep.c index 68db808..f4c6d95 100644 --- a/sys/i386/isa/if_ep.c +++ b/sys/i386/isa/if_ep.c @@ -38,7 +38,7 @@ */ /* - * $Id: if_ep.c,v 1.13 1995/04/10 07:54:34 root Exp root $ + * $Id: if_ep.c,v 1.25 1995/04/10 21:24:58 jkh Exp $ * * Promiscuous mode added and interrupt logic slightly changed * to reduce the number of adapter failures. Transceiver select @@ -132,13 +132,14 @@ struct isa_driver epdriver = { }; static struct kern_devconf kdc_ep[NEP] = { { - 0, 0, 0, /* filled in by dev_attach */ + 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" + &kdc_isa0, /* parent */ + 0, /* parentdata */ + DC_UNCONFIGURED, /* state */ + "3Com 3C509 Ethernet adapter", + DC_CLS_NETIF /* class */ } }; static inline void @@ -305,6 +306,8 @@ epprobe(is) u_short k; int i; + ep_registerdev(is); + if (!ep_look_for_board_at(is)) return (0); /* @@ -429,7 +432,7 @@ epattach(is) ifp->if_timer=1; if_attach(ifp); - ep_registerdev(is); + kdc_ep[is->id_unit].kdc_state = DC_BUSY; /* * Fill the hardware address into ifa_addr if we find an AF_LINK entry. diff --git a/sys/i386/isa/if_ie.c b/sys/i386/isa/if_ie.c index 095725f..5e85521 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.21 1995/03/19 14:28:45 davidg Exp $ + * $Id: if_ie.c,v 1.22 1995/03/28 07:55:31 bde Exp $ */ /* @@ -314,18 +314,18 @@ static struct kern_devconf kdc_ie[NIE] = { { isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, &kdc_isa0, /* parent */ 0, /* parentdata */ - DC_BUSY, /* network interfaces are always ``busy'' */ - "" + DC_UNCONFIGURED, /* state */ + "Ethernet adapter", /* description */ + DC_CLS_NETIF /* class */ } }; static inline void -ie_registerdev(struct isa_device *id, const char *descr) +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; - kdc_ie[id->id_unit].kdc_description = descr; dev_attach(&kdc_ie[id->id_unit]); } @@ -335,6 +335,8 @@ int ieprobe(dvp) { int ret; + ie_registerdev(dvp); + ret = sl_probe(dvp); if(!ret) ret = el_probe(dvp); if(!ret) ret = ni_probe(dvp); @@ -591,7 +593,7 @@ ieattach(dvp) #endif if_attach(ifp); - ie_registerdev(dvp, ie_hardware_names[ie_softc[unit].hard_type]); + kdc_ie[unit].kdc_description = ie_hardware_names[ie_softc[unit].hard_type]; { struct ifaddr *ifa = ifp->if_addrlist; diff --git a/sys/i386/isa/if_le.c b/sys/i386/isa/if_le.c index 3a8f4ce..06479b4 100644 --- a/sys/i386/isa/if_le.c +++ b/sys/i386/isa/if_le.c @@ -21,50 +21,7 @@ * (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.12 1994/12/22 21:56:11 wollman Exp $ - * - * $Log: if_le.c,v $ - * Revision 1.12 1994/12/22 21:56:11 wollman - * Move ARP interface initialization into if_ether.c:arp_ifinit(). - * - * Revision 1.10 1994/11/24 14:29:24 davidg - * Moved conversion of ether_type to host byte order out of ethernet drivers - * and into ether_input(). It was silly to have bpf want this one way and - * ether_input want it another way. Ripped out trailer support from the few - * remaining drivers that still had it. - * - * Revision 1.9 1994/10/23 21:27:22 wollman - * 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). - * - * 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. - * - * Revision 1.9 1994/08/16 20:40:56 thomas - * New README files (one per driver) - * Minor updates to drivers (DEPCA support and add pass to attach - * output) - * - * Revision 1.8 1994/08/05 20:20:54 thomas - * Enable change log - * - * Revision 1.7 1994/08/05 20:20:14 thomas - * *** empty log message *** - * + * $Id: if_le.c,v 1.13 1995/03/28 07:55:32 bde Exp $ */ /* @@ -369,8 +326,9 @@ static struct kern_devconf kdc_le[NLE] = { { 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" + DC_UNCONFIGURED, /* state */ + "Ethernet adapter: DEC EtherWorks II or EtherWorks III", + DC_CLS_NETIF /* class */ } }; static inline void @@ -397,6 +355,8 @@ le_probe( return 0; } + le_registerdev(dvp); + sc->le_iobase = dvp->id_iobase; sc->le_membase = (u_char *) dvp->id_maddr; sc->le_irq = dvp->id_irq; @@ -434,10 +394,7 @@ le_attach( ether_sprintf(sc->le_ac.ac_enaddr)); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS; -#ifdef MULTICAST ifp->if_flags |= IFF_MULTICAST; -#endif /* MULTICAST */ - ifp->if_output = ether_output; ifp->if_ioctl = le_ioctl; ifp->if_type = IFT_ETHER; @@ -449,7 +406,7 @@ le_attach( #endif if_attach(ifp); - le_registerdev(dvp); + kdc_le[dvp->id_unit].kdc_state = DC_IDLE; while (ifa && ifa->ifa_addr && ifa->ifa_addr->sa_family != AF_LINK) ifa = ifa->ifa_next; @@ -649,7 +606,6 @@ le_ioctl( break; } -#ifdef MULTICAST case SIOCADDMULTI: case SIOCDELMULTI: { /* @@ -668,14 +624,14 @@ le_ioctl( break; } -#endif /* MULTICAST */ - default: { error = EINVAL; } } splx(s); + kdc_le[ifp->if_unit].kdc_state = (ifp->if_flags & IFF_UP) + ? DC_BUSY : DC_IDLE; return error; } @@ -745,10 +701,8 @@ static void le_multi_filter( le_softc_t *sc) { -#ifdef MULTICAST struct ether_multistep step; struct ether_multi *enm; -#endif #ifdef ISO extern char all_es_snpa[]; #endif @@ -768,7 +722,6 @@ le_multi_filter( le_multi_op(sc, all_es_snpa, TRUE); #endif -#ifdef MULTICAST ETHER_FIRST_MULTI(step, &sc->le_ac, enm); if (enm != NULL) sc->le_flags |= IFF_MULTICAST; @@ -782,7 +735,6 @@ le_multi_filter( sc->le_flags &= ~LE_BRDCSTONLY; } sc->le_flags &= ~IFF_ALLMULTI; -#endif } static void diff --git a/sys/i386/isa/if_lnc.c b/sys/i386/isa/if_lnc.c index 305b7fc..e1105eb 100644 --- a/sys/i386/isa/if_lnc.c +++ b/sys/i386/isa/if_lnc.c @@ -150,7 +150,8 @@ static struct kern_devconf kdc_lnc = { &kdc_isa0, /* parent */ 0, /* parentdata */ DC_UNCONFIGURED, - "" + "", + DC_CLS_NETIF }; inline void diff --git a/sys/i386/isa/isa.c b/sys/i386/isa/isa.c index 43b1655..2422893 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.43 1995/04/04 22:48:40 ache Exp $ + * $Id: isa.c,v 1.44 1995/04/06 13:55:56 ache Exp $ */ /* @@ -108,14 +108,17 @@ u_int intr_mask[ICU_LEN]; u_int* intr_mptr[ICU_LEN]; int intr_unit[ICU_LEN]; +extern struct kern_devconf kdc_cpu0; + 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 */ + &kdc_cpu0, /* parent is the CPU */ 0, /* no parentdata */ DC_BUSY, /* busses are always busy */ - "ISA or EISA bus" + "ISA or EISA bus", + DC_CLS_BUS /* class */ }; static inthand_t *fastintr[ICU_LEN] = { diff --git a/sys/i386/isa/lpt.c b/sys/i386/isa/lpt.c index c0b7302..df3dc4e 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.26 1995/02/26 21:41:41 phk Exp $ + * $Id: lpt.c,v 1.27 1995/03/16 18:12:03 bde Exp $ */ /* @@ -262,8 +262,9 @@ static struct kern_devconf kdc_lpt[NLPT] = { { isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, &kdc_isa0, /* parent */ 0, /* parentdata */ - DC_UNKNOWN, /* not supported */ - "Parallel printer adapter" + DC_UNCONFIGURED, /* state */ + "Parallel printer adapter", + DC_CLS_PARALLEL | DC_CLS_NETIF /* class */ } }; static inline void @@ -353,6 +354,8 @@ lptprobe(struct isa_device *dvp) u_char mask; int i; + lpt_registerdev(dvp); + /* * Make sure there is some way for lptopen to see that * the port is not configured @@ -429,8 +432,7 @@ lptattach(struct isa_device *isdp) } lprintf("irq %x\n", sc->sc_irq); - lpt_registerdev(isdp); - + kdc_lpt[isdp->id_unit].kdc_state = DC_IDLE; return (1); } @@ -524,6 +526,7 @@ lptopen(dev_t dev, int flag) outb(port+lpt_control, sc->sc_control); sc->sc_state = OPEN; + kdc_lpt[unit].kdc_state = DC_BUSY; sc->sc_inbuf = geteblk(BUFSIZE); sc->sc_xfercnt = 0; splx(s); @@ -579,6 +582,7 @@ lptclose(dev_t dev, int flag) goto end_close; sc->sc_state &= ~OPEN; + kdc_lpt[minor(dev)].kdc_state = DC_IDLE; /* if the last write was interrupted, don't complete it */ if((!(sc->sc_state & INTERRUPTED)) && (sc->sc_irq & LP_USE_IRQ)) diff --git a/sys/i386/isa/mcd.c b/sys/i386/isa/mcd.c index 338fabf..1b96801 100644 --- a/sys/i386/isa/mcd.c +++ b/sys/i386/isa/mcd.c @@ -40,7 +40,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.39 1995/02/23 17:40:16 ache Exp $ + * $Id: mcd.c,v 1.40 1995/03/28 07:55:42 bde Exp $ */ static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore"; @@ -223,8 +223,9 @@ static struct kern_devconf kdc_mcd[NMCD] = { { isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, &kdc_isa0, /* parent */ 0, /* parentdata */ - DC_IDLE, /* status */ - "Mitsumi CD-ROM controller" /* properly filled later */ + DC_UNCONFIGURED, /* status */ + "Mitsumi CD-ROM controller", /* properly filled later */ + DC_CLS_RDISK } }; static inline void @@ -250,7 +251,7 @@ int mcd_attach(struct isa_device *dev) /* wire controller for interrupts and dma */ mcd_configure(cd); #endif - mcd_registerdev(dev); + kdc_mcd[dev->id_unit].kdc_state = DC_IDLE; /* name filled in probe */ kdc_mcd[dev->id_unit].kdc_description = mcd_data[dev->id_unit].name; @@ -702,6 +703,7 @@ mcd_probe(struct isa_device *dev) int status; unsigned char stbytes[3]; + mcd_registerdev(dev); mcd_data[unit].flags = MCDPROBING; #ifdef NOTDEF diff --git a/sys/i386/isa/mse.c b/sys/i386/isa/mse.c index de7b26d..a2c5ef3 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.9 1994/11/08 05:41:34 jkh Exp $ + * $Id: mse.c,v 1.10 1995/03/28 07:55:44 bde Exp $ */ /* * Driver for the Logitech and ATI Inport Bus mice for use with 386bsd and @@ -181,6 +181,27 @@ struct mse_types { { 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_UNCONFIGURED, /* state */ + "ATI or Logitech bus mouse adapter", + DC_CLS_MISC /* class */ +} }; + +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 mseprobe(idp) register struct isa_device *idp; @@ -188,6 +209,7 @@ mseprobe(idp) register struct mse_softc *sc = &mse_sc[idp->id_unit]; register int i; + mse_registerdev(idp); /* * Check for each mouse type in the table. */ @@ -205,26 +227,6 @@ 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; @@ -232,7 +234,7 @@ mseattach(idp) struct mse_softc *sc = &mse_sc[idp->id_unit]; sc->sc_port = idp->id_iobase; - mse_registerdev(idp); + kdc_mse[idp->id_unit].kdc_state = DC_IDLE; return (1); } @@ -253,6 +255,7 @@ mseopen(dev, flag) if (sc->sc_flags & MSESC_OPEN) return (EBUSY); sc->sc_flags |= MSESC_OPEN; + kdc_mse[MSE_UNIT(dev)].kdc_state = DC_BUSY; sc->sc_obuttons = sc->sc_buttons = 0x7; sc->sc_deltax = sc->sc_deltay = 0; sc->sc_bytesread = PROTOBYTES; @@ -280,6 +283,7 @@ mseclose(dev, flag) s = spltty(); (*sc->sc_disablemouse)(sc->sc_port); sc->sc_flags &= ~MSESC_OPEN; + kdc_mse[MSE_UNIT(dev)].kdc_state = DC_IDLE; splx(s); return(0); } diff --git a/sys/i386/isa/ncr5380.c b/sys/i386/isa/ncr5380.c index 8cb2392..631b2ec 100644 --- a/sys/i386/isa/ncr5380.c +++ b/sys/i386/isa/ncr5380.c @@ -246,6 +246,14 @@ static struct scsi_adapter nca_switch = { static struct scsi_device nca_dev = { NULL, NULL, NULL, NULL, "nca", 0, {0} }; struct isa_driver ncadriver = { nca_probe, nca_attach, "nca" }; +static char nca_description [80]; +static struct kern_devconf nca_kdc[NNCA] = {{ + 0, 0, 0, "nca", 0, { MDDT_ISA, 0, "bio" }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, &kdc_isa0, 0, + DC_UNCONFIGURED, nca_description, + DC_CLS_MISC /* host adapters aren't special */ +}}; + /* * Check if the device can be found at the port given and if so, * detect the type of board. Set it up ready for further work. @@ -257,6 +265,12 @@ int nca_probe (struct isa_device *dev) adapter_t *z = &ncadata[dev->id_unit]; int i; + if (dev->id_unit) + nca_kdc[dev->id_unit] = nca_kdc[0]; + nca_kdc[dev->id_unit].kdc_unit = dev->id_unit; + nca_kdc[dev->id_unit].kdc_isa = dev; + dev_attach (&nca_kdc[dev->id_unit]); + /* Init fields used by our routines */ z->parity = (dev->id_flags & FLAG_NOPARITY) ? 0 : MR_ENABLE_PARITY_CHECKING; @@ -474,13 +488,6 @@ int nca_init (adapter_t *z) return (0); } -static char nca_description [80]; -static struct kern_devconf nca_kdc[NNCA] = {{ - 0, 0, 0, "nca", 0, { MDDT_ISA, 0, "bio" }, - isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, &kdc_isa0, 0, - DC_BUSY, nca_description, -}}; - /* * Attach all sub-devices we can find. */ @@ -500,13 +507,9 @@ int nca_attach (struct isa_device *dev) z->sc_link.device = &nca_dev; /* ask the adapter what subunits are present */ + nca_kdc[unit].kdc_state = DC_BUSY; scsi_attachdevs (&(z->sc_link)); - if (dev->id_unit) - nca_kdc[dev->id_unit] = nca_kdc[0]; - nca_kdc[dev->id_unit].kdc_unit = dev->id_unit; - nca_kdc[dev->id_unit].kdc_isa = dev; - dev_attach (&nca_kdc[dev->id_unit]); return (1); } diff --git a/sys/i386/isa/npx.c b/sys/i386/isa/npx.c index 47e43d5..aacff0d 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.20 1995/02/23 17:32:38 bde Exp $ + * $Id: npx.c,v 1.21 1995/03/05 04:06:44 wpaul Exp $ */ #include "npx.h" @@ -148,6 +148,30 @@ _probetrap: iret "); +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_UNCONFIGURED, /* state */ + "Floating-point unit", + DC_CLS_MISC /* class */ +} }; + +static inline void +npx_registerdev(struct isa_device *id) +{ + int unit; + + unit = id->id_unit; + if (unit != 0) + kdc_npx[unit] = kdc_npx[0]; + kdc_npx[unit].kdc_unit = unit; + kdc_npx[unit].kdc_isa = id; + dev_attach(&kdc_npx[unit]); +} + /* * Probe routine. Initialize cr0 to give correct behaviour for [f]wait * whether the device exists or not (XXX should be elsewhere). Set flags @@ -171,6 +195,7 @@ npxprobe(dvp) * install suitable handlers and run with interrupts enabled so we * won't need to do so much here. */ + npx_registerdev(dvp); npx_intrno = NRSVIDT + ffs(dvp->id_irq) - 1; save_eflags = read_eflags(); disable_intr(); @@ -308,29 +333,6 @@ 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_BUSY, - "Floating-point unit" -} }; - -static inline void -npx_registerdev(struct isa_device *id) -{ - int unit; - - unit = id->id_unit; - if (unit != 0) - kdc_npx[unit] = kdc_npx[0]; - kdc_npx[unit].kdc_unit = unit; - kdc_npx[unit].kdc_isa = id; - dev_attach(&kdc_npx[unit]); -} - /* * Attach routine - announce which it is, and wire into system */ @@ -354,8 +356,9 @@ npxattach(dvp) printf("npx%d: no 387 emulator in kernel!\n", dvp->id_unit); #endif npxinit(__INITIAL_NPXCW__); - if (npx_exists) - npx_registerdev(dvp); + if (npx_exists) { + kdc_npx[dvp->id_unit].kdc_state = DC_BUSY; + } return (1); /* XXX unused */ } diff --git a/sys/i386/isa/scd.c b/sys/i386/isa/scd.c index 0959c8e..0f1973f 100644 --- a/sys/i386/isa/scd.c +++ b/sys/i386/isa/scd.c @@ -41,7 +41,7 @@ */ -/* $Id: scd.c,v 1.1 1995/03/24 18:33:00 jkh Exp $ */ +/* $Id: scd.c,v 1.2 1995/03/25 18:14:37 bde Exp $ */ /* Please send any comments to micke@dynas.se */ @@ -194,8 +194,9 @@ static struct kern_devconf kdc_scd[NSCD] = { { isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, &kdc_isa0, /* parent */ 0, /* parentdata */ - DC_IDLE, /* status */ - "Sony CD-ROM drive" /* properly filled later */ + DC_UNCONFIGURED, /* status */ + "Sony CD-ROM drive", /* properly filled later */ + DC_CLS_RDISK /* class */ } }; static inline void @@ -215,7 +216,7 @@ int scd_attach(struct isa_device *dev) cd->iobase = dev->id_iobase; /* Already set by probe, but ... */ - scd_registerdev(dev); + kdc_scd[dev->id_unit].kdc_state = DC_IDLE; /* name filled in probe */ kdc_scd[dev->id_unit].kdc_description = scd_data[dev->id_unit].name; printf("scd%d: <%s>\n", dev->id_unit, scd_data[dev->id_unit].name); @@ -709,6 +710,8 @@ scd_probe(struct isa_device *dev) bzero(&drive_config, sizeof(drive_config)); + scd_registerdev(dev); + again: /* Reset drive */ write_control(dev->id_iobase, CBIT_RESET_DRIVE); diff --git a/sys/i386/isa/seagate.c b/sys/i386/isa/seagate.c index 16f5c04..cfd113b 100644 --- a/sys/i386/isa/seagate.c +++ b/sys/i386/isa/seagate.c @@ -46,7 +46,7 @@ * delays, device flags, polling mode, generic cleanup * vak 950115 Added request-sense ops * - * $Id: seagate.c,v 1.5 1995/01/10 11:41:28 jkh Exp $ + * $Id: seagate.c,v 1.6 1995/03/28 07:55:50 bde Exp $ */ /* @@ -340,6 +340,14 @@ static struct scsi_adapter sea_switch = { static struct scsi_device sea_dev = { NULL, NULL, NULL, NULL, "sea", 0, {0} }; struct isa_driver seadriver = { sea_probe, sea_attach, "sea" }; +static char sea_description [80]; /* XXX BOGUS!!! */ +static struct kern_devconf sea_kdc[NSEA] = {{ + 0, 0, 0, "sea", 0, { MDDT_ISA, 0, "bio" }, + isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, &kdc_isa0, 0, + DC_UNCONFIGURED, sea_description, + DC_CLS_MISC /* host adapters aren't special */ +} }; + /* * Check if the device can be found at the port given and if so, * detect the type of board. Set it up ready for further work. @@ -354,6 +362,12 @@ int sea_probe (struct isa_device *dev) }; int i; + if (dev->id_unit) + sea_kdc[dev->id_unit] = sea_kdc[0]; + sea_kdc[dev->id_unit].kdc_unit = dev->id_unit; + sea_kdc[dev->id_unit].kdc_isa = dev; + dev_attach (&sea_kdc[dev->id_unit]); + /* Init fields used by our routines */ z->parity = (dev->id_flags & FLAG_NOPARITY) ? 0 : CMD_EN_PARITY; z->scsi_addr = HOST_SCSI_ADDR; @@ -498,13 +512,6 @@ int sea_init (adapter_t *z) return (0); } -static char sea_description [80]; -static struct kern_devconf sea_kdc[NSEA] = {{ - 0, 0, 0, "sea", 0, { MDDT_ISA, 0, "bio" }, - isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, &kdc_isa0, 0, - DC_BUSY, sea_description, -}}; - /* * Attach all sub-devices we can find. */ @@ -513,6 +520,7 @@ int sea_attach (struct isa_device *dev) int unit = dev->id_unit; adapter_t *z = &seadata[unit]; + sea_kdc[unit].kdc_state = DC_BUSY; /* host adapters are always busy */ sprintf (sea_description, "%s SCSI controller", z->name); printf ("\nsea%d: type %s%s\n", unit, z->name, (dev->id_flags & FLAG_NOPARITY) ? ", no parity" : ""); @@ -522,15 +530,10 @@ int sea_attach (struct isa_device *dev) z->sc_link.adapter_targ = z->scsi_addr; z->sc_link.adapter = &sea_switch; z->sc_link.device = &sea_dev; - + /* ask the adapter what subunits are present */ scsi_attachdevs (&(z->sc_link)); - if (dev->id_unit) - sea_kdc[dev->id_unit] = sea_kdc[0]; - sea_kdc[dev->id_unit].kdc_unit = dev->id_unit; - sea_kdc[dev->id_unit].kdc_isa = dev; - dev_attach (&sea_kdc[dev->id_unit]); return (1); } diff --git a/sys/i386/isa/sio.c b/sys/i386/isa/sio.c index f03bdbd..d7d787b 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.88 1995/04/04 16:26:04 ache Exp $ + * $Id: sio.c,v 1.89 1995/04/11 17:58:09 ache Exp $ */ #include "sio.h" @@ -347,6 +347,31 @@ static struct speedtab comspeedtab[] = { /* XXX - configure this list */ static Port_t likely_com_ports[] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, }; +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_UNCONFIGURED, + "RS-232 serial port" +} }; + +static void +sioregisterdev(id) + struct isa_device *id; +{ + int unit; + + unit = id->id_unit; + if (unit != 0) + kdc_sio[unit] = kdc_sio[0]; + kdc_sio[unit].kdc_unit = unit; + kdc_sio[unit].kdc_isa = id; + kdc_sio[unit].kdc_state = DC_IDLE; + dev_attach(&kdc_sio[unit]); +} + static int sioprobe(dev) struct isa_device *dev; @@ -360,6 +385,8 @@ sioprobe(dev) u_char mcr_image; int result; + sioregisterdev(dev); + if (!already_init) { /* * Turn off MCR_IENABLE for all likely serial ports. An unused @@ -535,31 +562,6 @@ 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_UNCONFIGURED, - "RS-232 serial port" -} }; - -static void -sioregisterdev(id) - struct isa_device *id; -{ - int unit; - - unit = id->id_unit; - if (unit != 0) - kdc_sio[unit] = kdc_sio[0]; - kdc_sio[unit].kdc_unit = unit; - kdc_sio[unit].kdc_isa = id; - kdc_sio[unit].kdc_state = DC_IDLE; - dev_attach(&kdc_sio[unit]); -} - static int sioattach(isdp) @@ -634,6 +636,8 @@ sioattach(isdp) #ifdef DSI_SOFT_MODEM if((inb(iobase+7) ^ inb(iobase+7)) & 0x80) { printf(" Digicom Systems, Inc. SoftModem"); + kdc_sio[isdp->id_unit].kdc_description = + "Serial port: Digicom Systems SoftModem"; goto determined_type; } #endif /* DSI_SOFT_MODEM */ @@ -654,6 +658,8 @@ sioattach(isdp) outb(iobase + com_scr, scr); if (scr1 != 0xa5 || scr2 != 0x5a) { printf(" 8250"); + kdc_sio[isdp->id_unit].kdc_description = + "Serial port: National 8250 or compatible"; goto determined_type; } } @@ -662,21 +668,31 @@ sioattach(isdp) switch (inb(com->int_id_port) & IIR_FIFO_MASK) { case FIFO_TRIGGER_1: printf(" 16450"); + kdc_sio[isdp->id_unit].kdc_description = + "Serial port: National 16450 or compatible"; break; case FIFO_TRIGGER_4: printf(" 16450?"); + kdc_sio[isdp->id_unit].kdc_description = + "Serial port: maybe National 16450"; break; case FIFO_TRIGGER_8: printf(" 16550?"); + kdc_sio[isdp->id_unit].kdc_description = + "Serial port: maybe National 16550"; break; case FIFO_TRIGGER_14: printf(" 16550A"); - if (COM_NOFIFO(isdp)) + if (COM_NOFIFO(isdp)) { printf(" fifo disabled"); - else { + kdc_sio[isdp->id_unit].kdc_description = + "Serial port: National 16550A, FIFO disabled"; + } else { com->hasfifo = TRUE; com->ftl_init = FIFO_TRIGGER_14; com->tx_fifo_size = 16; + kdc_sio[isdp->id_unit].kdc_description = + "Serial port: National 16550A or compatible"; } break; } @@ -696,7 +712,8 @@ determined_type: ; #endif /* COM_MULTIPORT */ printf("\n"); - sioregisterdev(isdp); + kdc_sio[unit].kdc_state = + (unit == comconsole) ? DC_BUSY : DC_IDLE; #ifdef KGDB if (kgdb_dev == makedev(commajor, unit)) { @@ -718,6 +735,7 @@ determined_type: ; outb(iobase + com_cfcr, CFCR_8BITS); outb(com->modem_status_port, com->mcr_image |= MCR_DTR | MCR_RTS); + kdc_sio[unit].kdc_state = DC_BUSY; if (kgdb_debug_init) { /* @@ -891,6 +909,7 @@ open_top: disc_optim(tp, &(tp->t_termios), com); if (tp->t_state & TS_ISOPEN && mynor & CALLOUT_MASK) com->active_out = TRUE; + kdc_sio[unit].kdc_state = DC_BUSY; out: splx(s); if (!(tp->t_state & TS_ISOPEN) && com->wopeners == 0) @@ -910,11 +929,13 @@ sioclose(dev, flag, mode, p) int mynor; int s; struct tty *tp; + int unit; mynor = minor(dev); if (mynor & CONTROL_MASK) return (0); - com = com_addr(MINOR_TO_UNIT(mynor)); + unit = MINOR_TO_UNIT(mynor); + com = com_addr(unit); tp = com->tp; s = spltty(); (*linesw[tp->t_line].l_close)(tp, flag); @@ -922,6 +943,7 @@ sioclose(dev, flag, mode, p) siostop(tp, FREAD | FWRITE); comhardclose(com); ttyclose(tp); + kdc_sio[unit].kdc_state = DC_IDLE; splx(s); return (0); } diff --git a/sys/i386/isa/spigot.c b/sys/i386/isa/spigot.c index 7ef54ad..aef738d 100644 --- a/sys/i386/isa/spigot.c +++ b/sys/i386/isa/spigot.c @@ -82,7 +82,7 @@ int spigot_attach(struct isa_device *id); struct isa_driver spigotdriver = {spigot_probe, spigot_attach, "spigot"}; -static struct kern_devconf kdc_spigot[NSPIGOT] = { +static struct kern_devconf kdc_spigot[NSPIGOT] = { { 0, /* kdc_next -> filled in by dev_attach() */ 0, /* kdc_rlink -> filled in by dev_attach() */ 0, /* kdc_number -> filled in by dev_attach() */ @@ -99,9 +99,10 @@ static struct kern_devconf kdc_spigot[NSPIGOT] = { ISA_EXTERNALLEN, /* kdc_datalen */ &kdc_isa0, /* kdc_parent */ 0, /* kdc_parentdata */ - DC_UNKNOWN, /* kdc_state - not supported */ - "Video Spigot frame grabber" /* kdc_description */ -}; + DC_UNCONFIGURED, /* kdc_state - not supported */ + "Video Spigot frame grabber", /* kdc_description */ + DC_CLS_MISC /* class */ +} }; static inline void spigot_registerdev(struct isa_device *id) @@ -118,7 +119,9 @@ spigot_probe(struct isa_device *devp) { int status; - if(inb(0xad9) == 0xff) /* ff if board isn't there??? */ + spigot_registerdev(devp); + + if(devp->id_iobase != 0xad6 || inb(0xad9) == 0xff) /* ff if board isn't there??? */ status = 0; else status = 1; @@ -129,13 +132,12 @@ int status; int spigot_attach(struct isa_device *devp) { -struct spigot_softc *ss=(struct spigot_softc *)&spigot_softc[devp->id_unit]; + struct spigot_softc *ss=(struct spigot_softc *)&spigot_softc[devp->id_unit]; + kdc_spigot[devp->id_unit].kdc_state = DC_UNKNOWN; ss->flags = 0; ss->maddr = devp->id_maddr; - spigot_registerdev(devp); - return 1; } diff --git a/sys/i386/isa/syscons.c b/sys/i386/isa/syscons.c index 41fa3eb..020fa13 100644 --- a/sys/i386/isa/syscons.c +++ b/sys/i386/isa/syscons.c @@ -25,7 +25,7 @@ * (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: syscons.c,v 1.107 1995/03/03 08:37:07 sos Exp $ + * $Id: syscons.c,v 1.111 1995/04/04 20:06:26 sos Exp $ */ #include "sc.h" @@ -203,7 +203,8 @@ static struct kern_devconf kdc_sc[NSC] = { &kdc_isa0, /* parent */ 0, /* parentdata */ DC_BUSY, /* the console is almost always busy */ - "Graphics console" + "Graphics console", + DC_CLS_DISPLAY /* class */ }; static inline void diff --git a/sys/i386/isa/ultra14f.c b/sys/i386/isa/ultra14f.c index 9eb6ac1..7e6bd8f 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.28 1995/03/16 18:12:06 bde Exp $ + * $Id: ultra14f.c,v 1.29 1995/03/23 09:00:20 rgrimes Exp $ */ #include <sys/types.h> @@ -326,8 +326,9 @@ static struct kern_devconf kdc_uha[NUHA] = { { 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" + DC_UNCONFIGURED, /* state */ + "UltraStore 14F or 34F SCSI host adapter", + DC_CLS_MISC /* host adapters aren't special */ } }; static inline void @@ -467,7 +468,7 @@ uhaprobe(dev) struct uha_reg *ur; struct uha_bits *ub; - dev->id_unit = unit; + dev->id_unit = unit; /* XXX */ /* * find unit and check we have that many defined @@ -506,6 +507,8 @@ uhaprobe(dev) } bzero(ub, sizeof(struct uha_bits)); + uha_registerdev(dev); + uhareg[unit] = ur; uhabits[unit] = ub; uhadata[unit] = uha; @@ -549,7 +552,7 @@ uha_attach(dev) uha->sc_link.device = &uha_dev; uha->sc_link.flags = SDEV_BOUNCE; - uha_registerdev(dev); + kdc_uha[unit].kdc_state = DC_BUSY; /* * ask the adapter what subunits are present */ diff --git a/sys/i386/isa/wd.c b/sys/i386/isa/wd.c index 34b9d86..da54118 100644 --- a/sys/i386/isa/wd.c +++ b/sys/i386/isa/wd.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)wd.c 7.2 (Berkeley) 5/9/91 - * $Id: wd.c,v 1.70 1995/03/22 05:22:59 davidg Exp $ + * $Id: wd.c,v 1.71 1995/04/09 06:09:31 davidg Exp $ */ /* TODO: @@ -121,8 +121,9 @@ static struct kern_devconf kdc_wd[NWD] = { { wd_externalize, 0, wd_goaway, DISK_EXTERNALLEN, 0, /* parent */ 0, /* parentdata */ - DC_UNKNOWN, /* don't support state yet */ - "ST506/ESDI/IDE disk" + DC_UNKNOWN, /* state */ + "ST506/ESDI/IDE disk", /* description */ + DC_CLS_DISK /* class */ } }; static struct kern_devconf kdc_wdc[NWDC] = { { @@ -131,8 +132,9 @@ static struct kern_devconf kdc_wdc[NWDC] = { { isa_generic_externalize, 0, wdc_goaway, ISA_EXTERNALLEN, &kdc_isa0, /* parent */ 0, /* parentdata */ - DC_UNKNOWN, /* state */ - "ST506/ESDI/IDE disk controller" + DC_UNCONFIGURED, /* state */ + "ST506/ESDI/IDE disk controller", + DC_CLS_MISC /* just an ordinary device */ } }; static inline void @@ -296,6 +298,8 @@ wdprobe(struct isa_device *dvp) du->dk_ctrlr = dvp->id_unit; du->dk_port = dvp->id_iobase; + wdc_registerdev(dvp); + /* check if we have registers that work */ outb(du->dk_port + wd_cyl_lo, 0xa5); /* wd_cyl_lo is read/write */ if (inb(du->dk_port + wd_cyl_lo) == 0xff) @@ -367,7 +371,7 @@ wdattach(struct isa_device *dvp) if (dvp->id_unit >= NWDC) return (0); - wdc_registerdev(dvp); + kdc_wdc[dvp->id_unit].kdc_state = DC_UNKNOWN; /* XXX */ for (wdup = isa_biotab_wdc; wdup->id_driver != 0; wdup++) { if (wdup->id_iobase != dvp->id_iobase) diff --git a/sys/i386/isa/wd7000.c b/sys/i386/isa/wd7000.c index 60ace17..c112539 100644 --- a/sys/i386/isa/wd7000.c +++ b/sys/i386/isa/wd7000.c @@ -76,8 +76,9 @@ static struct kern_devconf kdc_wds[NWDS] = { { isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, &kdc_isa0, 0, - DC_BUSY, - "Western Digital WD-7000 SCSI host adapter" + DC_UNCONFIGURED, /* state */ + "Western Digital WD-7000 SCSI host adapter", + DC_CLS_MISC /* class */ } }; struct scsi_device wds_dev = @@ -258,9 +259,15 @@ wdsprobe(struct isa_device *dev) if(wdsunit > NWDS) return 0; - dev->id_unit = wdsunit; + dev->id_unit = wdsunit; /* XXX WRONG! */ wds[wdsunit].addr = dev->id_iobase; + if(dev->id_unit) + kdc_wds[dev->id_unit] = kdc_wds[0]; + kdc_wds[dev->id_unit].kdc_unit = dev->id_unit; + kdc_wds[dev->id_unit].kdc_parentdata = dev; + dev_attach(&kdc_wds[dev->id_unit]); + if(wds_init(dev) != 0) return 0; wdsunit++; @@ -621,18 +628,14 @@ wdsattach(struct isa_device *dev) printf("wds%d: using %d bytes for dma buffer\n",unit,BUFSIZ); - if(dev->id_unit) - kdc_wds[dev->id_unit] = kdc_wds[0]; - kdc_wds[dev->id_unit].kdc_unit = dev->id_unit; - kdc_wds[dev->id_unit].kdc_parentdata = dev; - dev_attach(&kdc_wds[dev->id_unit]); - wds[unit].sc_link.adapter_unit = unit; wds[unit].sc_link.adapter_targ = 7; wds[unit].sc_link.adapter = &wds_switch; wds[unit].sc_link.device = &wds_dev; wds[unit].sc_link.flags = SDEV_BOUNCE; + kdc_wds[unit].kdc_state = DC_BUSY; + scsi_attachdevs(&wds[unit].sc_link); return 1; diff --git a/sys/i386/isa/wt.c b/sys/i386/isa/wt.c index cee9dbc..3b9718b 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.14 1995/01/09 17:55:10 joerg Exp $ + * $Id: wt.c,v 1.15 1995/03/28 07:55:56 bde Exp $ * */ @@ -170,6 +170,28 @@ static int wtreadfm (wtinfo_t *t); static int wtwritefm (wtinfo_t *t); static int wtpoll (wtinfo_t *t, int mask, int bits); +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_UNCONFIGURED, /* state */ + "Archive or Wangtek QIC-02/QIC-36 tape controller", + DC_CLS_TAPE /* class */ +} }; + +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]); +} + + /* * Probe for the presence of the device. */ @@ -177,6 +199,8 @@ int wtprobe (struct isa_device *id) { wtinfo_t *t = wttab + id->id_unit; + wt_registerdev(id); + t->unit = id->id_unit; t->chan = id->id_drq; t->port = id->id_iobase; @@ -214,27 +238,6 @@ 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. */ @@ -249,7 +252,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); + kdc_wt[id->id_unit].kdc_state = DC_IDLE; return (1); } @@ -336,6 +339,8 @@ int wtopen (int dev, int flag) return (EAGAIN); t->flags = TPINUSE; + kdc_wt[u].kdc_state = DC_BUSY; + if (flag & FREAD) t->flags |= TPREAD; if (flag & FWRITE) @@ -383,6 +388,7 @@ int wtclose (int dev) wtreadfm (t); done: t->flags &= TPREW | TPRMARK | TPSTART | TPTIMER; + kdc_wt[u].kdc_state = DC_IDLE; free (t->buf, M_TEMP); return (0); } diff --git a/sys/isa/fd.c b/sys/isa/fd.c index 9a6816f..e755f56 100644 --- a/sys/isa/fd.c +++ b/sys/isa/fd.c @@ -43,7 +43,7 @@ * SUCH DAMAGE. * * from: @(#)fd.c 7.4 (Berkeley) 5/25/91 - * $Id: fd.c,v 1.55 1995/03/26 19:28:18 rgrimes Exp $ + * $Id: fd.c,v 1.56 1995/04/06 07:20:15 rgrimes Exp $ * */ @@ -101,7 +101,8 @@ static struct kern_devconf kdc_fd[NFD] = { { 0, /* parent */ 0, /* parentdata */ DC_UNCONFIGURED, /* state */ - "floppy disk" + "floppy disk", + DC_CLS_DISK /* class */ } }; struct kern_devconf kdc_fdc[NFDC] = { { @@ -111,7 +112,8 @@ struct kern_devconf kdc_fdc[NFDC] = { { 0, /* parent */ 0, /* parentdata */ DC_UNCONFIGURED, /* state */ - "floppy disk/tape controller" + "floppy disk/tape controller", + DC_CLS_MISC /* class */ } }; static inline void @@ -522,6 +524,10 @@ fdprobe(struct isa_device *dev) fdcdevs[fdcu] = dev; fdc_data[fdcu].baseport = dev->id_iobase; +#ifndef DEV_LKM + fdc_registerdev(dev); +#endif + /* First - lets reset the floppy controller */ outb(dev->id_iobase+FDOUT, 0); DELAY(100); @@ -553,8 +559,6 @@ fdattach(struct isa_device *dev) struct isa_device *fdup; int ic_type = 0; - fdc_registerdev(dev); - fdc->fdcu = fdcu; fdc->flags |= FDC_ATTACHED; fdc->dmachan = dev->id_drq; @@ -619,14 +623,20 @@ fdattach(struct isa_device *dev) case 0x80: printf("NEC 765\n"); fdc->fdct = FDC_NE765; + kdc_fdc[fdcu].kdc_description = + "NEC 765 floppy disk/tape controller"; break; case 0x81: printf("Intel 82077\n"); fdc->fdct = FDC_I82077; + kdc_fdc[fdcu].kdc_description = + "Intel 82077 floppy disk/tape controller"; break; case 0x90: printf("NEC 72065B\n"); fdc->fdct = FDC_NE72065; + kdc_fdc[fdcu].kdc_description = + "NEC 72065B floppy disk/tape controller"; break; default: printf("unknown IC type %02x\n", ic_type); @@ -685,33 +695,43 @@ fdattach(struct isa_device *dev) fd->options = 0; printf("fd%d: ", fdsu, fdu); + fd_registerdev(fdcu, fdu); switch (fdt) { case RTCFDT_12M: printf("1.2MB 5.25in\n"); fd->type = FD_1200; + kdc_fd[fdu].kdc_description = + "1.2MB (1200K) 5.25in floppy disk drive"; break; case RTCFDT_144M: printf("1.44MB 3.5in\n"); fd->type = FD_1440; + kdc_fd[fdu].kdc_description = + "1.44MB (1440K) 3.5in floppy disk drive"; break; case RTCFDT_288M: printf("2.88MB 3.5in - 1.44MB mode\n"); fd->type = FD_1440; + kdc_fd[fdu].kdc_description = + "2.88MB (2880K) 3.5in floppy disk drive in 1.44 mode"; break; case RTCFDT_360K: printf("360KB 5.25in\n"); fd->type = FD_360; + kdc_fd[fdu].kdc_description = + "360KB 5.25in floppy disk drive"; break; case RTCFDT_720K: printf("720KB 3.5in\n"); fd->type = FD_720; + kdc_fd[fdu].kdc_description = + "720KB 3.5in floppy disk drive"; break; default: printf("unknown\n"); fd->type = NO_TYPE; break; } - fd_registerdev(fdcu, fdu); kdc_fd[fdu].kdc_state = DC_IDLE; if (dk_ndrive < DK_NDRIVE) { sprintf(dk_names[dk_ndrive], "fd%d", fdu); diff --git a/sys/isa/sio.c b/sys/isa/sio.c index f03bdbd..d7d787b 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.88 1995/04/04 16:26:04 ache Exp $ + * $Id: sio.c,v 1.89 1995/04/11 17:58:09 ache Exp $ */ #include "sio.h" @@ -347,6 +347,31 @@ static struct speedtab comspeedtab[] = { /* XXX - configure this list */ static Port_t likely_com_ports[] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, }; +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_UNCONFIGURED, + "RS-232 serial port" +} }; + +static void +sioregisterdev(id) + struct isa_device *id; +{ + int unit; + + unit = id->id_unit; + if (unit != 0) + kdc_sio[unit] = kdc_sio[0]; + kdc_sio[unit].kdc_unit = unit; + kdc_sio[unit].kdc_isa = id; + kdc_sio[unit].kdc_state = DC_IDLE; + dev_attach(&kdc_sio[unit]); +} + static int sioprobe(dev) struct isa_device *dev; @@ -360,6 +385,8 @@ sioprobe(dev) u_char mcr_image; int result; + sioregisterdev(dev); + if (!already_init) { /* * Turn off MCR_IENABLE for all likely serial ports. An unused @@ -535,31 +562,6 @@ 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_UNCONFIGURED, - "RS-232 serial port" -} }; - -static void -sioregisterdev(id) - struct isa_device *id; -{ - int unit; - - unit = id->id_unit; - if (unit != 0) - kdc_sio[unit] = kdc_sio[0]; - kdc_sio[unit].kdc_unit = unit; - kdc_sio[unit].kdc_isa = id; - kdc_sio[unit].kdc_state = DC_IDLE; - dev_attach(&kdc_sio[unit]); -} - static int sioattach(isdp) @@ -634,6 +636,8 @@ sioattach(isdp) #ifdef DSI_SOFT_MODEM if((inb(iobase+7) ^ inb(iobase+7)) & 0x80) { printf(" Digicom Systems, Inc. SoftModem"); + kdc_sio[isdp->id_unit].kdc_description = + "Serial port: Digicom Systems SoftModem"; goto determined_type; } #endif /* DSI_SOFT_MODEM */ @@ -654,6 +658,8 @@ sioattach(isdp) outb(iobase + com_scr, scr); if (scr1 != 0xa5 || scr2 != 0x5a) { printf(" 8250"); + kdc_sio[isdp->id_unit].kdc_description = + "Serial port: National 8250 or compatible"; goto determined_type; } } @@ -662,21 +668,31 @@ sioattach(isdp) switch (inb(com->int_id_port) & IIR_FIFO_MASK) { case FIFO_TRIGGER_1: printf(" 16450"); + kdc_sio[isdp->id_unit].kdc_description = + "Serial port: National 16450 or compatible"; break; case FIFO_TRIGGER_4: printf(" 16450?"); + kdc_sio[isdp->id_unit].kdc_description = + "Serial port: maybe National 16450"; break; case FIFO_TRIGGER_8: printf(" 16550?"); + kdc_sio[isdp->id_unit].kdc_description = + "Serial port: maybe National 16550"; break; case FIFO_TRIGGER_14: printf(" 16550A"); - if (COM_NOFIFO(isdp)) + if (COM_NOFIFO(isdp)) { printf(" fifo disabled"); - else { + kdc_sio[isdp->id_unit].kdc_description = + "Serial port: National 16550A, FIFO disabled"; + } else { com->hasfifo = TRUE; com->ftl_init = FIFO_TRIGGER_14; com->tx_fifo_size = 16; + kdc_sio[isdp->id_unit].kdc_description = + "Serial port: National 16550A or compatible"; } break; } @@ -696,7 +712,8 @@ determined_type: ; #endif /* COM_MULTIPORT */ printf("\n"); - sioregisterdev(isdp); + kdc_sio[unit].kdc_state = + (unit == comconsole) ? DC_BUSY : DC_IDLE; #ifdef KGDB if (kgdb_dev == makedev(commajor, unit)) { @@ -718,6 +735,7 @@ determined_type: ; outb(iobase + com_cfcr, CFCR_8BITS); outb(com->modem_status_port, com->mcr_image |= MCR_DTR | MCR_RTS); + kdc_sio[unit].kdc_state = DC_BUSY; if (kgdb_debug_init) { /* @@ -891,6 +909,7 @@ open_top: disc_optim(tp, &(tp->t_termios), com); if (tp->t_state & TS_ISOPEN && mynor & CALLOUT_MASK) com->active_out = TRUE; + kdc_sio[unit].kdc_state = DC_BUSY; out: splx(s); if (!(tp->t_state & TS_ISOPEN) && com->wopeners == 0) @@ -910,11 +929,13 @@ sioclose(dev, flag, mode, p) int mynor; int s; struct tty *tp; + int unit; mynor = minor(dev); if (mynor & CONTROL_MASK) return (0); - com = com_addr(MINOR_TO_UNIT(mynor)); + unit = MINOR_TO_UNIT(mynor); + com = com_addr(unit); tp = com->tp; s = spltty(); (*linesw[tp->t_line].l_close)(tp, flag); @@ -922,6 +943,7 @@ sioclose(dev, flag, mode, p) siostop(tp, FREAD | FWRITE); comhardclose(com); ttyclose(tp); + kdc_sio[unit].kdc_state = DC_IDLE; splx(s); return (0); } diff --git a/sys/isa/syscons.c b/sys/isa/syscons.c index 41fa3eb..020fa13 100644 --- a/sys/isa/syscons.c +++ b/sys/isa/syscons.c @@ -25,7 +25,7 @@ * (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: syscons.c,v 1.107 1995/03/03 08:37:07 sos Exp $ + * $Id: syscons.c,v 1.111 1995/04/04 20:06:26 sos Exp $ */ #include "sc.h" @@ -203,7 +203,8 @@ static struct kern_devconf kdc_sc[NSC] = { &kdc_isa0, /* parent */ 0, /* parentdata */ DC_BUSY, /* the console is almost always busy */ - "Graphics console" + "Graphics console", + DC_CLS_DISPLAY /* class */ }; static inline void diff --git a/sys/sys/devconf.h b/sys/sys/devconf.h index e38abbc..6d3b42a 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.3 1994/10/23 21:28:03 wollman Exp $ + * $Id: devconf.h,v 1.4 1995/03/17 04:18:07 davidg Exp $ */ /* @@ -46,6 +46,32 @@ enum dc_state { DC_BUSY /* driver supports state and is currently busy */ }; +#define DC_STATENAMES \ + { \ + "unknown", "unconfigured", "idle", "busy" \ + } + +enum dc_class { + DC_CLS_UNKNOWN = 0, /* old drivers don't set class */ + DC_CLS_CPU = 1, /* CPU devices */ + DC_CLS_BUS = 2, /* busses */ + DC_CLS_DISK = 4, /* disks */ + DC_CLS_TAPE = 8, /* tapes */ + DC_CLS_RDISK = 16, /* read-only disks */ + DC_CLS_DISPLAY = 32, /* display devices */ + DC_CLS_SERIAL = 64, /* serial I/O devices */ + DC_CLS_PARALLEL = 128, /* parallel I/O devices */ + DC_CLS_NETIF = 256, /* network interfaces */ + DC_CLS_MISC = 512 /* anything else */ +}; + +#define DC_CLASSNAMES \ + { \ + "unknown", "CPU", "bus", "disk", "tape", "read-only disk", \ + "display", "serial", "parallel", "network interface", \ + "miscellaneous" \ + } + struct devconf { char dc_name[MAXDEVNAME]; /* name */ char dc_descr[MAXDEVDESCR]; /* description */ @@ -56,6 +82,7 @@ struct devconf { 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) */ + enum dc_class dc_class; /* type of device (see above) */ size_t dc_datalen; /* length of data */ char dc_data[1]; /* variable-length data */ }; @@ -100,6 +127,7 @@ struct kern_devconf { 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. */ + enum dc_class kdc_class; /* filled in by driver */ }; int dev_attach(struct kern_devconf *); |