[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH RFC v1 29/29] target-arc: sample board
From: |
Michael Rolnik |
Subject: |
[Qemu-devel] [PATCH RFC v1 29/29] target-arc: sample board |
Date: |
Fri, 9 Sep 2016 01:32:10 +0300 |
Signed-off-by: Michael Rolnik <address@hidden>
---
MAINTAINERS | 1 +
hw/arc/Makefile.objs | 21 ++++++++++++++
hw/arc/sample.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 102 insertions(+)
create mode 100644 hw/arc/Makefile.objs
create mode 100644 hw/arc/sample.c
diff --git a/MAINTAINERS b/MAINTAINERS
index 0500cf5..6d7ce0b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -103,6 +103,7 @@ ARC
M: Michael Rolnik <address@hidden>
S: Maintained
F: target-arc/
+F: hw/arc
ARM
M: Peter Maydell <address@hidden>
diff --git a/hw/arc/Makefile.objs b/hw/arc/Makefile.objs
new file mode 100644
index 0000000..5ac5cb7
--- /dev/null
+++ b/hw/arc/Makefile.objs
@@ -0,0 +1,21 @@
+#
+# QEMU ARC CPU
+#
+# Copyright (c) 2016 Michael Rolnik
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# 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/lgpl-2.1.html>
+#
+
+obj-y += sample.o
diff --git a/hw/arc/sample.c b/hw/arc/sample.c
new file mode 100644
index 0000000..e8620af
--- /dev/null
+++ b/hw/arc/sample.c
@@ -0,0 +1,80 @@
+/*
+ * QEMU ARC CPU
+ *
+ * Copyright (c) 2016 Michael Rolnik
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * 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/lgpl-2.1.html>
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "qemu-common.h"
+#include "cpu.h"
+#include "hw/hw.h"
+#include "sysemu/sysemu.h"
+#include "sysemu/qtest.h"
+#include "ui/console.h"
+#include "hw/boards.h"
+#include "hw/devices.h"
+#include "hw/loader.h"
+#include "qemu/error-report.h"
+#include "exec/address-spaces.h"
+#include "include/hw/sysbus.h"
+
+#define SIZE_RAM 0x00020000
+
+static void sample_init(MachineState *machine)
+{
+ MemoryRegion *mem;
+ MemoryRegion *ram;
+
+ ARCCPU *cpu_arc ATTRIBUTE_UNUSED;
+
+ mem = g_new(MemoryRegion, 1);
+ ram = g_new(MemoryRegion, 1);
+
+ cpu_arc = cpu_arc_init("any");
+
+ memory_region_allocate_system_memory(mem, NULL, "arc.mem", SIZE_RAM);
+
+ memory_region_init_ram(ram, NULL, "ram", SIZE_RAM, &error_fatal);
+ memory_region_add_subregion(get_system_memory(), PHYS_BASE_RAM, ram);
+ vmstate_register_ram_global(ram);
+
+ char const *firmware = NULL;
+ char const *filename;
+
+ if (machine->firmware) {
+ firmware = machine->firmware;
+ }
+
+ filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, firmware);
+ if (!filename) {
+ error_report("Could not find flash image file '%s'", firmware);
+ exit(1);
+ }
+
+ load_image_targphys(filename, PHYS_BASE_RAM + 0x100, SIZE_RAM);
+}
+
+static void sample_machine_init(MachineClass *mc)
+{
+ mc->desc = "ARC sample/example board";
+ mc->init = sample_init;
+ mc->is_default = 1;
+}
+
+DEFINE_MACHINE("sample", sample_machine_init)
+
--
2.4.9 (Apple Git-60)
- [Qemu-devel] [PATCH RFC v1 22/29] target-arc: ASLS, ASRS, (continued)
- [Qemu-devel] [PATCH RFC v1 22/29] target-arc: ASLS, ASRS, Michael Rolnik, 2016/09/08
- [Qemu-devel] [PATCH RFC v1 20/29] target-arc: ADDS, ADDSDW, SUBS, SUBSDW, Michael Rolnik, 2016/09/08
- [Qemu-devel] [PATCH RFC v1 21/29] target-arc: ABSS, ABSSW, NEGS, NEGSW, RND16, SAT16, Michael Rolnik, 2016/09/08
- [Qemu-devel] [PATCH RFC v1 23/29] target-arc: FLAG, BRK, SLEEP, Michael Rolnik, 2016/09/08
- [Qemu-devel] [PATCH RFC v1 25/29] target-arc: TRAP, SWI, Michael Rolnik, 2016/09/08
- [Qemu-devel] [PATCH RFC v1 24/29] target-arc: NOP, UNIMP, Michael Rolnik, 2016/09/08
- [Qemu-devel] [PATCH RFC v1 26/29] target-arc: RTIE, Michael Rolnik, 2016/09/08
- [Qemu-devel] [PATCH RFC v1 27/29] target-arc: LP, Michael Rolnik, 2016/09/08
- [Qemu-devel] [PATCH RFC v1 29/29] target-arc: sample board,
Michael Rolnik <=
- [Qemu-devel] [PATCH RFC v1 28/29] target-arc: decode, Michael Rolnik, 2016/09/08
- Re: [Qemu-devel] [PATCH RFC v1 00/29] ARC cores, Alexey Brodkin, 2016/09/16