summaryrefslogtreecommitdiffstats
path: root/usr.sbin/config/mkioconf.c
diff options
context:
space:
mode:
authordfr <dfr@FreeBSD.org>1998-06-09 14:02:08 +0000
committerdfr <dfr@FreeBSD.org>1998-06-09 14:02:08 +0000
commit9d3db765ca348dc273a136848d1d42795119d828 (patch)
treeb46c3f8bab6df5cdaff202789c82b429c5a15e13 /usr.sbin/config/mkioconf.c
parenta89f496cbf1aff49309b74d4f717d397d95dd30b (diff)
downloadFreeBSD-src-9d3db765ca348dc273a136848d1d42795119d828.zip
FreeBSD-src-9d3db765ca348dc273a136848d1d42795119d828.tar.gz
Add (mostly stub) alpha support. Incidentally, it doesn't build on stable
unless I manually construct y.tab.h. Is this normal?
Diffstat (limited to 'usr.sbin/config/mkioconf.c')
-rw-r--r--usr.sbin/config/mkioconf.c105
1 files changed, 104 insertions, 1 deletions
diff --git a/usr.sbin/config/mkioconf.c b/usr.sbin/config/mkioconf.c
index b7053a0..6bb4b92 100644
--- a/usr.sbin/config/mkioconf.c
+++ b/usr.sbin/config/mkioconf.c
@@ -36,7 +36,7 @@
static char sccsid[] = "@(#)mkioconf.c 8.2 (Berkeley) 1/21/94";
#endif
static const char rcsid[] =
- "$Id: mkioconf.c,v 1.34 1998/04/02 04:25:41 eivind Exp $";
+ "$Id: mkioconf.c,v 1.35 1998/05/02 01:57:39 kato Exp $";
#endif /* not lint */
#include <err.h>
@@ -1218,6 +1218,109 @@ news_ioconf()
}
#endif
+#if MACHINE_ALPHA
+void
+alpha_ioconf()
+{
+ register struct device *dp, *mp;
+ FILE *fp;
+ FILE *fp1;
+ int dev_id = 10;
+
+ fp = fopen(path("ioconf.c.new"), "w");
+ if (fp == 0)
+ err(1, "%s", path("ioconf.c"));
+ fprintf(fp, "#include <sys/types.h>\n");
+ fprintf(fp, "#include <sys/time.h>\n");
+ fprintf(fp, "#include <ioconf.h>\n\n");
+ fprintf(fp, "#define C (char *)\n\n");
+ fp1 = fopen(path("ioconf.h.new"), "w");
+ if (fp1 == 0)
+ err(1, "%s", path("ioconf.h.new"));
+ fprintf(fp1, "/*\n");
+ fprintf(fp1, " * Extern declarations for I/O configuration.\n");
+ fprintf(fp1, " * DO NOT EDIT-- this file is automatically generated.\n");
+ fprintf(fp1, " */\n");
+ fprintf(fp1, "\n");
+ fprintf(fp1, "#ifndef IOCONF_H\n");
+ fprintf(fp1, "#define\tIOCONF_H\n");
+
+#if 0
+ /* print controller initialization structures */
+ for (dp = dtab; dp != 0; dp = dp->d_next) {
+ if (dp->d_type == PSEUDO_DEVICE)
+ continue;
+ fprintf(fp, "extern struct driver %sdriver;\n", dp->d_name);
+ }
+ fprintf(fp, "\nstruct alpha_ctlr alpha_cinit[] = {\n");
+ fprintf(fp, "/*\tdriver,\t\tunit,\taddr,\t\tpri,\tflags */\n");
+ for (dp = dtab; dp != 0; dp = dp->d_next) {
+ if (dp->d_type != CONTROLLER && dp->d_type != MASTER)
+ continue;
+ if (dp->d_conn != TO_NEXUS) {
+ printf("%s%s must be attached to a nexus (internal bus)\n",
+ 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));
+ continue;
+ }
+ if (dp->d_unit == UNKNOWN || dp->d_unit == QUES)
+ dp->d_unit = 0;
+ fprintf(fp,
+ "\t{ &%sdriver,\t%d,\tC 0x%x,\t%d,\t0x%x },\n",
+ dp->d_name, dp->d_unit, dp->d_addr, dp->d_pri,
+ dp->d_flags);
+ }
+ fprintf(fp, "\t0\n};\n");
+
+ /* print devices connected to other controllers */
+ fprintf(fp, "\nstruct scsi_device scsi_dinit[] = {\n");
+ fprintf(fp,
+ "/*driver,\tcdriver,\tunit,\tctlr,\tdrive,\tslave,\tdk,\tflags*/\n");
+ for (dp = dtab; dp != 0; dp = dp->d_next) {
+ if (dp->d_type == CONTROLLER || dp->d_type == MASTER ||
+ dp->d_type == PSEUDO_DEVICE)
+ continue;
+ mp = dp->d_conn;
+ if (mp == 0 ||
+ (!eq(mp->d_name, "asc") && !eq(mp->d_name, "sii"))) {
+ printf("%s%s: devices must be attached to a SCSI (asc or sii) controller\n",
+ dp->d_name, wnum(dp->d_unit));
+ continue;
+ }
+ if ((unsigned)dp->d_drive > 6) {
+ printf("%s%s: SCSI drive must be in the range 0..6\n",
+ dp->d_name, wnum(dp->d_unit));
+ continue;
+ }
+ /* may want to allow QUES later */
+ if ((unsigned)dp->d_slave > 7) {
+ printf("%s%s: SCSI slave (LUN) must be in the range 0..7\n",
+ dp->d_name, wnum(dp->d_unit));
+ continue;
+ }
+ fprintf(fp, "{ &%sdriver,\t&%sdriver,", dp->d_name, mp->d_name);
+ fprintf(fp, "\t%d,\t%d,\t%d,\t%d,\t%d,\t0x%x },\n",
+ dp->d_unit, mp->d_unit, dp->d_drive, dp->d_slave,
+ dp->d_dk, dp->d_flags);
+ }
+ fprintf(fp, "0\n};\n");
+#endif
+ if (seen_scbus)
+ scbus_devtab(fp, fp1, &dev_id);
+
+ (void) fclose(fp);
+ fprintf(fp1, "#endif\n");
+ (void) fclose(fp1);
+ moveifchanged(path("ioconf.c.new"), path("ioconf.c"));
+ moveifchanged(path("ioconf.h.new"), path("ioconf.h"));
+}
+
+#endif
+
char *
intv(dev)
register struct device *dev;
OpenPOWER on IntegriCloud