]>
Commit | Line | Data |
---|---|---|
859a0c5b PC |
1 | /* |
2 | * Xilinx ZynqMP EP108 board | |
3 | * | |
4 | * Copyright (C) 2015 Xilinx Inc | |
5 | * Written by Peter Crosthwaite <[email protected]> | |
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 "hw/arm/xlnx-zynqmp.h" | |
19 | #include "hw/boards.h" | |
20 | #include "qemu/error-report.h" | |
b79b9d28 | 21 | #include "exec/address-spaces.h" |
859a0c5b PC |
22 | |
23 | typedef struct XlnxEP108 { | |
24 | XlnxZynqMPState soc; | |
b79b9d28 | 25 | MemoryRegion ddr_ram; |
859a0c5b PC |
26 | } XlnxEP108; |
27 | ||
b79b9d28 PC |
28 | /* Max 2GB RAM */ |
29 | #define EP108_MAX_RAM_SIZE 0x80000000ull | |
30 | ||
082587b7 PC |
31 | static struct arm_boot_info xlnx_ep108_binfo; |
32 | ||
859a0c5b PC |
33 | static void xlnx_ep108_init(MachineState *machine) |
34 | { | |
35 | XlnxEP108 *s = g_new0(XlnxEP108, 1); | |
36 | Error *err = NULL; | |
37 | ||
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); | |
41 | ||
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); | |
46 | } | |
b79b9d28 PC |
47 | |
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; | |
52 | } | |
53 | ||
54 | if (machine->ram_size <= 0x08000000) { | |
55 | qemu_log("WARNING: RAM size " RAM_ADDR_FMT " is small for EP108", | |
56 | machine->ram_size); | |
57 | } | |
58 | ||
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); | |
082587b7 PC |
62 | |
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; | |
2e5577bc | 68 | arm_load_kernel(&s->soc.apu_cpu[0], &xlnx_ep108_binfo); |
859a0c5b PC |
69 | } |
70 | ||
71 | static QEMUMachine xlnx_ep108_machine = { | |
72 | .name = "xlnx-ep108", | |
73 | .desc = "Xilinx ZynqMP EP108 board", | |
74 | .init = xlnx_ep108_init, | |
75 | }; | |
76 | ||
77 | static void xlnx_ep108_machine_init(void) | |
78 | { | |
79 | qemu_register_machine(&xlnx_ep108_machine); | |
80 | } | |
81 | ||
82 | machine_init(xlnx_ep108_machine_init); |