regs-v5.h 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. /*
  2. * Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 and
  6. * only version 2 as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #ifndef _REGS_V5_H_
  14. #define _REGS_V5_H_
  15. #include <linux/bitops.h>
  16. #define REG_VERSION 0x000
  17. #define REG_STATUS 0x100
  18. #define REG_STATUS2 0x104
  19. #define REG_ENGINES_AVAIL 0x108
  20. #define REG_FIFO_SIZES 0x10c
  21. #define REG_SEG_SIZE 0x110
  22. #define REG_GOPROC 0x120
  23. #define REG_ENCR_SEG_CFG 0x200
  24. #define REG_ENCR_SEG_SIZE 0x204
  25. #define REG_ENCR_SEG_START 0x208
  26. #define REG_CNTR0_IV0 0x20c
  27. #define REG_CNTR1_IV1 0x210
  28. #define REG_CNTR2_IV2 0x214
  29. #define REG_CNTR3_IV3 0x218
  30. #define REG_CNTR_MASK 0x21C
  31. #define REG_ENCR_CCM_INT_CNTR0 0x220
  32. #define REG_ENCR_CCM_INT_CNTR1 0x224
  33. #define REG_ENCR_CCM_INT_CNTR2 0x228
  34. #define REG_ENCR_CCM_INT_CNTR3 0x22c
  35. #define REG_ENCR_XTS_DU_SIZE 0x230
  36. #define REG_CNTR_MASK2 0x234
  37. #define REG_CNTR_MASK1 0x238
  38. #define REG_CNTR_MASK0 0x23c
  39. #define REG_AUTH_SEG_CFG 0x300
  40. #define REG_AUTH_SEG_SIZE 0x304
  41. #define REG_AUTH_SEG_START 0x308
  42. #define REG_AUTH_IV0 0x310
  43. #define REG_AUTH_IV1 0x314
  44. #define REG_AUTH_IV2 0x318
  45. #define REG_AUTH_IV3 0x31c
  46. #define REG_AUTH_IV4 0x320
  47. #define REG_AUTH_IV5 0x324
  48. #define REG_AUTH_IV6 0x328
  49. #define REG_AUTH_IV7 0x32c
  50. #define REG_AUTH_IV8 0x330
  51. #define REG_AUTH_IV9 0x334
  52. #define REG_AUTH_IV10 0x338
  53. #define REG_AUTH_IV11 0x33c
  54. #define REG_AUTH_IV12 0x340
  55. #define REG_AUTH_IV13 0x344
  56. #define REG_AUTH_IV14 0x348
  57. #define REG_AUTH_IV15 0x34c
  58. #define REG_AUTH_INFO_NONCE0 0x350
  59. #define REG_AUTH_INFO_NONCE1 0x354
  60. #define REG_AUTH_INFO_NONCE2 0x358
  61. #define REG_AUTH_INFO_NONCE3 0x35c
  62. #define REG_AUTH_BYTECNT0 0x390
  63. #define REG_AUTH_BYTECNT1 0x394
  64. #define REG_AUTH_BYTECNT2 0x398
  65. #define REG_AUTH_BYTECNT3 0x39c
  66. #define REG_AUTH_EXP_MAC0 0x3a0
  67. #define REG_AUTH_EXP_MAC1 0x3a4
  68. #define REG_AUTH_EXP_MAC2 0x3a8
  69. #define REG_AUTH_EXP_MAC3 0x3ac
  70. #define REG_AUTH_EXP_MAC4 0x3b0
  71. #define REG_AUTH_EXP_MAC5 0x3b4
  72. #define REG_AUTH_EXP_MAC6 0x3b8
  73. #define REG_AUTH_EXP_MAC7 0x3bc
  74. #define REG_CONFIG 0x400
  75. #define REG_GOPROC_QC_KEY 0x1000
  76. #define REG_GOPROC_OEM_KEY 0x2000
  77. #define REG_ENCR_KEY0 0x3000
  78. #define REG_ENCR_KEY1 0x3004
  79. #define REG_ENCR_KEY2 0x3008
  80. #define REG_ENCR_KEY3 0x300c
  81. #define REG_ENCR_KEY4 0x3010
  82. #define REG_ENCR_KEY5 0x3014
  83. #define REG_ENCR_KEY6 0x3018
  84. #define REG_ENCR_KEY7 0x301c
  85. #define REG_ENCR_XTS_KEY0 0x3020
  86. #define REG_ENCR_XTS_KEY1 0x3024
  87. #define REG_ENCR_XTS_KEY2 0x3028
  88. #define REG_ENCR_XTS_KEY3 0x302c
  89. #define REG_ENCR_XTS_KEY4 0x3030
  90. #define REG_ENCR_XTS_KEY5 0x3034
  91. #define REG_ENCR_XTS_KEY6 0x3038
  92. #define REG_ENCR_XTS_KEY7 0x303c
  93. #define REG_AUTH_KEY0 0x3040
  94. #define REG_AUTH_KEY1 0x3044
  95. #define REG_AUTH_KEY2 0x3048
  96. #define REG_AUTH_KEY3 0x304c
  97. #define REG_AUTH_KEY4 0x3050
  98. #define REG_AUTH_KEY5 0x3054
  99. #define REG_AUTH_KEY6 0x3058
  100. #define REG_AUTH_KEY7 0x305c
  101. #define REG_AUTH_KEY8 0x3060
  102. #define REG_AUTH_KEY9 0x3064
  103. #define REG_AUTH_KEY10 0x3068
  104. #define REG_AUTH_KEY11 0x306c
  105. #define REG_AUTH_KEY12 0x3070
  106. #define REG_AUTH_KEY13 0x3074
  107. #define REG_AUTH_KEY14 0x3078
  108. #define REG_AUTH_KEY15 0x307c
  109. /* Register bits - REG_VERSION */
  110. #define CORE_STEP_REV_SHIFT 0
  111. #define CORE_STEP_REV_MASK GENMASK(15, 0)
  112. #define CORE_MINOR_REV_SHIFT 16
  113. #define CORE_MINOR_REV_MASK GENMASK(23, 16)
  114. #define CORE_MAJOR_REV_SHIFT 24
  115. #define CORE_MAJOR_REV_MASK GENMASK(31, 24)
  116. /* Register bits - REG_STATUS */
  117. #define MAC_FAILED_SHIFT 31
  118. #define DOUT_SIZE_AVAIL_SHIFT 26
  119. #define DOUT_SIZE_AVAIL_MASK GENMASK(30, 26)
  120. #define DIN_SIZE_AVAIL_SHIFT 21
  121. #define DIN_SIZE_AVAIL_MASK GENMASK(25, 21)
  122. #define HSD_ERR_SHIFT 20
  123. #define ACCESS_VIOL_SHIFT 19
  124. #define PIPE_ACTIVE_ERR_SHIFT 18
  125. #define CFG_CHNG_ERR_SHIFT 17
  126. #define DOUT_ERR_SHIFT 16
  127. #define DIN_ERR_SHIFT 15
  128. #define AXI_ERR_SHIFT 14
  129. #define CRYPTO_STATE_SHIFT 10
  130. #define CRYPTO_STATE_MASK GENMASK(13, 10)
  131. #define ENCR_BUSY_SHIFT 9
  132. #define AUTH_BUSY_SHIFT 8
  133. #define DOUT_INTR_SHIFT 7
  134. #define DIN_INTR_SHIFT 6
  135. #define OP_DONE_INTR_SHIFT 5
  136. #define ERR_INTR_SHIFT 4
  137. #define DOUT_RDY_SHIFT 3
  138. #define DIN_RDY_SHIFT 2
  139. #define OPERATION_DONE_SHIFT 1
  140. #define SW_ERR_SHIFT 0
  141. /* Register bits - REG_STATUS2 */
  142. #define AXI_EXTRA_SHIFT 1
  143. #define LOCKED_SHIFT 2
  144. /* Register bits - REG_CONFIG */
  145. #define REQ_SIZE_SHIFT 17
  146. #define REQ_SIZE_MASK GENMASK(20, 17)
  147. #define REQ_SIZE_ENUM_1_BEAT 0
  148. #define REQ_SIZE_ENUM_2_BEAT 1
  149. #define REQ_SIZE_ENUM_3_BEAT 2
  150. #define REQ_SIZE_ENUM_4_BEAT 3
  151. #define REQ_SIZE_ENUM_5_BEAT 4
  152. #define REQ_SIZE_ENUM_6_BEAT 5
  153. #define REQ_SIZE_ENUM_7_BEAT 6
  154. #define REQ_SIZE_ENUM_8_BEAT 7
  155. #define REQ_SIZE_ENUM_9_BEAT 8
  156. #define REQ_SIZE_ENUM_10_BEAT 9
  157. #define REQ_SIZE_ENUM_11_BEAT 10
  158. #define REQ_SIZE_ENUM_12_BEAT 11
  159. #define REQ_SIZE_ENUM_13_BEAT 12
  160. #define REQ_SIZE_ENUM_14_BEAT 13
  161. #define REQ_SIZE_ENUM_15_BEAT 14
  162. #define REQ_SIZE_ENUM_16_BEAT 15
  163. #define MAX_QUEUED_REQ_SHIFT 14
  164. #define MAX_QUEUED_REQ_MASK GENMASK(24, 16)
  165. #define ENUM_1_QUEUED_REQS 0
  166. #define ENUM_2_QUEUED_REQS 1
  167. #define ENUM_3_QUEUED_REQS 2
  168. #define IRQ_ENABLES_SHIFT 10
  169. #define IRQ_ENABLES_MASK GENMASK(13, 10)
  170. #define LITTLE_ENDIAN_MODE_SHIFT 9
  171. #define PIPE_SET_SELECT_SHIFT 5
  172. #define PIPE_SET_SELECT_MASK GENMASK(8, 5)
  173. #define HIGH_SPD_EN_N_SHIFT 4
  174. #define MASK_DOUT_INTR_SHIFT 3
  175. #define MASK_DIN_INTR_SHIFT 2
  176. #define MASK_OP_DONE_INTR_SHIFT 1
  177. #define MASK_ERR_INTR_SHIFT 0
  178. /* Register bits - REG_AUTH_SEG_CFG */
  179. #define COMP_EXP_MAC_SHIFT 24
  180. #define COMP_EXP_MAC_DISABLED 0
  181. #define COMP_EXP_MAC_ENABLED 1
  182. #define F9_DIRECTION_SHIFT 23
  183. #define F9_DIRECTION_UPLINK 0
  184. #define F9_DIRECTION_DOWNLINK 1
  185. #define AUTH_NONCE_NUM_WORDS_SHIFT 20
  186. #define AUTH_NONCE_NUM_WORDS_MASK GENMASK(22, 20)
  187. #define USE_PIPE_KEY_AUTH_SHIFT 19
  188. #define USE_HW_KEY_AUTH_SHIFT 18
  189. #define AUTH_FIRST_SHIFT 17
  190. #define AUTH_LAST_SHIFT 16
  191. #define AUTH_POS_SHIFT 14
  192. #define AUTH_POS_MASK GENMASK(15, 14)
  193. #define AUTH_POS_BEFORE 0
  194. #define AUTH_POS_AFTER 1
  195. #define AUTH_SIZE_SHIFT 9
  196. #define AUTH_SIZE_MASK GENMASK(13, 9)
  197. #define AUTH_SIZE_SHA1 0
  198. #define AUTH_SIZE_SHA256 1
  199. #define AUTH_SIZE_ENUM_1_BYTES 0
  200. #define AUTH_SIZE_ENUM_2_BYTES 1
  201. #define AUTH_SIZE_ENUM_3_BYTES 2
  202. #define AUTH_SIZE_ENUM_4_BYTES 3
  203. #define AUTH_SIZE_ENUM_5_BYTES 4
  204. #define AUTH_SIZE_ENUM_6_BYTES 5
  205. #define AUTH_SIZE_ENUM_7_BYTES 6
  206. #define AUTH_SIZE_ENUM_8_BYTES 7
  207. #define AUTH_SIZE_ENUM_9_BYTES 8
  208. #define AUTH_SIZE_ENUM_10_BYTES 9
  209. #define AUTH_SIZE_ENUM_11_BYTES 10
  210. #define AUTH_SIZE_ENUM_12_BYTES 11
  211. #define AUTH_SIZE_ENUM_13_BYTES 12
  212. #define AUTH_SIZE_ENUM_14_BYTES 13
  213. #define AUTH_SIZE_ENUM_15_BYTES 14
  214. #define AUTH_SIZE_ENUM_16_BYTES 15
  215. #define AUTH_MODE_SHIFT 6
  216. #define AUTH_MODE_MASK GENMASK(8, 6)
  217. #define AUTH_MODE_HASH 0
  218. #define AUTH_MODE_HMAC 1
  219. #define AUTH_MODE_CCM 0
  220. #define AUTH_MODE_CMAC 1
  221. #define AUTH_KEY_SIZE_SHIFT 3
  222. #define AUTH_KEY_SIZE_MASK GENMASK(5, 3)
  223. #define AUTH_KEY_SZ_AES128 0
  224. #define AUTH_KEY_SZ_AES256 2
  225. #define AUTH_ALG_SHIFT 0
  226. #define AUTH_ALG_MASK GENMASK(2, 0)
  227. #define AUTH_ALG_NONE 0
  228. #define AUTH_ALG_SHA 1
  229. #define AUTH_ALG_AES 2
  230. #define AUTH_ALG_KASUMI 3
  231. #define AUTH_ALG_SNOW3G 4
  232. #define AUTH_ALG_ZUC 5
  233. /* Register bits - REG_ENCR_XTS_DU_SIZE */
  234. #define ENCR_XTS_DU_SIZE_SHIFT 0
  235. #define ENCR_XTS_DU_SIZE_MASK GENMASK(19, 0)
  236. /* Register bits - REG_ENCR_SEG_CFG */
  237. #define F8_KEYSTREAM_ENABLE_SHIFT 17
  238. #define F8_KEYSTREAM_DISABLED 0
  239. #define F8_KEYSTREAM_ENABLED 1
  240. #define F8_DIRECTION_SHIFT 16
  241. #define F8_DIRECTION_UPLINK 0
  242. #define F8_DIRECTION_DOWNLINK 1
  243. #define USE_PIPE_KEY_ENCR_SHIFT 15
  244. #define USE_PIPE_KEY_ENCR_ENABLED 1
  245. #define USE_KEY_REGISTERS 0
  246. #define USE_HW_KEY_ENCR_SHIFT 14
  247. #define USE_KEY_REG 0
  248. #define USE_HW_KEY 1
  249. #define LAST_CCM_SHIFT 13
  250. #define LAST_CCM_XFR 1
  251. #define INTERM_CCM_XFR 0
  252. #define CNTR_ALG_SHIFT 11
  253. #define CNTR_ALG_MASK GENMASK(12, 11)
  254. #define CNTR_ALG_NIST 0
  255. #define ENCODE_SHIFT 10
  256. #define ENCR_MODE_SHIFT 6
  257. #define ENCR_MODE_MASK GENMASK(9, 6)
  258. #define ENCR_MODE_ECB 0
  259. #define ENCR_MODE_CBC 1
  260. #define ENCR_MODE_CTR 2
  261. #define ENCR_MODE_XTS 3
  262. #define ENCR_MODE_CCM 4
  263. #define ENCR_KEY_SZ_SHIFT 3
  264. #define ENCR_KEY_SZ_MASK GENMASK(5, 3)
  265. #define ENCR_KEY_SZ_DES 0
  266. #define ENCR_KEY_SZ_3DES 1
  267. #define ENCR_KEY_SZ_AES128 0
  268. #define ENCR_KEY_SZ_AES256 2
  269. #define ENCR_ALG_SHIFT 0
  270. #define ENCR_ALG_MASK GENMASK(2, 0)
  271. #define ENCR_ALG_NONE 0
  272. #define ENCR_ALG_DES 1
  273. #define ENCR_ALG_AES 2
  274. #define ENCR_ALG_KASUMI 4
  275. #define ENCR_ALG_SNOW_3G 5
  276. #define ENCR_ALG_ZUC 6
  277. /* Register bits - REG_GOPROC */
  278. #define GO_SHIFT 0
  279. #define CLR_CNTXT_SHIFT 1
  280. #define RESULTS_DUMP_SHIFT 2
  281. /* Register bits - REG_ENGINES_AVAIL */
  282. #define ENCR_AES_SEL_SHIFT 0
  283. #define DES_SEL_SHIFT 1
  284. #define ENCR_SNOW3G_SEL_SHIFT 2
  285. #define ENCR_KASUMI_SEL_SHIFT 3
  286. #define SHA_SEL_SHIFT 4
  287. #define SHA512_SEL_SHIFT 5
  288. #define AUTH_AES_SEL_SHIFT 6
  289. #define AUTH_SNOW3G_SEL_SHIFT 7
  290. #define AUTH_KASUMI_SEL_SHIFT 8
  291. #define BAM_PIPE_SETS_SHIFT 9
  292. #define BAM_PIPE_SETS_MASK GENMASK(12, 9)
  293. #define AXI_WR_BEATS_SHIFT 13
  294. #define AXI_WR_BEATS_MASK GENMASK(18, 13)
  295. #define AXI_RD_BEATS_SHIFT 19
  296. #define AXI_RD_BEATS_MASK GENMASK(24, 19)
  297. #define ENCR_ZUC_SEL_SHIFT 26
  298. #define AUTH_ZUC_SEL_SHIFT 27
  299. #define ZUC_ENABLE_SHIFT 28
  300. #endif /* _REGS_V5_H_ */