From 1aa242105af219082ccb0ceefc0e460d9d59ea6c Mon Sep 17 00:00:00 2001 From: Glenn Washburn Date: Mon, 31 Jan 2022 11:15:04 -0600 Subject: ppc: fix ciface_milliseconds using incorrect frequency for delay Instead of using a constant frequency for all CPUs, use the processor timebase frequency provided by QEMU. 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 Signed-off-by: Mark Cave-Ayland --- 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 930b47c4..a423b9fa 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 ); } -- cgit v1.2.1