Hi, On 07.01.2017 16:23, Hervé Poussineau wrote: > Machine supports both Open Hack'Ware and OpenBIOS. > Open Hack'Ware is the default because OpenBIOS is currently unable to boot > PReP boot partitions or PReP kernels. > > Signed-off-by: Hervé Poussineau <hpous...@reactos.org> > --- > default-configs/ppc-softmmu.mak | 1 + > hw/ppc/prep.c | 229 > ++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 230 insertions(+) > > diff --git a/default-configs/ppc-softmmu.mak b/default-configs/ppc-softmmu.mak > index e567658..7dd004e 100644 > --- a/default-configs/ppc-softmmu.mak > +++ b/default-configs/ppc-softmmu.mak > @@ -18,6 +18,7 @@ CONFIG_I82378=y > CONFIG_PC87312=y > CONFIG_MACIO=y > CONFIG_PCSPK=y > +CONFIG_CS4231A=y > CONFIG_CUDA=y > CONFIG_ADB=y > CONFIG_MAC_NVRAM=y > diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c > index 9fb89d3..9bdf573 100644 > --- a/hw/ppc/prep.c > +++ b/hw/ppc/prep.c > @@ -2,6 +2,7 @@ > * QEMU PPC PREP hardware System Emulator > * > * Copyright (c) 2003-2007 Jocelyn Mayer > + * Copyright (c) 2017 Hervé Poussineau > * > * Permission is hereby granted, free of charge, to any person obtaining a > copy > * of this software and associated documentation files (the "Software"), to > deal > @@ -43,6 +44,7 @@ > #include "hw/isa/pc87312.h" > #include "sysemu/block-backend.h" > #include "sysemu/arch_init.h" > +#include "sysemu/kvm.h" > #include "sysemu/qtest.h" > #include "exec/address-spaces.h" > #include "trace.h" > @@ -54,6 +56,8 @@ > > #define MAX_IDE_BUS 2 > > +#define CFG_ADDR 0xf0000510 > + > #define BIOS_SIZE (1024 * 1024) > #define BIOS_FILENAME "ppc_rom.bin" > #define KERNEL_LOAD_ADDR 0x01000000 > @@ -316,6 +320,12 @@ static uint32_t PREP_io_800_readb (void *opaque, > uint32_t addr) > > #define NVRAM_SIZE 0x2000 > > +static void fw_cfg_boot_set(void *opaque, const char *boot_device, > + Error **errp) > +{ > + fw_cfg_modify_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]); > +} > + > static void ppc_prep_reset(void *opaque) > { > PowerPCCPU *cpu = opaque; > @@ -677,4 +687,223 @@ static void prep_machine_init(MachineClass *mc) [...] > + > + fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_IS_KVM, kvm_enabled()); > + if (kvm_enabled()) { > +#ifdef CONFIG_KVM > + uint8_t *hypercall; > + > + fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_TBFREQ, kvmppc_get_tbfreq()); > + hypercall = g_malloc(16); > + kvmppc_get_hypercall(env, hypercall, 16); > + fw_cfg_add_bytes(fw_cfg, FW_CFG_PPC_KVM_HC, hypercall, 16); > + fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_KVM_PID, getpid()); > +#endif
This currently does not compile on a ppc64 host where CONFIG_KVM is set: hw/ppc/prep.c: In function ‘ibm_40p_init’: hw/ppc/prep.c:872:9: error: implicit declaration of function ‘kvmppc_get_tbfreq’ [-Werror=implicit-function-declaration] fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_TBFREQ, kvmppc_get_tbfreq()); ^ hw/ppc/prep.c:872:9: error: nested extern declaration of ‘kvmppc_get_tbfreq’ [-Werror=nested-externs] hw/ppc/prep.c:874:9: error: implicit declaration of function ‘kvmppc_get_hypercall’ [-Werror=implicit-function-declaration] kvmppc_get_hypercall(env, hypercall, 16); ^ hw/ppc/prep.c:874:9: error: nested extern declaration of ‘kvmppc_get_hypercall’ [-Werror=nested-externs] You need to #include "kvm_ppc.h" to get the prototype of the kvmppc_get_tbfreq() function. Thomas