diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-07-25 13:54:40 +1000 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-07-25 13:54:40 +1000 |
commit | a0236ff1b112b24c355dd6e7bcf145530b4e73b1 (patch) | |
tree | d3aa4f22d777a837bf8ad93063ed41535edb9c6e /include | |
parent | 8751768a4894c64daa75135a4e0e0ba5e7360fef (diff) | |
download | SLOF-a0236ff1b112b24c355dd6e7bcf145530b4e73b1.zip SLOF-a0236ff1b112b24c355dd6e7bcf145530b4e73b1.tar.gz SLOF-a0236ff1b112b24c355dd6e7bcf145530b4e73b1.tar.bz2 |
Use a global definition of sync() and mb()
For memory barriers accross the board. Also move the compiler barrier
to cpu.h
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/helpers.h | 6 | ||||
-rw-r--r-- | include/ppc970/cpu.h | 18 | ||||
-rw-r--r-- | include/ppcp7/cpu.h | 15 |
3 files changed, 27 insertions, 12 deletions
diff --git a/include/helpers.h b/include/helpers.h index e41d6a0..1a1f6e5 100644 --- a/include/helpers.h +++ b/include/helpers.h @@ -28,10 +28,4 @@ extern void SLOF_free_mem(void *addr, long size); extern long SLOF_dma_map_in(void *virt, long size, int cacheable); extern void SLOF_dma_map_out(long phys, void *virt, long size); -static inline void barrier(void) -{ - asm volatile("" : : : "memory"); -} -#define cpu_relax() barrier() - #endif diff --git a/include/ppc970/cpu.h b/include/ppc970/cpu.h index a1a0932..0e66dff 100644 --- a/include/ppc970/cpu.h +++ b/include/ppc970/cpu.h @@ -86,14 +86,24 @@ clr_ci(void) asm volatile(EXPAND(CLRCI(%0)) : "=r"(tmp) :: "memory", "cc"); } -static inline void -eieio(void) +static inline void eieio(void) { asm volatile ("eieio":::"memory"); } -static inline void -flush_cache(void* r, long n) +static inline void barrier(void) +{ + asm volatile("" : : : "memory"); +} +#define cpu_relax() barrier() + +static inline void sync(void) +{ + asm volatile ("sync" ::: "memory"); +} +#define mb() sync() + +static inline void flush_cache(void* r, long n) { asm volatile(EXPAND(FLUSH_CACHE(%0, %1)) : "+r"(r), "+r"(n) :: "memory", "cc", "r0", "ctr"); } diff --git a/include/ppcp7/cpu.h b/include/ppcp7/cpu.h index 042e64b..1b1fadd 100644 --- a/include/ppcp7/cpu.h +++ b/include/ppcp7/cpu.h @@ -44,12 +44,23 @@ static inline void flush_cache(void* r, long n) :: "memory", "cc", "r0", "ctr"); } -static inline void -eieio(void) +static inline void eieio(void) { asm volatile ("eieio":::"memory"); } +static inline void barrier(void) +{ + asm volatile("" : : : "memory"); +} +#define cpu_relax() barrier() + +static inline void sync(void) +{ + asm volatile ("sync" ::: "memory"); +} +#define mb() sync() + #endif /* __ASSEMBLER__ */ #endif |