cacheflush_no.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #ifndef _M68KNOMMU_CACHEFLUSH_H
  2. #define _M68KNOMMU_CACHEFLUSH_H
  3. /*
  4. * (C) Copyright 2000-2010, Greg Ungerer <gerg@snapgear.com>
  5. */
  6. #include <linux/mm.h>
  7. #include <asm/mcfsim.h>
  8. #define flush_cache_all() __flush_cache_all()
  9. #define flush_cache_mm(mm) do { } while (0)
  10. #define flush_cache_dup_mm(mm) do { } while (0)
  11. #define flush_cache_range(vma, start, end) do { } while (0)
  12. #define flush_cache_page(vma, vmaddr) do { } while (0)
  13. #define flush_dcache_range(start, len) __flush_dcache_all()
  14. #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
  15. #define flush_dcache_page(page) do { } while (0)
  16. #define flush_dcache_mmap_lock(mapping) do { } while (0)
  17. #define flush_dcache_mmap_unlock(mapping) do { } while (0)
  18. #define flush_icache_range(start, len) __flush_icache_all()
  19. #define flush_icache_page(vma,pg) do { } while (0)
  20. #define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
  21. #define flush_cache_vmap(start, end) do { } while (0)
  22. #define flush_cache_vunmap(start, end) do { } while (0)
  23. #define copy_to_user_page(vma, page, vaddr, dst, src, len) \
  24. memcpy(dst, src, len)
  25. #define copy_from_user_page(vma, page, vaddr, dst, src, len) \
  26. memcpy(dst, src, len)
  27. void mcf_cache_push(void);
  28. static inline void __flush_cache_all(void)
  29. {
  30. #ifdef CACHE_PUSH
  31. mcf_cache_push();
  32. #endif
  33. #ifdef CACHE_INVALIDATE
  34. __asm__ __volatile__ (
  35. "movel %0, %%d0\n\t"
  36. "movec %%d0, %%CACR\n\t"
  37. "nop\n\t"
  38. : : "i" (CACHE_INVALIDATE) : "d0" );
  39. #endif
  40. }
  41. /*
  42. * Some ColdFire parts implement separate instruction and data caches,
  43. * on those we should just flush the appropriate cache. If we don't need
  44. * to do any specific flushing then this will be optimized away.
  45. */
  46. static inline void __flush_icache_all(void)
  47. {
  48. #ifdef CACHE_INVALIDATEI
  49. __asm__ __volatile__ (
  50. "movel %0, %%d0\n\t"
  51. "movec %%d0, %%CACR\n\t"
  52. "nop\n\t"
  53. : : "i" (CACHE_INVALIDATEI) : "d0" );
  54. #endif
  55. }
  56. static inline void __flush_dcache_all(void)
  57. {
  58. #ifdef CACHE_PUSH
  59. mcf_cache_push();
  60. #endif
  61. #ifdef CACHE_INVALIDATED
  62. __asm__ __volatile__ (
  63. "movel %0, %%d0\n\t"
  64. "movec %%d0, %%CACR\n\t"
  65. "nop\n\t"
  66. : : "i" (CACHE_INVALIDATED) : "d0" );
  67. #else
  68. /* Flush the wrtite buffer */
  69. __asm__ __volatile__ ( "nop" );
  70. #endif
  71. }
  72. #endif /* _M68KNOMMU_CACHEFLUSH_H */