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