mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2026-04-13 14:21:40 +01:00
lib: sbi_init: Call hart init and timer init before platform early init
To allow the platform early drivers to use the sbi_timer_mdelay(), sbi_timer_udelay() and sbi_hart_has_extension() helpers, reorder the initialization sequence must call sbi_hart_init() and sbi_timer_init() prior to sbi_platform_early_init() during both cold and warm boot paths. Reviewed-by: Greentime Hu <greentime.hu@sifive.com> Reviewed-by: Zong Li <zong.li@sifive.com> Signed-off-by: Yu-Chien Peter Lin <peter.lin@sifive.com> Link: https://lore.kernel.org/r/20260224031733.3817148-2-peter.lin@sifive.com Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
committed by
Anup Patel
parent
0ab0c470d5
commit
4813a20420
@@ -265,11 +265,15 @@ static void __noreturn init_coldboot(struct sbi_scratch *scratch, u32 hartid)
|
|||||||
*/
|
*/
|
||||||
wake_coldboot_harts(scratch);
|
wake_coldboot_harts(scratch);
|
||||||
|
|
||||||
rc = sbi_platform_early_init(plat, true);
|
rc = sbi_hart_init(scratch, true);
|
||||||
if (rc)
|
if (rc)
|
||||||
sbi_hart_hang();
|
sbi_hart_hang();
|
||||||
|
|
||||||
rc = sbi_hart_init(scratch, true);
|
rc = sbi_timer_init(scratch, true);
|
||||||
|
if (rc)
|
||||||
|
sbi_hart_hang();
|
||||||
|
|
||||||
|
rc = sbi_platform_early_init(plat, true);
|
||||||
if (rc)
|
if (rc)
|
||||||
sbi_hart_hang();
|
sbi_hart_hang();
|
||||||
|
|
||||||
@@ -307,12 +311,6 @@ static void __noreturn init_coldboot(struct sbi_scratch *scratch, u32 hartid)
|
|||||||
sbi_hart_hang();
|
sbi_hart_hang();
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = sbi_timer_init(scratch, true);
|
|
||||||
if (rc) {
|
|
||||||
sbi_printf("%s: timer init failed (error %d)\n", __func__, rc);
|
|
||||||
sbi_hart_hang();
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = sbi_fwft_init(scratch, true);
|
rc = sbi_fwft_init(scratch, true);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
sbi_printf("%s: fwft init failed (error %d)\n", __func__, rc);
|
sbi_printf("%s: fwft init failed (error %d)\n", __func__, rc);
|
||||||
@@ -424,11 +422,15 @@ static void __noreturn init_warm_startup(struct sbi_scratch *scratch,
|
|||||||
if (rc)
|
if (rc)
|
||||||
sbi_hart_hang();
|
sbi_hart_hang();
|
||||||
|
|
||||||
rc = sbi_platform_early_init(plat, false);
|
rc = sbi_hart_init(scratch, false);
|
||||||
if (rc)
|
if (rc)
|
||||||
sbi_hart_hang();
|
sbi_hart_hang();
|
||||||
|
|
||||||
rc = sbi_hart_init(scratch, false);
|
rc = sbi_timer_init(scratch, false);
|
||||||
|
if (rc)
|
||||||
|
sbi_hart_hang();
|
||||||
|
|
||||||
|
rc = sbi_platform_early_init(plat, false);
|
||||||
if (rc)
|
if (rc)
|
||||||
sbi_hart_hang();
|
sbi_hart_hang();
|
||||||
|
|
||||||
@@ -452,10 +454,6 @@ static void __noreturn init_warm_startup(struct sbi_scratch *scratch,
|
|||||||
if (rc)
|
if (rc)
|
||||||
sbi_hart_hang();
|
sbi_hart_hang();
|
||||||
|
|
||||||
rc = sbi_timer_init(scratch, false);
|
|
||||||
if (rc)
|
|
||||||
sbi_hart_hang();
|
|
||||||
|
|
||||||
rc = sbi_fwft_init(scratch, false);
|
rc = sbi_fwft_init(scratch, false);
|
||||||
if (rc)
|
if (rc)
|
||||||
sbi_hart_hang();
|
sbi_hart_hang();
|
||||||
|
|||||||
Reference in New Issue
Block a user