forked from Imagelibrary/rtems
smp: Simplify main CPU initialization
Call _SMP_Handler_initialize() later and move bsp_smp_initialize() into _SMP_Handler_initialize(). Change bsp_smp_initialize() prototype to match integer types of calling context.
This commit is contained in:
@@ -807,9 +807,7 @@ void bsp_smp_secondary_cpu_initialize(int cpu)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#include <rtems/bspsmp.h>
|
#include <rtems/bspsmp.h>
|
||||||
int bsp_smp_initialize(
|
uint32_t bsp_smp_initialize( uint32_t configured_cpu_count )
|
||||||
int maximum
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
int cores;
|
int cores;
|
||||||
/* XXX need to deal with finding too many cores */
|
/* XXX need to deal with finding too many cores */
|
||||||
|
|||||||
@@ -19,9 +19,7 @@ void bsp_smp_secondary_cpu_initialize(int cpu)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int bsp_smp_initialize(
|
uint32_t bsp_smp_initialize( uint32_t configured_cpu_count )
|
||||||
int maximum
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
/* return the number of CPUs */
|
/* return the number of CPUs */
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -57,12 +57,10 @@ void *bsp_ap_entry;
|
|||||||
|
|
||||||
static void bsp_smp_delay( int );
|
static void bsp_smp_delay( int );
|
||||||
|
|
||||||
int bsp_smp_initialize(
|
uint32_t bsp_smp_initialize( uint32_t configured_cpu_count )
|
||||||
int maximum
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
int cpu;
|
uint32_t cpu;
|
||||||
int found_cpus = 0;
|
uint32_t found_cpus = 0;
|
||||||
|
|
||||||
sparc_leon3_set_cctrl( 0x80000F );
|
sparc_leon3_set_cctrl( 0x80000F );
|
||||||
found_cpus =
|
found_cpus =
|
||||||
@@ -71,13 +69,13 @@ int bsp_smp_initialize(
|
|||||||
printk( "Found %d CPUs\n", found_cpus );
|
printk( "Found %d CPUs\n", found_cpus );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( found_cpus > rtems_configuration_get_maximum_processors() ) {
|
if ( found_cpus > configured_cpu_count ) {
|
||||||
printk(
|
printk(
|
||||||
"%d CPUs IS MORE THAN CONFIGURED -- ONLY USING %d\n",
|
"%d CPUs IS MORE THAN CONFIGURED -- ONLY USING %d\n",
|
||||||
found_cpus,
|
found_cpus,
|
||||||
rtems_configuration_get_maximum_processors()
|
configured_cpu_count
|
||||||
);
|
);
|
||||||
found_cpus = rtems_configuration_get_maximum_processors();
|
found_cpus = configured_cpu_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( found_cpus == 1 )
|
if ( found_cpus == 1 )
|
||||||
|
|||||||
@@ -119,10 +119,6 @@ void rtems_initialize_data_structures(void)
|
|||||||
|
|
||||||
_Thread_Dispatch_initialization();
|
_Thread_Dispatch_initialization();
|
||||||
|
|
||||||
#if defined(RTEMS_SMP)
|
|
||||||
_SMP_Handler_initialize();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_User_extensions_Handler_initialization();
|
_User_extensions_Handler_initialization();
|
||||||
_ISR_Handler_initialization();
|
_ISR_Handler_initialization();
|
||||||
|
|
||||||
@@ -159,12 +155,8 @@ void rtems_initialize_data_structures(void)
|
|||||||
_POSIX_API_Initialize();
|
_POSIX_API_Initialize();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* Discover and initialize the secondary cores in an SMP system.
|
|
||||||
*/
|
|
||||||
#if defined(RTEMS_SMP)
|
#if defined(RTEMS_SMP)
|
||||||
_SMP_Processor_count =
|
_SMP_Handler_initialize();
|
||||||
bsp_smp_initialize( rtems_configuration_get_maximum_processors() );
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );
|
_System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );
|
||||||
|
|||||||
@@ -50,21 +50,24 @@ extern "C" {
|
|||||||
|
|
||||||
|
|
||||||
#ifndef ASM
|
#ifndef ASM
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialize secondary CPUs.
|
* @brief Performs BSP specific SMP initialization in the context of the main
|
||||||
|
* processor.
|
||||||
*
|
*
|
||||||
* This method is invoked by RTEMS during initialization to bring the
|
* This function is invoked on the main processor by RTEMS during
|
||||||
* secondary CPUs out of reset.
|
* initialization. All interrupt stacks are allocated at this point in case
|
||||||
|
* the CPU port allocates the interrupt stacks.
|
||||||
*
|
*
|
||||||
* @param [in] maximum is the maximum number of CPU cores that RTEMS
|
* The BSP may start secondary processors now.
|
||||||
* can handle
|
|
||||||
*
|
*
|
||||||
* @retval This method returns the number of cores available in the
|
* @param[in] configured_cpu_count The count of processors requested by the
|
||||||
* system.
|
* application configuration.
|
||||||
|
*
|
||||||
|
* @return The count of processors available for the application in the system.
|
||||||
|
* This value is less than or equal to the configured count of processors.
|
||||||
*/
|
*/
|
||||||
int bsp_smp_initialize(
|
uint32_t bsp_smp_initialize( uint32_t configured_cpu_count );
|
||||||
int maximum
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Obtain current CPU index.
|
* @brief Obtain current CPU index.
|
||||||
|
|||||||
@@ -31,13 +31,14 @@
|
|||||||
|
|
||||||
void _SMP_Handler_initialize(void)
|
void _SMP_Handler_initialize(void)
|
||||||
{
|
{
|
||||||
int cpu;
|
uint32_t max_cpus = rtems_configuration_get_maximum_processors();
|
||||||
|
uint32_t cpu;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize per cpu pointer table
|
* Initialize per cpu pointer table
|
||||||
*/
|
*/
|
||||||
_Per_CPU_Information_p[0] = &_Per_CPU_Information[0];
|
_Per_CPU_Information_p[0] = &_Per_CPU_Information[0];
|
||||||
for (cpu=1 ; cpu < rtems_configuration_get_maximum_processors(); cpu++ ) {
|
for ( cpu = 1 ; cpu < max_cpus; ++cpu ) {
|
||||||
|
|
||||||
Per_CPU_Control *p = &_Per_CPU_Information[cpu];
|
Per_CPU_Control *p = &_Per_CPU_Information[cpu];
|
||||||
|
|
||||||
@@ -59,6 +60,13 @@
|
|||||||
p->state = RTEMS_BSP_SMP_CPU_INITIAL_STATE;
|
p->state = RTEMS_BSP_SMP_CPU_INITIAL_STATE;
|
||||||
RTEMS_COMPILER_MEMORY_BARRIER();
|
RTEMS_COMPILER_MEMORY_BARRIER();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Discover and initialize the secondary cores in an SMP system.
|
||||||
|
*/
|
||||||
|
max_cpus = bsp_smp_initialize( max_cpus );
|
||||||
|
|
||||||
|
_SMP_Processor_count = max_cpus;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user