xref: /openbmc/qemu/hw/ppc/e500plat.c (revision 5f072e1f)
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"
174d5c29caSScott Wood 
184d5c29caSScott Wood static void e500plat_fixup_devtree(PPCE500Params *params, void *fdt)
194d5c29caSScott Wood {
204d5c29caSScott Wood     const char model[] = "QEMU ppce500";
214d5c29caSScott Wood     const char compatible[] = "fsl,qemu-e500";
224d5c29caSScott Wood 
234d5c29caSScott Wood     qemu_devtree_setprop(fdt, "/", "model", model, sizeof(model));
244d5c29caSScott Wood     qemu_devtree_setprop(fdt, "/", "compatible", compatible,
254d5c29caSScott Wood                          sizeof(compatible));
264d5c29caSScott Wood }
274d5c29caSScott Wood 
28*5f072e1fSEduardo Habkost static void e500plat_init(QEMUMachineInitArgs *args)
294d5c29caSScott Wood {
30*5f072e1fSEduardo Habkost     ram_addr_t ram_size = args->ram_size;
31*5f072e1fSEduardo Habkost     const char *boot_device = args->boot_device;
32*5f072e1fSEduardo Habkost     const char *cpu_model = args->cpu_model;
33*5f072e1fSEduardo Habkost     const char *kernel_filename = args->kernel_filename;
34*5f072e1fSEduardo Habkost     const char *kernel_cmdline = args->kernel_cmdline;
35*5f072e1fSEduardo Habkost     const char *initrd_filename = args->initrd_filename;
364d5c29caSScott Wood     PPCE500Params params = {
374d5c29caSScott Wood         .ram_size = ram_size,
384d5c29caSScott Wood         .boot_device = boot_device,
394d5c29caSScott Wood         .kernel_filename = kernel_filename,
404d5c29caSScott Wood         .kernel_cmdline = kernel_cmdline,
414d5c29caSScott Wood         .initrd_filename = initrd_filename,
424d5c29caSScott Wood         .cpu_model = cpu_model,
434d5c29caSScott Wood         .fixup_devtree = e500plat_fixup_devtree,
444d5c29caSScott Wood     };
454d5c29caSScott Wood 
464d5c29caSScott Wood     ppce500_init(&params);
474d5c29caSScott Wood }
484d5c29caSScott Wood 
494d5c29caSScott Wood static QEMUMachine e500plat_machine = {
504d5c29caSScott Wood     .name = "ppce500",
514d5c29caSScott Wood     .desc = "generic paravirt e500 platform",
524d5c29caSScott Wood     .init = e500plat_init,
534d5c29caSScott Wood     .max_cpus = 15,
544d5c29caSScott Wood };
554d5c29caSScott Wood 
564d5c29caSScott Wood static void e500plat_machine_init(void)
574d5c29caSScott Wood {
584d5c29caSScott Wood     qemu_register_machine(&e500plat_machine);
594d5c29caSScott Wood }
604d5c29caSScott Wood 
614d5c29caSScott Wood machine_init(e500plat_machine_init);
62