summaryrefslogtreecommitdiffstats
path: root/sys/isa/atrtc.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/isa/atrtc.c')
-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