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