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 | |
---|
22 | static rtems_isr bsp_inter_processor_interrupt( |
---|
23 | rtems_vector_number vector |
---|
24 | ) |
---|
25 | { |
---|
26 | _SMP_Inter_processor_interrupt_handler(); |
---|
27 | } |
---|
28 | |
---|
29 | void 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 | |
---|
38 | uint32_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 | |
---|
50 | bool _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 | |
---|
61 | void _CPU_SMP_Finalize_initialization( uint32_t cpu_count ) |
---|
62 | { |
---|
63 | (void) cpu_count; |
---|
64 | |
---|
65 | /* Nothing to do */ |
---|
66 | } |
---|
67 | |
---|
68 | void _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 | } |
---|