mkinitrd(8): determine the initrd size from the contents size
[dragonfly.git] / usr.sbin / config / config.h
1 /*
2  * Copyright (c) 1980, 1993
3  *      The Regents of the University of California.  All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the University nor the names of its contributors
14  *    may be used to endorse or promote products derived from this software
15  *    without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  *      @(#)config.h    8.1 (Berkeley) 6/6/93
30  * $FreeBSD: src/usr.sbin/config/config.h,v 1.35.2.1 2000/08/03 00:09:56 peter Exp $
31  */
32
33 /*
34  * Config.
35  */
36 #include <sys/types.h>
37 #include <stdlib.h>
38 #include <string.h>
39
40 struct file_list {
41         struct  file_list *f_next;
42         char    *f_fn;                  /* the name */
43         int     f_type;                 /* type or count */
44         u_char  f_flags;                /* see below */
45         char    *f_special;             /* special make rule if present */
46         char    *f_depends;             /* additional dependancies */
47         char    *f_clean;               /* File list to add to clean rule */
48         char    *f_needs;
49         char    *f_warn;                /* warning message */
50 };
51
52 /*
53  * Types.
54  */
55 #define NORMAL          1
56 #define INVISIBLE       2
57 #define PROFILING       3
58 #define NODEPEND        4
59 #define LOCAL           5
60 #define DEVDONE         0x80000000
61 #define TYPEMASK        0x7fffffff
62
63 /*
64  * Attributes (flags).
65  */
66 #define CONFIGDEP       1
67 #define NO_IMPLCT_RULE  2
68 #define NO_OBJ          4
69 #define BEFORE_DEPEND   8
70 #define NOWERROR        16
71
72 struct device {
73         int     d_type;                 /* DEVICE, bus adaptor */
74         const char *d_conn;             /* what it is connected to */
75         int     d_connunit;             /* unit of connection */
76         const char *d_name;             /* name of device (e.g. rk11) */
77         int     d_unit;                 /* unit number */
78         int     d_drive;                /* drive number */
79         int     d_target;               /* target number */
80         int     d_lun;                  /* unit number */
81         int     d_bus;                  /* controller bus number */
82         int     d_count;                /* pseudo-device count */
83 #define QUES    -1      /* -1 means '?' */
84 #define UNKNOWN -2      /* -2 means not set yet */
85         int     d_flags;                /* flags for device init */
86         int     d_disabled;             /* nonzero to skip probe/attach */
87         char    *d_port;                /* io port base manifest constant */
88         int     d_portn;        /* io port base (if number not manifest) */
89         int     d_maddr;                /* io memory base */
90         int     d_msize;                /* io memory size */
91         int     d_drq;                  /* DMA request  */
92         int     d_irq;                  /* interrupt request  */
93         struct  device *d_next;         /* Next one in list */
94 };
95
96 struct config {
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 ``i386'',
104  * it will build from ``Makefile.i386'' and use ``../i386/inline''
105  * in the makerules, etc.
106  */
107 char    *platformname;          /* MACHINE_PLATFORM  - (machine/ headers) */
108 char    *machinename;           /* MACHINE      - third party programs */
109 char    *machinearchname;       /* MACHINE_ARCH - (cpu/ headers) */
110
111 /*
112  * For each machine, a set of CPU's may be specified as supported.
113  * These and the options (below) are put in the C flags in the makefile.
114  */
115 struct cputype {
116         char    *cpu_name;
117         struct  cputype *cpu_next;
118 } *cputype;
119
120 /*
121  * A set of options may also be specified which are like CPU types,
122  * but which may also specify values for the options.
123  * A separate set of options may be defined for make-style options.
124  */
125 struct opt {
126         char    *op_name;
127         char    *op_value;
128         int     op_line;        /* line number for error-reporting */
129         int     op_ownfile;     /* true = own file, false = makefile */
130         struct  opt *op_next;
131 } *opt, *mkopt;
132
133 struct opt_list {
134         char *o_name;
135         char *o_file;
136         struct opt_list *o_next;
137 } *otab;
138
139 extern char     *ident;
140 extern int      do_trace;
141
142 char    *get_word(FILE *);
143 char    *get_quoted_word(FILE *);
144 char    *path(const char *);
145 char    *raisestr(char *);
146 void    moveifchanged(const char *, const char *);
147 void    init_dev(struct device *);       
148 void    newbus_ioconf(void);
149 void    options(void);
150 void    makefile(void);
151 void    headers(void);
152
153 extern struct   device *dtab;
154
155 extern char     errbuf[80];
156 extern int      yyline;
157
158 extern struct   file_list *ftab;
159
160 extern int      profiling;
161 extern int      debugging;
162
163 extern int      maxusers;
164
165 extern char *PREFIX;            /* Config file name - for error messages */
166 extern char srcdir[];           /* root of the kernel source tree */