iceregs.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /* Copyright (c) 2014-2017, The Linux Foundation. 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 _QCOM_INLINE_CRYPTO_ENGINE_REGS_H_
  13. #define _QCOM_INLINE_CRYPTO_ENGINE_REGS_H_
  14. /* Register bits for ICE version */
  15. #define ICE_CORE_CURRENT_MAJOR_VERSION 0x03
  16. #define ICE_CORE_STEP_REV_MASK 0xFFFF
  17. #define ICE_CORE_STEP_REV 0 /* bit 15-0 */
  18. #define ICE_CORE_MAJOR_REV_MASK 0xFF000000
  19. #define ICE_CORE_MAJOR_REV 24 /* bit 31-24 */
  20. #define ICE_CORE_MINOR_REV_MASK 0xFF0000
  21. #define ICE_CORE_MINOR_REV 16 /* bit 23-16 */
  22. #define ICE_BIST_STATUS_MASK (0xF0000000) /* bits 28-31 */
  23. #define ICE_FUSE_SETTING_MASK 0x1
  24. #define ICE_FORCE_HW_KEY0_SETTING_MASK 0x2
  25. #define ICE_FORCE_HW_KEY1_SETTING_MASK 0x4
  26. /* QCOM ICE Registers from SWI */
  27. #define QCOM_ICE_REGS_CONTROL 0x0000
  28. #define QCOM_ICE_REGS_RESET 0x0004
  29. #define QCOM_ICE_REGS_VERSION 0x0008
  30. #define QCOM_ICE_REGS_FUSE_SETTING 0x0010
  31. #define QCOM_ICE_REGS_PARAMETERS_1 0x0014
  32. #define QCOM_ICE_REGS_PARAMETERS_2 0x0018
  33. #define QCOM_ICE_REGS_PARAMETERS_3 0x001C
  34. #define QCOM_ICE_REGS_PARAMETERS_4 0x0020
  35. #define QCOM_ICE_REGS_PARAMETERS_5 0x0024
  36. /* QCOM ICE v3.X only */
  37. #define QCOM_ICE_GENERAL_ERR_STTS 0x0040
  38. #define QCOM_ICE_INVALID_CCFG_ERR_STTS 0x0030
  39. #define QCOM_ICE_GENERAL_ERR_MASK 0x0044
  40. /* QCOM ICE v2.X only */
  41. #define QCOM_ICE_REGS_NON_SEC_IRQ_STTS 0x0040
  42. #define QCOM_ICE_REGS_NON_SEC_IRQ_MASK 0x0044
  43. #define QCOM_ICE_REGS_NON_SEC_IRQ_CLR 0x0048
  44. #define QCOM_ICE_REGS_STREAM1_ERROR_SYNDROME1 0x0050
  45. #define QCOM_ICE_REGS_STREAM1_ERROR_SYNDROME2 0x0054
  46. #define QCOM_ICE_REGS_STREAM2_ERROR_SYNDROME1 0x0058
  47. #define QCOM_ICE_REGS_STREAM2_ERROR_SYNDROME2 0x005C
  48. #define QCOM_ICE_REGS_STREAM1_BIST_ERROR_VEC 0x0060
  49. #define QCOM_ICE_REGS_STREAM2_BIST_ERROR_VEC 0x0064
  50. #define QCOM_ICE_REGS_STREAM1_BIST_FINISH_VEC 0x0068
  51. #define QCOM_ICE_REGS_STREAM2_BIST_FINISH_VEC 0x006C
  52. #define QCOM_ICE_REGS_BIST_STATUS 0x0070
  53. #define QCOM_ICE_REGS_BYPASS_STATUS 0x0074
  54. #define QCOM_ICE_REGS_ADVANCED_CONTROL 0x1000
  55. #define QCOM_ICE_REGS_ENDIAN_SWAP 0x1004
  56. #define QCOM_ICE_REGS_TEST_BUS_CONTROL 0x1010
  57. #define QCOM_ICE_REGS_TEST_BUS_REG 0x1014
  58. #define QCOM_ICE_REGS_STREAM1_COUNTERS1 0x1100
  59. #define QCOM_ICE_REGS_STREAM1_COUNTERS2 0x1104
  60. #define QCOM_ICE_REGS_STREAM1_COUNTERS3 0x1108
  61. #define QCOM_ICE_REGS_STREAM1_COUNTERS4 0x110C
  62. #define QCOM_ICE_REGS_STREAM1_COUNTERS5_MSB 0x1110
  63. #define QCOM_ICE_REGS_STREAM1_COUNTERS5_LSB 0x1114
  64. #define QCOM_ICE_REGS_STREAM1_COUNTERS6_MSB 0x1118
  65. #define QCOM_ICE_REGS_STREAM1_COUNTERS6_LSB 0x111C
  66. #define QCOM_ICE_REGS_STREAM1_COUNTERS7_MSB 0x1120
  67. #define QCOM_ICE_REGS_STREAM1_COUNTERS7_LSB 0x1124
  68. #define QCOM_ICE_REGS_STREAM1_COUNTERS8_MSB 0x1128
  69. #define QCOM_ICE_REGS_STREAM1_COUNTERS8_LSB 0x112C
  70. #define QCOM_ICE_REGS_STREAM1_COUNTERS9_MSB 0x1130
  71. #define QCOM_ICE_REGS_STREAM1_COUNTERS9_LSB 0x1134
  72. #define QCOM_ICE_REGS_STREAM2_COUNTERS1 0x1200
  73. #define QCOM_ICE_REGS_STREAM2_COUNTERS2 0x1204
  74. #define QCOM_ICE_REGS_STREAM2_COUNTERS3 0x1208
  75. #define QCOM_ICE_REGS_STREAM2_COUNTERS4 0x120C
  76. #define QCOM_ICE_REGS_STREAM2_COUNTERS5_MSB 0x1210
  77. #define QCOM_ICE_REGS_STREAM2_COUNTERS5_LSB 0x1214
  78. #define QCOM_ICE_REGS_STREAM2_COUNTERS6_MSB 0x1218
  79. #define QCOM_ICE_REGS_STREAM2_COUNTERS6_LSB 0x121C
  80. #define QCOM_ICE_REGS_STREAM2_COUNTERS7_MSB 0x1220
  81. #define QCOM_ICE_REGS_STREAM2_COUNTERS7_LSB 0x1224
  82. #define QCOM_ICE_REGS_STREAM2_COUNTERS8_MSB 0x1228
  83. #define QCOM_ICE_REGS_STREAM2_COUNTERS8_LSB 0x122C
  84. #define QCOM_ICE_REGS_STREAM2_COUNTERS9_MSB 0x1230
  85. #define QCOM_ICE_REGS_STREAM2_COUNTERS9_LSB 0x1234
  86. #define QCOM_ICE_STREAM1_PREMATURE_LBA_CHANGE (1L << 0)
  87. #define QCOM_ICE_STREAM2_PREMATURE_LBA_CHANGE (1L << 1)
  88. #define QCOM_ICE_STREAM1_NOT_EXPECTED_LBO (1L << 2)
  89. #define QCOM_ICE_STREAM2_NOT_EXPECTED_LBO (1L << 3)
  90. #define QCOM_ICE_STREAM1_NOT_EXPECTED_DUN (1L << 4)
  91. #define QCOM_ICE_STREAM2_NOT_EXPECTED_DUN (1L << 5)
  92. #define QCOM_ICE_STREAM1_NOT_EXPECTED_DUS (1L << 6)
  93. #define QCOM_ICE_STREAM2_NOT_EXPECTED_DUS (1L << 7)
  94. #define QCOM_ICE_STREAM1_NOT_EXPECTED_DBO (1L << 8)
  95. #define QCOM_ICE_STREAM2_NOT_EXPECTED_DBO (1L << 9)
  96. #define QCOM_ICE_STREAM1_NOT_EXPECTED_ENC_SEL (1L << 10)
  97. #define QCOM_ICE_STREAM2_NOT_EXPECTED_ENC_SEL (1L << 11)
  98. #define QCOM_ICE_STREAM1_NOT_EXPECTED_CONF_IDX (1L << 12)
  99. #define QCOM_ICE_STREAM2_NOT_EXPECTED_CONF_IDX (1L << 13)
  100. #define QCOM_ICE_STREAM1_NOT_EXPECTED_NEW_TRNS (1L << 14)
  101. #define QCOM_ICE_STREAM2_NOT_EXPECTED_NEW_TRNS (1L << 15)
  102. #define QCOM_ICE_NON_SEC_IRQ_MASK \
  103. (QCOM_ICE_STREAM1_PREMATURE_LBA_CHANGE |\
  104. QCOM_ICE_STREAM2_PREMATURE_LBA_CHANGE |\
  105. QCOM_ICE_STREAM1_NOT_EXPECTED_LBO |\
  106. QCOM_ICE_STREAM2_NOT_EXPECTED_LBO |\
  107. QCOM_ICE_STREAM1_NOT_EXPECTED_DUN |\
  108. QCOM_ICE_STREAM2_NOT_EXPECTED_DUN |\
  109. QCOM_ICE_STREAM2_NOT_EXPECTED_DUN |\
  110. QCOM_ICE_STREAM2_NOT_EXPECTED_DUS |\
  111. QCOM_ICE_STREAM1_NOT_EXPECTED_DBO |\
  112. QCOM_ICE_STREAM2_NOT_EXPECTED_DBO |\
  113. QCOM_ICE_STREAM1_NOT_EXPECTED_ENC_SEL |\
  114. QCOM_ICE_STREAM2_NOT_EXPECTED_ENC_SEL |\
  115. QCOM_ICE_STREAM1_NOT_EXPECTED_CONF_IDX |\
  116. QCOM_ICE_STREAM1_NOT_EXPECTED_NEW_TRNS |\
  117. QCOM_ICE_STREAM2_NOT_EXPECTED_NEW_TRNS)
  118. /* QCOM ICE registers from secure side */
  119. #define QCOM_ICE_TEST_BUS_REG_SECURE_INTR (1L << 28)
  120. #define QCOM_ICE_TEST_BUS_REG_NON_SECURE_INTR (1L << 2)
  121. #define QCOM_ICE_LUT_KEYS_ICE_SEC_IRQ_STTS 0x2050
  122. #define QCOM_ICE_LUT_KEYS_ICE_SEC_IRQ_MASK 0x2054
  123. #define QCOM_ICE_LUT_KEYS_ICE_SEC_IRQ_CLR 0x2058
  124. #define QCOM_ICE_STREAM1_PARTIALLY_SET_KEY_USED (1L << 0)
  125. #define QCOM_ICE_STREAM2_PARTIALLY_SET_KEY_USED (1L << 1)
  126. #define QCOM_ICE_QCOMC_DBG_OPEN_EVENT (1L << 30)
  127. #define QCOM_ICE_KEYS_RAM_RESET_COMPLETED (1L << 31)
  128. #define QCOM_ICE_SEC_IRQ_MASK \
  129. (QCOM_ICE_STREAM1_PARTIALLY_SET_KEY_USED |\
  130. QCOM_ICE_STREAM2_PARTIALLY_SET_KEY_USED |\
  131. QCOM_ICE_QCOMC_DBG_OPEN_EVENT | \
  132. QCOM_ICE_KEYS_RAM_RESET_COMPLETED)
  133. #define qcom_ice_writel(ice, val, reg) \
  134. writel_relaxed((val), (ice)->mmio + (reg))
  135. #define qcom_ice_readl(ice, reg) \
  136. readl_relaxed((ice)->mmio + (reg))
  137. #endif /* _QCOM_INLINE_CRYPTO_ENGINE_REGS_H_ */