diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-09-06 01:19:08 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-09-06 01:19:08 +0000 |
commit | 80aa08476c26d1f9aea7162807bd27f717852afb (patch) | |
tree | eac3f1445aa314b81b31ff3521e06d4619ba676c /arch | |
parent | 9781bc8304de086b933804348a40995d60b66007 (diff) |
NTP fixes from Maciej.
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/baget/time.c | 25 | ||||
-rw-r--r-- | arch/mips/dec/time.c | 20 | ||||
-rw-r--r-- | arch/mips/kernel/time.c | 2 | ||||
-rw-r--r-- | arch/mips64/sgi-ip22/ip22-timer.c | 7 | ||||
-rw-r--r-- | arch/mips64/sgi-ip27/ip27-timer.c | 6 |
5 files changed, 35 insertions, 25 deletions
diff --git a/arch/mips/baget/time.c b/arch/mips/baget/time.c index d56fa6a23..99dccb59d 100644 --- a/arch/mips/baget/time.c +++ b/arch/mips/baget/time.c @@ -76,21 +76,22 @@ void __init time_init(void) void do_gettimeofday(struct timeval *tv) { - unsigned long flags; + unsigned long flags; - save_and_cli(flags); - *tv = xtime; - restore_flags(flags); + save_and_cli(flags); + *tv = xtime; + restore_flags(flags); } void do_settimeofday(struct timeval *tv) { - unsigned long flags; + unsigned long flags; - save_and_cli(flags); - xtime = *tv; - time_state = TIME_BAD; - time_maxerror = MAXPHASE; - time_esterror = MAXPHASE; - restore_flags(flags); -} + save_and_cli(flags); + xtime = *tv; + time_adjust = 0; /* stop active adjtime() */ + time_status |= STA_UNSYNC; + time_maxerror = NTP_PHASE_LIMIT; + time_esterror = NTP_PHASE_LIMIT; + restore_flags(flags); +} diff --git a/arch/mips/dec/time.c b/arch/mips/dec/time.c index 2daa8746b..798f21832 100644 --- a/arch/mips/dec/time.c +++ b/arch/mips/dec/time.c @@ -231,6 +231,7 @@ void do_gettimeofday(struct timeval *tv) void do_settimeofday(struct timeval *tv) { write_lock_irq(&xtime_lock); + /* This is revolting. We need to set the xtime.tv_usec * correctly. However, the value in this location is * is value at the last tick. @@ -243,10 +244,13 @@ void do_settimeofday(struct timeval *tv) tv->tv_usec += 1000000; tv->tv_sec--; } + xtime = *tv; - time_state = TIME_BAD; - time_maxerror = MAXPHASE; - time_esterror = MAXPHASE; + time_adjust = 0; /* stop active adjtime() */ + time_status |= STA_UNSYNC; + time_maxerror = NTP_PHASE_LIMIT; + time_esterror = NTP_PHASE_LIMIT; + write_unlock_irq(&xtime_lock); } @@ -351,13 +355,15 @@ timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) * called as close as possible to 500 ms before the new second starts. */ read_lock(&xtime_lock); - if (time_state != TIME_BAD && xtime.tv_sec > last_rtc_update + 660 && - xtime.tv_usec > 500000 - (tick >> 1) && - xtime.tv_usec < 500000 + (tick >> 1)) { + if ((time_status & STA_UNSYNC) == 0 + && xtime.tv_sec > last_rtc_update + 660 + && xtime.tv_usec >= 500000 - tick / 2 + && xtime.tv_usec <= 500000 + tick / 2) { if (set_rtc_mmss(xtime.tv_sec) == 0) last_rtc_update = xtime.tv_sec; else - last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ + /* do it again in 60 s */ + last_rtc_update = xtime.tv_sec - 600; } /* As we return to user mode fire off the other CPU schedulers.. this is basically because we don't yet share IRQ's around. This message is diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c index 0eb86b9f1..3551fd683 100644 --- a/arch/mips/kernel/time.c +++ b/arch/mips/kernel/time.c @@ -243,6 +243,7 @@ void do_gettimeofday(struct timeval *tv) void do_settimeofday(struct timeval *tv) { write_lock_irq (&xtime_lock); + /* This is revolting. We need to set the xtime.tv_usec * correctly. However, the value in this location is * is value at the last tick. @@ -261,6 +262,7 @@ void do_settimeofday(struct timeval *tv) time_status |= STA_UNSYNC; time_maxerror = NTP_PHASE_LIMIT; time_esterror = NTP_PHASE_LIMIT; + write_unlock_irq (&xtime_lock); } diff --git a/arch/mips64/sgi-ip22/ip22-timer.c b/arch/mips64/sgi-ip22/ip22-timer.c index 76b613e60..5b8ea05f7 100644 --- a/arch/mips64/sgi-ip22/ip22-timer.c +++ b/arch/mips64/sgi-ip22/ip22-timer.c @@ -288,8 +288,9 @@ void do_settimeofday(struct timeval *tv) { write_lock_irq(&xtime_lock); xtime = *tv; - time_state = TIME_BAD; - time_maxerror = MAXPHASE; - time_esterror = MAXPHASE; + time_adjust = 0; /* stop active adjtime() */ + time_status |= STA_UNSYNC; + time_maxerror = NTP_PHASE_LIMIT; + time_esterror = NTP_PHASE_LIMIT; write_unlock_irq(&xtime_lock); } diff --git a/arch/mips64/sgi-ip27/ip27-timer.c b/arch/mips64/sgi-ip27/ip27-timer.c index 90b3e3e75..62537554b 100644 --- a/arch/mips64/sgi-ip27/ip27-timer.c +++ b/arch/mips64/sgi-ip27/ip27-timer.c @@ -192,9 +192,9 @@ void do_settimeofday(struct timeval *tv) xtime = *tv; time_adjust = 0; /* stop active adjtime() */ - time_state = TIME_BAD; - time_maxerror = MAXPHASE; - time_esterror = MAXPHASE; + time_status |= STA_UNSYNC; + time_maxerror = NTP_PHASE_LIMIT; + time_esterror = NTP_PHASE_LIMIT; write_unlock_irq(&xtime_lock); } |