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.
This commit is contained in:
sato 2001-04-18 10:42:39 +00:00
parent 8a404fdd81
commit 9d92917cd6
6 changed files with 222 additions and 45 deletions

View File

@ -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 <sys/cdefs.h> /* 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 <sys/param.h>
#include <sys/kernel.h>
@ -55,6 +85,8 @@ __KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.10 2001/01/15 15:36:38 sato Exp $");
#include <dev/clock_subr.h>
#include <machine/clock_machdep.h>
#include <machine/platid.h>
#include <machine/platid_mask.h>
#include <dev/dec/clockvar.h>
#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.

View File

@ -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 <machine/platid_mask.h>
#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
}

View File

@ -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 <sys/cdefs.h> /* 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 <machine/sysconf.h>
#include <machine/bootinfo.h>
#include <machine/platid.h>
#include <machine/platid_mask.h>
#include <machine/locore.h>
#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)

View File

@ -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 <machine/bus.h>
#include <machine/autoconf.h>
#include <machine/platid.h>
#include <machine/platid_mask.h>
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++) {

View File

@ -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 <machine/bus.h>
#include <machine/autoconf.h>
#include <machine/platid.h>
#include <machine/platid_mask.h>
#include <hpcmips/tx/tx39var.h>
#include <hpcmips/tx/txsnd.h>
@ -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;

View File

@ -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 <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
@ -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;