Support device drivers with multiple names, and do the right thing for fd and

wd.
This commit is contained in:
mycroft 1994-03-10 19:50:43 +00:00
parent 2191277bb6
commit 26731dd3eb
14 changed files with 144 additions and 124 deletions

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)config.h 5.14 (Berkeley) 7/1/91
* $Id: config.h,v 1.12 1994/02/01 02:07:11 cgd Exp $
* $Id: config.h,v 1.13 1994/03/10 19:50:43 mycroft Exp $
*/
/*
@ -43,6 +43,12 @@
#define NODEV ((dev_t)-1)
struct name_expr {
int type;
char *name;
struct name_expr *next,*left,*right;
};
struct file_list {
struct file_list *f_next;
char *f_fn; /* the name */
@ -51,8 +57,8 @@ struct file_list {
u_char f_was_driver; /* to handle un-included pseudo-drivers*/
u_char f_needs_count; /* to handle un-included pseudo-drivers*/
char *f_special; /* special make rule if present */
char *f_needs;
char *f_countname;
struct name_expr *f_needs;
struct name_expr *f_countname;
/*
* Random values:
* swap space parameters for swap areas

View File

@ -107,12 +107,13 @@
* SUCH DAMAGE.
*
* from: @(#)config.y 5.14 (Berkeley) 7/1/91
* $Id: config.y,v 1.12 1994/02/18 06:10:42 mycroft Exp $
* $Id: config.y,v 1.13 1994/03/10 19:50:44 mycroft Exp $
*/
#include "config.h"
#include <ctype.h>
#include <stdio.h>
#include "config.h"
#include "specfile.h"
struct device cur;
struct device *curp = 0;
@ -612,10 +613,14 @@ mkconf(sysname)
char *sysname;
{
register struct file_list *fl, **flp;
register struct name_expr *expr;
fl = (struct file_list *) malloc(sizeof *fl);
expr = (struct name_expr *) malloc(sizeof *expr);
fl->f_type = SYSTEMSPEC;
fl->f_needs = sysname;
fl->f_needs = expr;
expr->type = T_IDENTIFIER;
expr->name = sysname;
fl->f_rootdev = NODEV;
fl->f_dumpdev = NODEV;
fl->f_fn = 0;
@ -677,7 +682,7 @@ mkswap(system, fl, size)
if (eq(fl->f_fn, "generic") || eq(fl->f_fn, "nfs"))
system->f_fn = ns(fl->f_fn);
else
system->f_fn = ns(system->f_needs);
system->f_fn = ns(system->f_needs->name);
}
/*
@ -938,14 +943,14 @@ verifysystemspecs()
if (fl->f_type != SYSTEMSPEC)
continue;
if (!finddev(fl->f_rootdev))
deverror(fl->f_needs, "root");
deverror(fl->f_needs->name, "root");
*pchecked++ = fl->f_rootdev;
pchecked = verifyswap(fl->f_next, checked, pchecked);
#define samedev(dev1, dev2) \
((minor(dev1) &~ 07) != (minor(dev2) &~ 07))
if (!alreadychecked(fl->f_dumpdev, checked, pchecked)) {
if (!finddev(fl->f_dumpdev))
deverror(fl->f_needs, "dump");
deverror(fl->f_needs->name, "dump");
*pchecked++ = fl->f_dumpdev;
}
}

View File

@ -33,7 +33,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)mkheaders.c 5.7 (Berkeley) 7/1/91";*/
static char rcsid[] = "$Id: mkheaders.c,v 1.5 1993/08/01 18:00:09 mycroft Exp $";
static char rcsid[] = "$Id: mkheaders.c,v 1.6 1994/03/10 19:50:45 mycroft Exp $";
#endif /* not lint */
/*
@ -44,6 +44,7 @@ static char rcsid[] = "$Id: mkheaders.c,v 1.5 1993/08/01 18:00:09 mycroft Exp $"
#include <ctype.h>
#include "config.h"
#include "y.tab.h"
#include "specfile.h"
headers()
{
@ -51,9 +52,21 @@ headers()
for (fl = ftab; fl != 0; fl = fl->f_next)
if (fl->f_was_driver)
do_count(fl->f_needs, fl->f_needs, 1);
do_identifiers(fl->f_needs);
else if (fl->f_needs_count)
do_count(fl->f_countname, fl->f_countname, 1);
do_identifiers(fl->f_countname);
}
do_identifiers(expr)
register struct name_expr *expr;
{
if (expr->left)
do_identifiers(expr->left);
if (expr->type == T_IDENTIFIER)
do_count(expr->name, expr->name, 1);
if (expr->right)
do_identifiers(expr->right);
}
/*

View File

@ -33,7 +33,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)mkioconf.c 5.18 (Berkeley) 5/10/91";*/
static char rcsid[] = "$Id: mkioconf.c,v 1.22 1994/02/18 06:10:46 mycroft Exp $";
static char rcsid[] = "$Id: mkioconf.c,v 1.23 1994/03/10 19:50:47 mycroft Exp $";
#endif /* not lint */
#include <stdio.h>
@ -655,6 +655,9 @@ char *
char *shandler();
char *sirq();
#define i386_scsidev(x) \
(eq(x, "aha") || eq(x, "ahb") || eq(x, "bt") || eq(x, "uha"))
i386_ioconf()
{
register struct device *dp, *mp, *np;
@ -670,10 +673,10 @@ 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/device.h\"\n");
fprintf(fp, "#include \"sys/buf.h\"\n");
fprintf(fp, "#include <machine/pte.h>\n");
fprintf(fp, "#include <sys/param.h>\n");
fprintf(fp, "#include <sys/device.h>\n");
fprintf(fp, "#include <sys/buf.h>\n");
fprintf(fp, "\n");
fprintf(fp, "#if __STDC__ > 0\n");
fprintf(fp, "#define VEC(s) X##s\n");
@ -689,14 +692,13 @@ i386_ioconf()
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");
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"))
if (mp == 0 || mp == TO_NEXUS || i386_scsidev(mp->d_name))
continue;
fprintf(fp, "extern struct isa_driver %3sdriver;",
dp->d_name);
@ -721,7 +723,8 @@ i386_ioconf()
mp = dp->d_conn;
if (mp == 0 || mp == TO_NEXUS || eq(mp->d_name, "isa"))
continue;
fprintf(fp, "{ &%sdriver, 0, ", mp->d_name);
fprintf(fp, "{ &%sdriver, 0, ",
i386_scsidev(mp->d_name) ? mp->d_name : dp->d_name);
fprintf(fp,
"%5s, %2d, C 0x%05X, %5d, %6d, %2d, 0x%02x, %3d, %d},\n",
"0", 0, 0, 0, 0, dp->d_unit, dp->d_flags,

View File

@ -33,7 +33,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)mkmakefile.c 5.33 (Berkeley) 7/1/91";*/
static char rcsid[] = "$Id: mkmakefile.c,v 1.20 1994/02/01 02:07:36 cgd Exp $";
static char rcsid[] = "$Id: mkmakefile.c,v 1.21 1994/03/10 19:50:48 mycroft Exp $";
#endif /* not lint */
/*
@ -460,7 +460,7 @@ do_systemspec(f, fl, first)
int first;
{
fprintf(f, "SYSTEM_SWAP_DEP+= swap%s.o\n", fl->f_fn);
fprintf(f, "%s: ${SYSTEM_DEP} swap%s.o vers.o", fl->f_needs, fl->f_fn);
fprintf(f, "%s: ${SYSTEM_DEP} swap%s.o vers.o", fl->f_needs->name, fl->f_fn);
fprintf(f, "\n\t${SYSTEM_LD_HEAD}\n");
fprintf(f, "\t${SYSTEM_LD} swap%s.o\n", fl->f_fn);
fprintf(f, "\t${SYSTEM_LD_TAIL}\n\n");

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "$Id: specfile.c,v 1.6 1994/02/01 02:04:19 cgd Exp $";
static char rcsid[] = "$Id: specfile.c,v 1.7 1994/03/10 19:50:49 mycroft Exp $";
#endif /* not lint */
#include <stdio.h>
@ -7,21 +7,7 @@ static char rcsid[] = "$Id: specfile.c,v 1.6 1994/02/01 02:04:19 cgd Exp $";
#include <setjmp.h>
#include "y.tab.h"
#include "config.h"
#define T_OPTIONAL 1
#define T_STANDARD 2
#define T_COMPILE_WITH 3
#define T_CONFIG_DEPENDENT 4
#define T_DEVICE_DRIVER 5
#define T_PROFILING_ROUTINE 6
#define T_IDENTIFIER 7
#define T_OR 8
#define T_REQUIRES 9
#define T_NOT 10
#define EXPR_GROUP 11
#define T_LEFTPAREN 12
#define T_RIGHTPAREN 13
#define T_NEEDS_COUNT 14
#include "specfile.h"
#define is_paren(x) ((x == '(') || (x == ')'))
struct file_keyword {
@ -63,12 +49,6 @@ int file_tok(token)
return T_IDENTIFIER;
}
struct name_expr {
int type;
char *name;
struct name_expr *next,*left,*right;
};
struct name_expr *
alloc_name_expr(name)
char *name;
@ -581,18 +561,6 @@ read_file(filename, fatal_on_open, override)
}
else if (!depends_on)
parse_err("'optional' requires dependency specification");
if (driver) {
if (!is_simple(depends_on))
parse_err("device-driver's must have a singular name");
if (eq("profiling-routine", depends_on->name))
parse_err("not a valid device-driver name");
}
if (needs_count) {
if (!is_simple(depends_on))
parse_err("needs-count's must have a singular name");
if (eq("profiling-routine", depends_on->name))
parse_err("not a valid name for needs-count");
}
if (is_simple(depends_on) &&
eq("profiling-routine", depends_on->name)) filetype = PROFILING;
else if (!optional || depend_check(depends_on,0)) filetype = NORMAL;
@ -610,10 +578,11 @@ read_file(filename, fatal_on_open, override)
tp->f_fn = kf_name;
tp->f_type = filetype;
if (driver)
tp->f_needs = depends_on->name;
else tp->f_needs = NULL; /* memory leak if doesn't need count */
tp->f_needs = depends_on;
else
tp->f_needs = NULL;
if (needs_count)
tp->f_countname = depends_on->name;
tp->f_countname = depends_on;
else
tp->f_countname = NULL;
tp->f_was_driver = driver;

