From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53610) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z2nSF-0004PX-Ty for qemu-devel@nongnu.org; Wed, 10 Jun 2015 17:22:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z2nSD-0001LG-0Z for qemu-devel@nongnu.org; Wed, 10 Jun 2015 17:22:35 -0400 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Wed, 10 Jun 2015 23:18:55 +0200 Message-Id: <1433971135-24587-5-git-send-email-hpoussin@reactos.org> In-Reply-To: <1433971135-24587-1-git-send-email-hpoussin@reactos.org> References: <1433971135-24587-1-git-send-email-hpoussin@reactos.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 4/4] prep: add IBM RS/6000 7020 (40p) machine emulation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , =?UTF-8?q?Andreas=20F=C3=A4rber?= , qemu-ppc@nongnu.org, Alexander Graf , Artyom Tarasenko Machine is very simple (only one PCI host bridge and an ISA bridge). Provide a ibm_40p.cfg file to add more devices to this machine. Syntax is: qemu-system-ppc -M 40p -readconfig ibm_40p.cfg Signed-off-by: Herv=C3=A9 Poussineau --- default-configs/ppc-softmmu.mak | 2 + docs/ibm_40p.cfg | 42 +++++++++++++++++ hw/ppc/prep.c | 99 +++++++++++++++++++++++++++++++++++= ++++++ 3 files changed, 143 insertions(+) create mode 100644 docs/ibm_40p.cfg diff --git a/default-configs/ppc-softmmu.mak b/default-configs/ppc-softmm= u.mak index 070803c..260dfb9 100644 --- a/default-configs/ppc-softmmu.mak +++ b/default-configs/ppc-softmmu.mak @@ -19,6 +19,7 @@ CONFIG_I82378=3Dy CONFIG_PC87312=3Dy CONFIG_MACIO=3Dy CONFIG_PCSPK=3Dy +CONFIG_CS4231A=3Dy CONFIG_CUDA=3Dy CONFIG_ADB=3Dy CONFIG_MAC_NVRAM=3Dy @@ -46,6 +47,7 @@ CONFIG_PLATFORM_BUS=3Dy CONFIG_ETSEC=3Dy CONFIG_LIBDECNUMBER=3Dy # For PReP +CONFIG_VGA_S3=3Dy CONFIG_MC146818RTC=3Dy CONFIG_RS6000_DEBUG=3Dy CONFIG_RS6000_MC=3Dy diff --git a/docs/ibm_40p.cfg b/docs/ibm_40p.cfg new file mode 100644 index 0000000..a7e21b5 --- /dev/null +++ b/docs/ibm_40p.cfg @@ -0,0 +1,42 @@ +########################################################################= #### +# +# qemu-system-ppc -M 40 creates a bare machine with just the very essent= ial +# chipset devices being present: +# +# 00.0 - Host bridge +# 0b.0 - ISA bridge +# +# This config file documents the other devices and how they are +# created. You can simply use "-readconfig $thisfile" to create +# them all. +[device] + driver =3D "i8042" + +[device] + driver =3D "cs4231a" + iobase =3D "0x830" + irq =3D "10" + +[device] + driver =3D "pc87312" + config =3D "12" + +[device] + driver =3D "lsi53c810" + addr =3D "01.0" + +[device] + driver =3D "pcnet" + addr =3D "03.0" + +[device] + driver =3D "isa-m48t59" + iobase =3D "0x74" + +[device] + driver =3D "prep-systemio" + ibm-planar-id =3D "0xfc" + equipment =3D "0xc0" + +[device] + driver =3D "rs6000-debug" diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index 998ee2d..d051fba 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -699,6 +699,97 @@ static void ppc_prep_init(MachineState *machine) graphic_width, graphic_height, graphic_depth); } =20 +static int prep_set_cmos_checksum(DeviceState *dev, void *opaque) +{ + uint16_t checksum =3D *(uint16_t *)opaque; + ISADevice *rtc; + + rtc =3D ISA_DEVICE(object_dynamic_cast(OBJECT(dev), "mc146818rtc")); + if (rtc) { + rtc_set_memory(rtc, 0x2e, checksum & 0xff); + rtc_set_memory(rtc, 0x3e, checksum & 0xff); + rtc_set_memory(rtc, 0x2f, checksum >> 8); + rtc_set_memory(rtc, 0x3f, checksum >> 8); + } + return 0; +} + +static void ibm_40p_init(MachineState *machine) +{ + CPUPPCState *env =3D NULL; + uint16_t cmos_checksum; + PowerPCCPU *cpu; + DeviceState *dev; + SysBusDevice *pcihost; + PCIBus *pci_bus; + BusState *isa_bus; + + /* init CPU */ + if (!machine->cpu_model) { + machine->cpu_model =3D "604"; + } + cpu =3D cpu_ppc_init(machine->cpu_model); + if (cpu =3D=3D NULL) { + fprintf(stderr, "Unable to find PowerPC CPU definition\n"); + exit(1); + } + env =3D &cpu->env; + + if (env->flags & POWERPC_FLAG_RTC_CLK) { + /* POWER / PowerPC 601 RTC clock frequency is 7.8125 MHz */ + cpu_ppc_tb_init(env, 7812500UL); + } else { + /* Set time-base frequency to 100 Mhz */ + cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL); + } + qemu_register_reset(ppc_prep_reset, cpu); + if (PPC_INPUT(env) !=3D PPC_FLAGS_INPUT_6xx) { + hw_error("Only 6xx bus is supported on PREP machine\n"); + } + + /* PCI host */ + dev =3D qdev_create(NULL, "raven-pcihost"); + if (bios_name =3D=3D NULL) { + bios_name =3D "P12H0456.IMG"; + } + qdev_prop_set_string(dev, "bios-name", bios_name); + qdev_prop_set_uint32(dev, "elf-machine", ELF_MACHINE); + pcihost =3D SYS_BUS_DEVICE(dev); + object_property_add_child(qdev_get_machine(), "raven", OBJECT(dev), = NULL); + qdev_init_nofail(dev); + pci_bus =3D PCI_BUS(qdev_get_child_bus(dev, "pci.0")); + if (pci_bus =3D=3D NULL) { + fprintf(stderr, "Couldn't create PCI host controller.\n"); + exit(1); + } + + /* PCI -> ISA bridge */ + dev =3D DEVICE(pci_create_simple(pci_bus, PCI_DEVFN(11, 0), "i82378"= )); + cpu =3D POWERPC_CPU(first_cpu); + qdev_connect_gpio_out(dev, 0, + cpu->env.irq_inputs[PPC6xx_INPUT_INT]); + qdev_connect_gpio_out(dev, 1, + qemu_allocate_irq(cpu_request_exit, NULL, 0)); + sysbus_connect_irq(pcihost, 0, qdev_get_gpio_in(dev, 15)); + sysbus_connect_irq(pcihost, 1, qdev_get_gpio_in(dev, 13)); + sysbus_connect_irq(pcihost, 2, qdev_get_gpio_in(dev, 15)); + sysbus_connect_irq(pcihost, 3, qdev_get_gpio_in(dev, 13)); + isa_bus =3D qdev_get_child_bus(dev, "isa.0"); + + /* Memory controller */ + dev =3D DEVICE(isa_create(ISA_BUS(isa_bus), "rs6000-mc")); + qdev_prop_set_uint32(dev, "ram-size", machine->ram_size); + qdev_init_nofail(dev); + + /* initialize CMOS checksums */ + cmos_checksum =3D 0x6aa9; + qbus_walk_children(isa_bus, prep_set_cmos_checksum, NULL, NULL, NULL= , + &cmos_checksum); + + /* initialize audio subsystem */ + audio_init(); +} + static QEMUMachine prep_machine =3D { .name =3D "prep", .desc =3D "PowerPC PREP platform", @@ -707,9 +798,17 @@ static QEMUMachine prep_machine =3D { .default_boot_order =3D "cad", }; =20 +static QEMUMachine ibm_40p_machine =3D { + .name =3D "40p", + .desc =3D "IBM RS/6000 7020 (40p)", + .init =3D ibm_40p_init, + .max_cpus =3D 1, +}; + static void prep_machine_init(void) { qemu_register_machine(&prep_machine); + qemu_register_machine(&ibm_40p_machine); } =20 machine_init(prep_machine_init); --=20 2.1.4