386BSD 0.0 development
[unix-history] / usr / src / usr.sbin / config / config.h
CommitLineData
23be2999
WJ
1/*
2 * Copyright (c) 1980 Regents of the University of California.
3 * 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. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)config.h 5.14 (Berkeley) 7/1/91
34 */
35
36/*
37 * Config.
38 */
39#include <sys/types.h>
40#include <stdlib.h>
41#include <string.h>
42
43#define NODEV ((dev_t)-1)
44
45struct file_list {
46 struct file_list *f_next;
47 char *f_fn; /* the name */
48 u_char f_type; /* see below */
49 u_char f_flags; /* see below */
50 char *f_special; /* special make rule if present */
51 char *f_needs;
52 /*
53 * Random values:
54 * swap space parameters for swap areas
55 * root device, etc. for system specifications
56 */
57 union {
58 struct { /* when swap specification */
59 dev_t fuw_swapdev;
60 int fuw_swapsize;
61 } fuw;
62 struct { /* when system specification */
63 dev_t fus_rootdev;
64 dev_t fus_dumpdev;
65 } fus;
66 } fun;
67#define f_swapdev fun.fuw.fuw_swapdev
68#define f_swapsize fun.fuw.fuw_swapsize
69#define f_rootdev fun.fus.fus_rootdev
70#define f_dumpdev fun.fus.fus_dumpdev
71};
72
73/*
74 * Types.
75 */
76#define DRIVER 1
77#define NORMAL 2
78#define INVISIBLE 3
79#define PROFILING 4
80#define SYSTEMSPEC 5
81#define SWAPSPEC 6
82
83/*
84 * Attributes (flags).
85 */
86#define CONFIGDEP 1
87
88struct idlst {
89 char *id;
90 struct idlst *id_next;
91};
92
93struct device {
94 int d_type; /* CONTROLLER, DEVICE, bus adaptor */
95 struct device *d_conn; /* what it is connected to */
96 char *d_name; /* name of device (e.g. rk11) */
97 struct idlst *d_vec; /* interrupt vectors */
98 int d_pri; /* interrupt priority */
99 int d_addr; /* address of csr */
100 int d_unit; /* unit number */
101 int d_drive; /* drive number */
102 int d_slave; /* slave number */
103#define QUES -1 /* -1 means '?' */
104#define UNKNOWN -2 /* -2 means not set yet */
105 int d_dk; /* if init 1 set to number for iostat */
106 int d_flags; /* flags for device init */
107 char *d_port; /* io port base manifest constant */
108 int d_portn; /* io port base (if number not manifest) */
109 char *d_mask; /* interrupt mask */
110 int d_maddr; /* io memory base */
111 int d_msize; /* io memory size */
112 int d_drq; /* DMA request */
113 int d_irq; /* interrupt request */
114 struct device *d_next; /* Next one in list */
115};
116#define TO_NEXUS (struct device *)-1
117#define TO_VBA (struct device *)-2
118
119struct config {
120 char *c_dev;
121 char *s_sysname;
122};
123
124/*
125 * Config has a global notion of which machine type is
126 * being used. It uses the name of the machine in choosing
127 * files and directories. Thus if the name of the machine is ``vax'',
128 * it will build from ``Makefile.vax'' and use ``../vax/inline''
129 * in the makerules, etc.
130 */
131int machine;
132char *machinename;
133#define MACHINE_VAX 1
134#define MACHINE_TAHOE 2
135#define MACHINE_HP300 3
136#define MACHINE_I386 4
137
138/*
139 * For each machine, a set of CPU's may be specified as supported.
140 * These and the options (below) are put in the C flags in the makefile.
141 */
142struct cputype {
143 char *cpu_name;
144 struct cputype *cpu_next;
145} *cputype;
146
147/*
148 * A set of options may also be specified which are like CPU types,
149 * but which may also specify values for the options.
150 * A separate set of options may be defined for make-style options.
151 */
152struct opt {
153 char *op_name;
154 char *op_value;
155 struct opt *op_next;
156} *opt, *mkopt;
157
158char *ident;
159char *ns();
160char *tc();
161char *qu();
162char *get_word();
163char *get_quoted_word();
164char *path();
165char *raise();
166
167int do_trace;
168
169#if MACHINE_VAX
170int seen_mba, seen_uba;
171#endif
172#if MACHINE_TAHOE
173int seen_vba;
174#endif
175#if MACHINE_I386
176int seen_isa;
177#endif
178
179struct device *connect();
180struct device *dtab;
181dev_t nametodev();
182char *devtoname();
183
184char errbuf[80];
185int yyline;
186
187struct file_list *ftab, *conf_list, **confp;
188
189int zone, hadtz;
190int dst;
191int profiling;
192int debugging;
193
194int maxusers;
195
196#define eq(a,b) (!strcmp(a,b))