linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 14/20] [POWERPC] Add mfspr/mtspr inline macros to 4xx bootwrapper
@ 2007-12-13  7:38 Benjamin Herrenschmidt
  0 siblings, 0 replies; only message in thread
From: Benjamin Herrenschmidt @ 2007-12-13  7:38 UTC (permalink / raw)
  To: Josh Boyer; +Cc: linuxppc-dev

The 4xx bootwrapper occasionally needs to access SPR registers,
this adds mfspr/mtspr wrappers to it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---

===================================================================
 arch/powerpc/boot/reg.h |    8 ++++++++
 1 file changed, 8 insertions(+)

--- linux-work.orig/arch/powerpc/boot/reg.h	2007-12-10 15:52:03.000000000 +1100
+++ linux-work/arch/powerpc/boot/reg.h	2007-12-10 16:41:21.000000000 +1100
@@ -16,6 +16,14 @@ static inline u32 mfpvr(void)
 	return pvr;
 }
 
+#define __stringify_1(x)	#x
+#define __stringify(x)		__stringify_1(x)
+
+#define mfspr(rn)	({unsigned long rval; \
+			asm volatile("mfspr %0," __stringify(rn) \
+				: "=r" (rval)); rval; })
+#define mtspr(rn, v)	asm volatile("mtspr " __stringify(rn) ",%0" : : "r" (v))
+
 register void *__stack_pointer asm("r1");
 #define get_sp()	(__stack_pointer)
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-12-13  7:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-13  7:38 [PATCH 14/20] [POWERPC] Add mfspr/mtspr inline macros to 4xx bootwrapper Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).