From e47d2d582f6a1a3df2daf248f8074a6d3614bc6a Mon Sep 17 00:00:00 2001 From: Peter Grehan Date: Wed, 14 Nov 2007 16:41:31 +0000 Subject: MFC: 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. Approved by: re (Ken Smith) --- sys/powerpc/include/md_var.h | 1 + sys/powerpc/powerpc/clock.c | 10 +++++++--- sys/powerpc/powerpc/machdep.c | 7 ++++++- 3 files changed, 14 insertions(+), 4 deletions(-) (limited to 'sys/powerpc') diff --git a/sys/powerpc/include/md_var.h b/sys/powerpc/include/md_var.h index 73249ada278f..567b190876b8 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 4b03d369aaf6..0c01cf048911 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 98c40514bbaf..ed0ff8339abc 100644 --- a/sys/powerpc/powerpc/machdep.c +++ b/sys/powerpc/powerpc/machdep.c @@ -187,6 +187,11 @@ static void cpu_startup(void *dummy) { + /* + * Initialise the decrementer-based clock. + */ + decr_init(); + /* * Good {morning,afternoon,evening,night}. */ @@ -714,7 +719,7 @@ void cpu_initclocks(void) { - decr_init(); + decr_tc_init(); } /* Get current clock frequency for the given cpu id. */ -- cgit v1.3