[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 | |
---|
[4d9bd56] | 22 | static rtems_isr bsp_inter_processor_interrupt( |
---|
[fdcd80e] | 23 | rtems_vector_number vector |
---|
| 24 | ) |
---|
| 25 | { |
---|
[4d9bd56] | 26 | _SMP_Inter_processor_interrupt_handler(); |
---|
[fdcd80e] | 27 | } |
---|
| 28 | |
---|
[53e008b] | 29 | void leon3_secondary_cpu_initialize(uint32_t cpu_index) |
---|
[fdcd80e] | 30 | { |
---|
[80186ca8] | 31 | leon3_set_cache_control_register(0x80000F); |
---|
[7fe05615] | 32 | /* Unmask IPI interrupts at Interrupt controller for this CPU */ |
---|
[53e008b] | 33 | LEON3_IrqCtrl_Regs->mask[cpu_index] |= 1U << LEON3_MP_IRQ; |
---|
[8cacceb] | 34 | |
---|
[911b1d2] | 35 | _SMP_Start_multitasking_on_secondary_processor(); |
---|
[fdcd80e] | 36 | } |
---|
| 37 | |
---|
[53e008b] | 38 | uint32_t _CPU_SMP_Initialize( void ) |
---|
[fdcd80e] | 39 | { |
---|
[80186ca8] | 40 | leon3_set_cache_control_register(0x80000F); |
---|
[e644155a] | 41 | |
---|
[53e008b] | 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 | } |
---|
[d212acb7] | 46 | |
---|
[53e008b] | 47 | return leon3_get_cpu_count(LEON3_IrqCtrl_Regs); |
---|
| 48 | } |
---|
[fdcd80e] | 49 | |
---|
[53e008b] | 50 | bool _CPU_SMP_Start_processor( uint32_t cpu_index ) |
---|
| 51 | { |
---|
| 52 | #if defined(RTEMS_DEBUG) |
---|
| 53 | printk( "Waking CPU %d\n", cpu_index ); |
---|
[d212acb7] | 54 | #endif |
---|
[fdcd80e] | 55 | |
---|
[53e008b] | 56 | LEON3_IrqCtrl_Regs->mpstat = 1U << cpu_index; |
---|
[fdcd80e] | 57 | |
---|
[53e008b] | 58 | return true; |
---|
| 59 | } |
---|
[fdcd80e] | 60 | |
---|
[53e008b] | 61 | void _CPU_SMP_Finalize_initialization( uint32_t cpu_count ) |
---|
| 62 | { |
---|
| 63 | (void) cpu_count; |
---|
[3d77001] | 64 | |
---|
[53e008b] | 65 | /* Nothing to do */ |
---|
[fdcd80e] | 66 | } |
---|
| 67 | |
---|
[ca63ae2] | 68 | void _CPU_SMP_Send_interrupt(uint32_t target_processor_index) |
---|
[fdcd80e] | 69 | { |
---|
| 70 | /* send interrupt to destination CPU */ |
---|
[ca63ae2] | 71 | LEON3_IrqCtrl_Regs->force[target_processor_index] = 1 << LEON3_MP_IRQ; |
---|
[fdcd80e] | 72 | } |
---|