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 56 /* 57 * Types. 58 */ 59 #define DRIVER 1 60 #define NORMAL 2 61 #define INVISIBLE 3 62 #define PROFILING 4 63 #define NODEPEND 5 64 #define LOCAL 6 65 #define DEVDONE 0x80000000 66 #define TYPEMASK 0x7fffffff 67 68 /* 69 * Attributes (flags). 70 */ 71 #define CONFIGDEP 1 72 #define NO_IMPLCT_RULE 2 73 #define NO_OBJ 4 74 #define BEFORE_DEPEND 8 75 76 struct device { 77 int d_type; /* CONTROLLER, DEVICE, bus adaptor */ 78 struct device *d_conn; /* what it is connected to */ 79 char *d_name; /* name of device (e.g. rk11) */ 80 int d_unit; /* unit number */ 81 int d_drive; /* drive number */ 82 int d_target; /* target number */ 83 int d_lun; /* unit number */ 84 int d_slave; /* slave number */ 85 #define QUES -1 /* -1 means '?' */ 86 #define UNKNOWN -2 /* -2 means not set yet */ 87 int d_dk; /* if init 1 set to number for iostat */ 88 int d_flags; /* flags for device init */ 89 int d_conflicts; /* I'm allowed to conflict */ 90 int d_disabled; /* nonzero to skip probe/attach */ 91 char *d_port; /* io port base manifest constant */ 92 int d_portn; /* io port base (if number not manifest) */ 93 int d_maddr; /* io memory base */ 94 int d_msize; /* io memory size */ 95 int d_drq; /* DMA request */ 96 int d_irq; /* interrupt request */ 97 struct device *d_next; /* Next one in list */ 98 }; 99 #define TO_NEXUS (struct device *)-1 100 #define TO_VBA (struct device *)-2 101 102 struct config { 103 char *c_dev; 104 char *s_sysname; 105 }; 106 107 /* 108 * Config has a global notion of which machine type is 109 * being used. It uses the name of the machine in choosing 110 * files and directories. Thus if the name of the machine is ``i386'', 111 * it will build from ``Makefile.i386'' and use ``../i386/inline'' 112 * in the makerules, etc. 113 */ 114 int machine; 115 char *machinename; 116 #define MACHINE_I386 1 117 #define MACHINE_PC98 2 118 #define MACHINE_ALPHA 3 119 120 /* 121 * For each machine, a set of CPU's may be specified as supported. 122 * These and the options (below) are put in the C flags in the makefile. 123 */ 124 struct cputype { 125 char *cpu_name; 126 struct cputype *cpu_next; 127 } *cputype; 128 129 /* 130 * A set of options may also be specified which are like CPU types, 131 * but which may also specify values for the options. 132 * A separate set of options may be defined for make-style options. 133 */ 134 struct opt { 135 char *op_name; 136 char *op_value; 137 int op_line; /* line number for error-reporting */ 138 int op_ownfile; /* true = own file, false = makefile */ 139 struct opt *op_next; 140 } *opt, *mkopt; 141 142 struct opt_list { 143 char *o_name; 144 char *o_file; 145 struct opt_list *o_next; 146 } *otab; 147 148 extern char *ident; 149 extern int do_trace; 150 151 char *get_word __P((FILE *)); 152 char *get_quoted_word __P((FILE *)); 153 char *path __P((char *)); 154 char *raisestr __P((char *)); 155 void moveifchanged __P((const char *, const char *)); 156 void init_dev __P((struct device *)); 157 void newbus_ioconf __P((void)); 158 int yyparse __P((void)); 159 int yylex __P((void)); 160 void options __P((void)); 161 void makefile __P((void)); 162 void headers __P((void)); 163 164 165 extern int seen_scbus; 166 extern struct device *dtab; 167 168 extern char errbuf[80]; 169 extern int yyline; 170 171 extern struct file_list *ftab; 172 173 extern int profiling; 174 extern int debugging; 175 176 extern int maxusers; 177 178 extern int old_config_present; /* Old config/build directory still there */ 179 180 extern char *PREFIX; /* Config file name - for error messages */ 181 182 #define eq(a,b) (!strcmp(a,b)) 183