cacheflush_no.h 2.6 KB

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