%token CPU IDENT CONFIG ANY DEVICE UBA MBA NEXUS CSR DRIVE VECTOR OPTIONS
%token CONTROLLER PSEUDO_DEVICE FLAGS ID SEMICOLON NUMBER FPNUMBER TRACE
%token DISK SLAVE AT HZ TIMEZONE DST MAXUSERS MASTER COMMA MINUS
/* config.y 1.11 81/05/22 */
struct device *curp = NULL;
Device_spec SEMICOLON = { newdev(&cur); } |
TRACE SEMICOLON = { do_trace = ! do_trace; } |
struct cputype *cp = malloc(sizeof (struct cputype));
IDENT ID { ident = ns($2); } |
CONFIG Save_id ID = { mkconf(temp_id, $3); free(temp_id); } |
yyerror("HZ specification obsolete; delete");
TIMEZONE NUMBER = { timezone = 60 * $2; check_tz(); } |
TIMEZONE NUMBER DST = { timezone = 60 * $2; dst = 1; check_tz(); } |
TIMEZONE FPNUMBER = { timezone = $2; check_tz(); } |
TIMEZONE FPNUMBER DST = { timezone = $2; dst = 1; check_tz(); } |
{ timezone = -60 * $3; check_tz(); } |
MINUS TIMEZONE NUMBER DST =
{ timezone = -60 * $3; dst = 1; check_tz(); } |
MINUS TIMEZONE FPNUMBER =
{ timezone = -$3; check_tz(); } |
MINUS TIMEZONE FPNUMBER DST =
{ timezone = -$3; dst = 1; check_tz(); } |
MAXUSERS NUMBER = { maxusers = $2; }
struct opt *op = malloc(sizeof (struct opt));
ID = { $$ = temp_id = ns($1); }
UBA = { $$ = ns("uba"); } |
MBA = { $$ = ns("mba"); } |
DEVICE Dev_name Dev_info Int_spec = { cur.d_type = DEVICE; } |
MASTER Dev_name Dev_info Int_spec = { cur.d_type = MASTER; } |
DISK Dev_name Dev_info Int_spec =
{ cur.d_dk = 1; cur.d_type = DEVICE; } |
CONTROLLER Dev_name Dev_info Int_spec = { cur.d_type = CONTROLLER; } |
PSEUDO_DEVICE Init_dev Dev =
{ cur.d_name = $3; cur.d_type = PSEUDO_DEVICE; }
if (eq(cur.d_name, "mba") || eq(cur.d_name, "uba"))
"%s must be connected to a nexus", cur.d_name));
cur.d_conn = connect($2, $3);
AT NEXUS NUMBER = { check_nexus(&cur, $3); cur.d_conn = TO_NEXUS; }
CSR NUMBER = { cur.d_addr = $2; } |
DRIVE NUMBER = { cur.d_drive = $2; } |
if (cur.d_conn != NULL && cur.d_conn != TO_NEXUS
&& cur.d_conn->d_type == MASTER)
yyerror("can't specify slave--not to master");
FLAGS NUMBER = { cur.d_flags = $2; }
VECTOR Id_list = { cur.d_vec = $2; } | ;
{ struct idlst *a = (struct idlst *)malloc(sizeof(struct idlst));
a->id = $1; a->id_next = 0; $$ = a; } |
{ struct idlst *a = (struct idlst *)malloc(sizeof(struct idlst));
a->id = $1; a->id_next = $2; $$ = a; } ;
fprintf(stderr, "config: %s at line %d\n", s, yyline);
* Return the passed string in a new space
cp = malloc(strlen(str)+1);
* Add a device to the list
register struct device *dp;
register struct device *np;
np = (struct device *) malloc(sizeof *np);
* Note that a configuration should be made
register struct file_list *fl;
fl = (struct file_list *) malloc(sizeof *fl);
fl->f_needs = ns(sysname);
* Find the pointer to connect to the given device and number.
* returns NULL if no such device and prints an error message
struct device *connect(dev, num)
register struct device *dp;
for (dp = dtab; dp != NULL; dp = dp->d_next)
if ((num == dp->d_unit) && eq(dev, dp->d_name))
if (dp->d_type != CONTROLLER && dp->d_type != MASTER)
"%s connected to non-controller", dev));
yyerror(sprintf(errbuf, "%s %d not defined", dev, num));
* Connect to an unspecific thing
struct device *huhcon(dev)
register struct device *dp, *dcp;
* First make certain that there are some of these to wildcard on
for (dp = dtab; dp != NULL; dp = dp->d_next)
yyerror(sprintf(errbuf, "no %s's to wildcard", dev));
* Now see if there is already a wildcard entry for this device
* (e.g. Search for a "uba ?")
for (; dp != NULL; dp = dp->d_next)
if (eq(dev, dp->d_name) && dp->d_unit == -1)
* If there isn't, make one becuase everything needs to be connected
* 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 the aren't
* connected to anything, then make the same connection, else
* call ourself to connect to another unspecific device.
if (dcp == TO_NEXUS || dcp == NULL)
dp->d_conn = connect(dcp->d_name, QUES);
* Set up the fields in the current device to their
register struct device *dp;
dp->d_addr = dp->d_flags = dp->d_dk = 0;
dp->d_slave = dp->d_drive = dp->d_unit = UNKNOWN;
* Make certain that this is a reasonable type of thing to put
register struct device *dev;
if (!eq(dev->d_name, "uba") && !eq(dev->d_name, "mba"))
yyerror("only uba's and mba's should be connected to the nexus");
yyerror("can't give specific nexus numbers");
* Check the timezone to make certain it is sensible
yyerror("timezone is unreasonable");