diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2009-02-13 23:26:52 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2009-02-13 23:26:52 +0000 |
commit | 0e9edb216685cbf5eba5234091b3f1f98ce35e1f (patch) | |
tree | a59bced359be87cd0e0197558c2f161c70107c46 /sys/arch | |
parent | 317974af3cafc2bb6357243f7729e7de1e28cbed (diff) |
Make delay() a per-board function pointer.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/mvme88k/conf/files.mvme88k | 3 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/cpu.h | 3 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/clock.c | 121 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/clockvar.h | 4 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/m187_machdep.c | 3 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/m188_machdep.c | 3 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/m197_machdep.c | 3 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/m1x7_machdep.c | 19 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/machdep.c | 31 |
9 files changed, 60 insertions, 130 deletions
diff --git a/sys/arch/mvme88k/conf/files.mvme88k b/sys/arch/mvme88k/conf/files.mvme88k index 26a76100559..fa24f6fef6f 100644 --- a/sys/arch/mvme88k/conf/files.mvme88k +++ b/sys/arch/mvme88k/conf/files.mvme88k @@ -1,4 +1,4 @@ -# $OpenBSD: files.mvme88k,v 1.42 2009/02/12 22:03:46 miod Exp $ +# $OpenBSD: files.mvme88k,v 1.43 2009/02/13 23:26:50 miod Exp $ # maxpartitions 16 @@ -63,7 +63,6 @@ file dev/cninit.c file arch/mvme88k/mvme88k/autoconf.c file arch/mvme88k/mvme88k/bus_dma.c -file arch/mvme88k/mvme88k/clock.c file arch/mvme88k/mvme88k/conf.c file arch/mvme88k/mvme88k/db_machdep.c ddb file arch/mvme88k/mvme88k/disksubr.c diff --git a/sys/arch/mvme88k/include/cpu.h b/sys/arch/mvme88k/include/cpu.h index 72dc6bb1a64..a1c53d3aa8d 100644 --- a/sys/arch/mvme88k/include/cpu.h +++ b/sys/arch/mvme88k/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.37 2007/05/14 17:00:40 miod Exp $ */ +/* $OpenBSD: cpu.h,v 1.38 2009/02/13 23:26:51 miod Exp $ */ /* * Copyright (c) 1996 Nivas Madhur * Copyright (c) 1992, 1993 @@ -53,6 +53,7 @@ extern u_int (*md_setipl)(u_int); extern u_int (*md_raiseipl)(u_int); extern void (*md_init_clocks)(void); extern void (*md_send_ipi)(int, cpuid_t); +extern void (*md_delay)(int); struct intrhand { SLIST_ENTRY(intrhand) ih_link; diff --git a/sys/arch/mvme88k/mvme88k/clock.c b/sys/arch/mvme88k/mvme88k/clock.c deleted file mode 100644 index 2137648cace..00000000000 --- a/sys/arch/mvme88k/mvme88k/clock.c +++ /dev/null @@ -1,121 +0,0 @@ -/* $OpenBSD: clock.c,v 1.3 2006/04/19 22:09:40 miod Exp $ */ -/* - * Copyright (c) 1999 Steve Murphree, Jr. - * Copyright (c) 1995 Theo de Raadt - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * Copyright (c) 1995 Nivas Madhur - * Copyright (c) 1994 Gordon W. Ross - * Copyright (c) 1993 Adam Glass - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Lawrence Berkeley Laboratory. - * - * 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. Neither the name of the University 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 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. - * - * @(#)clock.c 8.1 (Berkeley) 6/11/93 - */ - -/* - * Interval and statistic clocks driver. - */ - -#include <sys/param.h> -#include <sys/kernel.h> -#include <sys/device.h> -#include <sys/systm.h> - -#include <machine/autoconf.h> -#include <machine/bus.h> - -#include <mvme88k/mvme88k/clockvar.h> -#include <mvme88k/dev/vme.h> - -struct intrhand clock_ih; -struct intrhand statclock_ih; - -/* - * Statistics clock interval and variance, in usec. Variance must be a - * power of two. Since this gives us an even number, not an odd number, - * we discard one case and compensate. That is, a variance of 4096 would - * give us offsets in [0..4095]. Instead, we take offsets in [1..4095]. - * This is symmetric about the point 2048, or statvar/2, and thus averages - * to that value (assuming uniform random numbers). - */ -int statvar = 8192; -int statmin; /* statclock interval - 1/2*variance */ - -void -delay(int us) -{ - if (brdtyp == BRD_188) { - extern void m188_delay(int); - - m188_delay(us); - } else { - /* - * On MVME187 and MVME197, use the VMEchip for the - * delay clock. - */ - *(volatile u_int32_t *)(VME2_BASE + VME2_T1CMP) = 0xffffffff; - *(volatile u_int32_t *)(VME2_BASE + VME2_T1COUNT) = 0; - *(volatile u_int32_t *)(VME2_BASE + VME2_TCTL) |= - VME2_TCTL1_CEN; - - while ((*(volatile u_int32_t *)(VME2_BASE + VME2_T1COUNT)) < - (u_int32_t)us) - ; - *(volatile u_int32_t *)(VME2_BASE + VME2_TCTL) &= - ~VME2_TCTL1_CEN; - } -} diff --git a/sys/arch/mvme88k/mvme88k/clockvar.h b/sys/arch/mvme88k/mvme88k/clockvar.h index 5d491874aa4..0cf098c2f1c 100644 --- a/sys/arch/mvme88k/mvme88k/clockvar.h +++ b/sys/arch/mvme88k/mvme88k/clockvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: clockvar.h,v 1.2 2006/04/27 20:21:19 miod Exp $ */ +/* $OpenBSD: clockvar.h,v 1.3 2009/02/13 23:26:51 miod Exp $ */ /* * Copyright (c) 1999 Steve Murphree, Jr. * Copyright (c) 1995 Theo de Raadt @@ -72,4 +72,6 @@ extern struct intrhand statclock_ih; extern int statvar; extern int statmin; +void m188_delay(int); +void m1x7_delay(int); void m1x7_init_clocks(void); diff --git a/sys/arch/mvme88k/mvme88k/m187_machdep.c b/sys/arch/mvme88k/mvme88k/m187_machdep.c index b1cec8d3a64..4773648007b 100644 --- a/sys/arch/mvme88k/mvme88k/m187_machdep.c +++ b/sys/arch/mvme88k/mvme88k/m187_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m187_machdep.c,v 1.17 2009/02/01 00:51:33 miod Exp $ */ +/* $OpenBSD: m187_machdep.c,v 1.18 2009/02/13 23:26:51 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -256,4 +256,5 @@ m187_bootstrap() md_setipl = m187_setipl; md_raiseipl = m187_raiseipl; md_init_clocks = m1x7_init_clocks; + md_delay = m1x7_delay; } diff --git a/sys/arch/mvme88k/mvme88k/m188_machdep.c b/sys/arch/mvme88k/mvme88k/m188_machdep.c index c0bb1ade113..297721eae3e 100644 --- a/sys/arch/mvme88k/mvme88k/m188_machdep.c +++ b/sys/arch/mvme88k/mvme88k/m188_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m188_machdep.c,v 1.45 2008/11/27 21:43:03 miod Exp $ */ +/* $OpenBSD: m188_machdep.c,v 1.46 2009/02/13 23:26:51 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -221,6 +221,7 @@ m188_bootstrap() #ifdef MULTIPROCESSOR md_send_ipi = m188_send_ipi; #endif + md_delay = m188_delay; /* clear and disable all interrupts */ *(volatile u_int32_t *)MVME188_IENALL = 0; diff --git a/sys/arch/mvme88k/mvme88k/m197_machdep.c b/sys/arch/mvme88k/mvme88k/m197_machdep.c index f329cdeee56..71bba99f357 100644 --- a/sys/arch/mvme88k/mvme88k/m197_machdep.c +++ b/sys/arch/mvme88k/mvme88k/m197_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m197_machdep.c,v 1.28 2009/02/08 21:40:58 miod Exp $ */ +/* $OpenBSD: m197_machdep.c,v 1.29 2009/02/13 23:26:51 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -393,6 +393,7 @@ m197_bootstrap() #ifdef MULTIPROCESSOR md_send_ipi = m197_send_ipi; #endif + md_delay = m1x7_delay; } #ifdef MULTIPROCESSOR diff --git a/sys/arch/mvme88k/mvme88k/m1x7_machdep.c b/sys/arch/mvme88k/mvme88k/m1x7_machdep.c index 60185b55a24..b417c6fb87f 100644 --- a/sys/arch/mvme88k/mvme88k/m1x7_machdep.c +++ b/sys/arch/mvme88k/mvme88k/m1x7_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m1x7_machdep.c,v 1.6 2007/12/04 23:45:53 miod Exp $ */ +/* $OpenBSD: m1x7_machdep.c,v 1.7 2009/02/13 23:26:51 miod Exp $ */ /* * Copyright (c) 1999 Steve Murphree, Jr. * Copyright (c) 1995 Theo de Raadt @@ -79,6 +79,7 @@ #include <mvme88k/dev/pcctwovar.h> #include <mvme88k/dev/pcctworeg.h> +#include <mvme88k/dev/vme.h> #include <mvme88k/mvme88k/clockvar.h> @@ -207,3 +208,19 @@ m1x7_statintr(void *eframe) return (1); } + +void +m1x7_delay(int us) +{ + /* + * On MVME187 and MVME197, use the VMEchip for the delay clock. + */ + *(volatile u_int32_t *)(VME2_BASE + VME2_T1CMP) = 0xffffffff; + *(volatile u_int32_t *)(VME2_BASE + VME2_T1COUNT) = 0; + *(volatile u_int32_t *)(VME2_BASE + VME2_TCTL) |= VME2_TCTL1_CEN; + + while ((*(volatile u_int32_t *)(VME2_BASE + VME2_T1COUNT)) < + (u_int32_t)us) + ; + *(volatile u_int32_t *)(VME2_BASE + VME2_TCTL) &= ~VME2_TCTL1_CEN; +} diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c index 5e699cf7929..d483aa4ebb3 100644 --- a/sys/arch/mvme88k/mvme88k/machdep.c +++ b/sys/arch/mvme88k/mvme88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.217 2009/02/08 21:59:21 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.218 2009/02/13 23:26:51 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -80,6 +80,7 @@ #ifdef MVME188 #include <mvme88k/dev/sysconvar.h> #endif +#include <mvme88k/mvme88k/clockvar.h> #include <dev/cons.h> @@ -96,6 +97,7 @@ caddr_t allocsys(caddr_t); void consinit(void); +void dumb_delay(int); void dumpconf(void); void dumpsys(void); int getcpuspeed(struct mvmeprom_brdid *); @@ -129,6 +131,7 @@ u_int (*md_raiseipl)(u_int); #ifdef MULTIPROCESSOR void (*md_send_ipi)(int, cpuid_t); #endif +void (*md_delay)(int) = dumb_delay; int physmem; /* available physical memory, in pages */ @@ -173,6 +176,20 @@ vaddr_t virtual_avail, virtual_end; extern struct user *proc0paddr; +struct intrhand clock_ih; +struct intrhand statclock_ih; + +/* + * Statistics clock interval and variance, in usec. Variance must be a + * power of two. Since this gives us an even number, not an odd number, + * we discard one case and compensate. That is, a variance of 4096 would + * give us offsets in [0..4095]. Instead, we take offsets in [1..4095]. + * This is symmetric about the point 2048, or statvar/2, and thus averages + * to that value (assuming uniform random numbers). + */ +int statvar = 8192; +int statmin; /* statclock interval - 1/2*variance */ + /* * This is to fake out the console routines, while booting. */ @@ -1185,3 +1202,15 @@ m88k_broadcast_ipi(int ipi) } #endif + +void +delay(int us) +{ + (*md_delay)(us); +} + +/* delay() routine used until a proper routine is set up */ +void +dumb_delay(int us) +{ +} |