summaryrefslogtreecommitdiffstats
path: root/usr.sbin/config/mkglue.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/config/mkglue.c')
-rw-r--r--usr.sbin/config/mkglue.c108
1 files changed, 51 insertions, 57 deletions
diff --git a/usr.sbin/config/mkglue.c b/usr.sbin/config/mkglue.c
index 8b35314..e467869 100644
--- a/usr.sbin/config/mkglue.c
+++ b/usr.sbin/config/mkglue.c
@@ -332,71 +332,65 @@ dump_ctrs(fp)
/*
* Create the ISA interrupt vector glue file.
+ *
+ * The interrupt handlers are hardwired into vector.s and are attached
+ * at runtime depending on the data in ioconf.c and on the results of
+ * probing. Here we only need to generate the names of the interrupt
+ * handlers in an ancient form suitable for vmstat (the _eintrcnt label
+ * can't be expressed in C). We give the names of all devices to
+ * simplify the correspondence between devices and interrupt handlers.
+ * The order must match that in mkioconf.c.
*/
-vector() {
- register FILE *fp, *gp;
- register struct device *dp, *mp;
- int count;
+vector()
+{
+ int dev_id;
+ FILE *fp;
fp = fopen(path("vector.h"), "w");
- if (fp == 0) {
+ if (fp == NULL) {
perror(path("vector.h"));
exit(1);
}
- fprintf(fp, "\
-/*\n\
- * AT/386\n\
- * Macros for interrupt vector routines\n\
- * Generated by config program\n\
- */\n\
-\n");
-
- fprintf(fp, "\
-#define BUILD_VECTORS \\\n\
- BUILD_VECTOR(clk, 0,0,0, _high_imask, _clkintr,1,1, al);\\\n");
- fprintf(fp,
- "BUILD_VECTOR(rtc, 0,8,1, _stat_imask, _rtcintr,2,1_AND_2, ah);\\\n");
-
- count=2;
- 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) {
- build_vector(fp, dp, id, count);
- count++;
- if (!strcmp(id->id, id2->id))
- break;
- }
- }
- }
- }
- }
- fprintf(fp, "\n\n#define NR_REAL_INT_HANDLERS %d\n", count);
+ fprintf(fp, "/*\n");
+ fprintf(fp, " * vector.h\n");
+ fprintf(fp, " * Macros for interrupt vector routines\n");
+ fprintf(fp, " * Generated by config program\n");
+ fprintf(fp, " */\n\n");
+ fprintf(fp, "#define\tDEVICE_NAMES \"\\\n");
+ fprintf(fp, "clk0 irqnn\\0\\\n");
+#ifdef STATCLOCK
+ /*
+ * XXX _all_ devices should be configured so that there is no need
+ * for kludges like this.
+ */
+ fprintf(fp, "rtc0 irqnn\\0\\\n");
+ dev_id = 2;
+#else
+ dev_id = 1;
+#endif
+ vector_devtab(fp, "bio", &dev_id);
+ vector_devtab(fp, "tty", &dev_id);
+ vector_devtab(fp, "net", &dev_id);
+ vector_devtab(fp, "null", &dev_id);
+ fprintf(fp, "\"\n\n");
+ fprintf(fp, "#define\tNR_DEVICES\t%d\n", dev_id);
(void) fclose(fp);
}
-build_vector(fp, dp, id, offset)
- register FILE *fp;
- register struct device *dp;
- struct idlst *id;
- int offset;
+vector_devtab(fp, table, dev_idp)
+ FILE *fp;
+ char *table;
+ int *dev_idp;
{
- fprintf(fp, "\tBUILD_%sVECTOR(%s%d, %d,%d,%d",
- strcmp(dp->d_name, "sio") == 0 ? "FAST_" : "",
- dp->d_name, dp->d_unit, dp->d_unit, dp->d_irq, offset);
- if (eq(dp->d_mask, "null"))
- fprintf(fp, ", _%s%d_imask,", dp->d_name, dp->d_unit);
- else
- fprintf(fp, ", _%s_imask, ", dp->d_mask);
- fprintf(fp, " _%s,%d,1", id->id, 1 + dp->d_irq / 8);
- if (dp->d_irq < 8)
- fprintf(fp, ", al");
- else
- fprintf(fp, "_AND_2, ah");
- fprintf(fp, ");\\\n");
+ register struct device *dp, *mp;
+
+ for (dp = dtab; dp != NULL; dp = dp->d_next) {
+ if (dp->d_unit == QUES || !eq(dp->d_mask, table))
+ continue;
+ mp = dp->d_conn;
+ if (mp == NULL || mp == TO_NEXUS || !eq(mp->d_name, "isa"))
+ continue;
+ fprintf(fp, "%s%d irqnn\\0\\\n", dp->d_name, dp->d_unit);
+ (*dev_idp)++;
+ }
}
OpenPOWER on IntegriCloud