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