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