xref: /openbmc/linux/drivers/crypto/hisilicon/qm_common.h (revision b97d6790d03b763eca08847a9a5869a4291b9f9a)
1*94476b2bSKai Ye /* SPDX-License-Identifier: GPL-2.0 */
2*94476b2bSKai Ye /* Copyright (c) 2022 HiSilicon Limited. */
3*94476b2bSKai Ye #ifndef QM_COMMON_H
4*94476b2bSKai Ye #define QM_COMMON_H
5*94476b2bSKai Ye 
6*94476b2bSKai Ye #define QM_DBG_READ_LEN		256
7*94476b2bSKai Ye 
8*94476b2bSKai Ye struct qm_cqe {
9*94476b2bSKai Ye 	__le32 rsvd0;
10*94476b2bSKai Ye 	__le16 cmd_id;
11*94476b2bSKai Ye 	__le16 rsvd1;
12*94476b2bSKai Ye 	__le16 sq_head;
13*94476b2bSKai Ye 	__le16 sq_num;
14*94476b2bSKai Ye 	__le16 rsvd2;
15*94476b2bSKai Ye 	__le16 w7;
16*94476b2bSKai Ye };
17*94476b2bSKai Ye 
18*94476b2bSKai Ye struct qm_eqe {
19*94476b2bSKai Ye 	__le32 dw0;
20*94476b2bSKai Ye };
21*94476b2bSKai Ye 
22*94476b2bSKai Ye struct qm_aeqe {
23*94476b2bSKai Ye 	__le32 dw0;
24*94476b2bSKai Ye };
25*94476b2bSKai Ye 
26*94476b2bSKai Ye struct qm_sqc {
27*94476b2bSKai Ye 	__le16 head;
28*94476b2bSKai Ye 	__le16 tail;
29*94476b2bSKai Ye 	__le32 base_l;
30*94476b2bSKai Ye 	__le32 base_h;
31*94476b2bSKai Ye 	__le32 dw3;
32*94476b2bSKai Ye 	__le16 w8;
33*94476b2bSKai Ye 	__le16 rsvd0;
34*94476b2bSKai Ye 	__le16 pasid;
35*94476b2bSKai Ye 	__le16 w11;
36*94476b2bSKai Ye 	__le16 cq_num;
37*94476b2bSKai Ye 	__le16 w13;
38*94476b2bSKai Ye 	__le32 rsvd1;
39*94476b2bSKai Ye };
40*94476b2bSKai Ye 
41*94476b2bSKai Ye struct qm_cqc {
42*94476b2bSKai Ye 	__le16 head;
43*94476b2bSKai Ye 	__le16 tail;
44*94476b2bSKai Ye 	__le32 base_l;
45*94476b2bSKai Ye 	__le32 base_h;
46*94476b2bSKai Ye 	__le32 dw3;
47*94476b2bSKai Ye 	__le16 w8;
48*94476b2bSKai Ye 	__le16 rsvd0;
49*94476b2bSKai Ye 	__le16 pasid;
50*94476b2bSKai Ye 	__le16 w11;
51*94476b2bSKai Ye 	__le32 dw6;
52*94476b2bSKai Ye 	__le32 rsvd1;
53*94476b2bSKai Ye };
54*94476b2bSKai Ye 
55*94476b2bSKai Ye struct qm_eqc {
56*94476b2bSKai Ye 	__le16 head;
57*94476b2bSKai Ye 	__le16 tail;
58*94476b2bSKai Ye 	__le32 base_l;
59*94476b2bSKai Ye 	__le32 base_h;
60*94476b2bSKai Ye 	__le32 dw3;
61*94476b2bSKai Ye 	__le32 rsvd[2];
62*94476b2bSKai Ye 	__le32 dw6;
63*94476b2bSKai Ye };
64*94476b2bSKai Ye 
65*94476b2bSKai Ye struct qm_aeqc {
66*94476b2bSKai Ye 	__le16 head;
67*94476b2bSKai Ye 	__le16 tail;
68*94476b2bSKai Ye 	__le32 base_l;
69*94476b2bSKai Ye 	__le32 base_h;
70*94476b2bSKai Ye 	__le32 dw3;
71*94476b2bSKai Ye 	__le32 rsvd[2];
72*94476b2bSKai Ye 	__le32 dw6;
73*94476b2bSKai Ye };
74*94476b2bSKai Ye 
75*94476b2bSKai Ye static const char * const qm_s[] = {
76*94476b2bSKai Ye 	"init", "start", "close", "stop",
77*94476b2bSKai Ye };
78*94476b2bSKai Ye 
79*94476b2bSKai Ye void *hisi_qm_ctx_alloc(struct hisi_qm *qm, size_t ctx_size,
80*94476b2bSKai Ye 			dma_addr_t *dma_addr);
81*94476b2bSKai Ye void hisi_qm_ctx_free(struct hisi_qm *qm, size_t ctx_size,
82*94476b2bSKai Ye 		      const void *ctx_addr, dma_addr_t *dma_addr);
83*94476b2bSKai Ye void hisi_qm_show_last_dfx_regs(struct hisi_qm *qm);
84*94476b2bSKai Ye void hisi_qm_set_algqos_init(struct hisi_qm *qm);
85*94476b2bSKai Ye 
86*94476b2bSKai Ye #endif
87