1e6eaabebSScott Wood /*
2e6eaabebSScott Wood * Support for the PPC e500-based mpc8544ds board
3e6eaabebSScott Wood *
4e6eaabebSScott Wood * Copyright 2012 Freescale Semiconductor, Inc.
5e6eaabebSScott Wood *
6e6eaabebSScott Wood * This is free software; you can redistribute it and/or modify
7e6eaabebSScott Wood * it under the terms of the GNU General Public License as published by
8e6eaabebSScott Wood * the Free Software Foundation; either version 2 of the License, or
9e6eaabebSScott Wood * (at your option) any later version.
10e6eaabebSScott Wood */
11e6eaabebSScott Wood
120d75590dSPeter Maydell #include "qemu/osdep.h"
13e6eaabebSScott Wood #include "e500.h"
149c17d615SPaolo Bonzini #include "sysemu/device_tree.h"
150d09e41aSPaolo Bonzini #include "hw/ppc/openpic.h"
1644045ce9SAlexander Graf #include "qemu/error-report.h"
1747a0b1dfSBernhard Beschow #include "qemu/units.h"
1859e816fdSIgor Mammedov #include "cpu.h"
19e6eaabebSScott Wood
mpc8544ds_fixup_devtree(void * fdt)2003f04809SIgor Mammedov static void mpc8544ds_fixup_devtree(void *fdt)
21e6eaabebSScott Wood {
22e6eaabebSScott Wood const char model[] = "MPC8544DS";
23e6eaabebSScott Wood const char compatible[] = "MPC8544DS\0MPC85xxDS";
24e6eaabebSScott Wood
255a4348d1SPeter Crosthwaite qemu_fdt_setprop(fdt, "/", "model", model, sizeof(model));
265a4348d1SPeter Crosthwaite qemu_fdt_setprop(fdt, "/", "compatible", compatible,
27e6eaabebSScott Wood sizeof(compatible));
28e6eaabebSScott Wood }
29e6eaabebSScott Wood
mpc8544ds_init(MachineState * machine)303ef96221SMarcel Apfelbaum static void mpc8544ds_init(MachineState *machine)
31e6eaabebSScott Wood {
3244045ce9SAlexander Graf if (machine->ram_size > 0xc0000000) {
3344045ce9SAlexander Graf error_report("The MPC8544DS board only supports up to 3GB of RAM");
3444045ce9SAlexander Graf exit(1);
3544045ce9SAlexander Graf }
3644045ce9SAlexander Graf
3703f04809SIgor Mammedov ppce500_init(machine);
38e6eaabebSScott Wood }
39e6eaabebSScott Wood
mpc8544ds_machine_class_init(ObjectClass * oc,void * data)4035ad5b74SBernhard Beschow static void mpc8544ds_machine_class_init(ObjectClass *oc, void *data)
41e6eaabebSScott Wood {
4203f04809SIgor Mammedov MachineClass *mc = MACHINE_CLASS(oc);
4303f04809SIgor Mammedov PPCE500MachineClass *pmc = PPCE500_MACHINE_CLASS(oc);
4403f04809SIgor Mammedov
4503f04809SIgor Mammedov pmc->pci_first_slot = 0x11;
4603f04809SIgor Mammedov pmc->pci_nr_slots = 2;
4703f04809SIgor Mammedov pmc->fixup_devtree = mpc8544ds_fixup_devtree;
4803f04809SIgor Mammedov pmc->mpic_version = OPENPIC_MODEL_FSL_MPIC_20;
4947a0b1dfSBernhard Beschow pmc->platform_bus_base = 0xFF800000ULL;
5047a0b1dfSBernhard Beschow pmc->platform_bus_size = 8 * MiB;
5147a0b1dfSBernhard Beschow pmc->platform_bus_first_irq = 5;
5247a0b1dfSBernhard Beschow pmc->platform_bus_num_irqs = 10;
5303f04809SIgor Mammedov pmc->ccsrbar_base = 0xE0000000ULL;
5403f04809SIgor Mammedov pmc->pci_mmio_base = 0xC0000000ULL;
5503f04809SIgor Mammedov pmc->pci_mmio_bus_base = 0xC0000000ULL;
5603f04809SIgor Mammedov pmc->pci_pio_base = 0xE1000000ULL;
5703f04809SIgor Mammedov pmc->spin_base = 0xEF000000ULL;
5803f04809SIgor Mammedov
59e264d29dSEduardo Habkost mc->desc = "mpc8544ds";
60e264d29dSEduardo Habkost mc->init = mpc8544ds_init;
61e264d29dSEduardo Habkost mc->max_cpus = 15;
6259e816fdSIgor Mammedov mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("e500v2_v30");
6397316645SIgor Mammedov mc->default_ram_id = "mpc8544ds.ram";
64*053b7086SThomas Huth mc->default_nic = "virtio-net-pci";
65e6eaabebSScott Wood }
66e6eaabebSScott Wood
6703f04809SIgor Mammedov #define TYPE_MPC8544DS_MACHINE MACHINE_TYPE_NAME("mpc8544ds")
6803f04809SIgor Mammedov
6903f04809SIgor Mammedov static const TypeInfo mpc8544ds_info = {
7003f04809SIgor Mammedov .name = TYPE_MPC8544DS_MACHINE,
7103f04809SIgor Mammedov .parent = TYPE_PPCE500_MACHINE,
7235ad5b74SBernhard Beschow .class_init = mpc8544ds_machine_class_init,
7303f04809SIgor Mammedov };
7403f04809SIgor Mammedov
mpc8544ds_register_types(void)7503f04809SIgor Mammedov static void mpc8544ds_register_types(void)
7603f04809SIgor Mammedov {
7703f04809SIgor Mammedov type_register_static(&mpc8544ds_info);
7803f04809SIgor Mammedov }
7903f04809SIgor Mammedov
8003f04809SIgor Mammedov type_init(mpc8544ds_register_types)
81