Changeset df2ee9d in rtems


Ignore:
Timestamp:
Sep 7, 2016, 6:28:33 PM (3 years ago)
Author:
Pavel Pisa <pisa@…>
Branches:
master
Children:
40f49d1
Parents:
38a5385
git-author:
Pavel Pisa <pisa@…> (09/07/16 18:28:33)
git-committer:
Pavel Pisa <pisa@…> (09/07/16 18:29:39)
Message:

arm/raspberrypi: basic BCM2836 SMP implementation.

The BSP support is divided to startup/bspsmp_api.c file where
functions required by SuperCore? are defined and BCM2836 hardware
initialization part in startup/bspsmp_init.c.

Separation is done to prevent smpfatal08 test build failure.

Location:
c/src/lib/libbsp/arm/raspberrypi
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/arm/raspberrypi/Makefile.am

    r38a5385 rdf2ee9d  
    101101libbsp_a_SOURCES += startup/cmdline.c
    102102libbsp_a_SOURCES += startup/bspgetworkarea.c
     103if HAS_SMP
     104libbsp_a_SOURCES += startup/bspsmp_api.c
     105libbsp_a_SOURCES += startup/bspsmp_init.c
     106endif
    103107
    104108# IRQ
  • c/src/lib/libbsp/arm/raspberrypi/include/bsp.h

    r38a5385 rdf2ee9d  
    5151int rpi_video_is_initialized(void);
    5252
     53void rpi_ipi_initialize(void);
     54void rpi_start_rtems_on_secondary_processor(void);
     55
    5356#ifdef __cplusplus
    5457}
  • c/src/lib/libbsp/arm/raspberrypi/irq/irq.c

    r38a5385 rdf2ee9d  
    3232#include <rtems/bspIo.h>
    3333#include <strings.h>
     34
     35#ifdef RTEMS_SMP
     36#include <rtems/score/smp.h>
     37#include <rtems/score/smpimpl.h>
     38#endif
    3439
    3540typedef struct {
     
    98103  rtems_vector_number vector = 255;
    99104
     105#ifdef RTEMS_SMP
     106  uint32_t cpu_index_self = _SMP_Get_current_processor();
     107  uint32_t local_source = BCM2835_REG(BCM2836_IRQ_SOURCE_REG(cpu_index_self));
     108
     109  if ( local_source & BCM2836_IRQ_SOURCE_MBOX3 ) {
     110    /* reset mailbox 3 contents to zero */
     111    BCM2835_REG(BCM2836_MAILBOX_3_READ_CLEAR_BASE + 0x10 * cpu_index_self) = 0xffffffff;
     112    _SMP_Inter_processor_interrupt_handler();
     113  }
     114  if ( cpu_index_self != 0 )
     115    return;
     116#endif /* RTEMS_SMP */
     117
    100118  pend = BCM2835_REG(BCM2835_IRQ_BASIC);
    101119  if ( pend & BCM2835_IRQ_BASIC_SPEEDUP_USED_BITS ) {
  • c/src/lib/libbsp/arm/raspberrypi/startup/bspstarthooks.c

    r38a5385 rdf2ee9d  
    3030#include <bsp.h>
    3131
     32#ifdef RTEMS_SMP
     33#include <rtems/score/smp.h>
     34#endif
    3235
    3336void BSP_START_TEXT_SECTION bsp_start_hook_0(void)
    3437{
    3538  uint32_t sctlr_val;
     39#ifdef RTEMS_SMP
     40  uint32_t cpu_index_self = _SMP_Get_current_processor();
     41#endif /* RTEMS_SMP */
    3642
    3743  sctlr_val = arm_cp15_get_control();
     
    4955       * before switching off to be extra carefull.
    5056       */
    51       rtems_cache_flush_entire_data();
    52       rtems_cache_invalidate_entire_data();
     57#ifdef RTEMS_SMP
     58      if (cpu_index_self != 0) {
     59        arm_cp15_data_cache_clean_level(0);
     60        arm_cp15_cache_invalidate_level(0, 0);
     61      } else
     62#endif /* RTEMS_SMP */
     63      {
     64        rtems_cache_flush_entire_data();
     65        rtems_cache_invalidate_entire_data();
     66      }
    5367    }
    5468    arm_cp15_flush_prefetch_buffer();
     
    5670    arm_cp15_set_control(sctlr_val);
    5771  }
    58   rtems_cache_invalidate_entire_data();
     72#ifdef RTEMS_SMP
     73  if (cpu_index_self != 0) {
     74    arm_cp15_cache_invalidate_level(0, 0);
     75  } else
     76#endif /* RTEMS_SMP */
     77  {
     78    rtems_cache_invalidate_entire_data();
     79  }
    5980  rtems_cache_invalidate_entire_instruction();
    6081  arm_cp15_branch_predictor_invalidate_all();
     
    6788  /* Clear Secure or Non-secure Vector Base Address Register */
    6889  arm_cp15_set_vector_base_address(0);
     90
     91#ifdef RTEMS_SMP
     92  if (cpu_index_self == 0) {
     93    rpi_ipi_initialize();
     94  } else {
     95    rpi_start_rtems_on_secondary_processor();
     96  }
     97#endif
    6998}
    7099
  • c/src/lib/libbsp/arm/raspberrypi/startup/linkcmds.in

    r38a5385 rdf2ee9d  
    6262REGION_ALIAS ("REGION_NOCACHE_LOAD", RAM);
    6363
    64 bsp_stack_irq_size = DEFINED (bsp_stack_irq_size) ? bsp_stack_irq_size : 4096;
     64bsp_stack_irq_size = DEFINED (bsp_stack_irq_size) ? bsp_stack_irq_size : 3008;
    6565bsp_stack_abt_size = DEFINED (bsp_stack_abt_size) ? bsp_stack_abt_size : 1024;
    6666
  • c/src/lib/libbsp/arm/raspberrypi/startup/mm_config_table.c

    r38a5385 rdf2ee9d  
    8383    .flags = ARMV7_MMU_DEVICE
    8484  }
     85#if (BSP_IS_RPI2 == 1)
     86  /* Core local peripherals area - timer, mailboxes */
     87  , {
     88    .begin = BCM2836_CORE_LOCAL_PERIPH_BASE,
     89    .end =   BCM2836_CORE_LOCAL_PERIPH_BASE + BCM2836_CORE_LOCAL_PERIPH_SIZE,
     90    .flags = ARMV7_MMU_DEVICE
     91  }
     92#endif
    8593};
    8694
Note: See TracChangeset for help on using the changeset viewer.