From 9204785053e9a488b8990f9f98ff8f05c71fd0d5 Mon Sep 17 00:00:00 2001 From: Palmer Dabbelt Date: Thu, 2 Nov 2017 15:44:15 -0700 Subject: Detect harts that can't boot Linux instead of hard-coding them This checks to see if a hart can't boot Linux by looking for a compatible "mmu-type" field. If the hart can't boot Linux, then bbl masks it off. --- bbl/bbl.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'bbl/bbl.c') diff --git a/bbl/bbl.c b/bbl/bbl.c index d3d6d9f..1f91ea2 100644 --- a/bbl/bbl.c +++ b/bbl/bbl.c @@ -9,6 +9,7 @@ #include static const void* entry_point; +long disabled_hart_mask; static uintptr_t dtb_output() { @@ -24,7 +25,7 @@ static void filter_dtb(uintptr_t source) memcpy((void*)dest, (void*)source, size); // Remove information from the chained FDT - filter_harts(dest, platform__disabled_hart_mask); + filter_harts(dest, &disabled_hart_mask); filter_plic(dest); filter_compat(dest, "riscv,clint0"); filter_compat(dest, "riscv,debug-013"); @@ -37,7 +38,18 @@ void boot_other_hart(uintptr_t unused __attribute__((unused))) entry = entry_point; mb(); } while (!entry); - enter_supervisor_mode(entry, read_csr(mhartid), dtb_output()); + + long hartid = read_csr(mhartid); + if ((1 << hartid) & disabled_hart_mask) { + while (1) { + __asm__ volatile("wfi"); +#ifdef __riscv_div + __asm__ volatile("div x0, x0, x0"); +#endif + } + } + + enter_supervisor_mode(entry, hartid, dtb_output()); } void boot_loader(uintptr_t dtb) -- cgit v1.1