summaryrefslogtreecommitdiffstats
path: root/sys/isa
diff options
context:
space:
mode:
authoriwasaki <iwasaki@FreeBSD.org>2001-09-04 16:02:06 +0000
committeriwasaki <iwasaki@FreeBSD.org>2001-09-04 16:02:06 +0000
commit878a79c3e6de0481128689fbe94fb8cab74174c0 (patch)
tree8a086694659c8036602488a9827a9d6cebf5ab57 /sys/isa
parentc4a32defbf6710432c888f3ef40a5255c45ecedc (diff)
downloadFreeBSD-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/isa')
-rw-r--r--sys/isa/atrtc.c23
1 files changed, 22 insertions, 1 deletions
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.
OpenPOWER on IntegriCloud