lib: sbi: Using one array to define the name of extensions

Define an array sbi_hart_ext to map extension ID and name , and use it
for ISA parsing and printing out the supported extensions.

Signed-off-by: Yong-Xuan Wang <yongxuan.wang@sifive.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Yong-Xuan Wang
2023-12-12 08:58:34 +00:00
committed by Anup Patel
parent 056fe6f85d
commit 776770d2ad
3 changed files with 31 additions and 50 deletions

View File

@@ -401,8 +401,10 @@ static int fdt_parse_isa_one_hart(const char *isa, unsigned long *extensions)
continue; \
}
set_multi_letter_ext("smepmp", SBI_HART_EXT_SMEPMP);
set_multi_letter_ext("zkr", SBI_HART_EXT_ZKR);
for (j = 0; j < SBI_HART_EXT_MAX; j++) {
set_multi_letter_ext(sbi_hart_ext[j].name,
sbi_hart_ext[j].id);
}
#undef set_multi_letter_ext
}