Becky Bruce | feaf7cf | 2005-09-22 14:20:04 -0500 | [diff] [blame] | 1 | #ifndef _ASM_POWERPC_SYNCH_H |
| 2 | #define _ASM_POWERPC_SYNCH_H |
Arnd Bergmann | 88ced03 | 2005-12-16 22:43:46 +0100 | [diff] [blame] | 3 | #ifdef __KERNEL__ |
Becky Bruce | feaf7cf | 2005-09-22 14:20:04 -0500 | [diff] [blame] | 4 | |
| 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 | |
| 31 | static inline void eieio(void) |
| 32 | { |
| 33 | __asm__ __volatile__ ("eieio" : : : "memory"); |
| 34 | } |
| 35 | |
| 36 | static 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 Bergmann | 88ced03 | 2005-12-16 22:43:46 +0100 | [diff] [blame] | 49 | #endif /* __KERNEL__ */ |
Becky Bruce | feaf7cf | 2005-09-22 14:20:04 -0500 | [diff] [blame] | 50 | #endif /* _ASM_POWERPC_SYNCH_H */ |
| 51 | |