summaryrefslogtreecommitdiffstats
path: root/sys/pc98/cbus/pcrtc.c
diff options
context:
space:
mode:
authornyan <nyan@FreeBSD.org>1999-11-03 08:36:17 +0000
committernyan <nyan@FreeBSD.org>1999-11-03 08:36:17 +0000
commitb95da9010fae0c7f34c4c3c02c657ecb0e8396eb (patch)
tree41c986665a3521fe1479c7f92c0f9d0d267b7264 /sys/pc98/cbus/pcrtc.c
parent3415a19e364c9849763fdd543470df6bceb4baf4 (diff)
downloadFreeBSD-src-b95da9010fae0c7f34c4c3c02c657ecb0e8396eb.zip
FreeBSD-src-b95da9010fae0c7f34c4c3c02c657ecb0e8396eb.tar.gz
Sync with sys/i386/isa/clock.c revision 1.146.
Diffstat (limited to 'sys/pc98/cbus/pcrtc.c')
-rw-r--r--sys/pc98/cbus/pcrtc.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/sys/pc98/cbus/pcrtc.c b/sys/pc98/cbus/pcrtc.c
index 56a92bc..f00e764 100644
--- a/sys/pc98/cbus/pcrtc.c
+++ b/sys/pc98/cbus/pcrtc.c
@@ -873,6 +873,28 @@ set_timer_freq(u_int freq, int intr_freq)
}
/*
+ * i8254_restore is called from apm_default_resume() to reload
+ * the countdown register.
+ * this should not be necessary but there are broken laptops that
+ * do not restore the countdown register on resume.
+ * when it happnes, it messes up the hardclock interval and system clock,
+ * which leads to the infamous "calcru: negative time" problem.
+ */
+void
+i8254_restore(void)
+{
+ u_long ef;
+
+ ef = read_eflags();
+ disable_intr();
+ outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT);
+ outb(TIMER_CNTR0, timer0_max_count & 0xff);
+ outb(TIMER_CNTR0, timer0_max_count >> 8);
+ CLOCK_UNLOCK();
+ write_eflags(ef);
+}
+
+/*
* 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