[PATCH v2 01/21] ARM64: asm: implement read_cpuid_id()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We'll need to use this function in code that will be compiled for both
32-bit and 64-bit ARM, so add the 64-bit implementation.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 arch/arm/include/asm/cputype.h | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h
index 7dc027c1741b..c3fc05765060 100644
--- a/arch/arm/include/asm/cputype.h
+++ b/arch/arm/include/asm/cputype.h
@@ -6,6 +6,23 @@
 #include <linux/stringify.h>
 #include <linux/kernel.h>
 
+#ifdef CONFIG_CPU_64v8
+
+#define CPUID_ID	midr_el1
+#define CPUID_CACHETYPE	ctr_el0
+#define CPUID_MPIDR	mpidr_el1
+
+#define read_cpuid(reg)							\
+	({								\
+		unsigned int __val;					\
+		asm("mrs	%0, " __stringify(reg)			\
+		    : "=r" (__val)					\
+		    :							\
+		    : "cc");						\
+		__val;							\
+	})
+#else
+
 #define CPUID_ID	0
 #define CPUID_CACHETYPE	1
 #define CPUID_TCM	2
@@ -27,8 +44,6 @@
 #define CPUID_EXT_ISAR4	"c2, 4"
 #define CPUID_EXT_ISAR5	"c2, 5"
 
-extern unsigned int processor_id;
-
 #define read_cpuid(reg)							\
 	({								\
 		unsigned int __val;					\
@@ -47,6 +62,9 @@ extern unsigned int processor_id;
 		    : "cc");						\
 		__val;							\
 	})
+#endif
+
+extern unsigned int processor_id;
 
 /*
  * The CPU ID never changes at run time, so we might as well tell the
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux