From: Phil Sutherland Date: Sun, 8 Aug 1993 00:00:00 +0000 (+0000) Subject: Adds vmstat/iostat kernel support and more verbose device probe info X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/6b9305fda0fe58dbdd6b713d2c74dd2df3096a67 Adds vmstat/iostat kernel support and more verbose device probe info Fix config so that you can have devices without irqs This patch adds the symbol names to icu.s that vmstat expects the interrupt counters to be called. It also adds code to config so that the names of the interrupts are written at the end of vectors.s so vmstat can report real device names. It also cleans up and enables the logging of stray interrupts. The counters for false interrupts are added but the fix for them is not (the fix I have is not done very good.) A false interrupt is when a device asserts it's interrupt signal, then removes it before the 8259 can latch it. This is the number one cause of stray IRQ7's and IRQ15's. Additional device probe information is now printed. This includes ending I/O address (many drivers do not return the correct value from a probe this still needs to be fixed), memory address and size, driver flags passed in by config. It is now possible to configure devices that do not use an irq, this is especially handy for the new lpa driver. During a boot from floppy the system now asks for a root floppy disk. Also now reports root on sd0a when new SCSI code is used. NOTE: The source for vmstat and iostat are added by other patches. AUTHOR: Rodney W. Grimes (rgrimes@agora.rain.com) (vmstat/iostat, probe) AUTHOR: Phil Sutherland (philsuth@mycroft.dialix.oz.au) (config no irqs) AUTHOR: (???@sun-lamp) (autoconf.c add support for floppy swap) 386BSD-Patchkit: patch00117 --- diff --git a/usr/src/sys.386bsd/i386/i386/autoconf.c b/usr/src/sys.386bsd/i386/i386/autoconf.c index 79e06e3559..7eee991a94 100644 --- a/usr/src/sys.386bsd/i386/i386/autoconf.c +++ b/usr/src/sys.386bsd/i386/i386/autoconf.c @@ -34,8 +34,17 @@ * SUCH DAMAGE. * * @(#)autoconf.c 7.1 (Berkeley) 5/9/91 + * + * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE + * -------------------- ----- ---------------------- + * CURRENT PATCH LEVEL: 1 00117 + * -------------------- ----- ---------------------- + * + * 09 Apr 93 ???(From sun-lamp) Fix to report sd when Julians + * scsi code is used, allow you to swap + * root floppies during a boot */ -static char rcsid[] = "$Header: /usr/src/sys.386bsd/i386/i386/RCS/autoconf.c,v 1.2 92/01/21 14:21:31 william Exp Locker: root $"; +static char rcsid[] = "$Header: /b/source/CVS/src/sys.386bsd/i386/i386/autoconf.c,v 1.3 1993/04/10 21:58:52 cgd Exp $"; /* * Setup the system to run on the current machine. @@ -124,12 +133,17 @@ extern int Maxmem; #define DOSWAP /* change swdevt and dumpdev */ u_long bootdev = 0; /* should be dev_t, but not until 32 bits */ +#include "sd.h" static char devname[][2] = { 'w','d', /* 0 = wd */ 's','w', /* 1 = sw */ 'f','d', /* 2 = fd */ 'w','t', /* 3 = wt */ +#if NSD < 1 'a','s', /* 4 = as */ +#else + 's','d', /* 4 = sd -- new SCSI system */ +#endif }; #define PARTITIONMASK 0x7 @@ -165,6 +179,13 @@ setroot() */ if (rootdev == orootdev) return; + if (devname[majdev][0] == 'f' && devname[majdev][1] == 'd') { + printf(""); + printf("* insert the floppy you want to have mounted as\n"); + printf("* root, and hit any key to continue booting:\n"); + cngetc(); + printf(""); + } printf("changing root device to %c%c%d%c\n", devname[majdev][0], devname[majdev][1], mindev >> PARTITIONSHIFT, part + 'a'); diff --git a/usr/src/sys.386bsd/i386/i386/locore.s b/usr/src/sys.386bsd/i386/i386/locore.s index 290e9ca85e..b6a159b00a 100644 --- a/usr/src/sys.386bsd/i386/i386/locore.s +++ b/usr/src/sys.386bsd/i386/i386/locore.s @@ -37,12 +37,13 @@ * * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE * -------------------- ----- ---------------------- - * CURRENT PATCH LEVEL: 2 00064 + * CURRENT PATCH LEVEL: 3 00117 * -------------------- ----- ---------------------- * * 06 Aug 92 Pace Willisson Allow VGA memory to be mapped * 28 Nov 92 Frank MacLachlan Aligned addresses and data * on 32bit boundaries. + * 25 Mar 93 Kevin Lahey Add syscall counter for vmstat */ @@ -1584,6 +1585,7 @@ IDTVEC(syscall) movw $0x10,%ax # switch to kernel segments movw %ax,%ds movw %ax,%es + incl _cnt+V_SYSCALL # kml 3/25/93 call _syscall call _spl0 movw __udatasel,%ax # switch back to user segments diff --git a/usr/src/sys.386bsd/i386/isa/icu.s b/usr/src/sys.386bsd/i386/isa/icu.s index edcaf4fe28..0a96854bfb 100644 --- a/usr/src/sys.386bsd/i386/isa/icu.s +++ b/usr/src/sys.386bsd/i386/isa/icu.s @@ -38,11 +38,13 @@ * * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE * -------------------- ----- ---------------------- - * CURRENT PATCH LEVEL: 1 00064 + * CURRENT PATCH LEVEL: 2 00117 * -------------------- ----- ---------------------- * * 28 Nov 92 Frank MacLachlan Aligned addresses and data * on 32bit boundaries. + * 24 Mar 93 Rodney W. Grimes Added interrupt counters for vmstat + * also stray and false intr counters added */ /* @@ -65,7 +67,22 @@ _biomask: .long 0 .globl _netmask _netmask: .long 0 .globl _isa_intr + /* + * This is the names of the counters for vmstat added by + * rgrimes@agora.rain.com (Rodney W. Grimes) 10/30/1992 + * Added false and stray counters 3/25/1993 rgrimes + */ + .globl _intrcnt, _eintrcnt /* Added to make vmstat happy */ + .globl _isa_false7_intrcnt, _isa_false15_intrcnt, _isa_stray_intrcnt +_intrcnt: /* Added to make vmstat happy */ +_isa_false7_intrcnt: + .space 4 /* false IRQ7's */ +_isa_false15_intrcnt: + .space 4 /* false IRQ15's */ +_isa_stray_intrcnt: + .space 4 /* stray interrupts */ _isa_intr: .space 16*4 +_eintrcnt: /* Added to make vmstat happy */ .text /* diff --git a/usr/src/sys.386bsd/i386/isa/isa.c b/usr/src/sys.386bsd/i386/isa/isa.c index f047ab7bea..d9a417a835 100644 --- a/usr/src/sys.386bsd/i386/isa/isa.c +++ b/usr/src/sys.386bsd/i386/isa/isa.c @@ -37,10 +37,14 @@ * * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE * -------------------- ----- ---------------------- - * CURRENT PATCH LEVEL: 1 00017 + * CURRENT PATCH LEVEL: 2 00117 * -------------------- ----- ---------------------- * * 18 Aug 92 Frank Maclachlan *See comments below + * 25 Mar 93 Rodney W. Grimes Added counter for stray interrupt, + * turned on logging of stray interrupts, + * Now prints maddr, msize, and flags + * after finding a device. */ static char rcsid[] = "$Header: /usr/src/sys.386bsd/i386/isa/RCS/isa.c,v 1.2 92/01/21 14:34:23 william Exp Locker: root $"; @@ -179,7 +183,7 @@ config_isadev(isdp, mp) return (1); } else return(0); } -#else +#else /* notyet */ /* * Configure all ISA devices */ @@ -222,25 +226,47 @@ config_isadev(isdp, mp) isdp->id_alive = (*dp->probe)(isdp); if (isdp->id_alive) { printf("%s%d", dp->name, isdp->id_unit); + /* + * The attach should really be after all the printf's + * but until all the drivers are fixed do it here. + * There is a comment below that shows where this + * really belongs. Rod Grimes 04/10/93 + */ (*dp->attach)(isdp); - printf(" at 0x%x ", isdp->id_iobase); + printf(" at 0x%x", isdp->id_iobase); + if ((isdp->id_iobase + isdp->id_alive - 1) != + isdp->id_iobase) + printf("-0x%x", + isdp->id_iobase + isdp->id_alive - 1); + printf(" "); + if(isdp->id_irq) + printf("irq %d ", ffs(isdp->id_irq)-1); + if (isdp->id_drq != -1) + printf("drq %d ", isdp->id_drq); + if (isdp->id_maddr != 0) + printf("maddr 0x%x ", kvtop(isdp->id_maddr)); + if (isdp->id_msize != 0) + printf("msize %d ", isdp->id_msize); + if (isdp->id_flags != 0) + printf("flags 0x%x ", isdp->id_flags); + printf("on isa\n"); + + /* This is the place the attach should be done! */ if(isdp->id_irq) { int intrno; intrno = ffs(isdp->id_irq)-1; - printf("irq %d ", intrno); INTREN(isdp->id_irq); - if(mp)INTRMASK(*mp,isdp->id_irq); + if(mp) + INTRMASK(*mp,isdp->id_irq); setidt(ICU_OFFSET+intrno, isdp->id_intr, SDT_SYS386IGT, SEL_KPL); } - if (isdp->id_drq != -1) printf("drq %d ", isdp->id_drq); - printf("on isa\n"); } return (1); } else return(0); } -#endif +#endif /* (!) notyet */ #define IDTVEC(name) __CONCAT(X,name) /* default interrupt vector table entries */ @@ -504,11 +530,23 @@ isa_nmi(cd) { */ isa_strayintr(d) { -#ifdef notdef /* DON'T BOTHER FOR NOW! */ /* for some reason, we get bursts of intr #7, even if not enabled! */ - log(LOG_ERR,"ISA strayintr %x", d); -#endif + /* + * Well the reason you got bursts of intr #7 is because someone + * raised an interrupt line and dropped it before the 8259 could + * prioritize it. This is documented in the intel data book. This + * means you have BAD hardware! I have changed this so that only + * the first 5 get logged, then it quits logging them, and puts + * out a special message. rgrimes 3/25/1993 + */ + extern u_long isa_stray_intrcnt; + + isa_stray_intrcnt++; + if (isa_stray_intrcnt <= 5) + log(LOG_ERR,"ISA strayintr %x\n", d); + if (isa_stray_intrcnt == 5) + log(LOG_CRIT,"Too many ISA strayintr not logging any more\n"); } /* diff --git a/usr/src/usr.sbin/config/mkglue.c b/usr/src/usr.sbin/config/mkglue.c index ebc3e82f0f..e23491f625 100644 --- a/usr/src/usr.sbin/config/mkglue.c +++ b/usr/src/usr.sbin/config/mkglue.c @@ -29,6 +29,15 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE + * -------------------- ----- ---------------------- + * CURRENT PATCH LEVEL: 1 00117 + * -------------------- ----- ---------------------- + * + * 26 Mar 93 Rodney W. Grimes Added interrupt counters for vmstat, + * also false and stray counter names. + * */ #ifndef lint @@ -395,5 +404,44 @@ VEC(clk)\n\ } } } + + /* + * This is to output the names of the interrupts for vmstat + * added by rgrimes@agora.rain.com (Rodney W. Grimes) 10/30/1992 + * Added false and stray interrupt counter names 3/25/93 rwgrimes + */ + fprintf(fp,"\ +/* These are the names of the interupt vector counters */\n\n\ + .text\n\ + .globl _intrnames,_eintrnames\n\ +_intrnames:\n\ + .asciz \"false7\"\n\ + .asciz \"false15\"\n\ + .asciz \"stray\"\n\ + .asciz \"clk\"\n"); + + count=0; + for (dp = dtab; dp != 0; dp = dp->d_next) { + mp = dp->d_conn; + if (mp != 0 && /* mp != (struct device *)-1 &&*/ + eq(mp->d_name, "isa")) { + struct idlst *id, *id2; + + for (id = dp->d_vec; id; id = id->id_next) { + for (id2 = dp->d_vec; id2; id2 = id2->id_next) { + if (id2 == id) { + if(dp->d_irq == -1) continue; + fprintf(fp,"\t.asciz\t\"%s%d\"\n", + dp->d_name, dp->d_unit); + count++; + break; + } + if (!strcmp(id->id, id2->id)) + break; + } + } + } + } + fprintf(fp,"_eintrnames:\n\n\n"); (void) fclose(fp); } diff --git a/usr/src/usr.sbin/config/mkioconf.c b/usr/src/usr.sbin/config/mkioconf.c index 6c231807ba..7940424c12 100644 --- a/usr/src/usr.sbin/config/mkioconf.c +++ b/usr/src/usr.sbin/config/mkioconf.c @@ -32,16 +32,18 @@ * * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE * -------------------- ----- ---------------------- - * CURRENT PATCH LEVEL: 1 00091 + * CURRENT PATCH LEVEL: 2 00117 * -------------------- ----- ---------------------- * - * 27 Feb 93 Chris Demetriou Add proper flag handling. + * 27 Feb 93 Chris Demetriou Add proper flag handling. + * 08 Aug 93 Phil Sutherland Add support for devices without irq's + * Rodney W. Grimes Cleaned up indents, fixed table formats * */ #ifndef lint -static char sccsid[] = "@(#)mkioconf.c 5.18 (Berkeley) 5/10/91"; -#endif /* not lint */ +static char sccsid[] = "@(#)mkioconf.c 5.18 (Berkeley) 5/10/91"; +#endif /* not lint */ #include #include "y.tab.h" @@ -50,15 +52,15 @@ static char sccsid[] = "@(#)mkioconf.c 5.18 (Berkeley) 5/10/91"; /* * build the ioconf.c file */ -char *qu(); -char *intv(); +char *qu(); +char *intv(); #if MACHINE_VAX vax_ioconf() { register struct device *dp, *mp, *np; - register int uba_n, slave; - FILE *fp; + register int uba_n, slave; + FILE *fp; fp = fopen(path("ioconf.c"), "w"); if (fp == 0) { @@ -84,7 +86,7 @@ vax_ioconf() !eq(mp->d_name, "mba")) continue; fprintf(fp, "extern struct mba_driver %sdriver;\n", - dp->d_name); + dp->d_name); } fprintf(fp, "\nstruct mba_device mbdinit[] = {\n"); fprintf(fp, "\t/* Device, Unit, Mba, Drive, Dk */\n"); @@ -95,22 +97,22 @@ vax_ioconf() continue; if (dp->d_addr) { printf("can't specify csr address on mba for %s%d\n", - dp->d_name, dp->d_unit); + dp->d_name, dp->d_unit); continue; } if (dp->d_vec != 0) { printf("can't specify vector for %s%d on mba\n", - dp->d_name, dp->d_unit); + dp->d_name, dp->d_unit); continue; } if (dp->d_drive == UNKNOWN) { printf("drive not specified for %s%d\n", - dp->d_name, dp->d_unit); + dp->d_name, dp->d_unit); continue; } if (dp->d_slave != UNKNOWN) { - printf("can't specify slave number for %s%d\n", - dp->d_name, dp->d_unit); + printf("can't specify slave number for %s%d\n", + dp->d_name, dp->d_unit); continue; } fprintf(fp, "\t{ &%sdriver, %d, %s,", @@ -120,15 +122,14 @@ vax_ioconf() } fprintf(fp, "\t0\n};\n\n"); /* - * Print the mbsinit structure - * Driver Controller Unit Slave + * Print the mbsinit structure Driver Controller Unit Slave */ fprintf(fp, "struct mba_slave mbsinit [] = {\n"); fprintf(fp, "\t/* Driver, Ctlr, Unit, Slave */\n"); for (dp = dtab; dp != 0; dp = dp->d_next) { /* - * All slaves are connected to something which - * is connected to the massbus. + * All slaves are connected to something which is + * connected to the massbus. */ if ((mp = dp->d_conn) == 0 || mp == TO_NEXUS) continue; @@ -137,9 +138,9 @@ vax_ioconf() !eq(np->d_name, "mba")) continue; fprintf(fp, "\t{ &%sdriver, %s", - mp->d_name, qu(mp->d_unit)); + mp->d_name, qu(mp->d_unit)); fprintf(fp, ", %2d, %s },\n", - dp->d_unit, qu(dp->d_slave)); + dp->d_unit, qu(dp->d_slave)); } fprintf(fp, "\t0\n};\n\n"); } @@ -148,14 +149,14 @@ vax_ioconf() */ for (dp = dtab; dp != 0; dp = dp->d_next) { if (dp->d_vec != 0) { - struct idlst *ip; + struct idlst *ip; mp = dp->d_conn; if (mp == 0 || mp == TO_NEXUS || - (!eq(mp->d_name, "uba") && !eq(mp->d_name, "bi"))) + (!eq(mp->d_name, "uba") && !eq(mp->d_name, "bi"))) continue; fprintf(fp, - "extern struct uba_driver %sdriver;\n", - dp->d_name); + "extern struct uba_driver %sdriver;\n", + dp->d_name); fprintf(fp, "extern "); ip = dp->d_vec; for (;;) { @@ -167,7 +168,7 @@ vax_ioconf() } fprintf(fp, ";\n"); fprintf(fp, "int\t (*%sint%d[])() = { ", dp->d_name, - dp->d_unit); + dp->d_unit); ip = dp->d_vec; for (;;) { fprintf(fp, "X%s%d", ip->id, dp->d_unit); @@ -188,36 +189,36 @@ vax_ioconf() continue; if (dp->d_vec == 0) { printf("must specify vector for %s%d\n", - dp->d_name, dp->d_unit); + dp->d_name, dp->d_unit); continue; } if (dp->d_addr == 0) { printf("must specify csr address for %s%d\n", - dp->d_name, dp->d_unit); + dp->d_name, dp->d_unit); continue; } if (dp->d_drive != UNKNOWN || dp->d_slave != UNKNOWN) { printf("drives need their own entries; dont "); printf("specify drive or slave for %s%d\n", - dp->d_name, dp->d_unit); + dp->d_name, dp->d_unit); continue; } if (dp->d_flags) { printf("controllers (e.g. %s%d) ", - dp->d_name, dp->d_unit); + dp->d_name, dp->d_unit); printf("don't have flags, only devices do\n"); continue; } fprintf(fp, - "\t{ &%sdriver,\t%d,\t%s,\t0,\t%sint%d, C 0%o },\n", - dp->d_name, dp->d_unit, qu(mp->d_unit), - dp->d_name, dp->d_unit, dp->d_addr); + "\t{ &%sdriver,\t%d,\t%s,\t0,\t%sint%d, C 0%o },\n", + dp->d_name, dp->d_unit, qu(mp->d_unit), + dp->d_name, dp->d_unit, dp->d_addr); } fprintf(fp, "\t0\n};\n"); /* unibus devices */ fprintf(fp, "\nstruct uba_device ubdinit[] = {\n"); fprintf(fp, -"\t/* driver, unit, ctlr, ubanum, slave, intr, addr, dk, flags*/\n"); + "\t/* driver, unit, ctlr, ubanum, slave, intr, addr, dk, flags*/\n"); for (dp = dtab; dp != 0; dp = dp->d_next) { mp = dp->d_conn; if (dp->d_unit == QUES || dp->d_type != DEVICE || mp == 0 || @@ -231,19 +232,19 @@ vax_ioconf() if (eq(mp->d_name, "uba")) { if (dp->d_vec == 0) { printf("must specify vector for device %s%d\n", - dp->d_name, dp->d_unit); + dp->d_name, dp->d_unit); continue; } if (dp->d_addr == 0) { printf("must specify csr for device %s%d\n", - dp->d_name, dp->d_unit); + dp->d_name, dp->d_unit); continue; } if (dp->d_drive != UNKNOWN || dp->d_slave != UNKNOWN) { printf("drives/slaves can be specified "); printf("only for controllers, "); printf("not for device %s%d\n", - dp->d_name, dp->d_unit); + dp->d_name, dp->d_unit); continue; } uba_n = mp->d_unit; @@ -251,9 +252,9 @@ vax_ioconf() } else { if ((np = mp->d_conn) == 0) { printf("%s%d isn't connected to anything ", - mp->d_name, mp->d_unit); + mp->d_name, mp->d_unit); printf(", so %s%d is unattached\n", - dp->d_name, dp->d_unit); + dp->d_name, dp->d_unit); continue; } uba_n = np->d_unit; @@ -267,29 +268,29 @@ vax_ioconf() if (dp->d_slave != UNKNOWN) { printf("slave numbers should be given only "); printf("for massbus tapes, not for %s%d\n", - dp->d_name, dp->d_unit); + dp->d_name, dp->d_unit); continue; } if (dp->d_vec != 0) { printf("interrupt vectors should not be "); printf("given for drive %s%d\n", - dp->d_name, dp->d_unit); + dp->d_name, dp->d_unit); continue; } if (dp->d_addr != 0) { printf("csr addresses should be given only "); printf("on controllers, not on %s%d\n", - dp->d_name, dp->d_unit); + dp->d_name, dp->d_unit); continue; } slave = dp->d_drive; } fprintf(fp, "\t{ &%sdriver, %2d, %s,", - eq(mp->d_name, "uba") ? dp->d_name : mp->d_name, dp->d_unit, - eq(mp->d_name, "uba") ? " -1" : qu(mp->d_unit)); + eq(mp->d_name, "uba") ? dp->d_name : mp->d_name, dp->d_unit, + eq(mp->d_name, "uba") ? " -1" : qu(mp->d_unit)); fprintf(fp, " %s, %2d, %s, C 0%-6o, %d, 0x%x },\n", - qu(uba_n), slave, intv(dp), dp->d_addr, dp->d_dk, - dp->d_flags); + qu(uba_n), slave, intv(dp), dp->d_addr, dp->d_dk, + dp->d_flags); } fprintf(fp, "\t0\n};\n"); (void) fclose(fp); @@ -300,8 +301,8 @@ vax_ioconf() tahoe_ioconf() { register struct device *dp, *mp, *np; - register int vba_n, slave; - FILE *fp; + register int vba_n, slave; + FILE *fp; fp = fopen(path("ioconf.c"), "w"); if (fp == 0) { @@ -324,10 +325,10 @@ tahoe_ioconf() if (mp == 0 || mp == TO_NEXUS || !eq(mp->d_name, "vba")) continue; if (dp->d_vec != 0) { - struct idlst *ip; + struct idlst *ip; fprintf(fp, - "extern struct vba_driver %sdriver;\n", - dp->d_name); + "extern struct vba_driver %sdriver;\n", + dp->d_name); fprintf(fp, "extern "); ip = dp->d_vec; for (;;) { @@ -339,7 +340,7 @@ tahoe_ioconf() } fprintf(fp, ";\n"); fprintf(fp, "int\t (*%sint%d[])() = { ", dp->d_name, - dp->d_unit); + dp->d_unit); ip = dp->d_vec; for (;;) { fprintf(fp, "X%s%d", ip->id, dp->d_unit); @@ -349,10 +350,11 @@ tahoe_ioconf() fprintf(fp, ", "); } fprintf(fp, ", 0 } ;\n"); - } else if (dp->d_type == DRIVER) /* devices w/o interrupts */ + } else if (dp->d_type == DRIVER) /* devices w/o + * interrupts */ fprintf(fp, - "extern struct vba_driver %sdriver;\n", - dp->d_name); + "extern struct vba_driver %sdriver;\n", + dp->d_name); } fprintf(fp, "\nstruct vba_ctlr vbminit[] = {\n"); fprintf(fp, "/*\t driver,\tctlr,\tvbanum,\talive,\tintr,\taddr */\n"); @@ -363,36 +365,36 @@ tahoe_ioconf() continue; if (dp->d_vec == 0) { printf("must specify vector for %s%d\n", - dp->d_name, dp->d_unit); + dp->d_name, dp->d_unit); continue; } if (dp->d_addr == 0) { printf("must specify csr address for %s%d\n", - dp->d_name, dp->d_unit); + dp->d_name, dp->d_unit); continue; } if (dp->d_drive != UNKNOWN || dp->d_slave != UNKNOWN) { printf("drives need their own entries; dont "); printf("specify drive or slave for %s%d\n", - dp->d_name, dp->d_unit); + dp->d_name, dp->d_unit); continue; } if (dp->d_flags) { printf("controllers (e.g. %s%d) ", - dp->d_name, dp->d_unit); + dp->d_name, dp->d_unit); printf("don't have flags, only devices do\n"); continue; } fprintf(fp, - "\t{ &%sdriver,\t%d,\t%s,\t0,\t%sint%d, C 0x%x },\n", - dp->d_name, dp->d_unit, qu(mp->d_unit), - dp->d_name, dp->d_unit, dp->d_addr); + "\t{ &%sdriver,\t%d,\t%s,\t0,\t%sint%d, C 0x%x },\n", + dp->d_name, dp->d_unit, qu(mp->d_unit), + dp->d_name, dp->d_unit, dp->d_addr); } fprintf(fp, "\t0\n};\n"); /* versabus devices */ fprintf(fp, "\nstruct vba_device vbdinit[] = {\n"); fprintf(fp, -"\t/* driver, unit, ctlr, vbanum, slave, intr, addr, dk, flags*/\n"); + "\t/* driver, unit, ctlr, vbanum, slave, intr, addr, dk, flags*/\n"); for (dp = dtab; dp != 0; dp = dp->d_next) { mp = dp->d_conn; if (dp->d_unit == QUES || dp->d_type != DEVICE || mp == 0 || @@ -406,18 +408,18 @@ tahoe_ioconf() if (eq(mp->d_name, "vba")) { if (dp->d_vec == 0) printf( - "Warning, no interrupt vector specified for device %s%d\n", - dp->d_name, dp->d_unit); + "Warning, no interrupt vector specified for device %s%d\n", + dp->d_name, dp->d_unit); if (dp->d_addr == 0) { printf("must specify csr for device %s%d\n", - dp->d_name, dp->d_unit); + dp->d_name, dp->d_unit); continue; } if (dp->d_drive != UNKNOWN || dp->d_slave != UNKNOWN) { printf("drives/slaves can be specified "); printf("only for controllers, "); printf("not for device %s%d\n", - dp->d_name, dp->d_unit); + dp->d_name, dp->d_unit); continue; } vba_n = mp->d_unit; @@ -425,9 +427,9 @@ tahoe_ioconf() } else { if ((np = mp->d_conn) == 0) { printf("%s%d isn't connected to anything ", - mp->d_name, mp->d_unit); + mp->d_name, mp->d_unit); printf(", so %s%d is unattached\n", - dp->d_name, dp->d_unit); + dp->d_name, dp->d_unit); continue; } vba_n = np->d_unit; @@ -441,29 +443,29 @@ tahoe_ioconf() if (dp->d_slave != UNKNOWN) { printf("slave numbers should be given only "); printf("for massbus tapes, not for %s%d\n", - dp->d_name, dp->d_unit); + dp->d_name, dp->d_unit); continue; } if (dp->d_vec != 0) { printf("interrupt vectors should not be "); printf("given for drive %s%d\n", - dp->d_name, dp->d_unit); + dp->d_name, dp->d_unit); continue; } if (dp->d_addr != 0) { printf("csr addresses should be given only "); printf("on controllers, not on %s%d\n", - dp->d_name, dp->d_unit); + dp->d_name, dp->d_unit); continue; } slave = dp->d_drive; } fprintf(fp, "\t{ &%sdriver, %2d, %s,", - eq(mp->d_name, "vba") ? dp->d_name : mp->d_name, dp->d_unit, - eq(mp->d_name, "vba") ? " -1" : qu(mp->d_unit)); + eq(mp->d_name, "vba") ? dp->d_name : mp->d_name, dp->d_unit, + eq(mp->d_name, "vba") ? " -1" : qu(mp->d_unit)); fprintf(fp, " %s, %2d, %s, C 0x%-6x, %d, 0x%x },\n", - qu(vba_n), slave, intv(dp), dp->d_addr, dp->d_dk, - dp->d_flags); + qu(vba_n), slave, intv(dp), dp->d_addr, dp->d_dk, + dp->d_flags); } fprintf(fp, "\t0\n};\n"); (void) fclose(fp); @@ -474,9 +476,9 @@ tahoe_ioconf() hp300_ioconf() { register struct device *dp, *mp, *np; - register int hpib, slave; - FILE *fp; - extern char *wnum(); + register int hpib, slave; + FILE *fp; + extern char *wnum(); fp = fopen(path("ioconf.c"), "w"); if (fp == 0) { @@ -505,16 +507,16 @@ hp300_ioconf() for (dp = dtab; dp != 0; dp = dp->d_next) { mp = dp->d_conn; if (dp->d_unit == QUES || - dp->d_type != MASTER && dp->d_type != CONTROLLER) + dp->d_type != MASTER && dp->d_type != CONTROLLER) continue; if (mp != TO_NEXUS) { printf("%s%s must be attached to an sc (nexus)\n", - dp->d_name, wnum(dp->d_unit)); + dp->d_name, wnum(dp->d_unit)); continue; } if (dp->d_drive != UNKNOWN || dp->d_slave != UNKNOWN) { printf("can't specify drive/slave for %s%s\n", - dp->d_name, wnum(dp->d_unit)); + dp->d_name, wnum(dp->d_unit)); continue; } fprintf(fp, @@ -525,7 +527,7 @@ hp300_ioconf() /* devices */ fprintf(fp, "\nstruct hp_device hp_dinit[] = {\n"); fprintf(fp, - "/*driver,\tcdriver,\tunit,\tctlr,\tslave,\taddr,\tdk,\tflags*/\n"); + "/*driver,\tcdriver,\tunit,\tctlr,\tslave,\taddr,\tdk,\tflags*/\n"); for (dp = dtab; dp != 0; dp = dp->d_next) { mp = dp->d_conn; if (mp == 0 || dp->d_type != DEVICE || hpbadslave(mp, dp)) @@ -533,7 +535,7 @@ hp300_ioconf() if (mp == TO_NEXUS) { if (dp->d_drive != UNKNOWN || dp->d_slave != UNKNOWN) { printf("can't specify drive/slave for %s%s\n", - dp->d_name, wnum(dp->d_unit)); + dp->d_name, wnum(dp->d_unit)); continue; } slave = QUES; @@ -541,20 +543,20 @@ hp300_ioconf() } else { if (dp->d_addr != 0) { printf("can't specify sc for device %s%s\n", - dp->d_name, wnum(dp->d_unit)); + dp->d_name, wnum(dp->d_unit)); continue; } if (mp->d_type == CONTROLLER) { if (dp->d_drive == UNKNOWN) { printf("must specify drive for %s%s\n", - dp->d_name, wnum(dp->d_unit)); + dp->d_name, wnum(dp->d_unit)); continue; } slave = dp->d_drive; } else { if (dp->d_slave == UNKNOWN) { printf("must specify slave for %s%s\n", - dp->d_name, wnum(dp->d_unit)); + dp->d_name, wnum(dp->d_unit)); continue; } slave = dp->d_slave; @@ -580,7 +582,7 @@ hp300_ioconf() hpbadslave(mp, dp) register struct device *dp, *mp; { - extern char *wnum(); + extern char *wnum(); if (mp == TO_NEXUS && ishpibdev(dp->d_name) || mp != TO_NEXUS && eq(mp->d_name, "hpib") && @@ -599,7 +601,7 @@ hpbadslave(mp, dp) return (0); } -char * +char * wnum(num) { @@ -611,13 +613,13 @@ wnum(num) #endif #if MACHINE_I386 -char *sirq(); +char *sirq(); i386_ioconf() { register struct device *dp, *mp, *np; - register int uba_n, slave; - FILE *fp; + register int uba_n, slave; + FILE *fp; fp = fopen(path("ioconf.c"), "w"); if (fp == 0) { @@ -652,93 +654,139 @@ i386_ioconf() !eq(mp->d_name, "isa")) continue; fprintf(fp, -"extern struct isa_driver %sdriver; extern V(%s%d)();\n", - dp->d_name, dp->d_name, dp->d_unit); + "extern struct isa_driver %sdriver; ", dp->d_name); + if (dp->d_irq >= 0) { + fprintf(fp, + "extern V(%s%d)();\n", + dp->d_name, dp->d_unit); + } else { + fprintf(fp, "\n"); + } } fprintf(fp, "\nstruct isa_device isa_devtab_bio[] = {\n"); fprintf(fp, "\ -/* driver iobase irq drq maddr msiz intr unit flags */\n"); +/* driver iobase irq drq maddr msiz intr unit flags */\ +\n"); for (dp = dtab; dp != 0; dp = dp->d_next) { mp = dp->d_conn; if (dp->d_unit == QUES || mp == 0 || mp == TO_NEXUS || !eq(mp->d_name, "isa")) continue; - if (!eq(dp->d_mask, "bio")) continue; + if (!eq(dp->d_mask, "bio")) + continue; if (dp->d_port) - fprintf(fp, "{ &%sdriver, %8.8s,", dp->d_name, dp->d_port); + fprintf(fp, "{ &%3.3sdriver, %8.8s,", + dp->d_name, dp->d_port); else - fprintf(fp, "{ &%sdriver, 0x%03x,", dp->d_name, dp->d_portn); - fprintf(fp, " %5.5s, %2d, C 0x%05X, %5d, V(%s%d), %2d, %#x },\n", - sirq(dp->d_irq), dp->d_drq, dp->d_maddr, - dp->d_msize, dp->d_name, dp->d_unit, dp->d_unit, - dp->d_flags); + fprintf(fp, "{ &%3.3sdriver, 0x%03x,", + dp->d_name, dp->d_portn); + fprintf(fp, " %5.5s, %2d, C 0x%05X, %5d,", + sirq(dp->d_irq), dp->d_drq, + dp->d_maddr, dp->d_msize); + if (dp->d_irq >= 0) + fprintf(fp, " V(%s%d),\t", + dp->d_name, dp->d_unit); + else + fprintf(fp, " NULL,\t"); + fprintf(fp, " %2d, 0x%x },\n", + dp->d_unit, dp->d_flags); } fprintf(fp, "0\n};\n"); fprintf(fp, "struct isa_device isa_devtab_tty[] = {\n"); fprintf(fp, "\ -/* driver iobase irq drq maddr msiz intr unit flags */\n"); +/* driver iobase irq drq maddr msiz intr unit flags */\ +\n"); for (dp = dtab; dp != 0; dp = dp->d_next) { mp = dp->d_conn; if (dp->d_unit == QUES || mp == 0 || mp == TO_NEXUS || !eq(mp->d_name, "isa")) continue; - if (!eq(dp->d_mask, "tty")) continue; + if (!eq(dp->d_mask, "tty")) + continue; if (dp->d_port) - fprintf(fp, "{ &%sdriver, %8.8s,", dp->d_name, dp->d_port); + fprintf(fp, "{ &%3.3sdriver, %8.8s,", + dp->d_name, dp->d_port); else - fprintf(fp, "{ &%sdriver, 0x%03x,", dp->d_name, dp->d_portn); - fprintf(fp, " %5.5s, %2d, C 0x%05X, %5d, V(%s%d), %2d, %#x },\n", - sirq(dp->d_irq), dp->d_drq, dp->d_maddr, - dp->d_msize, dp->d_name, dp->d_unit, dp->d_unit, - dp->d_flags); + fprintf(fp, "{ &%3.3sdriver, 0x%03x,", + dp->d_name, dp->d_portn); + fprintf(fp, " %5.5s, %2d, C 0x%05X, %5d,", + sirq(dp->d_irq), dp->d_drq, + dp->d_maddr, dp->d_msize); + if (dp->d_irq >= 0) + fprintf(fp, " V(%s%d),\t", + dp->d_name, dp->d_unit); + else + fprintf(fp, " NULL,\t"); + fprintf(fp, " %2d, 0x%x },\n", + dp->d_unit, dp->d_flags); } fprintf(fp, "0\n};\n\n"); fprintf(fp, "struct isa_device isa_devtab_net[] = {\n"); fprintf(fp, "\ -/* driver iobase irq drq maddr msiz intr unit flags */\n"); +/* driver iobase irq drq maddr msiz intr unit flags */\ +\n"); for (dp = dtab; dp != 0; dp = dp->d_next) { mp = dp->d_conn; if (dp->d_unit == QUES || mp == 0 || mp == TO_NEXUS || !eq(mp->d_name, "isa")) continue; - if (!eq(dp->d_mask, "net")) continue; + if (!eq(dp->d_mask, "net")) + continue; if (dp->d_port) - fprintf(fp, "{ &%sdriver, %8.8s,", dp->d_name, dp->d_port); + fprintf(fp, "{ &%3.3sdriver, %8.8s,", + dp->d_name, dp->d_port); + else + fprintf(fp, "{ &%3.3sdriver, 0x%03x,", + dp->d_name, dp->d_portn); + fprintf(fp, " %5.5s, %2d, C 0x%05X, %5d,", + sirq(dp->d_irq), dp->d_drq, + dp->d_maddr, dp->d_msize); + if (dp->d_irq >= 0) + fprintf(fp, " V(%s%d),\t", + dp->d_name, dp->d_unit); else - fprintf(fp, "{ &%sdriver, 0x%03x,", dp->d_name, dp->d_portn); - fprintf(fp, " %5.5s, %2d, C 0x%05X, %5d, V(%s%d), %2d, %#x },\n", - sirq(dp->d_irq), dp->d_drq, dp->d_maddr, - dp->d_msize, dp->d_name, dp->d_unit, dp->d_unit, - dp->d_flags); + fprintf(fp, " NULL,\t"); + fprintf(fp, " %2d, 0x%x },\n", + dp->d_unit, dp->d_flags); } fprintf(fp, "0\n};\n\n"); fprintf(fp, "struct isa_device isa_devtab_null[] = {\n"); fprintf(fp, "\ -/* driver iobase irq drq maddr msiz intr unit flags */\n"); +/* driver iobase irq drq maddr msiz intr unit flags */\ +\n"); for (dp = dtab; dp != 0; dp = dp->d_next) { mp = dp->d_conn; if (dp->d_unit == QUES || mp == 0 || mp == TO_NEXUS || !eq(mp->d_name, "isa")) continue; - if (!eq(dp->d_mask, "null")) continue; + if (!eq(dp->d_mask, "null")) + continue; if (dp->d_port) - fprintf(fp, "{ &%sdriver, %8.8s,", dp->d_name, dp->d_port); + fprintf(fp, "{ &%3.3sdriver, %8.8s,", + dp->d_name, dp->d_port); + else + fprintf(fp, "{ &%3.3sdriver, 0x%03x,", + dp->d_name, dp->d_portn); + fprintf(fp, " %5.5s, %2d, C 0x%05X, %5d,", + sirq(dp->d_irq), dp->d_drq, + dp->d_maddr, dp->d_msize); + if (dp->d_irq >= 0) + fprintf(fp, " V(%s%d),\t", + dp->d_name, dp->d_unit); else - fprintf(fp, "{ &%sdriver, 0x%03x,", dp->d_name, dp->d_portn); - fprintf(fp, " %5.5s, %2d, C 0x%05X, %5d, V(%s%d), %2d, %#x },\n", - sirq(dp->d_irq), dp->d_drq, dp->d_maddr, - dp->d_msize, dp->d_name, dp->d_unit, dp->d_unit, - dp->d_flags); + fprintf(fp, " NULL,\t"); + fprintf(fp, " %2d, 0x%x },\n", + dp->d_unit, dp->d_flags); } fprintf(fp, "0\n};\n\n"); } (void) fclose(fp); } -char * +char * sirq(num) { @@ -749,11 +797,11 @@ sirq(num) } #endif -char * +char * intv(dev) register struct device *dev; { - static char buf[20]; + static char buf[20]; if (dev->d_vec == 0) return (" 0"); @@ -761,7 +809,7 @@ intv(dev) return (buf); } -char * +char * qu(num) {