2024-08-02 13:18:18 +02:00
|
|
|
diff --git a/cmd/riscv/exception.c b/cmd/riscv/exception.c
|
2024-08-21 06:24:42 +02:00
|
|
|
index f38f454a0b..9de4effe47 100644
|
2024-08-02 13:18:18 +02:00
|
|
|
--- a/cmd/riscv/exception.c
|
|
|
|
+++ b/cmd/riscv/exception.c
|
2024-08-21 06:24:42 +02:00
|
|
|
@@ -56,6 +56,40 @@ static int do_undefined(struct cmd_tbl *cmdtp, int flag, int argc,
|
2024-08-02 13:18:18 +02:00
|
|
|
return CMD_RET_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
+static int do_sregs(struct cmd_tbl *cmdtp, int flag, int argc,
|
|
|
|
+ char *const argv[])
|
|
|
|
+{
|
2024-08-02 13:43:56 +02:00
|
|
|
+ ulong stvec, sie, sip, sstatus;
|
2024-08-02 13:18:18 +02:00
|
|
|
+
|
|
|
|
+ asm volatile ("fence");
|
|
|
|
+ asm volatile ("csrr %0, stvec" : "=r"(stvec) : );
|
|
|
|
+ asm volatile ("csrr %0, sie" : "=r"(sie) : );
|
2024-08-02 13:43:56 +02:00
|
|
|
+ asm volatile ("csrr %0, sip" : "=r"(sip) : );
|
2024-08-02 13:18:18 +02:00
|
|
|
+ asm volatile ("csrr %0, sstatus" : "=r"(sstatus) : );
|
|
|
|
+
|
2024-08-02 13:43:56 +02:00
|
|
|
+ printf("stvec : 0x%016lx\n", stvec);
|
|
|
|
+ printf("sie : 0x%016lx\n", sie);
|
|
|
|
+ printf("sip : 0x%016lx\n", sip);
|
|
|
|
+ printf("sstatus : 0x%016lx\n", sstatus);
|
|
|
|
+
|
|
|
|
+ return CMD_RET_SUCCESS;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int do_enable(struct cmd_tbl *cmdtp, int flag, int argc,
|
|
|
|
+ char *const argv[])
|
|
|
|
+{
|
|
|
|
+ ulong which = SIE_SSIE | SIE_SEIE | SIE_STIE;
|
|
|
|
+
|
|
|
|
+ asm volatile (
|
|
|
|
+ "csrsi sstatus, 2\n" /* Enable SIE */
|
|
|
|
+ "csrs sie, %0\n" /* Enable selected interrupts */
|
|
|
|
+ : /* no output */
|
|
|
|
+ : "r" (which)
|
|
|
|
+ );
|
2024-08-02 13:18:18 +02:00
|
|
|
+
|
|
|
|
+ return CMD_RET_SUCCESS;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
static struct cmd_tbl cmd_sub[] = {
|
|
|
|
U_BOOT_CMD_MKENT(compressed, CONFIG_SYS_MAXARGS, 1, do_compressed,
|
|
|
|
"", ""),
|
2024-08-21 06:24:42 +02:00
|
|
|
@@ -67,6 +101,10 @@ static struct cmd_tbl cmd_sub[] = {
|
2024-08-02 13:18:18 +02:00
|
|
|
"", ""),
|
|
|
|
U_BOOT_CMD_MKENT(undefined, CONFIG_SYS_MAXARGS, 1, do_undefined,
|
|
|
|
"", ""),
|
|
|
|
+ U_BOOT_CMD_MKENT(sregs, CONFIG_SYS_MAXARGS, 1, do_sregs,
|
2024-08-02 13:43:56 +02:00
|
|
|
+ "", ""),
|
|
|
|
+ U_BOOT_CMD_MKENT(enable, CONFIG_SYS_MAXARGS, 1, do_enable,
|
2024-08-02 13:18:18 +02:00
|
|
|
+ "", ""),
|
|
|
|
};
|
|
|
|
|
|
|
|
static char exception_help_text[] =
|
2024-08-21 06:24:42 +02:00
|
|
|
@@ -77,6 +115,8 @@ static char exception_help_text[] =
|
2024-08-02 13:18:18 +02:00
|
|
|
" ialign16 - 16 bit aligned instruction\n"
|
|
|
|
" undefined - illegal instruction\n"
|
|
|
|
" unaligned - load address misaligned\n"
|
|
|
|
+ " sregs - print supervisor registers\n"
|
2024-08-02 13:43:56 +02:00
|
|
|
+ " enable - enable supervisor interrupts\n"
|
2024-08-02 13:18:18 +02:00
|
|
|
;
|
|
|
|
|
|
|
|
#include <exception.h>
|