mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-08-23 01:33:12 +08:00
bsps/pc386: Separate smp API functions. Makes smpfatal08 link
This commit is contained in:
@@ -233,6 +233,9 @@ extern unsigned char imps_apic_cpu_map[IMPS_MAX_CPUS];
|
||||
extern char _binary_appstart_bin_start[];
|
||||
extern char _binary_appstart_bin_size[];
|
||||
|
||||
/** @brief base address of the local apic. Usually 0xFEE00000 */
|
||||
extern unsigned imps_lapic_addr;
|
||||
|
||||
/*
|
||||
* Defines that use variables
|
||||
*/
|
||||
|
||||
@@ -252,6 +252,13 @@ uint32_t BSP_irq_count_dump(FILE *f);
|
||||
void raw_idt_notify(void);
|
||||
void C_dispatch_isr(int vector);
|
||||
|
||||
#ifdef RTEMS_SMP
|
||||
/* CPU specific functions used by the SMP API */
|
||||
int imps_probe(void);
|
||||
void ipi_install_irq(void);
|
||||
int send_ipi(unsigned int dst, unsigned int v);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
|
||||
#include <rtems/score/smpimpl.h>
|
||||
|
||||
#include <bsp/apic.h>
|
||||
#include <bsp/smp-imps.h>
|
||||
#include <bsp.h>
|
||||
#include <rtems.h>
|
||||
|
||||
void _CPU_SMP_Prepare_start_multitasking( void )
|
||||
{
|
||||
/* Do nothing */
|
||||
}
|
||||
|
||||
bool _CPU_SMP_Start_processor( uint32_t cpu_index )
|
||||
{
|
||||
(void) cpu_index;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
uint32_t _CPU_SMP_Get_current_processor( void )
|
||||
{
|
||||
return imps_apic_cpu_map[APIC_ID(IMPS_LAPIC_READ(LAPIC_ID))];
|
||||
}
|
||||
|
||||
uint32_t _CPU_SMP_Initialize( void )
|
||||
{
|
||||
/* XXX need to deal with finding too many cores */
|
||||
|
||||
return (uint32_t) imps_probe();
|
||||
}
|
||||
|
||||
void _CPU_SMP_Finalize_initialization( uint32_t cpu_count )
|
||||
{
|
||||
if ( cpu_count > 1 )
|
||||
ipi_install_irq();
|
||||
}
|
||||
|
||||
void _CPU_SMP_Send_interrupt( uint32_t target_processor_index )
|
||||
{
|
||||
send_ipi( target_processor_index, 0x30 );
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT (c) 2011.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.org/license/LICENSE.
|
||||
*/
|
||||
|
||||
#include <rtems/score/cpu.h>
|
||||
|
||||
#include <bsp/apic.h>
|
||||
#include <bsp/smp-imps.h>
|
||||
|
||||
static int lapic_dummy = 0;
|
||||
unsigned imps_lapic_addr = ((unsigned)(&lapic_dummy)) - LAPIC_ID;
|
||||
|
||||
uint32_t _CPU_SMP_Get_current_processor( void )
|
||||
{
|
||||
return imps_apic_cpu_map[APIC_ID(IMPS_LAPIC_READ(LAPIC_ID))];
|
||||
}
|
||||
|
||||
@@ -85,6 +85,9 @@
|
||||
extern void _pc386_delay(void);
|
||||
extern uint32_t* gdtdesc;
|
||||
|
||||
static int lapic_dummy = 0;
|
||||
unsigned imps_lapic_addr = ((unsigned)(&lapic_dummy)) - LAPIC_ID;
|
||||
|
||||
/* #define KERNEL_PRINT(_format) printk(_format) */
|
||||
|
||||
static void CMOS_WRITE_BYTE(
|
||||
@@ -220,7 +223,7 @@ get_checksum(unsigned start, int length)
|
||||
/*
|
||||
* APIC ICR write and status check function.
|
||||
*/
|
||||
static int
|
||||
int
|
||||
send_ipi(unsigned int dst, unsigned int v)
|
||||
{
|
||||
int to, send_status;
|
||||
@@ -698,7 +701,7 @@ imps_force(int ncpus)
|
||||
*
|
||||
* Function finished.
|
||||
*/
|
||||
static int
|
||||
int
|
||||
imps_probe(void)
|
||||
{
|
||||
/*
|
||||
@@ -768,7 +771,8 @@ static void bsp_inter_processor_interrupt(void *arg)
|
||||
_SMP_Inter_processor_interrupt_handler(_Per_CPU_Get());
|
||||
}
|
||||
|
||||
static void ipi_install_irq(void)
|
||||
void
|
||||
ipi_install_irq(void)
|
||||
{
|
||||
rtems_status_code status;
|
||||
|
||||
@@ -802,33 +806,3 @@ static void secondary_cpu_initialize(void)
|
||||
|
||||
_SMP_Start_multitasking_on_secondary_processor( _Per_CPU_Get() );
|
||||
}
|
||||
|
||||
uint32_t _CPU_SMP_Initialize( void )
|
||||
{
|
||||
/* XXX need to deal with finding too many cores */
|
||||
|
||||
return (uint32_t) imps_probe();
|
||||
}
|
||||
|
||||
void _CPU_SMP_Prepare_start_multitasking( void )
|
||||
{
|
||||
/* Do nothing */
|
||||
}
|
||||
|
||||
bool _CPU_SMP_Start_processor( uint32_t cpu_index )
|
||||
{
|
||||
(void) cpu_index;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void _CPU_SMP_Finalize_initialization( uint32_t cpu_count )
|
||||
{
|
||||
if ( cpu_count > 1 )
|
||||
ipi_install_irq();
|
||||
}
|
||||
|
||||
void _CPU_SMP_Send_interrupt( uint32_t target_processor_index )
|
||||
{
|
||||
send_ipi( target_processor_index, 0x30 );
|
||||
}
|
||||
|
||||
@@ -110,8 +110,8 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/i386/pc386/ata/idecfg.c
|
||||
endif
|
||||
|
||||
if HAS_SMP
|
||||
librtemsbsp_a_SOURCES += ../../../../../../bsps/i386/pc386/start/getcpuid.c
|
||||
librtemsbsp_a_SOURCES += ../../../../../../bsps/i386/pc386/start/smp-imps.c
|
||||
librtemsbsp_a_SOURCES += ../../../../../../bsps/i386/pc386/start/bspsmp.c
|
||||
|
||||
project_lib_DATA += appstart.$(OBJEXT)
|
||||
appcpustart.$(OBJEXT): ../../../../../../bsps/i386/pc386/start/startAP.S
|
||||
|
||||
Reference in New Issue
Block a user