summaryrefslogtreecommitdiffstats
path: root/recipes-devtools/qemu/qemu-zynqmp-mainline/0003-arm-Introduce-Xilinx-ZynqMP-SoC.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-devtools/qemu/qemu-zynqmp-mainline/0003-arm-Introduce-Xilinx-ZynqMP-SoC.patch')
-rw-r--r--recipes-devtools/qemu/qemu-zynqmp-mainline/0003-arm-Introduce-Xilinx-ZynqMP-SoC.patch145
1 files changed, 145 insertions, 0 deletions
diff --git a/recipes-devtools/qemu/qemu-zynqmp-mainline/0003-arm-Introduce-Xilinx-ZynqMP-SoC.patch b/recipes-devtools/qemu/qemu-zynqmp-mainline/0003-arm-Introduce-Xilinx-ZynqMP-SoC.patch
new file mode 100644
index 00000000..eb5740e0
--- /dev/null
+++ b/recipes-devtools/qemu/qemu-zynqmp-mainline/0003-arm-Introduce-Xilinx-ZynqMP-SoC.patch
@@ -0,0 +1,145 @@
1From 7f403cd27dbef216c77faa32d015965dfa5fe34e Mon Sep 17 00:00:00 2001
2From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
3Date: Mon, 23 Mar 2015 04:05:13 -0700
4Subject: [PATCH 03/15] arm: Introduce Xilinx ZynqMP SoC
5
6With quad Cortex-A53 CPUs.
7
8Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
9Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
10---
11 default-configs/aarch64-softmmu.mak | 2 +-
12 hw/arm/Makefile.objs | 1 +
13 hw/arm/xlnx-zynqmp.c | 72 +++++++++++++++++++++++++++++++++++
14 include/hw/arm/xlnx-zynqmp.h | 21 ++++++++++
15 4 files changed, 95 insertions(+), 1 deletion(-)
16 create mode 100644 hw/arm/xlnx-zynqmp.c
17 create mode 100644 include/hw/arm/xlnx-zynqmp.h
18
19diff --git a/default-configs/aarch64-softmmu.mak b/default-configs/aarch64-softmmu.mak
20index 6d3b5c7..96dd994 100644
21--- a/default-configs/aarch64-softmmu.mak
22+++ b/default-configs/aarch64-softmmu.mak
23@@ -3,4 +3,4 @@
24 # We support all the 32 bit boards so need all their config
25 include arm-softmmu.mak
26
27-# Currently no 64-bit specific config requirements
28+CONFIG_XLNX_ZYNQMP=y
29diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs
30index 2577f68..d7cd5f4 100644
31--- a/hw/arm/Makefile.objs
32+++ b/hw/arm/Makefile.objs
33@@ -10,3 +10,4 @@ obj-$(CONFIG_DIGIC) += digic.o
34 obj-y += omap1.o omap2.o strongarm.o
35 obj-$(CONFIG_ALLWINNER_A10) += allwinner-a10.o cubieboard.o
36 obj-$(CONFIG_STM32F205_SOC) += stm32f205_soc.o
37+obj-$(CONFIG_XLNX_ZYNQMP) += xlnx-zynqmp.o
38diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
39new file mode 100644
40index 0000000..41c207a
41--- /dev/null
42+++ b/hw/arm/xlnx-zynqmp.c
43@@ -0,0 +1,72 @@
44+/*
45+ * Xilinx Zynq MPSoC emulation
46+ *
47+ * Copyright (C) 2015 Xilinx Inc
48+ * Written by Peter Crosthwaite <peter.crosthwaite@xilinx.com>
49+ *
50+ * This program is free software; you can redistribute it and/or modify it
51+ * under the terms of the GNU General Public License as published by the
52+ * Free Software Foundation; either version 2 of the License, or
53+ * (at your option) any later version.
54+ *
55+ * This program is distributed in the hope that it will be useful, but WITHOUT
56+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
57+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
58+ * for more details.
59+ */
60+
61+#include "hw/arm/xlnx-zynqmp.h"
62+
63+static void xlnx_zynqmp_init(Object *obj)
64+{
65+ XlnxZynqMPState *s = XLNX_ZYNQMP(obj);
66+ int i;
67+
68+ for (i = 0; i < XLNX_ZYNQMP_NUM_CPUS; i++) {
69+ object_initialize(&s->cpu[i], sizeof(s->cpu[i]),
70+ "cortex-a53-" TYPE_ARM_CPU);
71+ object_property_add_child(obj, "cpu[*]", OBJECT(&s->cpu[i]),
72+ &error_abort);
73+ }
74+}
75+
76+#define ERR_PROP_CHECK_RETURN(err, errp) do { \
77+ if (err) { \
78+ error_propagate((errp), (err)); \
79+ return; \
80+ } \
81+} while (0)
82+
83+static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
84+{
85+ XlnxZynqMPState *s = XLNX_ZYNQMP(dev);
86+ uint8_t i;
87+ Error *err = NULL;
88+
89+ for (i = 0; i < XLNX_ZYNQMP_NUM_CPUS; i++) {
90+ object_property_set_bool(OBJECT(&s->cpu[i]), true, "realized", &err);
91+ ERR_PROP_CHECK_RETURN(err, errp);
92+ }
93+}
94+
95+static void xlnx_zynqmp_class_init(ObjectClass *oc, void *data)
96+{
97+ DeviceClass *dc = DEVICE_CLASS(oc);
98+
99+ dc->realize = xlnx_zynqmp_realize;
100+}
101+
102+static const TypeInfo xlnx_zynqmp_type_info = {
103+ .name = TYPE_XLNX_ZYNQMP,
104+ .parent = TYPE_DEVICE,
105+ .instance_size = sizeof(XlnxZynqMPState),
106+ .instance_init = xlnx_zynqmp_init,
107+ .class_init = xlnx_zynqmp_class_init,
108+};
109+
110+static void xlnx_zynqmp_register_types(void)
111+{
112+ type_register_static(&xlnx_zynqmp_type_info);
113+}
114+
115+type_init(xlnx_zynqmp_register_types)
116diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h
117new file mode 100644
118index 0000000..d6b3b92
119--- /dev/null
120+++ b/include/hw/arm/xlnx-zynqmp.h
121@@ -0,0 +1,21 @@
122+#ifndef XLNX_ZYNQMP_H_
123+
124+#include "qemu-common.h"
125+#include "hw/arm/arm.h"
126+
127+#define TYPE_XLNX_ZYNQMP "xlnx,zynqmp"
128+#define XLNX_ZYNQMP(obj) OBJECT_CHECK(XlnxZynqMPState, (obj), \
129+ TYPE_XLNX_ZYNQMP)
130+
131+#define XLNX_ZYNQMP_NUM_CPUS 4
132+
133+typedef struct XlnxZynqMPState {
134+ /*< private >*/
135+ DeviceState parent_obj;
136+ /*< public >*/
137+
138+ ARMCPU cpu[XLNX_ZYNQMP_NUM_CPUS];
139+} XlnxZynqMPState;
140+
141+#define XLNX_ZYNQMP_H_
142+#endif
143--
1441.7.10.4
145