Scott Wood | 4d5c29c | 2012-07-02 13:03:21 +0000 | [diff] [blame] | 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" |
Paolo Bonzini | 7948b4b | 2013-02-03 20:18:28 +0100 | [diff] [blame] | 15 | #include "hw/boards.h" |
Paolo Bonzini | 9c17d61 | 2012-12-17 18:20:04 +0100 | [diff] [blame] | 16 | #include "sysemu/device_tree.h" |
| 17 | #include "hw/pci/pci.h" |
Paolo Bonzini | 0d09e41 | 2013-02-05 17:06:20 +0100 | [diff] [blame] | 18 | #include "hw/ppc/openpic.h" |
Scott Wood | 4d5c29c | 2012-07-02 13:03:21 +0000 | [diff] [blame] | 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 | |
Eduardo Habkost | 5f072e1 | 2012-10-15 17:22:02 -0300 | [diff] [blame] | 30 | static void e500plat_init(QEMUMachineInitArgs *args) |
Scott Wood | 4d5c29c | 2012-07-02 13:03:21 +0000 | [diff] [blame] | 31 | { |
Eduardo Habkost | 5f072e1 | 2012-10-15 17:22:02 -0300 | [diff] [blame] | 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; |
Scott Wood | 4d5c29c | 2012-07-02 13:03:21 +0000 | [diff] [blame] | 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, |
Alexander Graf | 3bb7e02 | 2012-12-12 14:58:30 +0100 | [diff] [blame] | 45 | .pci_first_slot = 0x1, |
| 46 | .pci_nr_slots = PCI_SLOT_MAX - 1, |
Scott Wood | 4d5c29c | 2012-07-02 13:03:21 +0000 | [diff] [blame] | 47 | .fixup_devtree = e500plat_fixup_devtree, |
Scott Wood | f5fba9d | 2013-01-21 15:53:55 +0000 | [diff] [blame] | 48 | .mpic_version = OPENPIC_MODEL_FSL_MPIC_42, |
Scott Wood | 4d5c29c | 2012-07-02 13:03:21 +0000 | [diff] [blame] | 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, |
Scott Wood | f5fba9d | 2013-01-21 15:53:55 +0000 | [diff] [blame] | 58 | .max_cpus = 32, |
Avik Sil | e4ada29 | 2013-01-08 12:36:30 +0530 | [diff] [blame] | 59 | DEFAULT_MACHINE_OPTIONS, |
Scott Wood | 4d5c29c | 2012-07-02 13:03:21 +0000 | [diff] [blame] | 60 | }; |
| 61 | |
| 62 | static void e500plat_machine_init(void) |
| 63 | { |
| 64 | qemu_register_machine(&e500plat_machine); |
| 65 | } |
| 66 | |
| 67 | machine_init(e500plat_machine_init); |