outercache.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. #ifdef CONFIG_OUTER_CACHE_SYNC
  27. void (*sync)(void);
  28. #endif
  29. };
  30. #ifdef CONFIG_OUTER_CACHE
  31. extern struct outer_cache_fns outer_cache;
  32. static inline void outer_inv_range(unsigned long start, unsigned long end)
  33. {
  34. if (outer_cache.inv_range)
  35. outer_cache.inv_range(start, end);
  36. }
  37. static inline void outer_clean_range(unsigned long start, unsigned long end)
  38. {
  39. if (outer_cache.clean_range)
  40. outer_cache.clean_range(start, end);
  41. }
  42. static inline void outer_flush_range(unsigned long start, unsigned long end)
  43. {
  44. if (outer_cache.flush_range)
  45. outer_cache.flush_range(start, end);
  46. }
  47. #else
  48. static inline void outer_inv_range(unsigned long start, unsigned long end)
  49. { }
  50. static inline void outer_clean_range(unsigned long start, unsigned long end)
  51. { }
  52. static inline void outer_flush_range(unsigned long start, unsigned long end)
  53. { }
  54. #endif
  55. #ifdef CONFIG_OUTER_CACHE_SYNC
  56. static inline void outer_sync(void)
  57. {
  58. if (outer_cache.sync)
  59. outer_cache.sync();
  60. }
  61. #else
  62. static inline void outer_sync(void)
  63. { }
  64. #endif
  65. #endif /* __ASM_OUTERCACHE_H */