summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Washburn <development@efficientek.com>2022-01-31 11:15:04 -0600
committerMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2022-02-08 21:26:31 +0000
commit1aa242105af219082ccb0ceefc0e460d9d59ea6c (patch)
tree587033e128acbdd9db9c393336bd1baf3f27e744
parente2d6176ce9ea1a09453f42d7e8eaf24b5ee4cede (diff)
downloadqemu-openbios-1aa242105af219082ccb0ceefc0e460d9d59ea6c.tar.gz
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 <development@efficientek.com> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
-rw-r--r--arch/ppc/qemu/methods.c5
1 files 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 );
}