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
This commit is contained in:
Peter Grehan 2007-11-13 15:47:55 +00:00
parent 95d0af0c53
commit 2058844493
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=173584
5 changed files with 27 additions and 8 deletions

View File

@ -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)
{

View File

@ -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. */

View File

@ -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);

View File

@ -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)
{

View File

@ -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. */