config.y revision 20458
11553Srgrimes%union {
21553Srgrimes	char	*str;
31553Srgrimes	int	val;
41553Srgrimes	struct	file_list *file;
51553Srgrimes	struct	idlst *lst;
61553Srgrimes}
71553Srgrimes
81553Srgrimes%token	AND
91553Srgrimes%token	ANY
101553Srgrimes%token	ARGS
111553Srgrimes%token	AT
1212772Speter%token	AUTO
131553Srgrimes%token	BIO
149571Sgibbs%token	BUS
151553Srgrimes%token	COMMA
161553Srgrimes%token	CONFIG
178432Sjkh%token	CONFLICTS
181553Srgrimes%token	CONTROLLER
191553Srgrimes%token	CPU
201553Srgrimes%token	CSR
211553Srgrimes%token	DEVICE
2215257Sbde%token	DISABLE
231553Srgrimes%token	DISK
241553Srgrimes%token	DRIVE
251553Srgrimes%token	DRQ
261553Srgrimes%token	DUMPS
271553Srgrimes%token	EQUALS
281553Srgrimes%token	FLAGS
291553Srgrimes%token	IDENT
301553Srgrimes%token	INTERLEAVE
311553Srgrimes%token	IOMEM
321553Srgrimes%token	IOSIZ
331553Srgrimes%token	IRQ
341553Srgrimes%token	MACHINE
351553Srgrimes%token	MAJOR
361553Srgrimes%token	MASTER
371553Srgrimes%token	MAXUSERS
381553Srgrimes%token	MINOR
391553Srgrimes%token	MINUS
401553Srgrimes%token	NET
411553Srgrimes%token	NEXUS
4212772Speter%token	NONE
431553Srgrimes%token	ON
441553Srgrimes%token	OPTIONS
451553Srgrimes%token	MAKEOPTIONS
461553Srgrimes%token	PORT
471553Srgrimes%token	PRIORITY
481553Srgrimes%token	PSEUDO_DEVICE
491553Srgrimes%token	ROOT
501553Srgrimes%token	SEMICOLON
511553Srgrimes%token	SEQUENTIAL
521553Srgrimes%token	SIZE
531553Srgrimes%token	SLAVE
541553Srgrimes%token	SWAP
556814Sdufault%token	TARGET
561553Srgrimes%token	TTY
571553Srgrimes%token	TRACE
586814Sdufault%token	UNIT
591553Srgrimes%token	VECTOR
601553Srgrimes
611553Srgrimes%token	<str>	ID
621553Srgrimes%token	<val>	NUMBER
631553Srgrimes%token	<val>	FPNUMBER
641553Srgrimes
651553Srgrimes%type	<str>	Save_id
661553Srgrimes%type	<str>	Opt_value
671553Srgrimes%type	<str>	Dev
681553Srgrimes%type	<lst>	Id_list
691553Srgrimes%type	<val>	optional_size
701553Srgrimes%type	<val>	optional_sflag
711553Srgrimes%type	<str>	device_name
721553Srgrimes%type	<val>	major_minor
731553Srgrimes%type	<val>	arg_device_spec
744791Swollman%type	<val>	root_device_spec root_device_specs
751553Srgrimes%type	<val>	dump_device_spec
761553Srgrimes%type	<file>	swap_device_spec
771553Srgrimes%type	<file>	comp_device_spec
781553Srgrimes
791553Srgrimes%{
801553Srgrimes
811553Srgrimes/*
821553Srgrimes * Copyright (c) 1988, 1993
831553Srgrimes *	The Regents of the University of California.  All rights reserved.
841553Srgrimes *
851553Srgrimes * Redistribution and use in source and binary forms, with or without
861553Srgrimes * modification, are permitted provided that the following conditions
871553Srgrimes * are met:
881553Srgrimes * 1. Redistributions of source code must retain the above copyright
891553Srgrimes *    notice, this list of conditions and the following disclaimer.
901553Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
911553Srgrimes *    notice, this list of conditions and the following disclaimer in the
921553Srgrimes *    documentation and/or other materials provided with the distribution.
931553Srgrimes * 3. All advertising materials mentioning features or use of this software
941553Srgrimes *    must display the following acknowledgement:
951553Srgrimes *	This product includes software developed by the University of
961553Srgrimes *	California, Berkeley and its contributors.
971553Srgrimes * 4. Neither the name of the University nor the names of its contributors
981553Srgrimes *    may be used to endorse or promote products derived from this software
991553Srgrimes *    without specific prior written permission.
1001553Srgrimes *
1011553Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1021553Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1031553Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1041553Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1051553Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1061553Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1071553Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1081553Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1091553Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1101553Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1111553Srgrimes * SUCH DAMAGE.
1121553Srgrimes *
1131553Srgrimes *	@(#)config.y	8.1 (Berkeley) 6/6/93
1141553Srgrimes */
1151553Srgrimes
1161553Srgrimes#include "config.h"
1176497Sbde
1186497Sbde#include <sys/disklabel.h>
1196497Sbde#include <sys/diskslice.h>
1206497Sbde
1211553Srgrimes#include <ctype.h>
1221553Srgrimes#include <stdio.h>
1234791Swollman#include <err.h>
12412772Speter#include <string.h>
1251553Srgrimes
1261553Srgrimesstruct	device cur;
1271553Srgrimesstruct	device *curp = 0;
1281553Srgrimes
12920458Sjoerg#define ns(s)	strdup(s)
13020458Sjoerg
1311553Srgrimes%}
1321553Srgrimes%%
1331553SrgrimesConfiguration:
1341553Srgrimes	Many_specs
1351553Srgrimes		= { verifysystemspecs(); }
1361553Srgrimes		;
1371553Srgrimes
1381553SrgrimesMany_specs:
1391553Srgrimes	Many_specs Spec
1401553Srgrimes		|
1411553Srgrimes	/* lambda */
1421553Srgrimes		;
1431553Srgrimes
1441553SrgrimesSpec:
1451553Srgrimes	Device_spec SEMICOLON
1461553Srgrimes	      = { newdev(&cur); } |
1471553Srgrimes	Config_spec SEMICOLON
1481553Srgrimes		|
1491553Srgrimes	TRACE SEMICOLON
1501553Srgrimes	      = { do_trace = !do_trace; } |
1511553Srgrimes	SEMICOLON
1521553Srgrimes		|
1531553Srgrimes	error SEMICOLON
1541553Srgrimes		;
1551553Srgrimes
1561553SrgrimesConfig_spec:
1571553Srgrimes	MACHINE Save_id
1581553Srgrimes	    = {
1591553Srgrimes		if (!strcmp($2, "vax")) {
1601553Srgrimes			machine = MACHINE_VAX;
1611553Srgrimes			machinename = "vax";
1621553Srgrimes		} else if (!strcmp($2, "tahoe")) {
1631553Srgrimes			machine = MACHINE_TAHOE;
1641553Srgrimes			machinename = "tahoe";
1651553Srgrimes		} else if (!strcmp($2, "hp300")) {
1661553Srgrimes			machine = MACHINE_HP300;
1671553Srgrimes			machinename = "hp300";
1681553Srgrimes		} else if (!strcmp($2, "i386")) {
1691553Srgrimes			machine = MACHINE_I386;
1701553Srgrimes			machinename = "i386";
1711553Srgrimes		} else if (!strcmp($2, "mips")) {
1721553Srgrimes			machine = MACHINE_MIPS;
1731553Srgrimes			machinename = "mips";
1741553Srgrimes		} else if (!strcmp($2, "pmax")) {
1751553Srgrimes			machine = MACHINE_PMAX;
1761553Srgrimes			machinename = "pmax";
1771553Srgrimes		} else if (!strcmp($2, "luna68k")) {
1781553Srgrimes			machine = MACHINE_LUNA68K;
1791553Srgrimes			machinename = "luna68k";
1801553Srgrimes		} else if (!strcmp($2, "news3400")) {
1811553Srgrimes			machine = MACHINE_NEWS3400;
1821553Srgrimes			machinename = "news3400";
1831553Srgrimes		} else
1841553Srgrimes			yyerror("Unknown machine type");
1851553Srgrimes	      } |
1861553Srgrimes	CPU Save_id
1871553Srgrimes	      = {
1881553Srgrimes		struct cputype *cp =
1891553Srgrimes		    (struct cputype *)malloc(sizeof (struct cputype));
19012772Speter		memset(cp, 0, sizeof(*cp));
19120458Sjoerg		cp->cpu_name = $2;
1921553Srgrimes		cp->cpu_next = cputype;
1931553Srgrimes		cputype = cp;
1941553Srgrimes	      } |
1951553Srgrimes	OPTIONS Opt_list
1961553Srgrimes		|
1971553Srgrimes	MAKEOPTIONS Mkopt_list
1981553Srgrimes		|
1991553Srgrimes	IDENT ID
20020458Sjoerg	      = { ident = $2; } |
2011553Srgrimes	System_spec
2021553Srgrimes		|
2031553Srgrimes	MAXUSERS NUMBER
2041553Srgrimes	      = { maxusers = $2; };
2051553Srgrimes
2061553SrgrimesSystem_spec:
2071553Srgrimes	  System_id System_parameter_list
2081553Srgrimes		= { checksystemspec(*confp); }
2091553Srgrimes	;
2101553Srgrimes
2111553SrgrimesSystem_id:
2121553Srgrimes	  CONFIG Save_id
2131553Srgrimes		= { mkconf($2); }
2141553Srgrimes	;
2151553Srgrimes
2161553SrgrimesSystem_parameter_list:
2171553Srgrimes	  System_parameter_list System_parameter
2181553Srgrimes	| System_parameter
2191553Srgrimes	;
2201553Srgrimes
2211553SrgrimesSystem_parameter:
2221566Srgrimes	  addr_spec
2231566Srgrimes	| swap_spec
2241553Srgrimes	| root_spec
2251553Srgrimes	| dump_spec
2261553Srgrimes	| arg_spec
2271553Srgrimes	;
2281553Srgrimes
2291566Srgrimesaddr_spec:
2301566Srgrimes	  AT NUMBER
2316497Sbde		= { loadaddress = $2; }
2321566Srgrimes	;
2331566Srgrimes
2341553Srgrimesswap_spec:
2351553Srgrimes	  SWAP optional_on swap_device_list
2361553Srgrimes	;
2371553Srgrimes
2381553Srgrimesswap_device_list:
2391553Srgrimes	  swap_device_list AND swap_device
2401553Srgrimes	| swap_device
2411553Srgrimes	;
2421553Srgrimes
2431553Srgrimesswap_device:
2441553Srgrimes	  swap_device_spec optional_size optional_sflag
2451553Srgrimes	      = { mkswap(*confp, $1, $2, $3); }
2461553Srgrimes	;
2471553Srgrimes
2481553Srgrimesswap_device_spec:
2491553Srgrimes	  device_name
2501553Srgrimes		= {
2511553Srgrimes			struct file_list *fl = newflist(SWAPSPEC);
2521553Srgrimes
2531553Srgrimes			if (eq($1, "generic"))
2541553Srgrimes				fl->f_fn = $1;
2551553Srgrimes			else {
2566497Sbde				fl->f_swapdev = nametodev($1, 0,
2576497Sbde						    COMPATIBILITY_SLICE, 'b');
2581553Srgrimes				fl->f_fn = devtoname(fl->f_swapdev);
2591553Srgrimes			}
2601553Srgrimes			$$ = fl;
2611553Srgrimes		}
2621553Srgrimes	| major_minor
2631553Srgrimes		= {
2641553Srgrimes			struct file_list *fl = newflist(SWAPSPEC);
2651553Srgrimes
2661553Srgrimes			fl->f_swapdev = $1;
2671553Srgrimes			fl->f_fn = devtoname($1);
2681553Srgrimes			$$ = fl;
2691553Srgrimes		}
2701553Srgrimes	;
2711553Srgrimes
2721553Srgrimesroot_spec:
2734791Swollman	  ROOT optional_on root_device_specs
2741553Srgrimes		= {
2751553Srgrimes			struct file_list *fl = *confp;
2761553Srgrimes
2771553Srgrimes			if (fl && fl->f_rootdev != NODEV)
2781553Srgrimes				yyerror("extraneous root device specification");
2791553Srgrimes			else
2801553Srgrimes				fl->f_rootdev = $3;
2811553Srgrimes		}
2821553Srgrimes	;
2831553Srgrimes
2844791Swollmanroot_device_specs:
2854791Swollman	  root_device_spec AND root_device_specs
2864791Swollman		= {
2874791Swollman			warnx("extraneous root devices ignored");
2884791Swollman			$$ = $1;
2894791Swollman		  }
2904791Swollman	| root_device_spec
2914791Swollman	;
2924791Swollman
2931553Srgrimesroot_device_spec:
2941553Srgrimes	  device_name
2956497Sbde		= { $$ = nametodev($1, 0, COMPATIBILITY_SLICE, 'a'); }
2961553Srgrimes	| major_minor
2971553Srgrimes	;
2981553Srgrimes
2991553Srgrimesdump_spec:
3001553Srgrimes	  DUMPS optional_on dump_device_spec
3011553Srgrimes		= {
3021553Srgrimes			struct file_list *fl = *confp;
3031553Srgrimes
3041553Srgrimes			if (fl && fl->f_dumpdev != NODEV)
3051553Srgrimes				yyerror("extraneous dump device specification");
3061553Srgrimes			else
3071553Srgrimes				fl->f_dumpdev = $3;
3081553Srgrimes		}
3091553Srgrimes
3101553Srgrimes	;
3111553Srgrimes
3121553Srgrimesdump_device_spec:
3131553Srgrimes	  device_name
3146497Sbde		= { $$ = nametodev($1, 0, COMPATIBILITY_SLICE, 'b'); }
3151553Srgrimes	| major_minor
3161553Srgrimes	;
3171553Srgrimes
3181553Srgrimesarg_spec:
3191553Srgrimes	  ARGS optional_on arg_device_spec
3201553Srgrimes		= { yyerror("arg device specification obsolete, ignored"); }
3211553Srgrimes	;
3221553Srgrimes
3231553Srgrimesarg_device_spec:
3241553Srgrimes	  device_name
3256497Sbde		= { $$ = nametodev($1, 0, COMPATIBILITY_SLICE, 'b'); }
3261553Srgrimes	| major_minor
3271553Srgrimes	;
3281553Srgrimes
3291553Srgrimesmajor_minor:
3301553Srgrimes	  MAJOR NUMBER MINOR NUMBER
3311553Srgrimes		= { $$ = makedev($2, $4); }
3321553Srgrimes	;
3331553Srgrimes
3341553Srgrimesoptional_on:
3351553Srgrimes	  ON
3361553Srgrimes	| /* empty */
3371553Srgrimes	;
3381553Srgrimes
3391553Srgrimesoptional_size:
3401553Srgrimes	  SIZE NUMBER
3411553Srgrimes	      = { $$ = $2; }
3421553Srgrimes	| /* empty */
3431553Srgrimes	      = { $$ = 0; }
3441553Srgrimes	;
3451553Srgrimes
3461553Srgrimesoptional_sflag:
3471553Srgrimes	  SEQUENTIAL
3481553Srgrimes	      = { $$ = 2; }
3491553Srgrimes	| /* empty */
3501553Srgrimes	      = { $$ = 0; }
3511553Srgrimes	;
3521553Srgrimes
3531553Srgrimesdevice_name:
3541553Srgrimes	  Save_id
3551553Srgrimes		= { $$ = $1; }
3561553Srgrimes	| Save_id NUMBER
3571553Srgrimes		= {
3581553Srgrimes			char buf[80];
3591553Srgrimes
36020457Sjoerg			(void) snprintf(buf, 80, "%s%d", $1, $2);
3611553Srgrimes			$$ = ns(buf); free($1);
3621553Srgrimes		}
3631553Srgrimes	| Save_id NUMBER ID
3641553Srgrimes		= {
3651553Srgrimes			char buf[80];
3661553Srgrimes
36720457Sjoerg			(void) snprintf(buf, 80, "%s%d%s", $1, $2, $3);
3681553Srgrimes			$$ = ns(buf); free($1);
3691553Srgrimes		}
3706497Sbde	| Save_id NUMBER ID NUMBER
3716497Sbde		= {
3726497Sbde			char buf[80];
3736497Sbde
37420457Sjoerg			(void) snprintf(buf, 80, "%s%d%s%d", $1, $2, $3, $4);
3756497Sbde			$$ = ns(buf); free($1);
3766497Sbde		}
3776497Sbde	| Save_id NUMBER ID NUMBER ID
3786497Sbde		= {
3796497Sbde			char buf[80];
3806497Sbde
38120457Sjoerg			(void) snprintf(buf, 80, "%s%d%s%d%s",
38220457Sjoerg			     $1, $2, $3, $4, $5);
3836497Sbde			$$ = ns(buf); free($1);
3846497Sbde		}
3851553Srgrimes	;
3861553Srgrimes
3871553SrgrimesOpt_list:
3881553Srgrimes	Opt_list COMMA Option
3891553Srgrimes		|
3901553Srgrimes	Option
3911553Srgrimes		;
3921553Srgrimes
3931553SrgrimesOption:
3941553Srgrimes	Save_id
3951553Srgrimes	      = {
3961553Srgrimes		struct opt *op = (struct opt *)malloc(sizeof (struct opt));
39712772Speter		char *s;
39812772Speter		memset(op, 0, sizeof(*op));
39920458Sjoerg		op->op_name = $1;
4001553Srgrimes		op->op_next = opt;
4011553Srgrimes		op->op_value = 0;
4021553Srgrimes		opt = op;
40312772Speter		if (s = strchr(op->op_name, '=')) {
40412772Speter			/* AARGH!!!! Old-style bogon */
40512772Speter			*s = '\0';
40612772Speter			op->op_value = ns(s + 1);
40712772Speter		}
4081553Srgrimes	      } |
4091553Srgrimes	Save_id EQUALS Opt_value
4101553Srgrimes	      = {
4111553Srgrimes		struct opt *op = (struct opt *)malloc(sizeof (struct opt));
41212772Speter		memset(op, 0, sizeof(*op));
41320458Sjoerg		op->op_name = $1;
4141553Srgrimes		op->op_next = opt;
41520458Sjoerg		op->op_value = $3;
4161553Srgrimes		opt = op;
4171553Srgrimes	      } ;
4181553Srgrimes
4191553SrgrimesOpt_value:
4201553Srgrimes	ID
42120458Sjoerg	      = { $$ = $1; } |
4221553Srgrimes	NUMBER
4231553Srgrimes	      = {
4241553Srgrimes		char nb[16];
4251553Srgrimes	        (void) sprintf(nb, "%d", $1);
42620458Sjoerg		$$ = ns(nb);
4271553Srgrimes	      } ;
4281553Srgrimes
4291553Srgrimes
4301553SrgrimesSave_id:
4311553Srgrimes	ID
43220458Sjoerg	      = { $$ = $1; }
4331553Srgrimes	;
4341553Srgrimes
4351553SrgrimesMkopt_list:
4361553Srgrimes	Mkopt_list COMMA Mkoption
4371553Srgrimes		|
4381553Srgrimes	Mkoption
4391553Srgrimes		;
4401553Srgrimes
4411553SrgrimesMkoption:
4421553Srgrimes	Save_id EQUALS Opt_value
4431553Srgrimes	      = {
4441553Srgrimes		struct opt *op = (struct opt *)malloc(sizeof (struct opt));
44512772Speter		memset(op, 0, sizeof(*op));
44620458Sjoerg		op->op_name = $1;
44712772Speter		op->op_ownfile = 0;	/* for now */
4481553Srgrimes		op->op_next = mkopt;
44920458Sjoerg		op->op_value = $3;
4501553Srgrimes		mkopt = op;
4511553Srgrimes	      } ;
4521553Srgrimes
4531553SrgrimesDev:
4541553Srgrimes	ID
45520458Sjoerg	      = { $$ = $1; }
4561553Srgrimes	;
4571553Srgrimes
4581553SrgrimesDevice_spec:
4591553Srgrimes	DEVICE Dev_name Dev_info Int_spec
4601553Srgrimes	      = { cur.d_type = DEVICE; } |
4611553Srgrimes	MASTER Dev_name Dev_info Int_spec
4621553Srgrimes	      = { cur.d_type = MASTER; } |
4631553Srgrimes	DISK Dev_name Dev_info Int_spec
4641553Srgrimes	      = { cur.d_dk = 1; cur.d_type = DEVICE; } |
4651553Srgrimes	CONTROLLER Dev_name Dev_info Int_spec
4661553Srgrimes	      = { cur.d_type = CONTROLLER; } |
4671553Srgrimes	PSEUDO_DEVICE Init_dev Dev
4681553Srgrimes	      = {
4691553Srgrimes		cur.d_name = $3;
4701553Srgrimes		cur.d_type = PSEUDO_DEVICE;
4711553Srgrimes		} |
4721553Srgrimes	PSEUDO_DEVICE Init_dev Dev NUMBER
4731553Srgrimes	      = {
4741553Srgrimes		cur.d_name = $3;
4751553Srgrimes		cur.d_type = PSEUDO_DEVICE;
4761553Srgrimes		cur.d_slave = $4;
4771553Srgrimes		} |
4781553Srgrimes	PSEUDO_DEVICE Dev_name Cdev_init Cdev_info
4791553Srgrimes	      = {
4801553Srgrimes		if (!eq(cur.d_name, "cd"))
4811553Srgrimes			yyerror("improper spec for pseudo-device");
4821553Srgrimes		seen_cd = 1;
4831553Srgrimes		cur.d_type = DEVICE;
4841553Srgrimes		verifycomp(*compp);
4851553Srgrimes		};
4861553Srgrimes
4871553SrgrimesCdev_init:
4881553Srgrimes	/* lambda */
4891553Srgrimes	      = { mkcomp(&cur); };
4901553Srgrimes
4911553SrgrimesCdev_info:
4921553Srgrimes	  optional_on comp_device_list comp_option_list
4931553Srgrimes	;
4941553Srgrimes
4951553Srgrimescomp_device_list:
4961553Srgrimes	  comp_device_list AND comp_device
4971553Srgrimes	| comp_device
4981553Srgrimes	;
4991553Srgrimes
5001553Srgrimescomp_device:
5011553Srgrimes	  comp_device_spec
5021553Srgrimes	      = { addcomp(*compp, $1); }
5031553Srgrimes	;
5041553Srgrimes
5051553Srgrimescomp_device_spec:
5061553Srgrimes	  device_name
5071553Srgrimes		= {
5081553Srgrimes			struct file_list *fl = newflist(COMPSPEC);
5091553Srgrimes
5106497Sbde			fl->f_compdev = nametodev($1, 0, COMPATIBILITY_SLICE,
5116497Sbde						  'c');
5121553Srgrimes			fl->f_fn = devtoname(fl->f_compdev);
5131553Srgrimes			$$ = fl;
5141553Srgrimes		}
5151553Srgrimes	| major_minor
5161553Srgrimes		= {
5171553Srgrimes			struct file_list *fl = newflist(COMPSPEC);
5181553Srgrimes
5191553Srgrimes			fl->f_compdev = $1;
5201553Srgrimes			fl->f_fn = devtoname($1);
5211553Srgrimes			$$ = fl;
5221553Srgrimes		}
5231553Srgrimes	;
5241553Srgrimes
5251553Srgrimescomp_option_list:
5261553Srgrimes	  comp_option_list comp_option
5271553Srgrimes		|
5281553Srgrimes	  /* lambda */
5291553Srgrimes		;
5301553Srgrimes
5311553Srgrimescomp_option:
5321553Srgrimes	INTERLEAVE NUMBER
5331553Srgrimes	      = { cur.d_pri = $2; } |
5341553Srgrimes	FLAGS NUMBER
5351553Srgrimes	      = { cur.d_flags = $2; };
5361553Srgrimes
5371553SrgrimesDev_name:
5381553Srgrimes	Init_dev Dev NUMBER
5391553Srgrimes	      = {
5401553Srgrimes		cur.d_name = $2;
5411553Srgrimes		if (eq($2, "mba"))
5421553Srgrimes			seen_mba = 1;
5431553Srgrimes		else if (eq($2, "uba"))
5441553Srgrimes			seen_uba = 1;
5451553Srgrimes		else if (eq($2, "vba"))
5461553Srgrimes			seen_vba = 1;
5471553Srgrimes		else if (eq($2, "isa"))
5481553Srgrimes			seen_isa = 1;
5496814Sdufault		else if (eq($2, "scbus"))
5506814Sdufault			seen_scbus = 1;
5511553Srgrimes		cur.d_unit = $3;
5521553Srgrimes		};
5531553Srgrimes
5541553SrgrimesInit_dev:
5551553Srgrimes	/* lambda */
5561553Srgrimes	      = { init_dev(&cur); };
5571553Srgrimes
5581553SrgrimesDev_info:
5591553Srgrimes	Con_info Info_list
5601553Srgrimes		|
5611553Srgrimes	/* lambda */
5621553Srgrimes		;
5631553Srgrimes
5641553SrgrimesCon_info:
5651553Srgrimes	AT Dev NUMBER
5661553Srgrimes	      = {
5671553Srgrimes		if (eq(cur.d_name, "mba") || eq(cur.d_name, "uba")) {
5681553Srgrimes			(void) sprintf(errbuf,
5691553Srgrimes				"%s must be connected to a nexus", cur.d_name);
5701553Srgrimes			yyerror(errbuf);
5711553Srgrimes		}
5721553Srgrimes		cur.d_conn = connect($2, $3);
5731553Srgrimes		} |
5741553Srgrimes	AT NEXUS NUMBER
5751553Srgrimes	      = { check_nexus(&cur, $3); cur.d_conn = TO_NEXUS; };
5761553Srgrimes
5771553SrgrimesInfo_list:
5781553Srgrimes	Info_list Info
5791553Srgrimes		|
5801553Srgrimes	/* lambda */
5811553Srgrimes		;
5821553Srgrimes
5831553SrgrimesInfo:
5841553Srgrimes	CSR NUMBER
5851553Srgrimes	      = { cur.d_addr = $2; } |
5869571Sgibbs	BUS NUMBER
5879571Sgibbs	      = {
5889571Sgibbs		if (cur.d_conn != 0 && cur.d_conn->d_type == CONTROLLER)
5899571Sgibbs			cur.d_slave = $2;
5909571Sgibbs		else
5919571Sgibbs			yyerror("can't specify a bus to something "
5929574Sgibbs				 "other than a controller");
5939571Sgibbs		} |
5946814Sdufault	TARGET NUMBER
5956814Sdufault	      = { cur.d_target = $2; } |
5966814Sdufault	UNIT NUMBER
5976814Sdufault	      = { cur.d_lun = $2; } |
5981553Srgrimes	DRIVE NUMBER
5991553Srgrimes	      = { cur.d_drive = $2; } |
6001553Srgrimes	SLAVE NUMBER
6011553Srgrimes	      = {
6021553Srgrimes		if (cur.d_conn != 0 && cur.d_conn != TO_NEXUS &&
6031553Srgrimes		    cur.d_conn->d_type == MASTER)
6041553Srgrimes			cur.d_slave = $2;
6051553Srgrimes		else
6061553Srgrimes			yyerror("can't specify slave--not to master");
6071553Srgrimes		} |
6081553Srgrimes	IRQ NUMBER
6091553Srgrimes	      = { cur.d_irq = $2; } |
6101553Srgrimes	DRQ NUMBER
6111553Srgrimes	      = { cur.d_drq = $2; } |
6121553Srgrimes	IOMEM NUMBER
6131553Srgrimes	      = { cur.d_maddr = $2; } |
6141553Srgrimes	IOSIZ NUMBER
6151553Srgrimes	      = { cur.d_msize = $2; } |
6161553Srgrimes	PORT device_name
61720458Sjoerg	      = { cur.d_port = $2; } |
6181553Srgrimes	PORT NUMBER
6191553Srgrimes	      = { cur.d_portn = $2; } |
62012772Speter	PORT AUTO
62112772Speter	      = { cur.d_portn = -1; } |
62212772Speter	PORT NONE
62312772Speter	      = { cur.d_portn = -2; } |
6241553Srgrimes	TTY
6251553Srgrimes	      = { cur.d_mask = "tty"; } |
6261553Srgrimes	BIO
6271553Srgrimes	      = { cur.d_mask = "bio"; } |
6281553Srgrimes	NET
6291553Srgrimes	      = { cur.d_mask = "net"; } |
6301553Srgrimes	FLAGS NUMBER
6318432Sjkh	      = { cur.d_flags = $2; } |
63215257Sbde	DISABLE
63315257Sbde	      = { cur.d_disabled = 1; } |
6348432Sjkh	CONFLICTS
6358432Sjkh	      = { cur.d_conflicts = 1; };
6361553Srgrimes
6371553SrgrimesInt_spec:
6381553Srgrimes	VECTOR Id_list
6391553Srgrimes	      = { cur.d_vec = $2; } |
6401553Srgrimes	PRIORITY NUMBER
6411553Srgrimes	      = { cur.d_pri = $2; } |
6421553Srgrimes	/* lambda */
6431553Srgrimes		;
6441553Srgrimes
6451553SrgrimesId_list:
6461553Srgrimes	Save_id
6471553Srgrimes	      = {
6481553Srgrimes		struct idlst *a = (struct idlst *)malloc(sizeof(struct idlst));
64912772Speter		memset(a, 0, sizeof(*a));
6501553Srgrimes		a->id = $1; a->id_next = 0; $$ = a;
6511553Srgrimes		} |
6521553Srgrimes	Save_id Id_list =
6531553Srgrimes		{
6541553Srgrimes		struct idlst *a = (struct idlst *)malloc(sizeof(struct idlst));
65512772Speter		memset(a, 0, sizeof(*a));
6561553Srgrimes	        a->id = $1; a->id_next = $2; $$ = a;
6571553Srgrimes		};
6581553Srgrimes
6591553Srgrimes%%
6601553Srgrimes
6611553Srgrimesyyerror(s)
6621553Srgrimes	char *s;
6631553Srgrimes{
6641553Srgrimes
6651553Srgrimes	fprintf(stderr, "config: line %d: %s\n", yyline + 1, s);
6661553Srgrimes}
6671553Srgrimes
6681553Srgrimes/*
6691553Srgrimes * add a device to the list of devices
6701553Srgrimes */
6711553Srgrimesnewdev(dp)
6721553Srgrimes	register struct device *dp;
6731553Srgrimes{
6741553Srgrimes	register struct device *np;
6751553Srgrimes
6761553Srgrimes	np = (struct device *) malloc(sizeof *np);
67712772Speter	memset(np, 0, sizeof(*np));
6781553Srgrimes	*np = *dp;
6791553Srgrimes	np->d_next = 0;
6801553Srgrimes	if (curp == 0)
6811553Srgrimes		dtab = np;
6821553Srgrimes	else
6831553Srgrimes		curp->d_next = np;
6841553Srgrimes	curp = np;
6851553Srgrimes}
6861553Srgrimes
6871553Srgrimes/*
6881553Srgrimes * note that a configuration should be made
6891553Srgrimes */
6901553Srgrimesmkconf(sysname)
6911553Srgrimes	char *sysname;
6921553Srgrimes{
6931553Srgrimes	register struct file_list *fl, **flp;
6941553Srgrimes
6951553Srgrimes	fl = (struct file_list *) malloc(sizeof *fl);
69612772Speter	memset(fl, 0, sizeof(*fl));
6971553Srgrimes	fl->f_type = SYSTEMSPEC;
6981553Srgrimes	fl->f_needs = sysname;
6991553Srgrimes	fl->f_rootdev = NODEV;
7001553Srgrimes	fl->f_dumpdev = NODEV;
7011553Srgrimes	fl->f_fn = 0;
7021553Srgrimes	fl->f_next = 0;
7031553Srgrimes	for (flp = confp; *flp; flp = &(*flp)->f_next)
7041553Srgrimes		;
7051553Srgrimes	*flp = fl;
7061553Srgrimes	confp = flp;
7071553Srgrimes}
7081553Srgrimes
7091553Srgrimesstruct file_list *
7101553Srgrimesnewflist(ftype)
7111553Srgrimes	u_char ftype;
7121553Srgrimes{
7131553Srgrimes	struct file_list *fl = (struct file_list *)malloc(sizeof (*fl));
71412772Speter	memset(fl, 0, sizeof(*fl));
7151553Srgrimes
7161553Srgrimes	fl->f_type = ftype;
7171553Srgrimes	fl->f_next = 0;
7181553Srgrimes	fl->f_swapdev = NODEV;
7191553Srgrimes	fl->f_swapsize = 0;
7201553Srgrimes	fl->f_needs = 0;
7211553Srgrimes	fl->f_fn = 0;
7221553Srgrimes	return (fl);
7231553Srgrimes}
7241553Srgrimes
7251553Srgrimes/*
7261553Srgrimes * Add a swap device to the system's configuration
7271553Srgrimes */
7281553Srgrimesmkswap(system, fl, size, flag)
7291553Srgrimes	struct file_list *system, *fl;
7301553Srgrimes	int size, flag;
7311553Srgrimes{
7321553Srgrimes	register struct file_list **flp;
7331553Srgrimes	char name[80];
7341553Srgrimes
7351553Srgrimes	if (system == 0 || system->f_type != SYSTEMSPEC) {
7361553Srgrimes		yyerror("\"swap\" spec precedes \"config\" specification");
7371553Srgrimes		return;
7381553Srgrimes	}
7391553Srgrimes	if (size < 0) {
7401553Srgrimes		yyerror("illegal swap partition size");
7411553Srgrimes		return;
7421553Srgrimes	}
7431553Srgrimes	/*
7441553Srgrimes	 * Append swap description to the end of the list.
7451553Srgrimes	 */
7461553Srgrimes	flp = &system->f_next;
7471553Srgrimes	for (; *flp && (*flp)->f_type == SWAPSPEC; flp = &(*flp)->f_next)
7481553Srgrimes		;
7491553Srgrimes	fl->f_next = *flp;
7501553Srgrimes	*flp = fl;
7511553Srgrimes	fl->f_swapsize = size;
7521553Srgrimes	fl->f_swapflag = flag;
7531553Srgrimes	/*
7541553Srgrimes	 * If first swap device for this system,
7551553Srgrimes	 * set up f_fn field to insure swap
7561553Srgrimes	 * files are created with unique names.
7571553Srgrimes	 */
7581553Srgrimes	if (system->f_fn)
7591553Srgrimes		return;
7601553Srgrimes	if (eq(fl->f_fn, "generic"))
7611553Srgrimes		system->f_fn = ns(fl->f_fn);
7621553Srgrimes	else
7631553Srgrimes		system->f_fn = ns(system->f_needs);
7641553Srgrimes}
7651553Srgrimes
7661553Srgrimesmkcomp(dp)
7671553Srgrimes	register struct device *dp;
7681553Srgrimes{
7691553Srgrimes	register struct file_list *fl, **flp;
7701553Srgrimes	char buf[80];
7711553Srgrimes
7721553Srgrimes	fl = (struct file_list *) malloc(sizeof *fl);
77312772Speter	memset(fl, 0, sizeof(*fl));
7741553Srgrimes	fl->f_type = COMPDEVICE;
7751553Srgrimes	fl->f_compinfo = dp->d_unit;
7761553Srgrimes	fl->f_fn = ns(dp->d_name);
7771553Srgrimes	(void) sprintf(buf, "%s%d", dp->d_name, dp->d_unit);
7781553Srgrimes	fl->f_needs = ns(buf);
7791553Srgrimes	fl->f_next = 0;
7801553Srgrimes	for (flp = compp; *flp; flp = &(*flp)->f_next)
7811553Srgrimes		;
7821553Srgrimes	*flp = fl;
7831553Srgrimes	compp = flp;
7841553Srgrimes}
7851553Srgrimes
7861553Srgrimesaddcomp(compdev, fl)
7871553Srgrimes	struct file_list *compdev, *fl;
7881553Srgrimes{
7891553Srgrimes	register struct file_list **flp;
7901553Srgrimes	char name[80];
7911553Srgrimes
7921553Srgrimes	if (compdev == 0 || compdev->f_type != COMPDEVICE) {
7931553Srgrimes		yyerror("component spec precedes device specification");
7941553Srgrimes		return;
7951553Srgrimes	}
7961553Srgrimes	/*
7971553Srgrimes	 * Append description to the end of the list.
7981553Srgrimes	 */
7991553Srgrimes	flp = &compdev->f_next;
8001553Srgrimes	for (; *flp && (*flp)->f_type == COMPSPEC; flp = &(*flp)->f_next)
8011553Srgrimes		;
8021553Srgrimes	fl->f_next = *flp;
8031553Srgrimes	*flp = fl;
8041553Srgrimes}
8051553Srgrimes
8061553Srgrimes/*
8071553Srgrimes * find the pointer to connect to the given device and number.
8081553Srgrimes * returns 0 if no such device and prints an error message
8091553Srgrimes */
8101553Srgrimesstruct device *
8111553Srgrimesconnect(dev, num)
8121553Srgrimes	register char *dev;
8131553Srgrimes	register int num;
8141553Srgrimes{
8151553Srgrimes	register struct device *dp;
8161553Srgrimes	struct device *huhcon();
8171553Srgrimes
8181553Srgrimes	if (num == QUES)
8191553Srgrimes		return (huhcon(dev));
8201553Srgrimes	for (dp = dtab; dp != 0; dp = dp->d_next) {
8211553Srgrimes		if ((num != dp->d_unit) || !eq(dev, dp->d_name))
8221553Srgrimes			continue;
8231553Srgrimes		if (dp->d_type != CONTROLLER && dp->d_type != MASTER) {
8241553Srgrimes			(void) sprintf(errbuf,
8251553Srgrimes			    "%s connected to non-controller", dev);
8261553Srgrimes			yyerror(errbuf);
8271553Srgrimes			return (0);
8281553Srgrimes		}
8291553Srgrimes		return (dp);
8301553Srgrimes	}
8311553Srgrimes	(void) sprintf(errbuf, "%s %d not defined", dev, num);
8321553Srgrimes	yyerror(errbuf);
8331553Srgrimes	return (0);
8341553Srgrimes}
8351553Srgrimes
8361553Srgrimes/*
8371553Srgrimes * connect to an unspecific thing
8381553Srgrimes */
8391553Srgrimesstruct device *
8401553Srgrimeshuhcon(dev)
8411553Srgrimes	register char *dev;
8421553Srgrimes{
8431553Srgrimes	register struct device *dp, *dcp;
8441553Srgrimes	struct device rdev;
8451553Srgrimes	int oldtype;
8461553Srgrimes
8471553Srgrimes	/*
8481553Srgrimes	 * First make certain that there are some of these to wildcard on
8491553Srgrimes	 */
8501553Srgrimes	for (dp = dtab; dp != 0; dp = dp->d_next)
8511553Srgrimes		if (eq(dp->d_name, dev))
8521553Srgrimes			break;
8531553Srgrimes	if (dp == 0) {
8541553Srgrimes		(void) sprintf(errbuf, "no %s's to wildcard", dev);
8551553Srgrimes		yyerror(errbuf);
8561553Srgrimes		return (0);
8571553Srgrimes	}
8581553Srgrimes	oldtype = dp->d_type;
8591553Srgrimes	dcp = dp->d_conn;
8601553Srgrimes	/*
8611553Srgrimes	 * Now see if there is already a wildcard entry for this device
8621553Srgrimes	 * (e.g. Search for a "uba ?")
8631553Srgrimes	 */
8641553Srgrimes	for (; dp != 0; dp = dp->d_next)
8651553Srgrimes		if (eq(dev, dp->d_name) && dp->d_unit == -1)
8661553Srgrimes			break;
8671553Srgrimes	/*
8681553Srgrimes	 * If there isn't, make one because everything needs to be connected
8691553Srgrimes	 * to something.
8701553Srgrimes	 */
8711553Srgrimes	if (dp == 0) {
8721553Srgrimes		dp = &rdev;
8731553Srgrimes		init_dev(dp);
8741553Srgrimes		dp->d_unit = QUES;
8751553Srgrimes		dp->d_name = ns(dev);
8761553Srgrimes		dp->d_type = oldtype;
8771553Srgrimes		newdev(dp);
8781553Srgrimes		dp = curp;
8791553Srgrimes		/*
8801553Srgrimes		 * Connect it to the same thing that other similar things are
8811553Srgrimes		 * connected to, but make sure it is a wildcard unit
8821553Srgrimes		 * (e.g. up connected to sc ?, here we make connect sc? to a
8831553Srgrimes		 * uba?).  If other things like this are on the NEXUS or
8841553Srgrimes		 * if they aren't connected to anything, then make the same
8851553Srgrimes		 * connection, else call ourself to connect to another
8861553Srgrimes		 * unspecific device.
8871553Srgrimes		 */
8881553Srgrimes		if (dcp == TO_NEXUS || dcp == 0)
8891553Srgrimes			dp->d_conn = dcp;
8901553Srgrimes		else
8911553Srgrimes			dp->d_conn = connect(dcp->d_name, QUES);
8921553Srgrimes	}
8931553Srgrimes	return (dp);
8941553Srgrimes}
8951553Srgrimes
8961553Srgrimesinit_dev(dp)
8971553Srgrimes	register struct device *dp;
8981553Srgrimes{
8991553Srgrimes
9001553Srgrimes	dp->d_name = "OHNO!!!";
9011553Srgrimes	dp->d_type = DEVICE;
9021553Srgrimes	dp->d_conn = 0;
9038432Sjkh	dp->d_conflicts = 0;
90415257Sbde	dp->d_disabled = 0;
9051553Srgrimes	dp->d_vec = 0;
9061553Srgrimes	dp->d_addr = dp->d_flags = dp->d_dk = 0;
9071553Srgrimes	dp->d_pri = -1;
9086814Sdufault	dp->d_slave = dp->d_lun = dp->d_target = dp->d_drive = dp->d_unit = UNKNOWN;
9091553Srgrimes	dp->d_port = (char *)0;
9101553Srgrimes	dp->d_portn = 0;
9111553Srgrimes	dp->d_irq = -1;
9121553Srgrimes	dp->d_drq = -1;
9131553Srgrimes	dp->d_maddr = 0;
9141553Srgrimes	dp->d_msize = 0;
9151553Srgrimes	dp->d_mask = "null";
9161553Srgrimes}
9171553Srgrimes
9181553Srgrimes/*
9191553Srgrimes * make certain that this is a reasonable type of thing to connect to a nexus
9201553Srgrimes */
9211553Srgrimescheck_nexus(dev, num)
9221553Srgrimes	register struct device *dev;
9231553Srgrimes	int num;
9241553Srgrimes{
9251553Srgrimes
9261553Srgrimes	switch (machine) {
9271553Srgrimes
9281553Srgrimes	case MACHINE_VAX:
9291553Srgrimes		if (!eq(dev->d_name, "uba") && !eq(dev->d_name, "mba") &&
9301553Srgrimes		    !eq(dev->d_name, "bi"))
9311553Srgrimes			yyerror("only uba's, mba's, and bi's should be connected to the nexus");
9321553Srgrimes		if (num != QUES)
9331553Srgrimes			yyerror("can't give specific nexus numbers");
9341553Srgrimes		break;
9351553Srgrimes
9361553Srgrimes	case MACHINE_TAHOE:
9371553Srgrimes		if (!eq(dev->d_name, "vba"))
9381553Srgrimes			yyerror("only vba's should be connected to the nexus");
9391553Srgrimes		break;
9401553Srgrimes
9411553Srgrimes	case MACHINE_HP300:
9421553Srgrimes	case MACHINE_LUNA68K:
9431553Srgrimes		if (num != QUES)
9441553Srgrimes			dev->d_addr = num;
9451553Srgrimes		break;
9461553Srgrimes
9471553Srgrimes	case MACHINE_I386:
9481553Srgrimes		if (!eq(dev->d_name, "isa"))
9491553Srgrimes			yyerror("only isa's should be connected to the nexus");
9501553Srgrimes		break;
9511553Srgrimes
9521553Srgrimes	case MACHINE_NEWS3400:
9531553Srgrimes		if (!eq(dev->d_name, "iop") && !eq(dev->d_name, "hb") &&
9541553Srgrimes		    !eq(dev->d_name, "vme"))
9551553Srgrimes			yyerror("only iop's, hb's and vme's should be connected to the nexus");
9561553Srgrimes		break;
9571553Srgrimes	}
9581553Srgrimes}
9591553Srgrimes
9601553Srgrimes/*
9611553Srgrimes * Check system specification and apply defaulting
9621553Srgrimes * rules on root, argument, dump, and swap devices.
9631553Srgrimes */
9641553Srgrimeschecksystemspec(fl)
9651553Srgrimes	register struct file_list *fl;
9661553Srgrimes{
9671553Srgrimes	char buf[BUFSIZ];
9681553Srgrimes	register struct file_list *swap;
9691553Srgrimes	int generic;
9701553Srgrimes
9711553Srgrimes	if (fl == 0 || fl->f_type != SYSTEMSPEC) {
9721553Srgrimes		yyerror("internal error, bad system specification");
9731553Srgrimes		exit(1);
9741553Srgrimes	}
9751553Srgrimes	swap = fl->f_next;
9761553Srgrimes	generic = swap && swap->f_type == SWAPSPEC && eq(swap->f_fn, "generic");
9771553Srgrimes	if (fl->f_rootdev == NODEV && !generic) {
9781553Srgrimes		yyerror("no root device specified");
9791553Srgrimes		exit(1);
9801553Srgrimes	}
9811553Srgrimes	/*
9821553Srgrimes	 * Default swap area to be in 'b' partition of root's
9831553Srgrimes	 * device.  If root specified to be other than on 'a'
9841553Srgrimes	 * partition, give warning, something probably amiss.
9851553Srgrimes	 */
9861553Srgrimes	if (swap == 0 || swap->f_type != SWAPSPEC) {
9871553Srgrimes		dev_t dev;
9881553Srgrimes
9891553Srgrimes		swap = newflist(SWAPSPEC);
9901553Srgrimes		dev = fl->f_rootdev;
9916497Sbde		if (dkpart(dev) != 0) {
9921553Srgrimes			(void) sprintf(buf,
9931553Srgrimes"Warning, swap defaulted to 'b' partition with root on '%c' partition",
9946497Sbde				dkpart(dev) + 'a');
9951553Srgrimes			yyerror(buf);
9961553Srgrimes		}
9976497Sbde		swap->f_swapdev = dkmodpart(dev, SWAP_PART);
9981553Srgrimes		swap->f_fn = devtoname(swap->f_swapdev);
9991553Srgrimes		mkswap(fl, swap, 0);
10001553Srgrimes	}
10011553Srgrimes	/*
10021553Srgrimes	 * Make sure a generic swap isn't specified, along with
10031553Srgrimes	 * other stuff (user must really be confused).
10041553Srgrimes	 */
10051553Srgrimes	if (generic) {
10061553Srgrimes		if (fl->f_rootdev != NODEV)
10071553Srgrimes			yyerror("root device specified with generic swap");
10081553Srgrimes		if (fl->f_dumpdev != NODEV)
10091553Srgrimes			yyerror("dump device specified with generic swap");
10101553Srgrimes		return;
10111553Srgrimes	}
10121553Srgrimes	/*
10138480Swollman	 * Warn if dump device is not a swap area.
10141553Srgrimes	 */
10158480Swollman	if (fl->f_dumpdev != NODEV && fl->f_dumpdev != swap->f_swapdev) {
10161553Srgrimes		struct file_list *p = swap->f_next;
10171553Srgrimes
10181553Srgrimes		for (; p && p->f_type == SWAPSPEC; p = p->f_next)
10191553Srgrimes			if (fl->f_dumpdev == p->f_swapdev)
10201553Srgrimes				return;
10211553Srgrimes		(void) sprintf(buf,
10221553Srgrimes		    "Warning: dump device is not a swap partition");
10231553Srgrimes		yyerror(buf);
10241553Srgrimes	}
10251553Srgrimes}
10261553Srgrimes
10271553Srgrimes/*
10281553Srgrimes * Verify all devices specified in the system specification
10291553Srgrimes * are present in the device specifications.
10301553Srgrimes */
10311553Srgrimesverifysystemspecs()
10321553Srgrimes{
10331553Srgrimes	register struct file_list *fl;
10341553Srgrimes	dev_t checked[50], *verifyswap();
10351553Srgrimes	register dev_t *pchecked = checked;
10361553Srgrimes
10371553Srgrimes	for (fl = conf_list; fl; fl = fl->f_next) {
10381553Srgrimes		if (fl->f_type != SYSTEMSPEC)
10391553Srgrimes			continue;
10401553Srgrimes		if (!finddev(fl->f_rootdev))
10411553Srgrimes			deverror(fl->f_needs, "root");
10421553Srgrimes		*pchecked++ = fl->f_rootdev;
10431553Srgrimes		pchecked = verifyswap(fl->f_next, checked, pchecked);
10441553Srgrimes		if (!alreadychecked(fl->f_dumpdev, checked, pchecked)) {
10451553Srgrimes			if (!finddev(fl->f_dumpdev))
10461553Srgrimes				deverror(fl->f_needs, "dump");
10471553Srgrimes			*pchecked++ = fl->f_dumpdev;
10481553Srgrimes		}
10491553Srgrimes	}
10501553Srgrimes}
10511553Srgrimes
10521553Srgrimes/*
10531553Srgrimes * Do as above, but for swap devices.
10541553Srgrimes */
10551553Srgrimesdev_t *
10561553Srgrimesverifyswap(fl, checked, pchecked)
10571553Srgrimes	register struct file_list *fl;
10581553Srgrimes	dev_t checked[];
10591553Srgrimes	register dev_t *pchecked;
10601553Srgrimes{
10611553Srgrimes
10621553Srgrimes	for (;fl && fl->f_type == SWAPSPEC; fl = fl->f_next) {
10631553Srgrimes		if (eq(fl->f_fn, "generic"))
10641553Srgrimes			continue;
10651553Srgrimes		if (alreadychecked(fl->f_swapdev, checked, pchecked))
10661553Srgrimes			continue;
10671553Srgrimes		if (!finddev(fl->f_swapdev))
10681553Srgrimes			fprintf(stderr,
10691553Srgrimes			   "config: swap device %s not configured", fl->f_fn);
10701553Srgrimes		*pchecked++ = fl->f_swapdev;
10711553Srgrimes	}
10721553Srgrimes	return (pchecked);
10731553Srgrimes}
10741553Srgrimes
10751553Srgrimes/*
10761553Srgrimes * Verify that components of a compound device have themselves been config'ed
10771553Srgrimes */
10781553Srgrimesverifycomp(fl)
10791553Srgrimes	register struct file_list *fl;
10801553Srgrimes{
10811553Srgrimes	char *dname = fl->f_needs;
10821553Srgrimes
10831553Srgrimes	for (fl = fl->f_next; fl; fl = fl->f_next) {
10841553Srgrimes		if (fl->f_type != COMPSPEC || finddev(fl->f_compdev))
10851553Srgrimes			continue;
10861553Srgrimes		fprintf(stderr,
10871553Srgrimes			"config: %s: component device %s not configured\n",
10881553Srgrimes			dname, fl->f_needs);
10891553Srgrimes	}
10901553Srgrimes}
10911553Srgrimes
10921553Srgrimes/*
10931553Srgrimes * Has a device already been checked
10946497Sbde * for its existence in the configuration?
10951553Srgrimes */
10961553Srgrimesalreadychecked(dev, list, last)
10971553Srgrimes	dev_t dev, list[];
10981553Srgrimes	register dev_t *last;
10991553Srgrimes{
11001553Srgrimes	register dev_t *p;
11011553Srgrimes
11021553Srgrimes	for (p = list; p < last; p++)
11036497Sbde		if (dkmodpart(*p, 0) != dkmodpart(dev, 0))
11041553Srgrimes			return (1);
11051553Srgrimes	return (0);
11061553Srgrimes}
11071553Srgrimes
11081553Srgrimesdeverror(systemname, devtype)
11091553Srgrimes	char *systemname, *devtype;
11101553Srgrimes{
11111553Srgrimes
11121553Srgrimes	fprintf(stderr, "config: %s: %s device not configured\n",
11131553Srgrimes		systemname, devtype);
11141553Srgrimes}
11151553Srgrimes
11161553Srgrimes/*
11171553Srgrimes * Look for the device in the list of
11181553Srgrimes * configured hardware devices.  Must
11191553Srgrimes * take into account stuff wildcarded.
11201553Srgrimes */
11211553Srgrimes/*ARGSUSED*/
11221553Srgrimesfinddev(dev)
11231553Srgrimes	dev_t dev;
11241553Srgrimes{
11251553Srgrimes
11261553Srgrimes	/* punt on this right now */
11271553Srgrimes	return (1);
11281553Srgrimes}
1129