[PATCH 3/6] smp: Add and use _CPU_SMP_Send_interrupt()

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Jun 14 14:31:58 UTC 2013


Delete bsp_smp_interrupt_cpu().
---
 c/src/lib/libbsp/arm/shared/arm-a9mpcore-smp.c |    4 ++--
 c/src/lib/libbsp/i386/shared/smp/smp-imps.c    |    6 ++----
 c/src/lib/libbsp/powerpc/qoriq/startup/smp.c   |    5 +++--
 c/src/lib/libbsp/shared/smp/smp_stub.c         |    4 +---
 c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c   |    8 +++-----
 cpukit/score/cpu/arm/rtems/score/cpu.h         |    2 ++
 cpukit/score/cpu/i386/rtems/score/cpu.h        |    2 ++
 cpukit/score/cpu/no_cpu/rtems/score/cpu.h      |   10 ++++++++++
 cpukit/score/cpu/powerpc/rtems/score/cpu.h     |    1 +
 cpukit/score/cpu/sparc/rtems/score/cpu.h       |    2 ++
 cpukit/score/include/rtems/bspsmp.h            |   12 ------------
 cpukit/score/src/smp.c                         |    2 +-
 12 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/c/src/lib/libbsp/arm/shared/arm-a9mpcore-smp.c b/c/src/lib/libbsp/arm/shared/arm-a9mpcore-smp.c
index e647b4f..3005bcf 100644
--- a/c/src/lib/libbsp/arm/shared/arm-a9mpcore-smp.c
+++ b/c/src/lib/libbsp/arm/shared/arm-a9mpcore-smp.c
@@ -56,11 +56,11 @@ void bsp_smp_broadcast_interrupt(void)
   );
 }
 
-void bsp_smp_interrupt_cpu(int cpu)
+void _CPU_SMP_Send_interrupt( uint32_t target_processor_index )
 {
   rtems_status_code sc = arm_gic_irq_generate_software_irq(
     ARM_GIC_IRQ_SGI_0,
     ARM_GIC_IRQ_SOFTWARE_IRQ_TO_ALL_IN_LIST,
-    (uint8_t) (1U << cpu)
+    (uint8_t) (1U << target_processor_index)
   );
 }
diff --git a/c/src/lib/libbsp/i386/shared/smp/smp-imps.c b/c/src/lib/libbsp/i386/shared/smp/smp-imps.c
index 916379e..806cfb9 100644
--- a/c/src/lib/libbsp/i386/shared/smp/smp-imps.c
+++ b/c/src/lib/libbsp/i386/shared/smp/smp-imps.c
@@ -803,11 +803,9 @@ uint32_t bsp_smp_initialize( uint32_t configured_cpu_count )
   return cores;
 }
 
-void bsp_smp_interrupt_cpu(
-  int cpu
-)
+void _CPU_SMP_Send_interrupt( uint32_t target_processor_index )
 {
-  send_ipi( cpu, 0x30 );
+  send_ipi( target_processor_index, 0x30 );
 }
 
 void bsp_smp_broadcast_interrupt(void)
diff --git a/c/src/lib/libbsp/powerpc/qoriq/startup/smp.c b/c/src/lib/libbsp/powerpc/qoriq/startup/smp.c
index b16adb8..595729a 100644
--- a/c/src/lib/libbsp/powerpc/qoriq/startup/smp.c
+++ b/c/src/lib/libbsp/powerpc/qoriq/startup/smp.c
@@ -167,8 +167,9 @@ void bsp_smp_broadcast_interrupt(void)
   qoriq.pic.per_cpu [self].ipidr [IPI_INDEX].reg = ALL_CORES;
 }
 
-void bsp_smp_interrupt_cpu(int core)
+void _CPU_SMP_Send_interrupt(uint32_t target_processor_index)
 {
   uint32_t self = ppc_processor_id();
-  qoriq.pic.per_cpu [self].ipidr [IPI_INDEX].reg = ONE_CORE(core);
+  qoriq.pic.per_cpu [self].ipidr [IPI_INDEX].reg =
+    ONE_CORE(target_processor_index);
 }
diff --git a/c/src/lib/libbsp/shared/smp/smp_stub.c b/c/src/lib/libbsp/shared/smp/smp_stub.c
index 62338b9..175af9d 100644
--- a/c/src/lib/libbsp/shared/smp/smp_stub.c
+++ b/c/src/lib/libbsp/shared/smp/smp_stub.c
@@ -31,9 +31,7 @@ void bsp_smp_broadcast_message(
 {
 }
 
-void bsp_smp_interrupt_cpu(
-  int cpu
-)
+void _CPU_SMP_Send_interrupt( uint32_t target_processor_index )
 {
 }
 
diff --git a/c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c b/c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c
index 39fc9f9..8862ca5 100644
--- a/c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c
+++ b/c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c
@@ -115,12 +115,10 @@ uint32_t bsp_smp_initialize( uint32_t configured_cpu_count )
   return found_cpus;
 }
 
-void bsp_smp_interrupt_cpu(
-  int cpu
-)
+void _CPU_SMP_Send_interrupt(uint32_t target_processor_index)
 {
   /* send interrupt to destination CPU */
-  LEON3_IrqCtrl_Regs->force[cpu] = 1 << LEON3_MP_IRQ;
+  LEON3_IrqCtrl_Regs->force[target_processor_index] = 1 << LEON3_MP_IRQ;
 }
 
 void bsp_smp_broadcast_interrupt(void)
