diff --git a/tools/kconfig/Makefile b/tools/kconfig/Makefile index 96fe255..106e16f 100644 --- a/tools/kconfig/Makefile +++ b/tools/kconfig/Makefile @@ -2,7 +2,7 @@ CC = gcc -g CFLAGS = -O -Wall YACC = byacc -d DESTDIR = /usr/local -OBJS = config.o main.o lang.o mkioconf.o mkmakefile.o mkglue.o mkheaders.o \ +OBJS = config.o main.o lang.o mkioconf.o mkmakefile.o mkheaders.o \ mkswapconf.o PROG = kconfig diff --git a/tools/kconfig/config.8 b/tools/kconfig/config.8 index aef26a2..3a2794c 100644 --- a/tools/kconfig/config.8 +++ b/tools/kconfig/config.8 @@ -35,34 +35,22 @@ .Dt CONFIG 8 .Os BSD 4 .Sh NAME -.Nm config +.Nm kconfig .Nd build system configuration files .Sh SYNOPSIS -.Nm config +.Nm kconfig .Op Fl p .Ar system_name .Sh DESCRIPTION .Pp -This is the old version of the -.Nm config -program. -It understands the old autoconfiguration scheme -used on the HP300, DECstation, and derivative platforms. -The new version of config is used with the -SPARC and i386 platforms. -Only the version of -.Nm config -applicable to the architecture that you are running -will be installed on your machine. -.Pp -.Nm Config +.Nm Kconfig builds a set of system configuration files from the file .Ar SYSTEM_NAME which describes the system to configure. A second file tells -.Nm config +.Nm kconfig what files are needed to generate a system and can be augmented by configuration specific set of files that give alternate files for a specific machine. @@ -76,8 +64,8 @@ Available option and operand: .It Fl p If the .Fl p -option is supplied, -.Nm config +option is supplied, +.Nm kconfig will configure a system for profiling; for example, .Xr kgmon 8 and @@ -96,19 +84,15 @@ subdirectory of the system source (usually .Nm Config assumes the directory .Pa ../SYSTEM_NAME -exists and places all output files there. +exists and places all output files there. The output of -.Nm config +.Nm kconfig consists of a number of files; for the .Tn VAX , they are: .Pa ioconf.c , a description of what I/O devices are attached to the system; -.Pa ubglue.s , -a set of interrupt service routines for devices -attached to the -.Tn UNIBUS ; .Pa ubvec.s , offsets into a structure used for counting per-device interrupts; .Pa Makefile , @@ -124,7 +108,7 @@ the disk areas to be used for swapping, the root file system, argument processing, and system dumps. .Pp After running -.Nm config , +.Nm kconfig , it is necessary to run .Dq Li make depend in the directory where the new makefile @@ -133,24 +117,24 @@ was created. prints a reminder of this when it completes. .Pp If any other error messages are produced by -.Nm config , +.Nm kconfig , the problems in the configuration file should be corrected and -.Nm config +.Nm kconfig should be run again. Attempts to compile a system that had configuration errors are likely to fail. .Sh FILES -.Bl -tag -width /sys/conf/Makefile.vax -compact -.It Pa /sys/conf/Makefile.vax +.Bl -tag -width /sys/conf/Makefile.pic32 -compact +.It Pa /sys/conf/Makefile.pic32 generic makefile for the .Tn VAX .It Pa /sys/conf/files list of common files system is built from -.It Pa /sys/conf/files.vax +.It Pa /sys/conf/files.pic32 list of .Tn VAX specific files -.It Pa /sys/conf/devices.vax +.It Pa /sys/conf/devices.pic32 name to major device mapping file for the .Tn VAX .It Pa /sys/conf/files. Ns Em ERNIE @@ -161,10 +145,8 @@ system .Sh SEE ALSO The SYNOPSIS portion of each device in section 4. .Rs -.%T "Building 4.3 BSD UNIX System with Config" +.%T "Building RetroBSD Kernel with kconfig" .Re -.sp -.Xr config.new 8 .Sh BUGS The line numbers reported in error messages are usually off by one. .Sh HISTORY diff --git a/tools/kconfig/config.h b/tools/kconfig/config.h index 9bf8ea2..dca3f9c 100644 --- a/tools/kconfig/config.h +++ b/tools/kconfig/config.h @@ -123,8 +123,6 @@ struct device { int d_irq; /* interrupt request */ struct device *d_next; /* Next one in list */ }; -#define TO_NEXUS (struct device *)-1 -#define TO_VBA (struct device *)-2 struct config { char *c_dev; @@ -133,22 +131,11 @@ struct config { /* * Config has a global notion of which machine type is - * being used. It uses the name of the machine in choosing - * files and directories. Thus if the name of the machine is ``vax'', - * it will build from ``Makefile.vax'' and use ``../vax/inline'' - * in the makerules, etc. + * being used. */ int machine; char *machinename; -#define MACHINE_VAX 1 -#define MACHINE_TAHOE 2 -#define MACHINE_HP300 3 -#define MACHINE_I386 4 -#define MACHINE_MIPS 5 -#define MACHINE_PMAX 6 -#define MACHINE_LUNA68K 7 -#define MACHINE_NEWS3400 8 -#define MACHINE_PIC32 9 +#define MACHINE_PIC32 1 /* * For each machine, a set of CPU's may be specified as supported. @@ -182,15 +169,6 @@ char *raise(); int do_trace; -#if MACHINE_VAX -int seen_mba, seen_uba; -#endif -#if MACHINE_TAHOE -int seen_vba; -#endif -#if MACHINE_I386 -int seen_isa; -#endif int seen_cd; struct device *connect(); @@ -215,17 +193,7 @@ int maxusers; void init_dev(register struct device *dp); int yyparse(void); -void vax_ioconf(void); -void tahoe_ioconf(void); -void hp300_ioconf(void); -void i386_ioconf(void); -void pmax_ioconf(void); void pic32_ioconf(void); -void news_ioconf(void); -void ubglue(void); -void vbglue(void); -void hpglue(void); -void vector(void); void makefile(void); void headers(void); void swapconf(void); diff --git a/tools/kconfig/config.y b/tools/kconfig/config.y index 8382695..c7bb148 100644 --- a/tools/kconfig/config.y +++ b/tools/kconfig/config.y @@ -7,9 +7,7 @@ %token AND %token ANY -%token ARGS %token AT -%token BIO %token COMMA %token CONFIG %token CONTROLLER @@ -18,7 +16,6 @@ %token DEVICE %token DISK %token DRIVE -%token DRQ %token DST %token DUMPS %token EQUALS @@ -26,9 +23,6 @@ %token HZ %token IDENT %token INTERLEAVE -%token IOMEM -%token IOSIZ -%token IRQ %token LDSCRIPT %token MACHINE %token MAJOR @@ -36,12 +30,9 @@ %token MAXUSERS %token MINOR %token MINUS -%token NET -%token NEXUS %token ON %token OPTIONS %token MAKEOPTIONS -%token PORT %token PRIORITY %token PSEUDO_DEVICE %token ROOT @@ -51,7 +42,6 @@ %token SLAVE %token SWAP %token TIMEZONE -%token TTY %token TRACE %token VECTOR @@ -154,33 +144,9 @@ Spec: Config_spec: MACHINE Save_id = { - if (!strcmp($2, "vax")) { - machine = MACHINE_VAX; - machinename = "vax"; - } else if (!strcmp($2, "tahoe")) { - machine = MACHINE_TAHOE; - machinename = "tahoe"; - } else if (!strcmp($2, "hp300")) { - machine = MACHINE_HP300; - machinename = "hp300"; - } else if (!strcmp($2, "i386")) { - machine = MACHINE_I386; - machinename = "i386"; - } else if (!strcmp($2, "mips")) { - machine = MACHINE_MIPS; - machinename = "mips"; - } else if (!strcmp($2, "pmax")) { - machine = MACHINE_PMAX; - machinename = "pmax"; - } else if (!strcmp($2, "pic32")) { + if (strcmp($2, "pic32") == 0) { machine = MACHINE_PIC32; machinename = "pic32"; - } else if (!strcmp($2, "luna68k")) { - machine = MACHINE_LUNA68K; - machinename = "luna68k"; - } else if (!strcmp($2, "news3400")) { - machine = MACHINE_NEWS3400; - machinename = "news3400"; } else yyerror("Unknown machine type"); } @@ -272,12 +238,10 @@ System_parameter: root_spec | dump_spec - | - arg_spec ; swap_spec: - SWAP optional_on swap_device_list + SWAP optional_on swap_device_list ; swap_device_list: @@ -353,11 +317,6 @@ dump_device_spec: major_minor ; -arg_spec: - ARGS optional_on arg_device_spec - = { yyerror("arg device specification obsolete, ignored"); } - ; - arg_device_spec: device_name = { $$ = nametodev($1, 0, 'b'); } @@ -576,14 +535,6 @@ Dev_name: Init_dev Dev NUMBER = { cur.d_name = $2; - if (eq($2, "mba")) - seen_mba = 1; - else if (eq($2, "uba")) - seen_uba = 1; - else if (eq($2, "vba")) - seen_vba = 1; - else if (eq($2, "isa")) - seen_isa = 1; cur.d_unit = $3; } ; @@ -611,9 +562,6 @@ Con_info: } cur.d_conn = connect($2, $3); } - | - AT NEXUS NUMBER - = { check_nexus(&cur, $3); cur.d_conn = TO_NEXUS; } ; Info_list: @@ -631,40 +579,13 @@ Info: | SLAVE NUMBER = { - if (cur.d_conn != 0 && cur.d_conn != TO_NEXUS && + if (cur.d_conn != 0 && cur.d_conn->d_type == MASTER) cur.d_slave = $2; else yyerror("can't specify slave--not to master"); } | - IRQ NUMBER - = { cur.d_irq = $2; } - | - DRQ NUMBER - = { cur.d_drq = $2; } - | - IOMEM NUMBER - = { cur.d_maddr = $2; } - | - IOSIZ NUMBER - = { cur.d_msize = $2; } - | - PORT device_name - = { cur.d_port = ns($2); } - | - PORT NUMBER - = { cur.d_portn = $2; } - | - TTY - = { cur.d_mask = "tty"; } - | - BIO - = { cur.d_mask = "bio"; } - | - NET - = { cur.d_mask = "net"; } - | FLAGS NUMBER = { cur.d_flags = $2; } ; @@ -927,12 +848,12 @@ huhcon(dev) * Connect it to the same thing that other similar things are * connected to, but make sure it is a wildcard unit * (e.g. up connected to sc ?, here we make connect sc? to a - * uba?). If other things like this are on the NEXUS or - * if they aren't connected to anything, then make the same + * uba?). If other things like this + * aren't connected to anything, then make the same * connection, else call ourself to connect to another * unspecific device. */ - if (dcp == TO_NEXUS || dcp == 0) + if (dcp == 0) dp->d_conn = dcp; else dp->d_conn = connect(dcp->d_name, QUES); @@ -968,34 +889,7 @@ void check_nexus(dev, num) { switch (machine) { - case MACHINE_VAX: - if (!eq(dev->d_name, "uba") && !eq(dev->d_name, "mba") && - !eq(dev->d_name, "bi")) - yyerror("only uba's, mba's, and bi's should be connected to the nexus"); - if (num != QUES) - yyerror("can't give specific nexus numbers"); - break; - - case MACHINE_TAHOE: - if (!eq(dev->d_name, "vba")) - yyerror("only vba's should be connected to the nexus"); - break; - - case MACHINE_HP300: - case MACHINE_LUNA68K: - if (num != QUES) - dev->d_addr = num; - break; - - case MACHINE_I386: - if (!eq(dev->d_name, "isa")) - yyerror("only isa's should be connected to the nexus"); - break; - - case MACHINE_NEWS3400: - if (!eq(dev->d_name, "iop") && !eq(dev->d_name, "hb") && - !eq(dev->d_name, "vme")) - yyerror("only iop's, hb's and vme's should be connected to the nexus"); + case MACHINE_PIC32: break; } } diff --git a/tools/kconfig/lang.l b/tools/kconfig/lang.l index 51f3322..be4276e 100644 --- a/tools/kconfig/lang.l +++ b/tools/kconfig/lang.l @@ -52,11 +52,7 @@ struct kt { int kt_val; } key_words[] = { { "and", AND }, - { "args", ARGS }, { "at", AT }, -#if MACHINE_I386 - { "bio", BIO }, -#endif { "config", CONFIG }, { "controller", CONTROLLER }, { "cpu", CPU }, @@ -64,20 +60,12 @@ struct kt { { "device", DEVICE }, { "disk", DISK }, { "drive", DRIVE }, -#if MACHINE_I386 - { "drq", DRQ }, -#endif { "dst", DST }, { "dumps", DUMPS }, { "flags", FLAGS }, { "hz", HZ }, { "ident", IDENT }, { "interleave", INTERLEAVE }, -#if MACHINE_I386 - { "iomem", IOMEM }, - { "iosiz", IOSIZ }, - { "irq", IRQ }, -#endif { "ldscript", LDSCRIPT }, { "machine", MACHINE }, { "major", MAJOR }, @@ -85,29 +73,16 @@ struct kt { { "master", MASTER }, { "maxusers", MAXUSERS }, { "minor", MINOR }, -#if MACHINE_I386 - { "net", NET }, -#endif - { "nexus", NEXUS }, { "on", ON }, { "options", OPTIONS }, -#if MACHINE_I386 - { "port", PORT }, -#endif { "priority", PRIORITY }, { "pseudo-device", PSEUDO_DEVICE }, { "root", ROOT }, -#if MACHINE_HP300 || MACHINE_LUNA68K - { "scode", NEXUS }, -#endif { "sequential", SEQUENTIAL }, { "size", SIZE }, { "slave", SLAVE }, { "swap", SWAP }, { "tape", DEVICE }, -#if MACHINE_I386 - { "tty", TTY }, -#endif { "timezone", TIMEZONE }, { "trace", TRACE }, { "vector", VECTOR }, diff --git a/tools/kconfig/main.c b/tools/kconfig/main.c index 99e83fc..065d755 100644 --- a/tools/kconfig/main.c +++ b/tools/kconfig/main.c @@ -97,44 +97,15 @@ usage: fputs("usage: config [-gp] sysname\n", stderr); compp = &comp_list; if (yyparse()) exit(3); + switch (machine) { - case MACHINE_VAX: - vax_ioconf(); /* Print ioconf.c */ - ubglue(); /* Create ubglue.s */ - break; - - case MACHINE_TAHOE: - tahoe_ioconf(); - vbglue(); - break; - - case MACHINE_HP300: - case MACHINE_LUNA68K: - hp300_ioconf(); - hpglue(); - break; - - case MACHINE_I386: - i386_ioconf(); /* Print ioconf.c */ - vector(); /* Create vector.s */ - break; - - case MACHINE_MIPS: - case MACHINE_PMAX: - pmax_ioconf(); - break; - case MACHINE_PIC32: pic32_ioconf(); break; - case MACHINE_NEWS3400: - news_ioconf(); - break; - default: - printf("Specify machine type, e.g. ``machine vax''\n"); + printf("Specify machine type, e.g. ``machine pic32''\n"); exit(1); } makefile(); /* build Makefile */ diff --git a/tools/kconfig/mkglue.c b/tools/kconfig/mkglue.c deleted file mode 100644 index 7b1f308..0000000 --- a/tools/kconfig/mkglue.c +++ /dev/null @@ -1,402 +0,0 @@ -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * 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. - */ - -/* - * Make the bus adaptor interrupt glue files. - */ -#include -#include "config.h" -#include "y.tab.h" -#include - -static int cntcnt = 0; /* number of interrupt counters allocated */ - -/* - * Print a UNIBUS interrupt vector. - */ -void dump_ubavec(fp, vector, number) - register FILE *fp; - char *vector; - int number; -{ - char nbuf[80]; - register char *v = nbuf; - - (void) sprintf(v, "%s%d", vector, number); - fprintf(fp, "\t.globl\t_X%s\n\t.align\t2\n_X%s:\n\tpushr\t$0x3f\n", - v, v); - fprintf(fp, "\tincl\t_fltintrcnt+(4*%d)\n", cntcnt++); - if (strncmp(vector, "dzx", 3) == 0) - fprintf(fp, "\tmovl\t$%d,r0\n\tjmp\tdzdma\n\n", number); - else if (strncmp(vector, "dpx", 3) == 0) - fprintf(fp, "\tmovl\t$%d,r0\n\tjmp\tdpxdma\n\n", number); - else if (strncmp(vector, "dpr", 3) == 0) - fprintf(fp, "\tmovl\t$%d,r0\n\tjmp\tdprdma\n\n", number); - else { - if (strncmp(vector, "uur", 3) == 0) { - fprintf(fp, "#ifdef UUDMA\n"); - fprintf(fp, "\tmovl\t$%d,r0\n\tjsb\tuudma\n", number); - fprintf(fp, "#endif\n"); - } - fprintf(fp, "\tpushl\t$%d\n", number); - fprintf(fp, "\tcalls\t$1,_%s\n\tpopr\t$0x3f\n", vector); - fprintf(fp, "\tincl\t_cnt+V_INTR\n\trei\n\n"); - } -} - -static char *vaxinames[] = { - "clock", "cnr", "cnx", "tur", "tux", - "mba0", "mba1", "mba2", "mba3", - "uba0", "uba1", "uba2", "uba3" -}; - -static char *tahoeinames[] = { - "clock", "cnr", "cnx", "rmtr", "rmtx", "buserr", -}; - -static struct stdintrs { - char **si_names; /* list of standard interrupt names */ - int si_n; /* number of such names */ -} stdintrs[] = { - { vaxinames, sizeof (vaxinames) / sizeof (vaxinames[0]) }, - { tahoeinames, (sizeof (tahoeinames) / sizeof (tahoeinames[0])) } -}; - -/* - * Start the interrupt name table with the names - * of the standard vectors not directly associated - * with a bus. Also, dump the defines needed to - * reference the associated counters into a separate - * file which is prepended to locore.s. - */ -void dump_std(fp, gp) - register FILE *fp, *gp; -{ - register struct stdintrs *si = &stdintrs[machine-1]; - register char **cpp; - register int i; - - fprintf(fp, "\n\t.globl\t_intrnames\n"); - fprintf(fp, "\n\t.globl\t_eintrnames\n"); - fprintf(fp, "\t.data\n"); - fprintf(fp, "_intrnames:\n"); - cpp = si->si_names; - for (i = 0; i < si->si_n; i++) { - register char *cp, *tp; - char buf[80]; - - cp = *cpp; - if (cp[0] == 'i' && cp[1] == 'n' && cp[2] == 't') { - cp += 3; - if (*cp == 'r') - cp++; - } - for (tp = buf; *cp; cp++) - if (islower(*cp)) - *tp++ = toupper(*cp); - else - *tp++ = *cp; - *tp = '\0'; - fprintf(gp, "#define\tI_%s\t%d\n", buf, i * (int)sizeof (long)); - fprintf(fp, "\t.asciz\t\"%s\"\n", *cpp); - cpp++; - } -} - -void dump_intname(fp, vector, number) - register FILE *fp; - char *vector; - int number; -{ - register char *cp = vector; - - fprintf(fp, "\t.asciz\t\""); - /* - * Skip any "int" or "intr" in the name. - */ - while (*cp) - if (cp[0] == 'i' && cp[1] == 'n' && cp[2] == 't') { - cp += 3; - if (*cp == 'r') - cp++; - } else { - putc(*cp, fp); - cp++; - } - fprintf(fp, "%d\"\n", number); -} - -/* - * Reserve space for the interrupt counters. - */ -void dump_ctrs(fp) - register FILE *fp; -{ - struct stdintrs *si = &stdintrs[machine-1]; - - fprintf(fp, "_eintrnames:\n"); - fprintf(fp, "\n\t.globl\t_intrcnt\n"); - fprintf(fp, "\n\t.globl\t_eintrcnt\n"); - fprintf(fp, "\t.align 2\n"); - fprintf(fp, "_intrcnt:\n"); - fprintf(fp, "\t.space\t4 * %d\n", si->si_n); - fprintf(fp, "_fltintrcnt:\n"); - fprintf(fp, "\t.space\t4 * %d\n", cntcnt); - fprintf(fp, "_eintrcnt:\n\n"); - fprintf(fp, "\t.text\n"); -} - -/* - * Create the UNIBUS interrupt vector glue file. - */ -void ubglue() -{ - register FILE *fp, *gp; - register struct device *dp, *mp; - - fp = fopen(path("ubglue.s"), "w"); - if (fp == 0) { - perror(path("ubglue.s")); - exit(1); - } - gp = fopen(path("ubvec.s"), "w"); - if (gp == 0) { - perror(path("ubvec.s")); - exit(1); - } - for (dp = dtab; dp != 0; dp = dp->d_next) { - mp = dp->d_conn; - if (mp != 0 && mp != (struct device *)-1 && - !eq(mp->d_name, "mba")) { - 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) { - dump_ubavec(fp, id->id, - dp->d_unit); - break; - } - if (!strcmp(id->id, id2->id)) - break; - } - } - } - } - dump_std(fp, gp); - for (dp = dtab; dp != 0; dp = dp->d_next) { - mp = dp->d_conn; - if (mp != 0 && mp != (struct device *)-1 && - !eq(mp->d_name, "mba")) { - 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) { - dump_intname(fp, id->id, - dp->d_unit); - break; - } - if (!strcmp(id->id, id2->id)) - break; - } - } - } - } - dump_ctrs(fp); - (void) fclose(fp); - (void) fclose(gp); -} - -/* - * Print a VERSAbus interrupt vector - */ -void dump_vbavec(fp, vector, number) - register FILE *fp; - char *vector; - int number; -{ - char nbuf[80]; - register char *v = nbuf; - - (void) sprintf(v, "%s%d", vector, number); - fprintf(fp, "SCBVEC(%s):\n", v); - fprintf(fp, "\tCHECK_SFE(4)\n"); - fprintf(fp, "\tSAVE_FPSTAT(4)\n"); - fprintf(fp, "\tPUSHR\n"); - fprintf(fp, "\tincl\t_fltintrcnt+(4*%d)\n", cntcnt++); - fprintf(fp, "\tpushl\t$%d\n", number); - fprintf(fp, "\tcallf\t$8,_%s\n", vector); - fprintf(fp, "\tincl\t_cnt+V_INTR\n"); - fprintf(fp, "\tPOPR\n"); - fprintf(fp, "\tREST_FPSTAT\n"); - fprintf(fp, "\trei\n\n"); -} - -/* - * Create the VERSAbus interrupt vector glue file. - */ -void vbglue() -{ - register FILE *fp, *gp; - register struct device *dp, *mp; - - fp = fopen(path("vbglue.s"), "w"); - if (fp == 0) { - perror(path("vbglue.s")); - exit(1); - } - gp = fopen(path("vbvec.s"), "w"); - if (gp == 0) { - perror(path("vbvec.s")); - exit(1); - } - for (dp = dtab; dp != 0; dp = dp->d_next) { - struct idlst *id, *id2; - - mp = dp->d_conn; - if (mp == 0 || mp == (struct device *)-1 || - eq(mp->d_name, "mba")) - continue; - for (id = dp->d_vec; id; id = id->id_next) - for (id2 = dp->d_vec; id2; id2 = id2->id_next) { - if (id == id2) { - dump_vbavec(fp, id->id, dp->d_unit); - break; - } - if (eq(id->id, id2->id)) - break; - } - } - dump_std(fp, gp); - for (dp = dtab; dp != 0; dp = dp->d_next) { - mp = dp->d_conn; - if (mp != 0 && mp != (struct device *)-1 && - !eq(mp->d_name, "mba")) { - 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) { - dump_intname(fp, id->id, - dp->d_unit); - break; - } - if (eq(id->id, id2->id)) - break; - } - } - } - } - dump_ctrs(fp); - (void) fclose(fp); - (void) fclose(gp); -} - -/* - * HP9000/300 interrupts are auto-vectored. - * Code is hardwired in locore.s - */ -void hpglue() -{ -} - -/* - * Create the ISA interrupt vector glue file. - */ -void vector() -{ - register FILE *fp; - register struct device *dp, *mp; - int count; - - fp = fopen(path("vector.s"), "w"); - if (fp == 0) { - perror(path("vector.s")); - exit(1); - } - fprintf(fp,"\ -/*\n\ - * AT/386\n\ - * Interrupt vector routines\n\ - * Generated by config program\n\ - */ \n\ -\n\ -#include \"i386/isa/isa.h\"\n\ -#include \"i386/isa/icu.h\"\n\ -\n\ -#define VEC(name) .align 4; .globl _V/**/name; _V/**/name:\n\n"); - - fprintf(fp,"\ - .globl _hardclock\n\ -VEC(clk)\n\ - INTR1(0, _highmask, 0)\n\ - call _hardclock \n\ - INTREXIT1\n\n\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.globl _%s, _%s%dmask\n\t.data\n", - id->id, dp->d_name, dp->d_unit); - fprintf(fp,"_%s%dmask:\t.long 0\n\t.text\n", - dp->d_name, dp->d_unit); - fprintf(fp,"VEC(%s%d)\n\tINTR%d(%d, ", - dp->d_name, dp->d_unit, - dp->d_irq / 8 + 1, dp->d_unit); - if(eq(dp->d_mask,"null")) - fprintf(fp,"_%s%dmask, ", - dp->d_name, dp->d_unit); - else - fprintf(fp,"_%smask, ", - dp->d_mask); - fprintf(fp,"%d)\n\tcall\t_%s\n\tINTREXIT%d\n\n\n", - ++count, id->id, (dp->d_irq > 7)?2:1); - break; - } - if (!strcmp(id->id, id2->id)) - break; - } - } - } - } - (void) fclose(fp); -} diff --git a/tools/kconfig/mkheaders.c b/tools/kconfig/mkheaders.c index 3d12540..9cf7191 100644 --- a/tools/kconfig/mkheaders.c +++ b/tools/kconfig/mkheaders.c @@ -152,8 +152,7 @@ void do_count(dev, hname, search) hicount = dp->d_unit + 1; if (search) { mp = dp->d_conn; - if (mp != 0 && mp != TO_NEXUS && - mp->d_conn != 0 && mp->d_conn != TO_NEXUS) { + if (mp != 0 && mp->d_conn != 0) { do_count(mp->d_name, hname, 0); search = 0; } diff --git a/tools/kconfig/mkioconf.c b/tools/kconfig/mkioconf.c index 0642600..3b763b1 100644 --- a/tools/kconfig/mkioconf.c +++ b/tools/kconfig/mkioconf.c @@ -35,787 +35,95 @@ #include "y.tab.h" #include "config.h" +static void +comp_config(fp) + FILE *fp; +{ + register struct file_list *fl; + register struct device *dp; + + fprintf(fp, "\n#include \"dev/cdvar.h\"\n"); + fprintf(fp, "\nstruct cddevice cddevice[] = {\n"); + fprintf(fp, "/*\tunit\tileave\tflags\tdk\tdevs\t\t\t\t*/\n"); + + fl = comp_list; + while (fl) { + if (fl->f_type != COMPDEVICE) { + fl = fl->f_next; + continue; + } + for (dp = dtab; dp != 0; dp = dp->d_next) + if (dp->d_type == DEVICE && + eq(dp->d_name, fl->f_fn) && + dp->d_unit == fl->f_compinfo) + break; + if (dp == 0) + continue; + fprintf(fp, "\t%d,\t%d,\t%d,\t%d,\t{", + dp->d_unit, dp->d_pri < 0 ? 0 : dp->d_pri, + dp->d_flags, 1); + for (fl = fl->f_next; fl->f_type == COMPSPEC; fl = fl->f_next) + fprintf(fp, " 0x%x,", (unsigned) fl->f_compdev); + fprintf(fp, " NODEV },\n"); + } + fprintf(fp, "\t-1,\t0,\t0,\t0,\t{ 0 },\n};\n"); +} + /* * build the ioconf.c file */ -char *qu(); -char *intv(); -char *wnum(); -void pseudo_ioconf(); - -#if MACHINE_VAX -void vax_ioconf() +static void +pseudo_ioconf(fp) + register FILE *fp; { - register struct device *dp, *mp, *np; - register int uba_n, slave; - FILE *fp; + register struct device *dp; - fp = fopen(path("ioconf.c"), "w"); - if (fp == 0) { - perror(path("ioconf.c")); - exit(1); - } - fprintf(fp, "#include \"vax/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, "\n"); - fprintf(fp, "#include \"vax/mba/mbavar.h\"\n"); - fprintf(fp, "#include \"vax/uba/ubavar.h\"\n\n"); - fprintf(fp, "\n"); - fprintf(fp, "#define C (caddr_t)\n\n"); - - /* - * First print the mba initialization structures - */ - if (seen_mba) { - for (dp = dtab; dp != 0; dp = dp->d_next) { - mp = dp->d_conn; - if (mp == 0 || mp == TO_NEXUS || - !eq(mp->d_name, "mba")) - continue; - fprintf(fp, "extern struct mba_driver %sdriver;\n", + (void)fprintf(fp, "\n#include \n\n"); + for (dp = dtab; dp != NULL; dp = dp->d_next) + if (dp->d_type == PSEUDO_DEVICE) + (void)fprintf(fp, "extern void %sattach __P((int));\n", dp->d_name); - } - fprintf(fp, "\nstruct mba_device mbdinit[] = {\n"); - fprintf(fp, "\t/* Device, Unit, Mba, Drive, Dk */\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, "mba")) - continue; - if (dp->d_addr) { - printf("can't specify csr address on mba for %s%d\n", - 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); - continue; - } - if (dp->d_drive == UNKNOWN) { - printf("drive not specified for %s%d\n", - 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); - continue; - } - fprintf(fp, "\t{ &%sdriver, %d, %s,", - dp->d_name, dp->d_unit, qu(mp->d_unit)); - fprintf(fp, " %s, %d },\n", - qu(dp->d_drive), dp->d_dk); - } - fprintf(fp, "\t0\n};\n\n"); - /* - * 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. - */ - if ((mp = dp->d_conn) == 0 || mp == TO_NEXUS) - continue; - np = mp->d_conn; - if (np == 0 || np == TO_NEXUS || - !eq(np->d_name, "mba")) - continue; - fprintf(fp, "\t{ &%sdriver, %s", - mp->d_name, qu(mp->d_unit)); - fprintf(fp, ", %2d, %s },\n", - dp->d_unit, qu(dp->d_slave)); - } - fprintf(fp, "\t0\n};\n\n"); - } /* - * Now generate interrupt vectors for the unibus + * XXX concatonated disks are pseudo-devices but appear as DEVICEs + * since they don't adhere to normal pseudo-device conventions + * (i.e. one entry with total count in d_slave). */ - for (dp = dtab; dp != 0; dp = dp->d_next) { - if (dp->d_vec != 0) { - struct idlst *ip; - mp = dp->d_conn; - if (mp == 0 || mp == TO_NEXUS || - (!eq(mp->d_name, "uba") && !eq(mp->d_name, "bi"))) - continue; - fprintf(fp, - "extern struct uba_driver %sdriver;\n", - dp->d_name); - fprintf(fp, "extern "); - ip = dp->d_vec; - for (;;) { - fprintf(fp, "X%s%d()", ip->id, dp->d_unit); - ip = ip->id_next; - if (ip == 0) - break; - fprintf(fp, ", "); - } - fprintf(fp, ";\n"); - fprintf(fp, "int\t (*%sint%d[])() = { ", dp->d_name, - dp->d_unit); - ip = dp->d_vec; - for (;;) { - fprintf(fp, "X%s%d", ip->id, dp->d_unit); - ip = ip->id_next; - if (ip == 0) - break; - fprintf(fp, ", "); - } - fprintf(fp, ", 0 } ;\n"); - } - } - fprintf(fp, "\nstruct uba_ctlr ubminit[] = {\n"); - fprintf(fp, "/*\t driver,\tctlr,\tubanum,\talive,\tintr,\taddr */\n"); - for (dp = dtab; dp != 0; dp = dp->d_next) { - mp = dp->d_conn; - if (dp->d_type != CONTROLLER || mp == TO_NEXUS || mp == 0 || - !eq(mp->d_name, "uba")) - continue; - if (dp->d_vec == 0) { - printf("must specify vector for %s%d\n", - 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); - 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); - continue; - } - if (dp->d_flags) { - printf("controllers (e.g. %s%d) ", - 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); - } - 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"); - for (dp = dtab; dp != 0; dp = dp->d_next) { - mp = dp->d_conn; - if (dp->d_unit == QUES || dp->d_type != DEVICE || mp == 0 || - mp == TO_NEXUS || mp->d_type == MASTER || - eq(mp->d_name, "mba")) - continue; - np = mp->d_conn; - if (np != 0 && np != TO_NEXUS && eq(np->d_name, "mba")) - continue; - np = 0; - 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); - continue; - } - if (dp->d_addr == 0) { - printf("must specify csr for device %s%d\n", - 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); - continue; - } - uba_n = mp->d_unit; - slave = QUES; - } else { - if ((np = mp->d_conn) == 0) { - printf("%s%d isn't connected to anything ", - mp->d_name, mp->d_unit); - printf(", so %s%d is unattached\n", - dp->d_name, dp->d_unit); - continue; - } - uba_n = np->d_unit; - if (dp->d_drive == UNKNOWN) { - printf("must specify ``drive number'' "); - printf("for %s%d\n", dp->d_name, dp->d_unit); - continue; - } - /* NOTE THAT ON THE UNIBUS ``drive'' IS STORED IN */ - /* ``SLAVE'' AND WE DON'T WANT A SLAVE SPECIFIED */ - 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); - 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); - 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); - 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)); - 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); - } - fprintf(fp, "\t0\n};\n"); - pseudo_ioconf(fp); - (void) fclose(fp); -} -#endif - -#if MACHINE_TAHOE -void tahoe_ioconf() -{ - register struct device *dp, *mp, *np; - register int vba_n, slave; - FILE *fp; - - fp = fopen(path("ioconf.c"), "w"); - if (fp == 0) { - perror(path("ioconf.c")); - exit(1); - } - fprintf(fp, "#include \"sys/param.h\"\n"); - fprintf(fp, "#include \"tahoe/include/pte.h\"\n"); - fprintf(fp, "#include \"sys/buf.h\"\n"); - fprintf(fp, "#include \"sys/map.h\"\n"); - fprintf(fp, "\n"); - fprintf(fp, "#include \"tahoe/vba/vbavar.h\"\n"); - fprintf(fp, "\n"); - fprintf(fp, "#define C (caddr_t)\n\n"); + if (seen_cd) + (void)fprintf(fp, "extern void cdattach __P((int));\n"); + /* XXX temporary for HP300, others */ + (void)fprintf(fp, "\n#include /* XXX */\n"); + (void)fprintf(fp, "#define etherattach (void (*)__P((int)))nullop\n"); + (void)fprintf(fp, "#define iteattach (void (*) __P((int)))nullop\n"); + (void)fprintf(fp, "\nstruct pdevinit pdevinit[] = {\n"); + for (dp = dtab; dp != NULL; dp = dp->d_next) + if (dp->d_type == PSEUDO_DEVICE) + (void)fprintf(fp, "\t{ %sattach, %d },\n", dp->d_name, + dp->d_slave > 0 ? dp->d_slave : 1); /* - * Now generate interrupt vectors for the versabus + * XXX count up cds and put out an entry */ - for (dp = dtab; dp != 0; dp = dp->d_next) { - mp = dp->d_conn; - if (mp == 0 || mp == TO_NEXUS || !eq(mp->d_name, "vba")) - continue; - if (dp->d_vec != 0) { - struct idlst *ip; - fprintf(fp, - "extern struct vba_driver %sdriver;\n", - dp->d_name); - fprintf(fp, "extern "); - ip = dp->d_vec; - for (;;) { - fprintf(fp, "X%s%d()", ip->id, dp->d_unit); - ip = ip->id_next; - if (ip == 0) - break; - fprintf(fp, ", "); - } - fprintf(fp, ";\n"); - fprintf(fp, "int\t (*%sint%d[])() = { ", dp->d_name, - dp->d_unit); - ip = dp->d_vec; - for (;;) { - fprintf(fp, "X%s%d", ip->id, dp->d_unit); - ip = ip->id_next; - if (ip == 0) - break; - fprintf(fp, ", "); - } - fprintf(fp, ", 0 } ;\n"); - } else if (dp->d_type == DRIVER) /* devices w/o interrupts */ - fprintf(fp, - "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"); - for (dp = dtab; dp != 0; dp = dp->d_next) { - mp = dp->d_conn; - if (dp->d_type != CONTROLLER || mp == TO_NEXUS || mp == 0 || - !eq(mp->d_name, "vba")) - continue; - if (dp->d_vec == 0) { - printf("must specify vector for %s%d\n", - 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); - 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); - continue; - } - if (dp->d_flags) { - printf("controllers (e.g. %s%d) ", - 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); - } - fprintf(fp, "\t0\n};\n"); + if (seen_cd) { + struct file_list *fl; + int cdmax = -1; - /* versabus devices */ - fprintf(fp, "\nstruct vba_device vbdinit[] = {\n"); - fprintf(fp, - "\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 || - mp == TO_NEXUS || mp->d_type == MASTER || - eq(mp->d_name, "mba")) - continue; - np = mp->d_conn; - if (np != 0 && np != TO_NEXUS && eq(np->d_name, "mba")) - continue; - np = 0; - 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); - if (dp->d_addr == 0) { - printf("must specify csr for device %s%d\n", - 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); - continue; - } - vba_n = mp->d_unit; - slave = QUES; - } else { - if ((np = mp->d_conn) == 0) { - printf("%s%d isn't connected to anything ", - mp->d_name, mp->d_unit); - printf(", so %s%d is unattached\n", - dp->d_name, dp->d_unit); - continue; - } - vba_n = np->d_unit; - if (dp->d_drive == UNKNOWN) { - printf("must specify ``drive number'' "); - printf("for %s%d\n", dp->d_name, dp->d_unit); - continue; - } - /* NOTE THAT ON THE UNIBUS ``drive'' IS STORED IN */ - /* ``SLAVE'' AND WE DON'T WANT A SLAVE SPECIFIED */ - 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); - 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); - 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); - 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)); - 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); + for (fl = comp_list; fl != NULL; fl = fl->f_next) + if (fl->f_type == COMPDEVICE && fl->f_compinfo > cdmax) + cdmax = fl->f_compinfo; + (void)fprintf(fp, "\t{ cdattach, %d },\n", cdmax+1); } - fprintf(fp, "\t0\n};\n"); - pseudo_ioconf(fp); - (void) fclose(fp); -} -#endif - -#if MACHINE_HP300 || MACHINE_LUNA68K - -#define ishpibdev(n) (eq(n,"rd") || eq(n,"ct") || eq(n,"mt") || eq(n,"ppi")) -#define isscsidev(n) (eq(n,"sd") || eq(n,"st") || eq(n,"ac")) - -int hpbadslave(mp, dp) - register struct device *dp, *mp; -{ - - if ((mp == TO_NEXUS && ishpibdev(dp->d_name)) || - (mp != TO_NEXUS && eq(mp->d_name, "hpib") && - !ishpibdev(dp->d_name))) { - printf("%s%s must be attached to an hpib\n", - dp->d_name, wnum(dp->d_unit)); - return (1); - } - if ((mp == TO_NEXUS && isscsidev(dp->d_name)) || - (mp != TO_NEXUS && eq(mp->d_name, "scsi") && - !isscsidev(dp->d_name))) { - printf("%s%s must be attached to a scsi\n", - dp->d_name, wnum(dp->d_unit)); - return (1); - } - return (0); + (void)fprintf(fp, "\t{ 0, 0 }\n};\n"); + if (seen_cd) + comp_config(fp); } -void hp300_ioconf() +static char * +wnum(num) { - register struct device *dp, *mp; - register int hpib, slave; - FILE *fp; - - fp = fopen(path("ioconf.c"), "w"); - if (fp == 0) { - perror(path("ioconf.c")); - exit(1); - } - fprintf(fp, "#include \"sys/param.h\"\n"); - fprintf(fp, "#include \"sys/buf.h\"\n"); - fprintf(fp, "#include \"sys/map.h\"\n"); - fprintf(fp, "\n"); - if (machine == MACHINE_HP300) - fprintf(fp, "#include \"hp/dev/device.h\"\n\n"); - else - fprintf(fp, "#include \"luna68k/dev/device.h\"\n\n"); - fprintf(fp, "\n"); - fprintf(fp, "#define C (caddr_t)\n"); - fprintf(fp, "#define D (struct driver *)\n\n"); - /* - * First print the hpib controller initialization structures - */ - for (dp = dtab; dp != 0; dp = dp->d_next) { - mp = dp->d_conn; - if (dp->d_unit == QUES || mp == 0) - continue; - fprintf(fp, "extern struct driver %sdriver;\n", dp->d_name); - } - fprintf(fp, "\nstruct hp_ctlr hp_cinit[] = {\n"); - fprintf(fp, "/*\tdriver,\t\tunit,\talive,\taddr,\tflags */\n"); - 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)) - continue; - if (mp != TO_NEXUS) { - printf("%s%s must be attached to an sc (nexus)\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; - } - fprintf(fp, - "\t{ &%sdriver,\t%d,\t0,\tC 0x%x,\t0x%x },\n", - dp->d_name, dp->d_unit, dp->d_addr, dp->d_flags); - } - fprintf(fp, "\t0\n};\n"); - - /* devices */ - fprintf(fp, "\nstruct hp_device hp_dinit[] = {\n"); - fprintf(fp, - "/*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)) - continue; - 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)); - continue; - } - slave = QUES; - hpib = QUES; - } else { - if (dp->d_addr != 0) { - printf("can't specify sc for device %s%s\n", - 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)); - 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)); - continue; - } - slave = dp->d_slave; - } - hpib = mp->d_unit; - } - fprintf(fp, "{ &%sdriver,\t", dp->d_name); - if (mp == TO_NEXUS) - fprintf(fp, "D 0x0,\t"); - else - fprintf(fp, "&%sdriver,", mp->d_name); - fprintf(fp, "\t%d,\t%d,\t%d,\tC 0x%x,\t%d,\t0x%x },\n", - dp->d_unit, hpib, slave, - dp->d_addr, dp->d_dk, dp->d_flags); - } - fprintf(fp, "0\n};\n"); - pseudo_ioconf(fp); - (void) fclose(fp); -} -#endif - -#if MACHINE_I386 -char *sirq(int); - -void i386_ioconf() -{ - register struct device *dp, *mp; - 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, "\n"); - fprintf(fp, "#define V(s) __CONCAT(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"); - } - pseudo_ioconf(fp); - (void) fclose(fp); -} - -char * -sirq(num) -{ - - if (num == -1) - return ("0"); - sprintf(errbuf, "IRQ%d", num); + if (num == QUES || num == UNKNOWN) + return ("?"); + (void) sprintf(errbuf, "%d", num); return (errbuf); } -#endif - -#if MACHINE_PMAX -void pmax_ioconf() -{ - register struct device *dp, *mp; - FILE *fp; - - fp = fopen(path("ioconf.c"), "w"); - if (fp == 0) { - perror(path("ioconf.c")); - exit(1); - } - fprintf(fp, "#include \"sys/types.h\"\n"); - fprintf(fp, "#include \"sys/time.h\"\n"); - fprintf(fp, "#include \"mips/dev/device.h\"\n\n"); - fprintf(fp, "#define C (char *)\n\n"); - - /* 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 mips_ctlr mips_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"); - pseudo_ioconf(fp); - (void) fclose(fp); -} -#endif #if MACHINE_PIC32 void pic32_ioconf() @@ -884,270 +192,3 @@ void pic32_ioconf() (void) fclose(fp); } #endif - -#if MACHINE_NEWS3400 -int have_iop = 0; -int have_hb = 0; -int have_vme = 0; - -void news_ioconf() -{ - register struct device *dp, *mp; - register int slave; - FILE *fp; - - fp = fopen(path("ioconf.c"), "w"); - if (fp == 0) { - perror(path("ioconf.c")); - exit(1); - } - fprintf(fp, "#include \"sys/param.h\"\n"); - fprintf(fp, "#include \"sys/buf.h\"\n"); - fprintf(fp, "#include \"sys/map.h\"\n"); - fprintf(fp, "#include \"vm/vm.h\"\n"); - fprintf(fp, "#include \"iop.h\"\n"); - fprintf(fp, "#include \"hb.h\"\n"); - fprintf(fp, "\n"); - fprintf(fp, "#if NIOP > 0\n"); - fprintf(fp, "#include \"news3400/iop/iopvar.h\"\n"); - fprintf(fp, "#endif\n"); - fprintf(fp, "#if NHB > 0\n"); - fprintf(fp, "#include \"news3400/hbdev/hbvar.h\"\n"); - fprintf(fp, "#endif\n"); - fprintf(fp, "\n"); - fprintf(fp, "#define C (caddr_t)\n\n"); - fprintf(fp, "\n"); - - /* BEGIN HB */ - fprintf(fp, "#if NHB > 0\n"); - /* - * Now generate interrupt vectors for the HYPER-BUS - */ - for (dp = dtab; dp != 0; dp = dp->d_next) { - if (dp->d_pri >= 0) { - mp = dp->d_conn; - if (mp == 0 || mp == TO_NEXUS || - !eq(mp->d_name, "hb")) - continue; - fprintf(fp, "extern struct hb_driver %sdriver;\n", - dp->d_name); - have_hb++; - } - } - /* - * Now spew forth the hb_cinfo structure - */ - fprintf(fp, "\nstruct hb_ctlr hminit[] = {\n"); - fprintf(fp, "/*\t driver,\tctlr,\talive,\taddr,\tintpri */\n"); - for (dp = dtab; dp != 0; dp = dp->d_next) { - mp = dp->d_conn; - if ((dp->d_type != MASTER && dp->d_type != CONTROLLER) - || mp == TO_NEXUS || mp == 0 || - !eq(mp->d_name, "hb")) - continue; - if (dp->d_pri < 0) { - printf("must specify priority for %s%d\n", - dp->d_name, dp->d_unit); - continue; - } - if (dp->d_drive != UNKNOWN || dp->d_slave != UNKNOWN) { - printf("drives need their own entries; "); - printf("dont specify drive or slave for %s%d\n", - dp->d_name, dp->d_unit); - continue; - } - if (dp->d_flags) { - printf("controllers (e.g. %s%d) don't have flags, " - "only devices do\n", - dp->d_name, dp->d_unit); - continue; - } - fprintf(fp, "\t{ &%sdriver,\t%d,\t0,\tC 0x%x,\t%d },\n", - dp->d_name, dp->d_unit, dp->d_addr, dp->d_pri); - } - fprintf(fp, "\t0\n};\n"); - /* - * Now we go for the hb_device stuff - */ - fprintf(fp, "\nstruct hb_device hdinit[] = {\n"); - fprintf(fp, - "\t/* driver, unit, ctlr, slave, addr, pri, 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 || - mp == TO_NEXUS || /* mp->d_type == MASTER || */ - eq(mp->d_name, "iop") || eq(mp->d_name, "vme")) - continue; - if (eq(mp->d_name, "hb")) { - if (dp->d_pri < 0) { - printf("must specify vector for device %s%d\n", - dp->d_name, dp->d_unit); - continue; - } - if (dp->d_drive != UNKNOWN || dp->d_slave != UNKNOWN) { - printf("drives/slaves can be specified only "); - printf("for controllers, not for device %s%d\n", - dp->d_name, dp->d_unit); - continue; - } - slave = QUES; - } else { - if (mp->d_conn == 0) { - printf("%s%d isn't connected to anything, ", - mp->d_name, mp->d_unit); - printf("so %s%d is unattached\n", - dp->d_name, dp->d_unit); - continue; - } - if (dp->d_drive == UNKNOWN) { - printf("must specify ``drive number'' for %s%d\n", - dp->d_name, dp->d_unit); - continue; - } - /* NOTE THAT ON THE IOP ``drive'' IS STORED IN */ - /* ``SLAVE'' AND WE DON'T WANT A SLAVE SPECIFIED */ - 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); - continue; - } - if (dp->d_pri >= 0) { - printf("interrupt priority should not be "); - printf("given for drive %s%d\n", - 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); - continue; - } - slave = dp->d_drive; - } - fprintf(fp, - "\t{ &%sdriver, %2d, %s, %2d, C 0x%x, %d, %d, 0x%x },\n", - eq(mp->d_name, "hb") ? dp->d_name : mp->d_name, dp->d_unit, - eq(mp->d_name, "hb") ? " -1" : qu(mp->d_unit), - slave, dp->d_addr, dp->d_pri, dp->d_dk, dp->d_flags); - } - fprintf(fp, "\t0\n};\n\n"); - fprintf(fp, "#endif\n\n"); - /* END HB */ - - pseudo_ioconf(fp); - (void) fclose(fp); -} -#endif - -char * -intv(dev) - register struct device *dev; -{ - static char buf[20]; - - if (dev->d_vec == 0) - return (" 0"); - (void) sprintf(buf, "%sint%d", dev->d_name, dev->d_unit); - return (buf); -} - -char * -qu(num) -{ - - if (num == QUES) - return ("'?'"); - if (num == UNKNOWN) - return (" -1"); - (void) sprintf(errbuf, "%3d", num); - return (errbuf); -} - -char * -wnum(num) -{ - - if (num == QUES || num == UNKNOWN) - return ("?"); - (void) sprintf(errbuf, "%d", num); - return (errbuf); -} - -void comp_config(fp) - FILE *fp; -{ - register struct file_list *fl; - register struct device *dp; - - fprintf(fp, "\n#include \"dev/cdvar.h\"\n"); - fprintf(fp, "\nstruct cddevice cddevice[] = {\n"); - fprintf(fp, "/*\tunit\tileave\tflags\tdk\tdevs\t\t\t\t*/\n"); - - fl = comp_list; - while (fl) { - if (fl->f_type != COMPDEVICE) { - fl = fl->f_next; - continue; - } - for (dp = dtab; dp != 0; dp = dp->d_next) - if (dp->d_type == DEVICE && - eq(dp->d_name, fl->f_fn) && - dp->d_unit == fl->f_compinfo) - break; - if (dp == 0) - continue; - fprintf(fp, "\t%d,\t%d,\t%d,\t%d,\t{", - dp->d_unit, dp->d_pri < 0 ? 0 : dp->d_pri, - dp->d_flags, 1); - for (fl = fl->f_next; fl->f_type == COMPSPEC; fl = fl->f_next) - fprintf(fp, " 0x%x,", (unsigned) fl->f_compdev); - fprintf(fp, " NODEV },\n"); - } - fprintf(fp, "\t-1,\t0,\t0,\t0,\t{ 0 },\n};\n"); -} - -void -pseudo_ioconf(fp) - register FILE *fp; -{ - register struct device *dp; - - (void)fprintf(fp, "\n#include \n\n"); - for (dp = dtab; dp != NULL; dp = dp->d_next) - if (dp->d_type == PSEUDO_DEVICE) - (void)fprintf(fp, "extern void %sattach __P((int));\n", - dp->d_name); - /* - * XXX concatonated disks are pseudo-devices but appear as DEVICEs - * since they don't adhere to normal pseudo-device conventions - * (i.e. one entry with total count in d_slave). - */ - if (seen_cd) - (void)fprintf(fp, "extern void cdattach __P((int));\n"); - /* XXX temporary for HP300, others */ - (void)fprintf(fp, "\n#include /* XXX */\n"); - (void)fprintf(fp, "#define etherattach (void (*)__P((int)))nullop\n"); - (void)fprintf(fp, "#define iteattach (void (*) __P((int)))nullop\n"); - (void)fprintf(fp, "\nstruct pdevinit pdevinit[] = {\n"); - for (dp = dtab; dp != NULL; dp = dp->d_next) - if (dp->d_type == PSEUDO_DEVICE) - (void)fprintf(fp, "\t{ %sattach, %d },\n", dp->d_name, - dp->d_slave > 0 ? dp->d_slave : 1); - /* - * XXX count up cds and put out an entry - */ - if (seen_cd) { - struct file_list *fl; - int cdmax = -1; - - for (fl = comp_list; fl != NULL; fl = fl->f_next) - if (fl->f_type == COMPDEVICE && fl->f_compinfo > cdmax) - cdmax = fl->f_compinfo; - (void)fprintf(fp, "\t{ cdattach, %d },\n", cdmax+1); - } - (void)fprintf(fp, "\t{ 0, 0 }\n};\n"); - if (seen_cd) - comp_config(fp); -} diff --git a/tools/kconfig/mkmakefile.c b/tools/kconfig/mkmakefile.c index 2f7da3a..de13b1b 100644 --- a/tools/kconfig/mkmakefile.c +++ b/tools/kconfig/mkmakefile.c @@ -115,14 +115,6 @@ static struct users { int u_min; int u_max; } users[] = { - { 24, 8, 1024 }, /* MACHINE_VAX */ - { 4, 2, 128 }, /* MACHINE_TAHOE */ - { 8, 2, 64 }, /* MACHINE_HP300 */ - { 8, 2, 64 }, /* MACHINE_I386 */ - { 8, 2, 64 }, /* MACHINE_MIPS */ - { 8, 2, 64 }, /* MACHINE_PMAX */ - { 8, 2, 64 }, /* MACHINE_LUNA68K */ - { 8, 2, 64 }, /* MACHINE_NEWS3400 */ { 2, 1, 16 }, /* MACHINE_PIC32 */ }; #define NUSERS (sizeof (users) / sizeof (users[0])) @@ -395,9 +387,6 @@ void do_cfiles(fp) /* * Create the makerules for each file * which is part of the system. - * Devices are processed with the special c2 option -i - * which avoids any problem areas with i/o addressing - * (e.g. for the VAX); assembler files are processed by as. */ void do_rules(f) FILE *f; @@ -516,8 +505,8 @@ void makefile() if (hadtz == 0) printf("timezone not specified; gmt assumed\n"); if ((unsigned)machine > NUSERS) { - printf("maxusers config info isn't present, using vax\n"); - up = &users[MACHINE_VAX-1]; + printf("maxusers config info isn't present, using pic32\n"); + up = &users[MACHINE_PIC32-1]; } else up = &users[machine-1]; if (maxusers == 0) { diff --git a/tools/kconfig/mkubglue.c b/tools/kconfig/mkubglue.c deleted file mode 100644 index 88ffa49..0000000 --- a/tools/kconfig/mkubglue.c +++ /dev/null @@ -1,192 +0,0 @@ -/*- - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * 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. - */ - -/* - * Make the uba interrupt file ubglue.s - */ -#include -#include "config.h" -#include "y.tab.h" - -ubglue() -{ - register FILE *fp; - register struct device *dp, *mp; - - fp = fopen(path("ubglue.s"), "w"); - if (fp == 0) { - perror(path("ubglue.s")); - exit(1); - } - for (dp = dtab; dp != 0; dp = dp->d_next) { - mp = dp->d_conn; - if (mp != 0 && mp != (struct device *)-1 && - !eq(mp->d_name, "mba")) { - 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) { - dump_vec(fp, id->id, dp->d_unit); - break; - } - if (!strcmp(id->id, id2->id)) - break; - } - } - } - } - dump_std(fp); - for (dp = dtab; dp != 0; dp = dp->d_next) { - mp = dp->d_conn; - if (mp != 0 && mp != (struct device *)-1 && - !eq(mp->d_name, "mba")) { - 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) { - dump_intname(fp, id->id, - dp->d_unit); - break; - } - if (!strcmp(id->id, id2->id)) - break; - } - } - } - } - dump_ctrs(fp); - (void) fclose(fp); -} - -static int cntcnt = 0; /* number of interrupt counters allocated */ - -/* - * print an interrupt vector - */ -dump_vec(fp, vector, number) - register FILE *fp; - char *vector; - int number; -{ - char nbuf[80]; - register char *v = nbuf; - - (void) sprintf(v, "%s%d", vector, number); - fprintf(fp, "\t.globl\t_X%s\n\t.align\t2\n_X%s:\n\tpushr\t$0x3f\n", - v, v); - fprintf(fp, "\tincl\t_fltintrcnt+(4*%d)\n", cntcnt++); - if (strncmp(vector, "dzx", 3) == 0) - fprintf(fp, "\tmovl\t$%d,r0\n\tjmp\tdzdma\n\n", number); - else if (strncmp(vector, "dpx", 3) == 0) - fprintf(fp, "\tmovl\t$%d,r0\n\tjmp\tdpxdma\n\n", number); - else if (strncmp(vector, "dpr", 3) == 0) - fprintf(fp, "\tmovl\t$%d,r0\n\tjmp\tdprdma\n\n", number); - else { - if (strncmp(vector, "uur", 3) == 0) { - fprintf(fp, "#ifdef UUDMA\n"); - fprintf(fp, "\tmovl\t$%d,r0\n\tjsb\tuudma\n", number); - fprintf(fp, "#endif\n"); - } - fprintf(fp, "\tpushl\t$%d\n", number); - fprintf(fp, "\tcalls\t$1,_%s\n\tpopr\t$0x3f\n", vector); - fprintf(fp, "\tincl\t_cnt+V_INTR\n\trei\n\n"); - } -} - -/* - * Start the interrupt name table with the names - * of the standard vectors not on the unibus. - * The number and order of these names should correspond - * with the definitions in scb.s. - */ -dump_std(fp) - register FILE *fp; -{ - fprintf(fp, "\n\t.globl\t_intrnames\n"); - fprintf(fp, "\n\t.globl\t_eintrnames\n"); - fprintf(fp, "\t.data\n"); - fprintf(fp, "_intrnames:\n"); - fprintf(fp, "\t.asciz\t\"clock\"\n"); - fprintf(fp, "\t.asciz\t\"cnr\"\n"); - fprintf(fp, "\t.asciz\t\"cnx\"\n"); - fprintf(fp, "\t.asciz\t\"tur\"\n"); - fprintf(fp, "\t.asciz\t\"tux\"\n"); - fprintf(fp, "\t.asciz\t\"mba0\"\n"); - fprintf(fp, "\t.asciz\t\"mba1\"\n"); - fprintf(fp, "\t.asciz\t\"mba2\"\n"); - fprintf(fp, "\t.asciz\t\"mba3\"\n"); - fprintf(fp, "\t.asciz\t\"uba0\"\n"); - fprintf(fp, "\t.asciz\t\"uba1\"\n"); - fprintf(fp, "\t.asciz\t\"uba2\"\n"); - fprintf(fp, "\t.asciz\t\"uba3\"\n"); -#define I_FIXED 13 /* number of names above */ -} - -dump_intname(fp, vector, number) - register FILE *fp; - char *vector; - int number; -{ - register char *cp = vector; - - fprintf(fp, "\t.asciz\t\""); - /* - * Skip any "int" or "intr" in the name. - */ - while (*cp) - if (cp[0] == 'i' && cp[1] == 'n' && cp[2] == 't') { - cp += 3; - if (*cp == 'r') - cp++; - } else { - putc(*cp, fp); - cp++; - } - fprintf(fp, "%d\"\n", number); -} - -dump_ctrs(fp) - register FILE *fp; -{ - fprintf(fp, "_eintrnames:\n"); - fprintf(fp, "\n\t.globl\t_intrcnt\n"); - fprintf(fp, "\n\t.globl\t_eintrcnt\n"); - fprintf(fp, "_intrcnt:\n", I_FIXED); - fprintf(fp, "\t.space\t4 * %d\n", I_FIXED); - fprintf(fp, "_fltintrcnt:\n", cntcnt); - fprintf(fp, "\t.space\t4 * %d\n", cntcnt); - fprintf(fp, "_eintrcnt:\n\n"); - fprintf(fp, "\t.text\n"); -}