Rearrange things a little so we can deal with systypes that aren't

densely packed.
This commit is contained in:
thorpej 2000-06-01 03:41:23 +00:00
parent 850f9b030b
commit 1cf70c169f
3 changed files with 106 additions and 56 deletions

View File

@ -1,4 +1,40 @@
/* $NetBSD: cpuconf.c,v 1.23 1999/12/07 21:51:53 thorpej Exp $ */
/* $NetBSD: cpuconf.c,v 1.24 2000/06/01 03:41:23 thorpej Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@ -149,54 +185,70 @@ extern void dec_2100_a500_init __P((void));
#define dec_2100_a500_init platform_not_configured
#endif
struct cpuinit cpuinit[] = {
cpu_notsupp("???"), /* 0: ??? */
cpu_notsupp("ST_ADU"), /* 1: ST_ADU */
cpu_notsupp("ST_DEC_4000"), /* 2: ST_DEC_4000 */
cpu_notsupp("ST_DEC_7000"), /* 3: ST_DEC_7000 */
cpu_init(dec_3000_500_init,"DEC_3000_500"), /* 4: ST_DEC_3000_500 */
cpu_notsupp("???"), /* 5: ??? */
cpu_notsupp("ST_DEC_2000_300"), /* 6: ST_DEC_2000_300 */
cpu_init(dec_3000_300_init,"DEC_3000_300"), /* 7: ST_DEC_3000_300 */
cpu_init(avalon_a12_init,"AVALON_A12"), /* 8: ST_AVALON_A12 */
cpu_init(dec_2100_a500_init,"DEC_2100_A500"),/* 9: ST_DEC_2100_A500 */
cpu_notsupp("ST_DEC_APXVME_64"), /* 10: ST_DEC_APXVME_64 */
cpu_init(dec_axppci_33_init,"DEC_AXPPCI_33"),/* 11: ST_DEC_AXPPCI_33 */
cpu_init(dec_kn8ae_init,"DEC_KN8AE"), /* 12: ST_DEC_21000 */
cpu_init(dec_2100_a50_init,"DEC_2100_A50"), /* 13: ST_DEC_2100_A50 */
cpu_notsupp("ST_DEC_MUSTANG"), /* 14: ST_DEC_MUSTANG */
cpu_init(dec_kn20aa_init,"DEC_KN20AA"), /* 15: ST_DEC_KN20AA */
cpu_notsupp("???"), /* 16: ??? */
cpu_init(dec_1000a_init,"DEC_1000"), /* 17: ST_DEC_1000 */
cpu_notsupp("???"), /* 18: ??? */
cpu_init(dec_eb66_init,"DEC_EB66"), /* 19: ST_EB66 */
cpu_init(dec_eb64plus_init,"DEC_EB64PLUS"), /* 20: ST_EB64P */
cpu_init(dec_alphabook1_init,"DEC_ALPHABOOK1"),/* 21: ST_ALPHABOOK1 */
cpu_init(dec_kn300_init,"DEC_KN300"), /* 22: ST_DEC_4100 */
cpu_notsupp("ST_DEC_EV45_PBP"), /* 23: ST_DEC_EV45_PBP */
cpu_notsupp("ST_DEC_2100A_A500"), /* 24: ST_DEC_2100A_A500 */
cpu_notsupp("???"), /* 25: ??? */
cpu_init(dec_eb164_init,"DEC_EB164"), /* 26: ST_EB164 */
cpu_init(dec_1000a_init, "DEC_1000A"), /* 27: ST_DEC_1000A */
cpu_notsupp("ST_DEC_ALPHAVME_224"), /* 28: ST_DEC_ALPHAVME_224 */
cpu_notsupp("???"), /* 29: ??? */
cpu_init(dec_550_init,"DEC_550"), /* 30: ST_DEC_550 */
cpu_notsupp("???"), /* 31: ??? */
cpu_notsupp("ST_DEC_EV56_PBP"), /* 32: ST_DEC_EV56_PBP */
cpu_notsupp("ST_DEC_ALPHAVME_320"), /* 33: ST_DEC_ALPHAVME_320 */
cpu_init(dec_6600_init,"DEC_6600"), /* 34: ST_6600 */
#include "opt_api_up1000.h"
#ifdef API_UP1000
extern void api_up1000_init __P((void));
#else
#define api_up1000_init platform_not_configured
#endif
static const struct cpuinit cpuinit[] = {
cpu_notsupp(ST_ADU, "Alpha Demo Unit"),
cpu_notsupp(ST_DEC_4000, "DEC 4000 (``Cobra'')"),
cpu_notsupp(ST_DEC_7000, "DEC 7000 (``Ruby'')"),
cpu_init(ST_DEC_3000_500, dec_3000_500_init, "DEC_3000_500"),
cpu_notsupp(ST_DEC_2000_300, "DEC 2000/300 (``Jensen'')"),
cpu_init(ST_DEC_3000_300, dec_3000_300_init, "DEC_3000_300"),
cpu_init(ST_AVALON_A12, avalon_a12_init, "AVALON_A12"),
cpu_init(ST_DEC_2100_A500, dec_2100_a500_init, "DEC_2100_A500"),
cpu_notsupp(ST_DEC_APXVME_64, "AXPvme 64"),
cpu_init(ST_DEC_AXPPCI_33, dec_axppci_33_init, "DEC_AXPPCI_33"),
cpu_init(ST_DEC_21000, dec_kn8ae_init, "DEC_KN8AE"),
cpu_init(ST_DEC_2100_A50, dec_2100_a50_init, "DEC_2100_A50"),
cpu_notsupp(ST_DEC_MUSTANG, "Mustang"),
cpu_init(ST_DEC_KN20AA, dec_kn20aa_init, "DEC_KN20AA"),
cpu_init(ST_DEC_1000, dec_1000a_init, "DEC_1000"),
cpu_init(ST_EB66, dec_eb66_init, "DEC_EB66"),
cpu_init(ST_EB64P, dec_eb64plus_init, "DEC_EB64PLUS"),
cpu_init(ST_ALPHABOOK1, dec_alphabook1_init, "DEC_ALPHABOOK1"),
cpu_init(ST_DEC_4100, dec_kn300_init, "DEC_KN300"),
cpu_notsupp(ST_DEC_EV45_PBP, "EV45 Passive Backplane Board"),
cpu_notsupp(ST_DEC_2100A_A500, "DEC 2100A/A500 (``Lynx'')"),
cpu_init(ST_EB164, dec_eb164_init, "DEC_EB164"),
cpu_init(ST_DEC_1000A, dec_1000a_init, "DEC_1000A"),
cpu_notsupp(ST_DEC_ALPHAVME_224, "AlphaVME 224"),
cpu_init(ST_DEC_550, dec_550_init, "DEC_550"),
cpu_notsupp(ST_DEC_EV56_PBP, "EV56 Passive Backplane Board"),
cpu_notsupp(ST_DEC_ALPHAVME_320, "AlphaVME 320"),
cpu_init(ST_DEC_6600, dec_6600_init, "DEC_6600"),
cpu_init(ST_API_NAUTILUS, api_up1000_init, "API_UP1000"),
};
int ncpuinit = (sizeof(cpuinit) / sizeof(cpuinit[0]));
static const int ncpuinit = (sizeof(cpuinit) / sizeof(cpuinit[0]));
const struct cpuinit *
platform_lookup(int systype)
{
const struct cpuinit *c;
int i;
for (i = 0; i < ncpuinit; i++) {
c = &cpuinit[i];
if (c->systype == systype)
return (c);
}
return (NULL);
}
void
platform_not_configured()
{
const struct cpuinit *c = platform_lookup(cputype);
printf("\n");
printf("Support for system type %d is not present in this kernel.\n",
cputype);
printf("Please build a kernel with \"options %s\" and reboot.\n",
cpuinit[cputype].option);
c->option);
printf("\n");
panic("platform not configured\n");
}
@ -204,16 +256,11 @@ platform_not_configured()
void
platform_not_supported()
{
const char *typestr;
if (cputype >= ncpuinit)
typestr = "???";
else
typestr = cpuinit[cputype].option;
const struct cpuinit *c = platform_lookup(cputype);
printf("\n");
printf("NetBSD does not yet support system type %d (%s).\n", cputype,
typestr);
(c != NULL) ? c->option : "???");
printf("\n");
panic("platform not supported");
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.208 2000/05/31 05:14:29 thorpej Exp $ */
/* $NetBSD: machdep.c,v 1.209 2000/06/01 03:41:23 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@ -79,7 +79,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.208 2000/05/31 05:14:29 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.209 2000/06/01 03:41:23 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -275,7 +275,8 @@ alpha_init(pfn, ptb, bim, bip, biv)
vsize_t size;
char *p;
caddr_t v;
char *bootinfo_msg;
const char *bootinfo_msg;
const struct cpuinit *c;
/* NO OUTPUT ALLOWED UNTIL FURTHER NOTICE */
@ -407,11 +408,12 @@ nobootinfo:
*/
cputype = -cputype;
}
if (cputype >= ncpuinit) {
c = platform_lookup(cputype);
if (c == NULL) {
platform_not_supported();
/* NOTREACHED */
}
(*cpuinit[cputype].init)();
(*c->init)();
strcpy(cpu_model, platform.model);
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpuconf.h,v 1.9 2000/03/29 02:59:18 simonb Exp $ */
/* $NetBSD: cpuconf.h,v 1.10 2000/06/01 03:41:24 thorpej Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@ -88,16 +88,17 @@ struct platform {
struct cpuinit {
void (*init) __P((void));
u_int64_t systype;
const char *option;
};
#ifdef _KERNEL
#define cpu_notsupp(st) { platform_not_supported, st }
#define cpu_init(fn, opt) { fn, opt }
#define cpu_notsupp(st, str) { platform_not_supported, st, str }
#define cpu_init(st, fn, opt) { fn, st, opt }
extern struct platform platform;
extern struct cpuinit cpuinit[];
extern int ncpuinit;
extern const struct cpuinit *platform_lookup __P((int));
extern void platform_not_configured __P((void));
extern void platform_not_supported __P((void));
#endif /* _KERNEL */