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