xref: /freebsd/usr.sbin/config/config.h (revision a316b26e50bbed7cf655fbba726ab87d8ab7599d)
1 /*
2  * Copyright (c) 1980, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. All advertising materials mentioning features or use of this software
14  *    must display the following acknowledgement:
15  *	This product includes software developed by the University of
16  *	California, Berkeley and its contributors.
17  * 4. Neither the name of the University nor the names of its contributors
18  *    may be used to endorse or promote products derived from this software
19  *    without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  *
33  *	@(#)config.h	8.1 (Berkeley) 6/6/93
34  */
35 
36 /*
37  * Config.
38  */
39 #include <sys/types.h>
40 #include <stdlib.h>
41 #include <string.h>
42 
43 #define	NODEV	((dev_t)-1)
44 
45 struct file_list {
46 	struct	file_list *f_next;
47 	char	*f_fn;			/* the name */
48 	u_char	f_type;			/* see below */
49 	u_char	f_flags;		/* see below */
50 	char	*f_special;		/* special make rule if present */
51 	char	*f_depends;		/* additional dependancies */
52 	char	*f_needs;
53 	/*
54 	 * Random values:
55 	 *	swap space parameters for swap areas
56 	 *	root device, etc. for system specifications
57 	 */
58 	union {
59 		struct {		/* when swap specification */
60 			dev_t	fuw_swapdev;
61 			int	fuw_swapsize;
62 			int	fuw_swapflag;
63 		} fuw;
64 		struct {		/* when system specification */
65 			dev_t	fus_rootdev;
66 			dev_t	fus_dumpdev;
67 		} fus;
68 		struct {		/* when component dev specification */
69 			dev_t	fup_compdev;
70 			int	fup_compinfo;
71 		} fup;
72 	} fun;
73 #define	f_swapdev	fun.fuw.fuw_swapdev
74 #define	f_swapsize	fun.fuw.fuw_swapsize
75 #define	f_swapflag	fun.fuw.fuw_swapflag
76 #define	f_rootdev	fun.fus.fus_rootdev
77 #define	f_dumpdev	fun.fus.fus_dumpdev
78 #define f_compdev	fun.fup.fup_compdev
79 #define f_compinfo	fun.fup.fup_compinfo
80 };
81 
82 /*
83  * Types.
84  */
85 #define DRIVER		1
86 #define NORMAL		2
87 #define	INVISIBLE	3
88 #define	PROFILING	4
89 #define	SYSTEMSPEC	5
90 #define	SWAPSPEC	6
91 #define COMPDEVICE	7
92 #define COMPSPEC	8
93 
94 /*
95  * Attributes (flags).
96  */
97 #define	CONFIGDEP	1
98 #define NO_IMPLCT_RULE	2
99 #define NO_OBJ		4
100 #define BEFORE_DEPEND	8
101 
102 struct	idlst {
103 	char	*id;
104 	struct	idlst *id_next;
105 };
106 
107 struct device {
108 	int	d_type;			/* CONTROLLER, DEVICE, bus adaptor */
109 	struct	device *d_conn;		/* what it is connected to */
110 	char	*d_name;		/* name of device (e.g. rk11) */
111 	struct	idlst *d_vec;		/* interrupt vectors */
112 	int	d_pri;			/* interrupt priority */
113 	int	d_addr;			/* address of csr */
114 	int	d_unit;			/* unit number */
115 	int	d_drive;		/* drive number */
116 	int	d_slave;		/* slave number */
117 #define QUES	-1	/* -1 means '?' */
118 #define	UNKNOWN -2	/* -2 means not set yet */
119 	int	d_dk;			/* if init 1 set to number for iostat */
120 	int	d_flags;		/* flags for device init */
121 	char	*d_port;		/* io port base manifest constant */
122 	int	d_portn;	/* io port base (if number not manifest) */
123 	char	*d_mask;		/* interrupt mask */
124 	int	d_maddr;		/* io memory base */
125 	int	d_msize;		/* io memory size */
126 	int	d_drq;			/* DMA request  */
127 	int	d_irq;			/* interrupt request  */
128 	struct	device *d_next;		/* Next one in list */
129 };
130 #define TO_NEXUS	(struct device *)-1
131 #define TO_VBA		(struct device *)-2
132 
133 struct config {
134 	char	*c_dev;
135 	char	*s_sysname;
136 };
137 
138 /*
139  * Config has a global notion of which machine type is
140  * being used.  It uses the name of the machine in choosing
141  * files and directories.  Thus if the name of the machine is ``vax'',
142  * it will build from ``Makefile.vax'' and use ``../vax/inline''
143  * in the makerules, etc.
144  */
145 int	machine;
146 char	*machinename;
147 #define	MACHINE_VAX	1
148 #define	MACHINE_TAHOE	2
149 #define MACHINE_HP300	3
150 #define	MACHINE_I386	4
151 #define MACHINE_MIPS	5
152 #define MACHINE_PMAX	6
153 #define MACHINE_LUNA68K	7
154 #define MACHINE_NEWS3400	8
155 
156 /*
157  * For each machine, a set of CPU's may be specified as supported.
158  * These and the options (below) are put in the C flags in the makefile.
159  */
160 struct cputype {
161 	char	*cpu_name;
162 	struct	cputype *cpu_next;
163 } *cputype;
164 
165 /*
166  * A set of options may also be specified which are like CPU types,
167  * but which may also specify values for the options.
168  * A separate set of options may be defined for make-style options.
169  */
170 struct opt {
171 	char	*op_name;
172 	char	*op_value;
173 	struct	opt *op_next;
174 } *opt, *mkopt;
175 
176 char	*ident;
177 char	*ns();
178 char	*tc();
179 char	*qu();
180 char	*get_word();
181 char	*get_quoted_word();
182 char	*path();
183 char	*raise();
184 
185 int	do_trace;
186 
187 #if MACHINE_VAX
188 int	seen_mba, seen_uba;
189 #endif
190 #if MACHINE_TAHOE
191 int	seen_vba;
192 #endif
193 #if MACHINE_I386
194 int	seen_isa;
195 #endif
196 int	seen_cd;
197 
198 struct	device *connect();
199 struct	device *dtab;
200 dev_t	nametodev();
201 char	*devtoname();
202 
203 char	errbuf[80];
204 int	yyline;
205 
206 struct	file_list *ftab, *conf_list, **confp, *comp_list, **compp;
207 
208 int	zone, hadtz;
209 int	dst;
210 int	profiling;
211 int	debugging;
212 
213 int	maxusers;
214 u_int	loadaddress;
215 
216 #define eq(a,b)	(!strcmp(a,b))
217