xref: /original-bsd/usr.sbin/config/config.h (revision 67e03b52)
1 /*
2  * Copyright (c) 1980 Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)config.h	5.14 (Berkeley) 07/01/91
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 		} fuw;
36 		struct {		/* when system specification */
37 			dev_t	fus_rootdev;
38 			dev_t	fus_dumpdev;
39 		} fus;
40 	} fun;
41 #define	f_swapdev	fun.fuw.fuw_swapdev
42 #define	f_swapsize	fun.fuw.fuw_swapsize
43 #define	f_rootdev	fun.fus.fus_rootdev
44 #define	f_dumpdev	fun.fus.fus_dumpdev
45 };
46 
47 /*
48  * Types.
49  */
50 #define DRIVER		1
51 #define NORMAL		2
52 #define	INVISIBLE	3
53 #define	PROFILING	4
54 #define	SYSTEMSPEC	5
55 #define	SWAPSPEC	6
56 
57 /*
58  * Attributes (flags).
59  */
60 #define	CONFIGDEP	1
61 
62 struct	idlst {
63 	char	*id;
64 	struct	idlst *id_next;
65 };
66 
67 struct device {
68 	int	d_type;			/* CONTROLLER, DEVICE, bus adaptor */
69 	struct	device *d_conn;		/* what it is connected to */
70 	char	*d_name;		/* name of device (e.g. rk11) */
71 	struct	idlst *d_vec;		/* interrupt vectors */
72 	int	d_pri;			/* interrupt priority */
73 	int	d_addr;			/* address of csr */
74 	int	d_unit;			/* unit number */
75 	int	d_drive;		/* drive number */
76 	int	d_slave;		/* slave number */
77 #define QUES	-1	/* -1 means '?' */
78 #define	UNKNOWN -2	/* -2 means not set yet */
79 	int	d_dk;			/* if init 1 set to number for iostat */
80 	int	d_flags;		/* flags for device init */
81 	char	*d_port;		/* io port base manifest constant */
82 	int	d_portn;	/* io port base (if number not manifest) */
83 	char	*d_mask;		/* interrupt mask */
84 	int	d_maddr;		/* io memory base */
85 	int	d_msize;		/* io memory size */
86 	int	d_drq;			/* DMA request  */
87 	int	d_irq;			/* interrupt request  */
88 	struct	device *d_next;		/* Next one in list */
89 };
90 #define TO_NEXUS	(struct device *)-1
91 #define TO_VBA		(struct device *)-2
92 
93 struct config {
94 	char	*c_dev;
95 	char	*s_sysname;
96 };
97 
98 /*
99  * Config has a global notion of which machine type is
100  * being used.  It uses the name of the machine in choosing
101  * files and directories.  Thus if the name of the machine is ``vax'',
102  * it will build from ``Makefile.vax'' and use ``../vax/inline''
103  * in the makerules, etc.
104  */
105 int	machine;
106 char	*machinename;
107 #define	MACHINE_VAX	1
108 #define	MACHINE_TAHOE	2
109 #define MACHINE_HP300	3
110 #define	MACHINE_I386	4
111 
112 /*
113  * For each machine, a set of CPU's may be specified as supported.
114  * These and the options (below) are put in the C flags in the makefile.
115  */
116 struct cputype {
117 	char	*cpu_name;
118 	struct	cputype *cpu_next;
119 } *cputype;
120 
121 /*
122  * A set of options may also be specified which are like CPU types,
123  * but which may also specify values for the options.
124  * A separate set of options may be defined for make-style options.
125  */
126 struct opt {
127 	char	*op_name;
128 	char	*op_value;
129 	struct	opt *op_next;
130 } *opt, *mkopt;
131 
132 char	*ident;
133 char	*ns();
134 char	*tc();
135 char	*qu();
136 char	*get_word();
137 char	*get_quoted_word();
138 char	*path();
139 char	*raise();
140 
141 int	do_trace;
142 
143 #if MACHINE_VAX
144 int	seen_mba, seen_uba;
145 #endif
146 #if MACHINE_TAHOE
147 int	seen_vba;
148 #endif
149 #if MACHINE_I386
150 int	seen_isa;
151 #endif
152 
153 struct	device *connect();
154 struct	device *dtab;
155 dev_t	nametodev();
156 char	*devtoname();
157 
158 char	errbuf[80];
159 int	yyline;
160 
161 struct	file_list *ftab, *conf_list, **confp;
162 
163 int	zone, hadtz;
164 int	dst;
165 int	profiling;
166 int	debugging;
167 
168 int	maxusers;
169 
170 #define eq(a,b)	(!strcmp(a,b))
171