outercache.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * arch/arm/include/asm/outercache.h
  3. *
  4. * Copyright (C) 2010 ARM Ltd.
  5. * Written by Catalin Marinas <catalin.marinas@arm.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. */
  20. #ifndef __ASM_OUTERCACHE_H
  21. #define __ASM_OUTERCACHE_H
  22. struct outer_cache_fns {
  23. void (*inv_range)(unsigned long, unsigned long);
  24. void (*clean_range)(unsigned long, unsigned long);
  25. void (*flush_range)(unsigned long, unsigned long);
  26. void (*flush_all)(void);
  27. void (*inv_all)(void);
  28. void (*disable)(void);
  29. #ifdef CONFIG_OUTER_CACHE_SYNC
  30. void (*sync)(void);
  31. #endif
  32. };
  33. #ifdef CONFIG_OUTER_CACHE
  34. extern struct outer_cache_fns outer_cache;
  35. static inline void outer_inv_range(unsigned long start, unsigned long end)
  36. {
  37. if (outer_cache.inv_range)
  38. outer_cache.inv_range(start, end);
  39. }
  40. static inline void outer_clean_range(unsigned long start, unsigned long end)
  41. {
  42. if (outer_cache.clean_range)
  43. outer_cache.clean_range(start, end);
  44. }
  45. static inline void outer_flush_range(unsigned long start, unsigned long end)
  46. {
  47. if (outer_cache.flush_range)
  48. outer_cache.flush_range(start, end);
  49. }
  50. static inline void outer_flush_all(void)
  51. {
  52. if (outer_cache.flush_all)
  53. outer_cache.flush_all();
  54. }
  55. static inline void outer_inv_all(void)
  56. {
  57. if (outer_cache.inv_all)
  58. outer_cache.inv_all();
  59. }
  60. static inline void outer_disable(void)
  61. {
  62. if (outer_cache.disable)
  63. outer_cache.disable();
  64. }
  65. #else
  66. static inline void outer_inv_range(unsigned long start, unsigned long end)
  67. { }
  68. static inline void outer_clean_range(unsigned long start, unsigned long end)
  69. { }
  70. static inline void outer_flush_range(unsigned long start, unsigned long end)
  71. { }
  72. static inline void outer_flush_all(void) { }
  73. static inline void outer_inv_all(void) { }
  74. static inline void outer_disable(void) { }
  75. #endif
  76. #ifdef CONFIG_OUTER_CACHE_SYNC
  77. static inline void outer_sync(void)
  78. {
  79. if (outer_cache.sync)
  80. outer_cache.sync();
  81. }
  82. #else
  83. static inline void outer_sync(void)
  84. { }
  85. #endif
  86. #endif /* __ASM_OUTERCACHE_H */