summaryrefslogtreecommitdiffstats
path: root/sys/pc98/cbus/pcrtc.c
diff options
context:
space:
mode:
authornyan <nyan@FreeBSD.org>2001-09-16 05:29:27 +0000
committernyan <nyan@FreeBSD.org>2001-09-16 05:29:27 +0000
commit0588ccfa1ac10f1e20e25ba8237e58709be0acf8 (patch)
tree1cbfaf7f081eccf48f38527e207971f0b4df4a91 /sys/pc98/cbus/pcrtc.c
parent9313ae499c67d31e76e8f932ed6a4f3544a87b45 (diff)
downloadFreeBSD-src-0588ccfa1ac10f1e20e25ba8237e58709be0acf8.zip
FreeBSD-src-0588ccfa1ac10f1e20e25ba8237e58709be0acf8.tar.gz
MFi386: sys/i386/isa/clock.c revision 1.175 and 1.176.
Diffstat (limited to 'sys/pc98/cbus/pcrtc.c')
-rw-r--r--sys/pc98/cbus/pcrtc.c41
1 files changed, 36 insertions, 5 deletions
diff --git a/sys/pc98/cbus/pcrtc.c b/sys/pc98/cbus/pcrtc.c
index af35c4d..14eb0a1 100644
--- a/sys/pc98/cbus/pcrtc.c
+++ b/sys/pc98/cbus/pcrtc.c
@@ -141,9 +141,9 @@ int disable_rtc_set; /* disable resettodr() if != 0 */
int statclock_disable;
#ifndef TIMER_FREQ
#ifdef PC98
-#define TIMER_FREQ 2457600;
+#define TIMER_FREQ 2457600
#else /* IBM-PC */
-#define TIMER_FREQ 1193182;
+#define TIMER_FREQ 1193182
#endif /* PC98 */
#endif
u_int timer_freq = TIMER_FREQ;
@@ -887,7 +887,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)
{
@@ -898,6 +898,31 @@ i8254_restore(void)
mtx_unlock_spin(&clock_lock);
}
+#ifndef PC98
+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);
+}
+#endif
+
+/*
+ * Restore all the timers atomically.
+ */
+void
+timer_restore(void)
+{
+
+ i8254_restore(); /* restore timer_freq and hz */
+#ifndef PC98
+ rtc_restore(); /* reenable RTC interrupts */
+#endif
+}
+
/*
* Initialize 8254 timer 0 early so that it can be used in DELAY().
* XXX initialization of other timers is unintentionally left blank.
@@ -1303,13 +1328,15 @@ resettodr()
void
cpu_initclocks()
{
+#ifndef PC98
+ int diag;
+#endif
#ifdef APIC_IO
int apic_8254_trial;
void *clkdesc;
#endif /* APIC_IO */
-#ifndef PC98
- int diag;
+#ifndef PC98
if (statclock_disable) {
/*
* The stat interrupt mask is different without the
@@ -1474,6 +1501,7 @@ setup_8254_mixed_mode()
outb(IO_ICU1 + 1, 0x03); /* auto EOI, 8086 */
outb(IO_ICU1 + 1, 0xfe); /* unmask INT0 */
#endif
+
/* program IO APIC for type 3 INT on INT0 */
if (ext_int_setup(0, 0) < 0)
panic("8254 redirect via APIC pin0 impossible!");
@@ -1625,3 +1653,6 @@ static driver_t attimer_driver = {
static devclass_t attimer_devclass;
DRIVER_MODULE(attimer, isa, attimer_driver, attimer_devclass, 0, 0);
+#ifndef PC98
+DRIVER_MODULE(attimer, acpi, attimer_driver, attimer_devclass, 0, 0);
+#endif
OpenPOWER on IntegriCloud