aboutsummaryrefslogtreecommitdiff
path: root/bbl
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@dabbelt.com>2017-11-02 15:44:15 -0700
committerPalmer Dabbelt <palmer@dabbelt.com>2017-11-02 15:45:26 -0700
commit9204785053e9a488b8990f9f98ff8f05c71fd0d5 (patch)
treed87d05b64a66af9a542a7d88e98f53d7ff17d33d /bbl
parent220b1bee10d9399864131cd1dbe5037714237f03 (diff)
downloadriscv-pk-9204785053e9a488b8990f9f98ff8f05c71fd0d5.zip
riscv-pk-9204785053e9a488b8990f9f98ff8f05c71fd0d5.tar.gz
riscv-pk-9204785053e9a488b8990f9f98ff8f05c71fd0d5.tar.bz2
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.
Diffstat (limited to 'bbl')
-rw-r--r--bbl/bbl.c16
1 files changed, 14 insertions, 2 deletions
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 <string.h>
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)