diff options
author | Wesley W. Terpstra <wesley@sifive.com> | 2017-03-31 17:51:51 -0700 |
---|---|---|
committer | Wesley W. Terpstra <wesley@sifive.com> | 2017-03-31 17:51:51 -0700 |
commit | 733fae9216f27b3d63c16f8608c3a5e2c6317afc (patch) | |
tree | c60cb17444b7acba19df7aeb168a743c789470fd /machine/minit.c | |
parent | 078ea399c6c1f2d6e8461559bf8cc1ba34ca89b6 (diff) | |
download | pk-733fae9216f27b3d63c16f8608c3a5e2c6317afc.zip pk-733fae9216f27b3d63c16f8608c3a5e2c6317afc.tar.gz pk-733fae9216f27b3d63c16f8608c3a5e2c6317afc.tar.bz2 |
clint: move hart wakeup till after all FDT parsing
The clint was wiping out information discovered by the plic.
Initialize hart stacks as they are discovered.
Then fill in clint+plic info
Then wake the harts.
Diffstat (limited to 'machine/minit.c')
-rw-r--r-- | machine/minit.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/machine/minit.c b/machine/minit.c index 68c29ad..cfe1c43 100644 --- a/machine/minit.c +++ b/machine/minit.c @@ -121,6 +121,13 @@ static void hart_plic_init() *HLS()->plic_s_thresh = 0; } +static void wake_harts() +{ + for (int hart = 0; hart < MAX_HARTS; ++hart) + if (((hart_mask >> hart) & 1)) + *OTHER_HLS(hart)->ipi = 1; // wakeup the hart +} + void init_first_hart(uintptr_t hartid, uintptr_t dtb) { hart_init(); @@ -128,12 +135,14 @@ void init_first_hart(uintptr_t hartid, uintptr_t dtb) // Confirm console as early as possible query_uart(dtb); - printm("SBI console now online\n"); + printm("SBI console now online\r\n"); query_mem(dtb); query_harts(dtb); - query_plic(dtb); query_clint(dtb); + query_plic(dtb); + + wake_harts(); plic_init(); hart_plic_init(); |