source: rtems/c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c @ 53e008b

4.115
Last change on this file since 53e008b was 53e008b, checked in by Sebastian Huber <sebastian.huber@…>, on Apr 10, 2014 at 1:48:05 PM

score: SMP initialization changes

Add and use _CPU_SMP_Start_processor(). Add and use
_CPU_SMP_Finalize_initialization(). This makes most
_CPU_SMP_Initialize() functions a bit simpler since we can calculate the
minimum value of the count of processors requested by the application
configuration and the count of physically or virtually available
processors in the high-level code.

The CPU port has now the ability to signal a processor start failure.
With the support for clustered/partitioned scheduling the presence of
particular processors can be configured to be optional or mandatory.
There will be a fatal error only in case mandatory processors are not
present.

The CPU port may use a timeout to monitor the start of a processor.

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