]> git.proxmox.com Git - mirror_qemu.git/blob - hw/arm/xlnx-ep108.c
Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-peter' into staging
[mirror_qemu.git] / hw / arm / xlnx-ep108.c
1 /*
2 * Xilinx ZynqMP EP108 board
3 *
4 * Copyright (C) 2015 Xilinx Inc
5 * Written by Peter Crosthwaite <peter.crosthwaite@xilinx.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * for more details.
16 */
17
18 #include "qemu/osdep.h"
19 #include "hw/arm/xlnx-zynqmp.h"
20 #include "hw/boards.h"
21 #include "qemu/error-report.h"
22 #include "exec/address-spaces.h"
23
24 typedef struct XlnxEP108 {
25 XlnxZynqMPState soc;
26 MemoryRegion ddr_ram;
27 } XlnxEP108;
28
29 static struct arm_boot_info xlnx_ep108_binfo;
30
31 static void xlnx_ep108_init(MachineState *machine)
32 {
33 XlnxEP108 *s = g_new0(XlnxEP108, 1);
34 Error *err = NULL;
35 uint64_t ram_size = machine->ram_size;
36
37 /* Create the memory region to pass to the SoC */
38 if (ram_size > XLNX_ZYNQMP_MAX_RAM_SIZE) {
39 error_report("ERROR: RAM size 0x%" PRIx64 " above max supported of "
40 "0x%llx", ram_size,
41 XLNX_ZYNQMP_MAX_RAM_SIZE);
42 exit(1);
43 }
44
45 if (ram_size < 0x08000000) {
46 qemu_log("WARNING: RAM size 0x%" PRIx64 " is small for EP108",
47 ram_size);
48 }
49
50 memory_region_allocate_system_memory(&s->ddr_ram, NULL, "ddr-ram",
51 ram_size);
52
53 object_initialize(&s->soc, sizeof(s->soc), TYPE_XLNX_ZYNQMP);
54 object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc),
55 &error_abort);
56
57 object_property_set_link(OBJECT(&s->soc), OBJECT(&s->ddr_ram),
58 "ddr-ram", &error_abort);
59
60 object_property_set_bool(OBJECT(&s->soc), true, "realized", &err);
61 if (err) {
62 error_report_err(err);
63 exit(1);
64 }
65
66 xlnx_ep108_binfo.ram_size = ram_size;
67 xlnx_ep108_binfo.kernel_filename = machine->kernel_filename;
68 xlnx_ep108_binfo.kernel_cmdline = machine->kernel_cmdline;
69 xlnx_ep108_binfo.initrd_filename = machine->initrd_filename;
70 xlnx_ep108_binfo.loader_start = 0;
71 arm_load_kernel(s->soc.boot_cpu_ptr, &xlnx_ep108_binfo);
72 }
73
74 static void xlnx_ep108_machine_init(MachineClass *mc)
75 {
76 mc->desc = "Xilinx ZynqMP EP108 board";
77 mc->init = xlnx_ep108_init;
78 }
79
80 DEFINE_MACHINE("xlnx-ep108", xlnx_ep108_machine_init)