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