gic.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2000, 07 MIPS Technologies, Inc.
  7. *
  8. * GIC Register Definitions
  9. *
  10. */
  11. #ifndef _ASM_GICREGS_H
  12. #define _ASM_GICREGS_H
  13. #undef GICISBYTELITTLEENDIAN
  14. #define GICISWORDLITTLEENDIAN
  15. /* Constants */
  16. #define GIC_POL_POS 1
  17. #define GIC_POL_NEG 0
  18. #define GIC_TRIG_EDGE 1
  19. #define GIC_TRIG_LEVEL 0
  20. #if CONFIG_SMP
  21. #define GIC_NUM_INTRS (24 + NR_CPUS * 2)
  22. #else
  23. #define GIC_NUM_INTRS 32
  24. #endif
  25. #define MSK(n) ((1 << (n)) - 1)
  26. #define REG32(addr) (*(volatile unsigned int *) (addr))
  27. #define REG(base, offs) REG32((unsigned long)(base) + offs##_##OFS)
  28. #define REGP(base, phys) REG32((unsigned long)(base) + (phys))
  29. /* Accessors */
  30. #define GIC_REG(segment, offset) \
  31. REG32(_gic_base + segment##_##SECTION_OFS + offset##_##OFS)
  32. #define GIC_REG_ADDR(segment, offset) \
  33. REG32(_gic_base + segment##_##SECTION_OFS + offset)
  34. #define GIC_ABS_REG(segment, offset) \
  35. (_gic_base + segment##_##SECTION_OFS + offset##_##OFS)
  36. #define GIC_REG_ABS_ADDR(segment, offset) \
  37. (_gic_base + segment##_##SECTION_OFS + offset)
  38. #ifdef GICISBYTELITTLEENDIAN
  39. #define GICREAD(reg, data) (data) = (reg), (data) = le32_to_cpu(data)
  40. #define GICWRITE(reg, data) (reg) = cpu_to_le32(data)
  41. #define GICBIS(reg, bits) \
  42. ({unsigned int data; \
  43. GICREAD(reg, data); \
  44. data |= bits; \
  45. GICWRITE(reg, data); \
  46. })
  47. #else
  48. #define GICREAD(reg, data) (data) = (reg)
  49. #define GICWRITE(reg, data) (reg) = (data)
  50. #define GICBIS(reg, bits) (reg) |= (bits)
  51. #endif
  52. /* GIC Address Space */
  53. #define SHARED_SECTION_OFS 0x0000
  54. #define SHARED_SECTION_SIZE 0x8000
  55. #define VPE_LOCAL_SECTION_OFS 0x8000
  56. #define VPE_LOCAL_SECTION_SIZE 0x4000
  57. #define VPE_OTHER_SECTION_OFS 0xc000
  58. #define VPE_OTHER_SECTION_SIZE 0x4000
  59. #define USM_VISIBLE_SECTION_OFS 0x10000
  60. #define USM_VISIBLE_SECTION_SIZE 0x10000
  61. /* Register Map for Shared Section */
  62. #if defined(CONFIG_CPU_LITTLE_ENDIAN) || defined(GICISWORDLITTLEENDIAN)
  63. #define GIC_SH_CONFIG_OFS 0x0000
  64. /* Shared Global Counter */
  65. #define GIC_SH_COUNTER_31_00_OFS 0x0010
  66. #define GIC_SH_COUNTER_63_32_OFS 0x0014
  67. /* Interrupt Polarity */
  68. #define GIC_SH_POL_31_0_OFS 0x0100
  69. #define GIC_SH_POL_63_32_OFS 0x0104
  70. #define GIC_SH_POL_95_64_OFS 0x0108
  71. #define GIC_SH_POL_127_96_OFS 0x010c
  72. #define GIC_SH_POL_159_128_OFS 0x0110
  73. #define GIC_SH_POL_191_160_OFS 0x0114
  74. #define GIC_SH_POL_223_192_OFS 0x0118
  75. #define GIC_SH_POL_255_224_OFS 0x011c
  76. /* Edge/Level Triggering */
  77. #define GIC_SH_TRIG_31_0_OFS 0x0180
  78. #define GIC_SH_TRIG_63_32_OFS 0x0184
  79. #define GIC_SH_TRIG_95_64_OFS 0x0188
  80. #define GIC_SH_TRIG_127_96_OFS 0x018c
  81. #define GIC_SH_TRIG_159_128_OFS 0x0190
  82. #define GIC_SH_TRIG_191_160_OFS 0x0194
  83. #define GIC_SH_TRIG_223_192_OFS 0x0198
  84. #define GIC_SH_TRIG_255_224_OFS 0x019c
  85. /* Dual Edge Triggering */
  86. #define GIC_SH_DUAL_31_0_OFS 0x0200
  87. #define GIC_SH_DUAL_63_32_OFS 0x0204
  88. #define GIC_SH_DUAL_95_64_OFS 0x0208
  89. #define GIC_SH_DUAL_127_96_OFS 0x020c
  90. #define GIC_SH_DUAL_159_128_OFS 0x0210
  91. #define GIC_SH_DUAL_191_160_OFS 0x0214
  92. #define GIC_SH_DUAL_223_192_OFS 0x0218
  93. #define GIC_SH_DUAL_255_224_OFS 0x021c
  94. /* Set/Clear corresponding bit in Edge Detect Register */
  95. #define GIC_SH_WEDGE_OFS 0x0280
  96. /* Reset Mask - Disables Interrupt */
  97. #define GIC_SH_RMASK_31_0_OFS 0x0300
  98. #define GIC_SH_RMASK_63_32_OFS 0x0304
  99. #define GIC_SH_RMASK_95_64_OFS 0x0308
  100. #define GIC_SH_RMASK_127_96_OFS 0x030c
  101. #define GIC_SH_RMASK_159_128_OFS 0x0310
  102. #define GIC_SH_RMASK_191_160_OFS 0x0314
  103. #define GIC_SH_RMASK_223_192_OFS 0x0318
  104. #define GIC_SH_RMASK_255_224_OFS 0x031c
  105. /* Set Mask (WO) - Enables Interrupt */
  106. #define GIC_SH_SMASK_31_0_OFS 0x0380
  107. #define GIC_SH_SMASK_63_32_OFS 0x0384
  108. #define GIC_SH_SMASK_95_64_OFS 0x0388
  109. #define GIC_SH_SMASK_127_96_OFS 0x038c
  110. #define GIC_SH_SMASK_159_128_OFS 0x0390
  111. #define GIC_SH_SMASK_191_160_OFS 0x0394
  112. #define GIC_SH_SMASK_223_192_OFS 0x0398
  113. #define GIC_SH_SMASK_255_224_OFS 0x039c
  114. /* Global Interrupt Mask Register (RO) - Bit Set == Interrupt enabled */
  115. #define GIC_SH_MASK_31_0_OFS 0x0400
  116. #define GIC_SH_MASK_63_32_OFS 0x0404
  117. #define GIC_SH_MASK_95_64_OFS 0x0408
  118. #define GIC_SH_MASK_127_96_OFS 0x040c
  119. #define GIC_SH_MASK_159_128_OFS 0x0410
  120. #define GIC_SH_MASK_191_160_OFS 0x0414
  121. #define GIC_SH_MASK_223_192_OFS 0x0418
  122. #define GIC_SH_MASK_255_224_OFS 0x041c
  123. /* Pending Global Interrupts (RO) */
  124. #define GIC_SH_PEND_31_0_OFS 0x0480
  125. #define GIC_SH_PEND_63_32_OFS 0x0484
  126. #define GIC_SH_PEND_95_64_OFS 0x0488
  127. #define GIC_SH_PEND_127_96_OFS 0x048c
  128. #define GIC_SH_PEND_159_128_OFS 0x0490
  129. #define GIC_SH_PEND_191_160_OFS 0x0494
  130. #define GIC_SH_PEND_223_192_OFS 0x0498
  131. #define GIC_SH_PEND_255_224_OFS 0x049c
  132. #define GIC_SH_INTR_MAP_TO_PIN_BASE_OFS 0x0500
  133. /* Maps Interrupt X to a Pin */
  134. #define GIC_SH_MAP_TO_PIN(intr) \
  135. (GIC_SH_INTR_MAP_TO_PIN_BASE_OFS + (4 * intr))
  136. #define GIC_SH_INTR_MAP_TO_VPE_BASE_OFS 0x2000
  137. /* Maps Interrupt X to a VPE */
  138. #define GIC_SH_MAP_TO_VPE_REG_OFF(intr, vpe) \
  139. (GIC_SH_INTR_MAP_TO_VPE_BASE_OFS + (32 * (intr)) + (((vpe) / 32) * 4))
  140. #define GIC_SH_MAP_TO_VPE_REG_BIT(vpe) (1 << ((vpe) % 32))
  141. /* Polarity : Reset Value is always 0 */
  142. #define GIC_SH_SET_POLARITY_OFS 0x0100
  143. #define GIC_SET_POLARITY(intr, pol) \
  144. GICBIS(GIC_REG_ADDR(SHARED, GIC_SH_SET_POLARITY_OFS + (((intr) / 32) * 4)), (pol) << ((intr) % 32))
  145. /* Triggering : Reset Value is always 0 */
  146. #define GIC_SH_SET_TRIGGER_OFS 0x0180
  147. #define GIC_SET_TRIGGER(intr, trig) \
  148. GICBIS(GIC_REG_ADDR(SHARED, GIC_SH_SET_TRIGGER_OFS + (((intr) / 32) * 4)), (trig) << ((intr) % 32))
  149. /* Mask manipulation */
  150. #define GIC_SH_SMASK_OFS 0x0380
  151. #define GIC_SET_INTR_MASK(intr, val) \
  152. GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_SMASK_OFS + (((intr) / 32) * 4)), ((val) << ((intr) % 32)))
  153. #define GIC_SH_RMASK_OFS 0x0300
  154. #define GIC_CLR_INTR_MASK(intr, val) \
  155. GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_RMASK_OFS + (((intr) / 32) * 4)), ((val) << ((intr) % 32)))
  156. /* Register Map for Local Section */
  157. #define GIC_VPE_CTL_OFS 0x0000
  158. #define GIC_VPE_PEND_OFS 0x0004
  159. #define GIC_VPE_MASK_OFS 0x0008
  160. #define GIC_VPE_RMASK_OFS 0x000c
  161. #define GIC_VPE_SMASK_OFS 0x0010
  162. #define GIC_VPE_WD_MAP_OFS 0x0040
  163. #define GIC_VPE_COMPARE_MAP_OFS 0x0044
  164. #define GIC_VPE_TIMER_MAP_OFS 0x0048
  165. #define GIC_VPE_PERFCTR_MAP_OFS 0x0050
  166. #define GIC_VPE_SWINT0_MAP_OFS 0x0054
  167. #define GIC_VPE_SWINT1_MAP_OFS 0x0058
  168. #define GIC_VPE_OTHER_ADDR_OFS 0x0080
  169. #define GIC_VPE_WD_CONFIG0_OFS 0x0090
  170. #define GIC_VPE_WD_COUNT0_OFS 0x0094
  171. #define GIC_VPE_WD_INITIAL0_OFS 0x0098
  172. #define GIC_VPE_COMPARE_LO_OFS 0x00a0
  173. #define GIC_VPE_COMPARE_HI 0x00a4
  174. #define GIC_VPE_EIC_SHADOW_SET_BASE 0x0100
  175. #define GIC_VPE_EIC_SS(intr) \
  176. (GIC_EIC_SHADOW_SET_BASE + (4 * intr))
  177. #define GIC_VPE_EIC_VEC_BASE 0x0800
  178. #define GIC_VPE_EIC_VEC(intr) \
  179. (GIC_VPE_EIC_VEC_BASE + (4 * intr))
  180. #define GIC_VPE_TENABLE_NMI_OFS 0x1000
  181. #define GIC_VPE_TENABLE_YQ_OFS 0x1004
  182. #define GIC_VPE_TENABLE_INT_31_0_OFS 0x1080
  183. #define GIC_VPE_TENABLE_INT_63_32_OFS 0x1084
  184. /* User Mode Visible Section Register Map */
  185. #define GIC_UMV_SH_COUNTER_31_00_OFS 0x0000
  186. #define GIC_UMV_SH_COUNTER_63_32_OFS 0x0004
  187. #else /* CONFIG_CPU_BIG_ENDIAN */
  188. #define GIC_SH_CONFIG_OFS 0x0000
  189. /* Shared Global Counter */
  190. #define GIC_SH_COUNTER_31_00_OFS 0x0014
  191. #define GIC_SH_COUNTER_63_32_OFS 0x0010
  192. /* Interrupt Polarity */
  193. #define GIC_SH_POL_31_0_OFS 0x0104
  194. #define GIC_SH_POL_63_32_OFS 0x0100
  195. #define GIC_SH_POL_95_64_OFS 0x010c
  196. #define GIC_SH_POL_127_96_OFS 0x0108
  197. #define GIC_SH_POL_159_128_OFS 0x0114
  198. #define GIC_SH_POL_191_160_OFS 0x0110
  199. #define GIC_SH_POL_223_192_OFS 0x011c
  200. #define GIC_SH_POL_255_224_OFS 0x0118
  201. /* Edge/Level Triggering */
  202. #define GIC_SH_TRIG_31_0_OFS 0x0184
  203. #define GIC_SH_TRIG_63_32_OFS 0x0180
  204. #define GIC_SH_TRIG_95_64_OFS 0x018c
  205. #define GIC_SH_TRIG_127_96_OFS 0x0188
  206. #define GIC_SH_TRIG_159_128_OFS 0x0194
  207. #define GIC_SH_TRIG_191_160_OFS 0x0190
  208. #define GIC_SH_TRIG_223_192_OFS 0x019c
  209. #define GIC_SH_TRIG_255_224_OFS 0x0198
  210. /* Dual Edge Triggering */
  211. #define GIC_SH_DUAL_31_0_OFS 0x0204
  212. #define GIC_SH_DUAL_63_32_OFS 0x0200
  213. #define GIC_SH_DUAL_95_64_OFS 0x020c
  214. #define GIC_SH_DUAL_127_96_OFS 0x0208
  215. #define GIC_SH_DUAL_159_128_OFS 0x0214
  216. #define GIC_SH_DUAL_191_160_OFS 0x0210
  217. #define GIC_SH_DUAL_223_192_OFS 0x021c
  218. #define GIC_SH_DUAL_255_224_OFS 0x0218
  219. /* Set/Clear corresponding bit in Edge Detect Register */
  220. #define GIC_SH_WEDGE_OFS 0x0280
  221. /* Reset Mask - Disables Interrupt */
  222. #define GIC_SH_RMASK_31_0_OFS 0x0304
  223. #define GIC_SH_RMASK_63_32_OFS 0x0300
  224. #define GIC_SH_RMASK_95_64_OFS 0x030c
  225. #define GIC_SH_RMASK_127_96_OFS 0x0308
  226. #define GIC_SH_RMASK_159_128_OFS 0x0314
  227. #define GIC_SH_RMASK_191_160_OFS 0x0310
  228. #define GIC_SH_RMASK_223_192_OFS 0x031c
  229. #define GIC_SH_RMASK_255_224_OFS 0x0318
  230. /* Set Mask (WO) - Enables Interrupt */
  231. #define GIC_SH_SMASK_31_0_OFS 0x0384
  232. #define GIC_SH_SMASK_63_32_OFS 0x0380
  233. #define GIC_SH_SMASK_95_64_OFS 0x038c
  234. #define GIC_SH_SMASK_127_96_OFS 0x0388
  235. #define GIC_SH_SMASK_159_128_OFS 0x0394
  236. #define GIC_SH_SMASK_191_160_OFS 0x0390
  237. #define GIC_SH_SMASK_223_192_OFS 0x039c
  238. #define GIC_SH_SMASK_255_224_OFS 0x0398
  239. /* Global Interrupt Mask Register (RO) - Bit Set == Interrupt enabled */
  240. #define GIC_SH_MASK_31_0_OFS 0x0404
  241. #define GIC_SH_MASK_63_32_OFS 0x0400
  242. #define GIC_SH_MASK_95_64_OFS 0x040c
  243. #define GIC_SH_MASK_127_96_OFS 0x0408
  244. #define GIC_SH_MASK_159_128_OFS 0x0414
  245. #define GIC_SH_MASK_191_160_OFS 0x0410
  246. #define GIC_SH_MASK_223_192_OFS 0x041c
  247. #define GIC_SH_MASK_255_224_OFS 0x0418
  248. /* Pending Global Interrupts (RO) */
  249. #define GIC_SH_PEND_31_0_OFS 0x0484
  250. #define GIC_SH_PEND_63_32_OFS 0x0480
  251. #define GIC_SH_PEND_95_64_OFS 0x048c
  252. #define GIC_SH_PEND_127_96_OFS 0x0488
  253. #define GIC_SH_PEND_159_128_OFS 0x0494
  254. #define GIC_SH_PEND_191_160_OFS 0x0490
  255. #define GIC_SH_PEND_223_192_OFS 0x049c
  256. #define GIC_SH_PEND_255_224_OFS 0x0498
  257. #define GIC_SH_INTR_MAP_TO_PIN_BASE_OFS 0x0500
  258. /* Maps Interrupt X to a Pin */
  259. #define GIC_SH_MAP_TO_PIN(intr) \
  260. (GIC_SH_INTR_MAP_TO_PIN_BASE_OFS + (4 * intr))
  261. #define GIC_SH_INTR_MAP_TO_VPE_BASE_OFS 0x2004
  262. /*
  263. * Maps Interrupt X to a VPE. This is more complex than the LE case, as
  264. * odd and even registers need to be transposed. It does work - trust me!
  265. */
  266. #define GIC_SH_MAP_TO_VPE_REG_OFF(intr, vpe) \
  267. (GIC_SH_INTR_MAP_TO_VPE_BASE_OFS + (32 * (intr)) + \
  268. (((((vpe) / 32) ^ 1) - 1) * 4))
  269. #define GIC_SH_MAP_TO_VPE_REG_BIT(vpe) (1 << ((vpe) % 32))
  270. /* Polarity */
  271. #define GIC_SH_SET_POLARITY_OFS 0x0100
  272. #define GIC_SET_POLARITY(intr, pol) \
  273. GICBIS(GIC_REG_ADDR(SHARED, GIC_SH_SET_POLARITY_OFS + 4 + (((((intr) / 32) ^ 1) - 1) * 4)), (pol) << ((intr) % 32))
  274. /* Triggering */
  275. #define GIC_SH_SET_TRIGGER_OFS 0x0180
  276. #define GIC_SET_TRIGGER(intr, trig) \
  277. GICBIS(GIC_REG_ADDR(SHARED, GIC_SH_SET_TRIGGER_OFS + 4 + (((((intr) / 32) ^ 1) - 1) * 4)), (trig) << ((intr) % 32))
  278. /* Mask manipulation */
  279. #define GIC_SH_SMASK_OFS 0x0380
  280. #define GIC_SET_INTR_MASK(intr, val) \
  281. GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_SMASK_OFS + 4 + (((((intr) / 32) ^ 1) - 1) * 4)), ((val) << ((intr) % 32)))
  282. #define GIC_SH_RMASK_OFS 0x0300
  283. #define GIC_CLR_INTR_MASK(intr, val) \
  284. GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_RMASK_OFS + 4 + (((((intr) / 32) ^ 1) - 1) * 4)), ((val) << ((intr) % 32)))
  285. /* Register Map for Local Section */
  286. #define GIC_VPE_CTL_OFS 0x0000
  287. #define GIC_VPE_PEND_OFS 0x0004
  288. #define GIC_VPE_MASK_OFS 0x0008
  289. #define GIC_VPE_RMASK_OFS 0x000c
  290. #define GIC_VPE_SMASK_OFS 0x0010
  291. #define GIC_VPE_WD_MAP_OFS 0x0040
  292. #define GIC_VPE_COMPARE_MAP_OFS 0x0044
  293. #define GIC_VPE_TIMER_MAP_OFS 0x0048
  294. #define GIC_VPE_PERFCTR_MAP_OFS 0x0050
  295. #define GIC_VPE_SWINT0_MAP_OFS 0x0054
  296. #define GIC_VPE_SWINT1_MAP_OFS 0x0058
  297. #define GIC_VPE_OTHER_ADDR_OFS 0x0080
  298. #define GIC_VPE_WD_CONFIG0_OFS 0x0090
  299. #define GIC_VPE_WD_COUNT0_OFS 0x0094
  300. #define GIC_VPE_WD_INITIAL0_OFS 0x0098
  301. #define GIC_VPE_COMPARE_LO_OFS 0x00a4
  302. #define GIC_VPE_COMPARE_HI_OFS 0x00a0
  303. #define GIC_VPE_EIC_SHADOW_SET_BASE 0x0100
  304. #define GIC_VPE_EIC_SS(intr) \
  305. (GIC_EIC_SHADOW_SET_BASE + (4 * intr))
  306. #define GIC_VPE_EIC_VEC_BASE 0x0800
  307. #define GIC_VPE_EIC_VEC(intr) \
  308. (GIC_VPE_EIC_VEC_BASE + (4 * intr))
  309. #define GIC_VPE_TENABLE_NMI_OFS 0x1000
  310. #define GIC_VPE_TENABLE_YQ_OFS 0x1004
  311. #define GIC_VPE_TENABLE_INT_31_0_OFS 0x1080
  312. #define GIC_VPE_TENABLE_INT_63_32_OFS 0x1084
  313. /* User Mode Visible Section Register Map */
  314. #define GIC_UMV_SH_COUNTER_31_00_OFS 0x0004
  315. #define GIC_UMV_SH_COUNTER_63_32_OFS 0x0000
  316. #endif /* !LE */
  317. /* Masks */
  318. #define GIC_SH_CONFIG_COUNTSTOP_SHF 28
  319. #define GIC_SH_CONFIG_COUNTSTOP_MSK (MSK(1) << GIC_SH_CONFIG_COUNTSTOP_SHF)
  320. #define GIC_SH_CONFIG_COUNTBITS_SHF 24
  321. #define GIC_SH_CONFIG_COUNTBITS_MSK (MSK(4) << GIC_SH_CONFIG_COUNTBITS_SHF)
  322. #define GIC_SH_CONFIG_NUMINTRS_SHF 16
  323. #define GIC_SH_CONFIG_NUMINTRS_MSK (MSK(8) << GIC_SH_CONFIG_NUMINTRS_SHF)
  324. #define GIC_SH_CONFIG_NUMVPES_SHF 0
  325. #define GIC_SH_CONFIG_NUMVPES_MSK (MSK(8) << GIC_SH_CONFIG_NUMVPES_SHF)
  326. #define GIC_SH_WEDGE_SET(intr) (intr | (0x1 << 31))
  327. #define GIC_SH_WEDGE_CLR(intr) (intr & ~(0x1 << 31))
  328. #define GIC_MAP_TO_PIN_SHF 31
  329. #define GIC_MAP_TO_PIN_MSK (MSK(1) << GIC_MAP_TO_PIN_SHF)
  330. #define GIC_MAP_TO_NMI_SHF 30
  331. #define GIC_MAP_TO_NMI_MSK (MSK(1) << GIC_MAP_TO_NMI_SHF)
  332. #define GIC_MAP_TO_YQ_SHF 29
  333. #define GIC_MAP_TO_YQ_MSK (MSK(1) << GIC_MAP_TO_YQ_SHF)
  334. #define GIC_MAP_SHF 0
  335. #define GIC_MAP_MSK (MSK(6) << GIC_MAP_SHF)
  336. /* GIC_VPE_CTL Masks */
  337. #define GIC_VPE_CTL_PERFCNT_RTBL_SHF 2
  338. #define GIC_VPE_CTL_PERFCNT_RTBL_MSK (MSK(1) << GIC_VPE_CTL_PERFCNT_RTBL_SHF)
  339. #define GIC_VPE_CTL_TIMER_RTBL_SHF 1
  340. #define GIC_VPE_CTL_TIMER_RTBL_MSK (MSK(1) << GIC_VPE_CTL_TIMER_RTBL_SHF)
  341. #define GIC_VPE_CTL_EIC_MODE_SHF 0
  342. #define GIC_VPE_CTL_EIC_MODE_MSK (MSK(1) << GIC_VPE_CTL_EIC_MODE_SHF)
  343. /* GIC_VPE_PEND Masks */
  344. #define GIC_VPE_PEND_WD_SHF 0
  345. #define GIC_VPE_PEND_WD_MSK (MSK(1) << GIC_VPE_PEND_WD_SHF)
  346. #define GIC_VPE_PEND_CMP_SHF 1
  347. #define GIC_VPE_PEND_CMP_MSK (MSK(1) << GIC_VPE_PEND_CMP_SHF)
  348. #define GIC_VPE_PEND_TIMER_SHF 2
  349. #define GIC_VPE_PEND_TIMER_MSK (MSK(1) << GIC_VPE_PEND_TIMER_SHF)
  350. #define GIC_VPE_PEND_PERFCOUNT_SHF 3
  351. #define GIC_VPE_PEND_PERFCOUNT_MSK (MSK(1) << GIC_VPE_PEND_PERFCOUNT_SHF)
  352. #define GIC_VPE_PEND_SWINT0_SHF 4
  353. #define GIC_VPE_PEND_SWINT0_MSK (MSK(1) << GIC_VPE_PEND_SWINT0_SHF)
  354. #define GIC_VPE_PEND_SWINT1_SHF 5
  355. #define GIC_VPE_PEND_SWINT1_MSK (MSK(1) << GIC_VPE_PEND_SWINT1_SHF)
  356. /* GIC_VPE_RMASK Masks */
  357. #define GIC_VPE_RMASK_WD_SHF 0
  358. #define GIC_VPE_RMASK_WD_MSK (MSK(1) << GIC_VPE_RMASK_WD_SHF)
  359. #define GIC_VPE_RMASK_CMP_SHF 1
  360. #define GIC_VPE_RMASK_CMP_MSK (MSK(1) << GIC_VPE_RMASK_CMP_SHF)
  361. #define GIC_VPE_RMASK_TIMER_SHF 2
  362. #define GIC_VPE_RMASK_TIMER_MSK (MSK(1) << GIC_VPE_RMASK_TIMER_SHF)
  363. #define GIC_VPE_RMASK_PERFCNT_SHF 3
  364. #define GIC_VPE_RMASK_PERFCNT_MSK (MSK(1) << GIC_VPE_RMASK_PERFCNT_SHF)
  365. #define GIC_VPE_RMASK_SWINT0_SHF 4
  366. #define GIC_VPE_RMASK_SWINT0_MSK (MSK(1) << GIC_VPE_RMASK_SWINT0_SHF)
  367. #define GIC_VPE_RMASK_SWINT1_SHF 5
  368. #define GIC_VPE_RMASK_SWINT1_MSK (MSK(1) << GIC_VPE_RMASK_SWINT1_SHF)
  369. /* GIC_VPE_SMASK Masks */
  370. #define GIC_VPE_SMASK_WD_SHF 0
  371. #define GIC_VPE_SMASK_WD_MSK (MSK(1) << GIC_VPE_SMASK_WD_SHF)
  372. #define GIC_VPE_SMASK_CMP_SHF 1
  373. #define GIC_VPE_SMASK_CMP_MSK (MSK(1) << GIC_VPE_SMASK_CMP_SHF)
  374. #define GIC_VPE_SMASK_TIMER_SHF 2
  375. #define GIC_VPE_SMASK_TIMER_MSK (MSK(1) << GIC_VPE_SMASK_TIMER_SHF)
  376. #define GIC_VPE_SMASK_PERFCNT_SHF 3
  377. #define GIC_VPE_SMASK_PERFCNT_MSK (MSK(1) << GIC_VPE_SMASK_PERFCNT_SHF)
  378. #define GIC_VPE_SMASK_SWINT0_SHF 4
  379. #define GIC_VPE_SMASK_SWINT0_MSK (MSK(1) << GIC_VPE_SMASK_SWINT0_SHF)
  380. #define GIC_VPE_SMASK_SWINT1_SHF 5
  381. #define GIC_VPE_SMASK_SWINT1_MSK (MSK(1) << GIC_VPE_SMASK_SWINT1_SHF)
  382. /*
  383. * Set the Mapping of Interrupt X to a VPE.
  384. */
  385. #define GIC_SH_MAP_TO_VPE_SMASK(intr, vpe) \
  386. GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_MAP_TO_VPE_REG_OFF(intr, vpe)), \
  387. GIC_SH_MAP_TO_VPE_REG_BIT(vpe))
  388. struct gic_pcpu_mask {
  389. DECLARE_BITMAP(pcpu_mask, GIC_NUM_INTRS);
  390. };
  391. struct gic_pending_regs {
  392. DECLARE_BITMAP(pending, GIC_NUM_INTRS);
  393. };
  394. struct gic_intrmask_regs {
  395. DECLARE_BITMAP(intrmask, GIC_NUM_INTRS);
  396. };
  397. /*
  398. * Interrupt Meta-data specification. The ipiflag helps
  399. * in building ipi_map.
  400. */
  401. struct gic_intr_map {
  402. unsigned int intrnum; /* Ext Intr Num */
  403. unsigned int cpunum; /* Directed to this CPU */
  404. unsigned int pin; /* Directed to this Pin */
  405. unsigned int polarity; /* Polarity : +/- */
  406. unsigned int trigtype; /* Trigger : Edge/Levl */
  407. unsigned int ipiflag; /* Is used for IPI ? */
  408. };
  409. extern void gic_init(unsigned long gic_base_addr,
  410. unsigned long gic_addrspace_size, struct gic_intr_map *intrmap,
  411. unsigned int intrmap_size, unsigned int irqbase);
  412. extern unsigned int gic_get_int(void);
  413. extern void gic_send_ipi(unsigned int intr);
  414. extern unsigned int plat_ipi_call_int_xlate(unsigned int);
  415. extern unsigned int plat_ipi_resched_int_xlate(unsigned int);
  416. #endif /* _ASM_GICREGS_H */