xref: /openbmc/qemu/hw/ppc/e500plat.c (revision 3bb7e02a)
14d5c29caSScott Wood /*
24d5c29caSScott Wood  * Generic device-tree-driven paravirt PPC e500 platform
34d5c29caSScott Wood  *
44d5c29caSScott Wood  * Copyright 2012 Freescale Semiconductor, Inc.
54d5c29caSScott Wood  *
64d5c29caSScott Wood  * This is free software; you can redistribute it and/or modify
74d5c29caSScott Wood  * it under the terms of  the GNU General  Public License as published by
84d5c29caSScott Wood  * the Free Software Foundation;  either version 2 of the  License, or
94d5c29caSScott Wood  * (at your option) any later version.
104d5c29caSScott Wood  */
114d5c29caSScott Wood 
124d5c29caSScott Wood #include "config.h"
134d5c29caSScott Wood #include "qemu-common.h"
144d5c29caSScott Wood #include "e500.h"
154d5c29caSScott Wood #include "../boards.h"
164d5c29caSScott Wood #include "device_tree.h"
17*3bb7e02aSAlexander Graf #include "hw/pci.h"
184d5c29caSScott Wood 
194d5c29caSScott Wood static void e500plat_fixup_devtree(PPCE500Params *params, void *fdt)
204d5c29caSScott Wood {
214d5c29caSScott Wood     const char model[] = "QEMU ppce500";
224d5c29caSScott Wood     const char compatible[] = "fsl,qemu-e500";
234d5c29caSScott Wood 
244d5c29caSScott Wood     qemu_devtree_setprop(fdt, "/", "model", model, sizeof(model));
254d5c29caSScott Wood     qemu_devtree_setprop(fdt, "/", "compatible", compatible,
264d5c29caSScott Wood                          sizeof(compatible));
274d5c29caSScott Wood }
284d5c29caSScott Wood 
295f072e1fSEduardo Habkost static void e500plat_init(QEMUMachineInitArgs *args)
304d5c29caSScott Wood {
315f072e1fSEduardo Habkost     ram_addr_t ram_size = args->ram_size;
325f072e1fSEduardo Habkost     const char *boot_device = args->boot_device;
335f072e1fSEduardo Habkost     const char *cpu_model = args->cpu_model;
345f072e1fSEduardo Habkost     const char *kernel_filename = args->kernel_filename;
355f072e1fSEduardo Habkost     const char *kernel_cmdline = args->kernel_cmdline;
365f072e1fSEduardo Habkost     const char *initrd_filename = args->initrd_filename;
374d5c29caSScott Wood     PPCE500Params params = {
384d5c29caSScott Wood         .ram_size = ram_size,
394d5c29caSScott Wood         .boot_device = boot_device,
404d5c29caSScott Wood         .kernel_filename = kernel_filename,
414d5c29caSScott Wood         .kernel_cmdline = kernel_cmdline,
424d5c29caSScott Wood         .initrd_filename = initrd_filename,
434d5c29caSScott Wood         .cpu_model = cpu_model,
44*3bb7e02aSAlexander Graf         .pci_first_slot = 0x1,
45*3bb7e02aSAlexander Graf         .pci_nr_slots = PCI_SLOT_MAX - 1,
464d5c29caSScott Wood         .fixup_devtree = e500plat_fixup_devtree,
474d5c29caSScott Wood     };
484d5c29caSScott Wood 
494d5c29caSScott Wood     ppce500_init(&params);
504d5c29caSScott Wood }
514d5c29caSScott Wood 
524d5c29caSScott Wood static QEMUMachine e500plat_machine = {
534d5c29caSScott Wood     .name = "ppce500",
544d5c29caSScott Wood     .desc = "generic paravirt e500 platform",
554d5c29caSScott Wood     .init = e500plat_init,
564d5c29caSScott Wood     .max_cpus = 15,
574d5c29caSScott Wood };
584d5c29caSScott Wood 
594d5c29caSScott Wood static void e500plat_machine_init(void)
604d5c29caSScott Wood {
614d5c29caSScott Wood     qemu_register_machine(&e500plat_machine);
624d5c29caSScott Wood }
634d5c29caSScott Wood 
644d5c29caSScott Wood machine_init(e500plat_machine_init);
65