diff --git a/sys/arch/prep/conf/files.prep b/sys/arch/prep/conf/files.prep index 0362dc18aac0..a6e9f755e1b0 100644 --- a/sys/arch/prep/conf/files.prep +++ b/sys/arch/prep/conf/files.prep @@ -1,4 +1,4 @@ -# $NetBSD: files.prep,v 1.26 2002/02/25 19:09:43 kleink Exp $ +# $NetBSD: files.prep,v 1.27 2002/02/26 16:09:14 kleink Exp $ # # prep-specific configuration info # @@ -11,6 +11,10 @@ file arch/prep/prep/ibm_machdep.c file arch/prep/prep/ibm_6050.c file arch/prep/prep/ibm_7248.c +# Motorola +file arch/prep/prep/mot_machdep.c +file arch/prep/prep/mot_ulmb60xa.c + file arch/prep/prep/platform.c file arch/prep/prep/autoconf.c diff --git a/sys/arch/prep/include/platform.h b/sys/arch/prep/include/platform.h index 2b43463e6173..d484b1fa9456 100644 --- a/sys/arch/prep/include/platform.h +++ b/sys/arch/prep/include/platform.h @@ -1,4 +1,4 @@ -/* $NetBSD: platform.h,v 1.2 2002/02/24 13:19:07 kleink Exp $ */ +/* $NetBSD: platform.h,v 1.3 2002/02/26 16:09:15 kleink Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -78,4 +78,11 @@ void reset_ibm_generic(void); void pci_intr_fixup_ibm_6050(int, int, int *); void pci_intr_fixup_ibm_7248(int, int, int *); +/* Motorola */ +extern struct plattab plattab_mot; + +extern struct platform platform_mot_ulmb60xa; + +void pci_intr_fixup_mot_ulmb60xa(int, int, int *); + #endif /* !_PREP_PLATFORM_H_ */ diff --git a/sys/arch/prep/prep/mot_machdep.c b/sys/arch/prep/prep/mot_machdep.c new file mode 100644 index 000000000000..28281039f656 --- /dev/null +++ b/sys/arch/prep/prep/mot_machdep.c @@ -0,0 +1,50 @@ +/* $NetBSD: mot_machdep.c,v 1.1 2002/02/26 16:09:15 kleink Exp $ */ + +/*- + * Copyright (c) 2002 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Klaus J. Klein. + * + * 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. + */ + +#include +#include + +#include + +static struct platform *platform_mot[] = { + &platform_mot_ulmb60xa +}; + +struct plattab plattab_mot = { + platform_mot, sizeof(platform_mot)/sizeof(platform_mot[0]) +}; diff --git a/sys/arch/prep/prep/mot_ulmb60xa.c b/sys/arch/prep/prep/mot_ulmb60xa.c new file mode 100644 index 000000000000..a73b5f668713 --- /dev/null +++ b/sys/arch/prep/prep/mot_ulmb60xa.c @@ -0,0 +1,127 @@ +/* $NetBSD: mot_ulmb60xa.c,v 1.1 2002/02/26 16:09:15 kleink Exp $ */ + +/*- + * Copyright (c) 2002 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Klaus J. Klein. + * + * 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. + */ + +#include +#include + +#include +#include +#include +#include + +/* + * CPU Type Register + * These definitions should eventually be moved to a separate header file. + */ +#define MOT_CPUTYPE_REG (PREP_BUS_SPACE_IO + 0x0800) + +/* Cache Size */ +#define MOT_CPUTYPE_CSIZE_SHIFT 0 +#define MOT_CPUTYPE_CSIZE_MASK 0x3 +#define MOT_CPUTYPE_CSIZE(ct) \ + (((ct) >> MOT_CPUTYPE_CSIZE_SHIFT) & MOT_CPUTYPE_CSIZE_MASK) + +#define MOT_CPUTYPE_CSIZE_512K 0 +#define MOT_CPUTYPE_CSIZE_256K 1 +#define MOT_CPUTYPE_CSIZE_RESERVED 2 +#define MOT_CPUTYPE_CSIZE_NONE 3 + +/* Board ID */ +#define MOT_CPUTYPE_BOARDID_SHIFT 4 +#define MOT_CPUTYPE_BOARDID_MASK 0xf +#define MOT_CPUTYPE_BOARDID(ct) \ + (((ct) >> MOT_CPUTYPE_BOARDID_SHIFT) & MOT_CPUTYPE_BOARDID_MASK) + +#define MOT_CPUTYPE_BOARDID_ULTRA 4 + + +static int mot_ulmb60xa_match(struct platform *); + +struct platform platform_mot_ulmb60xa = { + "BULL ESTRELLA (e0) (e0)", /* model */ /* XXX */ + mot_ulmb60xa_match, /* match */ + prep_pci_get_chipset_tag_indirect, /* pci_get_chipset_tag */ + pci_intr_fixup_mot_ulmb60xa, /* pci_intr_fixup */ + ext_intr_ivr, /* ext_intr */ + cpu_setup_unknown, /* cpu_setup */ + reset_ibm_generic, /* reset */ +}; + +static int +mot_ulmb60xa_match(struct platform *p) +{ + uint8_t cputype; + + if (p->model == NULL) + return 0; + if (strcmp(res->VitalProductData.PrintableModel, p->model) != 0) + return 0; + /* Should possibly match against the FirmwareSupplier as well. */ + cputype = *(volatile uint8_t *)MOT_CPUTYPE_REG; + __asm __volatile ("eieio; sync"); + if (MOT_CPUTYPE_BOARDID(cputype) != MOT_CPUTYPE_BOARDID_ULTRA) + return 0; + + return 1; +} + +void +pci_intr_fixup_mot_ulmb60xa(int bus, int dev, int *line) +{ + + if (bus != 0) + return; + + switch (dev) { + case 12: /* NCR 53c810 */ + *line = 11; + break; + case 14: /* DEC 21440 */ + *line = 9; + break; + case 16: /* Slot #1 */ + *line = 9; + break; + case 17: /* Slot #2 */ + *line = 9; + break; + case 18: /* Slot #3 */ + *line = 11; + break; + } +} diff --git a/sys/arch/prep/prep/platform.c b/sys/arch/prep/prep/platform.c index ec962e4c589b..ba06850fa554 100644 --- a/sys/arch/prep/prep/platform.c +++ b/sys/arch/prep/prep/platform.c @@ -1,4 +1,4 @@ -/* $NetBSD: platform.c,v 1.3 2002/02/24 13:19:09 kleink Exp $ */ +/* $NetBSD: platform.c,v 1.4 2002/02/26 16:09:15 kleink Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -71,8 +71,15 @@ ident_platform(void) if (res == NULL) return 0; - if (strncmp(res->VitalProductData.PrintableModel, "IBM", 3) == 0) + if (strncmp(res->VitalProductData.PrintableModel, + "IBM", 3) == 0) p = &plattab_ibm; + else if (strncmp(res->VitalProductData.PrintableModel, + "MOT", 3) == 0) + p = &plattab_mot; + else if (strncmp(res->VitalProductData.PrintableModel, + "BULL ESTRELLA (e0) (e0)", 31) == 0) /* XXX */ + p = &plattab_mot; else p = &plattab_unknown;