diff options
author | grehan <grehan@FreeBSD.org> | 2007-11-13 15:47:55 +0000 |
---|---|---|
committer | grehan <grehan@FreeBSD.org> | 2007-11-13 15:47:55 +0000 |
commit | 243c15922e80e6b88947bd58974b7e7c3e74414c (patch) | |
tree | afa6afcdacc1a084ce4732b6de8c442040e954b1 /sys | |
parent | f026c7be9448bfb99bf9a7551e922faa58801f56 (diff) | |
download | FreeBSD-src-243c15922e80e6b88947bd58974b7e7c3e74414c.zip FreeBSD-src-243c15922e80e6b88947bd58974b7e7c3e74414c.tar.gz |
Split decr_init() into two, with the section that reads the timebase
frequency from OpenFirmware moved out and into a routine that is called
from cpu_startup().
This allows correct reporting of the CPU clockspeed when printing out
CPU information at boot time.
Reported by: numerous
Reviewed by: marcel
MFC after: 1 day
Diffstat (limited to 'sys')
-rw-r--r-- | sys/powerpc/aim/clock.c | 10 | ||||
-rw-r--r-- | sys/powerpc/aim/machdep.c | 7 | ||||
-rw-r--r-- | sys/powerpc/include/md_var.h | 1 | ||||
-rw-r--r-- | sys/powerpc/powerpc/clock.c | 10 | ||||
-rw-r--r-- | sys/powerpc/powerpc/machdep.c | 7 |
5 files changed, 27 insertions, 8 deletions
diff --git a/sys/powerpc/aim/clock.c b/sys/powerpc/aim/clock.c index 4b03d36..0c01cf0 100644 --- a/sys/powerpc/aim/clock.c +++ b/sys/powerpc/aim/clock.c @@ -233,9 +233,6 @@ decr_init(void) msr = mfmsr(); mtmsr(msr & ~(PSL_EE|PSL_RI)); - decr_timecounter.tc_frequency = ticks_per_sec; - tc_init(&decr_timecounter); - ns_per_tick = 1000000000 / ticks_per_sec; ticks_per_intr = ticks_per_sec / hz; __asm __volatile ("mftb %0" : "=r"(lasttb)); @@ -257,6 +254,13 @@ decr_init(void) panic("no cpu node"); } +void +decr_tc_init(void) +{ + decr_timecounter.tc_frequency = ticks_per_sec; + tc_init(&decr_timecounter); +} + static __inline u_quad_t mftb(void) { diff --git a/sys/powerpc/aim/machdep.c b/sys/powerpc/aim/machdep.c index 0d771e1..7cea2c0 100644 --- a/sys/powerpc/aim/machdep.c +++ b/sys/powerpc/aim/machdep.c @@ -188,6 +188,11 @@ cpu_startup(void *dummy) { /* + * Initialise the decrementer-based clock. + */ + decr_init(); + + /* * Good {morning,afternoon,evening,night}. */ cpu_setup(PCPU_GET(cpuid)); @@ -714,7 +719,7 @@ void cpu_initclocks(void) { - decr_init(); + decr_tc_init(); } /* Get current clock frequency for the given cpu id. */ diff --git a/sys/powerpc/include/md_var.h b/sys/powerpc/include/md_var.h index 73249ad..567b190 100644 --- a/sys/powerpc/include/md_var.h +++ b/sys/powerpc/include/md_var.h @@ -55,6 +55,7 @@ int is_physical_memory(vm_offset_t addr); int mem_valid(vm_offset_t addr, int len); void decr_init(void); +void decr_tc_init(void); void cpu_setup(u_int); diff --git a/sys/powerpc/powerpc/clock.c b/sys/powerpc/powerpc/clock.c index 4b03d36..0c01cf0 100644 --- a/sys/powerpc/powerpc/clock.c +++ b/sys/powerpc/powerpc/clock.c @@ -233,9 +233,6 @@ decr_init(void) msr = mfmsr(); mtmsr(msr & ~(PSL_EE|PSL_RI)); - decr_timecounter.tc_frequency = ticks_per_sec; - tc_init(&decr_timecounter); - ns_per_tick = 1000000000 / ticks_per_sec; ticks_per_intr = ticks_per_sec / hz; __asm __volatile ("mftb %0" : "=r"(lasttb)); @@ -257,6 +254,13 @@ decr_init(void) panic("no cpu node"); } +void +decr_tc_init(void) +{ + decr_timecounter.tc_frequency = ticks_per_sec; + tc_init(&decr_timecounter); +} + static __inline u_quad_t mftb(void) { diff --git a/sys/powerpc/powerpc/machdep.c b/sys/powerpc/powerpc/machdep.c index 0d771e1..7cea2c0 100644 --- a/sys/powerpc/powerpc/machdep.c +++ b/sys/powerpc/powerpc/machdep.c @@ -188,6 +188,11 @@ cpu_startup(void *dummy) { /* + * Initialise the decrementer-based clock. + */ + decr_init(); + + /* * Good {morning,afternoon,evening,night}. */ cpu_setup(PCPU_GET(cpuid)); @@ -714,7 +719,7 @@ void cpu_initclocks(void) { - decr_init(); + decr_tc_init(); } /* Get current clock frequency for the given cpu id. */ |