cpuconf.c revision 1.26 1 1.26 thorpej /* $NetBSD: cpuconf.c,v 1.26 2000/06/25 17:21:55 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 * 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.1 cgd
69 1.1 cgd #include <sys/param.h>
70 1.1 cgd #include <sys/device.h>
71 1.7 mjacob #include <sys/systm.h>
72 1.1 cgd #include <machine/cpuconf.h>
73 1.7 mjacob #include <machine/rpb.h>
74 1.7 mjacob
75 1.8 thorpej #include "opt_dec_3000_500.h"
76 1.8 thorpej #ifdef DEC_3000_500
77 1.7 mjacob extern void dec_3000_500_init __P((void));
78 1.7 mjacob #else
79 1.8 thorpej #define dec_3000_500_init platform_not_configured
80 1.7 mjacob #endif
81 1.1 cgd
82 1.8 thorpej #include "opt_dec_3000_300.h"
83 1.8 thorpej #ifdef DEC_3000_300
84 1.7 mjacob extern void dec_3000_300_init __P((void));
85 1.7 mjacob #else
86 1.8 thorpej #define dec_3000_300_init platform_not_configured
87 1.7 mjacob #endif
88 1.7 mjacob
89 1.8 thorpej #include "opt_dec_axppci_33.h"
90 1.8 thorpej #ifdef DEC_AXPPCI_33
91 1.7 mjacob extern void dec_axppci_33_init __P((void));
92 1.7 mjacob #else
93 1.8 thorpej #define dec_axppci_33_init platform_not_configured
94 1.7 mjacob #endif
95 1.7 mjacob
96 1.8 thorpej #include "opt_dec_kn8ae.h"
97 1.8 thorpej #ifdef DEC_KN8AE
98 1.7 mjacob extern void dec_kn8ae_init __P((void));
99 1.7 mjacob #else
100 1.8 thorpej #define dec_kn8ae_init platform_not_configured
101 1.7 mjacob #endif
102 1.7 mjacob
103 1.8 thorpej #include "opt_dec_2100_a50.h"
104 1.8 thorpej #ifdef DEC_2100_A50
105 1.7 mjacob extern void dec_2100_a50_init __P((void));
106 1.7 mjacob #else
107 1.8 thorpej #define dec_2100_a50_init platform_not_configured
108 1.7 mjacob #endif
109 1.7 mjacob
110 1.8 thorpej #include "opt_dec_kn20aa.h"
111 1.8 thorpej #ifdef DEC_KN20AA
112 1.7 mjacob extern void dec_kn20aa_init __P((void));
113 1.7 mjacob #else
114 1.8 thorpej #define dec_kn20aa_init platform_not_configured
115 1.7 mjacob #endif
116 1.7 mjacob
117 1.8 thorpej #include "opt_dec_eb64plus.h"
118 1.8 thorpej #ifdef DEC_EB64PLUS
119 1.7 mjacob extern void dec_eb64plus_init __P((void));
120 1.7 mjacob #else
121 1.8 thorpej #define dec_eb64plus_init platform_not_configured
122 1.7 mjacob #endif
123 1.7 mjacob
124 1.8 thorpej #include "opt_dec_eb164.h"
125 1.8 thorpej #ifdef DEC_EB164
126 1.7 mjacob extern void dec_eb164_init __P((void));
127 1.7 mjacob #else
128 1.8 thorpej #define dec_eb164_init platform_not_configured
129 1.7 mjacob #endif
130 1.1 cgd
131 1.9 ross #include "opt_avalon_a12.h"
132 1.9 ross #ifdef AVALON_A12
133 1.9 ross extern void avalon_a12_init __P((void));
134 1.9 ross #else
135 1.9 ross #define avalon_a12_init platform_not_configured
136 1.9 ross #endif
137 1.9 ross
138 1.11 mjacob #include "opt_dec_kn300.h"
139 1.11 mjacob #ifdef DEC_KN300
140 1.11 mjacob extern void dec_kn300_init __P((void));
141 1.11 mjacob #else
142 1.12 thorpej #define dec_kn300_init platform_not_configured
143 1.11 mjacob #endif
144 1.11 mjacob
145 1.14 thorpej #include "opt_dec_550.h"
146 1.14 thorpej #ifdef DEC_550
147 1.14 thorpej extern void dec_550_init __P((void));
148 1.14 thorpej #else
149 1.14 thorpej #define dec_550_init platform_not_configured
150 1.14 thorpej #endif
151 1.14 thorpej
152 1.17 ross #include "opt_dec_1000.h"
153 1.15 ross #include "opt_dec_1000a.h"
154 1.17 ross #if defined(DEC_1000) || defined(DEC_1000A)
155 1.26 thorpej extern void _dec_1000a_init __P((void));
156 1.26 thorpej #endif
157 1.26 thorpej #ifdef DEC_1000A
158 1.26 thorpej #define dec_1000a_init _dec_1000a_init
159 1.26 thorpej #else
160 1.26 thorpej #define dec_1000a_init platform_not_configured
161 1.26 thorpej #endif
162 1.26 thorpej #ifdef DEC_1000
163 1.26 thorpej #define dec_1000_init _dec_1000a_init
164 1.15 ross #else
165 1.15 ross #define dec_1000a_init platform_not_configured
166 1.15 ross #endif
167 1.15 ross
168 1.16 thorpej #include "opt_dec_alphabook1.h"
169 1.16 thorpej #ifdef DEC_ALPHABOOK1
170 1.16 thorpej extern void dec_alphabook1_init __P((void));
171 1.16 thorpej #else
172 1.16 thorpej #define dec_alphabook1_init platform_not_configured
173 1.16 thorpej #endif
174 1.16 thorpej
175 1.18 thorpej #include "opt_dec_eb66.h"
176 1.18 thorpej #ifdef DEC_EB66
177 1.18 thorpej extern void dec_eb66_init __P((void));
178 1.18 thorpej #else
179 1.18 thorpej #define dec_eb66_init platform_not_configured
180 1.18 thorpej #endif
181 1.18 thorpej
182 1.22 ross #include "opt_dec_6600.h"
183 1.22 ross #ifdef DEC_6600
184 1.22 ross extern void dec_6600_init __P((void));
185 1.22 ross #else
186 1.22 ross #define dec_6600_init platform_not_configured
187 1.22 ross #endif
188 1.22 ross
189 1.23 thorpej #include "opt_dec_2100_a500.h"
190 1.26 thorpej #include "opt_dec_2100a_a500.h"
191 1.26 thorpej #if defined(DEC_2100_A500) || defined(DEC_2100A_A500)
192 1.26 thorpej extern void _dec_2100_a500_init __P((void));
193 1.26 thorpej #endif
194 1.23 thorpej #ifdef DEC_2100_A500
195 1.26 thorpej #define dec_2100_a500_init _dec_2100_a500_init
196 1.23 thorpej #else
197 1.23 thorpej #define dec_2100_a500_init platform_not_configured
198 1.23 thorpej #endif
199 1.26 thorpej #ifdef DEC_2100A_A500
200 1.26 thorpej #define dec_2100a_a500_init _dec_2100_a500_init
201 1.26 thorpej #else
202 1.26 thorpej #define dec_2100a_a500_init platform_not_configured
203 1.26 thorpej #endif
204 1.23 thorpej
205 1.24 thorpej #include "opt_api_up1000.h"
206 1.24 thorpej #ifdef API_UP1000
207 1.24 thorpej extern void api_up1000_init __P((void));
208 1.24 thorpej #else
209 1.24 thorpej #define api_up1000_init platform_not_configured
210 1.24 thorpej #endif
211 1.24 thorpej
212 1.25 thorpej #include "opt_dec_2000_300.h"
213 1.25 thorpej #ifdef DEC_2000_300
214 1.25 thorpej extern void dec_2000_300_init __P((void));
215 1.25 thorpej #else
216 1.25 thorpej #define dec_2000_300_init platform_not_configured
217 1.25 thorpej #endif
218 1.25 thorpej
219 1.24 thorpej static const struct cpuinit cpuinit[] = {
220 1.24 thorpej cpu_notsupp(ST_ADU, "Alpha Demo Unit"),
221 1.24 thorpej cpu_notsupp(ST_DEC_4000, "DEC 4000 (``Cobra'')"),
222 1.24 thorpej cpu_notsupp(ST_DEC_7000, "DEC 7000 (``Ruby'')"),
223 1.24 thorpej cpu_init(ST_DEC_3000_500, dec_3000_500_init, "DEC_3000_500"),
224 1.25 thorpej cpu_init(ST_DEC_2000_300, dec_2000_300_init, "DEC_2000_300"),
225 1.24 thorpej cpu_init(ST_DEC_3000_300, dec_3000_300_init, "DEC_3000_300"),
226 1.24 thorpej cpu_init(ST_AVALON_A12, avalon_a12_init, "AVALON_A12"),
227 1.24 thorpej cpu_init(ST_DEC_2100_A500, dec_2100_a500_init, "DEC_2100_A500"),
228 1.24 thorpej cpu_notsupp(ST_DEC_APXVME_64, "AXPvme 64"),
229 1.24 thorpej cpu_init(ST_DEC_AXPPCI_33, dec_axppci_33_init, "DEC_AXPPCI_33"),
230 1.24 thorpej cpu_init(ST_DEC_21000, dec_kn8ae_init, "DEC_KN8AE"),
231 1.24 thorpej cpu_init(ST_DEC_2100_A50, dec_2100_a50_init, "DEC_2100_A50"),
232 1.24 thorpej cpu_notsupp(ST_DEC_MUSTANG, "Mustang"),
233 1.24 thorpej cpu_init(ST_DEC_KN20AA, dec_kn20aa_init, "DEC_KN20AA"),
234 1.26 thorpej cpu_init(ST_DEC_1000, dec_1000_init, "DEC_1000"),
235 1.24 thorpej cpu_init(ST_EB66, dec_eb66_init, "DEC_EB66"),
236 1.24 thorpej cpu_init(ST_EB64P, dec_eb64plus_init, "DEC_EB64PLUS"),
237 1.24 thorpej cpu_init(ST_ALPHABOOK1, dec_alphabook1_init, "DEC_ALPHABOOK1"),
238 1.24 thorpej cpu_init(ST_DEC_4100, dec_kn300_init, "DEC_KN300"),
239 1.24 thorpej cpu_notsupp(ST_DEC_EV45_PBP, "EV45 Passive Backplane Board"),
240 1.26 thorpej cpu_init(ST_DEC_2100A_A500, dec_2100a_a500_init, "DEC_2100A_A500"),
241 1.24 thorpej cpu_init(ST_EB164, dec_eb164_init, "DEC_EB164"),
242 1.24 thorpej cpu_init(ST_DEC_1000A, dec_1000a_init, "DEC_1000A"),
243 1.24 thorpej cpu_notsupp(ST_DEC_ALPHAVME_224, "AlphaVME 224"),
244 1.24 thorpej cpu_init(ST_DEC_550, dec_550_init, "DEC_550"),
245 1.24 thorpej cpu_notsupp(ST_DEC_EV56_PBP, "EV56 Passive Backplane Board"),
246 1.24 thorpej cpu_notsupp(ST_DEC_ALPHAVME_320, "AlphaVME 320"),
247 1.24 thorpej cpu_init(ST_DEC_6600, dec_6600_init, "DEC_6600"),
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.8 thorpej platform_not_configured()
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.7 mjacob printf("\n");
277 1.8 thorpej panic("platform not configured\n");
278 1.8 thorpej }
279 1.8 thorpej
280 1.8 thorpej void
281 1.8 thorpej platform_not_supported()
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