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

4.11
Last change on this file since 98f2d5c was 6c5c2f3, checked in by Sebastian Huber <sebastian.huber@…>, on May 12, 2014 at 7:23:51 AM

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
Line 
1/**
2 * @file
3 * @ingroup sparc_leon3
4 * @brief LEON3 SMP BSP Support
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
13 *  http://www.rtems.org/license/LICENSE.
14 */
15
16#include <bsp.h>
17#include <bsp/bootcard.h>
18#include <leon.h>
19#include <rtems/bspIo.h>
20#include <rtems/score/smpimpl.h>
21#include <stdlib.h>
22
23#if !defined(__leon__)
24uint32_t _CPU_SMP_Get_current_processor( void )
25{
26  return _LEON3_Get_current_processor();
27}
28#endif
29
30static rtems_isr bsp_inter_processor_interrupt(
31  rtems_vector_number vector
32)
33{
34  _SMP_Inter_processor_interrupt_handler();
35}
36
37void bsp_start_on_secondary_processor()
38{
39  uint32_t cpu_index_self = _CPU_SMP_Get_current_processor();
40
41  leon3_set_cache_control_register(0x80000F);
42  /* Unmask IPI interrupts at Interrupt controller for this CPU */
43  LEON3_IrqCtrl_Regs->mask[cpu_index_self] |= 1U << LEON3_MP_IRQ;
44
45  _SMP_Start_multitasking_on_secondary_processor();
46}
47
48uint32_t _CPU_SMP_Initialize( void )
49{
50  leon3_set_cache_control_register(0x80000F);
51
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  }
56
57  return leon3_get_cpu_count(LEON3_IrqCtrl_Regs);
58}
59
60bool _CPU_SMP_Start_processor( uint32_t cpu_index )
61{
62  #if defined(RTEMS_DEBUG)
63    printk( "Waking CPU %d\n", cpu_index );
64  #endif
65
66  LEON3_IrqCtrl_Regs->mpstat = 1U << cpu_index;
67
68  return true;
69}
70
71void _CPU_SMP_Finalize_initialization( uint32_t cpu_count )
72{
73  (void) cpu_count;
74
75  /* Nothing to do */
76}
77
78void _CPU_SMP_Send_interrupt(uint32_t target_processor_index)
79{
80  /* send interrupt to destination CPU */
81  LEON3_IrqCtrl_Regs->force[target_processor_index] = 1 << LEON3_MP_IRQ;
82}
Note: See TracBrowser for help on using the repository browser.