View File

@ -0,0 +1,14 @@
#define T_OPTIONAL 1
#define T_STANDARD 2
#define T_COMPILE_WITH 3
#define T_CONFIG_DEPENDENT 4
#define T_DEVICE_DRIVER 5
#define T_PROFILING_ROUTINE 6
#define T_IDENTIFIER 7
#define T_OR 8
#define T_REQUIRES 9
#define T_NOT 10
#define EXPR_GROUP 11
#define T_LEFTPAREN 12
#define T_RIGHTPAREN 13
#define T_NEEDS_COUNT 14

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)config.h 5.14 (Berkeley) 7/1/91
* $Id: config.h,v 1.12 1994/02/01 02:07:11 cgd Exp $
* $Id: config.h,v 1.13 1994/03/10 19:50:43 mycroft Exp $
*/
/*
@ -43,6 +43,12 @@
#define NODEV ((dev_t)-1)
struct name_expr {
int type;
char *name;
struct name_expr *next,*left,*right;
};
struct file_list {
struct file_list *f_next;
char *f_fn; /* the name */
@ -51,8 +57,8 @@ struct file_list {
u_char f_was_driver; /* to handle un-included pseudo-drivers*/
u_char f_needs_count; /* to handle un-included pseudo-drivers*/
char *f_special; /* special make rule if present */
char *f_needs;
char *f_countname;
struct name_expr *f_needs;
struct name_expr *f_countname;
/*
* Random values:
* swap space parameters for swap areas

View File

@ -107,12 +107,13 @@
* SUCH DAMAGE.
*
* from: @(#)config.y 5.14 (Berkeley) 7/1/91
* $Id: config.y,v 1.12 1994/02/18 06:10:42 mycroft Exp $
* $Id: config.y,v 1.13 1994/03/10 19:50:44 mycroft Exp $
*/
#include "config.h"
#include <ctype.h>
#include <stdio.h>
#include "config.h"
#include "specfile.h"
struct device cur;
struct device *curp = 0;
@ -612,10 +613,14 @@ mkconf(sysname)
char *sysname;
{
register struct file_list *fl, **flp;
register struct name_expr *expr;
fl = (struct file_list *) malloc(sizeof *fl);
expr = (struct name_expr *) malloc(sizeof *expr);
fl->f_type = SYSTEMSPEC;
fl->f_needs = sysname;
fl->f_needs = expr;
expr->type = T_IDENTIFIER;
expr->name = sysname;
fl->f_rootdev = NODEV;
fl->f_dumpdev = NODEV;
fl->f_fn = 0;
@ -677,7 +682,7 @@ mkswap(system, fl, size)
if (eq(fl->f_fn, "generic") || eq(fl->f_fn, "nfs"))
system->f_fn = ns(fl->f_fn);
else
system->f_fn = ns(system->f_needs);
system->f_fn = ns(system->f_needs->name);
}
/*
@ -938,14 +943,14 @@ verifysystemspecs()
if (fl->f_type != SYSTEMSPEC)
continue;
if (!finddev(fl->f_rootdev))
deverror(fl->f_needs, "root");
deverror(fl->f_needs->name, "root");
*pchecked++ = fl->f_rootdev;
pchecked = verifyswap(fl->f_next, checked, pchecked);
#define samedev(dev1, dev2) \
((minor(dev1) &~ 07) != (minor(dev2) &~ 07))
if (!alreadychecked(fl->f_dumpdev, checked, pchecked)) {
if (!finddev(fl->f_dumpdev))
deverror(fl->f_needs, "dump");
deverror(fl->f_needs->name, "dump");
*pchecked++ = fl->f_dumpdev;
}
}

View File

@ -33,7 +33,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)mkheaders.c 5.7 (Berkeley) 7/1/91";*/
static char rcsid[] = "$Id: mkheaders.c,v 1.5 1993/08/01 18:00:09 mycroft Exp $";
static char rcsid[] = "$Id: mkheaders.c,v 1.6 1994/03/10 19:50:45 mycroft Exp $";
#endif /* not lint */
/*
@ -44,6 +44,7 @@ static char rcsid[] = "$Id: mkheaders.c,v 1.5 1993/08/01 18:00:09 mycroft Exp $"
#include <ctype.h>
#include "config.h"
#include "y.tab.h"
#include "specfile.h"
headers()
{
@ -51,9 +52,21 @@ headers()
for (fl = ftab; fl != 0; fl = fl->f_next)
if (fl->f_was_driver)
do_count(fl->f_needs, fl->f_needs, 1);
do_identifiers(fl->f_needs);
else if (fl->f_needs_count)
do_count(fl->f_countname, fl->f_countname, 1);
do_identifiers(fl->f_countname);
}
do_identifiers(expr)
register struct name_expr *expr;
{
if (expr->left)
do_identifiers(expr->left);
if (expr->type == T_IDENTIFIER)
do_count(expr->name, expr->name, 1);
if (expr->right)
do_identifiers(expr->right);
}
/*

View File

@ -33,7 +33,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)mkioconf.c 5.18 (Berkeley) 5/10/91";*/
static char rcsid[] = "$Id: mkioconf.c,v 1.22 1994/02/18 06:10:46 mycroft Exp $";
static char rcsid[] = "$Id: mkioconf.c,v 1.23 1994/03/10 19:50:47 mycroft Exp $";
#endif /* not lint */
#include <stdio.h>
@ -655,6 +655,9 @@ char *
char *shandler();
char *sirq();
#define i386_scsidev(x) \
(eq(x, "aha") || eq(x, "ahb") || eq(x, "bt") || eq(x, "uha"))
i386_ioconf()
{
register struct device *dp, *mp, *np;
@ -670,10 +673,10 @@ 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/device.h\"\n");
fprintf(fp, "#include \"sys/buf.h\"\n");
fprintf(fp, "#include <machine/pte.h>\n");
fprintf(fp, "#include <sys/param.h>\n");
fprintf(fp, "#include <sys/device.h>\n");
fprintf(fp, "#include <sys/buf.h>\n");
fprintf(fp, "\n");
fprintf(fp, "#if __STDC__ > 0\n");
fprintf(fp, "#define VEC(s) X##s\n");
@ -689,14 +692,13 @@ i386_ioconf()
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");
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"))
if (mp == 0 || mp == TO_NEXUS || i386_scsidev(mp->d_name))
continue;
fprintf(fp, "extern struct isa_driver %3sdriver;",
dp->d_name);
@ -721,7 +723,8 @@ i386_ioconf()
mp = dp->d_conn;
if (mp == 0 || mp == TO_NEXUS || eq(mp->d_name, "isa"))
continue;
fprintf(fp, "{ &%sdriver, 0, ", mp->d_name);
fprintf(fp, "{ &%sdriver, 0, ",
i386_scsidev(mp->d_name) ? mp->d_name : dp->d_name);
fprintf(fp,
"%5s, %2d, C 0x%05X, %5d, %6d, %2d, 0x%02x, %3d, %d},\n",
"0", 0, 0, 0, 0, dp->d_unit, dp->d_flags,

View File

@ -33,7 +33,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)mkmakefile.c 5.33 (Berkeley) 7/1/91";*/
static char rcsid[] = "$Id: mkmakefile.c,v 1.20 1994/02/01 02:07:36 cgd Exp $";
static char rcsid[] = "$Id: mkmakefile.c,v 1.21 1994/03/10 19:50:48 mycroft Exp $";
#endif /* not lint */
/*
@ -460,7 +460,7 @@ do_systemspec(f, fl, first)
int first;
{
fprintf(f, "SYSTEM_SWAP_DEP+= swap%s.o\n", fl->f_fn);
fprintf(f, "%s: ${SYSTEM_DEP} swap%s.o vers.o", fl->f_needs, fl->f_fn);
fprintf(f, "%s: ${SYSTEM_DEP} swap%s.o vers.o", fl->f_needs->name, fl->f_fn);
fprintf(f, "\n\t${SYSTEM_LD_HEAD}\n");
fprintf(f, "\t${SYSTEM_LD} swap%s.o\n", fl->f_fn);
fprintf(f, "\t${SYSTEM_LD_TAIL}\n\n");

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "$Id: specfile.c,v 1.6 1994/02/01 02:04:19 cgd Exp $";
static char rcsid[] = "$Id: specfile.c,v 1.7 1994/03/10 19:50:49 mycroft Exp $";
#endif /* not lint */
#include <stdio.h>
@ -7,21 +7,7 @@ static char rcsid[] = "$Id: specfile.c,v 1.6 1994/02/01 02:04:19 cgd Exp $";
#include <setjmp.h>
#include "y.tab.h"
#include "config.h"
#define T_OPTIONAL 1
#define T_STANDARD 2
#define T_COMPILE_WITH 3
#define T_CONFIG_DEPENDENT 4
#define T_DEVICE_DRIVER 5
#define T_PROFILING_ROUTINE 6
#define T_IDENTIFIER 7
#define T_OR 8
#define T_REQUIRES 9
#define T_NOT 10
#define EXPR_GROUP 11
#define T_LEFTPAREN 12
#define T_RIGHTPAREN 13
#define T_NEEDS_COUNT 14
#include "specfile.h"
#define is_paren(x) ((x == '(') || (x == ')'))
struct file_keyword {
@ -63,12 +49,6 @@ int file_tok(token)
return T_IDENTIFIER;
}
struct name_expr {
int type;
char *name;
struct name_expr *next,*left,*right;
};
struct name_expr *
alloc_name_expr(name)
char *name;
@ -581,18 +561,6 @@ read_file(filename, fatal_on_open, override)
}
else if (!depends_on)
parse_err("'optional' requires dependency specification");
if (driver) {
if (!is_simple(depends_on))
parse_err("device-driver's must have a singular name");
if (eq("profiling-routine", depends_on->name))
parse_err("not a valid device-driver name");
}
if (needs_count) {
if (!is_simple(depends_on))
parse_err("needs-count's must have a singular name");
if (eq("profiling-routine", depends_on->name))
parse_err("not a valid name for needs-count");
}
if (is_simple(depends_on) &&
eq("profiling-routine", depends_on->name)) filetype = PROFILING;
else if (!optional || depend_check(depends_on,0)) filetype = NORMAL;
@ -610,10 +578,11 @@ read_file(filename, fatal_on_open, override)
tp->f_fn = kf_name;
tp->f_type = filetype;
if (driver)
tp->f_needs = depends_on->name;
else tp->f_needs = NULL; /* memory leak if doesn't need count */
tp->f_needs = depends_on;
else
tp->f_needs = NULL;
if (needs_count)
tp->f_countname = depends_on->name;
tp->f_countname = depends_on;
else
tp->f_countname = NULL;
tp->f_was_driver = driver;

View File

@ -0,0 +1,14 @@
#define T_OPTIONAL 1
#define T_STANDARD 2
#define T_COMPILE_WITH 3
#define T_CONFIG_DEPENDENT 4
#define T_DEVICE_DRIVER 5
#define T_PROFILING_ROUTINE 6
#define T_IDENTIFIER 7
#define T_OR 8
#define T_REQUIRES 9
#define T_NOT 10
#define EXPR_GROUP 11
#define T_LEFTPAREN 12
#define T_RIGHTPAREN 13
#define T_NEEDS_COUNT 14