From 4c45d5b45c3f38ec82e2180fd7baaa39cce3fb8e Mon Sep 17 00:00:00 2001 From: nyan Date: Sun, 3 May 2009 02:37:13 +0000 Subject: [PATCH] MFi386: revision 191745 Add support for using i8254 and rtc timers as event sources for i386 SMP system. Redistribute hard-/stat-/profclock events to other CPUs using IPI. --- sys/pc98/cbus/clock.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/sys/pc98/cbus/clock.c b/sys/pc98/cbus/clock.c index 6e1242f026fe..ad613e42a5dc 100644 --- a/sys/pc98/cbus/clock.c +++ b/sys/pc98/cbus/clock.c @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -71,6 +72,7 @@ __FBSDID("$FreeBSD$"); #endif #include #include +#include #include #ifdef DEV_ISA @@ -123,6 +125,31 @@ static struct timecounter i8254_timecounter = { 0 /* quality */ }; +int +hardclockintr(struct trapframe *frame) +{ + + if (PCPU_GET(cpuid) == 0) + hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame)); + else + hardclock_cpu(TRAPF_USERMODE(frame)); + return (FILTER_HANDLED); +} + +int +statclockintr(struct trapframe *frame) +{ + + return (FILTER_HANDLED); +} + +int +profclockintr(struct trapframe *frame) +{ + + return (FILTER_HANDLED); +} + static int clkintr(struct trapframe *frame) { @@ -151,7 +178,14 @@ clkintr(struct trapframe *frame) (*lapic_cyclic_clock_func[cpu])(frame); #endif - hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame)); +#ifdef SMP + if (smp_started) + ipi_all_but_self(IPI_HARDCLOCK); +#endif + if (PCPU_GET(cpuid) == 0) + hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame)); + else + hardclock_cpu(TRAPF_USERMODE(frame)); return (FILTER_HANDLED); }