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