1 /* $OpenBSD: cpuconf.c,v 1.13 2009/10/02 18:01:47 miod Exp $ */ 2 /* $NetBSD: cpuconf.c,v 1.27 2000/06/26 02:42:04 enami Exp $ */ 3 4 /*- 5 * Copyright (c) 2000 The NetBSD Foundation, Inc. 6 * All rights reserved. 7 * 8 * This code is derived from software contributed to The NetBSD Foundation 9 * by Jason R. Thorpe. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions and the following disclaimer. 16 * 2. Redistributions in binary form must reproduce the above copyright 17 * notice, this list of conditions and the following disclaimer in the 18 * documentation and/or other materials provided with the distribution. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 * POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33 /* 34 * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. 35 * 36 * Redistribution and use in source and binary forms, with or without 37 * modification, are permitted provided that the following conditions 38 * are met: 39 * 1. Redistributions of source code must retain the above copyright 40 * notice, this list of conditions and the following disclaimer. 41 * 2. Redistributions in binary form must reproduce the above copyright 42 * notice, this list of conditions and the following disclaimer in the 43 * documentation and/or other materials provided with the distribution. 44 * 3. All advertising materials mentioning features or use of this software 45 * must display the following acknowledgement: 46 * This product includes software developed by Christopher G. Demetriou 47 * for the NetBSD Project. 48 * 4. The name of the author may not be used to endorse or promote products 49 * derived from this software without specific prior written permission 50 * 51 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 52 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 53 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 54 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 55 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 56 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 57 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 58 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 59 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 60 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 61 */ 62 63 #include <sys/param.h> 64 #include <sys/device.h> 65 #include <sys/systm.h> 66 #include <machine/cpuconf.h> 67 #include <machine/rpb.h> 68 69 #ifdef DEC_3000_500 70 extern void dec_3000_500_init(void); 71 #else 72 #define dec_3000_500_init platform_not_configured 73 #endif 74 75 #ifdef DEC_3000_300 76 extern void dec_3000_300_init(void); 77 #else 78 #define dec_3000_300_init platform_not_configured 79 #endif 80 81 #ifdef DEC_AXPPCI_33 82 extern void dec_axppci_33_init(void); 83 #else 84 #define dec_axppci_33_init platform_not_configured 85 #endif 86 87 #ifdef DEC_2100_A50 88 extern void dec_2100_a50_init(void); 89 #else 90 #define dec_2100_a50_init platform_not_configured 91 #endif 92 93 #ifdef DEC_KN20AA 94 extern void dec_kn20aa_init(void); 95 #else 96 #define dec_kn20aa_init platform_not_configured 97 #endif 98 99 #ifdef DEC_EB164 100 extern void dec_eb164_init(void); 101 #else 102 #define dec_eb164_init platform_not_configured 103 #endif 104 105 #ifdef DEC_EB64PLUS 106 extern void dec_eb64plus_init(void); 107 #else 108 #define dec_eb64plus_init platform_not_configured 109 #endif 110 111 #ifdef DEC_KN300 112 extern void dec_kn300_init(void); 113 #else 114 #define dec_kn300_init platform_not_configured 115 #endif 116 117 #ifdef DEC_550 118 extern void dec_550_init(void); 119 #else 120 #define dec_550_init platform_not_configured 121 #endif 122 123 #if defined(DEC_1000) || defined(DEC_1000A) 124 extern void _dec_1000a_init(void); 125 #endif 126 #ifdef DEC_1000A 127 #define dec_1000a_init _dec_1000a_init 128 #else 129 #define dec_1000a_init platform_not_configured 130 #endif 131 #ifdef DEC_1000 132 #define dec_1000_init _dec_1000a_init 133 #else 134 #define dec_1000_init platform_not_configured 135 #endif 136 137 #ifdef DEC_6600 138 extern void dec_6600_init(void); 139 #else 140 #define dec_6600_init platform_not_configured 141 #endif 142 143 #ifdef API_UP1000 144 extern void api_up1000_init(void); 145 #else 146 #define api_up1000_init platform_not_configured 147 #endif 148 149 static const struct cpuinit cpuinit[] = { 150 cpu_notsupp(ST_ADU, "Alpha Demo Unit"), 151 cpu_notsupp(ST_DEC_4000, "DEC 4000 (``Cobra'')"), 152 cpu_notsupp(ST_DEC_7000, "DEC 7000 (``Ruby'')"), 153 cpu_init(ST_DEC_3000_500, dec_3000_500_init, "DEC_3000_500"), 154 cpu_notsupp(ST_DEC_2000_300, "DEC_2000_300"), 155 cpu_init(ST_DEC_3000_300, dec_3000_300_init, "DEC_3000_300"), 156 cpu_notsupp(ST_AVALON_A12, "AVALON_A12"), 157 cpu_notsupp(ST_DEC_2100_A500, "DEC_2100_A500"), 158 cpu_notsupp(ST_DEC_APXVME_64, "AXPvme 64"), 159 cpu_init(ST_DEC_AXPPCI_33, dec_axppci_33_init, "DEC_AXPPCI_33"), 160 cpu_notsupp(ST_DEC_21000, "DEC_KN8AE"), 161 cpu_init(ST_DEC_2100_A50, dec_2100_a50_init, "DEC_2100_A50"), 162 cpu_notsupp(ST_DEC_MUSTANG, "Mustang"), 163 cpu_init(ST_DEC_KN20AA, dec_kn20aa_init, "DEC_KN20AA"), 164 cpu_init(ST_DEC_1000, dec_1000_init, "DEC_1000"), 165 cpu_notsupp(ST_EB66, "DEC_EB66"), 166 cpu_init(ST_EB64P, dec_eb64plus_init, "DEC_EB64PLUS"), 167 cpu_notsupp(ST_ALPHABOOK1, "DEC_ALPHABOOK1"), 168 cpu_init(ST_DEC_4100, dec_kn300_init, "DEC_KN300"), 169 cpu_notsupp(ST_DEC_EV45_PBP, "EV45 Passive Backplane Board"), 170 cpu_notsupp(ST_DEC_2100A_A500, "DEC_2100A_A500"), 171 cpu_init(ST_EB164, dec_eb164_init, "DEC_EB164"), 172 cpu_init(ST_DEC_1000A, dec_1000a_init, "DEC_1000A"), 173 cpu_notsupp(ST_DEC_ALPHAVME_224, "AlphaVME 224"), 174 cpu_init(ST_DEC_550, dec_550_init, "DEC_550"), 175 cpu_notsupp(ST_DEC_EV56_PBP, "EV56 Passive Backplane Board"), 176 cpu_notsupp(ST_DEC_ALPHAVME_320, "AlphaVME 320"), 177 cpu_init(ST_DEC_6600, dec_6600_init, "DEC_6600"), 178 cpu_init(ST_DEC_TITAN, dec_6600_init, "DEC_6600"), 179 cpu_init(ST_API_NAUTILUS, api_up1000_init, "API_UP1000"), 180 }; 181 static const int ncpuinit = (sizeof(cpuinit) / sizeof(cpuinit[0])); 182 183 const struct cpuinit * 184 platform_lookup(int systype) 185 { 186 const struct cpuinit *c; 187 int i; 188 189 for (i = 0; i < ncpuinit; i++) { 190 c = &cpuinit[i]; 191 if (c->systype == systype) 192 return (c); 193 } 194 return (NULL); 195 } 196 197 void 198 platform_not_configured() 199 { 200 const struct cpuinit *c = platform_lookup(cputype); 201 202 printf("\nSupport for system type %d is not present in this kernel.\n", 203 cputype); 204 printf("Please build a kernel with \"options %s\" and reboot.\n", 205 c->option); 206 panic("platform not configured"); 207 } 208 209 void 210 platform_not_supported() 211 { 212 const struct cpuinit *c = platform_lookup(cputype); 213 214 printf("\nOpenBSD does not yet support system type %d (%s).\n", cputype, 215 (c != NULL) ? c->option : "???"); 216 panic("platform not supported"); 217 } 218