glue-cache.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * arch/arm/include/asm/glue-cache.h
  4. *
  5. * Copyright (C) 1999-2002 Russell King
  6. */
  7. #ifndef ASM_GLUE_CACHE_H
  8. #define ASM_GLUE_CACHE_H
  9. #include <asm/glue.h>
  10. /*
  11. * Cache Model
  12. * ===========
  13. */
  14. #undef _CACHE
  15. #undef MULTI_CACHE
  16. #if defined(CONFIG_CPU_CACHE_V4)
  17. # ifdef _CACHE
  18. # define MULTI_CACHE 1
  19. # else
  20. # define _CACHE v4
  21. # endif
  22. #endif
  23. #if defined(CONFIG_CPU_ARM920T) || defined(CONFIG_CPU_ARM922T) || \
  24. defined(CONFIG_CPU_ARM925T) || defined(CONFIG_CPU_ARM1020) || \
  25. defined(CONFIG_CPU_ARM1026)
  26. # define MULTI_CACHE 1
  27. #endif
  28. #if defined(CONFIG_CPU_FA526)
  29. # ifdef _CACHE
  30. # define MULTI_CACHE 1
  31. # else
  32. # define _CACHE fa
  33. # endif
  34. #endif
  35. #if defined(CONFIG_CPU_ARM926T)
  36. # ifdef _CACHE
  37. # define MULTI_CACHE 1
  38. # else
  39. # define _CACHE arm926
  40. # endif
  41. #endif
  42. #if defined(CONFIG_CPU_ARM940T)
  43. # ifdef _CACHE
  44. # define MULTI_CACHE 1
  45. # else
  46. # define _CACHE arm940
  47. # endif
  48. #endif
  49. #if defined(CONFIG_CPU_ARM946E)
  50. # ifdef _CACHE
  51. # define MULTI_CACHE 1
  52. # else
  53. # define _CACHE arm946
  54. # endif
  55. #endif
  56. #if defined(CONFIG_CPU_CACHE_V4WB)
  57. # ifdef _CACHE
  58. # define MULTI_CACHE 1
  59. # else
  60. # define _CACHE v4wb
  61. # endif
  62. #endif
  63. #if defined(CONFIG_CPU_XSCALE)
  64. # ifdef _CACHE
  65. # define MULTI_CACHE 1
  66. # else
  67. # define _CACHE xscale
  68. # endif
  69. #endif
  70. #if defined(CONFIG_CPU_XSC3)
  71. # ifdef _CACHE
  72. # define MULTI_CACHE 1
  73. # else
  74. # define _CACHE xsc3
  75. # endif
  76. #endif
  77. #if defined(CONFIG_CPU_MOHAWK)
  78. # ifdef _CACHE
  79. # define MULTI_CACHE 1
  80. # else
  81. # define _CACHE mohawk
  82. # endif
  83. #endif
  84. #if defined(CONFIG_CPU_FEROCEON)
  85. # define MULTI_CACHE 1
  86. #endif
  87. #if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K)
  88. # ifdef _CACHE
  89. # define MULTI_CACHE 1
  90. # else
  91. # define _CACHE v6
  92. # endif
  93. #endif
  94. #if defined(CONFIG_CPU_V7)
  95. # ifdef _CACHE
  96. # define MULTI_CACHE 1
  97. # else
  98. # define _CACHE v7
  99. # endif
  100. #endif
  101. #if defined(CONFIG_CACHE_B15_RAC)
  102. # define MULTI_CACHE 1
  103. #endif
  104. #if defined(CONFIG_CPU_V7M)
  105. # define MULTI_CACHE 1
  106. #endif
  107. #if !defined(_CACHE) && !defined(MULTI_CACHE)
  108. #error Unknown cache maintenance model
  109. #endif
  110. #ifndef __ASSEMBLER__
  111. static inline void nop_flush_icache_all(void) { }
  112. static inline void nop_flush_kern_cache_all(void) { }
  113. static inline void nop_flush_kern_cache_louis(void) { }
  114. static inline void nop_flush_user_cache_all(void) { }
  115. static inline void nop_flush_user_cache_range(unsigned long a,
  116. unsigned long b, unsigned int c) { }
  117. static inline void nop_coherent_kern_range(unsigned long a, unsigned long b) { }
  118. static inline int nop_coherent_user_range(unsigned long a,
  119. unsigned long b) { return 0; }
  120. static inline void nop_flush_kern_dcache_area(void *a, size_t s) { }
  121. static inline void nop_dma_flush_range(const void *a, const void *b) { }
  122. static inline void nop_dma_map_area(const void *s, size_t l, int f) { }
  123. static inline void nop_dma_unmap_area(const void *s, size_t l, int f) { }
  124. #endif
  125. #ifndef MULTI_CACHE
  126. #define __cpuc_flush_icache_all __glue(_CACHE,_flush_icache_all)
  127. #define __cpuc_flush_kern_all __glue(_CACHE,_flush_kern_cache_all)
  128. #define __cpuc_flush_kern_louis __glue(_CACHE,_flush_kern_cache_louis)
  129. #define __cpuc_flush_user_all __glue(_CACHE,_flush_user_cache_all)
  130. #define __cpuc_flush_user_range __glue(_CACHE,_flush_user_cache_range)
  131. #define __cpuc_coherent_kern_range __glue(_CACHE,_coherent_kern_range)
  132. #define __cpuc_coherent_user_range __glue(_CACHE,_coherent_user_range)
  133. #define __cpuc_flush_dcache_area __glue(_CACHE,_flush_kern_dcache_area)
  134. #define dmac_flush_range __glue(_CACHE,_dma_flush_range)
  135. #endif
  136. #endif