PageRenderTime 35ms CodeModel.GetById 33ms RepoModel.GetById 1ms app.codeStats 0ms

/drivers/crypto/msm/qcryptohw_40.h

https://bitbucket.org/Lloir/lge-kernel-msm7x27x
C Header | 316 lines | 246 code | 50 blank | 20 comment | 0 complexity | c6afa54185275f7896a1f501f008d184 MD5 | raw file
  1. /* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef _DRIVERS_CRYPTO_MSM_QCRYPTOHW_40_H_
  13. #define _DRIVERS_CRYPTO_MSM_QCRYPTOHW_40_H_
  14. #define QCE_AUTH_REG_BYTE_COUNT 4
  15. #define CRYPTO_VERSION_REG 0x0
  16. #define CRYPTO_DATA_IN_REG 0x008
  17. #define CRYPTO_DATA_OUT_REG 0x010
  18. #define CRYPTO_STATUS_REG 0x100
  19. #define CRYPTO_ENGINES_AVAIL 0x104
  20. #define CRYPTO3_VERSION_REG 0x108
  21. #define CRYPTO_SEG_SIZE_REG 0x200
  22. #define CRYPTO_GOPROC_REG 0x204
  23. #define CRYPTO_ENCR_SEG_CFG_REG 0x300
  24. #define CRYPTO_ENCR_SEG_SIZE_REG 0x304
  25. #define CRYPTO_ENCR_SEG_START_REG 0x308
  26. #define CRYPTO_ENCR_KEY0_REG 0x310
  27. #define CRYPTO_ENCR_KEY1_REG 0x314
  28. #define CRYPTO_ENCR_KEY2_REG 0x318
  29. #define CRYPTO_ENCR_KEY3_REG 0x31C
  30. #define CRYPTO_ENCR_KEY4_REG 0x320
  31. #define CRYPTO_ENCR_KEY5_REG 0x324
  32. #define CRYPTO_ENCR_KEY6_REG 0x328
  33. #define CRYPTO_ENCR_KEY7_REG 0x32C
  34. #define CRYPTO_ENCR_XTS_KEY0_REG 0x330
  35. #define CRYPTO_ENCR_XTS_KEY1_REG 0x334
  36. #define CRYPTO_ENCR_XTS_KEY2_REG 0x338
  37. #define CRYPTO_ENCR_XTS_KEY3_REG 0x33C
  38. #define CRYPTO_ENCR_XTS_KEY4_REG 0x340
  39. #define CRYPTO_ENCR_XTS_KEY5_REG 0x344
  40. #define CRYPTO_ENCR_XTS_KEY6_REG 0x348
  41. #define CRYPTO_ENCR_XTS_KEY7_REG 0x34C
  42. #define CRYPTO_CNTR0_IV0_REG 0x350
  43. #define CRYPTO_CNTR1_IV1_REG 0x354
  44. #define CRYPTO_CNTR2_IV2_REG 0x358
  45. #define CRYPTO_CNTR3_IV3_REG 0x35C
  46. #define CRYPTO_CNTR_MASK_REG 0x360
  47. #define CRYPTO_ENCR_XTS_DU_SIZE_REG 0x364
  48. #define CRYPTO_AUTH_SEG_CFG_REG 0x400
  49. #define CRYPTO_AUTH_SEG_SIZE_REG 0x404
  50. #define CRYPTO_AUTH_SEG_START_REG 0x408
  51. #define CRYPTO_AUTH_KEY0_REG 0x410
  52. #define CRYPTO_AUTH_KEY1_REG 0x414
  53. #define CRYPTO_AUTH_KEY2_REG 0x418
  54. #define CRYPTO_AUTH_KEY3_REG 0x41C
  55. #define CRYPTO_AUTH_KEY4_REG 0x420
  56. #define CRYPTO_AUTH_KEY5_REG 0x424
  57. #define CRYPTO_AUTH_KEY6_REG 0x428
  58. #define CRYPTO_AUTH_KEY7_REG 0x42C
  59. #define CRYPTO_AUTH_KEY8_REG 0x430
  60. #define CRYPTO_AUTH_KEY9_REG 0x434
  61. #define CRYPTO_AUTH_KEY10_REG 0x438
  62. #define CRYPTO_AUTH_KEY11_REG 0x43C
  63. #define CRYPTO_AUTH_KEY12_REG 0x440
  64. #define CRYPTO_AUTH_KEY13_REG 0x444
  65. #define CRYPTO_AUTH_KEY14_REG 0x448
  66. #define CRYPTO_AUTH_KEY15_REG 0x44C
  67. #define CRYPTO_AUTH_IV0_REG 0x450
  68. #define CRYPTO_AUTH_IV1_REG 0x454
  69. #define CRYPTO_AUTH_IV2_REG 0x458
  70. #define CRYPTO_AUTH_IV3_REG 0x45C
  71. #define CRYPTO_AUTH_IV4_REG 0x460
  72. #define CRYPTO_AUTH_IV5_REG 0x464
  73. #define CRYPTO_AUTH_IV6_REG 0x468
  74. #define CRYPTO_AUTH_IV7_REG 0x46C
  75. #define CRYPTO_AUTH_IV8_REG 0x470
  76. #define CRYPTO_AUTH_IV9_REG 0x474
  77. #define CRYPTO_AUTH_IV10_REG 0x478
  78. #define CRYPTO_AUTH_IV11_REG 0x47C
  79. #define CRYPTO_AUTH_IV12_REG 0x480
  80. #define CRYPTO_AUTH_IV13_REG 0x484
  81. #define CRYPTO_AUTH_IV14_REG 0x488
  82. #define CRYPTO_AUTH_IV15_REG 0x48C
  83. #define CRYPTO_AUTH_INFO_NONCE0_REG 0x490
  84. #define CRYPTO_AUTH_INFO_NONCE1_REG 0x494
  85. #define CRYPTO_AUTH_INFO_NONCE2_REG 0x498
  86. #define CRYPTO_AUTH_INFO_NONCE3_REG 0x49C
  87. #define CRYPTO_AUTH_BYTECNT0_REG 0x4A0
  88. #define CRYPTO_AUTH_BYTECNT1_REG 0x4A4
  89. #define CRYPTO_AUTH_BYTECNT2_REG 0x4A8
  90. #define CRYPTO_AUTH_BYTECNT3_REG 0x4AC
  91. #define CRYPTO_AUTH_EXP_MAC0_REG 0x4B0
  92. #define CRYPTO_AUTH_EXP_MAC1_REG 0x4B4
  93. #define CRYPTO_AUTH_EXP_MAC2_REG 0x4B8
  94. #define CRYPTO_AUTH_EXP_MAC3_REG 0x4BC
  95. #define CRYPTO_AUTH_EXP_MAC4_REG 0x4C0
  96. #define CRYPTO_AUTH_EXP_MAC5_REG 0x4C4
  97. #define CRYPTO_AUTH_EXP_MAC6_REG 0x4C8
  98. #define CRYPTO_AUTH_EXP_MAC7_REG 0x4CC
  99. #define CRYPTO_CONFIG_REG 0x500
  100. #define CRYPTO_SACR_REG 0x504
  101. #define CRYPTO_DEBUG_REG 0x508
  102. #define CRYPTO_DATA_SHADOW0 0x8000
  103. #define CRYPTO_DATA_SHADOW8191 0x8FFC
  104. /* Register bits */
  105. #define CRYPTO_CORE_MAJOR_REV 4 /* bit 7-4 */
  106. #define CRYPTO_CORE_MAJOR_REV_MASK (0xF << CRYPTO_CORE_MAJOR_REV)
  107. #define CRYPTO_CORE_MINOR_REV 0 /* bit 3-0 */
  108. #define CRYPTO_CORE_MINOR_REV_MASK (0xF << CRYPTO_CORE_MINOR_REV)
  109. #define CRYPTO_CORE_REV_MASK 0xFF
  110. /* status reg */
  111. #define CRYPTO_MAC_FAILED 25
  112. #define CRYPTO_DOUT_SIZE_AVAIL 22 /* bit 24-22 */
  113. #define CRYPTO_DOUT_SIZE_AVAIL_MASK (0x7 << CRYPTO_DOUT_SIZE_AVAIL)
  114. #define CRYPTO_DIN_SIZE_AVAIL 19 /* bit 21-19 */
  115. #define CRYPTO_DIN_SIZE_AVAIL_MASK (0x7 << CRYPTO_DIN_SIZE_AVAIL)
  116. #define CRYPTO_ACCESS_VIOL 18
  117. #define CRYPTO_SEG_CHNG_ERR 17
  118. #define CRYPTO_CFH_CHNG_ERR 16
  119. #define CRYPTO_DOUT_ERR 15
  120. #define CRYPTO_DIN_ERR 14
  121. #define CRYPTO_LOCKED 13
  122. #define CRYPTO_CRYPTO_STATE 10 /* bit 12-10 */
  123. #define CRYPTO_CRYPTO_STATE_MASK (0x7 << CRYPTO_CRYPTO_STATE)
  124. #define CRYPTO_ENCR_BUSY 9
  125. #define CRYPTO_AUTH_BUSY 8
  126. #define CRYPTO_DOUT_INTR 7
  127. #define CRYPTO_DIN_INTR 6
  128. #define CRYPTO_OP_DONE_INTR 5
  129. #define CRYPTO_ERR_INTR 4
  130. #define CRYPTO_DOUT_RDY 3
  131. #define CRYPTO_DIN_RDY 2
  132. #define CRYPTO_OPERATION_DONE 1
  133. #define CRYPTO_SW_ERR 0
  134. /* config reg */
  135. #define CRYPTO_REQ_SIZE 30 /* bit 31-30 */
  136. #define CRYPTO_REQ_SIZE_MASK (0x3 << CRYPTO_REQ_SIZE)
  137. #define CRYPTO_REQ_SIZE_ENUM_16_BYTES 0
  138. #define CRYPTO_REQ_SIZE_ENUM_32_BYTES 1
  139. #define CRYPTO_REQ_SIZE_ENUM_64_BYTES 2
  140. #define CRYPTO_MAX_QUEUED_REQ 27 /* bit 29-27 */
  141. #define CRYPTO_MAX_QUEUED_REQ_MASK (0x7 << CRYPTO_MAX_QUEUED_REQ)
  142. #define CRYPTO_ENUM1_QUEUED_REQS 0
  143. #define CRYPTO_ENUM2_QUEUED_REQS 1
  144. #define CRYPTO_ENUM3_QUEUED_REQS 2
  145. #define CRYPTO_ENUM4_QUEUED_REQS 3
  146. #define CRYPTO_FIFO_THRESHOLD 24 /* bit 26-24 */
  147. #define CRYPTO_FIFO_THRESHOLD_MASK (0x7 << CRYPTO_FIFO_THRESHOLD)
  148. #define CRYPTO_FIFO_ENUM_16_BYTES 0
  149. #define CRYPTO_FIFO_ENUM_32_BYTES 1
  150. #define CRYPTO_FIFO_ENUM_48_BYTES 2
  151. #define CRYPTO_FIFO_ENUM_64_BYTES 3
  152. #define CRYPTO_IRQ_ENABLES 20 /* bit 23-20 */
  153. #define CRYPTO_IRQ_ENABLES_MASK (0xF << CRYPTO_IRQ_ENABLES)
  154. #define CRYPTO_ACR_EN 18
  155. #define CRYPTO_BAM_MODE 17
  156. #define CRYPTO_LITTLE_ENDIAN_MODE 16
  157. #define CRYPTO_HIGH_SPD_OUT_EN_N 14
  158. #define CRYPTO_HIGH_SPD_IN_EN_N 13
  159. #define CRYPTO_DBG_EN 12
  160. #define CRYPTO_DBG_SEL 7 /* bit 11:7 */
  161. #define CRYPTO_DBG_SEL_MASK (0x1F << CRYPTO_DBG_SEL)
  162. #define CRYPTO_MASK_DOUT_INTR 6
  163. #define CRYPTO_MASK_DIN_INTR 5
  164. #define CRYPTO_MASK_OP_DONE_INTR 4
  165. #define CRYPTO_MASK_ERR_INTR 3
  166. #define CRYPTO_AUTO_SHUTDOWN_EN 2
  167. #define CRYPTO_CLK_EN_N 1
  168. /* auth_seg_cfg reg */
  169. #define CRYPTO_COMP_EXP_MAC 20
  170. #define CRYPTO_COMP_EXP_MAC_DISABLED 0
  171. #define CRYPTO_COMP_EXP_MAC_ENABLED 1
  172. #define CRYPTO_F9_DIRECTION 19
  173. #define CRYPTO_F9_DIRECTION_UPLINK 0
  174. #define CRYPTO_F9_DIRECTION_DOWNLINK 1
  175. #define CRYPTO_AUTH_NONCE_NUM_WORDS 16
  176. #define CRYPTO_AUTH_NONCE_NUM_WORDS_MASK \
  177. (0x7 << CRYPTO_AUTH_NONCE_NUM_WORDS)
  178. #define CRYPTO_USE_HW_KEY_AUTH 15
  179. #define CRYPTO_LAST 14
  180. #define CRYPTO_AUTH_POS 12 /* bit 13 .. 12*/
  181. #define CRYPTO_AUTH_POS_MASK (0x3 << CRYPTO_AUTH_POS)
  182. #define CRYPTO_AUTH_POS_BEFORE 0
  183. #define CRYPTO_AUTH_POS_AFTER 1
  184. #define CRYPTO_AUTH_SIZE 9 /* bits 11 .. 9*/
  185. #define CRYPTO_AUTH_SIZE_MASK (0x7 << CRYPTO_AUTH_SIZE)
  186. #define CRYPTO_AUTH_SIZE_SHA1 0
  187. #define CRYPTO_AUTH_SIZE_SHA256 1
  188. #define CRYPTO_AUTH_SIZE_ENUM_4_BYTES 0
  189. #define CRYPTO_AUTH_SIZE_ENUM_6_BYTES 1
  190. #define CRYPTO_AUTH_SIZE_ENUM_8_BYTES 2
  191. #define CRYPTO_AUTH_SIZE_ENUM_10_BYTES 3
  192. #define CRYPTO_AUTH_SIZE_ENUM_12_BYTES 4
  193. #define CRYPTO_AUTH_SIZE_ENUM_14_BYTES 5
  194. #define CRYPTO_AUTH_SIZE_ENUM_16_BYTES 6
  195. #define CRYPTO_AUTH_MODE 6 /* bit 8 .. 6*/
  196. #define CRYPTO_AUTH_MODE_MASK (0x7 << CRYPTO_AUTH_MODE)
  197. #define CRYPTO_AUTH_MODE_HASH 0
  198. #define CRYPTO_AUTH_MODE_HMAC 1
  199. #define CRYPTO_AUTH_MODE_CCM 0
  200. #define CRYPTO_AUTH_MODE_CMAC 1
  201. #define CRYPTO_AUTH_KEY_SIZE 3
  202. #define CRYPTO_AUTH_KEY_SIZE_MASK (0x7 << CRYPTO_AUTH_KEY_SIZE)
  203. #define CRYPTO_AUTH_KEY_SZ_AES128 0
  204. #define CRYPTO_AUTH_KEY_SZ_AES256 2
  205. #define CRYPTO_AUTH_ALG 0 /* bit 2 .. 0*/
  206. #define CRYPTO_AUTH_ALG_MASK 7
  207. #define CRYPTO_AUTH_ALG_NONE 0
  208. #define CRYPTO_AUTH_ALG_SHA 1
  209. #define CRYPTO_AUTH_ALG_AES 2
  210. #define CRYPTO_AUTH_ALG_KASUMI 3
  211. #define CRYPTO_AUTH_ALG_SNOW3G 4
  212. /* encr_xts_du_size reg */
  213. #define CRYPTO_ENCR_XTS_DU_SIZE 0 /* bit 19-0 */
  214. #define CRYPTO_ENCR_XTS_DU_SIZE_MASK 0xfffff
  215. /* encr_seg_cfg reg */
  216. #define CRYPTO_F8_KEYSTREAM_ENABLE 15
  217. #define CRYPTO_F8_KEYSTREAM_DISABLED 0
  218. #define CRYPTO_F8_KEYSTREAM_ENABLED 1
  219. #define CRYPTO_F8_DIRECTION 14
  220. #define CRYPTO_F8_DIRECTION_UPLINK 0
  221. #define CRYPTO_F8_DIRECTION_DOWNLINK 1
  222. #define CRYPTO_USE_HW_KEY_ENCR 13
  223. #define CRYPTO_USE_HW_KEY_REG 0
  224. #define CRYPTO_USE_HW_KEY 1
  225. #define CRYPTO_CNTR_ALG 11 /* bit 12-11 */
  226. #define CRYPTO_CNTR_ALG_MASK (3 << CRYPTO_CNTR_ALG)
  227. #define CRYPTO_CNTR_ALG_NIST 0
  228. #define CRYPTO_ENCODE 10
  229. #define CRYPTO_ENCR_MODE 6 /* bit 9-6 */
  230. #define CRYPTO_ENCR_MODE_MASK (0xF << CRYPTO_ENCR_MODE)
  231. /* only valid when AES */
  232. #define CRYPTO_ENCR_MODE_ECB 0
  233. #define CRYPTO_ENCR_MODE_CBC 1
  234. #define CRYPTO_ENCR_MODE_CTR 2
  235. #define CRYPTO_ENCR_MODE_XTS 3
  236. #define CRYPTO_ENCR_MODE_CCM 4
  237. #define CRYPTO_ENCR_KEY_SZ 3 /* bit 5-3 */
  238. #define CRYPTO_ENCR_KEY_SZ_MASK (7 << CRYPTO_ENCR_KEY_SZ)
  239. #define CRYPTO_ENCR_KEY_SZ_DES 0
  240. #define CRYPTO_ENCR_KEY_SZ_3DES 1
  241. #define CRYPTO_ENCR_KEY_SZ_AES128 0
  242. #define CRYPTO_ENCR_KEY_SZ_AES256 2
  243. #define CRYPTO_ENCR_KEY_SZ_UEA1 0
  244. #define CRYPTO_ENCR_KEY_SZ_UEA2 1
  245. #define CRYPTO_ENCR_ALG 0 /* bit 2-0 */
  246. #define CRYPTO_ENCR_ALG_MASK (7 << CRYPTO_ENCR_ALG)
  247. #define CRYPTO_ENCR_ALG_NONE 0
  248. #define CRYPTO_ENCR_ALG_DES 1
  249. #define CRYPTO_ENCR_ALG_AES 2
  250. #define CRYPTO_ENCR_ALG_KASUMI 3
  251. #define CRYPTO_ENCR_ALG_SNOW_3G 5
  252. /* goproc reg */
  253. #define CRYPTO_GO 0
  254. #define CRYPTO_CLR_CNTXT 1
  255. /* engines_avail */
  256. #define CRYPTO_ENCR_AES_SEL 0
  257. #define CRYPTO_DES_SEL 3
  258. #define CRYPTO_ENCR_SNOW3G_SEL 4
  259. #define CRYPTO_ENCR_KASUMI_SEL 5
  260. #define CRYPTO_SHA_SEL 6
  261. #define CRYPTO_SHA512_SEL 7
  262. #define CRYPTO_AUTH_AES_SEL 8
  263. #define CRYPTO_AUTH_SNOW3G_SEL 9
  264. #define CRYPTO_AUTH_KASUMI_SEL 10
  265. #define CRYPTO_BAM_SEL 11
  266. #endif /* _DRIVERS_CRYPTO_MSM_QCRYPTOHW_40_H_ */