blob: 794870ab8fd3edfb802fa22cb2d513c94794de8b [file] [log] [blame]
Becky Brucefeaf7cf2005-09-22 14:20:04 -05001#ifndef _ASM_POWERPC_SYNCH_H
2#define _ASM_POWERPC_SYNCH_H
Arnd Bergmann88ced032005-12-16 22:43:46 +01003#ifdef __KERNEL__
Becky Brucefeaf7cf2005-09-22 14:20:04 -05004
5#ifdef __powerpc64__
6#define __SUBARCH_HAS_LWSYNC
7#endif
8
9#ifdef __SUBARCH_HAS_LWSYNC
10# define LWSYNC lwsync
11#else
12# define LWSYNC sync
13#endif
14
15
16/*
17 * Arguably the bitops and *xchg operations don't imply any memory barrier
18 * or SMP ordering, but in fact a lot of drivers expect them to imply
19 * both, since they do on x86 cpus.
20 */
21#ifdef CONFIG_SMP
22#define EIEIO_ON_SMP "eieio\n"
23#define ISYNC_ON_SMP "\n\tisync"
24#define SYNC_ON_SMP __stringify(LWSYNC) "\n"
25#else
26#define EIEIO_ON_SMP
27#define ISYNC_ON_SMP
28#define SYNC_ON_SMP
29#endif
30
31static inline void eieio(void)
32{
33 __asm__ __volatile__ ("eieio" : : : "memory");
34}
35
36static inline void isync(void)
37{
38 __asm__ __volatile__ ("isync" : : : "memory");
39}
40
41#ifdef CONFIG_SMP
42#define eieio_on_smp() eieio()
43#define isync_on_smp() isync()
44#else
45#define eieio_on_smp() __asm__ __volatile__("": : :"memory")
46#define isync_on_smp() __asm__ __volatile__("": : :"memory")
47#endif
48
Arnd Bergmann88ced032005-12-16 22:43:46 +010049#endif /* __KERNEL__ */
Becky Brucefeaf7cf2005-09-22 14:20:04 -050050#endif /* _ASM_POWERPC_SYNCH_H */
51