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