summaryrefslogtreecommitdiffstats
path: root/sys/amd64/isa
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2005-02-28 23:37:35 +0000
committerpeter <peter@FreeBSD.org>2005-02-28 23:37:35 +0000
commit7e1c228b9f27ff83fabc78c22fd65edec55298b8 (patch)
treecbf1056653b0a15ba5ee28bf92b70393252caed4 /sys/amd64/isa
parent8115657ff0bbed634a787daeeed108209d0a65b9 (diff)
downloadFreeBSD-src-7e1c228b9f27ff83fabc78c22fd65edec55298b8.zip
FreeBSD-src-7e1c228b9f27ff83fabc78c22fd65edec55298b8.tar.gz
MFi386: Bring over John's local apic timer code
Diffstat (limited to 'sys/amd64/isa')
-rw-r--r--sys/amd64/isa/clock.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/sys/amd64/isa/clock.c b/sys/amd64/isa/clock.c
index de0d7d5..d4bf576 100644
--- a/sys/amd64/isa/clock.c
+++ b/sys/amd64/isa/clock.c
@@ -70,9 +70,7 @@ __FBSDID("$FreeBSD$");
#include <machine/intr_machdep.h>
#include <machine/md_var.h>
#include <machine/psl.h>
-#ifdef SMP
-#include <machine/smp.h>
-#endif
+#include <machine/apicvar.h>
#include <machine/specialreg.h>
#include <amd64/isa/isa.h>
@@ -113,6 +111,7 @@ static u_int32_t i8254_lastcount;
static u_int32_t i8254_offset;
static int (*i8254_pending)(struct intsrc *);
static int i8254_ticked;
+static int using_lapic_timer;
static u_char rtc_statusa = RTCSA_DIVIDER | RTCSA_NOPROF;
static u_char rtc_statusb = RTCSB_24HR | RTCSB_PINTR;
@@ -151,10 +150,8 @@ clkintr(struct clockframe *frame)
clkintr_pending = 0;
mtx_unlock_spin(&clock_lock);
}
- hardclock(frame);
-#ifdef SMP
- forward_hardclock();
-#endif
+ if (!using_lapic_timer)
+ hardclock(frame);
}
int
@@ -221,9 +218,6 @@ rtcintr(struct clockframe *frame)
}
if (pscnt == psdiv)
statclock(frame);
-#ifdef SMP
- forward_statclock();
-#endif
}
}
@@ -730,7 +724,8 @@ cpu_initclocks()
{
int diag;
- if (statclock_disable) {
+ using_lapic_timer = lapic_setup_clock();
+ if (statclock_disable || using_lapic_timer) {
/*
* The stat interrupt mask is different without the
* statistics clock. Also, don't set the interrupt
@@ -756,7 +751,7 @@ cpu_initclocks()
writertc(RTC_STATUSB, RTCSB_24HR);
/* Don't bother enabling the statistics clock. */
- if (!statclock_disable) {
+ if (!statclock_disable && !using_lapic_timer) {
diag = rtcin(RTC_DIAG);
if (diag != 0)
printf("RTC BIOS diagnostic error %b\n", diag, RTCDG_BITS);
@@ -775,6 +770,8 @@ void
cpu_startprofclock(void)
{
+ if (using_lapic_timer)
+ return;
rtc_statusa = RTCSA_DIVIDER | RTCSA_PROF;
writertc(RTC_STATUSA, rtc_statusa);
psdiv = pscnt = psratio;
@@ -784,6 +781,8 @@ void
cpu_stopprofclock(void)
{
+ if (using_lapic_timer)
+ return;
rtc_statusa = RTCSA_DIVIDER | RTCSA_NOPROF;
writertc(RTC_STATUSA, rtc_statusa);
psdiv = pscnt = 1;
OpenPOWER on IntegriCloud