[PATCH 05/18] score: Add _SMP_Othercast_action()

Sebastian Huber sebastian.huber at embedded-brains.de
Mon May 20 07:33:31 UTC 2019


---
 bsps/arm/shared/clock/clock-a9mpcore.c      | 12 +++++-------
 bsps/arm/shared/clock/clock-generic-timer.c | 10 ++++------
 cpukit/include/rtems/score/smpimpl.h        | 15 +++++++++++++++
 cpukit/score/src/smpmulticastaction.c       | 12 ++++++++++++
 4 files changed, 36 insertions(+), 13 deletions(-)

diff --git a/bsps/arm/shared/clock/clock-a9mpcore.c b/bsps/arm/shared/clock/clock-a9mpcore.c
index 7dac8445f2..6eaea05baf 100644
--- a/bsps/arm/shared/clock/clock-a9mpcore.c
+++ b/bsps/arm/shared/clock/clock-a9mpcore.c
@@ -102,13 +102,11 @@ typedef struct {
 
 static void a9mpcore_clock_secondary_action(void *arg)
 {
-  if (!_Per_CPU_Is_boot_processor(_Per_CPU_Get())) {
-    volatile a9mpcore_gt *gt = A9MPCORE_GT;
-    a9mpcore_clock_init_data *init_data = arg;
+  volatile a9mpcore_gt *gt = A9MPCORE_GT;
+  a9mpcore_clock_init_data *init_data = arg;
 
-    a9mpcore_clock_gt_init(gt, init_data->cmpval, init_data->interval);
-    bsp_interrupt_vector_enable(A9MPCORE_IRQ_GT);
-  }
+  a9mpcore_clock_gt_init(gt, init_data->cmpval, init_data->interval);
+  bsp_interrupt_vector_enable(A9MPCORE_IRQ_GT);
 }
 #endif
 
@@ -124,7 +122,7 @@ static void a9mpcore_clock_secondary_initialization(
     .interval = interval
   };
 
-  _SMP_Broadcast_action(a9mpcore_clock_secondary_action, &init_data);
+  _SMP_Othercast_action(a9mpcore_clock_secondary_action, &init_data);
 
   if (cmpval - a9mpcore_clock_get_counter(gt) >= interval) {
     bsp_fatal(BSP_ARM_A9MPCORE_FATAL_CLOCK_SMP_INIT);
diff --git a/bsps/arm/shared/clock/clock-generic-timer.c b/bsps/arm/shared/clock/clock-generic-timer.c
index 88fb1967e5..1369a5d6f1 100644
--- a/bsps/arm/shared/clock/clock-generic-timer.c
+++ b/bsps/arm/shared/clock/clock-generic-timer.c
@@ -122,13 +122,11 @@ static void arm_gt_clock_gt_init(uint64_t cval)
 #if defined(RTEMS_SMP) && !defined(CLOCK_DRIVER_USE_ONLY_BOOT_PROCESSOR)
 static void arm_gt_clock_secondary_action(void *arg)
 {
-  if (!_Per_CPU_Is_boot_processor(_Per_CPU_Get())) {
-    uint64_t *cval;
+  uint64_t *cval;
 
-    cval = arg;
-    arm_gt_clock_gt_init(*cval);
-    bsp_interrupt_vector_enable(arm_gt_clock_instance.irq);
-  }
+  cval = arg;
+  arm_gt_clock_gt_init(*cval);
+  bsp_interrupt_vector_enable(arm_gt_clock_instance.irq);
 }
 #endif
 
diff --git a/cpukit/include/rtems/score/smpimpl.h b/cpukit/include/rtems/score/smpimpl.h
index bc24f828fe..452f39a3b5 100644
--- a/cpukit/include/rtems/score/smpimpl.h
+++ b/cpukit/include/rtems/score/smpimpl.h
@@ -284,6 +284,21 @@ void _SMP_Broadcast_action(
   void               *arg
 );
 
+/**
+ * @brief Initiates an SMP multicast action to the set of all online
+ * processors excluding the current processor.
+ *
+ * Simply calls _SMP_Multicast_action() with _SMP_Get_online_processors() as
+ * the target processor set excluding the current processor.
+ *
+ * @param handler The multicast action handler.
+ * @param arg The multicast action argument.
+ */
+void _SMP_Othercast_action(
+  SMP_Action_handler  handler,
+  void               *arg
+);
+
 #endif /* defined( RTEMS_SMP ) */
 
 /**
diff --git a/cpukit/score/src/smpmulticastaction.c b/cpukit/score/src/smpmulticastaction.c
index b703ba14a7..f7dd503fae 100644
--- a/cpukit/score/src/smpmulticastaction.c
+++ b/cpukit/score/src/smpmulticastaction.c
@@ -258,3 +258,15 @@ void _SMP_Broadcast_action(
 {
   _SMP_Multicast_action( _SMP_Get_online_processors(), handler, arg );
 }
+
+void _SMP_Othercast_action(
+  SMP_Action_handler  handler,
+  void               *arg
+)
+{
+  Processor_mask targets;
+
+  _Processor_mask_Assign( &targets, _SMP_Get_online_processors() );
+  _Processor_mask_Clear( &targets, _SMP_Get_current_processor() );
+  _SMP_Multicast_action( &targets, handler, arg );
+}
-- 
2.16.4




More information about the devel mailing list