config.h revision 12772
166830Sobrien/*
266830Sobrien * Copyright (c) 1980, 1993
366830Sobrien *	The Regents of the University of California.  All rights reserved.
466830Sobrien *
566830Sobrien * Redistribution and use in source and binary forms, with or without
666830Sobrien * modification, are permitted provided that the following conditions
766830Sobrien * are met:
866830Sobrien * 1. Redistributions of source code must retain the above copyright
966830Sobrien *    notice, this list of conditions and the following disclaimer.
1066830Sobrien * 2. Redistributions in binary form must reproduce the above copyright
1166830Sobrien *    notice, this list of conditions and the following disclaimer in the
1266830Sobrien *    documentation and/or other materials provided with the distribution.
1366830Sobrien * 3. All advertising materials mentioning features or use of this software
1466830Sobrien *    must display the following acknowledgement:
1566830Sobrien *	This product includes software developed by the University of
1666830Sobrien *	California, Berkeley and its contributors.
1766830Sobrien * 4. Neither the name of the University nor the names of its contributors
1866830Sobrien *    may be used to endorse or promote products derived from this software
1966830Sobrien *    without specific prior written permission.
2066830Sobrien *
2166830Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2266830Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2366830Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2466830Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25100280Sgordon * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2651231Ssheldonh * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2766830Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2866830Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2943803Sdillon * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3043803Sdillon * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31108191Sdillon * SUCH DAMAGE.
3276409Sbsd *
3376409Sbsd *	@(#)config.h	8.1 (Berkeley) 6/6/93
3475931Simp */
3576409Sbsd
3676409Sbsd/*
3776409Sbsd * Config.
3876409Sbsd */
3976409Sbsd#include <sys/types.h>
4076409Sbsd#include <stdlib.h>
4176409Sbsd#include <string.h>
4276409Sbsd
4375931Simp#define	NODEV	((dev_t)-1)
4475931Simp
45108191Sdillonstruct file_list {
46108191Sdillon	struct	file_list *f_next;
47108191Sdillon	char	*f_fn;			/* the name */
48108191Sdillon	u_char	f_type;			/* see below */
4951231Ssheldonh	u_char	f_flags;		/* see below */
50108191Sdillon	char	*f_special;		/* special make rule if present */
5143803Sdillon	char	*f_depends;		/* additional dependancies */
5243803Sdillon	char	*f_clean;		/* File list to add to clean rule */
5377575Sru	char	*f_needs;
5491074Sobrien	/*
5575898Simp	 * Random values:
56104980Sschweikh	 *	swap space parameters for swap areas
57104980Sschweikh	 *	root device, etc. for system specifications
58100280Sgordon	 */
59100280Sgordon	union {
60100280Sgordon		struct {		/* when swap specification */
61100280Sgordon			dev_t	fuw_swapdev;
62100280Sgordon			int	fuw_swapsize;
63100280Sgordon			int	fuw_swapflag;
64100280Sgordon		} fuw;
65108191Sdillon		struct {		/* when system specification */
66108191Sdillon			dev_t	fus_rootdev;
67108191Sdillon			dev_t	fus_dumpdev;
68108191Sdillon		} fus;
69108191Sdillon		struct {		/* when component dev specification */
70108191Sdillon			dev_t	fup_compdev;
71108191Sdillon			int	fup_compinfo;
72108191Sdillon		} fup;
73108191Sdillon	} fun;
74108191Sdillon#define	f_swapdev	fun.fuw.fuw_swapdev
75108191Sdillon#define	f_swapsize	fun.fuw.fuw_swapsize
76108191Sdillon#define	f_swapflag	fun.fuw.fuw_swapflag
7775898Simp#define	f_rootdev	fun.fus.fus_rootdev
78108191Sdillon#define	f_dumpdev	fun.fus.fus_dumpdev
79108191Sdillon#define f_compdev	fun.fup.fup_compdev
80108191Sdillon#define f_compinfo	fun.fup.fup_compinfo
81108191Sdillon};
82108191Sdillon
83108191Sdillon/*
84108191Sdillon * Types.
85108191Sdillon */
86108191Sdillon#define DRIVER		1
87108191Sdillon#define NORMAL		2
8875898Simp#define	INVISIBLE	3
89108191Sdillon#define	PROFILING	4
9075898Simp#define	SYSTEMSPEC	5
91100285Sbsd#define	SWAPSPEC	6
92100285Sbsd#define COMPDEVICE	7
93100285Sbsd#define COMPSPEC	8
94108191Sdillon
95100285Sbsd/*
96100285Sbsd * Attributes (flags).
97100285Sbsd */
9885062Sbsd#define	CONFIGDEP	1
9985062Sbsd#define NO_IMPLCT_RULE	2
10085062Sbsd#define NO_OBJ		4
10175898Simp#define BEFORE_DEPEND	8
10275898Simp
10375898Simpstruct	idlst {
10491105Sobrien	char	*id;
10591105Sobrien	struct	idlst *id_next;
10691105Sobrien};
107108191Sdillon
108108191Sdillonstruct device {
109108191Sdillon	int	d_type;			/* CONTROLLER, DEVICE, bus adaptor */
110108191Sdillon	struct	device *d_conn;		/* what it is connected to */
11191105Sobrien	char	*d_name;		/* name of device (e.g. rk11) */
11288497Srwatson	struct	idlst *d_vec;		/* interrupt vectors */
11388497Srwatson	int	d_pri;			/* interrupt priority */
114108191Sdillon	int	d_addr;			/* address of csr */
115108191Sdillon	int	d_unit;			/* unit number */
116108191Sdillon	int	d_drive;		/* drive number */
11791074Sobrien	int	d_target;		/* target number */
118108191Sdillon	int	d_lun;			/* unit number */
119108191Sdillon	int	d_slave;		/* slave number */
120108191Sdillon#define QUES	-1	/* -1 means '?' */
121108191Sdillon#define	UNKNOWN -2	/* -2 means not set yet */
122108191Sdillon	int	d_dk;			/* if init 1 set to number for iostat */
123108191Sdillon	int	d_flags;		/* flags for device init */
124108191Sdillon	int	d_conflicts;		/* I'm allowed to conflict */
125108191Sdillon	char	*d_port;		/* io port base manifest constant */
126108191Sdillon	int	d_portn;	/* io port base (if number not manifest) */
127108191Sdillon	char	*d_mask;		/* interrupt mask */
128108191Sdillon	int	d_maddr;		/* io memory base */
12976193Sphk	int	d_msize;		/* io memory size */
13076193Sphk	int	d_drq;			/* DMA request  */
131108191Sdillon	int	d_irq;			/* interrupt request  */
13276409Sbsd	struct	device *d_next;		/* Next one in list */
13376193Sphk};
134108191Sdillon#define TO_NEXUS	(struct device *)-1
135108191Sdillon#define TO_VBA		(struct device *)-2
136108191Sdillon
137108191Sdillonstruct config {
138108191Sdillon	char	*c_dev;
13976193Sphk	char	*s_sysname;
14043803Sdillon};
141108191Sdillon
14243803Sdillon/*
143108191Sdillon * Config has a global notion of which machine type is
14443803Sdillon * being used.  It uses the name of the machine in choosing
145108191Sdillon * files and directories.  Thus if the name of the machine is ``vax'',
146108191Sdillon * it will build from ``Makefile.vax'' and use ``../vax/inline''
147108191Sdillon * in the makerules, etc.
148108191Sdillon */
149108191Sdillonint	machine;
150108191Sdillonchar	*machinename;
151108191Sdillon#define	MACHINE_VAX	1
152108191Sdillon#define	MACHINE_TAHOE	2
153108191Sdillon#define MACHINE_HP300	3
154108191Sdillon#define	MACHINE_I386	4
155108191Sdillon#define MACHINE_MIPS	5
156108191Sdillon#define MACHINE_PMAX	6
157108191Sdillon#define MACHINE_LUNA68K	7
158108191Sdillon#define MACHINE_NEWS3400	8
159108191Sdillon
160108191Sdillon/*
161108191Sdillon * For each machine, a set of CPU's may be specified as supported.
162108191Sdillon * These and the options (below) are put in the C flags in the makefile.
163108191Sdillon */
164108191Sdillonstruct cputype {
165108191Sdillon	char	*cpu_name;
166	struct	cputype *cpu_next;
167} *cputype;
168
169/*
170 * A set of options may also be specified which are like CPU types,
171 * but which may also specify values for the options.
172 * A separate set of options may be defined for make-style options.
173 */
174struct opt {
175	char	*op_name;
176	char	*op_value;
177	int	op_ownfile;	/* true = own file, false = makefile */
178	struct	opt *op_next;
179} *opt, *mkopt;
180
181struct opt_list {
182	char *o_name;
183	char *o_file;
184	struct opt_list *o_next;
185} *otab;
186
187char	*ident;
188char	*ns();
189char	*tc();
190char	*qu();
191char	*get_word();
192char	*get_quoted_word();
193char	*path();
194char	*raise();
195
196int	do_trace;
197
198#if MACHINE_VAX
199int	seen_mba, seen_uba;
200#endif
201#if MACHINE_TAHOE
202int	seen_vba;
203#endif
204#if MACHINE_I386
205int	seen_isa;
206int	seen_scbus;
207#endif
208int	seen_cd;
209
210struct	device *connect();
211struct	device *dtab;
212dev_t	nametodev();
213char	*devtoname();
214
215char	errbuf[80];
216int	yyline;
217
218struct	file_list *ftab, *conf_list, **confp, *comp_list, **compp;
219
220int	profiling;
221int	debugging;
222
223int	maxusers;
224u_int	loadaddress;
225
226extern	int old_config_present;	/* Old config/build directory still there */
227
228#define eq(a,b)	(!strcmp(a,b))
229