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