pte has moved, isn't needed
[unix-history] / usr / src / usr.sbin / config / mkioconf.c
index 08dde08..2c871e6 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)mkioconf.c 5.16 (Berkeley) %G%";
+static char sccsid[] = "@(#)mkioconf.c 5.18 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <stdio.h>
 #endif /* not lint */
 
 #include <stdio.h>
@@ -449,7 +449,6 @@ hp300_ioconf()
                perror(path("ioconf.c"));
                exit(1);
        }
                perror(path("ioconf.c"));
                exit(1);
        }
-       fprintf(fp, "#include \"hp300/include/pte.h\"\n");
        fprintf(fp, "#include \"sys/param.h\"\n");
        fprintf(fp, "#include \"sys/buf.h\"\n");
        fprintf(fp, "#include \"sys/map.h\"\n");
        fprintf(fp, "#include \"sys/param.h\"\n");
        fprintf(fp, "#include \"sys/buf.h\"\n");
        fprintf(fp, "#include \"sys/map.h\"\n");
@@ -577,6 +576,143 @@ wnum(num)
 }
 #endif
 
 }
 #endif
 
+#if MACHINE_I386
+char *sirq();
+
+i386_ioconf()
+{
+       register struct device *dp, *mp, *np;
+       register int uba_n, slave;
+       FILE *fp;
+
+       fp = fopen(path("ioconf.c"), "w");
+       if (fp == 0) {
+               perror(path("ioconf.c"));
+               exit(1);
+       }
+       fprintf(fp, "/*\n");
+       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, "#include \"sys/map.h\"\n");
+       fprintf(fp, "#include \"sys/vm.h\"\n");
+       fprintf(fp, "\n");
+       fprintf(fp, "#define V(s)       V/**/s\n");
+       fprintf(fp, "#define C (caddr_t)\n\n");
+       /*
+        * First print the isa initialization structures
+        */
+       if (seen_isa) {
+
+               fprintf(fp, "/*\n");
+               fprintf(fp, " * ISA devices\n");
+               fprintf(fp, " */\n\n");
+               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");
+
+               for (dp = dtab; dp != 0; dp = dp->d_next) {
+                       mp = dp->d_conn;
+                       if (mp == 0 || mp == TO_NEXUS ||
+                           !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);
+               }
+               fprintf(fp, "\nstruct isa_device isa_devtab_bio[] = {\n");
+               fprintf(fp, "\
+/* driver      iobase  irq   drq     maddr    msiz    intr   unit */\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 (dp->d_port)
+                fprintf(fp, "{ &%sdriver,  %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 },\n",
+                               sirq(dp->d_irq), dp->d_drq, dp->d_maddr,
+                        dp->d_msize, dp->d_name, dp->d_unit, dp->d_unit);
+               }
+               fprintf(fp, "0\n};\n");
+
+               fprintf(fp, "struct isa_device isa_devtab_tty[] = {\n");
+               fprintf(fp, "\
+/* driver      iobase  irq   drq     maddr    msiz    intr   unit */\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 (dp->d_port)
+                fprintf(fp, "{ &%sdriver,  %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 },\n",
+                               sirq(dp->d_irq), dp->d_drq, dp->d_maddr,
+                        dp->d_msize, dp->d_name, dp->d_unit, dp->d_unit);
+               }
+               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 */\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 (dp->d_port)
+                fprintf(fp, "{ &%sdriver,  %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 },\n",
+                               sirq(dp->d_irq), dp->d_drq, dp->d_maddr,
+                        dp->d_msize, dp->d_name, dp->d_unit, dp->d_unit);
+               }
+               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 */\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 (dp->d_port)
+                fprintf(fp, "{ &%sdriver,  %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 },\n",
+                               sirq(dp->d_irq), dp->d_drq, dp->d_maddr,
+                        dp->d_msize, dp->d_name, dp->d_unit, dp->d_unit);
+               }
+               fprintf(fp, "0\n};\n\n");
+       }
+       (void) fclose(fp);
+}
+
+char *
+sirq(num)
+{
+
+       if (num == -1)
+               return ("0");
+       sprintf(errbuf, "IRQ%d", num);
+       return (errbuf);
+}
+#endif
+
 char *
 intv(dev)
        register struct device *dev;
 char *
 intv(dev)
        register struct device *dev;