summaryrefslogtreecommitdiffstats
path: root/bsps/riscv/shared/start/start.S
diff options
context:
space:
mode:
Diffstat (limited to 'bsps/riscv/shared/start/start.S')
-rw-r--r--bsps/riscv/shared/start/start.S23
1 files changed, 22 insertions, 1 deletions
diff --git a/bsps/riscv/shared/start/start.S b/bsps/riscv/shared/start/start.S
index 3702f8ac2f..f31d89335c 100644
--- a/bsps/riscv/shared/start/start.S
+++ b/bsps/riscv/shared/start/start.S
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 embedded brains GmbH
+ * Copyright (c) 2018 embedded brains GmbH & Co. KG
* Copyright (c) 2015 University of York.
* Hesham Almatary <hesham@alumni.york.ac.uk>
@@ -40,6 +40,7 @@ PUBLIC(_start)
.section .bsp_start_text, "wax", @progbits
.align 2
.option arch, +zicsr
+ .option norelax
TYPE_FUNC(_start)
SYM(_start):
@@ -65,6 +66,17 @@ SYM(_start):
LADDR sp, _ISR_Stack_area_begin
LADDR t2, _ISR_Stack_size
csrr s0, mhartid
+ li t3, RISCV_BOOT_HARTID
+ sub s0, s0, t3
+
+ /*
+ * Check that this is a configured processor. If not, then there is
+ * not much that can be done since we do not have a stack available for
+ * this processor. Just loop forever in this case.
+ */
+ LREG t3, _SMP_Processor_configured_maximum
+ bgeu s0, t3, .Lwfi
+
LADDR t0, _Per_CPU_Information
slli t1, s0, PER_CPU_CONTROL_SIZE_LOG2
add s1, t0, t1
@@ -97,6 +109,9 @@ SYM(_start):
tail boot_card
#ifdef RTEMS_SMP
+.Lwfi:
+ wfi
+ j .Lwfi
.Lstart_on_secondary_processor:
@@ -128,9 +143,15 @@ SYM(_start):
mv a0, s1
call bsp_start_on_secondary_processor
+ .section .bsp_start_data, "aw"
+
+ .type .Lsecondary_processor_go, @object
+
#if __riscv_xlen == 32
+ .size .Lsecondary_processor_go, 4
.align 2
#elif __riscv_xlen == 64
+ .size .Lsecondary_processor_go, 8
.align 3
#endif