1 /* 2 * Generic device-tree-driven paravirt PPC e500 platform 3 * 4 * Copyright 2012 Freescale Semiconductor, Inc. 5 * 6 * This is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 */ 11 12 #include "config.h" 13 #include "qemu-common.h" 14 #include "e500.h" 15 #include "../boards.h" 16 #include "sysemu/device_tree.h" 17 #include "hw/pci/pci.h" 18 #include "hw/openpic.h" 19 20 static void e500plat_fixup_devtree(PPCE500Params *params, void *fdt) 21 { 22 const char model[] = "QEMU ppce500"; 23 const char compatible[] = "fsl,qemu-e500"; 24 25 qemu_devtree_setprop(fdt, "/", "model", model, sizeof(model)); 26 qemu_devtree_setprop(fdt, "/", "compatible", compatible, 27 sizeof(compatible)); 28 } 29 30 static void e500plat_init(QEMUMachineInitArgs *args) 31 { 32 ram_addr_t ram_size = args->ram_size; 33 const char *boot_device = args->boot_device; 34 const char *cpu_model = args->cpu_model; 35 const char *kernel_filename = args->kernel_filename; 36 const char *kernel_cmdline = args->kernel_cmdline; 37 const char *initrd_filename = args->initrd_filename; 38 PPCE500Params params = { 39 .ram_size = ram_size, 40 .boot_device = boot_device, 41 .kernel_filename = kernel_filename, 42 .kernel_cmdline = kernel_cmdline, 43 .initrd_filename = initrd_filename, 44 .cpu_model = cpu_model, 45 .pci_first_slot = 0x1, 46 .pci_nr_slots = PCI_SLOT_MAX - 1, 47 .fixup_devtree = e500plat_fixup_devtree, 48 .mpic_version = OPENPIC_MODEL_FSL_MPIC_42, 49 }; 50 51 ppce500_init(¶ms); 52 } 53 54 static QEMUMachine e500plat_machine = { 55 .name = "ppce500", 56 .desc = "generic paravirt e500 platform", 57 .init = e500plat_init, 58 .max_cpus = 32, 59 DEFAULT_MACHINE_OPTIONS, 60 }; 61 62 static void e500plat_machine_init(void) 63 { 64 qemu_register_machine(&e500plat_machine); 65 } 66 67 machine_init(e500plat_machine_init); 68