xref: /original-bsd/usr.sbin/config/config.h (revision da6ea800)
1 /*
2  * Copyright (c) 1980, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)config.h	8.1 (Berkeley) 06/06/93
8  */
9 
10 /*
11  * Config.
12  */
13 #include <sys/types.h>
14 #include <stdlib.h>
15 #include <string.h>
16 
17 #define	NODEV	((dev_t)-1)
18 
19 struct file_list {
20 	struct	file_list *f_next;
21 	char	*f_fn;			/* the name */
22 	u_char	f_type;			/* see below */
23 	u_char	f_flags;		/* see below */
24 	char	*f_special;		/* special make rule if present */
25 	char	*f_needs;
26 	/*
27 	 * Random values:
28 	 *	swap space parameters for swap areas
29 	 *	root device, etc. for system specifications
30 	 */
31 	union {
32 		struct {		/* when swap specification */
33 			dev_t	fuw_swapdev;
34 			int	fuw_swapsize;
35 			int	fuw_swapflag;
36 		} fuw;
37 		struct {		/* when system specification */
38 			dev_t	fus_rootdev;
39 			dev_t	fus_dumpdev;
40 		} fus;
41 		struct {		/* when component dev specification */
42 			dev_t	fup_compdev;
43 			int	fup_compinfo;
44 		} fup;
45 	} fun;
46 #define	f_swapdev	fun.fuw.fuw_swapdev
47 #define	f_swapsize	fun.fuw.fuw_swapsize
48 #define	f_swapflag	fun.fuw.fuw_swapflag
49 #define	f_rootdev	fun.fus.fus_rootdev
50 #define	f_dumpdev	fun.fus.fus_dumpdev
51 #define f_compdev	fun.fup.fup_compdev
52 #define f_compinfo	fun.fup.fup_compinfo
53 };
54 
55 /*
56  * Types.
57  */
58 #define DRIVER		1
59 #define NORMAL		2
60 #define	INVISIBLE	3
61 #define	PROFILING	4
62 #define	SYSTEMSPEC	5
63 #define	SWAPSPEC	6
64 #define COMPDEVICE	7
65 #define COMPSPEC	8
66 
67 /*
68  * Attributes (flags).
69  */
70 #define	CONFIGDEP	1
71 
72 struct	idlst {
73 	char	*id;
74 	struct	idlst *id_next;
75 };
76 
77 struct device {
78 	int	d_type;			/* CONTROLLER, DEVICE, bus adaptor */
79 	struct	device *d_conn;		/* what it is connected to */
80 	char	*d_name;		/* name of device (e.g. rk11) */
81 	struct	idlst *d_vec;		/* interrupt vectors */
82 	int	d_pri;			/* interrupt priority */
83 	int	d_addr;			/* address of csr */
84 	int	d_unit;			/* unit number */
85 	int	d_drive;		/* drive number */
86 	int	d_slave;		/* slave number */
87 #define QUES	-1	/* -1 means '?' */
88 #define	UNKNOWN -2	/* -2 means not set yet */
89 	int	d_dk;			/* if init 1 set to number for iostat */
90 	int	d_flags;		/* flags for device init */
91 	char	*d_port;		/* io port base manifest constant */
92 	int	d_portn;	/* io port base (if number not manifest) */
93 	char	*d_mask;		/* interrupt mask */
94 	int	d_maddr;		/* io memory base */
95 	int	d_msize;		/* io memory size */
96 	int	d_drq;			/* DMA request  */
97 	int	d_irq;			/* interrupt request  */
98 	struct	device *d_next;		/* Next one in list */
99 };
100 #define TO_NEXUS	(struct device *)-1
101 #define TO_VBA		(struct device *)-2
102 
103 struct config {
104 	char	*c_dev;
105 	char	*s_sysname;
106 };
107 
108 /*
109  * Config has a global notion of which machine type is
110  * being used.  It uses the name of the machine in choosing
111  * files and directories.  Thus if the name of the machine is ``vax'',
112  * it will build from ``Makefile.vax'' and use ``../vax/inline''
113  * in the makerules, etc.
114  */
115 int	machine;
116 char	*machinename;
117 #define	MACHINE_VAX	1
118 #define	MACHINE_TAHOE	2
119 #define MACHINE_HP300	3
120 #define	MACHINE_I386	4
121 #define MACHINE_MIPS	5
122 #define MACHINE_PMAX	6
123 #define MACHINE_LUNA68K	7
124 #define MACHINE_NEWS3400	8
125 
126 /*
127  * For each machine, a set of CPU's may be specified as supported.
128  * These and the options (below) are put in the C flags in the makefile.
129  */
130 struct cputype {
131 	char	*cpu_name;
132 	struct	cputype *cpu_next;
133 } *cputype;
134 
135 /*
136  * A set of options may also be specified which are like CPU types,
137  * but which may also specify values for the options.
138  * A separate set of options may be defined for make-style options.
139  */
140 struct opt {
141 	char	*op_name;
142 	char	*op_value;
143 	struct	opt *op_next;
144 } *opt, *mkopt;
145 
146 char	*ident;
147 char	*ns();
148 char	*tc();
149 char	*qu();
150 char	*get_word();
151 char	*get_quoted_word();
152 char	*path();
153 char	*raise();
154 
155 int	do_trace;
156 
157 #if MACHINE_VAX
158 int	seen_mba, seen_uba;
159 #endif
160 #if MACHINE_TAHOE
161 int	seen_vba;
162 #endif
163 #if MACHINE_I386
164 int	seen_isa;
165 #endif
166 int	seen_cd;
167 
168 struct	device *connect();
169 struct	device *dtab;
170 dev_t	nametodev();
171 char	*devtoname();
172 
173 char	errbuf[80];
174 int	yyline;
175 
176 struct	file_list *ftab, *conf_list, **confp, *comp_list, **compp;
177 
178 int	zone, hadtz;
179 int	dst;
180 int	hz;
181 int	profiling;
182 int	debugging;
183 
184 int	maxusers;
185 
186 #define eq(a,b)	(!strcmp(a,b))
187