cacheflush.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Copyright (C) 2007 PetaLogix
  3. * Copyright (C) 2007 John Williams <john.williams@petalogix.com>
  4. * based on v850 version which was
  5. * Copyright (C) 2001,02,03 NEC Electronics Corporation
  6. * Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org>
  7. *
  8. * This file is subject to the terms and conditions of the GNU General
  9. * Public License. See the file COPYING in the main directory of this
  10. * archive for more details.
  11. *
  12. */
  13. #ifndef _ASM_MICROBLAZE_CACHEFLUSH_H
  14. #define _ASM_MICROBLAZE_CACHEFLUSH_H
  15. /* Somebody depends on this; sigh... */
  16. #include <linux/mm.h>
  17. /*
  18. * Cache handling functions.
  19. * Microblaze has a write-through data cache, meaning that the data cache
  20. * never needs to be flushed. The only flushing operations that are
  21. * implemented are to invalidate the instruction cache. These are called
  22. * after loading a user application into memory, we must invalidate the
  23. * instruction cache to make sure we don't fetch old, bad code.
  24. */
  25. /* FIXME for LL-temac driver */
  26. #define invalidate_dcache_range(start, end) \
  27. __invalidate_dcache_range(start, end)
  28. #define flush_cache_all() __invalidate_cache_all()
  29. #define flush_cache_mm(mm) do { } while (0)
  30. #define flush_cache_range(vma, start, end) __invalidate_cache_all()
  31. #define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
  32. #define flush_dcache_range(start, end) __invalidate_dcache_range(start, end)
  33. #define flush_dcache_page(page) do { } while (0)
  34. #define flush_dcache_mmap_lock(mapping) do { } while (0)
  35. #define flush_dcache_mmap_unlock(mapping) do { } while (0)
  36. #define flush_icache_range(start, len) __invalidate_icache_range(start, len)
  37. #define flush_icache_page(vma, pg) do { } while (0)
  38. #define flush_cache_vmap(start, end) do { } while (0)
  39. #define flush_cache_vunmap(start, end) do { } while (0)
  40. struct page;
  41. struct mm_struct;
  42. struct vm_area_struct;
  43. /* see arch/microblaze/kernel/cache.c */
  44. extern void __invalidate_icache_all(void);
  45. extern void __invalidate_icache_range(unsigned long start, unsigned long end);
  46. extern void __invalidate_icache_page(struct vm_area_struct *vma,
  47. struct page *page);
  48. extern void __invalidate_icache_user_range(struct vm_area_struct *vma,
  49. struct page *page,
  50. unsigned long adr, int len);
  51. extern void __invalidate_cache_sigtramp(unsigned long addr);
  52. extern void __invalidate_dcache_all(void);
  53. extern void __invalidate_dcache_range(unsigned long start, unsigned long end);
  54. extern void __invalidate_dcache_page(struct vm_area_struct *vma,
  55. struct page *page);
  56. extern void __invalidate_dcache_user_range(struct vm_area_struct *vma,
  57. struct page *page,
  58. unsigned long adr, int len);
  59. extern inline void __invalidate_cache_all(void)
  60. {
  61. __invalidate_icache_all();
  62. __invalidate_dcache_all();
  63. }
  64. #define copy_to_user_page(vma, page, vaddr, dst, src, len) \
  65. do { memcpy((dst), (src), (len)); \
  66. flush_icache_range((unsigned) (dst), (unsigned) (dst) + (len)); \
  67. } while (0)
  68. #define copy_from_user_page(vma, page, vaddr, dst, src, len) \
  69. memcpy((dst), (src), (len))
  70. #endif /* _ASM_MICROBLAZE_CACHEFLUSH_H */