summaryrefslogtreecommitdiffstats
path: root/usr.sbin/config/mkioconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/config/mkioconf.c')
-rw-r--r--usr.sbin/config/mkioconf.c61
1 files changed, 36 insertions, 25 deletions
diff --git a/usr.sbin/config/mkioconf.c b/usr.sbin/config/mkioconf.c
index 5a0e89b..e92ae57 100644
--- a/usr.sbin/config/mkioconf.c
+++ b/usr.sbin/config/mkioconf.c
@@ -606,6 +606,7 @@ i386_ioconf()
{
register struct device *dp, *mp, *np;
register int uba_n, slave;
+ int dev_id;
FILE *fp;
fp = fopen(path("ioconf.c"), "w");
@@ -617,11 +618,8 @@ i386_ioconf()
fprintf(fp, " * ioconf.c \n");
fprintf(fp, " * Generated by config program\n");
fprintf(fp, " */\n\n");
- fprintf(fp, "#include \"machine/pte.h\"\n");
fprintf(fp, "#include \"sys/param.h\"\n");
- fprintf(fp, "#include \"sys/buf.h\"\n");
fprintf(fp, "\n");
- fprintf(fp, "#define V(s)\t__CONCAT(V,s)\n");
fprintf(fp, "#define C (caddr_t)\n\n");
/*
* First print the isa initialization structures
@@ -635,7 +633,9 @@ i386_ioconf()
fprintf(fp, "#include \"i386/isa/isa_device.h\"\n");
fprintf(fp, "#include \"i386/isa/isa.h\"\n");
fprintf(fp, "#include \"i386/isa/icu.h\"\n\n");
-
+ fprintf(fp, "/*\n");
+ fprintf(fp, " * XXX misplaced external declarations.\n");
+ fprintf(fp, " */\n");
for (dp = dtab; dp != 0; dp = dp->d_next) {
mp = dp->d_conn;
if (mp == 0 || mp == TO_NEXUS ||
@@ -650,18 +650,23 @@ i386_ioconf()
fprintf(stderr, "remapped irq 2 to irq 9, please update your config file\n");
dp->d_irq = 9;
}
- if (dp->d_irq != -1)
- fprintf(fp, " extern void %s();", shandler(dp));
+ if (dp->d_vec != NULL && dp->d_vec->id != NULL)
+ fprintf(fp, " inthand2_t %s;", shandler(dp));
fprintf(fp, "\n");
}
- isa_devtab(fp, "bio");
+#ifdef STATCLOCK
+ dev_id = 2;
+#else
+ dev_id = 1;
+#endif
+ isa_devtab(fp, "bio", &dev_id);
if(seen_wdc)
isa_biotab(fp, "wdc");
if(seen_fdc)
isa_biotab(fp, "fdc");
- isa_devtab(fp, "tty");
- isa_devtab(fp, "net");
- isa_devtab(fp, "null");
+ isa_devtab(fp, "tty", &dev_id);
+ isa_devtab(fp, "net", &dev_id);
+ isa_devtab(fp, "null", &dev_id);
}
/* XXX David did this differently!!! */
/* pseudo_ioconf(fp); */
@@ -676,13 +681,13 @@ isa_biotab(fp, table)
fprintf(fp, "\n\nstruct isa_device isa_biotab_%s[] = {\n", table);
fprintf(fp, "\
-/* driver iobase irq drq maddr msiz intr unit flags drive*/\n");
+/* id driver iobase irq drq maddr msiz intr unit flags drive*/\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, table))
continue;
- fprintf(fp, "{ &%3.3sdriver, %8.8s,",
+ fprintf(fp, "{ -1, &%3.3sdriver, %8.8s,",
mp->d_name, mp->d_port);
fprintf(fp, "%6.6s, %2d, C 0x%05X, %5d, %8.8s, %2d, 0x%04X, %2d },\n",
sirq(mp->d_irq), mp->d_drq, mp->d_maddr,
@@ -698,27 +703,27 @@ isa_biotab(fp, table)
*
* 4/26/93 rgrimes
*/
-isa_devtab(fp, table)
+isa_devtab(fp, table, dev_idp)
FILE *fp;
char *table;
+ int *dev_idp;
{
register struct device *dp, *mp;
fprintf(fp, "\n\nstruct isa_device isa_devtab_%s[] = {\n", table);
fprintf(fp, "\
-/* driver iobase irq drq maddr msiz intr unit flags */\n");
+/* id driver iobase irq drq maddr msiz intr unit flags */\n");
for (dp = dtab; dp != 0; dp = dp->d_next) {
+ if (dp->d_unit == QUES || !eq(dp->d_mask, table))
+ continue;
mp = dp->d_conn;
- if (dp->d_unit == QUES || mp == 0 ||
- mp == TO_NEXUS || !eq(mp->d_name, "isa"))
+ if (mp == NULL || mp == TO_NEXUS || !eq(mp->d_name, "isa"))
continue;
- if (strcmp(dp->d_mask, table)) continue;
+ fprintf(fp, "{ %2d, &%3.3sdriver,", (*dev_idp)++, dp->d_name);
if (dp->d_port)
- fprintf(fp, "{ &%3.3sdriver, %8.8s,",
- dp->d_name, dp->d_port);
+ fprintf(fp, " %8.8s,", dp->d_port);
else
- fprintf(fp, "{ &%3.3sdriver, 0x%04x,",
- dp->d_name, dp->d_portn);
+ fprintf(fp, " 0x%04x,", dp->d_portn);
fprintf(fp, "%6.6s, %2d, C 0x%05X, %5d, %8.8s, %2d, 0x%04X },\n",
sirq(dp->d_irq), dp->d_drq, dp->d_maddr,
dp->d_msize, shandler(dp), dp->d_unit,
@@ -736,11 +741,17 @@ char *
shandler(dp)
register struct device *dp;
{
- static char buf[32 + 20];
+ static char buf[32 + 1];
- if (dp->d_irq == -1)
- return ("NULL");
- sprintf(buf, "V(%.32s%d)", dp->d_name, dp->d_unit);
+ if (dp->d_vec == NULL || dp->d_vec->id == NULL)
+ return "NULL";
+ /*
+ * This is for ISA. We only support one interrupt handler in the
+ * devtabs. Handlers in the config file after the first for each
+ * device are ignored. Special handlers may be registered at
+ * runtime.
+ */
+ sprintf(buf, "%.32s", dp->d_vec->id);
return (buf);
}
OpenPOWER on IntegriCloud