Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
[linux-2.6-block.git] / arch / powerpc / include / asm / synch.h
CommitLineData
feaf7cf1
BB
1#ifndef _ASM_POWERPC_SYNCH_H
2#define _ASM_POWERPC_SYNCH_H
88ced031 3#ifdef __KERNEL__
feaf7cf1 4
144b9c13 5#include <linux/stringify.h>
2d1b2027 6#include <asm/feature-fixups.h>
144b9c13 7
46d075be
NP
8#if defined(__powerpc64__) || defined(CONFIG_PPC_E500MC)
9#define __SUBARCH_HAS_LWSYNC
10#endif
11
2d1b2027
KG
12#ifndef __ASSEMBLY__
13extern unsigned int __start___lwsync_fixup, __stop___lwsync_fixup;
14extern void do_lwsync_fixups(unsigned long value, void *fixup_start,
15 void *fixup_end);
16
17static inline void eieio(void)
18{
19 __asm__ __volatile__ ("eieio" : : : "memory");
20}
21
22static inline void isync(void)
23{
24 __asm__ __volatile__ ("isync" : : : "memory");
25}
26#endif /* __ASSEMBLY__ */
feaf7cf1 27
2d1b2027 28#if defined(__powerpc64__)
feaf7cf1 29# define LWSYNC lwsync
2d1b2027
KG
30#elif defined(CONFIG_E500)
31# define LWSYNC \
32 START_LWSYNC_SECTION(96); \
33 sync; \
34 MAKE_LWSYNC_SECTION_ENTRY(96, __lwsync_fixup);
feaf7cf1
BB
35#else
36# define LWSYNC sync
37#endif
38
feaf7cf1 39#ifdef CONFIG_SMP
4f629d7d 40#define ISYNC_ON_SMP "\n\tisync\n"
2d1b2027 41#define LWSYNC_ON_SMP stringify_in_c(LWSYNC) "\n"
feaf7cf1 42#else
feaf7cf1 43#define ISYNC_ON_SMP
144b9c13 44#define LWSYNC_ON_SMP
feaf7cf1
BB
45#endif
46
88ced031 47#endif /* __KERNEL__ */
feaf7cf1 48#endif /* _ASM_POWERPC_SYNCH_H */