[rtems commit] bsp/leon3: Add and use leon3_get_cpu_count()
Sebastian Huber
sebh at rtems.org
Fri Feb 21 08:33:12 UTC 2014
Module: rtems
Branch: master
Commit: 7ec8d95a1e30ba2fba0a619b023dfb184703b041
Changeset: http://git.rtems.org/rtems/commit/?id=7ec8d95a1e30ba2fba0a619b023dfb184703b041
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Wed Feb 19 16:42:23 2014 +0100
bsp/leon3: Add and use leon3_get_cpu_count()
---
c/src/lib/libbsp/sparc/leon3/include/leon.h | 9 +++++++++
c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c | 3 +--
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 1141bac..ccee1a3 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 59861b3..e8f6b63 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;
More information about the vc
mailing list