barrier.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copied from the kernel sources to tools/perf/:
  3. *
  4. * Generic barrier definitions, originally based on MN10300 definitions.
  5. *
  6. * It should be possible to use these on really simple architectures,
  7. * but it serves more as a starting point for new ports.
  8. *
  9. * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
  10. * Written by David Howells (dhowells@redhat.com)
  11. *
  12. * This program is free software; you can redistribute it and/or
  13. * modify it under the terms of the GNU General Public Licence
  14. * as published by the Free Software Foundation; either version
  15. * 2 of the Licence, or (at your option) any later version.
  16. */
  17. #ifndef __TOOLS_LINUX_ASM_GENERIC_BARRIER_H
  18. #define __TOOLS_LINUX_ASM_GENERIC_BARRIER_H
  19. #ifndef __ASSEMBLY__
  20. #include <linux/compiler.h>
  21. /*
  22. * Force strict CPU ordering. And yes, this is required on UP too when we're
  23. * talking to devices.
  24. *
  25. * Fall back to compiler barriers if nothing better is provided.
  26. */
  27. #ifndef mb
  28. #define mb() barrier()
  29. #endif
  30. #ifndef rmb
  31. #define rmb() mb()
  32. #endif
  33. #ifndef wmb
  34. #define wmb() mb()
  35. #endif
  36. #endif /* !__ASSEMBLY__ */
  37. #endif /* __TOOLS_LINUX_ASM_GENERIC_BARRIER_H */