summaryrefslogtreecommitdiff
path: root/src/mainboard/emulation
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainboard/emulation')
-rw-r--r--src/mainboard/emulation/qemu-riscv/Makefile.inc1
-rw-r--r--src/mainboard/emulation/qemu-riscv/clint.c6
-rw-r--r--src/mainboard/emulation/spike-riscv/Makefile.inc1
-rw-r--r--src/mainboard/emulation/spike-riscv/clint.c6
4 files changed, 14 insertions, 0 deletions
diff --git a/src/mainboard/emulation/qemu-riscv/Makefile.inc b/src/mainboard/emulation/qemu-riscv/Makefile.inc
index eb99544c35..2ca75fdae1 100644
--- a/src/mainboard/emulation/qemu-riscv/Makefile.inc
+++ b/src/mainboard/emulation/qemu-riscv/Makefile.inc
@@ -19,6 +19,7 @@ bootblock-y += clint.c
romstage-y += romstage.c
romstage-y += uart.c
romstage-y += rom_media.c
+romstage-y += clint.c
ramstage-y += uart.c
ramstage-y += rom_media.c
diff --git a/src/mainboard/emulation/qemu-riscv/clint.c b/src/mainboard/emulation/qemu-riscv/clint.c
index 367d48d4ae..4a00bc2142 100644
--- a/src/mainboard/emulation/qemu-riscv/clint.c
+++ b/src/mainboard/emulation/qemu-riscv/clint.c
@@ -14,6 +14,7 @@
*/
#include <mcall.h>
+#include <device/mmio.h>
#include <mainboard/addressmap.h>
/* This function is used to initialize HLS()->time/HLS()->timecmp */
@@ -23,3 +24,8 @@ void mtime_init(void)
HLS()->time = (uint64_t *)(QEMU_VIRT_CLINT + 0xbff8);
HLS()->timecmp = (uint64_t *)(QEMU_VIRT_CLINT + 0x4000 + 8 * hart_id);
}
+
+void set_msip(int hartid, int val)
+{
+ write32((void *)(QEMU_VIRT_CLINT + 4 * (uintptr_t)hartid), !!val);
+}
diff --git a/src/mainboard/emulation/spike-riscv/Makefile.inc b/src/mainboard/emulation/spike-riscv/Makefile.inc
index 38977b6345..bfeaf58867 100644
--- a/src/mainboard/emulation/spike-riscv/Makefile.inc
+++ b/src/mainboard/emulation/spike-riscv/Makefile.inc
@@ -18,6 +18,7 @@ bootblock-y += clint.c
romstage-y += romstage.c
romstage-y += uart.c
romstage-y += rom_media.c
+romstage-y += clint.c
ramstage-y += uart.c
ramstage-y += rom_media.c
ramstage-y += clint.c
diff --git a/src/mainboard/emulation/spike-riscv/clint.c b/src/mainboard/emulation/spike-riscv/clint.c
index 7ad3f5a7af..c39e05831c 100644
--- a/src/mainboard/emulation/spike-riscv/clint.c
+++ b/src/mainboard/emulation/spike-riscv/clint.c
@@ -14,6 +14,7 @@
*/
#include <mcall.h>
+#include <device/mmio.h>
#define SPIKE_CLINT_BASE 0x02000000
@@ -24,3 +25,8 @@ void mtime_init(void)
HLS()->time = (uint64_t *)(SPIKE_CLINT_BASE + 0xbff8);
HLS()->timecmp = (uint64_t *)(SPIKE_CLINT_BASE + 0x4000 + 8 * hart_id);
}
+
+void set_msip(int hartid, int val)
+{
+ write32((void *)(SPIKE_CLINT_BASE + 4 * (uintptr_t)hartid), !!val);
+}