[OpenBIOS] [RFC] Incorrect CPU timebase-frequency and clock-frequency in OpenBIOS

William Hahne will07c5 at gmail.com
Wed Aug 10 02:02:13 CEST 2011


Hello,

I would like to apologize for not splitting up my last post. I am a Google
Summer of Code student working on getting Mac OS X to work in Qemu.

Currently the cpu device in OpenBIOS has incorrect timebase-frequency and
clock-frequency properties. The Mac OS X scheduler relies on these values to
calculate the length of a timeslice. Both values are taken from fw_cfg by
OpenBIOS. The problem with timebase-frequency is that the value is far too
high. Mac OS X depends on this value being sufficiently smaller than
clock-frequency. The value for clock-frequency no longer even exists in
fw_cfg and is therefore reported as 0. Mac OS X needs some value here even
if it doesn't indicate an actual cpu frequency. The patch below for OpenBIOS
provides some fake values that work, but since the values are hard-coded
into OpenBIOS, it isn't a very nice solution.

The best solutions I can think of are to either compute clock-frequency in
OpenBIOS or have Qemu provide a value even if its purpose is only to appease
Mac OS X or any other OS that depends on the value. If the timebase
frequency is correct than it can be lowered otherwise it can be corrected. I
am posting this RFC to get thoughts more on what to do with clock-frequency.
For reference the timebase frequency is from the fw_cfg
value FW_CFG_PPC_TBFREQ and clock frequency is from FW_CFG_PPC_CPUFREQ.

Thanks,
William Hahne


Index: arch/ppc/qemu/init.c
===================================================================
--- arch/ppc/qemu/init.c (revision 1041)
+++ arch/ppc/qemu/init.c (working copy)
@@ -250,12 +250,14 @@
     push_str("icache-block-size");
     fword("property");

-    PUSH(fw_cfg_read_i32(FW_CFG_PPC_TBFREQ));
+    /* XXX - Mac OS X needs valid values for timebase-frequency and
clock-frequency
+       for scheduling to work. These are just temporary values and
shouldn't be hardcoded here. */
+    PUSH(16600000);
     fword("encode-int");
     push_str("timebase-frequency");
     fword("property");

-    PUSH(fw_cfg_read_i32(FW_CFG_PPC_CPUFREQ));
+    PUSH(266000000);
     fword("encode-int");
     push_str("clock-frequency");
     fword("property");
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openbios.org/pipermail/openbios/attachments/20110809/daa03769/attachment.html>


More information about the OpenBIOS mailing list