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>
13 /* hisi_zip_sqe dw3 */
14 #define HZIP_BD_STATUS_M GENMASK(7, 0)
15 /* hisi_zip_sqe dw7 */
16 #define HZIP_IN_SGE_DATA_OFFSET_M GENMASK(23, 0)
17 /* hisi_zip_sqe dw8 */
18 #define HZIP_OUT_SGE_DATA_OFFSET_M GENMASK(23, 0)
19 /* hisi_zip_sqe dw9 */
20 #define HZIP_REQ_TYPE_M GENMASK(7, 0)
21 #define HZIP_ALG_TYPE_ZLIB 0x02
22 #define HZIP_ALG_TYPE_GZIP 0x03
23 #define HZIP_BUF_TYPE_M GENMASK(11, 8)
24 #define HZIP_PBUFFER 0x0
27 enum hisi_zip_error_type {
28 /* negative compression */
36 struct list_head list;
37 struct hisi_zip_ctrl *ctrl;
45 u32 input_data_length;
63 u32 stream_ctx_addr_l;
64 u32 stream_ctx_addr_h;
65 u32 cipher_key1_addr_l;
66 u32 cipher_key1_addr_h;
67 u32 cipher_key2_addr_l;
68 u32 cipher_key2_addr_h;
72 struct hisi_zip *find_zip_device(int node);
73 int hisi_zip_register_to_crypto(void);
74 void hisi_zip_unregister_from_crypto(void);