]>
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 | ||
082587b7 PC |
28 | static struct arm_boot_info xlnx_ep108_binfo; |
29 | ||
859a0c5b PC |
30 | static void xlnx_ep108_init(MachineState *machine) |
31 | { | |
32 | XlnxEP108 *s = g_new0(XlnxEP108, 1); | |
33 | Error *err = NULL; | |
dc3b89ef AF |
34 | uint64_t ram_size = machine->ram_size; |
35 | ||
36 | /* Create the memory region to pass to the SoC */ | |
37 | if (ram_size > XLNX_ZYNQMP_MAX_RAM_SIZE) { | |
38 | error_report("ERROR: RAM size 0x%" PRIx64 " above max supported of " | |
39 | "0x%llx", ram_size, | |
40 | XLNX_ZYNQMP_MAX_RAM_SIZE); | |
41 | exit(1); | |
42 | } | |
43 | ||
44 | if (ram_size < 0x08000000) { | |
45 | qemu_log("WARNING: RAM size 0x%" PRIx64 " is small for EP108", | |
46 | ram_size); | |
47 | } | |
48 | ||
49 | memory_region_allocate_system_memory(&s->ddr_ram, NULL, "ddr-ram", | |
50 | ram_size); | |
859a0c5b PC |
51 | |
52 | object_initialize(&s->soc, sizeof(s->soc), TYPE_XLNX_ZYNQMP); | |
53 | object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc), | |
54 | &error_abort); | |
55 | ||
dc3b89ef AF |
56 | object_property_set_link(OBJECT(&s->soc), OBJECT(&s->ddr_ram), |
57 | "ddr-ram", &error_abort); | |
58 | ||
859a0c5b PC |
59 | object_property_set_bool(OBJECT(&s->soc), true, "realized", &err); |
60 | if (err) { | |
4fffeb5e | 61 | error_report_err(err); |
859a0c5b PC |
62 | exit(1); |
63 | } | |
b79b9d28 | 64 | |
dc3b89ef | 65 | xlnx_ep108_binfo.ram_size = ram_size; |
082587b7 PC |
66 | xlnx_ep108_binfo.kernel_filename = machine->kernel_filename; |
67 | xlnx_ep108_binfo.kernel_cmdline = machine->kernel_cmdline; | |
68 | xlnx_ep108_binfo.initrd_filename = machine->initrd_filename; | |
69 | xlnx_ep108_binfo.loader_start = 0; | |
6396a193 | 70 | arm_load_kernel(s->soc.boot_cpu_ptr, &xlnx_ep108_binfo); |
859a0c5b PC |
71 | } |
72 | ||
e264d29d | 73 | static void xlnx_ep108_machine_init(MachineClass *mc) |
859a0c5b | 74 | { |
e264d29d EH |
75 | mc->desc = "Xilinx ZynqMP EP108 board"; |
76 | mc->init = xlnx_ep108_init; | |
859a0c5b PC |
77 | } |
78 | ||
e264d29d | 79 | DEFINE_MACHINE("xlnx-ep108", xlnx_ep108_machine_init) |