mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-25 07:41:42 +01:00
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>
This commit is contained in:
@@ -247,7 +247,7 @@ static inline char *sbi_hart_feature_id2string(unsigned long feature)
|
|||||||
fstr = "pmp";
|
fstr = "pmp";
|
||||||
break;
|
break;
|
||||||
case SBI_HART_HAS_SCOUNTEREN:
|
case SBI_HART_HAS_SCOUNTEREN:
|
||||||
fstr = "scountern";
|
fstr = "scounteren";
|
||||||
break;
|
break;
|
||||||
case SBI_HART_HAS_MCOUNTEREN:
|
case SBI_HART_HAS_MCOUNTEREN:
|
||||||
fstr = "mcounteren";
|
fstr = "mcounteren";
|
||||||
@@ -371,8 +371,10 @@ int sbi_hart_init(struct sbi_scratch *scratch, u32 hartid, bool cold_boot)
|
|||||||
if (!hart_features_offset)
|
if (!hart_features_offset)
|
||||||
return SBI_ENOMEM;
|
return SBI_ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
hart_features = sbi_scratch_offset_ptr(scratch, hart_features_offset);
|
hart_features = sbi_scratch_offset_ptr(scratch, hart_features_offset);
|
||||||
*hart_features = 0;
|
*hart_features = 0;
|
||||||
|
sbi_hart_detect_features(hartid);
|
||||||
|
|
||||||
mstatus_init(scratch, hartid);
|
mstatus_init(scratch, hartid);
|
||||||
|
|
||||||
@@ -384,8 +386,6 @@ int sbi_hart_init(struct sbi_scratch *scratch, u32 hartid, bool cold_boot)
|
|||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
sbi_hart_detect_features(hartid);
|
|
||||||
|
|
||||||
return pmp_init(scratch, hartid);
|
return pmp_init(scratch, hartid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user