summaryrefslogtreecommitdiffstats
path: root/bsps/powerpc/qoriq
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-07-24 10:50:39 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-07-25 10:07:42 +0200
commit4678d1a8b0e74a12809122ef071324c99e78d7ff (patch)
tree3236b6cfe13d9b3865715aebd6b07baa2fb2abfa /bsps/powerpc/qoriq
parentscore: _SMP_Inter_processor_interrupt_handler() (diff)
downloadrtems-4678d1a8b0e74a12809122ef071324c99e78d7ff.tar.bz2
bsps: bsp_start_on_secondary_processor()
Pass current processor control as first parameter in bsp_start_on_secondary_processor() and qoriq_start_thread() to make dependency more explicit.
Diffstat (limited to 'bsps/powerpc/qoriq')
-rw-r--r--bsps/powerpc/qoriq/include/bsp.h4
-rw-r--r--bsps/powerpc/qoriq/start/bspsmp.c10
-rw-r--r--bsps/powerpc/qoriq/start/start.S8
3 files changed, 12 insertions, 10 deletions
diff --git a/bsps/powerpc/qoriq/include/bsp.h b/bsps/powerpc/qoriq/include/bsp.h
index d7e9e95b3f..1c292f6767 100644
--- a/bsps/powerpc/qoriq/include/bsp.h
+++ b/bsps/powerpc/qoriq/include/bsp.h
@@ -105,7 +105,9 @@ typedef struct {
extern qoriq_start_spin_table *
qoriq_start_spin_table_addr[QORIQ_CPU_COUNT / QORIQ_THREAD_COUNT];
-void qoriq_start_thread(void);
+struct Per_CPU_Control;
+
+void qoriq_start_thread(struct Per_CPU_Control *);
void qoriq_restart_secondary_processor(
const qoriq_start_spin_table *spin_table
diff --git a/bsps/powerpc/qoriq/start/bspsmp.c b/bsps/powerpc/qoriq/start/bspsmp.c
index 048275b1fc..2b95f943dd 100644
--- a/bsps/powerpc/qoriq/start/bspsmp.c
+++ b/bsps/powerpc/qoriq/start/bspsmp.c
@@ -44,10 +44,8 @@ static bool is_started_by_u_boot(uint32_t cpu_index)
return cpu_index % QORIQ_THREAD_COUNT == 0;
}
-void qoriq_start_thread(void)
+void qoriq_start_thread(Per_CPU_Control *cpu_self)
{
- const Per_CPU_Control *cpu_self = _Per_CPU_Get();
-
ppc_exc_initialize_interrupt_stack(
(uintptr_t) cpu_self->interrupt_stack_low,
rtems_configuration_get_interrupt_stack_size()
@@ -85,14 +83,14 @@ static void start_thread_if_necessary(uint32_t cpu_index_self)
#endif
}
-void bsp_start_on_secondary_processor(void)
+void bsp_start_on_secondary_processor(Per_CPU_Control *cpu_self)
{
- uint32_t cpu_index_self = _SMP_Get_current_processor();
- const Per_CPU_Control *cpu_self = _Per_CPU_Get_by_index(cpu_index_self);
+ uint32_t cpu_index_self;
qoriq_initialize_exceptions(cpu_self->interrupt_stack_low);
bsp_interrupt_facility_initialize();
+ cpu_index_self = _Per_CPU_Get_index(cpu_self);
start_thread_if_necessary(cpu_index_self);
_SMP_Start_multitasking_on_secondary_processor();
diff --git a/bsps/powerpc/qoriq/start/start.S b/bsps/powerpc/qoriq/start/start.S
index 96e00bf38b..57342971b6 100644
--- a/bsps/powerpc/qoriq/start/start.S
+++ b/bsps/powerpc/qoriq/start/start.S
@@ -38,6 +38,7 @@
#define START_STACK r15
#define SAVED_LINK_REGISTER r16
#define FDT_REGISTER r17
+#define CPU_SELF r18
.globl _start
#ifdef RTEMS_SMP
@@ -195,7 +196,7 @@ _start:
LA r13, _SDA_BASE_
#endif
- SET_SELF_CPU_CONTROL r4, r5
+ SET_SELF_CPU_CONTROL CPU_SELF, r5
blr
@@ -316,8 +317,7 @@ _start_thread:
bl .Linitearly
/* Initialize start stack */
- GET_SELF_CPU_CONTROL r3
- PPC_REG_LOAD r3, PER_CPU_INTERRUPT_STACK_HIGH(r3)
+ PPC_REG_LOAD r3, PER_CPU_INTERRUPT_STACK_HIGH(CPU_SELF)
subi r1, r3, PPC_MINIMUM_STACK_FRAME_SIZE
clrrwi r1, r1, PPC_STACK_ALIGN_POWER
li r0, 0
@@ -327,6 +327,7 @@ _start_thread:
bl .Linitfpu
#endif
+ mr r3, CPU_SELF
b qoriq_start_thread
PPC64_NOP_FOR_LINKER_TOC_POINTER_RESTORE
#endif
@@ -339,6 +340,7 @@ _start_secondary_processor:
bl .Linitmore
li r3, 0
bl .Linitmmu
+ mr r3, CPU_SELF
b bsp_start_on_secondary_processor
PPC64_NOP_FOR_LINKER_TOC_POINTER_RESTORE
#endif /* RTEMS_SMP */