%token CPU IDENT CONFIG ANY DEVICE UBA MBA NEXUS CSR DRIVE VECTOR
%token CONTROLLER PSEUDO_DEVICE FLAGS ID SEMICOLON NUMBER OPTIONS TRACE
/* config.y 1.2 81/02/25 */
Device_spec SEMICOLON = { newdev(&cur); } |
TRACE SEMICOLON = { do_trace = ! do_trace; } |
CPU ID NUMBER = { cpu_type = ns(sprintf(errbuf, "%s%d", $2, $3)); } |
IDENT ID { ident = ns($2); } |
CONFIG Save_id ID = { mkconf(temp_id, $3); free(temp_id); }
ID = { $$ = temp_id = ns($1); }
UBA = { $$ = ns("uba"); } |
MBA = { $$ = ns("mba"); } |
DEVICE Dev_name Dev_info Int_spec = { cur.d_type = DEVICE; } |
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 Dev_name = { cur.d_type = PSEUDO_DEVICE ; }
AT Dev NUMBER = { cur.d_conn = connect($2, $3); } |
AT NEXUS NUMBER = { cur.d_conn = -1; }
CSR NUMBER = { cur.d_addr = $2; } |
DRIVE NUMBER = { cur.d_drive = $2; } |
SLAVE NUMBER = { cur.d_slave = $2; } |
FLAGS NUMBER = { cur.d_flags = $2; }
VECTOR Save_id = { cur.d_vec1 = $2; } |
VECTOR Save_id ID = { cur.d_vec1 = $2; cur.d_vec2 = ns($3); } |
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 || num == -1)
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
for (; dp != NULL; dp = dp->d_next)
if (eq(dev, dp->d_name) && dp->d_unit == -1)
* If there isn't, make one
* Connect it to the same thing that other similar things are
* connected to, but make sure it is a wildcard unit
if (dcp == -1 || dcp == NULL)
dp->d_conn = connect(dcp->d_name, -1);
register struct device *dp;
dp->d_vec1 = dp->d_vec2 = NULL;
dp->d_addr = dp->d_flags = dp->d_dk = 0;
dp->d_drive = dp->d_unit = -17;