source: rtems/c/src/lib/libbsp/sparc/leon3/startup/bspsmp.c @ 98f2d5c

4.115
Last change on this file since 98f2d5c was 6c5c2f3, checked in by Sebastian Huber <sebastian.huber@…>, on 05/12/14 at 07:23:51

bsps: Use bsp_start_on_secondary_processor()

Use a standard function for startup on secondary processors.

  • Property mode set to 100644
File size: 1.8 KB
RevLine 
[fdcd80e]1/**
[d230d8e]2 * @file
3 * @ingroup sparc_leon3
4 * @brief LEON3 SMP BSP Support
[fdcd80e]5 */
6
7/*
8 *  COPYRIGHT (c) 1989-2011.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
[c499856]13 *  http://www.rtems.org/license/LICENSE.
[fdcd80e]14 */
15
16#include <bsp.h>
[6c5c2f3]17#include <bsp/bootcard.h>
[3d77001]18#include <leon.h>
[fdcd80e]19#include <rtems/bspIo.h>
[911b1d2]20#include <rtems/score/smpimpl.h>
[fdcd80e]21#include <stdlib.h>
22
[64a04ac]23#if !defined(__leon__)
24uint32_t _CPU_SMP_Get_current_processor( void )
25{
26  return _LEON3_Get_current_processor();
27}
28#endif
29
[4d9bd56]30static rtems_isr bsp_inter_processor_interrupt(
[fdcd80e]31  rtems_vector_number vector
32)
33{
[4d9bd56]34  _SMP_Inter_processor_interrupt_handler();
[fdcd80e]35}
36
[6c5c2f3]37void bsp_start_on_secondary_processor()
[fdcd80e]38{
[6c5c2f3]39  uint32_t cpu_index_self = _CPU_SMP_Get_current_processor();
40
[80186ca8]41  leon3_set_cache_control_register(0x80000F);
[7fe05615]42  /* Unmask IPI interrupts at Interrupt controller for this CPU */
[6c5c2f3]43  LEON3_IrqCtrl_Regs->mask[cpu_index_self] |= 1U << LEON3_MP_IRQ;
[8cacceb]44
[911b1d2]45  _SMP_Start_multitasking_on_secondary_processor();
[fdcd80e]46}
47
[53e008b]48uint32_t _CPU_SMP_Initialize( void )
[fdcd80e]49{
[80186ca8]50  leon3_set_cache_control_register(0x80000F);
[e644155a]51
[53e008b]52  if ( rtems_configuration_get_maximum_processors() > 1 ) {
53    LEON_Unmask_interrupt(LEON3_MP_IRQ);
54    set_vector(bsp_inter_processor_interrupt, LEON_TRAP_TYPE(LEON3_MP_IRQ), 1);
55  }
[d212acb7]56
[53e008b]57  return leon3_get_cpu_count(LEON3_IrqCtrl_Regs);
58}
[fdcd80e]59
[53e008b]60bool _CPU_SMP_Start_processor( uint32_t cpu_index )
61{
62  #if defined(RTEMS_DEBUG)
63    printk( "Waking CPU %d\n", cpu_index );
[d212acb7]64  #endif
[fdcd80e]65
[53e008b]66  LEON3_IrqCtrl_Regs->mpstat = 1U << cpu_index;
[fdcd80e]67
[53e008b]68  return true;
69}
[fdcd80e]70
[53e008b]71void _CPU_SMP_Finalize_initialization( uint32_t cpu_count )
72{
73  (void) cpu_count;
[3d77001]74
[53e008b]75  /* Nothing to do */
[fdcd80e]76}
77
[ca63ae2]78void _CPU_SMP_Send_interrupt(uint32_t target_processor_index)
[fdcd80e]79{
80  /* send interrupt to destination CPU */
[ca63ae2]81  LEON3_IrqCtrl_Regs->force[target_processor_index] = 1 << LEON3_MP_IRQ;
[fdcd80e]82}
Note: See TracBrowser for help on using the repository browser.