[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 03/16] test/qgraph: arm/xlinx-zynq-a9 machine node
From: |
Emanuele Giuseppe Esposito |
Subject: |
[Qemu-ppc] [PATCH 03/16] test/qgraph: arm/xlinx-zynq-a9 machine node |
Date: |
Mon, 20 Aug 2018 14:02:00 +0200 |
Add xlinx-zynq-a9 machine to the graph. This machine contains generic-sdhci, so
its constructor must take care of setting it properly when called.
Signed-off-by: Emanuele Giuseppe Esposito <address@hidden>
---
tests/Makefile.include | 1 +
tests/libqos/xilinx-zynq-a9-machine.c | 84 +++++++++++++++++++++++++++
tests/sdhci-test.c | 8 +--
3 files changed, 89 insertions(+), 4 deletions(-)
create mode 100644 tests/libqos/xilinx-zynq-a9-machine.c
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 4690d5f5e9..d559218b1c 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -760,6 +760,7 @@ libqgraph-arm-machines-obj-y = tests/libqos/raspi2-machine.o
libqgraph-arm-machines-obj-y += tests/libqos/virt-machine.o
libqgraph-arm-machines-obj-y += tests/libqos/smdkc210-machine.o
libqgraph-arm-machines-obj-y += tests/libqos/sabrelite-machine.o
+libqgraph-arm-machines-obj-y += tests/libqos/xilinx-zynq-a9-machine.o
libqgraph-machines-obj-y = $(libqgraph-arm-machines-obj-y)
libqgraph-machines-obj-y += tests/libqos/x86_64_pc-machine.o
diff --git a/tests/libqos/xilinx-zynq-a9-machine.c
b/tests/libqos/xilinx-zynq-a9-machine.c
new file mode 100644
index 0000000000..025cd80eb2
--- /dev/null
+++ b/tests/libqos/xilinx-zynq-a9-machine.c
@@ -0,0 +1,84 @@
+/*
+ * libqos driver framework
+ *
+ * Copyright (c) 2018 Emanuele Giuseppe Esposito <address@hidden>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>
+ */
+
+#include "qemu/osdep.h"
+#include "libqtest.h"
+#include "libqos/malloc.h"
+#include "libqos/qgraph.h"
+#include "sdhci.h"
+
+typedef struct QXilinx_zynq_a9Machine QXilinx_zynq_a9Machine;
+
+struct QXilinx_zynq_a9Machine {
+ QOSGraphObject obj;
+ QGuestAllocator *alloc;
+ QSDHCI_MemoryMapped sdhci;
+};
+
+static void xilinx_zynq_a9_destructor(QOSGraphObject *obj)
+{
+ g_free(obj);
+}
+
+static void *xilinx_zynq_a9_get_driver(void *object, const char *interface)
+{
+ QXilinx_zynq_a9Machine *machine = object;
+ if (!g_strcmp0(interface, "memory")) {
+ return &machine->alloc;
+ }
+
+ fprintf(stderr, "%s not present in arm/xilinx-zynq-a9\n", interface);
+ g_assert_not_reached();
+}
+
+static QOSGraphObject *xilinx_zynq_a9_get_device(void *obj, const char *device)
+{
+ QXilinx_zynq_a9Machine *machine = obj;
+ if (!g_strcmp0(device, "generic-sdhci")) {
+ return &machine->sdhci.obj;
+ }
+
+ fprintf(stderr, "%s not present in arm/xilinx-zynq-a9\n", device);
+ g_assert_not_reached();
+}
+
+static void *qos_create_machine_arm_xilinx_zynq_a9(void)
+{
+ QXilinx_zynq_a9Machine *machine = g_new0(QXilinx_zynq_a9Machine, 1);
+
+ machine->obj.get_device = xilinx_zynq_a9_get_device;
+ machine->obj.get_driver = xilinx_zynq_a9_get_driver;
+ machine->obj.destructor = xilinx_zynq_a9_destructor;
+ /* Datasheet: UG585 (v1.12.1) */
+ qos_init_sdhci_smm(&machine->sdhci, 0xe0100000, &(QSDHCIProperties) {
+ .version = 2,
+ .baseclock = 0,
+ .capab.sdma = true,
+ .capab.reg = 0x69ec0080,
+ });
+ return &machine->obj;
+}
+
+static void xilinx_zynq_a9_register_nodes(void)
+{
+ qos_node_create_machine("arm/xilinx-zynq-a9",
+ qos_create_machine_arm_xilinx_zynq_a9);
+ qos_node_contains("arm/xilinx-zynq-a9", "generic-sdhci", NULL);
+}
+
+libqos_init(xilinx_zynq_a9_register_nodes);
diff --git a/tests/sdhci-test.c b/tests/sdhci-test.c
index 31ecc06159..0a8efd8554 100644
--- a/tests/sdhci-test.c
+++ b/tests/sdhci-test.c
@@ -60,14 +60,14 @@ FIELD(SDHC_CAPAB, DRIVER, 36, 3); /*
since v3 */
{ "arm", "sabrelite",
{0x02190000, 3, 0, {1, 0x057834b4} } },
- *
- * FIXME: the following drivers are missing:
- *
-
Zynq-7000
{ "arm", "xilinx-zynq-a9", Datasheet: UG585 (v1.12.1)
{0xe0100000, 2, 0, {1, 0x69ec0080} } },
+ *
+ * FIXME: the following drivers are missing:
+ *
+
ZynqMP
{ "aarch64", "xlnx-zcu102", Datasheet: UG1085 (v1.7)
{0xff160000, 3, 0, {1, 0x280737ec6481} } },
--
2.17.1
- [Qemu-ppc] [PATCH 00/16] qtest: converted sdhci-test and most nop test to qgraph framework, Emanuele Giuseppe Esposito, 2018/08/20
- [Qemu-ppc] [PATCH 01/16] test/qgraph: arm/smdkc210 machine node, Emanuele Giuseppe Esposito, 2018/08/20
- [Qemu-ppc] [PATCH 02/16] test/qgraph: arm/sabrelite machine node, Emanuele Giuseppe Esposito, 2018/08/20
- [Qemu-ppc] [PATCH 06/16] test/qgraph: tpci200 test node, Emanuele Giuseppe Esposito, 2018/08/20
- [Qemu-ppc] [PATCH 03/16] test/qgraph: arm/xlinx-zynq-a9 machine node,
Emanuele Giuseppe Esposito <=
- [Qemu-ppc] [PATCH 05/16] test/qgraph: ac97 test node, Emanuele Giuseppe Esposito, 2018/08/20
- [Qemu-ppc] [PATCH 04/16] test/qgraph: aarch64/xlnx-zcu102 machine node, Emanuele Giuseppe Esposito, 2018/08/20
- [Qemu-ppc] [PATCH 08/16] test/qgraph: ne2k_pci test node, Emanuele Giuseppe Esposito, 2018/08/20
- [Qemu-ppc] [PATCH 07/16] test/qgraph: ipoctal232 test node, Emanuele Giuseppe Esposito, 2018/08/20
- [Qemu-ppc] [PATCH 11/16] test/qgraph: spapr-phb test node, Emanuele Giuseppe Esposito, 2018/08/20
- [Qemu-ppc] [PATCH 09/16] test/qgraph: nvme test node, Emanuele Giuseppe Esposito, 2018/08/20
- [Qemu-ppc] [PATCH 12/16] test/qgraph: usb-hcd-ohci test node, Emanuele Giuseppe Esposito, 2018/08/20
- [Qemu-ppc] [PATCH 14/16] test/qgraph: es1370 test node, Emanuele Giuseppe Esposito, 2018/08/20
- [Qemu-ppc] [PATCH 15/16] test/qgraph: eepro100 test node, Emanuele Giuseppe Esposito, 2018/08/20
- [Qemu-ppc] [PATCH 10/16] test/qgraph: pcnet test node, Emanuele Giuseppe Esposito, 2018/08/20