xref: /openbmc/linux/drivers/crypto/hisilicon/zip/zip.h (revision 671841d2)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2019 HiSilicon Limited. */
3 #ifndef HISI_ZIP_H
4 #define HISI_ZIP_H
5 
6 #undef pr_fmt
7 #define pr_fmt(fmt)	"hisi_zip: " fmt
8 
9 #include <linux/list.h>
10 #include "../qm.h"
11 
12 enum hisi_zip_error_type {
13 	/* negative compression */
14 	HZIP_NC_ERR = 0x0d,
15 };
16 
17 struct hisi_zip_dfx {
18 	atomic64_t send_cnt;
19 	atomic64_t recv_cnt;
20 	atomic64_t send_busy_cnt;
21 	atomic64_t err_bd_cnt;
22 };
23 
24 struct hisi_zip_ctrl;
25 
26 struct hisi_zip {
27 	struct hisi_qm qm;
28 	struct hisi_zip_ctrl *ctrl;
29 	struct hisi_zip_dfx dfx;
30 };
31 
32 struct hisi_zip_sqe {
33 	u32 consumed;
34 	u32 produced;
35 	u32 comp_data_length;
36 	u32 dw3;
37 	u32 input_data_length;
38 	u32 lba_l;
39 	u32 lba_h;
40 	u32 dw7;
41 	u32 dw8;
42 	u32 dw9;
43 	u32 dw10;
44 	u32 priv_info;
45 	u32 dw12;
46 	u32 tag;
47 	u32 dest_avail_out;
48 	u32 rsvd0;
49 	u32 comp_head_addr_l;
50 	u32 comp_head_addr_h;
51 	u32 source_addr_l;
52 	u32 source_addr_h;
53 	u32 dest_addr_l;
54 	u32 dest_addr_h;
55 	u32 stream_ctx_addr_l;
56 	u32 stream_ctx_addr_h;
57 	u32 cipher_key1_addr_l;
58 	u32 cipher_key1_addr_h;
59 	u32 cipher_key2_addr_l;
60 	u32 cipher_key2_addr_h;
61 	u32 rsvd1[4];
62 };
63 
64 int zip_create_qps(struct hisi_qp **qps, int ctx_num, int node);
65 int hisi_zip_register_to_crypto(void);
66 void hisi_zip_unregister_from_crypto(void);
67 #endif
68