From ee41eea947ebe2f1f627fafe0e429b5dcaaab944 Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Fri, 21 Dec 2007 15:39:32 +1100 Subject: [PATCH] [POWERPC] 4xx: Add mfspr/mtspr inline macros to 4xx bootwrapper The 4xx bootwrapper occasionally needs to access SPR registers, this adds mfspr/mtspr wrappers to it. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Josh Boyer --- arch/powerpc/boot/reg.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/powerpc/boot/reg.h b/arch/powerpc/boot/reg.h index d3cd9ee98a..9c2c9978e0 100644 --- a/arch/powerpc/boot/reg.h +++ b/arch/powerpc/boot/reg.h @@ -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) -- 2.39.5