ARM: Provide common header for hard_smp_processor_id()
authorRussell King <rmk+kernel@arm.linux.org.uk>
Sat, 4 Sep 2010 15:14:20 +0000 (16:14 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Mon, 4 Oct 2010 19:20:45 +0000 (20:20 +0100)
Provide a common header to read the SMP CPU number from the MPIDR.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/include/asm/smp_mpidr.h [new file with mode: 0644]
arch/arm/mach-realview/include/mach/smp.h
arch/arm/mach-s5pv310/include/mach/smp.h
arch/arm/mach-tegra/include/mach/smp.h
arch/arm/mach-ux500/include/mach/smp.h
arch/arm/mach-vexpress/include/mach/smp.h
arch/arm/plat-omap/include/plat/smp.h

diff --git a/arch/arm/include/asm/smp_mpidr.h b/arch/arm/include/asm/smp_mpidr.h
new file mode 100644 (file)
index 0000000..7da7105
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef ASMARM_SMP_MIDR_H
+#define ASMARM_SMP_MIDR_H
+
+#define hard_smp_processor_id()                                                \
+       ({                                                              \
+               unsigned int cpunum;                                    \
+               __asm__("mrc p15, 0, %0, c0, c0, 5\n"                   \
+                       : "=r" (cpunum));                               \
+               cpunum &= 0x0F;                                         \
+       })
+
+#endif
index dd53892d44a7adbaa7758cbb2293e43ee2af1433..d3cd265cb058c4acf0d29c4a14a16e097aa1ee55 100644 (file)
@@ -1,16 +1,8 @@
 #ifndef ASMARM_ARCH_SMP_H
 #define ASMARM_ARCH_SMP_H
 
-
 #include <asm/hardware/gic.h>
-
-#define hard_smp_processor_id()                        \
-       ({                                              \
-               unsigned int cpunum;                    \
-               __asm__("mrc p15, 0, %0, c0, c0, 5"     \
-                       : "=r" (cpunum));               \
-               cpunum &= 0x0F;                         \
-       })
+#include <asm/smp_mpidr.h>
 
 /*
  * We use IRQ1 as the IPI
index 990f3ba88a1fb59cee621cacd21e2ff72b263f0e..b7ec252384f47059f681ddad95c1d183ad8b39dc 100644 (file)
@@ -7,17 +7,10 @@
 #define ASM_ARCH_SMP_H __FILE__
 
 #include <asm/hardware/gic.h>
+#include <asm/smp_mpidr.h>
 
 extern void __iomem *gic_cpu_base_addr;
 
-#define hard_smp_processor_id()                        \
-       ({                                              \
-               unsigned int cpunum;                    \
-               __asm__("mrc p15, 0, %0, c0, c0, 5"     \
-                       : "=r" (cpunum));               \
-               cpunum &= 0x03;                         \
-       })
-
 /*
  * We use IRQ1 as the IPI
  */
index 8b42dab79a70ca17499b55c0ba9042e278428de5..e4a34a35a54466a1aecc7b3ea0ffe67c9dcee3df 100644 (file)
@@ -1,16 +1,8 @@
 #ifndef ASMARM_ARCH_SMP_H
 #define ASMARM_ARCH_SMP_H
 
-
 #include <asm/hardware/gic.h>
-
-#define hard_smp_processor_id()                        \
-       ({                                              \
-               unsigned int cpunum;                    \
-               __asm__("mrc p15, 0, %0, c0, c0, 5"     \
-                       : "=r" (cpunum));               \
-               cpunum &= 0x0F;                         \
-       })
+#include <asm/smp_mpidr.h>
 
 /*
  * We use IRQ1 as the IPI
index b59f7bc9725d251812f102b0443f1f714270afe8..197e8417375e17f38942e443a963a686cb90905b 100644 (file)
 #define ASMARM_ARCH_SMP_H
 
 #include <asm/hardware/gic.h>
+#include <asm/smp_mpidr.h>
 
 /* This is required to wakeup the secondary core */
 extern void u8500_secondary_startup(void);
 
-#define hard_smp_processor_id()                                \
-       ({                                              \
-               unsigned int cpunum;                    \
-               __asm__("mrc p15, 0, %0, c0, c0, 5"     \
-                       : "=r" (cpunum));               \
-               cpunum &= 0x0F;                         \
-       })
-
 /*
  * We use IRQ1 as the IPI
  */
index 72a9621ed087369eb265de17535e3d34d3693326..5a6da4fd247e86268c660d82ff8c4a4325021ffa 100644 (file)
@@ -2,14 +2,7 @@
 #define __MACH_SMP_H
 
 #include <asm/hardware/gic.h>
-
-#define hard_smp_processor_id()                                \
-       ({                                              \
-               unsigned int cpunum;                    \
-               __asm__("mrc p15, 0, %0, c0, c0, 5"     \
-                       : "=r" (cpunum));               \
-               cpunum &= 0x0F;                         \
-       })
+#include <asm/smp_mpidr.h>
 
 /*
  * We use IRQ1 as the IPI
index 5177a9c5a25acb62966f14763cf6aff842ee5a11..ecd6a488c497c28fda8aea2c3412a95b67e05cc7 100644 (file)
@@ -18,6 +18,7 @@
 #define OMAP_ARCH_SMP_H
 
 #include <asm/hardware/gic.h>
+#include <asm/smp_mpidr.h>
 
 /* Needed for secondary core boot */
 extern void omap_secondary_startup(void);
@@ -33,15 +34,4 @@ static inline void smp_cross_call(const struct cpumask *mask)
        gic_raise_softirq(mask, 1);
 }
 
-/*
- * Read MPIDR: Multiprocessor affinity register
- */
-#define hard_smp_processor_id()                        \
-       ({                                              \
-               unsigned int cpunum;                    \
-               __asm__("mrc p15, 0, %0, c0, c0, 5"     \
-                       : "=r" (cpunum));               \
-               cpunum &= 0x0F;                         \
-       })
-
 #endif