aboutsummaryrefslogtreecommitdiff
path: root/bbl
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@dabbelt.com>2017-08-03 14:39:23 -0700
committerPalmer Dabbelt <palmer@dabbelt.com>2017-08-03 15:43:47 -0700
commitca24f3c904186cb6babfc74fd6c4e133e4542b5e (patch)
tree6b3afe9e5df25ca40d021c97e1d9553ecdb5b9e9 /bbl
parent2187c4512db64656896f4b455628a2567984eba1 (diff)
downloadriscv-pk-ca24f3c904186cb6babfc74fd6c4e133e4542b5e.zip
riscv-pk-ca24f3c904186cb6babfc74fd6c4e133e4542b5e.tar.gz
riscv-pk-ca24f3c904186cb6babfc74fd6c4e133e4542b5e.tar.bz2
Add the '--enable-print-device-tree' argument
I'm trying to debug some device tree problems while booting Linux and figured it would be really nice to have access to the device tree while trying to debug these problems. I think this might be useful for lots of people, so I went ahead and cleaned up the code enough that it should actaully work in most cases.
Diffstat (limited to 'bbl')
-rw-r--r--bbl/bbl.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/bbl/bbl.c b/bbl/bbl.c
index b0a862d..7d1be2a 100644
--- a/bbl/bbl.c
+++ b/bbl/bbl.c
@@ -17,7 +17,7 @@ static uintptr_t dtb_output()
return (end + MEGAPAGE_SIZE - 1) / MEGAPAGE_SIZE * MEGAPAGE_SIZE;
}
-static void filter_dtb(uintptr_t source)
+static uintptr_t filter_dtb(uintptr_t source)
{
uintptr_t dest = dtb_output();
uint32_t size = fdt_size(source);
@@ -28,6 +28,8 @@ static void filter_dtb(uintptr_t source)
filter_plic(dest);
filter_compat(dest, "riscv,clint0");
filter_compat(dest, "riscv,debug-013");
+
+ return dest;
}
void boot_other_hart(uintptr_t dtb)
@@ -37,16 +39,19 @@ void boot_other_hart(uintptr_t dtb)
entry = entry_point;
mb();
} while (!entry);
- enter_supervisor_mode(entry, read_csr(mhartid), dtb_output());
+ enter_supervisor_mode(entry, read_csr(mhartid), dtb);
}
void boot_loader(uintptr_t dtb)
{
extern char _payload_start;
- filter_dtb(dtb);
+ dtb = filter_dtb(dtb);
#ifdef PK_ENABLE_LOGO
print_logo();
#endif
+#ifdef PK_PRINT_DEVICE_TREE
+ fdt_print(dtb);
+#endif
mb();
entry_point = &_payload_start;
boot_other_hart(dtb);