aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-sh/system.h
diff options
context:
space:
mode:
authorStuart Menefy <stuart.menefy@st.com>2007-11-30 02:12:36 -0500
committerPaul Mundt <lethal@linux-sh.org>2008-01-27 23:18:58 -0500
commit1efe4ce3ca126da77e450d5a83f7201949d76f62 (patch)
treefbae9902aa4103a9e86d06f841d580f24682e7b3 /include/asm-sh/system.h
parent53ff09422e5e7a6d6198b767c8f494e43ec8e3ae (diff)
sh: GUSA atomic rollback support.
This implements kernel-level atomic rollback built on top of gUSA, as an alternative non-IRQ based atomicity method. This is generally a faster method for platforms that are lacking the LL/SC pairs that SH-4A and later use, and is only supportable on legacy cores. Signed-off-by: Stuart Menefy <stuart.menefy@st.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'include/asm-sh/system.h')
-rw-r--r--include/asm-sh/system.h40
1 files changed, 5 insertions, 35 deletions
diff --git a/include/asm-sh/system.h b/include/asm-sh/system.h
index ad3d2a636130..969f3d4afe2a 100644
--- a/include/asm-sh/system.h
+++ b/include/asm-sh/system.h
@@ -68,27 +68,11 @@
68 68
69#define set_mb(var, value) do { (void)xchg(&var, value); } while (0) 69#define set_mb(var, value) do { (void)xchg(&var, value); } while (0)
70 70
71static inline unsigned long xchg_u32(volatile u32 *m, unsigned long val) 71#ifdef CONFIG_GUSA_RB
72{ 72#include <asm/cmpxchg-grb.h>
73 unsigned long flags, retval; 73#else
74 74#include <asm/cmpxchg-irq.h>
75 local_irq_save(flags); 75#endif
76 retval = *m;
77 *m = val;
78 local_irq_restore(flags);
79 return retval;
80}
81
82static inline unsigned long xchg_u8(volatile u8 *m, unsigned long val)
83{
84 unsigned long flags, retval;
85
86 local_irq_save(flags);
87 retval = *m;
88 *m = val & 0xff;
89 local_irq_restore(flags);
90 return retval;
91}
92 76
93extern void __xchg_called_with_bad_pointer(void); 77extern void __xchg_called_with_bad_pointer(void);
94 78
@@ -115,20 +99,6 @@ extern void __xchg_called_with_bad_pointer(void);
115#define xchg(ptr,x) \ 99#define xchg(ptr,x) \
116 ((__typeof__(*(ptr)))__xchg((ptr),(unsigned long)(x), sizeof(*(ptr)))) 100 ((__typeof__(*(ptr)))__xchg((ptr),(unsigned long)(x), sizeof(*(ptr))))
117 101
118static inline unsigned long __cmpxchg_u32(volatile int * m, unsigned long old,
119 unsigned long new)
120{
121 __u32 retval;
122 unsigned long flags;
123
124 local_irq_save(flags);
125 retval = *m;
126 if (retval == old)
127 *m = new;
128 local_irq_restore(flags); /* implies memory barrier */
129 return retval;
130}
131
132/* This function doesn't exist, so you'll get a linker error 102/* This function doesn't exist, so you'll get a linker error
133 * if something tries to do an invalid cmpxchg(). */ 103 * if something tries to do an invalid cmpxchg(). */
134extern void __cmpxchg_called_with_bad_pointer(void); 104extern void __cmpxchg_called_with_bad_pointer(void);