config.y revision 53047
11553Srgrimes%union {
21553Srgrimes	char	*str;
31553Srgrimes	int	val;
41553Srgrimes	struct	file_list *file;
51553Srgrimes}
61553Srgrimes
71553Srgrimes%token	ANY
852653Smarcel%token	ARCH
91553Srgrimes%token	AT
109571Sgibbs%token	BUS
111553Srgrimes%token	COMMA
1246855Speter%token	CONFIG
138432Sjkh%token	CONFLICTS
141553Srgrimes%token	CONTROLLER
151553Srgrimes%token	CPU
161553Srgrimes%token	DEVICE
1715257Sbde%token	DISABLE
181553Srgrimes%token	DISK
191553Srgrimes%token	DRIVE
201553Srgrimes%token	DRQ
211553Srgrimes%token	EQUALS
221553Srgrimes%token	FLAGS
231553Srgrimes%token	IDENT
241553Srgrimes%token	IOMEM
251553Srgrimes%token	IOSIZ
261553Srgrimes%token	IRQ
271553Srgrimes%token	MAXUSERS
281553Srgrimes%token	MINUS
291553Srgrimes%token	NEXUS
301553Srgrimes%token	OPTIONS
311553Srgrimes%token	MAKEOPTIONS
321553Srgrimes%token	PORT
331553Srgrimes%token	PSEUDO_DEVICE
341553Srgrimes%token	SEMICOLON
3553047Speter%token	TAPE
366814Sdufault%token	TARGET
371553Srgrimes%token	TTY
386814Sdufault%token	UNIT
391553Srgrimes%token	VECTOR
401553Srgrimes
411553Srgrimes%token	<str>	ID
421553Srgrimes%token	<val>	NUMBER
431553Srgrimes%token	<val>	FPNUMBER
441553Srgrimes
451553Srgrimes%type	<str>	Save_id
4646104Sluoqi%type	<str>	Opt_value
471553Srgrimes%type	<str>	Dev
481553Srgrimes%type	<str>	device_name
491553Srgrimes
501553Srgrimes%{
511553Srgrimes
521553Srgrimes/*
531553Srgrimes * Copyright (c) 1988, 1993
541553Srgrimes *	The Regents of the University of California.  All rights reserved.
551553Srgrimes *
561553Srgrimes * Redistribution and use in source and binary forms, with or without
571553Srgrimes * modification, are permitted provided that the following conditions
581553Srgrimes * are met:
591553Srgrimes * 1. Redistributions of source code must retain the above copyright
601553Srgrimes *    notice, this list of conditions and the following disclaimer.
611553Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
621553Srgrimes *    notice, this list of conditions and the following disclaimer in the
631553Srgrimes *    documentation and/or other materials provided with the distribution.
641553Srgrimes * 3. All advertising materials mentioning features or use of this software
651553Srgrimes *    must display the following acknowledgement:
661553Srgrimes *	This product includes software developed by the University of
671553Srgrimes *	California, Berkeley and its contributors.
681553Srgrimes * 4. Neither the name of the University nor the names of its contributors
691553Srgrimes *    may be used to endorse or promote products derived from this software
701553Srgrimes *    without specific prior written permission.
711553Srgrimes *
721553Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
731553Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
741553Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
751553Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
761553Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
771553Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
781553Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
791553Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
801553Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
811553Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
821553Srgrimes * SUCH DAMAGE.
831553Srgrimes *
841553Srgrimes *	@(#)config.y	8.1 (Berkeley) 6/6/93
8552007Speter * $FreeBSD: head/usr.sbin/config/config.y 53047 1999-11-09 07:20:22Z peter $
861553Srgrimes */
871553Srgrimes
881553Srgrimes#include <ctype.h>
8929451Scharnier#include <err.h>
901553Srgrimes#include <stdio.h>
9112772Speter#include <string.h>
921553Srgrimes
9345775Speter#include "config.h"
9445775Speter
9545744Speterstatic struct	device cur;
9645744Speterstatic struct	device *curp = 0;
971553Srgrimes
9845744Speterstruct  device *dtab;
9945744Speterchar	*ident;
10045744Speterint	yyline;
10146821Speterstruct  file_list *ftab;
10245744Speterchar	errbuf[80];
10345744Speterint	maxusers;
10445744Speter
10545744Speterint	seen_scbus;
10645744Speter
10720458Sjoerg#define ns(s)	strdup(s)
10820458Sjoerg
10945744Speterstatic struct device *connect __P((char *, int));
11045744Speterstatic struct device *huhcon __P((char *));
11145775Speterstatic void yyerror __P((char *s));
11229451Scharnier
11345775Speter
1141553Srgrimes%}
1151553Srgrimes%%
1161553SrgrimesConfiguration:
1171553Srgrimes	Many_specs
1181553Srgrimes		;
1191553Srgrimes
1201553SrgrimesMany_specs:
1211553Srgrimes	Many_specs Spec
1221553Srgrimes		|
1231553Srgrimes	/* lambda */
1241553Srgrimes		;
1251553Srgrimes
1261553SrgrimesSpec:
1271553Srgrimes	Device_spec SEMICOLON
1281553Srgrimes	      = { newdev(&cur); } |
1291553Srgrimes	Config_spec SEMICOLON
1301553Srgrimes		|
1311553Srgrimes	SEMICOLON
1321553Srgrimes		|
1331553Srgrimes	error SEMICOLON
1341553Srgrimes		;
1351553Srgrimes
1361553SrgrimesConfig_spec:
13752653Smarcel	ARCH Save_id
1381553Srgrimes	    = {
13945744Speter		if (!strcmp($2, "i386")) {
1401553Srgrimes			machine = MACHINE_I386;
1411553Srgrimes			machinename = "i386";
14235609Skato		} else if (!strcmp($2, "pc98")) {
14335609Skato			machine = MACHINE_PC98;
14435609Skato			machinename = "pc98";
14536813Sdfr		} else if (!strcmp($2, "alpha")) {
14636813Sdfr			machine = MACHINE_ALPHA;
14736813Sdfr			machinename = "alpha";
1481553Srgrimes		} else
1491553Srgrimes			yyerror("Unknown machine type");
1501553Srgrimes	      } |
15146104Sluoqi	CPU Save_id
1521553Srgrimes	      = {
1531553Srgrimes		struct cputype *cp =
1541553Srgrimes		    (struct cputype *)malloc(sizeof (struct cputype));
15512772Speter		memset(cp, 0, sizeof(*cp));
15620458Sjoerg		cp->cpu_name = $2;
1571553Srgrimes		cp->cpu_next = cputype;
1581553Srgrimes		cputype = cp;
1591553Srgrimes	      } |
1601553Srgrimes	OPTIONS Opt_list
1611553Srgrimes		|
1621553Srgrimes	MAKEOPTIONS Mkopt_list
1631553Srgrimes		|
1641553Srgrimes	IDENT ID
16520458Sjoerg	      = { ident = $2; } |
16646855Speter	System_spec
16746855Speter		|
1681553Srgrimes	MAXUSERS NUMBER
1691553Srgrimes	      = { maxusers = $2; };
1701553Srgrimes
17146855SpeterSystem_spec:
17246855Speter	CONFIG System_id System_parameter_list
17346855Speter	  = { warnx("line %d: root/dump/swap specifications obsolete", yyline);}
17446855Speter	  |
17546855Speter	CONFIG System_id
17646855Speter	  ;
17746855Speter
17846855SpeterSystem_id:
17946855Speter	Save_id
18046855Speter	      = {
18146855Speter		struct opt *op = (struct opt *)malloc(sizeof (struct opt));
18246855Speter		memset(op, 0, sizeof(*op));
18346855Speter		op->op_name = ns("KERNEL");
18446855Speter		op->op_ownfile = 0;
18546855Speter		op->op_next = mkopt;
18646855Speter		op->op_value = $1;
18746855Speter		op->op_line = yyline + 1;
18846855Speter		mkopt = op;
18946855Speter	      };
19046855Speter
19146855SpeterSystem_parameter_list:
19246855Speter	  System_parameter_list ID
19346855Speter	| ID
19446855Speter	;
19546855Speter
1961553Srgrimesdevice_name:
1971553Srgrimes	  Save_id
1981553Srgrimes		= { $$ = $1; }
1991553Srgrimes	| Save_id NUMBER
2001553Srgrimes		= {
2011553Srgrimes			char buf[80];
2021553Srgrimes
20346021Speter			(void) snprintf(buf, sizeof(buf), "%s%d", $1, $2);
2041553Srgrimes			$$ = ns(buf); free($1);
2051553Srgrimes		}
2061553Srgrimes	| Save_id NUMBER ID
2071553Srgrimes		= {
2081553Srgrimes			char buf[80];
2091553Srgrimes
21046021Speter			(void) snprintf(buf, sizeof(buf), "%s%d%s", $1, $2, $3);
2111553Srgrimes			$$ = ns(buf); free($1);
2121553Srgrimes		}
2136497Sbde	| Save_id NUMBER ID NUMBER
2146497Sbde		= {
2156497Sbde			char buf[80];
2166497Sbde
21746021Speter			(void) snprintf(buf, sizeof(buf), "%s%d%s%d",
21846021Speter			     $1, $2, $3, $4);
2196497Sbde			$$ = ns(buf); free($1);
2206497Sbde		}
2216497Sbde	| Save_id NUMBER ID NUMBER ID
2226497Sbde		= {
2236497Sbde			char buf[80];
2246497Sbde
22546021Speter			(void) snprintf(buf, sizeof(buf), "%s%d%s%d%s",
22620457Sjoerg			     $1, $2, $3, $4, $5);
2276497Sbde			$$ = ns(buf); free($1);
2286497Sbde		}
2291553Srgrimes	;
2301553Srgrimes
2311553SrgrimesOpt_list:
2321553Srgrimes	Opt_list COMMA Option
2331553Srgrimes		|
2341553Srgrimes	Option
2351553Srgrimes		;
2361553Srgrimes
2371553SrgrimesOption:
23846104Sluoqi	Save_id
2391553Srgrimes	      = {
2401553Srgrimes		struct opt *op = (struct opt *)malloc(sizeof (struct opt));
24112772Speter		char *s;
24212772Speter		memset(op, 0, sizeof(*op));
24320458Sjoerg		op->op_name = $1;
2441553Srgrimes		op->op_next = opt;
2451553Srgrimes		op->op_value = 0;
24637576Sbde		/*
24737576Sbde		 * op->op_line is 1-based; yyline is 0-based but is now 1
24837576Sbde		 * larger than when `Save_id' was lexed.
24937576Sbde		 */
25033538Seivind		op->op_line = yyline;
2511553Srgrimes		opt = op;
25229451Scharnier		if ((s = strchr(op->op_name, '='))) {
25346021Speter			warnx("line %d: The `=' in options should not be quoted", yyline);
25412772Speter			*s = '\0';
25512772Speter			op->op_value = ns(s + 1);
25612772Speter		}
2571553Srgrimes	      } |
25846104Sluoqi	Save_id EQUALS Opt_value
2591553Srgrimes	      = {
2601553Srgrimes		struct opt *op = (struct opt *)malloc(sizeof (struct opt));
26112772Speter		memset(op, 0, sizeof(*op));
26220458Sjoerg		op->op_name = $1;
2631553Srgrimes		op->op_next = opt;
26420458Sjoerg		op->op_value = $3;
26537576Sbde		op->op_line = yyline + 1;
2661553Srgrimes		opt = op;
2671553Srgrimes	      } ;
2681553Srgrimes
26946104SluoqiOpt_value:
2701553Srgrimes	ID
27146021Speter		= { $$ = $1; } |
2721553Srgrimes	NUMBER
27346021Speter		= {
27446021Speter			char buf[80];
2751553Srgrimes
27646021Speter			(void) snprintf(buf, sizeof(buf), "%d", $1);
27746021Speter			$$ = ns(buf);
27846021Speter		} ;
2791553Srgrimes
2801553SrgrimesSave_id:
2811553Srgrimes	ID
28220458Sjoerg	      = { $$ = $1; }
2831553Srgrimes	;
2841553Srgrimes
2851553SrgrimesMkopt_list:
2861553Srgrimes	Mkopt_list COMMA Mkoption
2871553Srgrimes		|
2881553Srgrimes	Mkoption
2891553Srgrimes		;
2901553Srgrimes
2911553SrgrimesMkoption:
29246104Sluoqi	Save_id EQUALS Opt_value
2931553Srgrimes	      = {
2941553Srgrimes		struct opt *op = (struct opt *)malloc(sizeof (struct opt));
29512772Speter		memset(op, 0, sizeof(*op));
29620458Sjoerg		op->op_name = $1;
29712772Speter		op->op_ownfile = 0;	/* for now */
2981553Srgrimes		op->op_next = mkopt;
29920458Sjoerg		op->op_value = $3;
30037576Sbde		op->op_line = yyline + 1;
3011553Srgrimes		mkopt = op;
3021553Srgrimes	      } ;
3031553Srgrimes
3041553SrgrimesDev:
3051553Srgrimes	ID
30620458Sjoerg	      = { $$ = $1; }
3071553Srgrimes	;
3081553Srgrimes
3091553SrgrimesDevice_spec:
31052098Speter	DEVICE Dev_name Dev_info
3111553Srgrimes	      = { cur.d_type = DEVICE; } |
31252098Speter	DISK Dev_name Dev_info
31353047Speter	      = {
31453047Speter		warnx("line %d: Obsolete keyword 'disk' found - use 'device'", yyline);
31553047Speter		cur.d_type = DEVICE;
31653047Speter		} |
31753047Speter	TAPE Dev_name Dev_info
31853047Speter	      = {
31953047Speter		warnx("line %d: Obsolete keyword 'tape' found - use 'device'", yyline);
32053047Speter		cur.d_type = DEVICE;
32153047Speter		} |
32252098Speter	CONTROLLER Dev_name Dev_info
3231553Srgrimes	      = { cur.d_type = CONTROLLER; } |
3241553Srgrimes	PSEUDO_DEVICE Init_dev Dev
3251553Srgrimes	      = {
3261553Srgrimes		cur.d_name = $3;
3271553Srgrimes		cur.d_type = PSEUDO_DEVICE;
3281553Srgrimes		} |
3291553Srgrimes	PSEUDO_DEVICE Init_dev Dev NUMBER
3301553Srgrimes	      = {
3311553Srgrimes		cur.d_name = $3;
3321553Srgrimes		cur.d_type = PSEUDO_DEVICE;
33352098Speter		cur.d_count = $4;
33446021Speter		} ;
3351553Srgrimes
3361553SrgrimesDev_name:
3371553Srgrimes	Init_dev Dev NUMBER
3381553Srgrimes	      = {
3391553Srgrimes		cur.d_name = $2;
34045775Speter		if (eq($2, "scbus"))
3416814Sdufault			seen_scbus = 1;
3421553Srgrimes		cur.d_unit = $3;
3431553Srgrimes		};
3441553Srgrimes
3451553SrgrimesInit_dev:
3461553Srgrimes	/* lambda */
3471553Srgrimes	      = { init_dev(&cur); };
3481553Srgrimes
3491553SrgrimesDev_info:
3501553Srgrimes	Con_info Info_list
3511553Srgrimes		|
3521553Srgrimes	/* lambda */
3531553Srgrimes		;
3541553Srgrimes
3551553SrgrimesCon_info:
3561553Srgrimes	AT Dev NUMBER
3571553Srgrimes	      = {
3581553Srgrimes		if (eq(cur.d_name, "mba") || eq(cur.d_name, "uba")) {
35946021Speter			(void) snprintf(errbuf, sizeof(errbuf),
3601553Srgrimes				"%s must be connected to a nexus", cur.d_name);
3611553Srgrimes			yyerror(errbuf);
3621553Srgrimes		}
3631553Srgrimes		cur.d_conn = connect($2, $3);
3641553Srgrimes		} |
3651553Srgrimes	AT NEXUS NUMBER
36652098Speter	      = { cur.d_conn = TO_NEXUS; };
3671553Srgrimes
3681553SrgrimesInfo_list:
3691553Srgrimes	Info_list Info
3701553Srgrimes		|
3711553Srgrimes	/* lambda */
3721553Srgrimes		;
3731553Srgrimes
3741553SrgrimesInfo:
37552098Speter	BUS NUMBER	/* controller scbus1 at ahc0 bus 1 - twin channel */
3769571Sgibbs	      = {
3779571Sgibbs		if (cur.d_conn != 0 && cur.d_conn->d_type == CONTROLLER)
3789571Sgibbs			cur.d_slave = $2;
3799571Sgibbs		else
3809571Sgibbs			yyerror("can't specify a bus to something "
3819574Sgibbs				 "other than a controller");
3829571Sgibbs		} |
3836814Sdufault	TARGET NUMBER
3846814Sdufault	      = { cur.d_target = $2; } |
3856814Sdufault	UNIT NUMBER
3866814Sdufault	      = { cur.d_lun = $2; } |
3871553Srgrimes	DRIVE NUMBER
3881553Srgrimes	      = { cur.d_drive = $2; } |
3891553Srgrimes	IRQ NUMBER
3901553Srgrimes	      = { cur.d_irq = $2; } |
3911553Srgrimes	DRQ NUMBER
3921553Srgrimes	      = { cur.d_drq = $2; } |
3931553Srgrimes	IOMEM NUMBER
3941553Srgrimes	      = { cur.d_maddr = $2; } |
3951553Srgrimes	IOSIZ NUMBER
3961553Srgrimes	      = { cur.d_msize = $2; } |
3971553Srgrimes	PORT device_name
39820458Sjoerg	      = { cur.d_port = $2; } |
3991553Srgrimes	PORT NUMBER
4001553Srgrimes	      = { cur.d_portn = $2; } |
4011553Srgrimes	FLAGS NUMBER
4028432Sjkh	      = { cur.d_flags = $2; } |
40315257Sbde	DISABLE
40415257Sbde	      = { cur.d_disabled = 1; } |
4058432Sjkh	CONFLICTS
4068432Sjkh	      = { cur.d_conflicts = 1; };
4071553Srgrimes
4081553Srgrimes%%
4091553Srgrimes
41045775Speterstatic void
4111553Srgrimesyyerror(s)
4121553Srgrimes	char *s;
4131553Srgrimes{
41429493Scharnier
41529451Scharnier	warnx("line %d: %s", yyline + 1, s);
4161553Srgrimes}
4171553Srgrimes
4181553Srgrimes/*
4191553Srgrimes * add a device to the list of devices
4201553Srgrimes */
42145744Speterstatic void
4221553Srgrimesnewdev(dp)
4231553Srgrimes	register struct device *dp;
4241553Srgrimes{
42546021Speter	register struct device *np, *xp;
4261553Srgrimes
42746021Speter	if (dp->d_unit >= 0) {
42846021Speter		for (xp = dtab; xp != 0; xp = xp->d_next) {
42946021Speter			if ((xp->d_unit == dp->d_unit) &&
43046021Speter			    eq(xp->d_name, dp->d_name)) {
43146021Speter				warnx("line %d: already seen device %s%d",
43246021Speter				    yyline, xp->d_name, xp->d_unit);
43346021Speter			}
43446021Speter		}
43546021Speter	}
4361553Srgrimes	np = (struct device *) malloc(sizeof *np);
43712772Speter	memset(np, 0, sizeof(*np));
4381553Srgrimes	*np = *dp;
4391553Srgrimes	np->d_next = 0;
4401553Srgrimes	if (curp == 0)
4411553Srgrimes		dtab = np;
4421553Srgrimes	else
4431553Srgrimes		curp->d_next = np;
4441553Srgrimes	curp = np;
4451553Srgrimes}
4461553Srgrimes
4471553Srgrimes
4481553Srgrimes/*
4491553Srgrimes * find the pointer to connect to the given device and number.
4501553Srgrimes * returns 0 if no such device and prints an error message
4511553Srgrimes */
45245744Speterstatic struct device *
4531553Srgrimesconnect(dev, num)
4541553Srgrimes	register char *dev;
4551553Srgrimes	register int num;
4561553Srgrimes{
4571553Srgrimes	register struct device *dp;
4581553Srgrimes
4591553Srgrimes	if (num == QUES)
4601553Srgrimes		return (huhcon(dev));
4611553Srgrimes	for (dp = dtab; dp != 0; dp = dp->d_next) {
4621553Srgrimes		if ((num != dp->d_unit) || !eq(dev, dp->d_name))
4631553Srgrimes			continue;
46452098Speter		if (dp->d_type != CONTROLLER) {
46546021Speter			(void) snprintf(errbuf, sizeof(errbuf),
4661553Srgrimes			    "%s connected to non-controller", dev);
4671553Srgrimes			yyerror(errbuf);
4681553Srgrimes			return (0);
4691553Srgrimes		}
4701553Srgrimes		return (dp);
4711553Srgrimes	}
47246021Speter	(void) snprintf(errbuf, sizeof(errbuf), "%s %d not defined", dev, num);
4731553Srgrimes	yyerror(errbuf);
4741553Srgrimes	return (0);
4751553Srgrimes}
4761553Srgrimes
4771553Srgrimes/*
4781553Srgrimes * connect to an unspecific thing
4791553Srgrimes */
48045744Speterstatic struct device *
4811553Srgrimeshuhcon(dev)
4821553Srgrimes	register char *dev;
4831553Srgrimes{
4841553Srgrimes	register struct device *dp, *dcp;
4851553Srgrimes	struct device rdev;
4861553Srgrimes	int oldtype;
4871553Srgrimes
4881553Srgrimes	/*
4891553Srgrimes	 * First make certain that there are some of these to wildcard on
4901553Srgrimes	 */
4911553Srgrimes	for (dp = dtab; dp != 0; dp = dp->d_next)
4921553Srgrimes		if (eq(dp->d_name, dev))
4931553Srgrimes			break;
4941553Srgrimes	if (dp == 0) {
49546021Speter		(void) snprintf(errbuf, sizeof(errbuf), "no %s's to wildcard",
49646021Speter		   dev);
4971553Srgrimes		yyerror(errbuf);
4981553Srgrimes		return (0);
4991553Srgrimes	}
5001553Srgrimes	oldtype = dp->d_type;
5011553Srgrimes	dcp = dp->d_conn;
5021553Srgrimes	/*
5031553Srgrimes	 * Now see if there is already a wildcard entry for this device
5041553Srgrimes	 * (e.g. Search for a "uba ?")
5051553Srgrimes	 */
5061553Srgrimes	for (; dp != 0; dp = dp->d_next)
5071553Srgrimes		if (eq(dev, dp->d_name) && dp->d_unit == -1)
5081553Srgrimes			break;
5091553Srgrimes	/*
5101553Srgrimes	 * If there isn't, make one because everything needs to be connected
5111553Srgrimes	 * to something.
5121553Srgrimes	 */
5131553Srgrimes	if (dp == 0) {
5141553Srgrimes		dp = &rdev;
5151553Srgrimes		init_dev(dp);
5161553Srgrimes		dp->d_unit = QUES;
5171553Srgrimes		dp->d_name = ns(dev);
5181553Srgrimes		dp->d_type = oldtype;
5191553Srgrimes		newdev(dp);
5201553Srgrimes		dp = curp;
5211553Srgrimes		/*
5221553Srgrimes		 * Connect it to the same thing that other similar things are
5231553Srgrimes		 * connected to, but make sure it is a wildcard unit
5241553Srgrimes		 * (e.g. up connected to sc ?, here we make connect sc? to a
5251553Srgrimes		 * uba?).  If other things like this are on the NEXUS or
5261553Srgrimes		 * if they aren't connected to anything, then make the same
5271553Srgrimes		 * connection, else call ourself to connect to another
5281553Srgrimes		 * unspecific device.
5291553Srgrimes		 */
5301553Srgrimes		if (dcp == TO_NEXUS || dcp == 0)
5311553Srgrimes			dp->d_conn = dcp;
5321553Srgrimes		else
5331553Srgrimes			dp->d_conn = connect(dcp->d_name, QUES);
5341553Srgrimes	}
5351553Srgrimes	return (dp);
5361553Srgrimes}
5371553Srgrimes
53829451Scharniervoid
5391553Srgrimesinit_dev(dp)
5401553Srgrimes	register struct device *dp;
5411553Srgrimes{
5421553Srgrimes
5431553Srgrimes	dp->d_name = "OHNO!!!";
5441553Srgrimes	dp->d_type = DEVICE;
5451553Srgrimes	dp->d_conn = 0;
5468432Sjkh	dp->d_conflicts = 0;
54715257Sbde	dp->d_disabled = 0;
54853047Speter	dp->d_flags = 0;
54952098Speter	dp->d_slave = dp->d_lun = dp->d_target = dp->d_drive = dp->d_unit = \
55052098Speter		dp->d_count = UNKNOWN;
5511553Srgrimes	dp->d_port = (char *)0;
55224333Sache	dp->d_portn = -1;
5531553Srgrimes	dp->d_irq = -1;
5541553Srgrimes	dp->d_drq = -1;
5551553Srgrimes	dp->d_maddr = 0;
5561553Srgrimes	dp->d_msize = 0;
5571553Srgrimes}
558