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. 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 8.1 (Berkeley) 6/6/93 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 45 struct file_list { 46 struct file_list *f_next; 47 char *f_fn; /* the name */ 48 int f_type; /* type or count */ 49 u_char f_flags; /* see below */ 50 char *f_special; /* special make rule if present */ 51 char *f_depends; /* additional dependancies */ 52 char *f_clean; /* File list to add to clean rule */ 53 char *f_needs; 54 /* 55 * Random values: 56 * swap space parameters for swap areas 57 * root device, etc. for system specifications 58 */ 59 union { 60 struct { /* when swap specification */ 61 dev_t fuw_swapdev; 62 int fuw_swapsize; 63 int fuw_swapflag; 64 } fuw; 65 struct { /* when system specification */ 66 dev_t fus_rootdev; 67 dev_t fus_dumpdev; 68 } fus; 69 struct { /* when component dev specification */ 70 dev_t fup_compdev; 71 int fup_compinfo; 72 } fup; 73 } fun; 74 #define f_swapdev fun.fuw.fuw_swapdev 75 #define f_swapsize fun.fuw.fuw_swapsize 76 #define f_swapflag fun.fuw.fuw_swapflag 77 #define f_rootdev fun.fus.fus_rootdev 78 #define f_dumpdev fun.fus.fus_dumpdev 79 #define f_compdev fun.fup.fup_compdev 80 #define f_compinfo fun.fup.fup_compinfo 81 }; 82 83 /* 84 * Types. 85 */ 86 #define DRIVER 1 87 #define NORMAL 2 88 #define INVISIBLE 3 89 #define PROFILING 4 90 #define SYSTEMSPEC 5 91 #define SWAPSPEC 6 92 #define COMPDEVICE 7 93 #define COMPSPEC 8 94 95 /* 96 * Attributes (flags). 97 */ 98 #define CONFIGDEP 1 99 #define NO_IMPLCT_RULE 2 100 #define NO_OBJ 4 101 #define BEFORE_DEPEND 8 102 103 struct idlst { 104 char *id; 105 struct idlst *id_next; 106 }; 107 108 struct device { 109 int d_type; /* CONTROLLER, DEVICE, bus adaptor */ 110 struct device *d_conn; /* what it is connected to */ 111 char *d_name; /* name of device (e.g. rk11) */ 112 struct idlst *d_vec; /* interrupt vectors */ 113 int d_pri; /* interrupt priority */ 114 int d_addr; /* address of csr */ 115 int d_unit; /* unit number */ 116 int d_drive; /* drive number */ 117 int d_target; /* target number */ 118 int d_lun; /* unit number */ 119 int d_slave; /* slave number */ 120 #define QUES -1 /* -1 means '?' */ 121 #define UNKNOWN -2 /* -2 means not set yet */ 122 int d_dk; /* if init 1 set to number for iostat */ 123 int d_flags; /* flags for device init */ 124 int d_conflicts; /* I'm allowed to conflict */ 125 int d_disabled; /* nonzero to skip probe/attach */ 126 char *d_port; /* io port base manifest constant */ 127 int d_portn; /* io port base (if number not manifest) */ 128 char *d_mask; /* interrupt mask */ 129 int d_maddr; /* io memory base */ 130 int d_msize; /* io memory size */ 131 int d_drq; /* DMA request */ 132 int d_irq; /* interrupt request */ 133 struct device *d_next; /* Next one in list */ 134 }; 135 #define TO_NEXUS (struct device *)-1 136 #define TO_VBA (struct device *)-2 137 138 struct config { 139 char *c_dev; 140 char *s_sysname; 141 }; 142 143 /* 144 * Config has a global notion of which machine type is 145 * being used. It uses the name of the machine in choosing 146 * files and directories. Thus if the name of the machine is ``vax'', 147 * it will build from ``Makefile.vax'' and use ``../vax/inline'' 148 * in the makerules, etc. 149 */ 150 int machine; 151 char *machinename; 152 #define MACHINE_VAX 1 153 #define MACHINE_TAHOE 2 154 #define MACHINE_HP300 3 155 #define MACHINE_I386 4 156 #define MACHINE_MIPS 5 157 #define MACHINE_PMAX 6 158 #define MACHINE_LUNA68K 7 159 #define MACHINE_NEWS3400 8 160 161 /* 162 * For each machine, a set of CPU's may be specified as supported. 163 * These and the options (below) are put in the C flags in the makefile. 164 */ 165 struct cputype { 166 char *cpu_name; 167 struct cputype *cpu_next; 168 } *cputype; 169 170 /* 171 * A set of options may also be specified which are like CPU types, 172 * but which may also specify values for the options. 173 * A separate set of options may be defined for make-style options. 174 */ 175 struct opt { 176 char *op_name; 177 char *op_value; 178 int op_ownfile; /* true = own file, false = makefile */ 179 struct opt *op_next; 180 } *opt, *mkopt; 181 182 struct opt_list { 183 char *o_name; 184 char *o_file; 185 struct opt_list *o_next; 186 } *otab; 187 188 char *ident; 189 char *ns(); 190 char *tc(); 191 char *qu(); 192 char *get_word(); 193 char *get_quoted_word(); 194 char *path(); 195 char *raise(); 196 void moveifchanged(); 197 198 int do_trace; 199 200 #if MACHINE_VAX 201 int seen_mba, seen_uba; 202 #endif 203 #if MACHINE_TAHOE 204 int seen_vba; 205 #endif 206 #if MACHINE_I386 207 int seen_isa; 208 int seen_scbus; 209 #endif 210 int seen_cd; 211 212 struct device *connect(); 213 struct device *dtab; 214 dev_t nametodev(); 215 char *devtoname(); 216 217 char errbuf[80]; 218 int yyline; 219 220 struct file_list *ftab, *conf_list, **confp, *comp_list, **compp; 221 222 int profiling; 223 int debugging; 224 225 int maxusers; 226 u_int loadaddress; 227 228 extern int old_config_present; /* Old config/build directory still there */ 229 230 #define eq(a,b) (!strcmp(a,b)) 231