diff options
author | Palmer Dabbelt <palmer@dabbelt.com> | 2017-11-02 18:48:38 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-02 18:48:38 -0700 |
commit | 3815c611158f435d36121c2c433af664ad86d8ca (patch) | |
tree | 21fd7e514596ecd126d089b5ecff255bb809d433 /bbl/bbl.c | |
parent | 220b1bee10d9399864131cd1dbe5037714237f03 (diff) | |
parent | 27498013ad7684a5f22a99790ac29badea205a3f (diff) | |
download | pk-3815c611158f435d36121c2c433af664ad86d8ca.zip pk-3815c611158f435d36121c2c433af664ad86d8ca.tar.gz pk-3815c611158f435d36121c2c433af664ad86d8ca.tar.bz2 |
Merge pull request #67 from riscv/dts2
Detect harts that can't boot Linux instead of hard-coding them
Diffstat (limited to 'bbl/bbl.c')
-rw-r--r-- | bbl/bbl.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -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) |