xref: /openbsd/sys/arch/alpha/alpha/cpuconf.c (revision ab6c3136)
1 /* $OpenBSD: cpuconf.c,v 1.14 2013/03/09 02:10:47 deraadt 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 DEC_ALPHABOOK1
144 extern void dec_alphabook1_init(void);
145 #else
146 #define	dec_alphabook1_init	platform_not_configured
147 #endif
148 
149 #ifdef API_UP1000
150 extern void api_up1000_init(void);
151 #else
152 #define	api_up1000_init		platform_not_configured
153 #endif
154 
155 static const struct cpuinit cpuinit[] = {
156 	cpu_notsupp(ST_ADU, "Alpha Demo Unit"),
157 	cpu_notsupp(ST_DEC_4000, "DEC 4000 (``Cobra'')"),
158 	cpu_notsupp(ST_DEC_7000, "DEC 7000 (``Ruby'')"),
159 	cpu_init(ST_DEC_3000_500, dec_3000_500_init, "DEC_3000_500"),
160 	cpu_notsupp(ST_DEC_2000_300, "DEC_2000_300"),
161 	cpu_init(ST_DEC_3000_300, dec_3000_300_init, "DEC_3000_300"),
162 	cpu_notsupp(ST_AVALON_A12, "AVALON_A12"),
163 	cpu_notsupp(ST_DEC_2100_A500, "DEC_2100_A500"),
164 	cpu_notsupp(ST_DEC_APXVME_64, "AXPvme 64"),
165 	cpu_init(ST_DEC_AXPPCI_33, dec_axppci_33_init, "DEC_AXPPCI_33"),
166 	cpu_notsupp(ST_DEC_21000, "DEC_KN8AE"),
167 	cpu_init(ST_DEC_2100_A50, dec_2100_a50_init, "DEC_2100_A50"),
168 	cpu_notsupp(ST_DEC_MUSTANG, "Mustang"),
169 	cpu_init(ST_DEC_KN20AA, dec_kn20aa_init, "DEC_KN20AA"),
170 	cpu_init(ST_DEC_1000, dec_1000_init, "DEC_1000"),
171 	cpu_notsupp(ST_EB66, "DEC_EB66"),
172 	cpu_init(ST_ALPHABOOK1, dec_alphabook1_init, "DEC_ALPHABOOK1"),
173 	cpu_init(ST_DEC_4100, dec_kn300_init, "DEC_KN300"),
174 	cpu_notsupp(ST_DEC_EV45_PBP, "EV45 Passive Backplane Board"),
175 	cpu_notsupp(ST_DEC_2100A_A500, "DEC_2100A_A500"),
176 	cpu_init(ST_EB164, dec_eb164_init, "DEC_EB164"),
177 	cpu_init(ST_DEC_1000A, dec_1000a_init, "DEC_1000A"),
178 	cpu_notsupp(ST_DEC_ALPHAVME_224, "AlphaVME 224"),
179 	cpu_init(ST_DEC_550, dec_550_init, "DEC_550"),
180 	cpu_notsupp(ST_DEC_EV56_PBP, "EV56 Passive Backplane Board"),
181 	cpu_notsupp(ST_DEC_ALPHAVME_320, "AlphaVME 320"),
182 	cpu_init(ST_DEC_6600, dec_6600_init, "DEC_6600"),
183 	cpu_init(ST_DEC_TITAN, dec_6600_init, "DEC_6600"),
184 	cpu_init(ST_API_NAUTILUS, api_up1000_init, "API_UP1000"),
185 };
186 static const int ncpuinit = (sizeof(cpuinit) / sizeof(cpuinit[0]));
187 
188 const struct cpuinit *
platform_lookup(int systype)189 platform_lookup(int systype)
190 {
191 	const struct cpuinit *c;
192 	int i;
193 
194 	for (i = 0; i < ncpuinit; i++) {
195 		c = &cpuinit[i];
196 		if (c->systype == systype)
197 			return (c);
198 	}
199 	return (NULL);
200 }
201 
202 void
platform_not_configured()203 platform_not_configured()
204 {
205 	const struct cpuinit *c = platform_lookup(cputype);
206 
207 	printf("\nSupport for system type %d is not present in this kernel.\n",
208 	    cputype);
209 	printf("Please build a kernel with \"options %s\" and reboot.\n",
210 	    c->option);
211 	panic("platform not configured");
212 }
213 
214 void
platform_not_supported()215 platform_not_supported()
216 {
217 	const struct cpuinit *c = platform_lookup(cputype);
218 
219 	printf("\nOpenBSD does not yet support system type %d (%s).\n", cputype,
220 	    (c != NULL) ? c->option : "???");
221 	panic("platform not supported");
222 }
223