outercache.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. #include <linux/types.h>
  23. struct outer_cache_fns {
  24. void (*inv_range)(unsigned long, unsigned long);
  25. void (*clean_range)(unsigned long, unsigned long);
  26. void (*flush_range)(unsigned long, unsigned long);
  27. void (*flush_all)(void);
  28. void (*inv_all)(void);
  29. void (*disable)(void);
  30. #ifdef CONFIG_OUTER_CACHE_SYNC
  31. void (*sync)(void);
  32. #endif
  33. void (*set_debug)(unsigned long);
  34. void (*resume)(void);
  35. };
  36. extern struct outer_cache_fns outer_cache;
  37. #ifdef CONFIG_OUTER_CACHE
  38. static inline void outer_inv_range(phys_addr_t start, phys_addr_t end)
  39. {
  40. if (outer_cache.inv_range)
  41. outer_cache.inv_range(start, end);
  42. }
  43. static inline void outer_clean_range(phys_addr_t start, phys_addr_t end)
  44. {
  45. if (outer_cache.clean_range)
  46. outer_cache.clean_range(start, end);
  47. }
  48. static inline void outer_flush_range(phys_addr_t start, phys_addr_t end)
  49. {
  50. if (outer_cache.flush_range)
  51. outer_cache.flush_range(start, end);
  52. }
  53. static inline void outer_flush_all(void)
  54. {
  55. if (outer_cache.flush_all)
  56. outer_cache.flush_all();
  57. }
  58. static inline void outer_inv_all(void)
  59. {
  60. if (outer_cache.inv_all)
  61. outer_cache.inv_all();
  62. }
  63. static inline void outer_disable(void)
  64. {
  65. if (outer_cache.disable)
  66. outer_cache.disable();
  67. }
  68. static inline void outer_resume(void)
  69. {
  70. if (outer_cache.resume)
  71. outer_cache.resume();
  72. }
  73. #else
  74. static inline void outer_inv_range(phys_addr_t start, phys_addr_t end)
  75. { }
  76. static inline void outer_clean_range(phys_addr_t start, phys_addr_t end)
  77. { }
  78. static inline void outer_flush_range(phys_addr_t start, phys_addr_t end)
  79. { }
  80. static inline void outer_flush_all(void) { }
  81. static inline void outer_inv_all(void) { }
  82. static inline void outer_disable(void) { }
  83. static inline void outer_resume(void) { }
  84. #endif
  85. #ifdef CONFIG_OUTER_CACHE_SYNC
  86. static inline void outer_sync(void)
  87. {
  88. if (outer_cache.sync)
  89. outer_cache.sync();
  90. }
  91. #else
  92. static inline void outer_sync(void)
  93. { }
  94. #endif
  95. #endif /* __ASM_OUTERCACHE_H */