summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorAtish Patra <atish.patra@wdc.com>2019-01-25 01:48:45 +0300
committerAnup Patel <anup@brainfault.org>2019-01-29 04:47:14 +0300
commitd70f8aab45d1e449b3b9be26e050b20ed76e12e9 (patch)
tree2d8067b4e3723f36627bbc482a006490a5b83928 /platform
parentbd98d772983df829b78b7ba16bc2dce559c93fbc (diff)
downloadopensbi-d70f8aab45d1e449b3b9be26e050b20ed76e12e9.tar.xz
platform: fu540: Provide a compile time option selective hart booting.
Currently, only hart 1 is enabled for fu540 platform to support U-boot. Introduce a compile time FU540_ENABLED_HART_MASK option so that specific harts can be selected for booting. As fu540 is a multicore, we should boot all cores by default except hart 0. Signed-off-by: Atish Patra <atish.patra@wdc.com>
Diffstat (limited to 'platform')
-rw-r--r--platform/sifive/fu540/objects.mk3
-rw-r--r--platform/sifive/fu540/platform.c12
2 files changed, 13 insertions, 2 deletions
diff --git a/platform/sifive/fu540/objects.mk b/platform/sifive/fu540/objects.mk
index e0d0585..f09a305 100644
--- a/platform/sifive/fu540/objects.mk
+++ b/platform/sifive/fu540/objects.mk
@@ -8,3 +8,6 @@
#
platform-objs-y += platform.o
+ifdef FU540_ENABLED_HART_MASK
+platform-genflags-y += -DFU540_ENABLED_HART_MASK=$(FU540_ENABLED_HART_MASK)
+endif
diff --git a/platform/sifive/fu540/platform.c b/platform/sifive/fu540/platform.c
index 56ca666..ea6ced9 100644
--- a/platform/sifive/fu540/platform.c
+++ b/platform/sifive/fu540/platform.c
@@ -34,7 +34,15 @@
#define FU540_UART1_ADDR 0x10011000
#define FU540_UART_BAUDRATE 115200
-#define FU540_HARITD_ENABLED 1
+/**
+ * The FU540 SoC has 5 HARTs but HART ID 0 doesn't have S mode. enable only
+ * HARTs 1 to 4.
+ */
+#ifndef FU540_ENABLED_HART_MASK
+#define FU540_ENABLED_HART_MASK (1 << 1 | 1 << 2 | 1 << 3 | 1 << 4)
+#endif
+
+#define FU540_HARITD_DISABLED ~(FU540_ENABLED_HART_MASK)
/* PRCI clock related macros */
//TODO: Do we need a separate driver for this ?
@@ -183,7 +191,7 @@ struct sbi_platform platform = {
.features = SBI_PLATFORM_DEFAULT_FEATURES,
.hart_count = FU540_HART_COUNT,
.hart_stack_size = FU540_HART_STACK_SIZE,
- .disabled_hart_mask = ~(1 << FU540_HARITD_ENABLED),
+ .disabled_hart_mask = FU540_HARITD_DISABLED,
.pmp_region_count = fu540_pmp_region_count,
.pmp_region_info = fu540_pmp_region_info,
.final_init = fu540_final_init,