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