summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-02-19 16:42:23 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-02-21 09:38:56 +0100
commit7ec8d95a1e30ba2fba0a619b023dfb184703b041 (patch)
tree329cf10c676abb793105df05668b93cd15f12a4e
parentbsp/leon3: Add leon3_power_down_loop() (diff)
downloadrtems-7ec8d95a1e30ba2fba0a619b023dfb184703b041.tar.bz2
bsp/leon3: Add and use leon3_get_cpu_count()
-rw-r--r--c/src/lib/libbsp/sparc/leon3/include/leon.h9
-rw-r--r--c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c3
2 files changed, 10 insertions, 2 deletions
diff --git a/c/src/lib/libbsp/sparc/leon3/include/leon.h b/c/src/lib/libbsp/sparc/leon3/include/leon.h
index 1141bac9da..ccee1a381d 100644
--- a/c/src/lib/libbsp/sparc/leon3/include/leon.h
+++ b/c/src/lib/libbsp/sparc/leon3/include/leon.h
@@ -334,6 +334,15 @@ void bsp_debug_uart_init(void);
void leon3_power_down_loop(void) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE;
+static inline uint32_t leon3_get_cpu_count(
+ volatile struct irqmp_regs *irqmp
+)
+{
+ uint32_t mpstat = irqmp->mpstat;
+
+ return ((mpstat >> LEON3_IRQMPSTATUS_CPUNR) & 0xf) + 1;
+}
+
#endif /* !ASM */
#ifdef __cplusplus
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 59861b344b..e8f6b6331c 100644
--- a/c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c
+++ b/c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c
@@ -55,8 +55,7 @@ uint32_t _CPU_SMP_Initialize( uint32_t configured_cpu_count )
sparc_leon3_set_cctrl( 0x80000F );
- max_cpu_count =
- ((LEON3_IrqCtrl_Regs->mpstat >> LEON3_IRQMPSTATUS_CPUNR) & 0xf) + 1;
+ 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;