synch.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef _ASM_POWERPC_SYNCH_H
  2. #define _ASM_POWERPC_SYNCH_H
  3. #ifdef __KERNEL__
  4. #include <linux/stringify.h>
  5. #include <asm/feature-fixups.h>
  6. #ifndef __ASSEMBLY__
  7. extern unsigned int __start___lwsync_fixup, __stop___lwsync_fixup;
  8. extern void do_lwsync_fixups(unsigned long value, void *fixup_start,
  9. void *fixup_end);
  10. static inline void eieio(void)
  11. {
  12. __asm__ __volatile__ ("eieio" : : : "memory");
  13. }
  14. static inline void isync(void)
  15. {
  16. __asm__ __volatile__ ("isync" : : : "memory");
  17. }
  18. #endif /* __ASSEMBLY__ */
  19. #if defined(__powerpc64__)
  20. # define LWSYNC lwsync
  21. #elif defined(CONFIG_E500)
  22. # define LWSYNC \
  23. START_LWSYNC_SECTION(96); \
  24. sync; \
  25. MAKE_LWSYNC_SECTION_ENTRY(96, __lwsync_fixup);
  26. #else
  27. # define LWSYNC sync
  28. #endif
  29. #ifdef CONFIG_SMP
  30. #define __PPC_ACQUIRE_BARRIER \
  31. START_LWSYNC_SECTION(97); \
  32. isync; \
  33. MAKE_LWSYNC_SECTION_ENTRY(97, __lwsync_fixup);
  34. #define PPC_ACQUIRE_BARRIER "\n" stringify_in_c(__PPC_ACQUIRE_BARRIER)
  35. #define PPC_RELEASE_BARRIER stringify_in_c(LWSYNC) "\n"
  36. #define PPC_ATOMIC_ENTRY_BARRIER "\n" stringify_in_c(sync) "\n"
  37. #define PPC_ATOMIC_EXIT_BARRIER "\n" stringify_in_c(sync) "\n"
  38. #else
  39. #define PPC_ACQUIRE_BARRIER
  40. #define PPC_RELEASE_BARRIER
  41. #define PPC_ATOMIC_ENTRY_BARRIER
  42. #define PPC_ATOMIC_EXIT_BARRIER
  43. #endif
  44. #endif /* __KERNEL__ */
  45. #endif /* _ASM_POWERPC_SYNCH_H */