diff options
author | iwasaki <iwasaki@FreeBSD.org> | 2001-09-04 16:02:06 +0000 |
---|---|---|
committer | iwasaki <iwasaki@FreeBSD.org> | 2001-09-04 16:02:06 +0000 |
commit | 878a79c3e6de0481128689fbe94fb8cab74174c0 (patch) | |
tree | 8a086694659c8036602488a9827a9d6cebf5ab57 /sys | |
parent | c4a32defbf6710432c888f3ef40a5255c45ecedc (diff) | |
download | FreeBSD-src-878a79c3e6de0481128689fbe94fb8cab74174c0.zip FreeBSD-src-878a79c3e6de0481128689fbe94fb8cab74174c0.tar.gz |
Reenable RTC interrupts after wakeup. Some laptops have a problem
with system statistics monitoring tools (such as systat, vmstat...)
because of stopping RTC interrupts generation.
Restore all the timers (RTC and i8254) atomically.
Reviewed by: bde
MFC after: 1 week
Diffstat (limited to 'sys')
-rw-r--r-- | sys/amd64/amd64/tsc.c | 23 | ||||
-rw-r--r-- | sys/amd64/include/clock.h | 2 | ||||
-rw-r--r-- | sys/amd64/isa/clock.c | 23 | ||||
-rw-r--r-- | sys/i386/i386/tsc.c | 23 | ||||
-rw-r--r-- | sys/i386/include/clock.h | 2 | ||||
-rw-r--r-- | sys/i386/isa/clock.c | 23 | ||||
-rw-r--r-- | sys/i386/isa/pmtimer.c | 2 | ||||
-rw-r--r-- | sys/isa/atrtc.c | 23 |
8 files changed, 113 insertions, 8 deletions
diff --git a/sys/amd64/amd64/tsc.c b/sys/amd64/amd64/tsc.c index e0a638e..1893b19 100644 --- a/sys/amd64/amd64/tsc.c +++ b/sys/amd64/amd64/tsc.c @@ -705,7 +705,7 @@ set_timer_freq(u_int freq, int intr_freq) * when it happnes, it messes up the hardclock interval and system clock, * which leads to the infamous "calcru: negative time" problem. */ -void +static void i8254_restore(void) { @@ -716,6 +716,27 @@ i8254_restore(void) mtx_unlock_spin(&clock_lock); } +static void +rtc_restore(void) +{ + + /* Reenable RTC updates and interrupts. */ + /* XXX locking is needed for RTC access? */ + writertc(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR); + writertc(RTC_STATUSB, rtc_statusb); +} + +/* + * Restore all the timers atomically. + */ +void +timer_restore(void) +{ + + i8254_restore(); /* restore timer_freq and hz */ + rtc_restore(); /* reenable RTC interrupts */ +} + /* * Initialize 8254 timer 0 early so that it can be used in DELAY(). * XXX initialization of other timers is unintentionally left blank. diff --git a/sys/amd64/include/clock.h b/sys/amd64/include/clock.h index c3d0e32..20bd09d 100644 --- a/sys/amd64/include/clock.h +++ b/sys/amd64/include/clock.h @@ -43,7 +43,7 @@ int acquire_timer1 __P((int mode)); int release_timer1 __P((void)); #endif int sysbeep __P((int pitch, int period)); -void i8254_restore __P((void)); +void timer_restore __P((void)); #endif /* _KERNEL */ diff --git a/sys/amd64/isa/clock.c b/sys/amd64/isa/clock.c index e0a638e..1893b19 100644 --- a/sys/amd64/isa/clock.c +++ b/sys/amd64/isa/clock.c @@ -705,7 +705,7 @@ set_timer_freq(u_int freq, int intr_freq) * when it happnes, it messes up the hardclock interval and system clock, * which leads to the infamous "calcru: negative time" problem. */ -void +static void i8254_restore(void) { @@ -716,6 +716,27 @@ i8254_restore(void) mtx_unlock_spin(&clock_lock); } +static void +rtc_restore(void) +{ + + /* Reenable RTC updates and interrupts. */ + /* XXX locking is needed for RTC access? */ + writertc(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR); + writertc(RTC_STATUSB, rtc_statusb); +} + +/* + * Restore all the timers atomically. + */ +void +timer_restore(void) +{ + + i8254_restore(); /* restore timer_freq and hz */ + rtc_restore(); /* reenable RTC interrupts */ +} + /* * Initialize 8254 timer 0 early so that it can be used in DELAY(). * XXX initialization of other timers is unintentionally left blank. diff --git a/sys/i386/i386/tsc.c b/sys/i386/i386/tsc.c index e0a638e..1893b19 100644 --- a/sys/i386/i386/tsc.c +++ b/sys/i386/i386/tsc.c @@ -705,7 +705,7 @@ set_timer_freq(u_int freq, int intr_freq) * when it happnes, it messes up the hardclock interval and system clock, * which leads to the infamous "calcru: negative time" problem. */ -void +static void i8254_restore(void) { @@ -716,6 +716,27 @@ i8254_restore(void) mtx_unlock_spin(&clock_lock); } +static void +rtc_restore(void) +{ + + /* Reenable RTC updates and interrupts. */ + /* XXX locking is needed for RTC access? */ + writertc(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR); + writertc(RTC_STATUSB, rtc_statusb); +} + +/* + * Restore all the timers atomically. + */ +void +timer_restore(void) +{ + + i8254_restore(); /* restore timer_freq and hz */ + rtc_restore(); /* reenable RTC interrupts */ +} + /* * Initialize 8254 timer 0 early so that it can be used in DELAY(). * XXX initialization of other timers is unintentionally left blank. diff --git a/sys/i386/include/clock.h b/sys/i386/include/clock.h index c3d0e32..20bd09d 100644 --- a/sys/i386/include/clock.h +++ b/sys/i386/include/clock.h @@ -43,7 +43,7 @@ int acquire_timer1 __P((int mode)); int release_timer1 __P((void)); #endif int sysbeep __P((int pitch, int period)); -void i8254_restore __P((void)); +void timer_restore __P((void)); #endif /* _KERNEL */ diff --git a/sys/i386/isa/clock.c b/sys/i386/isa/clock.c index e0a638e..1893b19 100644 --- a/sys/i386/isa/clock.c +++ b/sys/i386/isa/clock.c @@ -705,7 +705,7 @@ set_timer_freq(u_int freq, int intr_freq) * when it happnes, it messes up the hardclock interval and system clock, * which leads to the infamous "calcru: negative time" problem. */ -void +static void i8254_restore(void) { @@ -716,6 +716,27 @@ i8254_restore(void) mtx_unlock_spin(&clock_lock); } +static void +rtc_restore(void) +{ + + /* Reenable RTC updates and interrupts. */ + /* XXX locking is needed for RTC access? */ + writertc(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR); + writertc(RTC_STATUSB, rtc_statusb); +} + +/* + * Restore all the timers atomically. + */ +void +timer_restore(void) +{ + + i8254_restore(); /* restore timer_freq and hz */ + rtc_restore(); /* reenable RTC interrupts */ +} + /* * Initialize 8254 timer 0 early so that it can be used in DELAY(). * XXX initialization of other timers is unintentionally left blank. diff --git a/sys/i386/isa/pmtimer.c b/sys/i386/isa/pmtimer.c index 732f8c7..35448e4 100644 --- a/sys/i386/isa/pmtimer.c +++ b/sys/i386/isa/pmtimer.c @@ -83,7 +83,7 @@ pmtimer_resume(device_t dev) /* modified for adjkerntz */ pl = splsoftclock(); - i8254_restore(); /* restore timer_freq and hz */ + timer_restore(); /* restore the all timers */ inittodr(0); /* adjust time to RTC */ microtime(&resume_time); getmicrotime(&tmp_time); diff --git a/sys/isa/atrtc.c b/sys/isa/atrtc.c index e0a638e..1893b19 100644 --- a/sys/isa/atrtc.c +++ b/sys/isa/atrtc.c @@ -705,7 +705,7 @@ set_timer_freq(u_int freq, int intr_freq) * when it happnes, it messes up the hardclock interval and system clock, * which leads to the infamous "calcru: negative time" problem. */ -void +static void i8254_restore(void) { @@ -716,6 +716,27 @@ i8254_restore(void) mtx_unlock_spin(&clock_lock); } +static void +rtc_restore(void) +{ + + /* Reenable RTC updates and interrupts. */ + /* XXX locking is needed for RTC access? */ + writertc(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR); + writertc(RTC_STATUSB, rtc_statusb); +} + +/* + * Restore all the timers atomically. + */ +void +timer_restore(void) +{ + + i8254_restore(); /* restore timer_freq and hz */ + rtc_restore(); /* reenable RTC interrupts */ +} + /* * Initialize 8254 timer 0 early so that it can be used in DELAY(). * XXX initialization of other timers is unintentionally left blank. |