diff options
author | Xiang W <wxjstz@126.com> | 2021-09-16 12:32:50 +0800 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2021-09-22 13:38:39 +0530 |
commit | 51113fe2a5ac6b5a712f2e5393347bf24194c09b (patch) | |
tree | d5fb9d741b86020918219cd6b1b290622c991eaa | |
parent | 12753d22563f7d2d01f2c6644c7b66b06eb5c90f (diff) |
lib: sbi: Add BUG() macro for csr_read/write_num() and misa_string()
We use BUG() macro in csr_read_num(), csr_write_num(), and
misa_string() functions for unhandled cases.
Signed-off-by: Xiang W <wxjstz@126.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
-rw-r--r-- | lib/sbi/riscv_asm.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/sbi/riscv_asm.c b/lib/sbi/riscv_asm.c index d7b9b2b..f6b8c8e 100644 --- a/lib/sbi/riscv_asm.c +++ b/lib/sbi/riscv_asm.c @@ -11,6 +11,7 @@ #include <sbi/riscv_encoding.h> #include <sbi/sbi_error.h> #include <sbi/sbi_platform.h> +#include <sbi/sbi_console.h> /* determine CPU extension, return non-zero support */ int misa_extension_imp(char ext) @@ -75,6 +76,7 @@ void misa_string(int xlen, char *out, unsigned int out_sz) out[pos++] = '8'; break; default: + BUG(); return; } } @@ -134,6 +136,7 @@ unsigned long csr_read_num(int csr_num) #endif default: + BUG(); break; }; @@ -197,6 +200,7 @@ void csr_write_num(int csr_num, unsigned long val) switchcase_csr_write_16(CSR_MHPMEVENT16, val) default: + BUG(); break; }; |