source: rtems/c/src/lib/libbsp/sparc/leon3/startup/bspsmp.c @ 64a04ac

4.115
Last change on this file since 64a04ac was 64a04ac, checked in by Sebastian Huber <sebastian.huber@…>, on 05/12/14 at 06:53:11

bsps: Use standard file name for BSP support

  • 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>
[3d77001]17#include <leon.h>
[fdcd80e]18#include <rtems/bspIo.h>
[911b1d2]19#include <rtems/score/smpimpl.h>
[fdcd80e]20#include <stdlib.h>
21
[64a04ac]22#if !defined(__leon__)
23uint32_t _CPU_SMP_Get_current_processor( void )
24{
25  return _LEON3_Get_current_processor();
26}
27#endif
28
[4d9bd56]29static rtems_isr bsp_inter_processor_interrupt(
[fdcd80e]30  rtems_vector_number vector
31)
32{
[4d9bd56]33  _SMP_Inter_processor_interrupt_handler();
[fdcd80e]34}
35
[53e008b]36void leon3_secondary_cpu_initialize(uint32_t cpu_index)
[fdcd80e]37{
[80186ca8]38  leon3_set_cache_control_register(0x80000F);
[7fe05615]39  /* Unmask IPI interrupts at Interrupt controller for this CPU */
[53e008b]40  LEON3_IrqCtrl_Regs->mask[cpu_index] |= 1U << LEON3_MP_IRQ;
[8cacceb]41
[911b1d2]42  _SMP_Start_multitasking_on_secondary_processor();
[fdcd80e]43}
44
[53e008b]45uint32_t _CPU_SMP_Initialize( void )
[fdcd80e]46{
[80186ca8]47  leon3_set_cache_control_register(0x80000F);
[e644155a]48
[53e008b]49  if ( rtems_configuration_get_maximum_processors() > 1 ) {
50    LEON_Unmask_interrupt(LEON3_MP_IRQ);
51    set_vector(bsp_inter_processor_interrupt, LEON_TRAP_TYPE(LEON3_MP_IRQ), 1);
52  }
[d212acb7]53
[53e008b]54  return leon3_get_cpu_count(LEON3_IrqCtrl_Regs);
55}
[fdcd80e]56
[53e008b]57bool _CPU_SMP_Start_processor( uint32_t cpu_index )
58{
59  #if defined(RTEMS_DEBUG)
60    printk( "Waking CPU %d\n", cpu_index );
[d212acb7]61  #endif
[fdcd80e]62
[53e008b]63  LEON3_IrqCtrl_Regs->mpstat = 1U << cpu_index;
[fdcd80e]64
[53e008b]65  return true;
66}
[fdcd80e]67
[53e008b]68void _CPU_SMP_Finalize_initialization( uint32_t cpu_count )
69{
70  (void) cpu_count;
[3d77001]71
[53e008b]72  /* Nothing to do */
[fdcd80e]73}
74
[ca63ae2]75void _CPU_SMP_Send_interrupt(uint32_t target_processor_index)
[fdcd80e]76{
77  /* send interrupt to destination CPU */
[ca63ae2]78  LEON3_IrqCtrl_Regs->force[target_processor_index] = 1 << LEON3_MP_IRQ;
[fdcd80e]79}
Note: See TracBrowser for help on using the repository browser.