diff options
Diffstat (limited to 'arch/arm/include')
-rw-r--r-- | arch/arm/include/asm/smp_plat.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/arm/include/asm/smp_plat.h b/arch/arm/include/asm/smp_plat.h index 558d6c80aca9..aaa61b6f50ff 100644 --- a/arch/arm/include/asm/smp_plat.h +++ b/arch/arm/include/asm/smp_plat.h | |||
@@ -5,6 +5,9 @@ | |||
5 | #ifndef __ASMARM_SMP_PLAT_H | 5 | #ifndef __ASMARM_SMP_PLAT_H |
6 | #define __ASMARM_SMP_PLAT_H | 6 | #define __ASMARM_SMP_PLAT_H |
7 | 7 | ||
8 | #include <linux/cpumask.h> | ||
9 | #include <linux/err.h> | ||
10 | |||
8 | #include <asm/cputype.h> | 11 | #include <asm/cputype.h> |
9 | 12 | ||
10 | /* | 13 | /* |
@@ -48,5 +51,19 @@ static inline int cache_ops_need_broadcast(void) | |||
48 | */ | 51 | */ |
49 | extern int __cpu_logical_map[]; | 52 | extern int __cpu_logical_map[]; |
50 | #define cpu_logical_map(cpu) __cpu_logical_map[cpu] | 53 | #define cpu_logical_map(cpu) __cpu_logical_map[cpu] |
54 | /* | ||
55 | * Retrieve logical cpu index corresponding to a given MPIDR[23:0] | ||
56 | * - mpidr: MPIDR[23:0] to be used for the look-up | ||
57 | * | ||
58 | * Returns the cpu logical index or -EINVAL on look-up error | ||
59 | */ | ||
60 | static inline int get_logical_index(u32 mpidr) | ||
61 | { | ||
62 | int cpu; | ||
63 | for (cpu = 0; cpu < nr_cpu_ids; cpu++) | ||
64 | if (cpu_logical_map(cpu) == mpidr) | ||
65 | return cpu; | ||
66 | return -EINVAL; | ||
67 | } | ||
51 | 68 | ||
52 | #endif | 69 | #endif |