Skip to content

Commit 2f4109e

Browse files
committed
create a variable for the ext data array
On some platforms, opensbi fails as the loop in fdt_parse_isa_one_hart is for 32 items, and the array is only 15 at present. Signed-off-by: Ronald G Minnich <rminnich@gmail.com>
1 parent 29ecda9 commit 2f4109e

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

include/sbi/sbi_hart.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ struct sbi_hart_ext_data {
7474
};
7575

7676
extern const struct sbi_hart_ext_data sbi_hart_ext[];
77+
extern const int sbi_hart_ext_size;
7778

7879
/*
7980
* Smepmp enforces access boundaries between M-mode and

lib/sbi/sbi_hart.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,8 @@ const struct sbi_hart_ext_data sbi_hart_ext[] = {
668668
__SBI_HART_EXT_DATA(smcdeleg, SBI_HART_EXT_SMCDELEG),
669669
};
670670

671+
const int sbi_hart_ext_size = sizeof(sbi_hart_ext) / sizeof(sbi_hart_ext[0]);
672+
671673
/**
672674
* Get the hart extensions in string format
673675
*

lib/utils/fdt/fdt_helper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ static int fdt_parse_isa_one_hart(const char *isa, unsigned long *extensions)
401401
continue; \
402402
}
403403

404-
for (j = 0; j < SBI_HART_EXT_MAX; j++) {
404+
for (j = 0; j < sbi_hart_ext_size; j++) {
405405
set_multi_letter_ext(sbi_hart_ext[j].name,
406406
sbi_hart_ext[j].id);
407407
}

0 commit comments

Comments
 (0)