From 9d92917cd6b582a10faa6481ff4e952942b1c4e5 Mon Sep 17 00:00:00 2001 From: sato Date: Wed, 18 Apr 2001 10:42:39 +0000 Subject: [PATCH] check platid if 'options VR41XX' and 'options TX39XX' are both defined. XXX: currently this case is missconfiguration and not compilable. XXX: because all codes are not supported this case yet. --- sys/arch/hpcmips/hpcmips/clock.c | 66 ++++++++++++++++---- sys/arch/hpcmips/hpcmips/cpu.c | 45 +++++++++++++- sys/arch/hpcmips/hpcmips/machdep.c | 96 +++++++++++++++++++++++------- sys/arch/hpcmips/hpcmips/mainbus.c | 38 +++++++++--- sys/arch/hpcmips/tx/txsim.c | 11 +++- sys/arch/hpcmips/vr/vrip.c | 11 +++- 6 files changed, 222 insertions(+), 45 deletions(-) diff --git a/sys/arch/hpcmips/hpcmips/clock.c b/sys/arch/hpcmips/hpcmips/clock.c index c0dbd61bf46a..1c0393998b3e 100644 --- a/sys/arch/hpcmips/hpcmips/clock.c +++ b/sys/arch/hpcmips/hpcmips/clock.c @@ -1,4 +1,33 @@ -/* $NetBSD: clock.c,v 1.10 2001/01/15 15:36:38 sato Exp $ */ +/* $NetBSD: clock.c,v 1.11 2001/04/18 10:42:39 sato Exp $ */ + +/*- + * Copyright (c) 1999 Shin Takemura, All rights reserved. + * Copyright (c) 1999-2001 SATO Kazumi, All rights reserved. + * + * 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. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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) 1988 University of Utah. @@ -41,11 +70,12 @@ * * @(#)clock.c 8.1 (Berkeley) 6/10/93 */ +#include "opt_vr41xx.h" #include "opt_tx39xx.h" #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.10 2001/01/15 15:36:38 sato Exp $"); +__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.11 2001/04/18 10:42:39 sato Exp $"); #include #include @@ -55,6 +85,8 @@ __KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.10 2001/01/15 15:36:38 sato Exp $"); #include #include +#include +#include #include #define MINYEAR 2001 /* "today" */ @@ -107,17 +139,27 @@ cpu_initclocks() { if (clockfns == NULL) panic("cpu_initclocks: no clock attached"); -#ifndef TX39XX /* TX3912/22 periodic timer is not CLOCK_RATE, it is 100Hz */ - hz = CLOCK_RATE; /* 128 Hz clock */ - tick = 1000000 / hz; /* number of microseconds between interrupts */ - tickfix = 1000000 - (hz * tick); - if (tickfix) { - int ftp; + /* + * VR41XX clock is not 100Hz but CLOCK_RATE, + * TX3912/22 periodic timer is not CLOCK_RATE, it is 100Hz by default. + */ +#if defined VR41XX +#if defined TX39XX + if (platid_match(&platid, &platid_mask_CPU_MIPS_VR_41XX)) +#endif /* defined TX39XX */ + { + hz = CLOCK_RATE; /* 128 Hz clock */ + tick = 1000000 / hz; + /* number of microseconds between interrupts */ + tickfix = 1000000 - (hz * tick); + if (tickfix) { + int ftp; - ftp = min(ffs(tickfix), ffs(hz)); - tickfix >>= (ftp - 1); - tickfixinterval = hz >> (ftp - 1); - } + ftp = min(ffs(tickfix), ffs(hz)); + tickfix >>= (ftp - 1); + tickfixinterval = hz >> (ftp - 1); + } + } #endif /* !TX39XX */ /* * Get the clock started. diff --git a/sys/arch/hpcmips/hpcmips/cpu.c b/sys/arch/hpcmips/hpcmips/cpu.c index 4f1f591fde9a..728ef24c318a 100644 --- a/sys/arch/hpcmips/hpcmips/cpu.c +++ b/sys/arch/hpcmips/hpcmips/cpu.c @@ -1,4 +1,32 @@ -/* $NetBSD: cpu.c,v 1.6 2001/04/11 08:23:27 sato Exp $ */ +/* $NetBSD: cpu.c,v 1.7 2001/04/18 10:42:39 sato Exp $ */ +/*- + * Copyright (c) 1999 Shin Takemura, All rights reserved. + * Copyright (c) 1999-2001 SATO Kazumi, All rights reserved. + * + * 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. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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) 1994, 1995 Carnegie-Mellon University. @@ -39,6 +67,7 @@ #include #include "opt_vr41xx.h" +#include "opt_tx39xx.h" /* Definition of the driver for autoconfig. */ static int cpumatch(struct device *, struct cfdata *, void *); @@ -82,9 +111,21 @@ cpuattach(parent, dev, aux) cpu_identify(); #ifdef VR41XX - if (platid_match(&platid, &platid_mask_CPU_MIPS_VR_41XX)) { +#ifdef TX39XX + if (platid_match(&platid, &platid_mask_CPU_MIPS_VR_41XX)) +#endif /* TX39XX */ + { printf("cpu0: install VR specific idle routine\n"); CPU_IDLE = (long *)vr_idle; } #endif +#ifdef TX39XX +#ifdef VR41XX + if (platid_match(&platid, &platid_mask_CPU_MIPS_TX_3900) + || platid_match(&platid, &platid_mask_CPU_MIPS_TX_3920)) +#endif /* VR41XX */ + { + ; /* XXXX: currenty not implemented */ + } +#endif } diff --git a/sys/arch/hpcmips/hpcmips/machdep.c b/sys/arch/hpcmips/hpcmips/machdep.c index 658edf482902..91122ab97b41 100644 --- a/sys/arch/hpcmips/hpcmips/machdep.c +++ b/sys/arch/hpcmips/hpcmips/machdep.c @@ -1,4 +1,33 @@ -/* $NetBSD: machdep.c,v 1.46 2001/04/11 08:23:27 sato Exp $ */ +/* $NetBSD: machdep.c,v 1.47 2001/04/18 10:42:39 sato Exp $ */ + +/*- + * Copyright (c) 1999 Shin Takemura, All rights reserved. + * Copyright (c) 1999-2001 SATO Kazumi, All rights reserved. + * + * 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. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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) 1988 University of Utah. @@ -43,7 +72,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.46 2001/04/11 08:23:27 sato Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.47 2001/04/18 10:42:39 sato Exp $"); /* from: Utah Hdr: machdep.c 1.63 91/04/24 */ #include "opt_vr41xx.h" @@ -94,6 +123,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.46 2001/04/11 08:23:27 sato Exp $"); #include #include #include +#include #include #ifdef DDB @@ -271,19 +301,35 @@ mach_init(argc, argv, bi) platid.dw.dw1 = bootinfo->platid_machine; } } - /* Platform Specific Function Hooks */ #if defined TX39XX && defined VR41XX +/* XXX: currently, the case defined TX39XX && defined VR41XX don't work */ #error misconfiguration -#elif defined TX39XX - tx_init(); -#elif defined VR41XX - vr_init(); +#endif /* defined TX39XX && defined VR41XX */ + + /* Platform Specific Function Hooks */ +#ifdef VR41XX +#ifdef TX39XX + if (platid_match(&platid, &platid_mask_CPU_MIPS_VR_41XX)) +#endif /* TX39XX */ + { + vr_init(); #if NBICONSDEV > 0 /* bicons don't need actual device initialize. only bootinfo needed. */ - cn_tab = &bicons; - bicons_init(&bicons); -#endif + cn_tab = &bicons; + bicons_init(&bicons); #endif + } +#endif /* VR41XX */ +#ifdef TX39XX +#ifdef VR41XX + if (platid_match(&platid, &platid_mask_CPU_MIPS_TX_3900) + || platid_match(&platid, &platid_mask_CPU_MIPS_TX_3920)) +#endif /* VR41XX */ + { + tx_init(); + } +#endif /* TX39XX */ + /* Initialize frame buffer (to steal DMA buffer, stay here.) */ (*platform.fb_init)(&kernend); kernend = (caddr_t)mips_round_page(kernend); @@ -743,7 +789,10 @@ cpu_intr(status, cause, pc, ipending) uvmexp.intrs++; #ifdef VR41XX - if (ipending & MIPS_INT_MASK_5) { +#ifdef TX39XX + if (CPUISMIPS3) +#endif /* TX39XX */ + if (ipending & MIPS_INT_MASK_5){ /* * Writing a value to the Compare register, * as a side effect, clears the timer interrupt request. @@ -753,15 +802,22 @@ cpu_intr(status, cause, pc, ipending) #endif /* device interrupts */ -#ifdef ENABLE_MIPS_TX3900 - if (ipending & MIPS_HARD_INT_MASK) { - _splset((*platform.iointr)(status, cause, pc, ipending)); - } -#else - if (ipending & MIPS3_HARD_INT_MASK) { - _splset((*platform.iointr)(status, cause, pc, ipending)); - } -#endif +#if defined(VR41XX) +#if defined(TX39XX) + if (CPUISMIPS3) +#endif /* TX39XX */ + if (ipending & MIPS3_HARD_INT_MASK) { + _splset((*platform.iointr)(status, cause, pc, ipending)); + } +#endif /* VR41XX */ +#if defined(TX39XX) +#if defined(VR41XX) + if (CPUISMIPS1) +#endif /* VR41XX */ + if (ipending & MIPS_HARD_INT_MASK) { + _splset((*platform.iointr)(status, cause, pc, ipending)); + } +#endif /* TX39XX */ /* software simulated interrupt */ if ((ipending & MIPS_SOFT_INT_MASK_1) diff --git a/sys/arch/hpcmips/hpcmips/mainbus.c b/sys/arch/hpcmips/hpcmips/mainbus.c index 75bc15b353d3..8bfbc45aaa73 100644 --- a/sys/arch/hpcmips/hpcmips/mainbus.c +++ b/sys/arch/hpcmips/hpcmips/mainbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: mainbus.c,v 1.9 2001/04/11 08:23:27 sato Exp $ */ +/* $NetBSD: mainbus.c,v 1.10 2001/04/18 10:42:39 sato Exp $ */ /*- * Copyright (c) 1999 @@ -43,6 +43,8 @@ #include #include +#include +#include struct mainbus_softc { struct device sc_dv; @@ -115,14 +117,34 @@ mbattach(parent, self, aux) ma.ma_name = "cpu"; config_found(mb, &ma, mbprint); -#if defined VR41XX && defined TX39XX + +#if defined TX39XX && defined VR41XX +/* XXX: currently, the case defined TX39XX && defined VR41XX don't work */ #error misconfiguration -#elif defined VR41XX - if (!system_bus_iot) - mb_bus_space_init(); - hpcmips_init_bus_space_extent(system_bus_iot); /* Now prepare extent */ - ma.ma_iot = system_bus_iot; -#endif +#endif /* defined TX39XX && defined VR41XX */ + + /* Platform Specific Function Hooks */ +#ifdef VR41XX +#ifdef TX39XX + if (platid_match(&platid, &platid_mask_CPU_MIPS_VR_41XX)) +#endif /* TX39XX */ + { + if (!system_bus_iot) + mb_bus_space_init(); + /* Now prepare extent */ + hpcmips_init_bus_space_extent(system_bus_iot); + ma.ma_iot = system_bus_iot; + } +#endif /* VR41XX */ +#ifdef TX39XX +#ifdef VR41XX + if (platid_match(&platid, &platid_mask_CPU_MIPS_TX_3900) + || platid_match(&platid, &platid_mask_CPU_MIPS_TX_3920)) +#endif /* VR41XX */ + { + ; /* do nothing.. */ + } +#endif /* TX39XX */ /* Attach devices */ for (i = 0; i < sizeof(devnames)/sizeof(*devnames); i++) { diff --git a/sys/arch/hpcmips/tx/txsim.c b/sys/arch/hpcmips/tx/txsim.c index 7d4b8b043215..2015a7f027ef 100644 --- a/sys/arch/hpcmips/tx/txsim.c +++ b/sys/arch/hpcmips/tx/txsim.c @@ -1,4 +1,4 @@ -/* $NetBSD: txsim.c,v 1.3 2000/10/22 10:42:33 uch Exp $ */ +/* $NetBSD: txsim.c,v 1.4 2001/04/18 10:42:39 sato Exp $ */ /*- * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. @@ -36,6 +36,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include "opt_vr41xx.h" +#include "opt_tx39xx.h" /* * TX System Internal Module. */ @@ -47,6 +49,8 @@ #include #include +#include +#include #include #include @@ -70,6 +74,11 @@ txsim_match(struct device *parent, struct cfdata *match, void *aux) { struct mainbus_attach_args *ma = aux; +#ifdef VR41XX + if (!platid_match(&platid, &platid_mask_CPU_MIPS_TX_3900) + && !platid_match(&platid, &platid_mask_CPU_MIPS_TX_3920)) + return 1; +#endif /* !TX39XX */ if (strcmp(ma->ma_name, match->cf_driver->cd_name)) return 0; return 1; diff --git a/sys/arch/hpcmips/vr/vrip.c b/sys/arch/hpcmips/vr/vrip.c index f6ce3ee61a5b..8ad76bd0f866 100644 --- a/sys/arch/hpcmips/vr/vrip.c +++ b/sys/arch/hpcmips/vr/vrip.c @@ -1,4 +1,4 @@ -/* $NetBSD: vrip.c,v 1.6 2000/03/10 09:18:00 sato Exp $ */ +/* $NetBSD: vrip.c,v 1.7 2001/04/18 10:46:00 sato Exp $ */ /*- * Copyright (c) 1999 @@ -33,6 +33,9 @@ * SUCH DAMAGE. * */ +#include "opt_vr41xx.h" +#include "opt_tx39xx.h" + #include #include #include @@ -134,7 +137,11 @@ vripmatch(parent, match, aux) void *aux; { struct mainbus_attach_args *ma = aux; - + +#ifdef TX39XX + if (!platid_match(&platid, &platid_mask_CPU_MIPS_VR_41XX)) + return 1; +#endif /* !TX39XX */ if (strcmp(ma->ma_name, match->cf_driver->cd_name)) return 0; return 1;