]> git.saurik.com Git - apple/xnu.git/blob - SETUP/config/config.h
xnu-2422.115.4.tar.gz
[apple/xnu.git] / SETUP / config / config.h
1 /*
2 * Copyright (c) 1999-2009 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7 * Reserved. This file contains Original Code and/or Modifications of
8 * Original Code as defined in and that are subject to the Apple Public
9 * Source License Version 1.0 (the 'License'). You may not use this file
10 * except in compliance with the License. Please obtain a copy of the
11 * License at http://www.apple.com/publicsource and read it before using
12 * this file.
13 *
14 * The Original Code and all software distributed under the License are
15 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19 * License for the specific language governing rights and limitations
20 * under the License."
21 *
22 * @APPLE_LICENSE_HEADER_END@
23 */
24 /*
25 * Mach Operating System
26 * Copyright (c) 1990 Carnegie-Mellon University
27 * Copyright (c) 1989 Carnegie-Mellon University
28 * Copyright (c) 1988 Carnegie-Mellon University
29 * Copyright (c) 1987 Carnegie-Mellon University
30 * All rights reserved. The CMU software License Agreement specifies
31 * the terms and conditions for use and redistribution.
32 */
33
34 /*
35 * Copyright (c) 1980 Regents of the University of California.
36 * All rights reserved.
37 *
38 * Redistribution and use in source and binary forms are permitted
39 * provided that the above copyright notice and this paragraph are
40 * duplicated in all such forms and that any documentation,
41 * advertising materials, and other materials related to such
42 * distribution and use acknowledge that the software was developed
43 * by the University of California, Berkeley. The name of the
44 * University may not be used to endorse or promote products derived
45 * from this software without specific prior written permission.
46 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
47 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
48 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
49 *
50 * @(#)config.h 5.8 (Berkeley) 6/18/88
51 */
52
53 /*
54 * Config.
55 */
56
57 #include <stdio.h>
58 #include <sys/types.h>
59 #include <sys/param.h>
60 #include <stdlib.h>
61 #include <string.h>
62
63 struct file_list {
64 struct file_list *f_next;
65 char *f_fn; /* the name */
66 u_char f_type; /* see below */
67 u_char f_flags; /* see below */
68 short f_special; /* requires special make rule */
69 char *f_needs;
70 char *f_extra; /* stuff to add to make line */
71 /*
72 * Random values:
73 * swap space parameters for swap areas
74 * root device, etc. for system specifications
75 */
76 union {
77 struct { /* when swap specification */
78 dev_t fuw_swapdev;
79 int fuw_swapsize;
80 } fuw;
81 struct { /* when system specification */
82 dev_t fus_rootdev;
83 dev_t fus_argdev;
84 dev_t fus_dumpdev;
85 } fus;
86 } fun;
87 #define f_swapdev fun.fuw.fuw_swapdev
88 #define f_swapsize fun.fuw.fuw_swapsize
89 #define f_rootdev fun.fus.fus_rootdev
90 #define f_argdev fun.fus.fus_argdev
91 #define f_dumpdev fun.fus.fus_dumpdev
92 };
93
94 /*
95 * Types.
96 */
97 #define DRIVER 1
98 #define NORMAL 2
99 #define INVISIBLE 3
100 #define PROFILING 4
101 #define SYSTEMSPEC 5
102 #define SWAPSPEC 6
103
104 /*
105 * Attributes (flags).
106 */
107 #define CONFIGDEP 0x01 /* obsolete? */
108 #define OPTIONSDEF 0x02 /* options definition entry */
109 #define ORDERED 0x04 /* don't list in OBJ's, keep "files" order */
110 #define SEDIT 0x08 /* run sed filter (SQT) */
111
112 /*
113 * Maximum number of fields for variable device fields (SQT).
114 */
115 #define NFIELDS 10
116
117 struct idlst {
118 char *id;
119 struct idlst *id_next;
120 int id_vec; /* Sun interrupt vector number */
121 };
122
123 struct device {
124 int d_type; /* CONTROLLER, DEVICE, bus adaptor */
125 struct device *d_conn; /* what it is connected to */
126 const char *d_name; /* name of device (e.g. rk11) */
127 struct idlst *d_vec; /* interrupt vectors */
128 int d_pri; /* interrupt priority */
129 int d_addr; /* address of csr */
130 int d_unit; /* unit number */
131 int d_drive; /* drive number */
132 int d_slave; /* slave number */
133 #define QUES -1 /* -1 means '?' */
134 #define UNKNOWN -2 /* -2 means not set yet */
135 int d_dk; /* if init 1 set to number for iostat */
136 int d_flags; /* nlags for device init */
137 struct device *d_next; /* Next one in list */
138 u_short d_mach; /* Sun - machine type (0 = all)*/
139 u_short d_bus; /* Sun - bus type (0 = unknown) */
140 u_long d_fields[NFIELDS]; /* fields values (SQT) */
141 int d_bin; /* interrupt bin (SQT) */
142 int d_addrmod; /* address modifier (MIPS) */
143 char *d_init; /* pseudo device init routine name */
144 };
145 #define TO_NEXUS (struct device *)-1
146 #define TO_SLOT (struct device *)-1
147
148 struct config {
149 char *c_dev;
150 char *s_sysname;
151 };
152
153 /*
154 * Config has a global notion of which machine type is
155 * being used. It uses the name of the machine in choosing
156 * files and directories. Thus if the name of the machine is ``vax'',
157 * it will build from ``Makefile.vax'' and use ``../vax/inline''
158 * in the makerules, etc.
159 */
160 extern int machine;
161 extern const char *machinename;
162 #define MACHINE_VAX 1
163 #define MACHINE_SUN 2
164 #define MACHINE_ROMP 3
165 #define MACHINE_SUN2 4
166 #define MACHINE_SUN3 5
167 #define MACHINE_MMAX 6
168 #define MACHINE_SQT 7
169 #define MACHINE_SUN4 8
170 #define MACHINE_I386 9
171 #define MACHINE_IX 10
172 #define MACHINE_MIPSY 11
173 #define MACHINE_MIPS 12
174 #define MACHINE_I860 13
175 #define MACHINE_M68K 14
176 #define MACHINE_M88K 15
177 #define MACHINE_M98K 16
178 #define MACHINE_HPPA 17
179 #define MACHINE_SPARC 18
180 #define MACHINE_PPC 19
181 #define MACHINE_ARM 20
182 #define MACHINE_X86_64 21
183
184 /*
185 * For each machine, a set of CPU's may be specified as supported.
186 * These and the options (below) are put in the C flags in the makefile.
187 */
188 struct cputype {
189 char *cpu_name;
190 struct cputype *cpu_next;
191 };
192
193 extern struct cputype *cputype;
194
195 /*
196 * In order to configure and build outside the kernel source tree,
197 * we may wish to specify where the source tree lives.
198 */
199 extern const char *source_directory;
200 extern const char *object_directory;
201 extern char *config_directory;
202
203 FILE *fopenp(const char *fpath, char *file, char *complete, const char *ftype);
204 const char *get_VPATH(void);
205 #define VPATH get_VPATH()
206
207 /*
208 * A set of options may also be specified which are like CPU types,
209 * but which may also specify values for the options.
210 * A separate set of options may be defined for make-style options.
211 */
212 struct opt {
213 char *op_name;
214 char *op_value;
215 struct opt *op_next;
216 };
217
218 extern struct opt *opt, *mkopt, *opt_tail, *mkopt_tail;
219
220 extern char *ident;
221 const char *get_word(FILE *fp);
222 char *ns(const char *str);
223 char *qu(int num);
224 char *path(const char *file);
225
226 extern int do_trace;
227
228 #if MACHINE_VAX
229 extern int seen_mba, seen_uba;
230 #endif
231
232 extern int seen_vme, seen_mbii;
233
234 extern struct device *dtab;
235 dev_t nametodev(char *name, int defunit, char defpartition);
236 char *devtoname(dev_t dev);
237
238 extern char errbuf[80];
239 extern int yyline;
240
241 extern struct file_list *ftab, *conf_list, **confp;
242 extern char *build_directory;
243
244 extern int profiling;
245
246 extern int maxusers;
247
248 #define eq(a,b) (!strcmp(a,b))
249
250 #ifdef mips
251 #define DEV_MASK 0xf
252 #define DEV_SHIFT 4
253 #else /* mips */
254 #define DEV_MASK 0x7
255 #define DEV_SHIFT 3
256 #endif /* mips */
257
258 /* External function references */
259 char *get_rest(FILE *fp);
260
261 int yyparse(void);
262 void yyerror(const char *s);
263
264 void vax_ioconf(void);
265 void sun_ioconf(void);
266 void romp_ioconf(void);
267 void mmax_ioconf(void);
268 void sqt_ioconf(void);
269 void i386_ioconf(void);
270 void mips_ioconf(void);
271 void m68k_ioconf(void);
272 void m88k_ioconf(void);
273 void m98k_ioconf(void);
274 void hppa_ioconf(void);
275 void sparc_ioconf(void);
276 void ppc_ioconf(void);
277 void arm_ioconf(void);
278 void x86_64_ioconf(void);
279
280 void swapconf(void);
281
282 void ubglue(void);
283 void mbglue(void);
284
285 void makefile(void);
286 void headers(void);
287 int opteq(const char *cp, const char *dp);
288
289 void init_dev(struct device *dp);
290 void newdev(struct device *dp);
291 void dev_param(struct device *dp, const char *str, long num);
292
293 int searchp(const char *spath, char *file, char *fullname, int (*func)(char *));