Instead of using a constant frequency for all CPUs, which have varying frequencies, use the time frequency as returned by the processor. This fixes issues where delays from ciface_milliseconds were not corresponding to elapsed time as given by the real time clock on certain platforms, eg. QEMU's mac99 machine.
Signed-off-by: Glenn Washburn development@efficientek.com --- Mark, if I missed something in the commit message, feel free to make edits as you see fit.
Glenn
--- arch/ppc/qemu/methods.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/ppc/qemu/methods.c b/arch/ppc/qemu/methods.c index 930b47c..a423b9f 100644 --- a/arch/ppc/qemu/methods.c +++ b/arch/ppc/qemu/methods.c @@ -126,7 +126,8 @@ ciface_quiesce( unsigned long args[], unsigned long ret[] ) }
/* ( -- ms ) */ -#define TIMER_FREQUENCY 16600000ULL +/* From drivers/timer.c */ +extern unsigned long timer_freq;
static void ciface_milliseconds( unsigned long args[], unsigned long ret[] ) @@ -146,7 +147,7 @@ ciface_milliseconds( unsigned long args[], unsigned long ret[] ) : "cc");
ticks = (((unsigned long long)tbu) << 32) | (unsigned long long)tbl; - msecs = (1000 * ticks) / TIMER_FREQUENCY; + msecs = (1000 * ticks) / timer_freq; PUSH( msecs ); }