patch-2.2.4 linux/arch/sparc/kernel/time.c
Next file: linux/arch/sparc/kernel/traps.c
Previous file: linux/arch/sparc/kernel/systbls.S
Back to the patch index
Back to the overall index
- Lines: 86
- Date:
Mon Mar 15 16:10:43 1999
- Orig file:
v2.2.3/linux/arch/sparc/kernel/time.c
- Orig date:
Wed Jan 20 23:14:04 1999
diff -u --recursive --new-file v2.2.3/linux/arch/sparc/kernel/time.c linux/arch/sparc/kernel/time.c
@@ -1,4 +1,4 @@
-/* $Id: time.c,v 1.39 1998/09/29 09:46:15 davem Exp $
+/* $Id: time.c,v 1.43 1999/03/15 22:13:31 davem Exp $
* linux/arch/sparc/kernel/time.c
*
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
@@ -39,6 +39,8 @@
#include <asm/sun4paddr.h>
#include <asm/page.h>
+extern rwlock_t xtime_lock;
+
enum sparc_clock_type sp_clock_typ;
struct mostek48t02 *mstk48t02_regs = 0;
struct mostek48t08 *mstk48t08_regs = 0;
@@ -80,7 +82,7 @@
#ifdef CONFIG_SUN4
if((idprom->id_machtype == (SM_SUN4 | SM_4_260)) ||
- (idprom->id_machtype == (SM_SUN4 | SM_4_110))) {
+ (idprom->id_machtype == (SM_SUN4 | SM_4_110))) {
int temp;
intersil_read_intr(intersil_clock, temp);
/* re-enable the irq */
@@ -89,6 +91,8 @@
#endif
clear_clock_irq();
+ write_lock(&xtime_lock);
+
do_timer(regs);
/* Determine when to update the Mostek clock. */
@@ -101,6 +105,7 @@
else
last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */
}
+ write_unlock(&xtime_lock);
}
/* Converts Gregorian date to seconds since 1970-01-01 00:00:00.
@@ -436,6 +441,9 @@
return offset + count;
}
+/* This need not obtain the xtime_lock as it is coded in
+ * an implicitly SMP safe way already.
+ */
void do_gettimeofday(struct timeval *tv)
{
#if CONFIG_AP1000
@@ -485,12 +493,13 @@
void do_settimeofday(struct timeval *tv)
{
+ write_lock_irq(&xtime_lock);
bus_do_settimeofday(tv);
+ write_unlock_irq(&xtime_lock);
}
static void sbus_do_settimeofday(struct timeval *tv)
{
- cli();
#if !CONFIG_AP1000
tv->tv_usec -= do_gettimeoffset();
if(tv->tv_usec < 0) {
@@ -501,10 +510,8 @@
xtime = *tv;
time_adjust = 0; /* stop active adjtime() */
time_status |= STA_UNSYNC;
- time_state = TIME_ERROR; /* p. 24, (a) */
time_maxerror = NTP_PHASE_LIMIT;
time_esterror = NTP_PHASE_LIMIT;
- sti();
}
/*
@@ -544,7 +551,7 @@
} else {
printk(KERN_WARNING
"set_rtc_mmss: can't update from %d to %d\n",
- cmos_minutes, real_minutes);
+ mostek_minutes, real_minutes);
return -1;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)