diff options
author | Anup Patel <anup.patel@wdc.com> | 2020-05-10 08:43:00 +0300 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2020-05-19 06:49:32 +0300 |
commit | 28b40528499755ec19a6f8a06dc47e65619fb96c (patch) | |
tree | 2c24425358a5bd00cebd7aafc84a9c62a6f124a3 /lib | |
parent | 38a4b54cdc3fd77574c4ef166154819a976e9fa0 (diff) | |
download | opensbi-28b40528499755ec19a6f8a06dc47e65619fb96c.tar.xz |
lib: sbi: detect features before everything else in sbi_hart_init()
We should detect HART features in sbi_hart_init() before
mstatus_init(), delegate_traps() and pmp_init().
Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sbi/sbi_hart.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c index 28cfeaa..2a284fd 100644 --- a/lib/sbi/sbi_hart.c +++ b/lib/sbi/sbi_hart.c @@ -247,7 +247,7 @@ static inline char *sbi_hart_feature_id2string(unsigned long feature) fstr = "pmp"; break; case SBI_HART_HAS_SCOUNTEREN: - fstr = "scountern"; + fstr = "scounteren"; break; case SBI_HART_HAS_MCOUNTEREN: fstr = "mcounteren"; @@ -371,8 +371,10 @@ int sbi_hart_init(struct sbi_scratch *scratch, u32 hartid, bool cold_boot) if (!hart_features_offset) return SBI_ENOMEM; } + hart_features = sbi_scratch_offset_ptr(scratch, hart_features_offset); *hart_features = 0; + sbi_hart_detect_features(hartid); mstatus_init(scratch, hartid); @@ -384,8 +386,6 @@ int sbi_hart_init(struct sbi_scratch *scratch, u32 hartid, bool cold_boot) if (rc) return rc; - sbi_hart_detect_features(hartid); - return pmp_init(scratch, hartid); } |