@@ -135,7 +133,7 @@ void bsp_smp_broadcast_interrupt(void)
   for ( dest_cpu=0 ; dest_cpu < max_cpus ; dest_cpu++ ) {
     if ( cpu == dest_cpu )
       continue;
-    bsp_smp_interrupt_cpu( dest_cpu );
+    _CPU_SMP_Send_interrupt( dest_cpu );
     /* this is likely needed due to the ISR code not being SMP aware yet */
     bsp_smp_delay( 100000 );
   }
diff --git a/cpukit/score/cpu/arm/rtems/score/cpu.h b/cpukit/score/cpu/arm/rtems/score/cpu.h
index ed1b605..519d486 100644
--- a/cpukit/score/cpu/arm/rtems/score/cpu.h
+++ b/cpukit/score/cpu/arm/rtems/score/cpu.h
@@ -457,6 +457,8 @@ void _CPU_Context_validate( uintptr_t pattern );
     return mpidr & 0xffU;
   }
 
+  void _CPU_SMP_Send_interrupt( uint32_t target_processor_index );
+
   static inline void _ARM_Data_memory_barrier( void )
   {
     __asm__ volatile ( "dmb" : : : "memory" );
diff --git a/cpukit/score/cpu/i386/rtems/score/cpu.h b/cpukit/score/cpu/i386/rtems/score/cpu.h
index b00ae3b..092ba99 100644
--- a/cpukit/score/cpu/i386/rtems/score/cpu.h
+++ b/cpukit/score/cpu/i386/rtems/score/cpu.h
@@ -457,6 +457,8 @@ uint32_t   _CPU_ISR_Get_level( void );
 
   RTEMS_COMPILER_PURE_ATTRIBUTE uint32_t _CPU_SMP_Get_current_processor( void );
 
+  void _CPU_SMP_Send_interrupt( uint32_t target_processor_index );
+
   static inline void _CPU_Processor_event_broadcast( void )
   {
     __asm__ volatile ( "" : : : "memory" );
diff --git a/cpukit/score/cpu/no_cpu/rtems/score/cpu.h b/cpukit/score/cpu/no_cpu/rtems/score/cpu.h
index d368e51..dc48d2b 100644
--- a/cpukit/score/cpu/no_cpu/rtems/score/cpu.h
+++ b/cpukit/score/cpu/no_cpu/rtems/score/cpu.h
@@ -1417,6 +1417,16 @@ static inline uint32_t CPU_swap_u32(
   }
 
   /**
+   * @brief Sends an inter-processor interrupt to the specified target
+   * processor.
+   *
+   * This operation is undefined for target processor indices out of range.
+   *
+   * @param[in] target_processor_index The target processor index.
+   */
+  void _CPU_SMP_Send_interrupt( uint32_t target_processor_index );
+
+  /**
    * @brief Broadcasts a processor event.
    *
    * Some architectures provide a low-level synchronization primitive for
diff --git a/cpukit/score/cpu/powerpc/rtems/score/cpu.h b/cpukit/score/cpu/powerpc/rtems/score/cpu.h
index 9b1917e..759f9dd 100644
--- a/cpukit/score/cpu/powerpc/rtems/score/cpu.h
+++ b/cpukit/score/cpu/powerpc/rtems/score/cpu.h
@@ -1014,6 +1014,7 @@ void _CPU_Context_validate( uintptr_t pattern );
     return pir;
   }
 
+  void _CPU_SMP_Send_interrupt( uint32_t target_processor_index );
 
   static inline void _CPU_Processor_event_broadcast( void )
   {
diff --git a/cpukit/score/cpu/sparc/rtems/score/cpu.h b/cpukit/score/cpu/sparc/rtems/score/cpu.h
index e4eb65e..8ba7a41 100644
--- a/cpukit/score/cpu/sparc/rtems/score/cpu.h
+++ b/cpukit/score/cpu/sparc/rtems/score/cpu.h
@@ -1188,6 +1188,8 @@ void _CPU_Context_restore(
 
   RTEMS_COMPILER_PURE_ATTRIBUTE uint32_t _CPU_SMP_Get_current_processor( void );
 
+  void _CPU_SMP_Send_interrupt( uint32_t target_processor_index );
+
   static inline void _CPU_Processor_event_broadcast( void )
   {
     __asm__ volatile ( "" : : : "memory" );
diff --git a/cpukit/score/include/rtems/bspsmp.h b/cpukit/score/include/rtems/bspsmp.h
index 57f5a7a..ec8be9f 100644
--- a/cpukit/score/include/rtems/bspsmp.h
+++ b/cpukit/score/include/rtems/bspsmp.h
@@ -84,18 +84,6 @@ uint32_t bsp_smp_initialize( uint32_t configured_cpu_count );
 void bsp_smp_broadcast_interrupt(void);
 
 /**
- *  @brief Generate a interprocessor interrupt.
- *
- *  This method is invoked by RTEMS to let @a cpu know that it
- *  has sent it a message.
- *
- *  @param [in] cpu is the recipient CPU
- */
-void bsp_smp_interrupt_cpu(
-  int cpu
-);
-
-/**
  * @brief Performs high-level initialization of a secondary processor and runs
  * the application threads.
  *
diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c
index 8e06d04..4d2a1b5 100644
--- a/cpukit/score/src/smp.c
+++ b/cpukit/score/src/smp.c
@@ -121,7 +121,7 @@ void _SMP_Send_message( uint32_t cpu, uint32_t message )
   per_cpu->message |= message;
   _Per_CPU_Lock_release( per_cpu, level );
 
-  bsp_smp_interrupt_cpu( cpu );
+  _CPU_SMP_Send_interrupt( cpu );
 }
 
 void _SMP_Broadcast_message( uint32_t message )
-- 
1.7.7




More information about the devel mailing list