leon: allow SMP boot from any CPU

This commit is contained in:
Martin Aberg
2017-04-24 16:39:49 +02:00
committed by Daniel Hellstrom
parent 039edd2adc
commit aa19873f68
2 changed files with 14 additions and 5 deletions

View File

@@ -36,6 +36,11 @@ int CPU_SPARC_HAS_SNOOPING;
/* Index of CPU, in an AMP system CPU-index may be non-zero */ /* Index of CPU, in an AMP system CPU-index may be non-zero */
uint32_t LEON3_Cpu_Index = 0; uint32_t LEON3_Cpu_Index = 0;
#if defined(RTEMS_SMP)
/* Index of the boot CPU. Set by the first CPU at boot to its CPU ID. */
int LEON3_Boot_Cpu = -1;
#endif
/* /*
* set_snooping * set_snooping
* *

View File

@@ -281,13 +281,16 @@ SYM(hard_reset):
rd %asr17, %o0 ! get CPU identifier rd %asr17, %o0 ! get CPU identifier
srl %o0, LEON3_ASR17_PROCESSOR_INDEX_SHIFT, %o0 srl %o0, LEON3_ASR17_PROCESSOR_INDEX_SHIFT, %o0
cmp %o0, 0
beq cpu0
nop
sll %o0, PER_CPU_CONTROL_SIZE_LOG2, %l0 sll %o0, PER_CPU_CONTROL_SIZE_LOG2, %l0
add %g6, %l0, %g6 add %g6, %l0, %g6
/* If LEON3_Boot_Cpu < 0 then assign us as boot CPU and continue. */
set SYM(LEON3_Boot_Cpu), %o1
ld [%o1], %o2
tst %o2
bneg .Lbootcpu
nop
ld [%g6 + PER_CPU_INTERRUPT_STACK_HIGH], %sp ! set stack pointer ld [%g6 + PER_CPU_INTERRUPT_STACK_HIGH], %sp ! set stack pointer
sub %sp, 4, %sp ! stack starts at end of area - 4 sub %sp, 4, %sp ! stack starts at end of area - 4
andn %sp, 0x0f, %sp ! align stack on 16-byte boundary andn %sp, 0x0f, %sp ! align stack on 16-byte boundary
@@ -295,7 +298,8 @@ SYM(hard_reset):
call SYM(bsp_start_on_secondary_processor) ! does not return call SYM(bsp_start_on_secondary_processor) ! does not return
sub %sp, SPARC_MINIMUM_STACK_FRAME_SIZE, %sp sub %sp, SPARC_MINIMUM_STACK_FRAME_SIZE, %sp
cpu0: .Lbootcpu:
st %o0, [%o1]
#endif #endif
set (SYM(rdb_start)), %g5 ! End of RAM set (SYM(rdb_start)), %g5 ! End of RAM