diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-04-10 15:48:05 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-04-14 08:37:04 +0200 |
commit | 53e008b6fda8ccd1cdcf0f000bbccf1d3788206b (patch) | |
tree | 09adbf721ce5e3356ed61e4ee59a767994810873 /c/src/lib/libbsp/sparc | |
parent | score: Add _Per_CPU_Get_snapshot() (diff) | |
download | rtems-53e008b6fda8ccd1cdcf0f000bbccf1d3788206b.tar.bz2 |
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.
Diffstat (limited to 'c/src/lib/libbsp/sparc')
-rw-r--r-- | c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c | 50 |
1 files changed, 20 insertions, 30 deletions
diff --git a/c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c b/c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c index 2470e76fce..6681525861 100644 --- a/c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c +++ b/c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c @@ -26,53 +26,43 @@ static rtems_isr bsp_inter_processor_interrupt( _SMP_Inter_processor_interrupt_handler(); } -void leon3_secondary_cpu_initialize(uint32_t cpu) +void leon3_secondary_cpu_initialize(uint32_t cpu_index) { leon3_set_cache_control_register(0x80000F); /* Unmask IPI interrupts at Interrupt controller for this CPU */ - LEON3_IrqCtrl_Regs->mask[cpu] |= 1 << LEON3_MP_IRQ; + LEON3_IrqCtrl_Regs->mask[cpu_index] |= 1U << LEON3_MP_IRQ; _SMP_Start_multitasking_on_secondary_processor(); } -uint32_t _CPU_SMP_Initialize( uint32_t configured_cpu_count ) +uint32_t _CPU_SMP_Initialize( void ) { - uint32_t max_cpu_count; - uint32_t used_cpu_count; - uint32_t cpu; - leon3_set_cache_control_register(0x80000F); - max_cpu_count = leon3_get_cpu_count(LEON3_IrqCtrl_Regs); - used_cpu_count = configured_cpu_count < max_cpu_count ? - configured_cpu_count : max_cpu_count; + if ( rtems_configuration_get_maximum_processors() > 1 ) { + LEON_Unmask_interrupt(LEON3_MP_IRQ); + set_vector(bsp_inter_processor_interrupt, LEON_TRAP_TYPE(LEON3_MP_IRQ), 1); + } - #if defined(RTEMS_DEBUG) - printk( "Found %d CPUs\n", max_cpu_count ); + return leon3_get_cpu_count(LEON3_IrqCtrl_Regs); +} - if ( max_cpu_count > configured_cpu_count ) { - printk( - "%d CPUs IS MORE THAN CONFIGURED -- ONLY USING %d\n", - max_cpu_count, - configured_cpu_count - ); - } +bool _CPU_SMP_Start_processor( uint32_t cpu_index ) +{ + #if defined(RTEMS_DEBUG) + printk( "Waking CPU %d\n", cpu_index ); #endif - if ( used_cpu_count > 1 ) { - LEON_Unmask_interrupt(LEON3_MP_IRQ); - set_vector(bsp_inter_processor_interrupt, LEON_TRAP_TYPE(LEON3_MP_IRQ), 1); - } + LEON3_IrqCtrl_Regs->mpstat = 1U << cpu_index; - for ( cpu = 1 ; cpu < used_cpu_count ; ++cpu ) { - #if defined(RTEMS_DEBUG) - printk( "Waking CPU %d\n", cpu ); - #endif + return true; +} - LEON3_IrqCtrl_Regs->mpstat = 1 << cpu; - } +void _CPU_SMP_Finalize_initialization( uint32_t cpu_count ) +{ + (void) cpu_count; - return used_cpu_count; + /* Nothing to do */ } void _CPU_SMP_Send_interrupt(uint32_t target_processor_index) |