Home | History | Annotate | Line # | Download | only in alpha
cpuconf.c revision 1.27
      1 /* $NetBSD: cpuconf.c,v 1.27 2000/06/26 02:42:04 enami 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/param.h>
     70 #include <sys/device.h>
     71 #include <sys/systm.h>
     72 #include <machine/cpuconf.h>
     73 #include <machine/rpb.h>
     74 
     75 #include "opt_dec_3000_500.h"
     76 #ifdef DEC_3000_500
     77 extern void dec_3000_500_init __P((void));
     78 #else
     79 #define	dec_3000_500_init	platform_not_configured
     80 #endif
     81 
     82 #include "opt_dec_3000_300.h"
     83 #ifdef DEC_3000_300
     84 extern void dec_3000_300_init __P((void));
     85 #else
     86 #define	dec_3000_300_init	platform_not_configured
     87 #endif
     88 
     89 #include "opt_dec_axppci_33.h"
     90 #ifdef DEC_AXPPCI_33
     91 extern void dec_axppci_33_init __P((void));
     92 #else
     93 #define	dec_axppci_33_init	platform_not_configured
     94 #endif
     95 
     96 #include "opt_dec_kn8ae.h"
     97 #ifdef DEC_KN8AE
     98 extern void dec_kn8ae_init __P((void));
     99 #else
    100 #define	dec_kn8ae_init		platform_not_configured
    101 #endif
    102 
    103 #include "opt_dec_2100_a50.h"
    104 #ifdef DEC_2100_A50
    105 extern void dec_2100_a50_init __P((void));
    106 #else
    107 #define	dec_2100_a50_init	platform_not_configured
    108 #endif
    109 
    110 #include "opt_dec_kn20aa.h"
    111 #ifdef DEC_KN20AA
    112 extern void dec_kn20aa_init __P((void));
    113 #else
    114 #define	dec_kn20aa_init		platform_not_configured
    115 #endif
    116 
    117 #include "opt_dec_eb64plus.h"
    118 #ifdef DEC_EB64PLUS
    119 extern void dec_eb64plus_init __P((void));
    120 #else
    121 #define	dec_eb64plus_init	platform_not_configured
    122 #endif
    123 
    124 #include "opt_dec_eb164.h"
    125 #ifdef DEC_EB164
    126 extern void dec_eb164_init __P((void));
    127 #else
    128 #define	dec_eb164_init		platform_not_configured
    129 #endif
    130 
    131 #include "opt_avalon_a12.h"
    132 #ifdef AVALON_A12
    133 extern void avalon_a12_init __P((void));
    134 #else
    135 #define	avalon_a12_init		platform_not_configured
    136 #endif
    137 
    138 #include "opt_dec_kn300.h"
    139 #ifdef	DEC_KN300
    140 extern void dec_kn300_init __P((void));
    141 #else
    142 #define	dec_kn300_init		platform_not_configured
    143 #endif
    144 
    145 #include "opt_dec_550.h"
    146 #ifdef DEC_550
    147 extern void dec_550_init __P((void));
    148 #else
    149 #define	dec_550_init		platform_not_configured
    150 #endif
    151 
    152 #include "opt_dec_1000.h"
    153 #include "opt_dec_1000a.h"
    154 #if defined(DEC_1000) || defined(DEC_1000A)
    155 extern void _dec_1000a_init __P((void));
    156 #endif
    157 #ifdef DEC_1000A
    158 #define	dec_1000a_init		_dec_1000a_init
    159 #else
    160 #define	dec_1000a_init		platform_not_configured
    161 #endif
    162 #ifdef DEC_1000
    163 #define	dec_1000_init		_dec_1000a_init
    164 #else
    165 #define	dec_1000_init		platform_not_configured
    166 #endif
    167 
    168 #include "opt_dec_alphabook1.h"
    169 #ifdef DEC_ALPHABOOK1
    170 extern void dec_alphabook1_init __P((void));
    171 #else
    172 #define	dec_alphabook1_init	platform_not_configured
    173 #endif
    174 
    175 #include "opt_dec_eb66.h"
    176 #ifdef DEC_EB66
    177 extern void dec_eb66_init __P((void));
    178 #else
    179 #define	dec_eb66_init		platform_not_configured
    180 #endif
    181 
    182 #include "opt_dec_6600.h"
    183 #ifdef DEC_6600
    184 extern void dec_6600_init __P((void));
    185 #else
    186 #define	dec_6600_init		platform_not_configured
    187 #endif
    188 
    189 #include "opt_dec_2100_a500.h"
    190 #include "opt_dec_2100a_a500.h"
    191 #if defined(DEC_2100_A500) || defined(DEC_2100A_A500)
    192 extern void _dec_2100_a500_init __P((void));
    193 #endif
    194 #ifdef DEC_2100_A500
    195 #define	dec_2100_a500_init	_dec_2100_a500_init
    196 #else
    197 #define	dec_2100_a500_init	platform_not_configured
    198 #endif
    199 #ifdef DEC_2100A_A500
    200 #define	dec_2100a_a500_init	_dec_2100_a500_init
    201 #else
    202 #define	dec_2100a_a500_init	platform_not_configured
    203 #endif
    204 
    205 #include "opt_api_up1000.h"
    206 #ifdef API_UP1000
    207 extern void api_up1000_init __P((void));
    208 #else
    209 #define	api_up1000_init		platform_not_configured
    210 #endif
    211 
    212 #include "opt_dec_2000_300.h"
    213 #ifdef DEC_2000_300
    214 extern void dec_2000_300_init __P((void));
    215 #else
    216 #define	dec_2000_300_init	platform_not_configured
    217 #endif
    218 
    219 static const struct cpuinit cpuinit[] = {
    220 	cpu_notsupp(ST_ADU, "Alpha Demo Unit"),
    221 	cpu_notsupp(ST_DEC_4000, "DEC 4000 (``Cobra'')"),
    222 	cpu_notsupp(ST_DEC_7000, "DEC 7000 (``Ruby'')"),
    223 	cpu_init(ST_DEC_3000_500, dec_3000_500_init, "DEC_3000_500"),
    224 	cpu_init(ST_DEC_2000_300, dec_2000_300_init, "DEC_2000_300"),
    225 	cpu_init(ST_DEC_3000_300, dec_3000_300_init, "DEC_3000_300"),
    226 	cpu_init(ST_AVALON_A12, avalon_a12_init, "AVALON_A12"),
    227 	cpu_init(ST_DEC_2100_A500, dec_2100_a500_init, "DEC_2100_A500"),
    228 	cpu_notsupp(ST_DEC_APXVME_64, "AXPvme 64"),
    229 	cpu_init(ST_DEC_AXPPCI_33, dec_axppci_33_init, "DEC_AXPPCI_33"),
    230 	cpu_init(ST_DEC_21000, dec_kn8ae_init, "DEC_KN8AE"),
    231 	cpu_init(ST_DEC_2100_A50, dec_2100_a50_init, "DEC_2100_A50"),
    232 	cpu_notsupp(ST_DEC_MUSTANG, "Mustang"),
    233 	cpu_init(ST_DEC_KN20AA, dec_kn20aa_init, "DEC_KN20AA"),
    234 	cpu_init(ST_DEC_1000, dec_1000_init, "DEC_1000"),
    235 	cpu_init(ST_EB66, dec_eb66_init, "DEC_EB66"),
    236 	cpu_init(ST_EB64P, dec_eb64plus_init, "DEC_EB64PLUS"),
    237 	cpu_init(ST_ALPHABOOK1, dec_alphabook1_init, "DEC_ALPHABOOK1"),
    238 	cpu_init(ST_DEC_4100, dec_kn300_init, "DEC_KN300"),
    239 	cpu_notsupp(ST_DEC_EV45_PBP, "EV45 Passive Backplane Board"),
    240 	cpu_init(ST_DEC_2100A_A500, dec_2100a_a500_init, "DEC_2100A_A500"),
    241 	cpu_init(ST_EB164, dec_eb164_init, "DEC_EB164"),
    242 	cpu_init(ST_DEC_1000A, dec_1000a_init, "DEC_1000A"),
    243 	cpu_notsupp(ST_DEC_ALPHAVME_224, "AlphaVME 224"),
    244 	cpu_init(ST_DEC_550, dec_550_init, "DEC_550"),
    245 	cpu_notsupp(ST_DEC_EV56_PBP, "EV56 Passive Backplane Board"),
    246 	cpu_notsupp(ST_DEC_ALPHAVME_320, "AlphaVME 320"),
    247 	cpu_init(ST_DEC_6600, dec_6600_init, "DEC_6600"),
    248 	cpu_init(ST_API_NAUTILUS, api_up1000_init, "API_UP1000"),
    249 };
    250 static const int ncpuinit = (sizeof(cpuinit) / sizeof(cpuinit[0]));
    251 
    252 const struct cpuinit *
    253 platform_lookup(int systype)
    254 {
    255 	const struct cpuinit *c;
    256 	int i;
    257 
    258 	for (i = 0; i < ncpuinit; i++) {
    259 		c = &cpuinit[i];
    260 		if (c->systype == systype)
    261 			return (c);
    262 	}
    263 	return (NULL);
    264 }
    265 
    266 void
    267 platform_not_configured()
    268 {
    269 	const struct cpuinit *c = platform_lookup(cputype);
    270 
    271 	printf("\n");
    272 	printf("Support for system type %d is not present in this kernel.\n",
    273 	    cputype);
    274 	printf("Please build a kernel with \"options %s\" and reboot.\n",
    275 	    c->option);
    276 	printf("\n");
    277 	panic("platform not configured\n");
    278 }
    279 
    280 void
    281 platform_not_supported()
    282 {
    283 	const struct cpuinit *c = platform_lookup(cputype);
    284 
    285 	printf("\n");
    286 	printf("NetBSD does not yet support system type %d (%s).\n", cputype,
    287 	    (c != NULL) ? c->option : "???");
    288 	printf("\n");
    289 	panic("platform not supported");
    290 }
    291