zip.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright (c) 2019 HiSilicon Limited. */
  3. #ifndef HISI_ZIP_H
  4. #define HISI_ZIP_H
  5. #undef pr_fmt
  6. #define pr_fmt(fmt) "hisi_zip: " fmt
  7. #include <linux/list.h>
  8. #include <linux/hisi_acc_qm.h>
  9. enum hisi_zip_error_type {
  10. /* negative compression */
  11. HZIP_NC_ERR = 0x0d,
  12. };
  13. struct hisi_zip_dfx {
  14. atomic64_t send_cnt;
  15. atomic64_t recv_cnt;
  16. atomic64_t send_busy_cnt;
  17. atomic64_t err_bd_cnt;
  18. };
  19. struct hisi_zip_ctrl;
  20. struct hisi_zip {
  21. struct hisi_qm qm;
  22. struct hisi_zip_ctrl *ctrl;
  23. struct hisi_zip_dfx dfx;
  24. };
  25. struct hisi_zip_sqe {
  26. u32 consumed;
  27. u32 produced;
  28. u32 comp_data_length;
  29. /*
  30. * status: 0~7 bits
  31. * rsvd: 8~31 bits
  32. */
  33. u32 dw3;
  34. u32 input_data_length;
  35. u32 dw5;
  36. u32 dw6;
  37. /*
  38. * in_sge_data_offset: 0~23 bits
  39. * rsvd: 24~27 bits
  40. * sqe_type: 29~31 bits
  41. */
  42. u32 dw7;
  43. /*
  44. * out_sge_data_offset: 0~23 bits
  45. * rsvd: 24~31 bits
  46. */
  47. u32 dw8;
  48. /*
  49. * request_type: 0~7 bits
  50. * buffer_type: 8~11 bits
  51. * rsvd: 13~31 bits
  52. */
  53. u32 dw9;
  54. u32 dw10;
  55. u32 dw11;
  56. u32 dw12;
  57. /* tag: in sqe type 0 */
  58. u32 dw13;
  59. u32 dest_avail_out;
  60. u32 dw15;
  61. u32 dw16;
  62. u32 dw17;
  63. u32 source_addr_l;
  64. u32 source_addr_h;
  65. u32 dest_addr_l;
  66. u32 dest_addr_h;
  67. u32 dw22;
  68. u32 dw23;
  69. u32 dw24;
  70. u32 dw25;
  71. /* tag: in sqe type 3 */
  72. u32 dw26;
  73. u32 dw27;
  74. u32 rsvd1[4];
  75. };
  76. int zip_create_qps(struct hisi_qp **qps, int qp_num, int node);
  77. int hisi_zip_register_to_crypto(struct hisi_qm *qm);
  78. void hisi_zip_unregister_from_crypto(struct hisi_qm *qm);
  79. bool hisi_zip_alg_support(struct hisi_qm *qm, u32 alg);
  80. #endif