1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2019 HiSilicon Limited. */
7 #define pr_fmt(fmt) "hisi_zip: " fmt
9 #include <linux/list.h>
12 /* hisi_zip_sqe dw3 */
13 #define HZIP_BD_STATUS_M GENMASK(7, 0)
14 /* hisi_zip_sqe dw7 */
15 #define HZIP_IN_SGE_DATA_OFFSET_M GENMASK(23, 0)
16 /* hisi_zip_sqe dw8 */
17 #define HZIP_OUT_SGE_DATA_OFFSET_M GENMASK(23, 0)
18 /* hisi_zip_sqe dw9 */
19 #define HZIP_REQ_TYPE_M GENMASK(7, 0)
20 #define HZIP_ALG_TYPE_ZLIB 0x02
21 #define HZIP_ALG_TYPE_GZIP 0x03
22 #define HZIP_BUF_TYPE_M GENMASK(11, 8)
23 #define HZIP_PBUFFER 0x0
26 enum hisi_zip_error_type {
27 /* negative compression */
34 atomic64_t send_busy_cnt;
35 atomic64_t err_bd_cnt;
42 struct list_head list;
43 struct hisi_zip_ctrl *ctrl;
44 struct hisi_zip_dfx dfx;
52 u32 input_data_length;
70 u32 stream_ctx_addr_l;
71 u32 stream_ctx_addr_h;
72 u32 cipher_key1_addr_l;
73 u32 cipher_key1_addr_h;
74 u32 cipher_key2_addr_l;
75 u32 cipher_key2_addr_h;
79 int zip_create_qps(struct hisi_qp **qps, int ctx_num, int node);
80 int hisi_zip_register_to_crypto(void);
81 void hisi_zip_unregister_from_crypto(void);