[OpenBIOS] [PATCH] PPC: Add "real" CPU timebase-frequency override NVRAM variable
Alexander Graf
agraf at csgraf.de
Sat Jun 29 15:04:30 CEST 2013
Am 29.06.2013 um 13:27 schrieb Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>:
> Some older OS (particularly Darwin) will get stuck in a timing loop upon
> boot if the CPU clock-frequency and timebase-frequency aren't set close
> enough to "real" values.
>
> The clock-frequency property is already fairly realistic, so create a new
> boolean NVRAM variable "force-real-tbfreq?" which when set to true will
> override the timebase-frequency value supplied by QEMU/KVM with that similar
> to a real Mac.
>
> Hence it is possible to boot these old OS from QEMU by adding the following
> to the QEMU command line: -prom-env 'force-real-tbfreq?=true' (although of
> course the guest timing may be inaccurate).
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
> CC: Alexander Graf <agraf at csgraf.de>
I think I'd prefer a QEMU option to modify the timebase for real. That would change the emulated frequency as well as the one it exposes to OpenBIOS.
Alex
> ---
> openbios-devel/arch/ppc/qemu/init.c | 10 +++++++++-
> openbios-devel/forth/admin/nvram.fs | 1 +
> 2 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/openbios-devel/arch/ppc/qemu/init.c b/openbios-devel/arch/ppc/qemu/init.c
> index fcbd04d..60a5303 100644
> --- a/openbios-devel/arch/ppc/qemu/init.c
> +++ b/openbios-devel/arch/ppc/qemu/init.c
> @@ -258,7 +258,15 @@ cpu_generic_init(const struct cpudef *cpu)
> push_str("icache-block-size");
> fword("property");
>
> - PUSH(fw_cfg_read_i32(FW_CFG_PPC_TBFREQ));
> + /* Some OS (early Darwin) require a value of timebase-frequency
> + that closely matches real hardware in order to prevent a
> + timing loop hang. Use CLOCKFREQ / 16 as a good approximation. */
> + fword("force-real-tbfreq?");
> + if (POP()) {
> + PUSH(fw_cfg_read_i32(FW_CFG_PPC_CLOCKFREQ) / 0x10);
> + } else {
> + PUSH(fw_cfg_read_i32(FW_CFG_PPC_TBFREQ));
> + }
> fword("encode-int");
> push_str("timebase-frequency");
> fword("property");
> diff --git a/openbios-devel/forth/admin/nvram.fs b/openbios-devel/forth/admin/nvram.fs
> index 20f6462..cf3e905 100644
> --- a/openbios-devel/forth/admin/nvram.fs
> +++ b/openbios-devel/forth/admin/nvram.fs
> @@ -336,6 +336,7 @@ s" -1" s" real-size" int-config
> s" 4000000" s" load-base" int-config
> s" -1" s" virt-base" int-config
> s" -1" s" virt-size" int-config
> +s" false" s" force-real-tbfreq?" bool-config
> [THEN]
>
> [IFDEF] CONFIG_X86
> --
> 1.7.10.4
>
More information about the OpenBIOS
mailing list