lib: sbi: Improve misa_string() implementation

The RISC-V ISA string does not follow alphabetical order. Instead,
we have a RISC-V specific ordering of extensions in the RISC-V ISA
string. This patch improves misa_string() implementation to return
a valid RISC-V ISA string.

Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
This commit is contained in:
Anup Patel
2020-05-05 11:46:25 +05:30
committed by Anup Patel
parent 5338679ff0
commit dc38929dfb
3 changed files with 52 additions and 19 deletions

View File

@@ -173,19 +173,8 @@ int misa_extension_imp(char ext);
/* Get MXL field of misa, return -1 on error */
int misa_xlen(void);
static inline void misa_string(char *out, unsigned int out_sz)
{
unsigned long i;
for (i = 0; i < 26; i++) {
if (misa_extension_imp('A' + i)) {
*out = 'A' + i;
out++;
}
}
*out = '\0';
out++;
}
/* Get RISC-V ISA string representation */
void misa_string(int xlen, char *out, unsigned int out_sz);
int pmp_set(unsigned int n, unsigned long prot, unsigned long addr,
unsigned long log2len);