Add exception enable U-Boot command
This commit is contained in:
parent
055f03980c
commit
33fb07481a
@ -219,7 +219,7 @@
|
|||||||
patches = [
|
patches = [
|
||||||
#./u-boot-debug.patch
|
#./u-boot-debug.patch
|
||||||
./uboot-debug-ext-interrupts.patch
|
./uboot-debug-ext-interrupts.patch
|
||||||
./uboot-sregs.patch
|
./uboot-exception-extras.patch
|
||||||
];
|
];
|
||||||
#
|
#
|
||||||
# CONFIG_SERIAL_PRESENT=n
|
# CONFIG_SERIAL_PRESENT=n
|
||||||
|
@ -1,24 +1,41 @@
|
|||||||
diff --git a/cmd/riscv/exception.c b/cmd/riscv/exception.c
|
diff --git a/cmd/riscv/exception.c b/cmd/riscv/exception.c
|
||||||
index f38f454a0b..87877ab235 100644
|
index f38f454a0b..9de4effe47 100644
|
||||||
--- a/cmd/riscv/exception.c
|
--- a/cmd/riscv/exception.c
|
||||||
+++ b/cmd/riscv/exception.c
|
+++ b/cmd/riscv/exception.c
|
||||||
@@ -56,6 +56,23 @@ static int do_undefined(struct cmd_tbl *cmdtp, int flag, int argc,
|
@@ -56,6 +56,40 @@ static int do_undefined(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||||
return CMD_RET_FAILURE;
|
return CMD_RET_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
+static int do_sregs(struct cmd_tbl *cmdtp, int flag, int argc,
|
+static int do_sregs(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||||
+ char *const argv[])
|
+ char *const argv[])
|
||||||
+{
|
+{
|
||||||
+ ulong stvec, sie, sstatus;
|
+ ulong stvec, sie, sip, sstatus;
|
||||||
+
|
+
|
||||||
+ asm volatile ("fence");
|
+ asm volatile ("fence");
|
||||||
+ asm volatile ("csrr %0, stvec" : "=r"(stvec) : );
|
+ asm volatile ("csrr %0, stvec" : "=r"(stvec) : );
|
||||||
+ asm volatile ("csrr %0, sie" : "=r"(sie) : );
|
+ asm volatile ("csrr %0, sie" : "=r"(sie) : );
|
||||||
|
+ asm volatile ("csrr %0, sip" : "=r"(sip) : );
|
||||||
+ asm volatile ("csrr %0, sstatus" : "=r"(sstatus) : );
|
+ asm volatile ("csrr %0, sstatus" : "=r"(sstatus) : );
|
||||||
+
|
+
|
||||||
+ printf("stvec : 0x%08lx\n", stvec);
|
+ printf("stvec : 0x%016lx\n", stvec);
|
||||||
+ printf("sie : 0x%08lx\n", sie);
|
+ printf("sie : 0x%016lx\n", sie);
|
||||||
+ printf("sstatus : 0x%08lx\n", sstatus);
|
+ 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)
|
||||||
|
+ );
|
||||||
+
|
+
|
||||||
+ return CMD_RET_SUCCESS;
|
+ return CMD_RET_SUCCESS;
|
||||||
+}
|
+}
|
||||||
@ -26,20 +43,23 @@ index f38f454a0b..87877ab235 100644
|
|||||||
static struct cmd_tbl cmd_sub[] = {
|
static struct cmd_tbl cmd_sub[] = {
|
||||||
U_BOOT_CMD_MKENT(compressed, CONFIG_SYS_MAXARGS, 1, do_compressed,
|
U_BOOT_CMD_MKENT(compressed, CONFIG_SYS_MAXARGS, 1, do_compressed,
|
||||||
"", ""),
|
"", ""),
|
||||||
@@ -67,6 +84,8 @@ static struct cmd_tbl cmd_sub[] = {
|
@@ -67,6 +101,10 @@ static struct cmd_tbl cmd_sub[] = {
|
||||||
"", ""),
|
"", ""),
|
||||||
U_BOOT_CMD_MKENT(undefined, CONFIG_SYS_MAXARGS, 1, do_undefined,
|
U_BOOT_CMD_MKENT(undefined, CONFIG_SYS_MAXARGS, 1, do_undefined,
|
||||||
"", ""),
|
"", ""),
|
||||||
+ U_BOOT_CMD_MKENT(sregs, CONFIG_SYS_MAXARGS, 1, do_sregs,
|
+ U_BOOT_CMD_MKENT(sregs, CONFIG_SYS_MAXARGS, 1, do_sregs,
|
||||||
|
+ "", ""),
|
||||||
|
+ U_BOOT_CMD_MKENT(enable, CONFIG_SYS_MAXARGS, 1, do_enable,
|
||||||
+ "", ""),
|
+ "", ""),
|
||||||
};
|
};
|
||||||
|
|
||||||
static char exception_help_text[] =
|
static char exception_help_text[] =
|
||||||
@@ -77,6 +96,7 @@ static char exception_help_text[] =
|
@@ -77,6 +115,8 @@ static char exception_help_text[] =
|
||||||
" ialign16 - 16 bit aligned instruction\n"
|
" ialign16 - 16 bit aligned instruction\n"
|
||||||
" undefined - illegal instruction\n"
|
" undefined - illegal instruction\n"
|
||||||
" unaligned - load address misaligned\n"
|
" unaligned - load address misaligned\n"
|
||||||
+ " sregs - print supervisor registers\n"
|
+ " sregs - print supervisor registers\n"
|
||||||
|
+ " enable - enable supervisor interrupts\n"
|
||||||
;
|
;
|
||||||
|
|
||||||
#include <exception.h>
|
#include <exception.h>
|
Loading…
Reference in New Issue
Block a user