Home | History | Annotate | Line # | Download | only in alpha
      1 /* $NetBSD: cpuconf.c,v 1.38 2024/03/02 20:15:33 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  *
     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.38 2024/03/02 20:15:33 thorpej 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_kn7aa.h"
     72 #ifdef DEC_KN7AA
     73 extern void dec_kn7aa_init(void);
     74 #else
     75 #define	dec_kn7aa_init		platform_not_configured
     76 #endif
     77 
     78 #include "opt_dec_3000_500.h"
     79 #ifdef DEC_3000_500
     80 extern void dec_3000_500_init(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(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(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(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(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(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(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(void);
    130 #else
    131 #define	dec_eb164_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_init(ST_DEC_7000, dec_kn7aa_init, "DEC_KN7AA"),
    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_DEC_2100_A500, dec_2100_a500_init, "DEC_2100_A500"),
    223 	cpu_notsupp(ST_DEC_APXVME_64, "AXPvme 64"),
    224 	cpu_init(ST_DEC_AXPPCI_33, dec_axppci_33_init, "DEC_AXPPCI_33"),
    225 	cpu_init(ST_DEC_21000, dec_kn8ae_init, "DEC_KN8AE"),
    226 	cpu_init(ST_DEC_2100_A50, dec_2100_a50_init, "DEC_2100_A50"),
    227 	cpu_notsupp(ST_DEC_MUSTANG, "Mustang"),
    228 	cpu_init(ST_DEC_KN20AA, dec_kn20aa_init, "DEC_KN20AA"),
    229 	cpu_init(ST_DEC_1000, dec_1000_init, "DEC_1000"),
    230 	cpu_init(ST_EB66, dec_eb66_init, "DEC_EB66"),
    231 	cpu_init(ST_EB64P, dec_eb64plus_init, "DEC_EB64PLUS"),
    232 	cpu_init(ST_ALPHABOOK1, dec_alphabook1_init, "DEC_ALPHABOOK1"),
    233 	cpu_init(ST_DEC_4100, dec_kn300_init, "DEC_KN300"),
    234 	cpu_notsupp(ST_DEC_EV45_PBP, "EV45 Passive Backplane Board"),
    235 	cpu_init(ST_DEC_2100A_A500, dec_2100a_a500_init, "DEC_2100A_A500"),
    236 	cpu_notsupp(ST_DEC_XL, "Alpha XL"),
    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_XXM, "DEC XXM"),
    242 	cpu_notsupp(ST_DEC_EV56_PBP, "EV56 Passive Backplane Board"),
    243 	cpu_notsupp(ST_DEC_ALPHAVME_320, "AlphaVME 320"),
    244 	cpu_init(ST_DEC_6600, dec_6600_init, "DEC_6600"),
    245 	cpu_init(ST_DEC_TITAN, dec_6600_init, "DEC_6600"),
    246 	cpu_notsupp(ST_DEC_MARVEL, "DEC_MARVEL"),
    247 	cpu_notsupp(ST_DTI_RUFFIAN, "DTI_RUFFIAN"),
    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(void)
    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");
    278 }
    279 
    280 void
    281 platform_not_supported(void)
    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