aboutsummaryrefslogtreecommitdiff
path: root/sys/pc98
diff options
context:
space:
mode:
authorYoshihiro Takahashi <nyan@FreeBSD.org>2001-09-16 05:29:27 +0000
committerYoshihiro Takahashi <nyan@FreeBSD.org>2001-09-16 05:29:27 +0000
commit555c5bb9dd45bdb2f8a0a621ea6213e5af0af11f (patch)
tree1cbfaf7f081eccf48f38527e207971f0b4df4a91 /sys/pc98
parentdc27775f75194dd2f2605395db21ffb7a84cfead (diff)
Notes
Diffstat (limited to 'sys/pc98')
-rw-r--r--sys/pc98/cbus/clock.c41
-rw-r--r--sys/pc98/cbus/pcrtc.c41
-rw-r--r--sys/pc98/pc98/clock.c41
3 files changed, 108 insertions, 15 deletions
diff --git a/sys/pc98/cbus/clock.c b/sys/pc98/cbus/clock.c
index af35c4d8ddfa..14eb0a1c4512 100644
--- a/sys/pc98/cbus/clock.c
+++ b/sys/pc98/cbus/clock.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
diff --git a/sys/pc98/cbus/pcrtc.c b/sys/pc98/cbus/pcrtc.c
index af35c4d8ddfa..14eb0a1c4512 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
diff --git a/sys/pc98/pc98/clock.c b/sys/pc98/pc98/clock.c
index af35c4d8ddfa..14eb0a1c4512 100644
--- a/sys/pc98/pc98/clock.c
+++ b/sys/pc98/pc98/clock.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