[rtems commit] score: Introduce _SMP_Get_online_processors()
Sebastian Huber
sebh at rtems.org
Mon Jul 10 07:38:33 UTC 2017
Module: rtems
Branch: master
Commit: 76d119857f62ceff860439ae8bbf3fa29757dc87
Changeset: http://git.rtems.org/rtems/commit/?id=76d119857f62ceff860439ae8bbf3fa29757dc87
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Fri Jul 7 07:45:57 2017 +0200
score: Introduce _SMP_Get_online_processors()
Update #3059.
---
c/src/lib/libbsp/powerpc/qoriq/startup/bsprestart.c | 2 +-
c/src/lib/libbsp/shared/clockdrv_shell.h | 6 ++++--
c/src/lib/libbsp/sparc/shared/timer/gptimer.c | 2 +-
cpukit/score/include/rtems/score/smpimpl.h | 9 +++++++++
cpukit/score/src/smpmulticastaction.c | 2 +-
cpukit/score/src/threadinitialize.c | 5 ++++-
testsuites/smptests/smpipi01/init.c | 4 ++--
7 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/c/src/lib/libbsp/powerpc/qoriq/startup/bsprestart.c b/c/src/lib/libbsp/powerpc/qoriq/startup/bsprestart.c
index c85a6b8..3558334 100644
--- a/c/src/lib/libbsp/powerpc/qoriq/startup/bsprestart.c
+++ b/c/src/lib/libbsp/powerpc/qoriq/startup/bsprestart.c
@@ -100,7 +100,7 @@ static void restart_interrupt(void *arg)
static void raise_restart_interrupt(void)
{
qoriq.pic.ipidr[RESTART_IPI_INDEX].reg =
- _Processor_mask_To_uint32_t(&_SMP_Online_processors, 0);
+ _Processor_mask_To_uint32_t(_SMP_Get_online_processors(), 0);
ppc_synchronize_data();
ppc_synchronize_instructions();
}
diff --git a/c/src/lib/libbsp/shared/clockdrv_shell.h b/c/src/lib/libbsp/shared/clockdrv_shell.h
index bf74133..a4d1b2d 100644
--- a/c/src/lib/libbsp/shared/clockdrv_shell.h
+++ b/c/src/lib/libbsp/shared/clockdrv_shell.h
@@ -80,7 +80,7 @@ static void Clock_driver_timecounter_tick( void )
if ( _Per_CPU_Is_boot_processor( cpu ) ) {
rtems_timecounter_tick();
- } else if ( _Processor_mask_Is_set( &_SMP_Online_processors, cpu_index ) ) {
+ } else if ( _Processor_mask_Is_set( _SMP_Get_online_processors(), cpu_index ) ) {
_Watchdog_Tick( cpu );
}
}
@@ -227,7 +227,9 @@ rtems_device_driver Clock_initialize(
Clock_driver_support_install_isr( Clock_isr, Old_ticker );
#ifdef RTEMS_SMP
- Clock_driver_support_set_interrupt_affinity( &_SMP_Online_processors );
+ Clock_driver_support_set_interrupt_affinity(
+ _SMP_Get_online_processors()
+ );
#endif
/*
diff --git a/c/src/lib/libbsp/sparc/shared/timer/gptimer.c b/c/src/lib/libbsp/sparc/shared/timer/gptimer.c
index 014bd7c..b982822 100644
--- a/c/src/lib/libbsp/sparc/shared/timer/gptimer.c
+++ b/c/src/lib/libbsp/sparc/shared/timer/gptimer.c
@@ -451,7 +451,7 @@ static void gptimer_tlib_irq_reg(struct tlib_dev *hand, tlib_isr_t func, void *d
tindex = timer->tindex;
}
drvmgr_interrupt_set_affinity(priv->dev, tindex,
- _SMP_Online_processors);
+ _SMP_Get_online_processors());
}
#endif
diff --git a/cpukit/score/include/rtems/score/smpimpl.h b/cpukit/score/include/rtems/score/smpimpl.h
index bc800b9..950f83a 100644
--- a/cpukit/score/include/rtems/score/smpimpl.h
+++ b/cpukit/score/include/rtems/score/smpimpl.h
@@ -335,6 +335,15 @@ bool _SMP_Before_multitasking_action_broadcast(
do { } while ( 0 )
#endif
+RTEMS_INLINE_ROUTINE const Processor_mask *_SMP_Get_online_processors( void )
+{
+#if defined(RTEMS_SMP)
+ return &_SMP_Online_processors;
+#else
+ return &_Processor_mask_The_one_and_only.
+#endif
+}
+
/** @} */
#ifdef __cplusplus
diff --git a/cpukit/score/src/smpmulticastaction.c b/cpukit/score/src/smpmulticastaction.c
index 73b1500..455fbd7 100644
--- a/cpukit/score/src/smpmulticastaction.c
+++ b/cpukit/score/src/smpmulticastaction.c
@@ -106,7 +106,7 @@ void _SMP_Multicast_action(
}
if( cpus == NULL ) {
- _Processor_mask_Assign( &targets, &_SMP_Online_processors );
+ _Processor_mask_Assign( &targets, _SMP_Get_online_processors() );
} else {
_Processor_mask_Zero( &targets );
diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c
index 803ee7b..3230eac 100644
--- a/cpukit/score/src/threadinitialize.c
+++ b/cpukit/score/src/threadinitialize.c
@@ -248,7 +248,10 @@ bool _Thread_Initialize(
RTEMS_STATIC_ASSERT( THREAD_SCHEDULER_BLOCKED == 0, Scheduler_state );
the_thread->Scheduler.home = scheduler;
_ISR_lock_Initialize( &the_thread->Scheduler.Lock, "Thread Scheduler" );
- _Processor_mask_Assign( &the_thread->Scheduler.Affinity, &_SMP_Online_processors );
+ _Processor_mask_Assign(
+ &the_thread->Scheduler.Affinity,
+ _SMP_Get_online_processors()
+ );
_ISR_lock_Initialize( &the_thread->Wait.Lock.Default, "Thread Wait Default" );
_Thread_queue_Gate_open( &the_thread->Wait.Lock.Tranquilizer );
_RBTree_Initialize_node( &the_thread->Wait.Link.Registry_node );
diff --git a/testsuites/smptests/smpipi01/init.c b/testsuites/smptests/smpipi01/init.c
index 59f8771..cc85388 100644
--- a/testsuites/smptests/smpipi01/init.c
+++ b/testsuites/smptests/smpipi01/init.c
@@ -162,7 +162,7 @@ static void test_send_message_flood(
for (cpu_index = 0; cpu_index < cpu_count; ++cpu_index) {
rtems_test_assert(
- _Processor_mask_Is_set(&_SMP_Online_processors, cpu_index)
+ _Processor_mask_Is_set(_SMP_Get_online_processors(), cpu_index)
);
printf(
@@ -176,7 +176,7 @@ static void test_send_message_flood(
for (; cpu_index < CPU_COUNT; ++cpu_index) {
rtems_test_assert(
- !_Processor_mask_Is_set(&_SMP_Online_processors, cpu_index)
+ !_Processor_mask_Is_set(_SMP_Get_online_processors(), cpu_index)
);
}
}
More information about the vc
mailing list