macio-ide: add to storage category
[qemu/ar7.git] / hw / arm / xlnx-ep108.c
blob2899698443ce9986b84d1a7ffd2625523eb9b575
1 /*
2 * Xilinx ZynqMP EP108 board
4 * Copyright (C) 2015 Xilinx Inc
5 * Written by Peter Crosthwaite <peter.crosthwaite@xilinx.com>
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.
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.
18 #include "hw/arm/xlnx-zynqmp.h"
19 #include "hw/boards.h"
20 #include "qemu/error-report.h"
21 #include "exec/address-spaces.h"
23 typedef struct XlnxEP108 {
24 XlnxZynqMPState soc;
25 MemoryRegion ddr_ram;
26 } XlnxEP108;
28 /* Max 2GB RAM */
29 #define EP108_MAX_RAM_SIZE 0x80000000ull
31 static struct arm_boot_info xlnx_ep108_binfo;
33 static void xlnx_ep108_init(MachineState *machine)
35 XlnxEP108 *s = g_new0(XlnxEP108, 1);
36 Error *err = NULL;
38 object_initialize(&s->soc, sizeof(s->soc), TYPE_XLNX_ZYNQMP);
39 object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc),
40 &error_abort);
42 object_property_set_bool(OBJECT(&s->soc), true, "realized", &err);
43 if (err) {
44 error_report("%s", error_get_pretty(err));
45 exit(1);
48 if (machine->ram_size > EP108_MAX_RAM_SIZE) {
49 error_report("WARNING: RAM size " RAM_ADDR_FMT " above max supported, "
50 "reduced to %llx", machine->ram_size, EP108_MAX_RAM_SIZE);
51 machine->ram_size = EP108_MAX_RAM_SIZE;
54 if (machine->ram_size <= 0x08000000) {
55 qemu_log("WARNING: RAM size " RAM_ADDR_FMT " is small for EP108",
56 machine->ram_size);
59 memory_region_allocate_system_memory(&s->ddr_ram, NULL, "ddr-ram",
60 machine->ram_size);
61 memory_region_add_subregion(get_system_memory(), 0, &s->ddr_ram);
63 xlnx_ep108_binfo.ram_size = machine->ram_size;
64 xlnx_ep108_binfo.kernel_filename = machine->kernel_filename;
65 xlnx_ep108_binfo.kernel_cmdline = machine->kernel_cmdline;
66 xlnx_ep108_binfo.initrd_filename = machine->initrd_filename;
67 xlnx_ep108_binfo.loader_start = 0;
68 arm_load_kernel(s->soc.boot_cpu_ptr, &xlnx_ep108_binfo);
71 static void xlnx_ep108_machine_init(MachineClass *mc)
73 mc->desc = "Xilinx ZynqMP EP108 board";
74 mc->init = xlnx_ep108_init;
77 DEFINE_MACHINE("xlnx-ep108", xlnx_ep108_machine_init)