cacheflush_no.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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 __clear_cache_all(void)
  29. {
  30. #ifdef CACHE_INVALIDATE
  31. __asm__ __volatile__ (
  32. "movel %0, %%d0\n\t"
  33. "movec %%d0, %%CACR\n\t"
  34. "nop\n\t"
  35. : : "i" (CACHE_INVALIDATE) : "d0" );
  36. #endif
  37. }
  38. static inline void __flush_cache_all(void)
  39. {
  40. #ifdef CACHE_PUSH
  41. mcf_cache_push();
  42. #endif
  43. __clear_cache_all();
  44. }
  45. /*
  46. * Some ColdFire parts implement separate instruction and data caches,
  47. * on those we should just flush the appropriate cache. If we don't need
  48. * to do any specific flushing then this will be optimized away.
  49. */
  50. static inline void __flush_icache_all(void)
  51. {
  52. #ifdef CACHE_INVALIDATEI
  53. __asm__ __volatile__ (
  54. "movel %0, %%d0\n\t"
  55. "movec %%d0, %%CACR\n\t"
  56. "nop\n\t"
  57. : : "i" (CACHE_INVALIDATEI) : "d0" );
  58. #endif
  59. }
  60. static inline void __flush_dcache_all(void)
  61. {
  62. #ifdef CACHE_PUSH
  63. mcf_cache_push();
  64. #endif
  65. #ifdef CACHE_INVALIDATED
  66. __asm__ __volatile__ (
  67. "movel %0, %%d0\n\t"
  68. "movec %%d0, %%CACR\n\t"
  69. "nop\n\t"
  70. : : "i" (CACHE_INVALIDATED) : "d0" );
  71. #else
  72. /* Flush the wrtite buffer */
  73. __asm__ __volatile__ ( "nop" );
  74. #endif
  75. }
  76. /*
  77. * Push cache entries at supplied address. We want to write back any dirty
  78. * data and the invalidate the cache lines associated with this address.
  79. */
  80. static inline void cache_push(unsigned long paddr, int len)
  81. {
  82. __flush_cache_all();
  83. }
  84. /*
  85. * Clear cache entries at supplied address (that is don't write back any
  86. * dirty data).
  87. */
  88. static inline void cache_clear(unsigned long paddr, int len)
  89. {
  90. __clear_cache_all();
  91. }
  92. #endif /* _M68KNOMMU_CACHEFLUSH_H */