blob: 7292ce12900ef232508687ab90c990b35b538551 [file] [log] [blame]
Scott Wood4d5c29c2012-07-02 13:03:21 +00001/*
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 Bonzini7948b4b2013-02-03 20:18:28 +010015#include "hw/boards.h"
Paolo Bonzini9c17d612012-12-17 18:20:04 +010016#include "sysemu/device_tree.h"
17#include "hw/pci/pci.h"
Paolo Bonzini0d09e412013-02-05 17:06:20 +010018#include "hw/ppc/openpic.h"
Scott Wood4d5c29c2012-07-02 13:03:21 +000019
20static 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 Habkost5f072e12012-10-15 17:22:02 -030030static void e500plat_init(QEMUMachineInitArgs *args)
Scott Wood4d5c29c2012-07-02 13:03:21 +000031{
Eduardo Habkost5f072e12012-10-15 17:22:02 -030032 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 Wood4d5c29c2012-07-02 13:03:21 +000038 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 Graf3bb7e022012-12-12 14:58:30 +010045 .pci_first_slot = 0x1,
46 .pci_nr_slots = PCI_SLOT_MAX - 1,
Scott Wood4d5c29c2012-07-02 13:03:21 +000047 .fixup_devtree = e500plat_fixup_devtree,
Scott Woodf5fba9d2013-01-21 15:53:55 +000048 .mpic_version = OPENPIC_MODEL_FSL_MPIC_42,
Scott Wood4d5c29c2012-07-02 13:03:21 +000049 };
50
51 ppce500_init(&params);
52}
53
54static QEMUMachine e500plat_machine = {
55 .name = "ppce500",
56 .desc = "generic paravirt e500 platform",
57 .init = e500plat_init,
Scott Woodf5fba9d2013-01-21 15:53:55 +000058 .max_cpus = 32,
Avik Sile4ada292013-01-08 12:36:30 +053059 DEFAULT_MACHINE_OPTIONS,
Scott Wood4d5c29c2012-07-02 13:03:21 +000060};
61
62static void e500plat_machine_init(void)
63{
64 qemu_register_machine(&e500plat_machine);
65}
66
67machine_init(e500plat_machine_init);