xref: /xnu-12377.41.6/SETUP/config/config.h (revision bbb1b6f9e71b8cdde6e5cd6f4841f207dee3d828)
1*bbb1b6f9SApple OSS Distributions /*
2*bbb1b6f9SApple OSS Distributions  * Copyright (c) 1999-2009 Apple Inc. All rights reserved.
3*bbb1b6f9SApple OSS Distributions  *
4*bbb1b6f9SApple OSS Distributions  * @APPLE_LICENSE_HEADER_START@
5*bbb1b6f9SApple OSS Distributions  *
6*bbb1b6f9SApple OSS Distributions  * "Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
7*bbb1b6f9SApple OSS Distributions  * Reserved.  This file contains Original Code and/or Modifications of
8*bbb1b6f9SApple OSS Distributions  * Original Code as defined in and that are subject to the Apple Public
9*bbb1b6f9SApple OSS Distributions  * Source License Version 1.0 (the 'License').  You may not use this file
10*bbb1b6f9SApple OSS Distributions  * except in compliance with the License.  Please obtain a copy of the
11*bbb1b6f9SApple OSS Distributions  * License at http://www.apple.com/publicsource and read it before using
12*bbb1b6f9SApple OSS Distributions  * this file.
13*bbb1b6f9SApple OSS Distributions  *
14*bbb1b6f9SApple OSS Distributions  * The Original Code and all software distributed under the License are
15*bbb1b6f9SApple OSS Distributions  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16*bbb1b6f9SApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17*bbb1b6f9SApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18*bbb1b6f9SApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
19*bbb1b6f9SApple OSS Distributions  * License for the specific language governing rights and limitations
20*bbb1b6f9SApple OSS Distributions  * under the License."
21*bbb1b6f9SApple OSS Distributions  *
22*bbb1b6f9SApple OSS Distributions  * @APPLE_LICENSE_HEADER_END@
23*bbb1b6f9SApple OSS Distributions  */
24*bbb1b6f9SApple OSS Distributions /*
25*bbb1b6f9SApple OSS Distributions  * Mach Operating System
26*bbb1b6f9SApple OSS Distributions  * Copyright (c) 1990 Carnegie-Mellon University
27*bbb1b6f9SApple OSS Distributions  * Copyright (c) 1989 Carnegie-Mellon University
28*bbb1b6f9SApple OSS Distributions  * Copyright (c) 1988 Carnegie-Mellon University
29*bbb1b6f9SApple OSS Distributions  * Copyright (c) 1987 Carnegie-Mellon University
30*bbb1b6f9SApple OSS Distributions  * All rights reserved.  The CMU software License Agreement specifies
31*bbb1b6f9SApple OSS Distributions  * the terms and conditions for use and redistribution.
32*bbb1b6f9SApple OSS Distributions  */
33*bbb1b6f9SApple OSS Distributions 
34*bbb1b6f9SApple OSS Distributions /*
35*bbb1b6f9SApple OSS Distributions  * Copyright (c) 1980 Regents of the University of California.
36*bbb1b6f9SApple OSS Distributions  * All rights reserved.
37*bbb1b6f9SApple OSS Distributions  *
38*bbb1b6f9SApple OSS Distributions  * Redistribution and use in source and binary forms are permitted
39*bbb1b6f9SApple OSS Distributions  * provided that the above copyright notice and this paragraph are
40*bbb1b6f9SApple OSS Distributions  * duplicated in all such forms and that any documentation,
41*bbb1b6f9SApple OSS Distributions  * advertising materials, and other materials related to such
42*bbb1b6f9SApple OSS Distributions  * distribution and use acknowledge that the software was developed
43*bbb1b6f9SApple OSS Distributions  * by the University of California, Berkeley.  The name of the
44*bbb1b6f9SApple OSS Distributions  * University may not be used to endorse or promote products derived
45*bbb1b6f9SApple OSS Distributions  * from this software without specific prior written permission.
46*bbb1b6f9SApple OSS Distributions  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
47*bbb1b6f9SApple OSS Distributions  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
48*bbb1b6f9SApple OSS Distributions  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
49*bbb1b6f9SApple OSS Distributions  *
50*bbb1b6f9SApple OSS Distributions  *	@(#)config.h	5.8 (Berkeley) 6/18/88
51*bbb1b6f9SApple OSS Distributions  */
52*bbb1b6f9SApple OSS Distributions 
53*bbb1b6f9SApple OSS Distributions /*
54*bbb1b6f9SApple OSS Distributions  * Config.
55*bbb1b6f9SApple OSS Distributions  */
56*bbb1b6f9SApple OSS Distributions 
57*bbb1b6f9SApple OSS Distributions #include <stdio.h>
58*bbb1b6f9SApple OSS Distributions #include <sys/types.h>
59*bbb1b6f9SApple OSS Distributions #include <sys/param.h>
60*bbb1b6f9SApple OSS Distributions #include <stdlib.h>
61*bbb1b6f9SApple OSS Distributions #include <string.h>
62*bbb1b6f9SApple OSS Distributions 
63*bbb1b6f9SApple OSS Distributions struct file_list {
64*bbb1b6f9SApple OSS Distributions 	struct  file_list *f_next;
65*bbb1b6f9SApple OSS Distributions 	char    *f_fn;                  /* the name */
66*bbb1b6f9SApple OSS Distributions 	u_char  f_type;                 /* see below */
67*bbb1b6f9SApple OSS Distributions 	u_char  f_flags;                /* see below */
68*bbb1b6f9SApple OSS Distributions 	short   f_special;              /* requires special make rule */
69*bbb1b6f9SApple OSS Distributions 	char    *f_needs;
70*bbb1b6f9SApple OSS Distributions 	char    *f_extra;               /* stuff to add to make line */
71*bbb1b6f9SApple OSS Distributions };
72*bbb1b6f9SApple OSS Distributions 
73*bbb1b6f9SApple OSS Distributions /*
74*bbb1b6f9SApple OSS Distributions  * Types.
75*bbb1b6f9SApple OSS Distributions  */
76*bbb1b6f9SApple OSS Distributions #define DRIVER          1
77*bbb1b6f9SApple OSS Distributions #define NORMAL          2
78*bbb1b6f9SApple OSS Distributions #define INVISIBLE       3
79*bbb1b6f9SApple OSS Distributions #define PROFILING       4
80*bbb1b6f9SApple OSS Distributions 
81*bbb1b6f9SApple OSS Distributions /*
82*bbb1b6f9SApple OSS Distributions  * Attributes (flags).
83*bbb1b6f9SApple OSS Distributions  */
84*bbb1b6f9SApple OSS Distributions #define CONFIGDEP            0x01    /* obsolete? */
85*bbb1b6f9SApple OSS Distributions #define OPTIONSDEF           0x02    /* options definition entry */
86*bbb1b6f9SApple OSS Distributions #define LIBRARYDEP           0x04    /* include file in library build */
87*bbb1b6f9SApple OSS Distributions #define BOUND_CHECKS_MASK        0x78    /* options for -fbounds-safety */
88*bbb1b6f9SApple OSS Distributions 
89*bbb1b6f9SApple OSS Distributions #define BOUND_CHECKS_NONE        0x00    /* do not use -fbounds-safety */
90*bbb1b6f9SApple OSS Distributions #define BOUND_CHECKS_PENDING 0x08        /* do not use -fbounds-safety but disable associated warnings */
91*bbb1b6f9SApple OSS Distributions #define BOUND_CHECKS         0x10    /* build with -fbounds-safety */
92*bbb1b6f9SApple OSS Distributions #define BOUND_CHECKS_SOFT    0x18    /* emit non-panicking traps for bound-checked source */
93*bbb1b6f9SApple OSS Distributions #define BOUND_CHECKS_DEBUG   0x20    /* emit one panicking trap per bounds check */
94*bbb1b6f9SApple OSS Distributions #define BOUND_CHECKS_SEED    0x40    /* emit panicking traps on !RELEASE builds */
95*bbb1b6f9SApple OSS Distributions #define BOUND_CHECKS_NEW_CHECKS 0x80 /* build with -fbounds-safety-bringup-missing-checks if building with -fbounds-safety*/
96*bbb1b6f9SApple OSS Distributions 
97*bbb1b6f9SApple OSS Distributions struct device {
98*bbb1b6f9SApple OSS Distributions 	int     d_type;                 /* CONTROLLER, DEVICE, bus adaptor */
99*bbb1b6f9SApple OSS Distributions 	const char      *d_name;        /* name of device (e.g. rk11) */
100*bbb1b6f9SApple OSS Distributions 	int     d_slave;                /* slave number */
101*bbb1b6f9SApple OSS Distributions #define QUES    -1      /* -1 means '?' */
102*bbb1b6f9SApple OSS Distributions #define UNKNOWN -2      /* -2 means not set yet */
103*bbb1b6f9SApple OSS Distributions 	int     d_flags;                /* nlags for device init */
104*bbb1b6f9SApple OSS Distributions 	struct  device *d_next;         /* Next one in list */
105*bbb1b6f9SApple OSS Distributions 	char    *d_init;                /* pseudo device init routine name */
106*bbb1b6f9SApple OSS Distributions };
107*bbb1b6f9SApple OSS Distributions 
108*bbb1b6f9SApple OSS Distributions /*
109*bbb1b6f9SApple OSS Distributions  * Config has a global notion of which machine type is
110*bbb1b6f9SApple OSS Distributions  * being used.  It uses the name of the machine in choosing
111*bbb1b6f9SApple OSS Distributions  * files and directories.  Thus if the name of the machine is ``vax'',
112*bbb1b6f9SApple OSS Distributions  * it will build from ``Makefile.vax'' and use ``../vax/inline''
113*bbb1b6f9SApple OSS Distributions  * in the makerules, etc.
114*bbb1b6f9SApple OSS Distributions  */
115*bbb1b6f9SApple OSS Distributions extern const char       *machinename;
116*bbb1b6f9SApple OSS Distributions 
117*bbb1b6f9SApple OSS Distributions /*
118*bbb1b6f9SApple OSS Distributions  * In order to configure and build outside the kernel source tree,
119*bbb1b6f9SApple OSS Distributions  * we may wish to specify where the source tree lives.
120*bbb1b6f9SApple OSS Distributions  */
121*bbb1b6f9SApple OSS Distributions extern const char *source_directory;
122*bbb1b6f9SApple OSS Distributions extern const char *object_directory;
123*bbb1b6f9SApple OSS Distributions extern char *config_directory;
124*bbb1b6f9SApple OSS Distributions 
125*bbb1b6f9SApple OSS Distributions FILE *fopenp(const char *fpath, char *file, char *complete, const char *ftype);
126*bbb1b6f9SApple OSS Distributions const char *get_VPATH(void);
127*bbb1b6f9SApple OSS Distributions #define VPATH   get_VPATH()
128*bbb1b6f9SApple OSS Distributions 
129*bbb1b6f9SApple OSS Distributions /*
130*bbb1b6f9SApple OSS Distributions  * A set of options may also be specified which are like CPU types,
131*bbb1b6f9SApple OSS Distributions  * but which may also specify values for the options.
132*bbb1b6f9SApple OSS Distributions  * A separate set of options may be defined for make-style options.
133*bbb1b6f9SApple OSS Distributions  */
134*bbb1b6f9SApple OSS Distributions struct opt {
135*bbb1b6f9SApple OSS Distributions 	char    *op_name;
136*bbb1b6f9SApple OSS Distributions 	char    *op_value;
137*bbb1b6f9SApple OSS Distributions 	struct  opt *op_next;
138*bbb1b6f9SApple OSS Distributions };
139*bbb1b6f9SApple OSS Distributions 
140*bbb1b6f9SApple OSS Distributions extern struct opt *opt, *mkopt, *opt_tail, *mkopt_tail;
141*bbb1b6f9SApple OSS Distributions 
142*bbb1b6f9SApple OSS Distributions const char      *get_word(FILE *fp);
143*bbb1b6f9SApple OSS Distributions char    *ns(const char *str);
144*bbb1b6f9SApple OSS Distributions char    *qu(int num);
145*bbb1b6f9SApple OSS Distributions char    *path(const char *file);
146*bbb1b6f9SApple OSS Distributions 
147*bbb1b6f9SApple OSS Distributions extern int      do_trace;
148*bbb1b6f9SApple OSS Distributions 
149*bbb1b6f9SApple OSS Distributions extern struct   device *dtab;
150*bbb1b6f9SApple OSS Distributions dev_t   nametodev(char *name, int defunit, char defpartition);
151*bbb1b6f9SApple OSS Distributions char    *devtoname(dev_t dev);
152*bbb1b6f9SApple OSS Distributions 
153*bbb1b6f9SApple OSS Distributions extern char     errbuf[80];
154*bbb1b6f9SApple OSS Distributions extern int      yyline;
155*bbb1b6f9SApple OSS Distributions 
156*bbb1b6f9SApple OSS Distributions extern struct   file_list *ftab, *conf_list, **confp;
157*bbb1b6f9SApple OSS Distributions extern char     *build_directory;
158*bbb1b6f9SApple OSS Distributions 
159*bbb1b6f9SApple OSS Distributions extern int      profiling;
160*bbb1b6f9SApple OSS Distributions 
161*bbb1b6f9SApple OSS Distributions #define eq(a, b) (!strcmp(a,b))
162*bbb1b6f9SApple OSS Distributions 
163*bbb1b6f9SApple OSS Distributions #define DEV_MASK 0x7
164*bbb1b6f9SApple OSS Distributions #define DEV_SHIFT  3
165*bbb1b6f9SApple OSS Distributions 
166*bbb1b6f9SApple OSS Distributions /* External function references */
167*bbb1b6f9SApple OSS Distributions char *get_rest(FILE *fp);
168*bbb1b6f9SApple OSS Distributions 
169*bbb1b6f9SApple OSS Distributions int yyparse(void);
170*bbb1b6f9SApple OSS Distributions void yyerror(const char *s);
171*bbb1b6f9SApple OSS Distributions 
172*bbb1b6f9SApple OSS Distributions void mkioconf(void);
173*bbb1b6f9SApple OSS Distributions 
174*bbb1b6f9SApple OSS Distributions void makefile(void);
175*bbb1b6f9SApple OSS Distributions void headers(void);
176*bbb1b6f9SApple OSS Distributions int opteq(const char *cp, const char *dp);
177*bbb1b6f9SApple OSS Distributions 
178*bbb1b6f9SApple OSS Distributions void init_dev(struct device *dp);
179*bbb1b6f9SApple OSS Distributions void newdev(struct device *dp);
180*bbb1b6f9SApple OSS Distributions void dev_param(struct device *dp, const char *str, long num);
181*bbb1b6f9SApple OSS Distributions 
182*bbb1b6f9SApple OSS Distributions int searchp(const char *spath, char *file, char *fullname, int (*func)(char *));
183