diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2009-03-04 19:35:55 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2009-03-04 19:35:55 +0000 |
commit | e76369dccd027f5c27487502290777d6368227ff (patch) | |
tree | a0fdd672949878d1b87eff18ed001d981b73f558 | |
parent | cf6c62c87ac4dfec64755a2f4896381d0976b1b4 (diff) |
When handling clock interrupts, check the overflow counter to know how many
times hardclock() needs to be invoked; fixes clock drift found on 197DP
with SMP kernels.
-rw-r--r-- | sys/arch/mvme88k/dev/pcctworeg.h | 3 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/m1x7_machdep.c | 23 |
2 files changed, 18 insertions, 8 deletions
diff --git a/sys/arch/mvme88k/dev/pcctworeg.h b/sys/arch/mvme88k/dev/pcctworeg.h index a204e462d58..85327ec54db 100644 --- a/sys/arch/mvme88k/dev/pcctworeg.h +++ b/sys/arch/mvme88k/dev/pcctworeg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pcctworeg.h,v 1.8 2006/04/27 20:19:28 miod Exp $ */ +/* $OpenBSD: pcctworeg.h,v 1.9 2009/03/04 19:35:52 miod Exp $ */ /* * Memory map for PCC2 chip found in MVME1x7 boards. @@ -95,6 +95,7 @@ extern u_int8_t *volatile pcc2intr_ipl; #define PCC2_TCTL_COC 0x02 #define PCC2_TCTL_COVF 0x04 #define PCC2_TCTL_OVF 0xf0 +#define PCC2_TCTL_OVF_SHIFT 4 #define PCC2_GPIO_PLTY 0x80 #define PCC2_GPIO_EL 0x40 diff --git a/sys/arch/mvme88k/mvme88k/m1x7_machdep.c b/sys/arch/mvme88k/mvme88k/m1x7_machdep.c index b417c6fb87f..cd230963fab 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.7 2009/02/13 23:26:51 miod Exp $ */ +/* $OpenBSD: m1x7_machdep.c,v 1.8 2009/03/04 19:35:54 miod Exp $ */ /* * Copyright (c) 1999 Steve Murphree, Jr. * Copyright (c) 1995 Theo de Raadt @@ -156,17 +156,26 @@ m1x7_init_clocks(void) int m1x7_clockintr(void *eframe) { + uint oflow; + + oflow = (*(volatile u_int8_t *)(PCC2_BASE + PCCTWO_T1CTL) & + PCC2_TCTL_OVF) >> PCC2_TCTL_OVF_SHIFT; + *(volatile u_int8_t *)(PCC2_BASE + PCCTWO_T1CTL) = + PCC2_TCTL_CEN | PCC2_TCTL_COC | PCC2_TCTL_COVF; + *(volatile u_int8_t *)(PCC2_BASE + PCCTWO_T1ICR) = PROF_RESET; - hardclock(eframe); + while (oflow-- != 0) { + hardclock(eframe); #ifdef MULTIPROCESSOR - /* - * Send an IPI to all other processors, so they can get their - * own ticks. - */ - m88k_broadcast_ipi(CI_IPI_HARDCLOCK); + /* + * Send an IPI to all other processors, so they can get their + * own ticks. + */ + m88k_broadcast_ipi(CI_IPI_HARDCLOCK); #endif + } return (1); } |