|
@@ -5,6 +5,9 @@
|
|
|
#ifndef __ASMARM_SMP_PLAT_H
|
|
|
#define __ASMARM_SMP_PLAT_H
|
|
|
|
|
|
+#include <linux/cpumask.h>
|
|
|
+#include <linux/err.h>
|
|
|
+
|
|
|
#include <asm/cputype.h>
|
|
|
|
|
|
/*
|
|
@@ -48,5 +51,19 @@ static inline int cache_ops_need_broadcast(void)
|
|
|
*/
|
|
|
extern int __cpu_logical_map[];
|
|
|
#define cpu_logical_map(cpu) __cpu_logical_map[cpu]
|
|
|
+/*
|
|
|
+ * Retrieve logical cpu index corresponding to a given MPIDR[23:0]
|
|
|
+ * - mpidr: MPIDR[23:0] to be used for the look-up
|
|
|
+ *
|
|
|
+ * Returns the cpu logical index or -EINVAL on look-up error
|
|
|
+ */
|
|
|
+static inline int get_logical_index(u32 mpidr)
|
|
|
+{
|
|
|
+ int cpu;
|
|
|
+ for (cpu = 0; cpu < nr_cpu_ids; cpu++)
|
|
|
+ if (cpu_logical_map(cpu) == mpidr)
|
|
|
+ return cpu;
|
|
|
+ return -EINVAL;
|
|
|
+}
|
|
|
|
|
|
#endif
|