[rtems commit] bsps/pc386: Separate smp API functions. Makes smpfatal08 link
Chris Johns
chrisj at rtems.org
Wed Jun 17 01:55:03 UTC 2020
Module: rtems
Branch: master
Commit: 208cd6b7948675022d8ea9bb394e3610c3607d07
Changeset: http://git.rtems.org/rtems/commit/?id=208cd6b7948675022d8ea9bb394e3610c3607d07
Author: Jan Sommer <jan.sommer at dlr.de>
Date: Sun May 31 16:22:57 2020 +0200
bsps/pc386: Separate smp API functions. Makes smpfatal08 link
---
bsps/i386/include/bsp/smp-imps.h | 3 +++
bsps/i386/pc386/include/bsp.h | 7 ++++++
bsps/i386/pc386/start/bspsmp.c | 43 +++++++++++++++++++++++++++++++++
bsps/i386/pc386/start/getcpuid.c | 22 -----------------
bsps/i386/pc386/start/smp-imps.c | 40 ++++++------------------------
c/src/lib/libbsp/i386/pc386/Makefile.am | 2 +-
6 files changed, 61 insertions(+), 56 deletions(-)
diff --git a/bsps/i386/include/bsp/smp-imps.h b/bsps/i386/include/bsp/smp-imps.h
index 03434b8..7b023dd 100644
--- a/bsps/i386/include/bsp/smp-imps.h
+++ b/bsps/i386/include/bsp/smp-imps.h
@@ -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
*/
diff --git a/bsps/i386/pc386/include/bsp.h b/bsps/i386/pc386/include/bsp.h
index 7989b88..1ed92e4 100644
--- a/bsps/i386/pc386/include/bsp.h
+++ b/bsps/i386/pc386/include/bsp.h
@@ -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
diff --git a/bsps/i386/pc386/start/bspsmp.c b/bsps/i386/pc386/start/bspsmp.c
new file mode 100644
index 0000000..026f869
--- /dev/null
+++ b/bsps/i386/pc386/start/bspsmp.c
@@ -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 );
+}
diff --git a/bsps/i386/pc386/start/getcpuid.c b/bsps/i386/pc386/start/getcpuid.c
deleted file mode 100644
index 4918a2a..0000000
--- a/bsps/i386/pc386/start/getcpuid.c
+++ /dev/null
@@ -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))];
-}
-
diff --git a/bsps/i386/pc386/start/smp-imps.c b/bsps/i386/pc386/start/smp-imps.c
index 6480c0d..de593f3 100644
--- a/bsps/i386/pc386/start/smp-imps.c
+++ b/bsps/i386/pc386/start/smp-imps.c
@@ -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 );
-}
diff --git a/c/src/lib/libbsp/i386/pc386/Makefile.am b/c/src/lib/libbsp/i386/pc386/Makefile.am
index c71f672..6f4f156 100644
--- a/c/src/lib/libbsp/i386/pc386/Makefile.am
+++ b/c/src/lib/libbsp/i386/pc386/Makefile.am
@@ -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
More information about the vc
mailing list