cacheflush.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #ifndef _SPARC64_CACHEFLUSH_H
  2. #define _SPARC64_CACHEFLUSH_H
  3. #include <linux/config.h>
  4. #include <asm/page.h>
  5. /* Flushing for D-cache alias handling is only needed if
  6. * the page size is smaller than 16K.
  7. */
  8. #if PAGE_SHIFT < 14
  9. #define DCACHE_ALIASING_POSSIBLE
  10. #endif
  11. #ifndef __ASSEMBLY__
  12. #include <linux/mm.h>
  13. /* Cache flush operations. */
  14. /* These are the same regardless of whether this is an SMP kernel or not. */
  15. #define flush_cache_mm(__mm) \
  16. do { if ((__mm) == current->mm) flushw_user(); } while(0)
  17. #define flush_cache_range(vma, start, end) \
  18. flush_cache_mm((vma)->vm_mm)
  19. #define flush_cache_page(vma, page, pfn) \
  20. flush_cache_mm((vma)->vm_mm)
  21. /*
  22. * On spitfire, the icache doesn't snoop local stores and we don't
  23. * use block commit stores (which invalidate icache lines) during
  24. * module load, so we need this.
  25. */
  26. extern void flush_icache_range(unsigned long start, unsigned long end);
  27. extern void __flush_icache_page(unsigned long);
  28. extern void __flush_dcache_page(void *addr, int flush_icache);
  29. extern void flush_dcache_page_impl(struct page *page);
  30. #ifdef CONFIG_SMP
  31. extern void smp_flush_dcache_page_impl(struct page *page, int cpu);
  32. extern void flush_dcache_page_all(struct mm_struct *mm, struct page *page);
  33. #else
  34. #define smp_flush_dcache_page_impl(page,cpu) flush_dcache_page_impl(page)
  35. #define flush_dcache_page_all(mm,page) flush_dcache_page_impl(page)
  36. #endif
  37. extern void __flush_dcache_range(unsigned long start, unsigned long end);
  38. extern void flush_dcache_page(struct page *page);
  39. #define flush_icache_page(vma, pg) do { } while(0)
  40. #define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
  41. #define copy_to_user_page(vma, page, vaddr, dst, src, len) \
  42. do { \
  43. flush_cache_page(vma, vaddr, page_to_pfn(page));\
  44. memcpy(dst, src, len); \
  45. } while (0)
  46. #define copy_from_user_page(vma, page, vaddr, dst, src, len) \
  47. do { \
  48. flush_cache_page(vma, vaddr, page_to_pfn(page));\
  49. memcpy(dst, src, len); \
  50. } while (0)
  51. #define flush_dcache_mmap_lock(mapping) do { } while (0)
  52. #define flush_dcache_mmap_unlock(mapping) do { } while (0)
  53. #define flush_cache_vmap(start, end) do { } while (0)
  54. #define flush_cache_vunmap(start, end) do { } while (0)
  55. #endif /* !__ASSEMBLY__ */
  56. #endif /* _SPARC64_CACHEFLUSH_H */