1 1.38 thorpej /* $NetBSD: cpuconf.c,v 1.38 2024/03/02 20:15:33 thorpej Exp $ */ 2 1.24 thorpej 3 1.24 thorpej /*- 4 1.24 thorpej * Copyright (c) 2000 The NetBSD Foundation, Inc. 5 1.24 thorpej * All rights reserved. 6 1.24 thorpej * 7 1.24 thorpej * This code is derived from software contributed to The NetBSD Foundation 8 1.24 thorpej * by Jason R. Thorpe. 9 1.24 thorpej * 10 1.24 thorpej * Redistribution and use in source and binary forms, with or without 11 1.24 thorpej * modification, are permitted provided that the following conditions 12 1.24 thorpej * are met: 13 1.24 thorpej * 1. Redistributions of source code must retain the above copyright 14 1.24 thorpej * notice, this list of conditions and the following disclaimer. 15 1.24 thorpej * 2. Redistributions in binary form must reproduce the above copyright 16 1.24 thorpej * notice, this list of conditions and the following disclaimer in the 17 1.24 thorpej * documentation and/or other materials provided with the distribution. 18 1.24 thorpej * 19 1.24 thorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20 1.24 thorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 1.24 thorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 1.24 thorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23 1.24 thorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 1.24 thorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 1.24 thorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 1.24 thorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 1.24 thorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 1.24 thorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 1.24 thorpej * POSSIBILITY OF SUCH DAMAGE. 30 1.24 thorpej */ 31 1.1 cgd 32 1.1 cgd /* 33 1.1 cgd * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. 34 1.1 cgd * 35 1.1 cgd * Redistribution and use in source and binary forms, with or without 36 1.1 cgd * modification, are permitted provided that the following conditions 37 1.1 cgd * are met: 38 1.1 cgd * 1. Redistributions of source code must retain the above copyright 39 1.1 cgd * notice, this list of conditions and the following disclaimer. 40 1.1 cgd * 2. Redistributions in binary form must reproduce the above copyright 41 1.1 cgd * notice, this list of conditions and the following disclaimer in the 42 1.1 cgd * documentation and/or other materials provided with the distribution. 43 1.1 cgd * 3. All advertising materials mentioning features or use of this software 44 1.1 cgd * must display the following acknowledgement: 45 1.1 cgd * This product includes software developed by Christopher G. Demetriou 46 1.1 cgd * for the NetBSD Project. 47 1.1 cgd * 4. The name of the author may not be used to endorse or promote products 48 1.1 cgd * derived from this software without specific prior written permission 49 1.1 cgd * 50 1.1 cgd * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 51 1.1 cgd * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 52 1.1 cgd * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 53 1.1 cgd * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 54 1.1 cgd * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 55 1.1 cgd * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 56 1.1 cgd * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 57 1.1 cgd * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 58 1.1 cgd * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 59 1.1 cgd * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 60 1.1 cgd */ 61 1.29 lukem 62 1.29 lukem #include <sys/cdefs.h> 63 1.38 thorpej __KERNEL_RCSID(0, "$NetBSD: cpuconf.c,v 1.38 2024/03/02 20:15:33 thorpej Exp $"); 64 1.1 cgd 65 1.1 cgd #include <sys/param.h> 66 1.1 cgd #include <sys/device.h> 67 1.7 mjacob #include <sys/systm.h> 68 1.1 cgd #include <machine/cpuconf.h> 69 1.7 mjacob #include <machine/rpb.h> 70 1.7 mjacob 71 1.38 thorpej #include "opt_dec_kn7aa.h" 72 1.38 thorpej #ifdef DEC_KN7AA 73 1.38 thorpej extern void dec_kn7aa_init(void); 74 1.38 thorpej #else 75 1.38 thorpej #define dec_kn7aa_init platform_not_configured 76 1.38 thorpej #endif 77 1.38 thorpej 78 1.8 thorpej #include "opt_dec_3000_500.h" 79 1.8 thorpej #ifdef DEC_3000_500 80 1.32 dsl extern void dec_3000_500_init(void); 81 1.7 mjacob #else 82 1.8 thorpej #define dec_3000_500_init platform_not_configured 83 1.7 mjacob #endif 84 1.1 cgd 85 1.8 thorpej #include "opt_dec_3000_300.h" 86 1.8 thorpej #ifdef DEC_3000_300 87 1.32 dsl extern void dec_3000_300_init(void); 88 1.7 mjacob #else 89 1.8 thorpej #define dec_3000_300_init platform_not_configured 90 1.7 mjacob #endif 91 1.7 mjacob 92 1.8 thorpej #include "opt_dec_axppci_33.h" 93 1.8 thorpej #ifdef DEC_AXPPCI_33 94 1.32 dsl extern void dec_axppci_33_init(void); 95 1.7 mjacob #else 96 1.8 thorpej #define dec_axppci_33_init platform_not_configured 97 1.7 mjacob #endif 98 1.7 mjacob 99 1.8 thorpej #include "opt_dec_kn8ae.h" 100 1.8 thorpej #ifdef DEC_KN8AE 101 1.32 dsl extern void dec_kn8ae_init(void); 102 1.7 mjacob #else 103 1.8 thorpej #define dec_kn8ae_init platform_not_configured 104 1.7 mjacob #endif 105 1.7 mjacob 106 1.8 thorpej #include "opt_dec_2100_a50.h" 107 1.8 thorpej #ifdef DEC_2100_A50 108 1.32 dsl extern void dec_2100_a50_init(void); 109 1.7 mjacob #else 110 1.8 thorpej #define dec_2100_a50_init platform_not_configured 111 1.7 mjacob #endif 112 1.7 mjacob 113 1.8 thorpej #include "opt_dec_kn20aa.h" 114 1.8 thorpej #ifdef DEC_KN20AA 115 1.32 dsl extern void dec_kn20aa_init(void); 116 1.7 mjacob #else 117 1.8 thorpej #define dec_kn20aa_init platform_not_configured 118 1.7 mjacob #endif 119 1.7 mjacob 120 1.8 thorpej #include "opt_dec_eb64plus.h" 121 1.8 thorpej #ifdef DEC_EB64PLUS 122 1.32 dsl extern void dec_eb64plus_init(void); 123 1.7 mjacob #else 124 1.8 thorpej #define dec_eb64plus_init platform_not_configured 125 1.7 mjacob #endif 126 1.7 mjacob 127 1.8 thorpej #include "opt_dec_eb164.h" 128 1.8 thorpej #ifdef DEC_EB164 129 1.32 dsl extern void dec_eb164_init(void); 130 1.7 mjacob #else 131 1.8 thorpej #define dec_eb164_init platform_not_configured 132 1.7 mjacob #endif 133 1.1 cgd 134 1.11 mjacob #include "opt_dec_kn300.h" 135 1.11 mjacob #ifdef DEC_KN300 136 1.32 dsl extern void dec_kn300_init(void); 137 1.11 mjacob #else 138 1.12 thorpej #define dec_kn300_init platform_not_configured 139 1.11 mjacob #endif 140 1.11 mjacob 141 1.14 thorpej #include "opt_dec_550.h" 142 1.14 thorpej #ifdef DEC_550 143 1.32 dsl extern void dec_550_init(void); 144 1.14 thorpej #else 145 1.14 thorpej #define dec_550_init platform_not_configured 146 1.14 thorpej #endif 147 1.14 thorpej 148 1.17 ross #include "opt_dec_1000.h" 149 1.15 ross #include "opt_dec_1000a.h" 150 1.17 ross #if defined(DEC_1000) || defined(DEC_1000A) 151 1.32 dsl extern void _dec_1000a_init(void); 152 1.26 thorpej #endif 153 1.26 thorpej #ifdef DEC_1000A 154 1.26 thorpej #define dec_1000a_init _dec_1000a_init 155 1.26 thorpej #else 156 1.26 thorpej #define dec_1000a_init platform_not_configured 157 1.26 thorpej #endif 158 1.26 thorpej #ifdef DEC_1000 159 1.26 thorpej #define dec_1000_init _dec_1000a_init 160 1.15 ross #else 161 1.27 enami #define dec_1000_init platform_not_configured 162 1.15 ross #endif 163 1.15 ross 164 1.16 thorpej #include "opt_dec_alphabook1.h" 165 1.16 thorpej #ifdef DEC_ALPHABOOK1 166 1.32 dsl extern void dec_alphabook1_init(void); 167 1.16 thorpej #else 168 1.16 thorpej #define dec_alphabook1_init platform_not_configured 169 1.16 thorpej #endif 170 1.16 thorpej 171 1.18 thorpej #include "opt_dec_eb66.h" 172 1.18 thorpej #ifdef DEC_EB66 173 1.32 dsl extern void dec_eb66_init(void); 174 1.18 thorpej #else 175 1.18 thorpej #define dec_eb66_init platform_not_configured 176 1.18 thorpej #endif 177 1.18 thorpej 178 1.22 ross #include "opt_dec_6600.h" 179 1.22 ross #ifdef DEC_6600 180 1.32 dsl extern void dec_6600_init(void); 181 1.22 ross #else 182 1.22 ross #define dec_6600_init platform_not_configured 183 1.22 ross #endif 184 1.22 ross 185 1.23 thorpej #include "opt_dec_2100_a500.h" 186 1.26 thorpej #include "opt_dec_2100a_a500.h" 187 1.26 thorpej #if defined(DEC_2100_A500) || defined(DEC_2100A_A500) 188 1.32 dsl extern void _dec_2100_a500_init(void); 189 1.26 thorpej #endif 190 1.23 thorpej #ifdef DEC_2100_A500 191 1.26 thorpej #define dec_2100_a500_init _dec_2100_a500_init 192 1.23 thorpej #else 193 1.23 thorpej #define dec_2100_a500_init platform_not_configured 194 1.23 thorpej #endif 195 1.26 thorpej #ifdef DEC_2100A_A500 196 1.26 thorpej #define dec_2100a_a500_init _dec_2100_a500_init 197 1.26 thorpej #else 198 1.26 thorpej #define dec_2100a_a500_init platform_not_configured 199 1.26 thorpej #endif 200 1.23 thorpej 201 1.24 thorpej #include "opt_api_up1000.h" 202 1.24 thorpej #ifdef API_UP1000 203 1.32 dsl extern void api_up1000_init(void); 204 1.24 thorpej #else 205 1.24 thorpej #define api_up1000_init platform_not_configured 206 1.24 thorpej #endif 207 1.24 thorpej 208 1.25 thorpej #include "opt_dec_2000_300.h" 209 1.25 thorpej #ifdef DEC_2000_300 210 1.32 dsl extern void dec_2000_300_init(void); 211 1.25 thorpej #else 212 1.25 thorpej #define dec_2000_300_init platform_not_configured 213 1.25 thorpej #endif 214 1.25 thorpej 215 1.24 thorpej static const struct cpuinit cpuinit[] = { 216 1.24 thorpej cpu_notsupp(ST_ADU, "Alpha Demo Unit"), 217 1.24 thorpej cpu_notsupp(ST_DEC_4000, "DEC 4000 (``Cobra'')"), 218 1.38 thorpej cpu_init(ST_DEC_7000, dec_kn7aa_init, "DEC_KN7AA"), 219 1.24 thorpej cpu_init(ST_DEC_3000_500, dec_3000_500_init, "DEC_3000_500"), 220 1.25 thorpej cpu_init(ST_DEC_2000_300, dec_2000_300_init, "DEC_2000_300"), 221 1.24 thorpej cpu_init(ST_DEC_3000_300, dec_3000_300_init, "DEC_3000_300"), 222 1.24 thorpej cpu_init(ST_DEC_2100_A500, dec_2100_a500_init, "DEC_2100_A500"), 223 1.24 thorpej cpu_notsupp(ST_DEC_APXVME_64, "AXPvme 64"), 224 1.24 thorpej cpu_init(ST_DEC_AXPPCI_33, dec_axppci_33_init, "DEC_AXPPCI_33"), 225 1.24 thorpej cpu_init(ST_DEC_21000, dec_kn8ae_init, "DEC_KN8AE"), 226 1.24 thorpej cpu_init(ST_DEC_2100_A50, dec_2100_a50_init, "DEC_2100_A50"), 227 1.24 thorpej cpu_notsupp(ST_DEC_MUSTANG, "Mustang"), 228 1.24 thorpej cpu_init(ST_DEC_KN20AA, dec_kn20aa_init, "DEC_KN20AA"), 229 1.26 thorpej cpu_init(ST_DEC_1000, dec_1000_init, "DEC_1000"), 230 1.24 thorpej cpu_init(ST_EB66, dec_eb66_init, "DEC_EB66"), 231 1.24 thorpej cpu_init(ST_EB64P, dec_eb64plus_init, "DEC_EB64PLUS"), 232 1.24 thorpej cpu_init(ST_ALPHABOOK1, dec_alphabook1_init, "DEC_ALPHABOOK1"), 233 1.24 thorpej cpu_init(ST_DEC_4100, dec_kn300_init, "DEC_KN300"), 234 1.24 thorpej cpu_notsupp(ST_DEC_EV45_PBP, "EV45 Passive Backplane Board"), 235 1.26 thorpej cpu_init(ST_DEC_2100A_A500, dec_2100a_a500_init, "DEC_2100A_A500"), 236 1.37 thorpej cpu_notsupp(ST_DEC_XL, "Alpha XL"), 237 1.24 thorpej cpu_init(ST_EB164, dec_eb164_init, "DEC_EB164"), 238 1.24 thorpej cpu_init(ST_DEC_1000A, dec_1000a_init, "DEC_1000A"), 239 1.24 thorpej cpu_notsupp(ST_DEC_ALPHAVME_224, "AlphaVME 224"), 240 1.24 thorpej cpu_init(ST_DEC_550, dec_550_init, "DEC_550"), 241 1.37 thorpej cpu_notsupp(ST_DEC_XXM, "DEC XXM"), 242 1.24 thorpej cpu_notsupp(ST_DEC_EV56_PBP, "EV56 Passive Backplane Board"), 243 1.24 thorpej cpu_notsupp(ST_DEC_ALPHAVME_320, "AlphaVME 320"), 244 1.24 thorpej cpu_init(ST_DEC_6600, dec_6600_init, "DEC_6600"), 245 1.36 tsutsui cpu_init(ST_DEC_TITAN, dec_6600_init, "DEC_6600"), 246 1.37 thorpej cpu_notsupp(ST_DEC_MARVEL, "DEC_MARVEL"), 247 1.37 thorpej cpu_notsupp(ST_DTI_RUFFIAN, "DTI_RUFFIAN"), 248 1.24 thorpej cpu_init(ST_API_NAUTILUS, api_up1000_init, "API_UP1000"), 249 1.1 cgd }; 250 1.24 thorpej static const int ncpuinit = (sizeof(cpuinit) / sizeof(cpuinit[0])); 251 1.24 thorpej 252 1.24 thorpej const struct cpuinit * 253 1.24 thorpej platform_lookup(int systype) 254 1.24 thorpej { 255 1.24 thorpej const struct cpuinit *c; 256 1.24 thorpej int i; 257 1.24 thorpej 258 1.24 thorpej for (i = 0; i < ncpuinit; i++) { 259 1.24 thorpej c = &cpuinit[i]; 260 1.24 thorpej if (c->systype == systype) 261 1.24 thorpej return (c); 262 1.24 thorpej } 263 1.24 thorpej return (NULL); 264 1.24 thorpej } 265 1.7 mjacob 266 1.7 mjacob void 267 1.33 cegger platform_not_configured(void) 268 1.7 mjacob { 269 1.24 thorpej const struct cpuinit *c = platform_lookup(cputype); 270 1.8 thorpej 271 1.7 mjacob printf("\n"); 272 1.7 mjacob printf("Support for system type %d is not present in this kernel.\n", 273 1.7 mjacob cputype); 274 1.8 thorpej printf("Please build a kernel with \"options %s\" and reboot.\n", 275 1.24 thorpej c->option); 276 1.35 matt printf("\n"); 277 1.28 provos panic("platform not configured"); 278 1.8 thorpej } 279 1.8 thorpej 280 1.8 thorpej void 281 1.33 cegger platform_not_supported(void) 282 1.8 thorpej { 283 1.24 thorpej const struct cpuinit *c = platform_lookup(cputype); 284 1.8 thorpej 285 1.8 thorpej printf("\n"); 286 1.8 thorpej printf("NetBSD does not yet support system type %d (%s).\n", cputype, 287 1.24 thorpej (c != NULL) ? c->option : "???"); 288 1.8 thorpej printf("\n"); 289 1.8 thorpej panic("platform not supported"); 290 1.7 mjacob } 291