regs.h 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * CAAM hardware register-level view
  4. *
  5. * Copyright 2008-2011 Freescale Semiconductor, Inc.
  6. * Copyright 2018 NXP
  7. */
  8. #ifndef REGS_H
  9. #define REGS_H
  10. #include <linux/types.h>
  11. #include <linux/bitops.h>
  12. #include <linux/io.h>
  13. #include <linux/io-64-nonatomic-hi-lo.h>
  14. /*
  15. * Architecture-specific register access methods
  16. *
  17. * CAAM's bus-addressable registers are 64 bits internally.
  18. * They have been wired to be safely accessible on 32-bit
  19. * architectures, however. Registers were organized such
  20. * that (a) they can be contained in 32 bits, (b) if not, then they
  21. * can be treated as two 32-bit entities, or finally (c) if they
  22. * must be treated as a single 64-bit value, then this can safely
  23. * be done with two 32-bit cycles.
  24. *
  25. * For 32-bit operations on 64-bit values, CAAM follows the same
  26. * 64-bit register access conventions as it's predecessors, in that
  27. * writes are "triggered" by a write to the register at the numerically
  28. * higher address, thus, a full 64-bit write cycle requires a write
  29. * to the lower address, followed by a write to the higher address,
  30. * which will latch/execute the write cycle.
  31. *
  32. * For example, let's assume a SW reset of CAAM through the master
  33. * configuration register.
  34. * - SWRST is in bit 31 of MCFG.
  35. * - MCFG begins at base+0x0000.
  36. * - Bits 63-32 are a 32-bit word at base+0x0000 (numerically-lower)
  37. * - Bits 31-0 are a 32-bit word at base+0x0004 (numerically-higher)
  38. *
  39. * (and on Power, the convention is 0-31, 32-63, I know...)
  40. *
  41. * Assuming a 64-bit write to this MCFG to perform a software reset
  42. * would then require a write of 0 to base+0x0000, followed by a
  43. * write of 0x80000000 to base+0x0004, which would "execute" the
  44. * reset.
  45. *
  46. * Of course, since MCFG 63-32 is all zero, we could cheat and simply
  47. * write 0x8000000 to base+0x0004, and the reset would work fine.
  48. * However, since CAAM does contain some write-and-read-intended
  49. * 64-bit registers, this code defines 64-bit access methods for
  50. * the sake of internal consistency and simplicity, and so that a
  51. * clean transition to 64-bit is possible when it becomes necessary.
  52. *
  53. * There are limitations to this that the developer must recognize.
  54. * 32-bit architectures cannot enforce an atomic-64 operation,
  55. * Therefore:
  56. *
  57. * - On writes, since the HW is assumed to latch the cycle on the
  58. * write of the higher-numeric-address word, then ordered
  59. * writes work OK.
  60. *
  61. * - For reads, where a register contains a relevant value of more
  62. * that 32 bits, the hardware employs logic to latch the other
  63. * "half" of the data until read, ensuring an accurate value.
  64. * This is of particular relevance when dealing with CAAM's
  65. * performance counters.
  66. *
  67. */
  68. extern bool caam_little_end;
  69. extern bool caam_imx;
  70. extern size_t caam_ptr_sz;
  71. #define caam_to_cpu(len) \
  72. static inline u##len caam##len ## _to_cpu(u##len val) \
  73. { \
  74. if (caam_little_end) \
  75. return le##len ## _to_cpu((__force __le##len)val); \
  76. else \
  77. return be##len ## _to_cpu((__force __be##len)val); \
  78. }
  79. #define cpu_to_caam(len) \
  80. static inline u##len cpu_to_caam##len(u##len val) \
  81. { \
  82. if (caam_little_end) \
  83. return (__force u##len)cpu_to_le##len(val); \
  84. else \
  85. return (__force u##len)cpu_to_be##len(val); \
  86. }
  87. caam_to_cpu(16)
  88. caam_to_cpu(32)
  89. caam_to_cpu(64)
  90. cpu_to_caam(16)
  91. cpu_to_caam(32)
  92. cpu_to_caam(64)
  93. static inline void wr_reg32(void __iomem *reg, u32 data)
  94. {
  95. if (caam_little_end)
  96. iowrite32(data, reg);
  97. else
  98. iowrite32be(data, reg);
  99. }
  100. static inline u32 rd_reg32(void __iomem *reg)
  101. {
  102. if (caam_little_end)
  103. return ioread32(reg);
  104. return ioread32be(reg);
  105. }
  106. static inline void clrsetbits_32(void __iomem *reg, u32 clear, u32 set)
  107. {
  108. if (caam_little_end)
  109. iowrite32((ioread32(reg) & ~clear) | set, reg);
  110. else
  111. iowrite32be((ioread32be(reg) & ~clear) | set, reg);
  112. }
  113. /*
  114. * The only users of these wr/rd_reg64 functions is the Job Ring (JR).
  115. * The DMA address registers in the JR are handled differently depending on
  116. * platform:
  117. *
  118. * 1. All BE CAAM platforms and i.MX platforms (LE CAAM):
  119. *
  120. * base + 0x0000 : most-significant 32 bits
  121. * base + 0x0004 : least-significant 32 bits
  122. *
  123. * The 32-bit version of this core therefore has to write to base + 0x0004
  124. * to set the 32-bit wide DMA address.
  125. *
  126. * 2. All other LE CAAM platforms (LS1021A etc.)
  127. * base + 0x0000 : least-significant 32 bits
  128. * base + 0x0004 : most-significant 32 bits
  129. */
  130. static inline void wr_reg64(void __iomem *reg, u64 data)
  131. {
  132. if (caam_little_end) {
  133. if (caam_imx) {
  134. iowrite32(data >> 32, (u32 __iomem *)(reg));
  135. iowrite32(data, (u32 __iomem *)(reg) + 1);
  136. } else {
  137. iowrite64(data, reg);
  138. }
  139. } else {
  140. iowrite64be(data, reg);
  141. }
  142. }
  143. static inline u64 rd_reg64(void __iomem *reg)
  144. {
  145. if (caam_little_end) {
  146. if (caam_imx) {
  147. u32 low, high;
  148. high = ioread32(reg);
  149. low = ioread32(reg + sizeof(u32));
  150. return low + ((u64)high << 32);
  151. } else {
  152. return ioread64(reg);
  153. }
  154. } else {
  155. return ioread64be(reg);
  156. }
  157. }
  158. static inline u64 cpu_to_caam_dma64(dma_addr_t value)
  159. {
  160. if (caam_imx) {
  161. u64 ret_val = (u64)cpu_to_caam32(lower_32_bits(value)) << 32;
  162. if (IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT))
  163. ret_val |= (u64)cpu_to_caam32(upper_32_bits(value));
  164. return ret_val;
  165. }
  166. return cpu_to_caam64(value);
  167. }
  168. static inline u64 caam_dma64_to_cpu(u64 value)
  169. {
  170. if (caam_imx)
  171. return (((u64)caam32_to_cpu(lower_32_bits(value)) << 32) |
  172. (u64)caam32_to_cpu(upper_32_bits(value)));
  173. return caam64_to_cpu(value);
  174. }
  175. static inline u64 cpu_to_caam_dma(u64 value)
  176. {
  177. if (IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT) &&
  178. caam_ptr_sz == sizeof(u64))
  179. return cpu_to_caam_dma64(value);
  180. else
  181. return cpu_to_caam32(value);
  182. }
  183. static inline u64 caam_dma_to_cpu(u64 value)
  184. {
  185. if (IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT) &&
  186. caam_ptr_sz == sizeof(u64))
  187. return caam_dma64_to_cpu(value);
  188. else
  189. return caam32_to_cpu(value);
  190. }
  191. /*
  192. * jr_outentry
  193. * Represents each entry in a JobR output ring
  194. */
  195. static inline void jr_outentry_get(void *outring, int hw_idx, dma_addr_t *desc,
  196. u32 *jrstatus)
  197. {
  198. if (caam_ptr_sz == sizeof(u32)) {
  199. struct {
  200. u32 desc;
  201. u32 jrstatus;
  202. } __packed *outentry = outring;
  203. *desc = outentry[hw_idx].desc;
  204. *jrstatus = outentry[hw_idx].jrstatus;
  205. } else {
  206. struct {
  207. dma_addr_t desc;/* Pointer to completed descriptor */
  208. u32 jrstatus; /* Status for completed descriptor */
  209. } __packed *outentry = outring;
  210. *desc = outentry[hw_idx].desc;
  211. *jrstatus = outentry[hw_idx].jrstatus;
  212. }
  213. }
  214. #define SIZEOF_JR_OUTENTRY (caam_ptr_sz + sizeof(u32))
  215. static inline dma_addr_t jr_outentry_desc(void *outring, int hw_idx)
  216. {
  217. dma_addr_t desc;
  218. u32 unused;
  219. jr_outentry_get(outring, hw_idx, &desc, &unused);
  220. return desc;
  221. }
  222. static inline u32 jr_outentry_jrstatus(void *outring, int hw_idx)
  223. {
  224. dma_addr_t unused;
  225. u32 jrstatus;
  226. jr_outentry_get(outring, hw_idx, &unused, &jrstatus);
  227. return jrstatus;
  228. }
  229. static inline void jr_inpentry_set(void *inpring, int hw_idx, dma_addr_t val)
  230. {
  231. if (caam_ptr_sz == sizeof(u32)) {
  232. u32 *inpentry = inpring;
  233. inpentry[hw_idx] = val;
  234. } else {
  235. dma_addr_t *inpentry = inpring;
  236. inpentry[hw_idx] = val;
  237. }
  238. }
  239. #define SIZEOF_JR_INPENTRY caam_ptr_sz
  240. /* Version registers (Era 10+) e80-eff */
  241. struct version_regs {
  242. u32 crca; /* CRCA_VERSION */
  243. u32 afha; /* AFHA_VERSION */
  244. u32 kfha; /* KFHA_VERSION */
  245. u32 pkha; /* PKHA_VERSION */
  246. u32 aesa; /* AESA_VERSION */
  247. u32 mdha; /* MDHA_VERSION */
  248. u32 desa; /* DESA_VERSION */
  249. u32 snw8a; /* SNW8A_VERSION */
  250. u32 snw9a; /* SNW9A_VERSION */
  251. u32 zuce; /* ZUCE_VERSION */
  252. u32 zuca; /* ZUCA_VERSION */
  253. u32 ccha; /* CCHA_VERSION */
  254. u32 ptha; /* PTHA_VERSION */
  255. u32 rng; /* RNG_VERSION */
  256. u32 trng; /* TRNG_VERSION */
  257. u32 aaha; /* AAHA_VERSION */
  258. u32 rsvd[10];
  259. u32 sr; /* SR_VERSION */
  260. u32 dma; /* DMA_VERSION */
  261. u32 ai; /* AI_VERSION */
  262. u32 qi; /* QI_VERSION */
  263. u32 jr; /* JR_VERSION */
  264. u32 deco; /* DECO_VERSION */
  265. };
  266. /* Version registers bitfields */
  267. /* Number of CHAs instantiated */
  268. #define CHA_VER_NUM_MASK 0xffull
  269. /* CHA Miscellaneous Information */
  270. #define CHA_VER_MISC_SHIFT 8
  271. #define CHA_VER_MISC_MASK (0xffull << CHA_VER_MISC_SHIFT)
  272. /* CHA Revision Number */
  273. #define CHA_VER_REV_SHIFT 16
  274. #define CHA_VER_REV_MASK (0xffull << CHA_VER_REV_SHIFT)
  275. /* CHA Version ID */
  276. #define CHA_VER_VID_SHIFT 24
  277. #define CHA_VER_VID_MASK (0xffull << CHA_VER_VID_SHIFT)
  278. /* CHA Miscellaneous Information - AESA_MISC specific */
  279. #define CHA_VER_MISC_AES_NUM_MASK GENMASK(7, 0)
  280. #define CHA_VER_MISC_AES_GCM BIT(1 + CHA_VER_MISC_SHIFT)
  281. /* CHA Miscellaneous Information - PKHA_MISC specific */
  282. #define CHA_VER_MISC_PKHA_NO_CRYPT BIT(7 + CHA_VER_MISC_SHIFT)
  283. /*
  284. * caam_perfmon - Performance Monitor/Secure Memory Status/
  285. * CAAM Global Status/Component Version IDs
  286. *
  287. * Spans f00-fff wherever instantiated
  288. */
  289. /* Number of DECOs */
  290. #define CHA_NUM_MS_DECONUM_SHIFT 24
  291. #define CHA_NUM_MS_DECONUM_MASK (0xfull << CHA_NUM_MS_DECONUM_SHIFT)
  292. /*
  293. * CHA version IDs / instantiation bitfields (< Era 10)
  294. * Defined for use with the cha_id fields in perfmon, but the same shift/mask
  295. * selectors can be used to pull out the number of instantiated blocks within
  296. * cha_num fields in perfmon because the locations are the same.
  297. */
  298. #define CHA_ID_LS_AES_SHIFT 0
  299. #define CHA_ID_LS_AES_MASK (0xfull << CHA_ID_LS_AES_SHIFT)
  300. #define CHA_ID_LS_DES_SHIFT 4
  301. #define CHA_ID_LS_DES_MASK (0xfull << CHA_ID_LS_DES_SHIFT)
  302. #define CHA_ID_LS_ARC4_SHIFT 8
  303. #define CHA_ID_LS_ARC4_MASK (0xfull << CHA_ID_LS_ARC4_SHIFT)
  304. #define CHA_ID_LS_MD_SHIFT 12
  305. #define CHA_ID_LS_MD_MASK (0xfull << CHA_ID_LS_MD_SHIFT)
  306. #define CHA_ID_LS_RNG_SHIFT 16
  307. #define CHA_ID_LS_RNG_MASK (0xfull << CHA_ID_LS_RNG_SHIFT)
  308. #define CHA_ID_LS_SNW8_SHIFT 20
  309. #define CHA_ID_LS_SNW8_MASK (0xfull << CHA_ID_LS_SNW8_SHIFT)
  310. #define CHA_ID_LS_KAS_SHIFT 24
  311. #define CHA_ID_LS_KAS_MASK (0xfull << CHA_ID_LS_KAS_SHIFT)
  312. #define CHA_ID_LS_PK_SHIFT 28
  313. #define CHA_ID_LS_PK_MASK (0xfull << CHA_ID_LS_PK_SHIFT)
  314. #define CHA_ID_MS_CRC_SHIFT 0
  315. #define CHA_ID_MS_CRC_MASK (0xfull << CHA_ID_MS_CRC_SHIFT)
  316. #define CHA_ID_MS_SNW9_SHIFT 4
  317. #define CHA_ID_MS_SNW9_MASK (0xfull << CHA_ID_MS_SNW9_SHIFT)
  318. #define CHA_ID_MS_DECO_SHIFT 24
  319. #define CHA_ID_MS_DECO_MASK (0xfull << CHA_ID_MS_DECO_SHIFT)
  320. #define CHA_ID_MS_JR_SHIFT 28
  321. #define CHA_ID_MS_JR_MASK (0xfull << CHA_ID_MS_JR_SHIFT)
  322. /* Specific CHA version IDs */
  323. #define CHA_VER_VID_AES_LP 0x3ull
  324. #define CHA_VER_VID_AES_HP 0x4ull
  325. #define CHA_VER_VID_MD_LP256 0x0ull
  326. #define CHA_VER_VID_MD_LP512 0x1ull
  327. #define CHA_VER_VID_MD_HP 0x2ull
  328. struct sec_vid {
  329. u16 ip_id;
  330. u8 maj_rev;
  331. u8 min_rev;
  332. };
  333. struct caam_perfmon {
  334. /* Performance Monitor Registers f00-f9f */
  335. u64 req_dequeued; /* PC_REQ_DEQ - Dequeued Requests */
  336. u64 ob_enc_req; /* PC_OB_ENC_REQ - Outbound Encrypt Requests */
  337. u64 ib_dec_req; /* PC_IB_DEC_REQ - Inbound Decrypt Requests */
  338. u64 ob_enc_bytes; /* PC_OB_ENCRYPT - Outbound Bytes Encrypted */
  339. u64 ob_prot_bytes; /* PC_OB_PROTECT - Outbound Bytes Protected */
  340. u64 ib_dec_bytes; /* PC_IB_DECRYPT - Inbound Bytes Decrypted */
  341. u64 ib_valid_bytes; /* PC_IB_VALIDATED Inbound Bytes Validated */
  342. u64 rsvd[13];
  343. /* CAAM Hardware Instantiation Parameters fa0-fbf */
  344. u32 cha_rev_ms; /* CRNR - CHA Rev No. Most significant half*/
  345. u32 cha_rev_ls; /* CRNR - CHA Rev No. Least significant half*/
  346. #define CTPR_MS_QI_SHIFT 25
  347. #define CTPR_MS_QI_MASK (0x1ull << CTPR_MS_QI_SHIFT)
  348. #define CTPR_MS_PS BIT(17)
  349. #define CTPR_MS_DPAA2 BIT(13)
  350. #define CTPR_MS_VIRT_EN_INCL 0x00000001
  351. #define CTPR_MS_VIRT_EN_POR 0x00000002
  352. #define CTPR_MS_PG_SZ_MASK 0x10
  353. #define CTPR_MS_PG_SZ_SHIFT 4
  354. u32 comp_parms_ms; /* CTPR - Compile Parameters Register */
  355. #define CTPR_LS_BLOB BIT(1)
  356. u32 comp_parms_ls; /* CTPR - Compile Parameters Register */
  357. u64 rsvd1[2];
  358. /* CAAM Global Status fc0-fdf */
  359. u64 faultaddr; /* FAR - Fault Address */
  360. u32 faultliodn; /* FALR - Fault Address LIODN */
  361. u32 faultdetail; /* FADR - Fault Addr Detail */
  362. u32 rsvd2;
  363. #define CSTA_PLEND BIT(10)
  364. #define CSTA_ALT_PLEND BIT(18)
  365. u32 status; /* CSTA - CAAM Status */
  366. u64 rsvd3;
  367. /* Component Instantiation Parameters fe0-fff */
  368. u32 rtic_id; /* RVID - RTIC Version ID */
  369. #define CCBVID_ERA_MASK 0xff000000
  370. #define CCBVID_ERA_SHIFT 24
  371. u32 ccb_id; /* CCBVID - CCB Version ID */
  372. u32 cha_id_ms; /* CHAVID - CHA Version ID Most Significant*/
  373. u32 cha_id_ls; /* CHAVID - CHA Version ID Least Significant*/
  374. u32 cha_num_ms; /* CHANUM - CHA Number Most Significant */
  375. u32 cha_num_ls; /* CHANUM - CHA Number Least Significant*/
  376. #define SECVID_MS_IPID_MASK 0xffff0000
  377. #define SECVID_MS_IPID_SHIFT 16
  378. #define SECVID_MS_MAJ_REV_MASK 0x0000ff00
  379. #define SECVID_MS_MAJ_REV_SHIFT 8
  380. u32 caam_id_ms; /* CAAMVID - CAAM Version ID MS */
  381. u32 caam_id_ls; /* CAAMVID - CAAM Version ID LS */
  382. };
  383. /* LIODN programming for DMA configuration */
  384. #define MSTRID_LOCK_LIODN 0x80000000
  385. #define MSTRID_LOCK_MAKETRUSTED 0x00010000 /* only for JR masterid */
  386. #define MSTRID_LIODN_MASK 0x0fff
  387. struct masterid {
  388. u32 liodn_ms; /* lock and make-trusted control bits */
  389. u32 liodn_ls; /* LIODN for non-sequence and seq access */
  390. };
  391. /* Partition ID for DMA configuration */
  392. struct partid {
  393. u32 rsvd1;
  394. u32 pidr; /* partition ID, DECO */
  395. };
  396. /* RNGB test mode (replicated twice in some configurations) */
  397. /* Padded out to 0x100 */
  398. struct rngtst {
  399. u32 mode; /* RTSTMODEx - Test mode */
  400. u32 rsvd1[3];
  401. u32 reset; /* RTSTRESETx - Test reset control */
  402. u32 rsvd2[3];
  403. u32 status; /* RTSTSSTATUSx - Test status */
  404. u32 rsvd3;
  405. u32 errstat; /* RTSTERRSTATx - Test error status */
  406. u32 rsvd4;
  407. u32 errctl; /* RTSTERRCTLx - Test error control */
  408. u32 rsvd5;
  409. u32 entropy; /* RTSTENTROPYx - Test entropy */
  410. u32 rsvd6[15];
  411. u32 verifctl; /* RTSTVERIFCTLx - Test verification control */
  412. u32 rsvd7;
  413. u32 verifstat; /* RTSTVERIFSTATx - Test verification status */
  414. u32 rsvd8;
  415. u32 verifdata; /* RTSTVERIFDx - Test verification data */
  416. u32 rsvd9;
  417. u32 xkey; /* RTSTXKEYx - Test XKEY */
  418. u32 rsvd10;
  419. u32 oscctctl; /* RTSTOSCCTCTLx - Test osc. counter control */
  420. u32 rsvd11;
  421. u32 oscct; /* RTSTOSCCTx - Test oscillator counter */
  422. u32 rsvd12;
  423. u32 oscctstat; /* RTSTODCCTSTATx - Test osc counter status */
  424. u32 rsvd13[2];
  425. u32 ofifo[4]; /* RTSTOFIFOx - Test output FIFO */
  426. u32 rsvd14[15];
  427. };
  428. /* RNG4 TRNG test registers */
  429. struct rng4tst {
  430. #define RTMCTL_ACC BIT(5) /* TRNG access mode */
  431. #define RTMCTL_PRGM BIT(16) /* 1 -> program mode, 0 -> run mode */
  432. #define RTMCTL_SAMP_MODE_VON_NEUMANN_ES_SC 0 /* use von Neumann data in
  433. both entropy shifter and
  434. statistical checker */
  435. #define RTMCTL_SAMP_MODE_RAW_ES_SC 1 /* use raw data in both
  436. entropy shifter and
  437. statistical checker */
  438. #define RTMCTL_SAMP_MODE_VON_NEUMANN_ES_RAW_SC 2 /* use von Neumann data in
  439. entropy shifter, raw data
  440. in statistical checker */
  441. #define RTMCTL_SAMP_MODE_INVALID 3 /* invalid combination */
  442. u32 rtmctl; /* misc. control register */
  443. u32 rtscmisc; /* statistical check misc. register */
  444. u32 rtpkrrng; /* poker range register */
  445. union {
  446. u32 rtpkrmax; /* PRGM=1: poker max. limit register */
  447. u32 rtpkrsq; /* PRGM=0: poker square calc. result register */
  448. };
  449. #define RTSDCTL_ENT_DLY_SHIFT 16
  450. #define RTSDCTL_ENT_DLY_MASK (0xffff << RTSDCTL_ENT_DLY_SHIFT)
  451. #define RTSDCTL_ENT_DLY_MIN 3200
  452. #define RTSDCTL_ENT_DLY_MAX 12800
  453. u32 rtsdctl; /* seed control register */
  454. union {
  455. u32 rtsblim; /* PRGM=1: sparse bit limit register */
  456. u32 rttotsam; /* PRGM=0: total samples register */
  457. };
  458. u32 rtfrqmin; /* frequency count min. limit register */
  459. #define RTFRQMAX_DISABLE (1 << 20)
  460. union {
  461. u32 rtfrqmax; /* PRGM=1: freq. count max. limit register */
  462. u32 rtfrqcnt; /* PRGM=0: freq. count register */
  463. };
  464. u32 rsvd1[40];
  465. #define RDSTA_SKVT 0x80000000
  466. #define RDSTA_SKVN 0x40000000
  467. #define RDSTA_PR0 BIT(4)
  468. #define RDSTA_PR1 BIT(5)
  469. #define RDSTA_IF0 0x00000001
  470. #define RDSTA_IF1 0x00000002
  471. #define RDSTA_MASK (RDSTA_PR1 | RDSTA_PR0 | RDSTA_IF1 | RDSTA_IF0)
  472. u32 rdsta;
  473. u32 rsvd2[15];
  474. };
  475. /*
  476. * caam_ctrl - basic core configuration
  477. * starts base + 0x0000 padded out to 0x1000
  478. */
  479. #define KEK_KEY_SIZE 8
  480. #define TKEK_KEY_SIZE 8
  481. #define TDSK_KEY_SIZE 8
  482. #define DECO_RESET 1 /* Use with DECO reset/availability regs */
  483. #define DECO_RESET_0 (DECO_RESET << 0)
  484. #define DECO_RESET_1 (DECO_RESET << 1)
  485. #define DECO_RESET_2 (DECO_RESET << 2)
  486. #define DECO_RESET_3 (DECO_RESET << 3)
  487. #define DECO_RESET_4 (DECO_RESET << 4)
  488. struct caam_ctrl {
  489. /* Basic Configuration Section 000-01f */
  490. /* Read/Writable */
  491. u32 rsvd1;
  492. u32 mcr; /* MCFG Master Config Register */
  493. u32 rsvd2;
  494. u32 scfgr; /* SCFGR, Security Config Register */
  495. /* Bus Access Configuration Section 010-11f */
  496. /* Read/Writable */
  497. struct masterid jr_mid[4]; /* JRxLIODNR - JobR LIODN setup */
  498. u32 rsvd3[11];
  499. u32 jrstart; /* JRSTART - Job Ring Start Register */
  500. struct masterid rtic_mid[4]; /* RTICxLIODNR - RTIC LIODN setup */
  501. u32 rsvd4[5];
  502. u32 deco_rsr; /* DECORSR - Deco Request Source */
  503. u32 rsvd11;
  504. u32 deco_rq; /* DECORR - DECO Request */
  505. struct partid deco_mid[5]; /* DECOxLIODNR - 1 per DECO */
  506. u32 rsvd5[22];
  507. /* DECO Availability/Reset Section 120-3ff */
  508. u32 deco_avail; /* DAR - DECO availability */
  509. u32 deco_reset; /* DRR - DECO reset */
  510. u32 rsvd6[182];
  511. /* Key Encryption/Decryption Configuration 400-5ff */
  512. /* Read/Writable only while in Non-secure mode */
  513. u32 kek[KEK_KEY_SIZE]; /* JDKEKR - Key Encryption Key */
  514. u32 tkek[TKEK_KEY_SIZE]; /* TDKEKR - Trusted Desc KEK */
  515. u32 tdsk[TDSK_KEY_SIZE]; /* TDSKR - Trusted Desc Signing Key */
  516. u32 rsvd7[32];
  517. u64 sknonce; /* SKNR - Secure Key Nonce */
  518. u32 rsvd8[70];
  519. /* RNG Test/Verification/Debug Access 600-7ff */
  520. /* (Useful in Test/Debug modes only...) */
  521. union {
  522. struct rngtst rtst[2];
  523. struct rng4tst r4tst[2];
  524. };
  525. u32 rsvd9[416];
  526. /* Version registers - introduced with era 10 e80-eff */
  527. struct version_regs vreg;
  528. /* Performance Monitor f00-fff */
  529. struct caam_perfmon perfmon;
  530. };
  531. /*
  532. * Controller master config register defs
  533. */
  534. #define MCFGR_SWRESET 0x80000000 /* software reset */
  535. #define MCFGR_WDENABLE 0x40000000 /* DECO watchdog enable */
  536. #define MCFGR_WDFAIL 0x20000000 /* DECO watchdog force-fail */
  537. #define MCFGR_DMA_RESET 0x10000000
  538. #define MCFGR_LONG_PTR 0x00010000 /* Use >32-bit desc addressing */
  539. #define SCFGR_RDBENABLE 0x00000400
  540. #define SCFGR_VIRT_EN 0x00008000
  541. #define DECORR_RQD0ENABLE 0x00000001 /* Enable DECO0 for direct access */
  542. #define DECORSR_JR0 0x00000001 /* JR to supply TZ, SDID, ICID */
  543. #define DECORSR_VALID 0x80000000
  544. #define DECORR_DEN0 0x00010000 /* DECO0 available for access*/
  545. /* AXI read cache control */
  546. #define MCFGR_ARCACHE_SHIFT 12
  547. #define MCFGR_ARCACHE_MASK (0xf << MCFGR_ARCACHE_SHIFT)
  548. #define MCFGR_ARCACHE_BUFF (0x1 << MCFGR_ARCACHE_SHIFT)
  549. #define MCFGR_ARCACHE_CACH (0x2 << MCFGR_ARCACHE_SHIFT)
  550. #define MCFGR_ARCACHE_RALL (0x4 << MCFGR_ARCACHE_SHIFT)
  551. /* AXI write cache control */
  552. #define MCFGR_AWCACHE_SHIFT 8
  553. #define MCFGR_AWCACHE_MASK (0xf << MCFGR_AWCACHE_SHIFT)
  554. #define MCFGR_AWCACHE_BUFF (0x1 << MCFGR_AWCACHE_SHIFT)
  555. #define MCFGR_AWCACHE_CACH (0x2 << MCFGR_AWCACHE_SHIFT)
  556. #define MCFGR_AWCACHE_WALL (0x8 << MCFGR_AWCACHE_SHIFT)
  557. /* AXI pipeline depth */
  558. #define MCFGR_AXIPIPE_SHIFT 4
  559. #define MCFGR_AXIPIPE_MASK (0xf << MCFGR_AXIPIPE_SHIFT)
  560. #define MCFGR_AXIPRI 0x00000008 /* Assert AXI priority sideband */
  561. #define MCFGR_LARGE_BURST 0x00000004 /* 128/256-byte burst size */
  562. #define MCFGR_BURST_64 0x00000001 /* 64-byte burst size */
  563. /* JRSTART register offsets */
  564. #define JRSTART_JR0_START 0x00000001 /* Start Job ring 0 */
  565. #define JRSTART_JR1_START 0x00000002 /* Start Job ring 1 */
  566. #define JRSTART_JR2_START 0x00000004 /* Start Job ring 2 */
  567. #define JRSTART_JR3_START 0x00000008 /* Start Job ring 3 */
  568. /*
  569. * caam_job_ring - direct job ring setup
  570. * 1-4 possible per instantiation, base + 1000/2000/3000/4000
  571. * Padded out to 0x1000
  572. */
  573. struct caam_job_ring {
  574. /* Input ring */
  575. u64 inpring_base; /* IRBAx - Input desc ring baseaddr */
  576. u32 rsvd1;
  577. u32 inpring_size; /* IRSx - Input ring size */
  578. u32 rsvd2;
  579. u32 inpring_avail; /* IRSAx - Input ring room remaining */
  580. u32 rsvd3;
  581. u32 inpring_jobadd; /* IRJAx - Input ring jobs added */
  582. /* Output Ring */
  583. u64 outring_base; /* ORBAx - Output status ring base addr */
  584. u32 rsvd4;
  585. u32 outring_size; /* ORSx - Output ring size */
  586. u32 rsvd5;
  587. u32 outring_rmvd; /* ORJRx - Output ring jobs removed */
  588. u32 rsvd6;
  589. u32 outring_used; /* ORSFx - Output ring slots full */
  590. /* Status/Configuration */
  591. u32 rsvd7;
  592. u32 jroutstatus; /* JRSTAx - JobR output status */
  593. u32 rsvd8;
  594. u32 jrintstatus; /* JRINTx - JobR interrupt status */
  595. u32 rconfig_hi; /* JRxCFG - Ring configuration */
  596. u32 rconfig_lo;
  597. /* Indices. CAAM maintains as "heads" of each queue */
  598. u32 rsvd9;
  599. u32 inp_rdidx; /* IRRIx - Input ring read index */
  600. u32 rsvd10;
  601. u32 out_wtidx; /* ORWIx - Output ring write index */
  602. /* Command/control */
  603. u32 rsvd11;
  604. u32 jrcommand; /* JRCRx - JobR command */
  605. u32 rsvd12[900];
  606. /* Version registers - introduced with era 10 e80-eff */
  607. struct version_regs vreg;
  608. /* Performance Monitor f00-fff */
  609. struct caam_perfmon perfmon;
  610. };
  611. #define JR_RINGSIZE_MASK 0x03ff
  612. /*
  613. * jrstatus - Job Ring Output Status
  614. * All values in lo word
  615. * Also note, same values written out as status through QI
  616. * in the command/status field of a frame descriptor
  617. */
  618. #define JRSTA_SSRC_SHIFT 28
  619. #define JRSTA_SSRC_MASK 0xf0000000
  620. #define JRSTA_SSRC_NONE 0x00000000
  621. #define JRSTA_SSRC_CCB_ERROR 0x20000000
  622. #define JRSTA_SSRC_JUMP_HALT_USER 0x30000000
  623. #define JRSTA_SSRC_DECO 0x40000000
  624. #define JRSTA_SSRC_QI 0x50000000
  625. #define JRSTA_SSRC_JRERROR 0x60000000
  626. #define JRSTA_SSRC_JUMP_HALT_CC 0x70000000
  627. #define JRSTA_DECOERR_JUMP 0x08000000
  628. #define JRSTA_DECOERR_INDEX_SHIFT 8
  629. #define JRSTA_DECOERR_INDEX_MASK 0xff00
  630. #define JRSTA_DECOERR_ERROR_MASK 0x00ff
  631. #define JRSTA_DECOERR_NONE 0x00
  632. #define JRSTA_DECOERR_LINKLEN 0x01
  633. #define JRSTA_DECOERR_LINKPTR 0x02
  634. #define JRSTA_DECOERR_JRCTRL 0x03
  635. #define JRSTA_DECOERR_DESCCMD 0x04
  636. #define JRSTA_DECOERR_ORDER 0x05
  637. #define JRSTA_DECOERR_KEYCMD 0x06
  638. #define JRSTA_DECOERR_LOADCMD 0x07
  639. #define JRSTA_DECOERR_STORECMD 0x08
  640. #define JRSTA_DECOERR_OPCMD 0x09
  641. #define JRSTA_DECOERR_FIFOLDCMD 0x0a
  642. #define JRSTA_DECOERR_FIFOSTCMD 0x0b
  643. #define JRSTA_DECOERR_MOVECMD 0x0c
  644. #define JRSTA_DECOERR_JUMPCMD 0x0d
  645. #define JRSTA_DECOERR_MATHCMD 0x0e
  646. #define JRSTA_DECOERR_SHASHCMD 0x0f
  647. #define JRSTA_DECOERR_SEQCMD 0x10
  648. #define JRSTA_DECOERR_DECOINTERNAL 0x11
  649. #define JRSTA_DECOERR_SHDESCHDR 0x12
  650. #define JRSTA_DECOERR_HDRLEN 0x13
  651. #define JRSTA_DECOERR_BURSTER 0x14
  652. #define JRSTA_DECOERR_DESCSIGNATURE 0x15
  653. #define JRSTA_DECOERR_DMA 0x16
  654. #define JRSTA_DECOERR_BURSTFIFO 0x17
  655. #define JRSTA_DECOERR_JRRESET 0x1a
  656. #define JRSTA_DECOERR_JOBFAIL 0x1b
  657. #define JRSTA_DECOERR_DNRERR 0x80
  658. #define JRSTA_DECOERR_UNDEFPCL 0x81
  659. #define JRSTA_DECOERR_PDBERR 0x82
  660. #define JRSTA_DECOERR_ANRPLY_LATE 0x83
  661. #define JRSTA_DECOERR_ANRPLY_REPLAY 0x84
  662. #define JRSTA_DECOERR_SEQOVF 0x85
  663. #define JRSTA_DECOERR_INVSIGN 0x86
  664. #define JRSTA_DECOERR_DSASIGN 0x87
  665. #define JRSTA_QIERR_ERROR_MASK 0x00ff
  666. #define JRSTA_CCBERR_JUMP 0x08000000
  667. #define JRSTA_CCBERR_INDEX_MASK 0xff00
  668. #define JRSTA_CCBERR_INDEX_SHIFT 8
  669. #define JRSTA_CCBERR_CHAID_MASK 0x00f0
  670. #define JRSTA_CCBERR_CHAID_SHIFT 4
  671. #define JRSTA_CCBERR_ERRID_MASK 0x000f
  672. #define JRSTA_CCBERR_CHAID_AES (0x01 << JRSTA_CCBERR_CHAID_SHIFT)
  673. #define JRSTA_CCBERR_CHAID_DES (0x02 << JRSTA_CCBERR_CHAID_SHIFT)
  674. #define JRSTA_CCBERR_CHAID_ARC4 (0x03 << JRSTA_CCBERR_CHAID_SHIFT)
  675. #define JRSTA_CCBERR_CHAID_MD (0x04 << JRSTA_CCBERR_CHAID_SHIFT)
  676. #define JRSTA_CCBERR_CHAID_RNG (0x05 << JRSTA_CCBERR_CHAID_SHIFT)
  677. #define JRSTA_CCBERR_CHAID_SNOW (0x06 << JRSTA_CCBERR_CHAID_SHIFT)
  678. #define JRSTA_CCBERR_CHAID_KASUMI (0x07 << JRSTA_CCBERR_CHAID_SHIFT)
  679. #define JRSTA_CCBERR_CHAID_PK (0x08 << JRSTA_CCBERR_CHAID_SHIFT)
  680. #define JRSTA_CCBERR_CHAID_CRC (0x09 << JRSTA_CCBERR_CHAID_SHIFT)
  681. #define JRSTA_CCBERR_ERRID_NONE 0x00
  682. #define JRSTA_CCBERR_ERRID_MODE 0x01
  683. #define JRSTA_CCBERR_ERRID_DATASIZ 0x02
  684. #define JRSTA_CCBERR_ERRID_KEYSIZ 0x03
  685. #define JRSTA_CCBERR_ERRID_PKAMEMSZ 0x04
  686. #define JRSTA_CCBERR_ERRID_PKBMEMSZ 0x05
  687. #define JRSTA_CCBERR_ERRID_SEQUENCE 0x06
  688. #define JRSTA_CCBERR_ERRID_PKDIVZRO 0x07
  689. #define JRSTA_CCBERR_ERRID_PKMODEVN 0x08
  690. #define JRSTA_CCBERR_ERRID_KEYPARIT 0x09
  691. #define JRSTA_CCBERR_ERRID_ICVCHK 0x0a
  692. #define JRSTA_CCBERR_ERRID_HARDWARE 0x0b
  693. #define JRSTA_CCBERR_ERRID_CCMAAD 0x0c
  694. #define JRSTA_CCBERR_ERRID_INVCHA 0x0f
  695. #define JRINT_ERR_INDEX_MASK 0x3fff0000
  696. #define JRINT_ERR_INDEX_SHIFT 16
  697. #define JRINT_ERR_TYPE_MASK 0xf00
  698. #define JRINT_ERR_TYPE_SHIFT 8
  699. #define JRINT_ERR_HALT_MASK 0xc
  700. #define JRINT_ERR_HALT_SHIFT 2
  701. #define JRINT_ERR_HALT_INPROGRESS 0x4
  702. #define JRINT_ERR_HALT_COMPLETE 0x8
  703. #define JRINT_JR_ERROR 0x02
  704. #define JRINT_JR_INT 0x01
  705. #define JRINT_ERR_TYPE_WRITE 1
  706. #define JRINT_ERR_TYPE_BAD_INPADDR 3
  707. #define JRINT_ERR_TYPE_BAD_OUTADDR 4
  708. #define JRINT_ERR_TYPE_INV_INPWRT 5
  709. #define JRINT_ERR_TYPE_INV_OUTWRT 6
  710. #define JRINT_ERR_TYPE_RESET 7
  711. #define JRINT_ERR_TYPE_REMOVE_OFL 8
  712. #define JRINT_ERR_TYPE_ADD_OFL 9
  713. #define JRCFG_SOE 0x04
  714. #define JRCFG_ICEN 0x02
  715. #define JRCFG_IMSK 0x01
  716. #define JRCFG_ICDCT_SHIFT 8
  717. #define JRCFG_ICTT_SHIFT 16
  718. #define JRCR_RESET 0x01
  719. /*
  720. * caam_assurance - Assurance Controller View
  721. * base + 0x6000 padded out to 0x1000
  722. */
  723. struct rtic_element {
  724. u64 address;
  725. u32 rsvd;
  726. u32 length;
  727. };
  728. struct rtic_block {
  729. struct rtic_element element[2];
  730. };
  731. struct rtic_memhash {
  732. u32 memhash_be[32];
  733. u32 memhash_le[32];
  734. };
  735. struct caam_assurance {
  736. /* Status/Command/Watchdog */
  737. u32 rsvd1;
  738. u32 status; /* RSTA - Status */
  739. u32 rsvd2;
  740. u32 cmd; /* RCMD - Command */
  741. u32 rsvd3;
  742. u32 ctrl; /* RCTL - Control */
  743. u32 rsvd4;
  744. u32 throttle; /* RTHR - Throttle */
  745. u32 rsvd5[2];
  746. u64 watchdog; /* RWDOG - Watchdog Timer */
  747. u32 rsvd6;
  748. u32 rend; /* REND - Endian corrections */
  749. u32 rsvd7[50];
  750. /* Block access/configuration @ 100/110/120/130 */
  751. struct rtic_block memblk[4]; /* Memory Blocks A-D */
  752. u32 rsvd8[32];
  753. /* Block hashes @ 200/300/400/500 */
  754. struct rtic_memhash hash[4]; /* Block hash values A-D */
  755. u32 rsvd_3[640];
  756. };
  757. /*
  758. * caam_queue_if - QI configuration and control
  759. * starts base + 0x7000, padded out to 0x1000 long
  760. */
  761. struct caam_queue_if {
  762. u32 qi_control_hi; /* QICTL - QI Control */
  763. u32 qi_control_lo;
  764. u32 rsvd1;
  765. u32 qi_status; /* QISTA - QI Status */
  766. u32 qi_deq_cfg_hi; /* QIDQC - QI Dequeue Configuration */
  767. u32 qi_deq_cfg_lo;
  768. u32 qi_enq_cfg_hi; /* QISEQC - QI Enqueue Command */
  769. u32 qi_enq_cfg_lo;
  770. u32 rsvd2[1016];
  771. };
  772. /* QI control bits - low word */
  773. #define QICTL_DQEN 0x01 /* Enable frame pop */
  774. #define QICTL_STOP 0x02 /* Stop dequeue/enqueue */
  775. #define QICTL_SOE 0x04 /* Stop on error */
  776. /* QI control bits - high word */
  777. #define QICTL_MBSI 0x01
  778. #define QICTL_MHWSI 0x02
  779. #define QICTL_MWSI 0x04
  780. #define QICTL_MDWSI 0x08
  781. #define QICTL_CBSI 0x10 /* CtrlDataByteSwapInput */
  782. #define QICTL_CHWSI 0x20 /* CtrlDataHalfSwapInput */
  783. #define QICTL_CWSI 0x40 /* CtrlDataWordSwapInput */
  784. #define QICTL_CDWSI 0x80 /* CtrlDataDWordSwapInput */
  785. #define QICTL_MBSO 0x0100
  786. #define QICTL_MHWSO 0x0200
  787. #define QICTL_MWSO 0x0400
  788. #define QICTL_MDWSO 0x0800
  789. #define QICTL_CBSO 0x1000 /* CtrlDataByteSwapOutput */
  790. #define QICTL_CHWSO 0x2000 /* CtrlDataHalfSwapOutput */
  791. #define QICTL_CWSO 0x4000 /* CtrlDataWordSwapOutput */
  792. #define QICTL_CDWSO 0x8000 /* CtrlDataDWordSwapOutput */
  793. #define QICTL_DMBS 0x010000
  794. #define QICTL_EPO 0x020000
  795. /* QI status bits */
  796. #define QISTA_PHRDERR 0x01 /* PreHeader Read Error */
  797. #define QISTA_CFRDERR 0x02 /* Compound Frame Read Error */
  798. #define QISTA_OFWRERR 0x04 /* Output Frame Read Error */
  799. #define QISTA_BPDERR 0x08 /* Buffer Pool Depleted */
  800. #define QISTA_BTSERR 0x10 /* Buffer Undersize */
  801. #define QISTA_CFWRERR 0x20 /* Compound Frame Write Err */
  802. #define QISTA_STOPD 0x80000000 /* QI Stopped (see QICTL) */
  803. /* deco_sg_table - DECO view of scatter/gather table */
  804. struct deco_sg_table {
  805. u64 addr; /* Segment Address */
  806. u32 elen; /* E, F bits + 30-bit length */
  807. u32 bpid_offset; /* Buffer Pool ID + 16-bit length */
  808. };
  809. /*
  810. * caam_deco - descriptor controller - CHA cluster block
  811. *
  812. * Only accessible when direct DECO access is turned on
  813. * (done in DECORR, via MID programmed in DECOxMID
  814. *
  815. * 5 typical, base + 0x8000/9000/a000/b000
  816. * Padded out to 0x1000 long
  817. */
  818. struct caam_deco {
  819. u32 rsvd1;
  820. u32 cls1_mode; /* CxC1MR - Class 1 Mode */
  821. u32 rsvd2;
  822. u32 cls1_keysize; /* CxC1KSR - Class 1 Key Size */
  823. u32 cls1_datasize_hi; /* CxC1DSR - Class 1 Data Size */
  824. u32 cls1_datasize_lo;
  825. u32 rsvd3;
  826. u32 cls1_icvsize; /* CxC1ICVSR - Class 1 ICV size */
  827. u32 rsvd4[5];
  828. u32 cha_ctrl; /* CCTLR - CHA control */
  829. u32 rsvd5;
  830. u32 irq_crtl; /* CxCIRQ - CCB interrupt done/error/clear */
  831. u32 rsvd6;
  832. u32 clr_written; /* CxCWR - Clear-Written */
  833. u32 ccb_status_hi; /* CxCSTA - CCB Status/Error */
  834. u32 ccb_status_lo;
  835. u32 rsvd7[3];
  836. u32 aad_size; /* CxAADSZR - Current AAD Size */
  837. u32 rsvd8;
  838. u32 cls1_iv_size; /* CxC1IVSZR - Current Class 1 IV Size */
  839. u32 rsvd9[7];
  840. u32 pkha_a_size; /* PKASZRx - Size of PKHA A */
  841. u32 rsvd10;
  842. u32 pkha_b_size; /* PKBSZRx - Size of PKHA B */
  843. u32 rsvd11;
  844. u32 pkha_n_size; /* PKNSZRx - Size of PKHA N */
  845. u32 rsvd12;
  846. u32 pkha_e_size; /* PKESZRx - Size of PKHA E */
  847. u32 rsvd13[24];
  848. u32 cls1_ctx[16]; /* CxC1CTXR - Class 1 Context @100 */
  849. u32 rsvd14[48];
  850. u32 cls1_key[8]; /* CxC1KEYR - Class 1 Key @200 */
  851. u32 rsvd15[121];
  852. u32 cls2_mode; /* CxC2MR - Class 2 Mode */
  853. u32 rsvd16;
  854. u32 cls2_keysize; /* CxX2KSR - Class 2 Key Size */
  855. u32 cls2_datasize_hi; /* CxC2DSR - Class 2 Data Size */
  856. u32 cls2_datasize_lo;
  857. u32 rsvd17;
  858. u32 cls2_icvsize; /* CxC2ICVSZR - Class 2 ICV Size */
  859. u32 rsvd18[56];
  860. u32 cls2_ctx[18]; /* CxC2CTXR - Class 2 Context @500 */
  861. u32 rsvd19[46];
  862. u32 cls2_key[32]; /* CxC2KEYR - Class2 Key @600 */
  863. u32 rsvd20[84];
  864. u32 inp_infofifo_hi; /* CxIFIFO - Input Info FIFO @7d0 */
  865. u32 inp_infofifo_lo;
  866. u32 rsvd21[2];
  867. u64 inp_datafifo; /* CxDFIFO - Input Data FIFO */
  868. u32 rsvd22[2];
  869. u64 out_datafifo; /* CxOFIFO - Output Data FIFO */
  870. u32 rsvd23[2];
  871. u32 jr_ctl_hi; /* CxJRR - JobR Control Register @800 */
  872. u32 jr_ctl_lo;
  873. u64 jr_descaddr; /* CxDADR - JobR Descriptor Address */
  874. #define DECO_OP_STATUS_HI_ERR_MASK 0xF00000FF
  875. u32 op_status_hi; /* DxOPSTA - DECO Operation Status */
  876. u32 op_status_lo;
  877. u32 rsvd24[2];
  878. u32 liodn; /* DxLSR - DECO LIODN Status - non-seq */
  879. u32 td_liodn; /* DxLSR - DECO LIODN Status - trustdesc */
  880. u32 rsvd26[6];
  881. u64 math[4]; /* DxMTH - Math register */
  882. u32 rsvd27[8];
  883. struct deco_sg_table gthr_tbl[4]; /* DxGTR - Gather Tables */
  884. u32 rsvd28[16];
  885. struct deco_sg_table sctr_tbl[4]; /* DxSTR - Scatter Tables */
  886. u32 rsvd29[48];
  887. u32 descbuf[64]; /* DxDESB - Descriptor buffer */
  888. u32 rscvd30[193];
  889. #define DESC_DBG_DECO_STAT_VALID 0x80000000
  890. #define DESC_DBG_DECO_STAT_MASK 0x00F00000
  891. #define DESC_DBG_DECO_STAT_SHIFT 20
  892. u32 desc_dbg; /* DxDDR - DECO Debug Register */
  893. u32 rsvd31[13];
  894. #define DESC_DER_DECO_STAT_MASK 0x000F0000
  895. #define DESC_DER_DECO_STAT_SHIFT 16
  896. u32 dbg_exec; /* DxDER - DECO Debug Exec Register */
  897. u32 rsvd32[112];
  898. };
  899. #define DECO_STAT_HOST_ERR 0xD
  900. #define DECO_JQCR_WHL 0x20000000
  901. #define DECO_JQCR_FOUR 0x10000000
  902. #define JR_BLOCK_NUMBER 1
  903. #define ASSURE_BLOCK_NUMBER 6
  904. #define QI_BLOCK_NUMBER 7
  905. #define DECO_BLOCK_NUMBER 8
  906. #define PG_SIZE_4K 0x1000
  907. #define PG_SIZE_64K 0x10000
  908. #endif /* REGS_H */