[POWERPC] 4xx: Add mfspr/mtspr inline macros to 4xx bootwrapper
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 21 Dec 2007 04:39:32 +0000 (15:39 +1100)
committerJosh Boyer <jwboyer@linux.vnet.ibm.com>
Sun, 23 Dec 2007 19:14:22 +0000 (13:14 -0600)
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>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
arch/powerpc/boot/reg.h

index d3cd9ee..9c2c997 100644 (file)
@@ -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)