xref: /netbsd/sys/arch/alpha/alpha/cpuconf.c (revision 6550d01e)
1 /* $NetBSD: cpuconf.c,v 1.33 2009/03/18 10:22:22 cegger 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.33 2009/03/18 10:22:22 cegger 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_avalon_a12.h"
128 #ifdef AVALON_A12
129 extern void avalon_a12_init(void);
130 #else
131 #define	avalon_a12_init		platform_not_configured
132 #endif
133 
134 #include "opt_dec_kn300.h"
135 #ifdef	DEC_KN300
136 extern void dec_kn300_init(void);
137 #else
138 #define	dec_kn300_init		platform_not_configured
139 #endif
140 
141 #include "opt_dec_550.h"
142 #ifdef DEC_550
143 extern void dec_550_init(void);
144 #else
145 #define	dec_550_init		platform_not_configured
146 #endif
147 
148 #include "opt_dec_1000.h"
149 #include "opt_dec_1000a.h"
150 #if defined(DEC_1000) || defined(DEC_1000A)
151 extern void _dec_1000a_init(void);
152 #endif
153 #ifdef DEC_1000A
154 #define	dec_1000a_init		_dec_1000a_init
155 #else
156 #define	dec_1000a_init		platform_not_configured
157 #endif
158 #ifdef DEC_1000
159 #define	dec_1000_init		_dec_1000a_init
160 #else
161 #define	dec_1000_init		platform_not_configured
162 #endif
163 
164 #include "opt_dec_alphabook1.h"
165 #ifdef DEC_ALPHABOOK1
166 extern void dec_alphabook1_init(void);
167 #else
168 #define	dec_alphabook1_init	platform_not_configured
169 #endif
170 
171 #include "opt_dec_eb66.h"
172 #ifdef DEC_EB66
173 extern void dec_eb66_init(void);
174 #else
175 #define	dec_eb66_init		platform_not_configured
176 #endif
177 
178 #include "opt_dec_6600.h"
179 #ifdef DEC_6600
180 extern void dec_6600_init(void);
181 #else
182 #define	dec_6600_init		platform_not_configured
183 #endif
184 
185 #include "opt_dec_2100_a500.h"
186 #include "opt_dec_2100a_a500.h"
187 #if defined(DEC_2100_A500) || defined(DEC_2100A_A500)
188 extern void _dec_2100_a500_init(void);
189 #endif
190 #ifdef DEC_2100_A500
191 #define	dec_2100_a500_init	_dec_2100_a500_init
192 #else
193 #define	dec_2100_a500_init	platform_not_configured
194 #endif
195 #ifdef DEC_2100A_A500
196 #define	dec_2100a_a500_init	_dec_2100_a500_init
197 #else
198 #define	dec_2100a_a500_init	platform_not_configured
199 #endif
200 
201 #include "opt_api_up1000.h"
202 #ifdef API_UP1000
203 extern void api_up1000_init(void);
204 #else
205 #define	api_up1000_init		platform_not_configured
206 #endif
207 
208 #include "opt_dec_2000_300.h"
209 #ifdef DEC_2000_300
210 extern void dec_2000_300_init(void);
211 #else
212 #define	dec_2000_300_init	platform_not_configured
213 #endif
214 
215 static const struct cpuinit cpuinit[] = {
216 	cpu_notsupp(ST_ADU, "Alpha Demo Unit"),
217 	cpu_notsupp(ST_DEC_4000, "DEC 4000 (``Cobra'')"),
218 	cpu_notsupp(ST_DEC_7000, "DEC 7000 (``Ruby'')"),
219 	cpu_init(ST_DEC_3000_500, dec_3000_500_init, "DEC_3000_500"),
220 	cpu_init(ST_DEC_2000_300, dec_2000_300_init, "DEC_2000_300"),
221 	cpu_init(ST_DEC_3000_300, dec_3000_300_init, "DEC_3000_300"),
222 	cpu_init(ST_AVALON_A12, avalon_a12_init, "AVALON_A12"),
223 	cpu_init(ST_DEC_2100_A500, dec_2100_a500_init, "DEC_2100_A500"),
224 	cpu_notsupp(ST_DEC_APXVME_64, "AXPvme 64"),
225 	cpu_init(ST_DEC_AXPPCI_33, dec_axppci_33_init, "DEC_AXPPCI_33"),
226 	cpu_init(ST_DEC_21000, dec_kn8ae_init, "DEC_KN8AE"),
227 	cpu_init(ST_DEC_2100_A50, dec_2100_a50_init, "DEC_2100_A50"),
228 	cpu_notsupp(ST_DEC_MUSTANG, "Mustang"),
229 	cpu_init(ST_DEC_KN20AA, dec_kn20aa_init, "DEC_KN20AA"),
230 	cpu_init(ST_DEC_1000, dec_1000_init, "DEC_1000"),
231 	cpu_init(ST_EB66, dec_eb66_init, "DEC_EB66"),
232 	cpu_init(ST_EB64P, dec_eb64plus_init, "DEC_EB64PLUS"),
233 	cpu_init(ST_ALPHABOOK1, dec_alphabook1_init, "DEC_ALPHABOOK1"),
234 	cpu_init(ST_DEC_4100, dec_kn300_init, "DEC_KN300"),
235 	cpu_notsupp(ST_DEC_EV45_PBP, "EV45 Passive Backplane Board"),
236 	cpu_init(ST_DEC_2100A_A500, dec_2100a_a500_init, "DEC_2100A_A500"),
237 	cpu_init(ST_EB164, dec_eb164_init, "DEC_EB164"),
238 	cpu_init(ST_DEC_1000A, dec_1000a_init, "DEC_1000A"),
239 	cpu_notsupp(ST_DEC_ALPHAVME_224, "AlphaVME 224"),
240 	cpu_init(ST_DEC_550, dec_550_init, "DEC_550"),
241 	cpu_notsupp(ST_DEC_EV56_PBP, "EV56 Passive Backplane Board"),
242 	cpu_notsupp(ST_DEC_ALPHAVME_320, "AlphaVME 320"),
243 	cpu_init(ST_DEC_6600, dec_6600_init, "DEC_6600"),
244 	cpu_init(ST_API_NAUTILUS, api_up1000_init, "API_UP1000"),
245 };
246 static const int ncpuinit = (sizeof(cpuinit) / sizeof(cpuinit[0]));
247 
248 const struct cpuinit *
249 platform_lookup(int systype)
250 {
251 	const struct cpuinit *c;
252 	int i;
253 
254 	for (i = 0; i < ncpuinit; i++) {
255 		c = &cpuinit[i];
256 		if (c->systype == systype)
257 			return (c);
258 	}
259 	return (NULL);
260 }
261 
262 void
263 platform_not_configured(void)
264 {
265 	const struct cpuinit *c = platform_lookup(cputype);
266 
267 	printf("\n");
268 	printf("Support for system type %d is not present in this kernel.\n",
269 	    cputype);
270 	printf("Please build a kernel with \"options %s\" and reboot.\n",
271 	    c->option);
272 	printf("\n");
273 	panic("platform not configured");
274 }
275 
276 void
277 platform_not_supported(void)
278 {
279 	const struct cpuinit *c = platform_lookup(cputype);
280 
281 	printf("\n");
282 	printf("NetBSD does not yet support system type %d (%s).\n", cputype,
283 	    (c != NULL) ? c->option : "???");
284 	printf("\n");
285 	panic("platform not supported");
286 }
287