Changeset fad33860 in rtems


Ignore:
Timestamp:
May 29, 2014, 7:39:18 PM (5 years ago)
Author:
Daniel Hellstrom <daniel@…>
Branches:
4.11, master
Children:
6aacf08
Parents:
fa40ec52
git-author:
Daniel Hellstrom <daniel@…> (05/29/14 19:39:18)
git-committer:
Daniel Hellstrom <daniel@…> (10/09/14 11:18:01)
Message:

LEON3 SMP: support static interrupt affinity

Changed LEON3_irq-mp to const also.

Location:
c/src/lib/libbsp/sparc
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/sparc/leon3/include/bsp.h

    rfa40ec52 rfad33860  
    221221 * See startup/bspsmp.c for the default value.
    222222 */
    223 extern unsigned char LEON3_mp_irq;
     223extern const unsigned char LEON3_mp_irq;
     224
     225#ifdef RTEMS_SMP
     226/* Weak table used to implement static interrupt CPU affinity in a SMP
     227 * configuration. The array index is the interrupt to be looked up, and
     228 * the array[INTERRUPT] content is the CPU number relative to boot CPU
     229 * index that will be servicing the interrupts from the IRQ source. The
     230 * default is to let the first CPU (the boot cpu) to handle all
     231 * interrupts (all zeros).
     232 */
     233extern const unsigned char LEON3_irq_to_cpu[32];
     234#endif
    224235
    225236#ifdef __cplusplus
  • c/src/lib/libbsp/sparc/leon3/startup/bspsmp.c

    rfa40ec52 rfad33860  
    2525 * Can be overridden by being defined in the application.
    2626 */
    27 unsigned char LEON3_mp_irq __attribute__((weak)) = 14;
     27const unsigned char LEON3_mp_irq __attribute__((weak)) = 14;
    2828
    2929#if !defined(__leon__) || defined(RTEMS_PARAVIRT)
  • c/src/lib/libbsp/sparc/shared/irq/irq-shared.c

    rfa40ec52 rfad33860  
    22#include <bsp.h>
    33#include <bsp/irq-generic.h>
     4
     5#if defined(RTEMS_SMP) && defined(LEON3)
     6/* Interrupt to CPU map. Default to CPU0 since in BSS. */
     7const unsigned char LEON3_irq_to_cpu[32] __attribute__((weak));
     8
     9/* On SMP use map table above relative to SMP Boot CPU (normally CPU0) */
     10static inline int bsp_irq_cpu(int irq)
     11{
     12  /* protect from bad user configuration, default to boot cpu */
     13  if (rtems_configuration_get_maximum_processors() <= LEON3_irq_to_cpu[irq])
     14    return LEON3_Cpu_Index;
     15  else
     16    return LEON3_Cpu_Index + LEON3_irq_to_cpu[irq];
     17}
     18#else
     19/* when not SMP the local CPU is returned */
     20static inline int bsp_irq_cpu(int irq)
     21{
     22#ifdef LEON3
     23  return _LEON3_Get_current_processor();
     24#else
     25  return 0;
     26#endif
     27}
     28#endif
    429
    530static inline void bsp_dispatch_irq(int irq)
     
    5580rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
    5681{
    57        BSP_Unmask_interrupt((int)vector);
     82  int irq = (int)vector;
     83  BSP_Cpu_Unmask_interrupt(irq, bsp_irq_cpu(irq));
    5884
    59        return RTEMS_SUCCESSFUL;
     85  return RTEMS_SUCCESSFUL;
    6086}
    6187
    6288rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
    6389{
    64        BSP_Mask_interrupt((int)vector);
     90  int irq = (int)vector;
     91  BSP_Cpu_Mask_interrupt(irq, bsp_irq_cpu(irq));
    6592
    66        return RTEMS_SUCCESSFUL;
     93  return RTEMS_SUCCESSFUL;
    6794}
    6895
    6996void BSP_shared_interrupt_mask(int irq)
    7097{
    71        BSP_Mask_interrupt(irq);
     98  BSP_Cpu_Mask_interrupt(irq, bsp_irq_cpu(irq));
    7299}
    73100
    74101void BSP_shared_interrupt_unmask(int irq)
    75102{
    76        BSP_Unmask_interrupt(irq);
     103  BSP_Cpu_Unmask_interrupt(irq, bsp_irq_cpu(irq));
    77104}
    78105
Note: See TracChangeset for help on using the changeset viewer.