[PATCH v2] lib: sbi: Add missing sscrind and sscfg extensions in sbi_hart_ext[]

Clément Léger cleger at rivosinc.com
Wed Mar 20 08:45:31 PDT 2024


The sbi_hart_ext[] array is missing these two extensions ids. It is
expected that this array contains all the extensions declaration at the
same index of the SBI_HART_EXT_* define. Without this, when adding a new
extension, there is a mismatch between ids and extension names and it
can even display corrupted extension names.

Signed-off-by: Clément Léger <cleger at rivosinc.com>

---

Changes in v2:
 - Add _Static_assert() to check sbi_hart_ext[] array size

---
 lib/sbi/sbi_hart.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c
index 3d13694..80efeaa 100644
--- a/lib/sbi/sbi_hart.c
+++ b/lib/sbi/sbi_hart.c
@@ -666,8 +666,13 @@ const struct sbi_hart_ext_data sbi_hart_ext[] = {
 	__SBI_HART_EXT_DATA(sdtrig, SBI_HART_EXT_SDTRIG),
 	__SBI_HART_EXT_DATA(smcsrind, SBI_HART_EXT_SMCSRIND),
 	__SBI_HART_EXT_DATA(smcdeleg, SBI_HART_EXT_SMCDELEG),
+	__SBI_HART_EXT_DATA(sscsrind, SBI_HART_EXT_SSCSRIND),
+	__SBI_HART_EXT_DATA(ssccfg, SBI_HART_EXT_SSCCFG),
 };
 
+_Static_assert(array_size(sbi_hart_ext) == SBI_HART_EXT_MAX,
+	       "sbi_hart_ext[] array should contain all extensions ids");
+
 /**
  * Get the hart extensions in string format
  *
-- 
2.43.0




More information about the opensbi mailing list