zip_regs.h 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348
  1. /***********************license start************************************
  2. * Copyright (c) 2003-2017 Cavium, Inc.
  3. * All rights reserved.
  4. *
  5. * License: one of 'Cavium License' or 'GNU General Public License Version 2'
  6. *
  7. * This file is provided under the terms of the Cavium License (see below)
  8. * or under the terms of GNU General Public License, Version 2, as
  9. * published by the Free Software Foundation. When using or redistributing
  10. * this file, you may do so under either license.
  11. *
  12. * Cavium License: Redistribution and use in source and binary forms, with
  13. * or without modification, are permitted provided that the following
  14. * conditions are met:
  15. *
  16. * * Redistributions of source code must retain the above copyright
  17. * notice, this list of conditions and the following disclaimer.
  18. *
  19. * * Redistributions in binary form must reproduce the above
  20. * copyright notice, this list of conditions and the following
  21. * disclaimer in the documentation and/or other materials provided
  22. * with the distribution.
  23. *
  24. * * Neither the name of Cavium Inc. nor the names of its contributors may be
  25. * used to endorse or promote products derived from this software without
  26. * specific prior written permission.
  27. *
  28. * This Software, including technical data, may be subject to U.S. export
  29. * control laws, including the U.S. Export Administration Act and its
  30. * associated regulations, and may be subject to export or import
  31. * regulations in other countries.
  32. *
  33. * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
  34. * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS
  35. * OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
  36. * RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
  37. * REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
  38. * DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY)
  39. * WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A
  40. * PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET
  41. * ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE
  42. * ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES
  43. * WITH YOU.
  44. ***********************license end**************************************/
  45. #ifndef __ZIP_REGS_H__
  46. #define __ZIP_REGS_H__
  47. /*
  48. * Configuration and status register (CSR) address and type definitions for
  49. * Cavium ZIP.
  50. */
  51. #include <linux/kern_levels.h>
  52. /* ZIP invocation result completion status codes */
  53. #define ZIP_CMD_NOTDONE 0x0
  54. /* Successful completion. */
  55. #define ZIP_CMD_SUCCESS 0x1
  56. /* Output truncated */
  57. #define ZIP_CMD_DTRUNC 0x2
  58. /* Dynamic Stop */
  59. #define ZIP_CMD_DYNAMIC_STOP 0x3
  60. /* Uncompress ran out of input data when IWORD0[EF] was set */
  61. #define ZIP_CMD_ITRUNC 0x4
  62. /* Uncompress found the reserved block type 3 */
  63. #define ZIP_CMD_RBLOCK 0x5
  64. /*
  65. * Uncompress found LEN != ZIP_CMD_NLEN in an uncompressed block in the input.
  66. */
  67. #define ZIP_CMD_NLEN 0x6
  68. /* Uncompress found a bad code in the main Huffman codes. */
  69. #define ZIP_CMD_BADCODE 0x7
  70. /* Uncompress found a bad code in the 19 Huffman codes encoding lengths. */
  71. #define ZIP_CMD_BADCODE2 0x8
  72. /* Compress found a zero-length input. */
  73. #define ZIP_CMD_ZERO_LEN 0x9
  74. /* The compress or decompress encountered an internal parity error. */
  75. #define ZIP_CMD_PARITY 0xA
  76. /*
  77. * Uncompress found a string identifier that precedes the uncompressed data and
  78. * decompression history.
  79. */
  80. #define ZIP_CMD_FATAL 0xB
  81. /**
  82. * enum zip_int_vec_e - ZIP MSI-X Vector Enumeration, enumerates the MSI-X
  83. * interrupt vectors.
  84. */
  85. enum zip_int_vec_e {
  86. ZIP_INT_VEC_E_ECCE = 0x10,
  87. ZIP_INT_VEC_E_FIFE = 0x11,
  88. ZIP_INT_VEC_E_QUE0_DONE = 0x0,
  89. ZIP_INT_VEC_E_QUE0_ERR = 0x8,
  90. ZIP_INT_VEC_E_QUE1_DONE = 0x1,
  91. ZIP_INT_VEC_E_QUE1_ERR = 0x9,
  92. ZIP_INT_VEC_E_QUE2_DONE = 0x2,
  93. ZIP_INT_VEC_E_QUE2_ERR = 0xa,
  94. ZIP_INT_VEC_E_QUE3_DONE = 0x3,
  95. ZIP_INT_VEC_E_QUE3_ERR = 0xb,
  96. ZIP_INT_VEC_E_QUE4_DONE = 0x4,
  97. ZIP_INT_VEC_E_QUE4_ERR = 0xc,
  98. ZIP_INT_VEC_E_QUE5_DONE = 0x5,
  99. ZIP_INT_VEC_E_QUE5_ERR = 0xd,
  100. ZIP_INT_VEC_E_QUE6_DONE = 0x6,
  101. ZIP_INT_VEC_E_QUE6_ERR = 0xe,
  102. ZIP_INT_VEC_E_QUE7_DONE = 0x7,
  103. ZIP_INT_VEC_E_QUE7_ERR = 0xf,
  104. ZIP_INT_VEC_E_ENUM_LAST = 0x12,
  105. };
  106. /**
  107. * union zip_zptr_addr_s - ZIP Generic Pointer Structure for ADDR.
  108. *
  109. * It is the generic format of pointers in ZIP_INST_S.
  110. */
  111. union zip_zptr_addr_s {
  112. u64 u_reg64;
  113. struct {
  114. #if defined(__BIG_ENDIAN_BITFIELD)
  115. u64 reserved_49_63 : 15;
  116. u64 addr : 49;
  117. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  118. u64 addr : 49;
  119. u64 reserved_49_63 : 15;
  120. #endif
  121. } s;
  122. };
  123. /**
  124. * union zip_zptr_ctl_s - ZIP Generic Pointer Structure for CTL.
  125. *
  126. * It is the generic format of pointers in ZIP_INST_S.
  127. */
  128. union zip_zptr_ctl_s {
  129. u64 u_reg64;
  130. struct {
  131. #if defined(__BIG_ENDIAN_BITFIELD)
  132. u64 reserved_112_127 : 16;
  133. u64 length : 16;
  134. u64 reserved_67_95 : 29;
  135. u64 fw : 1;
  136. u64 nc : 1;
  137. u64 data_be : 1;
  138. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  139. u64 data_be : 1;
  140. u64 nc : 1;
  141. u64 fw : 1;
  142. u64 reserved_67_95 : 29;
  143. u64 length : 16;
  144. u64 reserved_112_127 : 16;
  145. #endif
  146. } s;
  147. };
  148. /**
  149. * union zip_inst_s - ZIP Instruction Structure.
  150. * Each ZIP instruction has 16 words (they are called IWORD0 to IWORD15 within
  151. * the structure).
  152. */
  153. union zip_inst_s {
  154. u64 u_reg64[16];
  155. struct {
  156. #if defined(__BIG_ENDIAN_BITFIELD)
  157. u64 doneint : 1;
  158. u64 reserved_56_62 : 7;
  159. u64 totaloutputlength : 24;
  160. u64 reserved_27_31 : 5;
  161. u64 exn : 3;
  162. u64 reserved_23_23 : 1;
  163. u64 exbits : 7;
  164. u64 reserved_12_15 : 4;
  165. u64 sf : 1;
  166. u64 ss : 2;
  167. u64 cc : 2;
  168. u64 ef : 1;
  169. u64 bf : 1;
  170. u64 ce : 1;
  171. u64 reserved_3_3 : 1;
  172. u64 ds : 1;
  173. u64 dg : 1;
  174. u64 hg : 1;
  175. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  176. u64 hg : 1;
  177. u64 dg : 1;
  178. u64 ds : 1;
  179. u64 reserved_3_3 : 1;
  180. u64 ce : 1;
  181. u64 bf : 1;
  182. u64 ef : 1;
  183. u64 cc : 2;
  184. u64 ss : 2;
  185. u64 sf : 1;
  186. u64 reserved_12_15 : 4;
  187. u64 exbits : 7;
  188. u64 reserved_23_23 : 1;
  189. u64 exn : 3;
  190. u64 reserved_27_31 : 5;
  191. u64 totaloutputlength : 24;
  192. u64 reserved_56_62 : 7;
  193. u64 doneint : 1;
  194. #endif
  195. #if defined(__BIG_ENDIAN_BITFIELD)
  196. u64 historylength : 16;
  197. u64 reserved_96_111 : 16;
  198. u64 adlercrc32 : 32;
  199. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  200. u64 adlercrc32 : 32;
  201. u64 reserved_96_111 : 16;
  202. u64 historylength : 16;
  203. #endif
  204. union zip_zptr_addr_s ctx_ptr_addr;
  205. union zip_zptr_ctl_s ctx_ptr_ctl;
  206. union zip_zptr_addr_s his_ptr_addr;
  207. union zip_zptr_ctl_s his_ptr_ctl;
  208. union zip_zptr_addr_s inp_ptr_addr;
  209. union zip_zptr_ctl_s inp_ptr_ctl;
  210. union zip_zptr_addr_s out_ptr_addr;
  211. union zip_zptr_ctl_s out_ptr_ctl;
  212. union zip_zptr_addr_s res_ptr_addr;
  213. union zip_zptr_ctl_s res_ptr_ctl;
  214. #if defined(__BIG_ENDIAN_BITFIELD)
  215. u64 reserved_817_831 : 15;
  216. u64 wq_ptr : 49;
  217. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  218. u64 wq_ptr : 49;
  219. u64 reserved_817_831 : 15;
  220. #endif
  221. #if defined(__BIG_ENDIAN_BITFIELD)
  222. u64 reserved_882_895 : 14;
  223. u64 tt : 2;
  224. u64 reserved_874_879 : 6;
  225. u64 grp : 10;
  226. u64 tag : 32;
  227. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  228. u64 tag : 32;
  229. u64 grp : 10;
  230. u64 reserved_874_879 : 6;
  231. u64 tt : 2;
  232. u64 reserved_882_895 : 14;
  233. #endif
  234. #if defined(__BIG_ENDIAN_BITFIELD)
  235. u64 reserved_896_959 : 64;
  236. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  237. u64 reserved_896_959 : 64;
  238. #endif
  239. #if defined(__BIG_ENDIAN_BITFIELD)
  240. u64 reserved_960_1023 : 64;
  241. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  242. u64 reserved_960_1023 : 64;
  243. #endif
  244. } s;
  245. };
  246. /**
  247. * union zip_nptr_s - ZIP Instruction Next-Chunk-Buffer Pointer (NPTR)
  248. * Structure
  249. *
  250. * ZIP_NPTR structure is used to chain all the zip instruction buffers
  251. * together. ZIP instruction buffers are managed (allocated and released) by
  252. * the software.
  253. */
  254. union zip_nptr_s {
  255. u64 u_reg64;
  256. struct {
  257. #if defined(__BIG_ENDIAN_BITFIELD)
  258. u64 reserved_49_63 : 15;
  259. u64 addr : 49;
  260. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  261. u64 addr : 49;
  262. u64 reserved_49_63 : 15;
  263. #endif
  264. } s;
  265. };
  266. /**
  267. * union zip_zptr_s - ZIP Generic Pointer Structure.
  268. *
  269. * It is the generic format of pointers in ZIP_INST_S.
  270. */
  271. union zip_zptr_s {
  272. u64 u_reg64[2];
  273. struct {
  274. #if defined(__BIG_ENDIAN_BITFIELD)
  275. u64 reserved_49_63 : 15;
  276. u64 addr : 49;
  277. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  278. u64 addr : 49;
  279. u64 reserved_49_63 : 15;
  280. #endif
  281. #if defined(__BIG_ENDIAN_BITFIELD)
  282. u64 reserved_112_127 : 16;
  283. u64 length : 16;
  284. u64 reserved_67_95 : 29;
  285. u64 fw : 1;
  286. u64 nc : 1;
  287. u64 data_be : 1;
  288. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  289. u64 data_be : 1;
  290. u64 nc : 1;
  291. u64 fw : 1;
  292. u64 reserved_67_95 : 29;
  293. u64 length : 16;
  294. u64 reserved_112_127 : 16;
  295. #endif
  296. } s;
  297. };
  298. /**
  299. * union zip_zres_s - ZIP Result Structure
  300. *
  301. * The ZIP coprocessor writes the result structure after it completes the
  302. * invocation. The result structure is exactly 24 bytes, and each invocation of
  303. * the ZIP coprocessor produces exactly one result structure.
  304. */
  305. union zip_zres_s {
  306. u64 u_reg64[3];
  307. struct {
  308. #if defined(__BIG_ENDIAN_BITFIELD)
  309. u64 crc32 : 32;
  310. u64 adler32 : 32;
  311. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  312. u64 adler32 : 32;
  313. u64 crc32 : 32;
  314. #endif
  315. #if defined(__BIG_ENDIAN_BITFIELD)
  316. u64 totalbyteswritten : 32;
  317. u64 totalbytesread : 32;
  318. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  319. u64 totalbytesread : 32;
  320. u64 totalbyteswritten : 32;
  321. #endif
  322. #if defined(__BIG_ENDIAN_BITFIELD)
  323. u64 totalbitsprocessed : 32;
  324. u64 doneint : 1;
  325. u64 reserved_155_158 : 4;
  326. u64 exn : 3;
  327. u64 reserved_151_151 : 1;
  328. u64 exbits : 7;
  329. u64 reserved_137_143 : 7;
  330. u64 ef : 1;
  331. volatile u64 compcode : 8;
  332. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  333. volatile u64 compcode : 8;
  334. u64 ef : 1;
  335. u64 reserved_137_143 : 7;
  336. u64 exbits : 7;
  337. u64 reserved_151_151 : 1;
  338. u64 exn : 3;
  339. u64 reserved_155_158 : 4;
  340. u64 doneint : 1;
  341. u64 totalbitsprocessed : 32;
  342. #endif
  343. } s;
  344. };
  345. /**
  346. * union zip_cmd_ctl - Structure representing the register that controls
  347. * clock and reset.
  348. */
  349. union zip_cmd_ctl {
  350. u64 u_reg64;
  351. struct zip_cmd_ctl_s {
  352. #if defined(__BIG_ENDIAN_BITFIELD)
  353. u64 reserved_2_63 : 62;
  354. u64 forceclk : 1;
  355. u64 reset : 1;
  356. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  357. u64 reset : 1;
  358. u64 forceclk : 1;
  359. u64 reserved_2_63 : 62;
  360. #endif
  361. } s;
  362. };
  363. #define ZIP_CMD_CTL 0x0ull
  364. /**
  365. * union zip_constants - Data structure representing the register that contains
  366. * all of the current implementation-related parameters of the zip core in this
  367. * chip.
  368. */
  369. union zip_constants {
  370. u64 u_reg64;
  371. struct zip_constants_s {
  372. #if defined(__BIG_ENDIAN_BITFIELD)
  373. u64 nexec : 8;
  374. u64 reserved_49_55 : 7;
  375. u64 syncflush_capable : 1;
  376. u64 depth : 16;
  377. u64 onfsize : 12;
  378. u64 ctxsize : 12;
  379. u64 reserved_1_7 : 7;
  380. u64 disabled : 1;
  381. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  382. u64 disabled : 1;
  383. u64 reserved_1_7 : 7;
  384. u64 ctxsize : 12;
  385. u64 onfsize : 12;
  386. u64 depth : 16;
  387. u64 syncflush_capable : 1;
  388. u64 reserved_49_55 : 7;
  389. u64 nexec : 8;
  390. #endif
  391. } s;
  392. };
  393. #define ZIP_CONSTANTS 0x00A0ull
  394. /**
  395. * union zip_corex_bist_status - Represents registers which have the BIST
  396. * status of memories in zip cores.
  397. *
  398. * Each bit is the BIST result of an individual memory
  399. * (per bit, 0 = pass and 1 = fail).
  400. */
  401. union zip_corex_bist_status {
  402. u64 u_reg64;
  403. struct zip_corex_bist_status_s {
  404. #if defined(__BIG_ENDIAN_BITFIELD)
  405. u64 reserved_53_63 : 11;
  406. u64 bstatus : 53;
  407. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  408. u64 bstatus : 53;
  409. u64 reserved_53_63 : 11;
  410. #endif
  411. } s;
  412. };
  413. static inline u64 ZIP_COREX_BIST_STATUS(u64 param1)
  414. {
  415. if (param1 <= 1)
  416. return 0x0520ull + (param1 & 1) * 0x8ull;
  417. pr_err("ZIP_COREX_BIST_STATUS: %llu\n", param1);
  418. return 0;
  419. }
  420. /**
  421. * union zip_ctl_bist_status - Represents register that has the BIST status of
  422. * memories in ZIP_CTL (instruction buffer, G/S pointer FIFO, input data
  423. * buffer, output data buffers).
  424. *
  425. * Each bit is the BIST result of an individual memory
  426. * (per bit, 0 = pass and 1 = fail).
  427. */
  428. union zip_ctl_bist_status {
  429. u64 u_reg64;
  430. struct zip_ctl_bist_status_s {
  431. #if defined(__BIG_ENDIAN_BITFIELD)
  432. u64 reserved_9_63 : 55;
  433. u64 bstatus : 9;
  434. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  435. u64 bstatus : 9;
  436. u64 reserved_9_63 : 55;
  437. #endif
  438. } s;
  439. };
  440. #define ZIP_CTL_BIST_STATUS 0x0510ull
  441. /**
  442. * union zip_ctl_cfg - Represents the register that controls the behavior of
  443. * the ZIP DMA engines.
  444. *
  445. * It is recommended to keep default values for normal operation. Changing the
  446. * values of the fields may be useful for diagnostics.
  447. */
  448. union zip_ctl_cfg {
  449. u64 u_reg64;
  450. struct zip_ctl_cfg_s {
  451. #if defined(__BIG_ENDIAN_BITFIELD)
  452. u64 reserved_52_63 : 12;
  453. u64 ildf : 4;
  454. u64 reserved_36_47 : 12;
  455. u64 drtf : 4;
  456. u64 reserved_27_31 : 5;
  457. u64 stcf : 3;
  458. u64 reserved_19_23 : 5;
  459. u64 ldf : 3;
  460. u64 reserved_2_15 : 14;
  461. u64 busy : 1;
  462. u64 reserved_0_0 : 1;
  463. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  464. u64 reserved_0_0 : 1;
  465. u64 busy : 1;
  466. u64 reserved_2_15 : 14;
  467. u64 ldf : 3;
  468. u64 reserved_19_23 : 5;
  469. u64 stcf : 3;
  470. u64 reserved_27_31 : 5;
  471. u64 drtf : 4;
  472. u64 reserved_36_47 : 12;
  473. u64 ildf : 4;
  474. u64 reserved_52_63 : 12;
  475. #endif
  476. } s;
  477. };
  478. #define ZIP_CTL_CFG 0x0560ull
  479. /**
  480. * union zip_dbg_corex_inst - Represents the registers that reflect the status
  481. * of the current instruction that the ZIP core is executing or has executed.
  482. *
  483. * These registers are only for debug use.
  484. */
  485. union zip_dbg_corex_inst {
  486. u64 u_reg64;
  487. struct zip_dbg_corex_inst_s {
  488. #if defined(__BIG_ENDIAN_BITFIELD)
  489. u64 busy : 1;
  490. u64 reserved_35_62 : 28;
  491. u64 qid : 3;
  492. u64 iid : 32;
  493. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  494. u64 iid : 32;
  495. u64 qid : 3;
  496. u64 reserved_35_62 : 28;
  497. u64 busy : 1;
  498. #endif
  499. } s;
  500. };
  501. static inline u64 ZIP_DBG_COREX_INST(u64 param1)
  502. {
  503. if (param1 <= 1)
  504. return 0x0640ull + (param1 & 1) * 0x8ull;
  505. pr_err("ZIP_DBG_COREX_INST: %llu\n", param1);
  506. return 0;
  507. }
  508. /**
  509. * union zip_dbg_corex_sta - Represents registers that reflect the status of
  510. * the zip cores.
  511. *
  512. * They are for debug use only.
  513. */
  514. union zip_dbg_corex_sta {
  515. u64 u_reg64;
  516. struct zip_dbg_corex_sta_s {
  517. #if defined(__BIG_ENDIAN_BITFIELD)
  518. u64 busy : 1;
  519. u64 reserved_37_62 : 26;
  520. u64 ist : 5;
  521. u64 nie : 32;
  522. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  523. u64 nie : 32;
  524. u64 ist : 5;
  525. u64 reserved_37_62 : 26;
  526. u64 busy : 1;
  527. #endif
  528. } s;
  529. };
  530. static inline u64 ZIP_DBG_COREX_STA(u64 param1)
  531. {
  532. if (param1 <= 1)
  533. return 0x0680ull + (param1 & 1) * 0x8ull;
  534. pr_err("ZIP_DBG_COREX_STA: %llu\n", param1);
  535. return 0;
  536. }
  537. /**
  538. * union zip_dbg_quex_sta - Represets registers that reflect status of the zip
  539. * instruction queues.
  540. *
  541. * They are for debug use only.
  542. */
  543. union zip_dbg_quex_sta {
  544. u64 u_reg64;
  545. struct zip_dbg_quex_sta_s {
  546. #if defined(__BIG_ENDIAN_BITFIELD)
  547. u64 busy : 1;
  548. u64 reserved_56_62 : 7;
  549. u64 rqwc : 24;
  550. u64 nii : 32;
  551. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  552. u64 nii : 32;
  553. u64 rqwc : 24;
  554. u64 reserved_56_62 : 7;
  555. u64 busy : 1;
  556. #endif
  557. } s;
  558. };
  559. static inline u64 ZIP_DBG_QUEX_STA(u64 param1)
  560. {
  561. if (param1 <= 7)
  562. return 0x1800ull + (param1 & 7) * 0x8ull;
  563. pr_err("ZIP_DBG_QUEX_STA: %llu\n", param1);
  564. return 0;
  565. }
  566. /**
  567. * union zip_ecc_ctl - Represents the register that enables ECC for each
  568. * individual internal memory that requires ECC.
  569. *
  570. * For debug purpose, it can also flip one or two bits in the ECC data.
  571. */
  572. union zip_ecc_ctl {
  573. u64 u_reg64;
  574. struct zip_ecc_ctl_s {
  575. #if defined(__BIG_ENDIAN_BITFIELD)
  576. u64 reserved_19_63 : 45;
  577. u64 vmem_cdis : 1;
  578. u64 vmem_fs : 2;
  579. u64 reserved_15_15 : 1;
  580. u64 idf1_cdis : 1;
  581. u64 idf1_fs : 2;
  582. u64 reserved_11_11 : 1;
  583. u64 idf0_cdis : 1;
  584. u64 idf0_fs : 2;
  585. u64 reserved_7_7 : 1;
  586. u64 gspf_cdis : 1;
  587. u64 gspf_fs : 2;
  588. u64 reserved_3_3 : 1;
  589. u64 iqf_cdis : 1;
  590. u64 iqf_fs : 2;
  591. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  592. u64 iqf_fs : 2;
  593. u64 iqf_cdis : 1;
  594. u64 reserved_3_3 : 1;
  595. u64 gspf_fs : 2;
  596. u64 gspf_cdis : 1;
  597. u64 reserved_7_7 : 1;
  598. u64 idf0_fs : 2;
  599. u64 idf0_cdis : 1;
  600. u64 reserved_11_11 : 1;
  601. u64 idf1_fs : 2;
  602. u64 idf1_cdis : 1;
  603. u64 reserved_15_15 : 1;
  604. u64 vmem_fs : 2;
  605. u64 vmem_cdis : 1;
  606. u64 reserved_19_63 : 45;
  607. #endif
  608. } s;
  609. };
  610. #define ZIP_ECC_CTL 0x0568ull
  611. /* NCB - zip_ecce_ena_w1c */
  612. union zip_ecce_ena_w1c {
  613. u64 u_reg64;
  614. struct zip_ecce_ena_w1c_s {
  615. #if defined(__BIG_ENDIAN_BITFIELD)
  616. u64 reserved_37_63 : 27;
  617. u64 dbe : 5;
  618. u64 reserved_5_31 : 27;
  619. u64 sbe : 5;
  620. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  621. u64 sbe : 5;
  622. u64 reserved_5_31 : 27;
  623. u64 dbe : 5;
  624. u64 reserved_37_63 : 27;
  625. #endif
  626. } s;
  627. };
  628. #define ZIP_ECCE_ENA_W1C 0x0598ull
  629. /* NCB - zip_ecce_ena_w1s */
  630. union zip_ecce_ena_w1s {
  631. u64 u_reg64;
  632. struct zip_ecce_ena_w1s_s {
  633. #if defined(__BIG_ENDIAN_BITFIELD)
  634. u64 reserved_37_63 : 27;
  635. u64 dbe : 5;
  636. u64 reserved_5_31 : 27;
  637. u64 sbe : 5;
  638. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  639. u64 sbe : 5;
  640. u64 reserved_5_31 : 27;
  641. u64 dbe : 5;
  642. u64 reserved_37_63 : 27;
  643. #endif
  644. } s;
  645. };
  646. #define ZIP_ECCE_ENA_W1S 0x0590ull
  647. /**
  648. * union zip_ecce_int - Represents the register that contains the status of the
  649. * ECC interrupt sources.
  650. */
  651. union zip_ecce_int {
  652. u64 u_reg64;
  653. struct zip_ecce_int_s {
  654. #if defined(__BIG_ENDIAN_BITFIELD)
  655. u64 reserved_37_63 : 27;
  656. u64 dbe : 5;
  657. u64 reserved_5_31 : 27;
  658. u64 sbe : 5;
  659. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  660. u64 sbe : 5;
  661. u64 reserved_5_31 : 27;
  662. u64 dbe : 5;
  663. u64 reserved_37_63 : 27;
  664. #endif
  665. } s;
  666. };
  667. #define ZIP_ECCE_INT 0x0580ull
  668. /* NCB - zip_ecce_int_w1s */
  669. union zip_ecce_int_w1s {
  670. u64 u_reg64;
  671. struct zip_ecce_int_w1s_s {
  672. #if defined(__BIG_ENDIAN_BITFIELD)
  673. u64 reserved_37_63 : 27;
  674. u64 dbe : 5;
  675. u64 reserved_5_31 : 27;
  676. u64 sbe : 5;
  677. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  678. u64 sbe : 5;
  679. u64 reserved_5_31 : 27;
  680. u64 dbe : 5;
  681. u64 reserved_37_63 : 27;
  682. #endif
  683. } s;
  684. };
  685. #define ZIP_ECCE_INT_W1S 0x0588ull
  686. /* NCB - zip_fife_ena_w1c */
  687. union zip_fife_ena_w1c {
  688. u64 u_reg64;
  689. struct zip_fife_ena_w1c_s {
  690. #if defined(__BIG_ENDIAN_BITFIELD)
  691. u64 reserved_42_63 : 22;
  692. u64 asserts : 42;
  693. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  694. u64 asserts : 42;
  695. u64 reserved_42_63 : 22;
  696. #endif
  697. } s;
  698. };
  699. #define ZIP_FIFE_ENA_W1C 0x0090ull
  700. /* NCB - zip_fife_ena_w1s */
  701. union zip_fife_ena_w1s {
  702. u64 u_reg64;
  703. struct zip_fife_ena_w1s_s {
  704. #if defined(__BIG_ENDIAN_BITFIELD)
  705. u64 reserved_42_63 : 22;
  706. u64 asserts : 42;
  707. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  708. u64 asserts : 42;
  709. u64 reserved_42_63 : 22;
  710. #endif
  711. } s;
  712. };
  713. #define ZIP_FIFE_ENA_W1S 0x0088ull
  714. /* NCB - zip_fife_int */
  715. union zip_fife_int {
  716. u64 u_reg64;
  717. struct zip_fife_int_s {
  718. #if defined(__BIG_ENDIAN_BITFIELD)
  719. u64 reserved_42_63 : 22;
  720. u64 asserts : 42;
  721. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  722. u64 asserts : 42;
  723. u64 reserved_42_63 : 22;
  724. #endif
  725. } s;
  726. };
  727. #define ZIP_FIFE_INT 0x0078ull
  728. /* NCB - zip_fife_int_w1s */
  729. union zip_fife_int_w1s {
  730. u64 u_reg64;
  731. struct zip_fife_int_w1s_s {
  732. #if defined(__BIG_ENDIAN_BITFIELD)
  733. u64 reserved_42_63 : 22;
  734. u64 asserts : 42;
  735. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  736. u64 asserts : 42;
  737. u64 reserved_42_63 : 22;
  738. #endif
  739. } s;
  740. };
  741. #define ZIP_FIFE_INT_W1S 0x0080ull
  742. /**
  743. * union zip_msix_pbax - Represents the register that is the MSI-X PBA table
  744. *
  745. * The bit number is indexed by the ZIP_INT_VEC_E enumeration.
  746. */
  747. union zip_msix_pbax {
  748. u64 u_reg64;
  749. struct zip_msix_pbax_s {
  750. #if defined(__BIG_ENDIAN_BITFIELD)
  751. u64 pend : 64;
  752. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  753. u64 pend : 64;
  754. #endif
  755. } s;
  756. };
  757. static inline u64 ZIP_MSIX_PBAX(u64 param1)
  758. {
  759. if (param1 == 0)
  760. return 0x0000838000FF0000ull;
  761. pr_err("ZIP_MSIX_PBAX: %llu\n", param1);
  762. return 0;
  763. }
  764. /**
  765. * union zip_msix_vecx_addr - Represents the register that is the MSI-X vector
  766. * table, indexed by the ZIP_INT_VEC_E enumeration.
  767. */
  768. union zip_msix_vecx_addr {
  769. u64 u_reg64;
  770. struct zip_msix_vecx_addr_s {
  771. #if defined(__BIG_ENDIAN_BITFIELD)
  772. u64 reserved_49_63 : 15;
  773. u64 addr : 47;
  774. u64 reserved_1_1 : 1;
  775. u64 secvec : 1;
  776. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  777. u64 secvec : 1;
  778. u64 reserved_1_1 : 1;
  779. u64 addr : 47;
  780. u64 reserved_49_63 : 15;
  781. #endif
  782. } s;
  783. };
  784. static inline u64 ZIP_MSIX_VECX_ADDR(u64 param1)
  785. {
  786. if (param1 <= 17)
  787. return 0x0000838000F00000ull + (param1 & 31) * 0x10ull;
  788. pr_err("ZIP_MSIX_VECX_ADDR: %llu\n", param1);
  789. return 0;
  790. }
  791. /**
  792. * union zip_msix_vecx_ctl - Represents the register that is the MSI-X vector
  793. * table, indexed by the ZIP_INT_VEC_E enumeration.
  794. */
  795. union zip_msix_vecx_ctl {
  796. u64 u_reg64;
  797. struct zip_msix_vecx_ctl_s {
  798. #if defined(__BIG_ENDIAN_BITFIELD)
  799. u64 reserved_33_63 : 31;
  800. u64 mask : 1;
  801. u64 reserved_20_31 : 12;
  802. u64 data : 20;
  803. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  804. u64 data : 20;
  805. u64 reserved_20_31 : 12;
  806. u64 mask : 1;
  807. u64 reserved_33_63 : 31;
  808. #endif
  809. } s;
  810. };
  811. static inline u64 ZIP_MSIX_VECX_CTL(u64 param1)
  812. {
  813. if (param1 <= 17)
  814. return 0x0000838000F00008ull + (param1 & 31) * 0x10ull;
  815. pr_err("ZIP_MSIX_VECX_CTL: %llu\n", param1);
  816. return 0;
  817. }
  818. /**
  819. * union zip_quex_done - Represents the registers that contain the per-queue
  820. * instruction done count.
  821. */
  822. union zip_quex_done {
  823. u64 u_reg64;
  824. struct zip_quex_done_s {
  825. #if defined(__BIG_ENDIAN_BITFIELD)
  826. u64 reserved_20_63 : 44;
  827. u64 done : 20;
  828. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  829. u64 done : 20;
  830. u64 reserved_20_63 : 44;
  831. #endif
  832. } s;
  833. };
  834. static inline u64 ZIP_QUEX_DONE(u64 param1)
  835. {
  836. if (param1 <= 7)
  837. return 0x2000ull + (param1 & 7) * 0x8ull;
  838. pr_err("ZIP_QUEX_DONE: %llu\n", param1);
  839. return 0;
  840. }
  841. /**
  842. * union zip_quex_done_ack - Represents the registers on write to which will
  843. * decrement the per-queue instructiona done count.
  844. */
  845. union zip_quex_done_ack {
  846. u64 u_reg64;
  847. struct zip_quex_done_ack_s {
  848. #if defined(__BIG_ENDIAN_BITFIELD)
  849. u64 reserved_20_63 : 44;
  850. u64 done_ack : 20;
  851. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  852. u64 done_ack : 20;
  853. u64 reserved_20_63 : 44;
  854. #endif
  855. } s;
  856. };
  857. static inline u64 ZIP_QUEX_DONE_ACK(u64 param1)
  858. {
  859. if (param1 <= 7)
  860. return 0x2200ull + (param1 & 7) * 0x8ull;
  861. pr_err("ZIP_QUEX_DONE_ACK: %llu\n", param1);
  862. return 0;
  863. }
  864. /**
  865. * union zip_quex_done_ena_w1c - Represents the register which when written
  866. * 1 to will disable the DONEINT interrupt for the queue.
  867. */
  868. union zip_quex_done_ena_w1c {
  869. u64 u_reg64;
  870. struct zip_quex_done_ena_w1c_s {
  871. #if defined(__BIG_ENDIAN_BITFIELD)
  872. u64 reserved_1_63 : 63;
  873. u64 done_ena : 1;
  874. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  875. u64 done_ena : 1;
  876. u64 reserved_1_63 : 63;
  877. #endif
  878. } s;
  879. };
  880. static inline u64 ZIP_QUEX_DONE_ENA_W1C(u64 param1)
  881. {
  882. if (param1 <= 7)
  883. return 0x2600ull + (param1 & 7) * 0x8ull;
  884. pr_err("ZIP_QUEX_DONE_ENA_W1C: %llu\n", param1);
  885. return 0;
  886. }
  887. /**
  888. * union zip_quex_done_ena_w1s - Represents the register that when written 1 to
  889. * will enable the DONEINT interrupt for the queue.
  890. */
  891. union zip_quex_done_ena_w1s {
  892. u64 u_reg64;
  893. struct zip_quex_done_ena_w1s_s {
  894. #if defined(__BIG_ENDIAN_BITFIELD)
  895. u64 reserved_1_63 : 63;
  896. u64 done_ena : 1;
  897. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  898. u64 done_ena : 1;
  899. u64 reserved_1_63 : 63;
  900. #endif
  901. } s;
  902. };
  903. static inline u64 ZIP_QUEX_DONE_ENA_W1S(u64 param1)
  904. {
  905. if (param1 <= 7)
  906. return 0x2400ull + (param1 & 7) * 0x8ull;
  907. pr_err("ZIP_QUEX_DONE_ENA_W1S: %llu\n", param1);
  908. return 0;
  909. }
  910. /**
  911. * union zip_quex_done_wait - Represents the register that specifies the per
  912. * queue interrupt coalescing settings.
  913. */
  914. union zip_quex_done_wait {
  915. u64 u_reg64;
  916. struct zip_quex_done_wait_s {
  917. #if defined(__BIG_ENDIAN_BITFIELD)
  918. u64 reserved_48_63 : 16;
  919. u64 time_wait : 16;
  920. u64 reserved_20_31 : 12;
  921. u64 num_wait : 20;
  922. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  923. u64 num_wait : 20;
  924. u64 reserved_20_31 : 12;
  925. u64 time_wait : 16;
  926. u64 reserved_48_63 : 16;
  927. #endif
  928. } s;
  929. };
  930. static inline u64 ZIP_QUEX_DONE_WAIT(u64 param1)
  931. {
  932. if (param1 <= 7)
  933. return 0x2800ull + (param1 & 7) * 0x8ull;
  934. pr_err("ZIP_QUEX_DONE_WAIT: %llu\n", param1);
  935. return 0;
  936. }
  937. /**
  938. * union zip_quex_doorbell - Represents doorbell registers for the ZIP
  939. * instruction queues.
  940. */
  941. union zip_quex_doorbell {
  942. u64 u_reg64;
  943. struct zip_quex_doorbell_s {
  944. #if defined(__BIG_ENDIAN_BITFIELD)
  945. u64 reserved_20_63 : 44;
  946. u64 dbell_cnt : 20;
  947. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  948. u64 dbell_cnt : 20;
  949. u64 reserved_20_63 : 44;
  950. #endif
  951. } s;
  952. };
  953. static inline u64 ZIP_QUEX_DOORBELL(u64 param1)
  954. {
  955. if (param1 <= 7)
  956. return 0x4000ull + (param1 & 7) * 0x8ull;
  957. pr_err("ZIP_QUEX_DOORBELL: %llu\n", param1);
  958. return 0;
  959. }
  960. union zip_quex_err_ena_w1c {
  961. u64 u_reg64;
  962. struct zip_quex_err_ena_w1c_s {
  963. #if defined(__BIG_ENDIAN_BITFIELD)
  964. u64 reserved_5_63 : 59;
  965. u64 mdbe : 1;
  966. u64 nwrp : 1;
  967. u64 nrrp : 1;
  968. u64 irde : 1;
  969. u64 dovf : 1;
  970. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  971. u64 dovf : 1;
  972. u64 irde : 1;
  973. u64 nrrp : 1;
  974. u64 nwrp : 1;
  975. u64 mdbe : 1;
  976. u64 reserved_5_63 : 59;
  977. #endif
  978. } s;
  979. };
  980. static inline u64 ZIP_QUEX_ERR_ENA_W1C(u64 param1)
  981. {
  982. if (param1 <= 7)
  983. return 0x3600ull + (param1 & 7) * 0x8ull;
  984. pr_err("ZIP_QUEX_ERR_ENA_W1C: %llu\n", param1);
  985. return 0;
  986. }
  987. union zip_quex_err_ena_w1s {
  988. u64 u_reg64;
  989. struct zip_quex_err_ena_w1s_s {
  990. #if defined(__BIG_ENDIAN_BITFIELD)
  991. u64 reserved_5_63 : 59;
  992. u64 mdbe : 1;
  993. u64 nwrp : 1;
  994. u64 nrrp : 1;
  995. u64 irde : 1;
  996. u64 dovf : 1;
  997. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  998. u64 dovf : 1;
  999. u64 irde : 1;
  1000. u64 nrrp : 1;
  1001. u64 nwrp : 1;
  1002. u64 mdbe : 1;
  1003. u64 reserved_5_63 : 59;
  1004. #endif
  1005. } s;
  1006. };
  1007. static inline u64 ZIP_QUEX_ERR_ENA_W1S(u64 param1)
  1008. {
  1009. if (param1 <= 7)
  1010. return 0x3400ull + (param1 & 7) * 0x8ull;
  1011. pr_err("ZIP_QUEX_ERR_ENA_W1S: %llu\n", param1);
  1012. return 0;
  1013. }
  1014. /**
  1015. * union zip_quex_err_int - Represents registers that contain the per-queue
  1016. * error interrupts.
  1017. */
  1018. union zip_quex_err_int {
  1019. u64 u_reg64;
  1020. struct zip_quex_err_int_s {
  1021. #if defined(__BIG_ENDIAN_BITFIELD)
  1022. u64 reserved_5_63 : 59;
  1023. u64 mdbe : 1;
  1024. u64 nwrp : 1;
  1025. u64 nrrp : 1;
  1026. u64 irde : 1;
  1027. u64 dovf : 1;
  1028. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  1029. u64 dovf : 1;
  1030. u64 irde : 1;
  1031. u64 nrrp : 1;
  1032. u64 nwrp : 1;
  1033. u64 mdbe : 1;
  1034. u64 reserved_5_63 : 59;
  1035. #endif
  1036. } s;
  1037. };
  1038. static inline u64 ZIP_QUEX_ERR_INT(u64 param1)
  1039. {
  1040. if (param1 <= 7)
  1041. return 0x3000ull + (param1 & 7) * 0x8ull;
  1042. pr_err("ZIP_QUEX_ERR_INT: %llu\n", param1);
  1043. return 0;
  1044. }
  1045. /* NCB - zip_que#_err_int_w1s */
  1046. union zip_quex_err_int_w1s {
  1047. u64 u_reg64;
  1048. struct zip_quex_err_int_w1s_s {
  1049. #if defined(__BIG_ENDIAN_BITFIELD)
  1050. u64 reserved_5_63 : 59;
  1051. u64 mdbe : 1;
  1052. u64 nwrp : 1;
  1053. u64 nrrp : 1;
  1054. u64 irde : 1;
  1055. u64 dovf : 1;
  1056. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  1057. u64 dovf : 1;
  1058. u64 irde : 1;
  1059. u64 nrrp : 1;
  1060. u64 nwrp : 1;
  1061. u64 mdbe : 1;
  1062. u64 reserved_5_63 : 59;
  1063. #endif
  1064. } s;
  1065. };
  1066. static inline u64 ZIP_QUEX_ERR_INT_W1S(u64 param1)
  1067. {
  1068. if (param1 <= 7)
  1069. return 0x3200ull + (param1 & 7) * 0x8ull;
  1070. pr_err("ZIP_QUEX_ERR_INT_W1S: %llu\n", param1);
  1071. return 0;
  1072. }
  1073. /**
  1074. * union zip_quex_gcfg - Represents the registers that reflect status of the
  1075. * zip instruction queues,debug use only.
  1076. */
  1077. union zip_quex_gcfg {
  1078. u64 u_reg64;
  1079. struct zip_quex_gcfg_s {
  1080. #if defined(__BIG_ENDIAN_BITFIELD)
  1081. u64 reserved_4_63 : 60;
  1082. u64 iqb_ldwb : 1;
  1083. u64 cbw_sty : 1;
  1084. u64 l2ld_cmd : 2;
  1085. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  1086. u64 l2ld_cmd : 2;
  1087. u64 cbw_sty : 1;
  1088. u64 iqb_ldwb : 1;
  1089. u64 reserved_4_63 : 60;
  1090. #endif
  1091. } s;
  1092. };
  1093. static inline u64 ZIP_QUEX_GCFG(u64 param1)
  1094. {
  1095. if (param1 <= 7)
  1096. return 0x1A00ull + (param1 & 7) * 0x8ull;
  1097. pr_err("ZIP_QUEX_GCFG: %llu\n", param1);
  1098. return 0;
  1099. }
  1100. /**
  1101. * union zip_quex_map - Represents the registers that control how each
  1102. * instruction queue maps to zip cores.
  1103. */
  1104. union zip_quex_map {
  1105. u64 u_reg64;
  1106. struct zip_quex_map_s {
  1107. #if defined(__BIG_ENDIAN_BITFIELD)
  1108. u64 reserved_2_63 : 62;
  1109. u64 zce : 2;
  1110. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  1111. u64 zce : 2;
  1112. u64 reserved_2_63 : 62;
  1113. #endif
  1114. } s;
  1115. };
  1116. static inline u64 ZIP_QUEX_MAP(u64 param1)
  1117. {
  1118. if (param1 <= 7)
  1119. return 0x1400ull + (param1 & 7) * 0x8ull;
  1120. pr_err("ZIP_QUEX_MAP: %llu\n", param1);
  1121. return 0;
  1122. }
  1123. /**
  1124. * union zip_quex_sbuf_addr - Represents the registers that set the buffer
  1125. * parameters for the instruction queues.
  1126. *
  1127. * When quiescent (i.e. outstanding doorbell count is 0), it is safe to rewrite
  1128. * this register to effectively reset the command buffer state machine.
  1129. * These registers must be programmed after SW programs the corresponding
  1130. * ZIP_QUE(0..7)_SBUF_CTL.
  1131. */
  1132. union zip_quex_sbuf_addr {
  1133. u64 u_reg64;
  1134. struct zip_quex_sbuf_addr_s {
  1135. #if defined(__BIG_ENDIAN_BITFIELD)
  1136. u64 reserved_49_63 : 15;
  1137. u64 ptr : 42;
  1138. u64 off : 7;
  1139. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  1140. u64 off : 7;
  1141. u64 ptr : 42;
  1142. u64 reserved_49_63 : 15;
  1143. #endif
  1144. } s;
  1145. };
  1146. static inline u64 ZIP_QUEX_SBUF_ADDR(u64 param1)
  1147. {
  1148. if (param1 <= 7)
  1149. return 0x1000ull + (param1 & 7) * 0x8ull;
  1150. pr_err("ZIP_QUEX_SBUF_ADDR: %llu\n", param1);
  1151. return 0;
  1152. }
  1153. /**
  1154. * union zip_quex_sbuf_ctl - Represents the registers that set the buffer
  1155. * parameters for the instruction queues.
  1156. *
  1157. * When quiescent (i.e. outstanding doorbell count is 0), it is safe to rewrite
  1158. * this register to effectively reset the command buffer state machine.
  1159. * These registers must be programmed before SW programs the corresponding
  1160. * ZIP_QUE(0..7)_SBUF_ADDR.
  1161. */
  1162. union zip_quex_sbuf_ctl {
  1163. u64 u_reg64;
  1164. struct zip_quex_sbuf_ctl_s {
  1165. #if defined(__BIG_ENDIAN_BITFIELD)
  1166. u64 reserved_45_63 : 19;
  1167. u64 size : 13;
  1168. u64 inst_be : 1;
  1169. u64 reserved_24_30 : 7;
  1170. u64 stream_id : 8;
  1171. u64 reserved_12_15 : 4;
  1172. u64 aura : 12;
  1173. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  1174. u64 aura : 12;
  1175. u64 reserved_12_15 : 4;
  1176. u64 stream_id : 8;
  1177. u64 reserved_24_30 : 7;
  1178. u64 inst_be : 1;
  1179. u64 size : 13;
  1180. u64 reserved_45_63 : 19;
  1181. #endif
  1182. } s;
  1183. };
  1184. static inline u64 ZIP_QUEX_SBUF_CTL(u64 param1)
  1185. {
  1186. if (param1 <= 7)
  1187. return 0x1200ull + (param1 & 7) * 0x8ull;
  1188. pr_err("ZIP_QUEX_SBUF_CTL: %llu\n", param1);
  1189. return 0;
  1190. }
  1191. /**
  1192. * union zip_que_ena - Represents queue enable register
  1193. *
  1194. * If a queue is disabled, ZIP_CTL stops fetching instructions from the queue.
  1195. */
  1196. union zip_que_ena {
  1197. u64 u_reg64;
  1198. struct zip_que_ena_s {
  1199. #if defined(__BIG_ENDIAN_BITFIELD)
  1200. u64 reserved_8_63 : 56;
  1201. u64 ena : 8;
  1202. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  1203. u64 ena : 8;
  1204. u64 reserved_8_63 : 56;
  1205. #endif
  1206. } s;
  1207. };
  1208. #define ZIP_QUE_ENA 0x0500ull
  1209. /**
  1210. * union zip_que_pri - Represents the register that defines the priority
  1211. * between instruction queues.
  1212. */
  1213. union zip_que_pri {
  1214. u64 u_reg64;
  1215. struct zip_que_pri_s {
  1216. #if defined(__BIG_ENDIAN_BITFIELD)
  1217. u64 reserved_8_63 : 56;
  1218. u64 pri : 8;
  1219. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  1220. u64 pri : 8;
  1221. u64 reserved_8_63 : 56;
  1222. #endif
  1223. } s;
  1224. };
  1225. #define ZIP_QUE_PRI 0x0508ull
  1226. /**
  1227. * union zip_throttle - Represents the register that controls the maximum
  1228. * number of in-flight X2I data fetch transactions.
  1229. *
  1230. * Writing 0 to this register causes the ZIP module to temporarily suspend NCB
  1231. * accesses; it is not recommended for normal operation, but may be useful for
  1232. * diagnostics.
  1233. */
  1234. union zip_throttle {
  1235. u64 u_reg64;
  1236. struct zip_throttle_s {
  1237. #if defined(__BIG_ENDIAN_BITFIELD)
  1238. u64 reserved_6_63 : 58;
  1239. u64 ld_infl : 6;
  1240. #elif defined(__LITTLE_ENDIAN_BITFIELD)
  1241. u64 ld_infl : 6;
  1242. u64 reserved_6_63 : 58;
  1243. #endif
  1244. } s;
  1245. };
  1246. #define ZIP_THROTTLE 0x0010ull
  1247. #endif /* _CSRS_ZIP__ */