zip.h 1.5 KB
Newer Older
1 2 3 4 5 6 7 8 9
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2019 HiSilicon Limited. */
#ifndef HISI_ZIP_H
#define HISI_ZIP_H

#undef pr_fmt
#define pr_fmt(fmt)	"hisi_zip: " fmt

#include <linux/list.h>
10
#include <linux/hisi_acc_qm.h>
11 12 13 14 15 16

enum hisi_zip_error_type {
	/* negative compression */
	HZIP_NC_ERR = 0x0d,
};

17 18 19 20 21 22 23
struct hisi_zip_dfx {
	atomic64_t send_cnt;
	atomic64_t recv_cnt;
	atomic64_t send_busy_cnt;
	atomic64_t err_bd_cnt;
};

24 25 26 27 28
struct hisi_zip_ctrl;

struct hisi_zip {
	struct hisi_qm qm;
	struct hisi_zip_ctrl *ctrl;
29
	struct hisi_zip_dfx dfx;
30 31 32 33 34 35
};

struct hisi_zip_sqe {
	u32 consumed;
	u32 produced;
	u32 comp_data_length;
36 37 38 39
	/*
	 * status: 0~7 bits
	 * rsvd: 8~31 bits
	 */
40 41
	u32 dw3;
	u32 input_data_length;
42 43 44 45 46 47 48
	u32 dw5;
	u32 dw6;
	/*
	 * in_sge_data_offset: 0~23 bits
	 * rsvd: 24~27 bits
	 * sqe_type: 29~31 bits
	 */
49
	u32 dw7;
50 51 52 53
	/*
	 * out_sge_data_offset: 0~23 bits
	 * rsvd: 24~31 bits
	 */
54
	u32 dw8;
55 56 57 58 59
	/*
	 * request_type: 0~7 bits
	 * buffer_type: 8~11 bits
	 * rsvd: 13~31 bits
	 */
60 61
	u32 dw9;
	u32 dw10;
62
	u32 dw11;
63
	u32 dw12;
64 65
	/* tag: in sqe type 0 */
	u32 dw13;
66
	u32 dest_avail_out;
67 68 69
	u32 dw15;
	u32 dw16;
	u32 dw17;
70 71 72 73
	u32 source_addr_l;
	u32 source_addr_h;
	u32 dest_addr_l;
	u32 dest_addr_h;
74 75 76 77
	u32 dw22;
	u32 dw23;
	u32 dw24;
	u32 dw25;
78
	/* tag: in sqe type 3 */
79 80
	u32 dw26;
	u32 dw27;
81 82 83
	u32 rsvd1[4];
};

84
int zip_create_qps(struct hisi_qp **qps, int ctx_num, int node);
85 86
int hisi_zip_register_to_crypto(struct hisi_qm *qm);
void hisi_zip_unregister_from_crypto(struct hisi_qm *qm);
87
#endif