diff options
author | mav <mav@FreeBSD.org> | 2009-05-02 12:59:47 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2009-05-02 12:59:47 +0000 |
commit | b704e6092a4076e74c276c0d531447a8cb3bf6a6 (patch) | |
tree | 0961463ce51a684ec4e9ea891895cce8c3c221ae /sys/i386/isa/clock.c | |
parent | baf55d1d06ec21028f521e2a0594294a49bc3bce (diff) | |
download | FreeBSD-src-b704e6092a4076e74c276c0d531447a8cb3bf6a6.zip FreeBSD-src-b704e6092a4076e74c276c0d531447a8cb3bf6a6.tar.gz |
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.
Diffstat (limited to 'sys/i386/isa/clock.c')
-rw-r--r-- | sys/i386/isa/clock.c | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/sys/i386/isa/clock.c b/sys/i386/isa/clock.c index b908c34..989a622 100644 --- a/sys/i386/isa/clock.c +++ b/sys/i386/isa/clock.c @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include <sys/kernel.h> #include <sys/module.h> #include <sys/sched.h> +#include <sys/smp.h> #include <sys/sysctl.h> #include <machine/clock.h> @@ -69,6 +70,7 @@ __FBSDID("$FreeBSD$"); #endif #include <machine/ppireg.h> #include <machine/timerreg.h> +#include <machine/smp.h> #include <isa/rtc.h> #ifdef DEV_ISA @@ -127,6 +129,35 @@ 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) +{ + + if (profprocs != 0) + profclock(TRAPF_USERMODE(frame), TRAPF_PC(frame)); + statclock(TRAPF_USERMODE(frame)); + return (FILTER_HANDLED); +} + +int +profclockintr(struct trapframe *frame) +{ + + profclock(TRAPF_USERMODE(frame), TRAPF_PC(frame)); + return (FILTER_HANDLED); +} + static int clkintr(struct trapframe *frame) { @@ -155,7 +186,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)); #ifdef DEV_MCA /* Reset clock interrupt by asserting bit 7 of port 0x61 */ if (MCA_system) @@ -241,10 +279,19 @@ rtcintr(struct trapframe *frame) if (profprocs != 0) { if (--pscnt == 0) pscnt = psdiv; +#ifdef SMP + if (pscnt != psdiv && smp_started) + ipi_all_but_self(IPI_PROFCLOCK); +#endif profclock(TRAPF_USERMODE(frame), TRAPF_PC(frame)); } - if (pscnt == psdiv) + if (pscnt == psdiv) { +#ifdef SMP + if (smp_started) + ipi_all_but_self(IPI_STATCLOCK); +#endif statclock(TRAPF_USERMODE(frame)); + } } return(flag ? FILTER_HANDLED : FILTER_STRAY); } |