mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2 1/3] ARM: asm: Add convenience fucntions to access VBAR
@ 2016-01-11  0:58 Andrey Smirnov
  2016-01-11  0:58 ` [PATCH 2/3] ARM: mmu: Add VBAR setup Andrey Smirnov
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Andrey Smirnov @ 2016-01-11  0:58 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

Add two functions to get/set VBAR register.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---

Changes since v1 (http://lists.infradead.org/pipermail/barebox/2015-December/025685.html):

 - Use CONFIG_CPU_32v7 instead of __LINUX_ARM_ARCH__

---
 arch/arm/include/asm/system.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index 26fb18c..b118a42 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -71,6 +71,26 @@ static inline void set_cr(unsigned int val)
 	isb();
 }

+#ifdef CONFIG_CPU_32v7
+static inline unsigned int get_vbar(void)
+{
+	unsigned int vbar;
+	asm volatile("mrc p15, 0, %0, c12, c0, 0 @ get VBAR"
+		     : "=r" (vbar) : : "cc");
+	return vbar;
+}
+
+static inline void set_vbar(unsigned int vbar)
+{
+	asm volatile("mcr p15, 0, %0, c12, c0, 0 @ set VBAR"
+		     : : "r" (vbar) : "cc");
+	isb();
+}
+#else
+static inline unsigned int get_vbar(void) { return 0; }
+static inline void set_vbar(unsigned int vbar) {}
+#endif
+
 #endif

 #endif /* __ASM_ARM_SYSTEM_H */
--
2.5.0

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-01-12  8:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-11  0:58 [PATCH v2 1/3] ARM: asm: Add convenience fucntions to access VBAR Andrey Smirnov
2016-01-11  0:58 ` [PATCH 2/3] ARM: mmu: Add VBAR setup Andrey Smirnov
2016-01-11  0:58 ` [PATCH 3/3] ARM: Fix exception table setup in MMU-less mode Andrey Smirnov
2016-01-11 10:49 ` [PATCH v2 1/3] ARM: asm: Add convenience fucntions to access VBAR Sascha Hauer
2016-01-11 23:58   ` Andrey Smirnov
2016-01-12  8:45     ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox