mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-24 15:31:22 +01:00
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>
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user