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