diff options
author | nwhitehorn <nwhitehorn@FreeBSD.org> | 2009-05-14 00:34:26 +0000 |
---|---|---|
committer | nwhitehorn <nwhitehorn@FreeBSD.org> | 2009-05-14 00:34:26 +0000 |
commit | dc1ac440de95721f8b696146577a51ef7a418f59 (patch) | |
tree | 76fac3396a64c911f78e68ca8b02794bc0332825 /sys/powerpc/booke/clock.c | |
parent | d9c2725c3513aa19672b456422a31a356dccffc5 (diff) | |
download | FreeBSD-src-dc1ac440de95721f8b696146577a51ef7a418f59.zip FreeBSD-src-dc1ac440de95721f8b696146577a51ef7a418f59.tar.gz |
Factor out platform dependent things unrelated to device drivers into a
new platform module. These are probed in early boot, and have the
responsibility of determining the layout of physical memory, determining
the CPU timebase frequency, and handling the zoo of SMP mechanisms
found on PowerPC.
Reviewed by: marcel, raj
Book-E parts by: raj
Diffstat (limited to 'sys/powerpc/booke/clock.c')
-rw-r--r-- | sys/powerpc/booke/clock.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/sys/powerpc/booke/clock.c b/sys/powerpc/booke/clock.c index 7070161..6c88741 100644 --- a/sys/powerpc/booke/clock.c +++ b/sys/powerpc/booke/clock.c @@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$"); #include <sys/interrupt.h> #include <machine/clock.h> +#include <machine/platform.h> #include <machine/psl.h> #include <machine/spr.h> #include <machine/cpu.h> @@ -123,29 +124,22 @@ void cpu_initclocks(void) { - return; -} - -void -decr_config (unsigned long freq) -{ - ticks_per_sec = freq; - decr_timecounter.tc_frequency = freq; + decr_tc_init(); } void decr_init (void) { + struct cpuref cpu; unsigned int msr; - /* - * Should check for correct CPU here? XXX - */ + if (platform_smp_get_bsp(&cpu) != 0) + platform_smp_first_cpu(&cpu); + ticks_per_sec = platform_timebase_freq(&cpu); + msr = mfmsr(); mtmsr(msr & ~(PSL_EE)); - tc_init(&decr_timecounter); - ns_per_tick = 1000000000 / ticks_per_sec; ticks_per_intr = ticks_per_sec / hz; @@ -173,6 +167,15 @@ mftb (void) return tb; } +void +decr_tc_init(void) +{ + + decr_timecounter.tc_frequency = ticks_per_sec; + tc_init(&decr_timecounter); +} + + static unsigned decr_get_timecount(struct timecounter *tc) { |