summaryrefslogtreecommitdiffstats
path: root/sys/pc98/cbus
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2005-02-09 22:48:22 +0000
committerjhb <jhb@FreeBSD.org>2005-02-09 22:48:22 +0000
commit41cf4e19b2dc88a4f8c2be0d404c1d83f94f03fd (patch)
treea53b34a98faf62c40eccd3f639d62feac89f000a /sys/pc98/cbus
parentac4a47b2e55a3fcc247461afccb03ca447a52d2f (diff)
downloadFreeBSD-src-41cf4e19b2dc88a4f8c2be0d404c1d83f94f03fd.zip
FreeBSD-src-41cf4e19b2dc88a4f8c2be0d404c1d83f94f03fd.tar.gz
Fix pc98 compile: merge in changes to use the local APIC timer. Also, add
missing initialization of i8254_intsrc while I am here.
Diffstat (limited to 'sys/pc98/cbus')
-rw-r--r--sys/pc98/cbus/clock.c28
-rw-r--r--sys/pc98/cbus/pcrtc.c28
2 files changed, 28 insertions, 28 deletions
diff --git a/sys/pc98/cbus/clock.c b/sys/pc98/cbus/clock.c
index 72a968e..e3c4e8a 100644
--- a/sys/pc98/cbus/clock.c
+++ b/sys/pc98/cbus/clock.c
@@ -48,6 +48,7 @@
* modified for PC98 by Kakefuda
*/
+#include "opt_apic.h"
#include "opt_clock.h"
#include "opt_isa.h"
#include "opt_mca.h"
@@ -74,8 +75,8 @@
#include <machine/intr_machdep.h>
#include <machine/md_var.h>
#include <machine/psl.h>
-#if defined(SMP)
-#include <machine/smp.h>
+#ifdef DEV_APIC
+#include <machine/apicvar.h>
#endif
#include <machine/specialreg.h>
@@ -134,6 +135,7 @@ static u_int hardclock_max_count;
static u_int32_t i8254_lastcount;
static u_int32_t i8254_offset;
static int i8254_ticked;
+static int using_lapic_timer;
static struct intsrc *i8254_intsrc;
#ifndef BURN_BRIDGES
/*
@@ -189,11 +191,8 @@ clkintr(struct clockframe *frame)
clkintr_pending = 0;
mtx_unlock_spin(&clock_lock);
}
- timer_func(frame);
-#ifdef SMP
- if (timer_func == hardclock)
- forward_hardclock();
-#endif
+ if (timer_func != hardclock || !using_lapic_timer)
+ timer_func(frame);
#ifndef BURN_BRIDGES
switch (timer0_state) {
@@ -201,13 +200,12 @@ clkintr(struct clockframe *frame)
break;
case ACQUIRED:
+ if (using_lapic_timer)
+ break;
if ((timer0_prescaler_count += timer0_max_count)
>= hardclock_max_count) {
timer0_prescaler_count -= hardclock_max_count;
hardclock(frame);
-#ifdef SMP
- forward_hardclock();
-#endif
}
break;
@@ -239,10 +237,8 @@ clkintr(struct clockframe *frame)
timer0_prescaler_count = 0;
timer_func = hardclock;
timer0_state = RELEASED;
- hardclock(frame);
-#ifdef SMP
- forward_hardclock();
-#endif
+ if (!using_lapic_timer)
+ hardclock(frame);
}
break;
}
@@ -899,9 +895,13 @@ void
cpu_initclocks()
{
+#ifdef DEV_APIC
+ using_lapic_timer = lapic_setup_clock();
+#endif
/* Finish initializing 8254 timer 0. */
intr_add_handler("clk", 0, (driver_intr_t *)clkintr, NULL,
INTR_TYPE_CLK | INTR_FAST, NULL);
+ i8254_intsrc = intr_lookup_source(0);
init_TSC_tc();
}
diff --git a/sys/pc98/cbus/pcrtc.c b/sys/pc98/cbus/pcrtc.c
index 72a968e..e3c4e8a 100644
--- a/sys/pc98/cbus/pcrtc.c
+++ b/sys/pc98/cbus/pcrtc.c
@@ -48,6 +48,7 @@
* modified for PC98 by Kakefuda
*/
+#include "opt_apic.h"
#include "opt_clock.h"
#include "opt_isa.h"
#include "opt_mca.h"
@@ -74,8 +75,8 @@
#include <machine/intr_machdep.h>
#include <machine/md_var.h>
#include <machine/psl.h>
-#if defined(SMP)
-#include <machine/smp.h>
+#ifdef DEV_APIC
+#include <machine/apicvar.h>
#endif
#include <machine/specialreg.h>
@@ -134,6 +135,7 @@ static u_int hardclock_max_count;
static u_int32_t i8254_lastcount;
static u_int32_t i8254_offset;
static int i8254_ticked;
+static int using_lapic_timer;
static struct intsrc *i8254_intsrc;
#ifndef BURN_BRIDGES
/*
@@ -189,11 +191,8 @@ clkintr(struct clockframe *frame)
clkintr_pending = 0;
mtx_unlock_spin(&clock_lock);
}
- timer_func(frame);
-#ifdef SMP
- if (timer_func == hardclock)
- forward_hardclock();
-#endif
+ if (timer_func != hardclock || !using_lapic_timer)
+ timer_func(frame);
#ifndef BURN_BRIDGES
switch (timer0_state) {
@@ -201,13 +200,12 @@ clkintr(struct clockframe *frame)
break;
case ACQUIRED:
+ if (using_lapic_timer)
+ break;
if ((timer0_prescaler_count += timer0_max_count)
>= hardclock_max_count) {
timer0_prescaler_count -= hardclock_max_count;
hardclock(frame);
-#ifdef SMP
- forward_hardclock();
-#endif
}
break;
@@ -239,10 +237,8 @@ clkintr(struct clockframe *frame)
timer0_prescaler_count = 0;
timer_func = hardclock;
timer0_state = RELEASED;
- hardclock(frame);
-#ifdef SMP
- forward_hardclock();
-#endif
+ if (!using_lapic_timer)
+ hardclock(frame);
}
break;
}
@@ -899,9 +895,13 @@ void
cpu_initclocks()
{
+#ifdef DEV_APIC
+ using_lapic_timer = lapic_setup_clock();
+#endif
/* Finish initializing 8254 timer 0. */
intr_add_handler("clk", 0, (driver_intr_t *)clkintr, NULL,
INTR_TYPE_CLK | INTR_FAST, NULL);
+ i8254_intsrc = intr_lookup_source(0);
init_TSC_tc();
}
OpenPOWER on IntegriCloud