Home | History | Annotate | Line # | Download | only in alpha
cpuconf.c revision 1.24
      1 /* $NetBSD: cpuconf.c,v 1.24 2000/06/01 03:41:23 thorpej 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 #else
    157 #define	dec_1000a_init		platform_not_configured
    158 #endif
    159 
    160 #include "opt_dec_alphabook1.h"
    161 #ifdef DEC_ALPHABOOK1
    162 extern void dec_alphabook1_init __P((void));
    163 #else
    164 #define	dec_alphabook1_init	platform_not_configured
    165 #endif
    166 
    167 #include "opt_dec_eb66.h"
    168 #ifdef DEC_EB66
    169 extern void dec_eb66_init __P((void));
    170 #else
    171 #define	dec_eb66_init		platform_not_configured
    172 #endif
    173 
    174 #include "opt_dec_6600.h"
    175 #ifdef DEC_6600
    176 extern void dec_6600_init __P((void));
    177 #else
    178 #define	dec_6600_init		platform_not_configured
    179 #endif
    180 
    181 #include "opt_dec_2100_a500.h"
    182 #ifdef DEC_2100_A500
    183 extern void dec_2100_a500_init __P((void));
    184 #else
    185 #define	dec_2100_a500_init	platform_not_configured
    186 #endif
    187 
    188 #include "opt_api_up1000.h"
    189 #ifdef API_UP1000
    190 extern void api_up1000_init __P((void));
    191 #else
    192 #define	api_up1000_init		platform_not_configured
    193 #endif
    194 
    195 static const struct cpuinit cpuinit[] = {
    196 	cpu_notsupp(ST_ADU, "Alpha Demo Unit"),
    197 	cpu_notsupp(ST_DEC_4000, "DEC 4000 (``Cobra'')"),
    198 	cpu_notsupp(ST_DEC_7000, "DEC 7000 (``Ruby'')"),
    199 	cpu_init(ST_DEC_3000_500, dec_3000_500_init, "DEC_3000_500"),
    200 	cpu_notsupp(ST_DEC_2000_300, "DEC 2000/300 (``Jensen'')"),
    201 	cpu_init(ST_DEC_3000_300, dec_3000_300_init, "DEC_3000_300"),
    202 	cpu_init(ST_AVALON_A12, avalon_a12_init, "AVALON_A12"),
    203 	cpu_init(ST_DEC_2100_A500, dec_2100_a500_init, "DEC_2100_A500"),
    204 	cpu_notsupp(ST_DEC_APXVME_64, "AXPvme 64"),
    205 	cpu_init(ST_DEC_AXPPCI_33, dec_axppci_33_init, "DEC_AXPPCI_33"),
    206 	cpu_init(ST_DEC_21000, dec_kn8ae_init, "DEC_KN8AE"),
    207 	cpu_init(ST_DEC_2100_A50, dec_2100_a50_init, "DEC_2100_A50"),
    208 	cpu_notsupp(ST_DEC_MUSTANG, "Mustang"),
    209 	cpu_init(ST_DEC_KN20AA, dec_kn20aa_init, "DEC_KN20AA"),
    210 	cpu_init(ST_DEC_1000, dec_1000a_init, "DEC_1000"),
    211 	cpu_init(ST_EB66, dec_eb66_init, "DEC_EB66"),
    212 	cpu_init(ST_EB64P, dec_eb64plus_init, "DEC_EB64PLUS"),
    213 	cpu_init(ST_ALPHABOOK1, dec_alphabook1_init, "DEC_ALPHABOOK1"),
    214 	cpu_init(ST_DEC_4100, dec_kn300_init, "DEC_KN300"),
    215 	cpu_notsupp(ST_DEC_EV45_PBP, "EV45 Passive Backplane Board"),
    216 	cpu_notsupp(ST_DEC_2100A_A500, "DEC 2100A/A500 (``Lynx'')"),
    217 	cpu_init(ST_EB164, dec_eb164_init, "DEC_EB164"),
    218 	cpu_init(ST_DEC_1000A, dec_1000a_init, "DEC_1000A"),
    219 	cpu_notsupp(ST_DEC_ALPHAVME_224, "AlphaVME 224"),
    220 	cpu_init(ST_DEC_550, dec_550_init, "DEC_550"),
    221 	cpu_notsupp(ST_DEC_EV56_PBP, "EV56 Passive Backplane Board"),
    222 	cpu_notsupp(ST_DEC_ALPHAVME_320, "AlphaVME 320"),
    223 	cpu_init(ST_DEC_6600, dec_6600_init, "DEC_6600"),
    224 	cpu_init(ST_API_NAUTILUS, api_up1000_init, "API_UP1000"),
    225 };
    226 static const int ncpuinit = (sizeof(cpuinit) / sizeof(cpuinit[0]));
    227 
    228 const struct cpuinit *
    229 platform_lookup(int systype)
    230 {
    231 	const struct cpuinit *c;
    232 	int i;
    233 
    234 	for (i = 0; i < ncpuinit; i++) {
    235 		c = &cpuinit[i];
    236 		if (c->systype == systype)
    237 			return (c);
    238 	}
    239 	return (NULL);
    240 }
    241 
    242 void
    243 platform_not_configured()
    244 {
    245 	const struct cpuinit *c = platform_lookup(cputype);
    246 
    247 	printf("\n");
    248 	printf("Support for system type %d is not present in this kernel.\n",
    249 	    cputype);
    250 	printf("Please build a kernel with \"options %s\" and reboot.\n",
    251 	    c->option);
    252 	printf("\n");
    253 	panic("platform not configured\n");
    254 }
    255 
    256 void
    257 platform_not_supported()
    258 {
    259 	const struct cpuinit *c = platform_lookup(cputype);
    260 
    261 	printf("\n");
    262 	printf("NetBSD does not yet support system type %d (%s).\n", cputype,
    263 	    (c != NULL) ? c->option : "???");
    264 	printf("\n");
    265 	panic("platform not supported");
    266 }
    267