]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
arm: Implement read_mpidr on armv7
authorPatrick Rudolph <patrick.rudolph@9elements.com>
Wed, 23 Oct 2024 13:20:15 +0000 (15:20 +0200)
committerTom Rini <trini@konsulko.com>
Sun, 27 Oct 2024 23:24:13 +0000 (17:24 -0600)
Implement read_mpidr() on armv7 to make use of it in generic
code that compiles on both armv7 and armv8.

Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
arch/arm/include/asm/system.h

index 2237d7d0066863a09c71fa492362f8d9098d018e..9eb30c2ade88dcb869bc120a43aae8be88695bbb 100644 (file)
@@ -394,6 +394,15 @@ void switch_to_hypervisor_ret(void);
 #define wfi()
 #endif
 
+static inline unsigned long read_mpidr(void)
+{
+       unsigned long val;
+
+       asm volatile("mrc p15, 0, %0, c0, c0, 5" : "=r" (val));
+
+       return val;
+}
+
 static inline unsigned long get_cpsr(void)
 {
        unsigned long cpsr;