Merge tag 'regmap-fix-v5.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux/fpc-iii.git] / drivers / crypto / caam / dpseci_cmd.h
blob71a007c85adbd2c3892168336d466648249ca926
1 /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
2 /*
3 * Copyright 2013-2016 Freescale Semiconductor Inc.
4 * Copyright 2017-2018 NXP
5 */
7 #ifndef _DPSECI_CMD_H_
8 #define _DPSECI_CMD_H_
10 /* DPSECI Version */
11 #define DPSECI_VER_MAJOR 5
12 #define DPSECI_VER_MINOR 3
14 #define DPSECI_VER(maj, min) (((maj) << 16) | (min))
15 #define DPSECI_VERSION DPSECI_VER(DPSECI_VER_MAJOR, DPSECI_VER_MINOR)
17 /* Command versioning */
18 #define DPSECI_CMD_BASE_VERSION 1
19 #define DPSECI_CMD_BASE_VERSION_V2 2
20 #define DPSECI_CMD_ID_OFFSET 4
22 #define DPSECI_CMD_V1(id) (((id) << DPSECI_CMD_ID_OFFSET) | \
23 DPSECI_CMD_BASE_VERSION)
25 #define DPSECI_CMD_V2(id) (((id) << DPSECI_CMD_ID_OFFSET) | \
26 DPSECI_CMD_BASE_VERSION_V2)
28 /* Command IDs */
29 #define DPSECI_CMDID_CLOSE DPSECI_CMD_V1(0x800)
30 #define DPSECI_CMDID_OPEN DPSECI_CMD_V1(0x809)
31 #define DPSECI_CMDID_GET_API_VERSION DPSECI_CMD_V1(0xa09)
33 #define DPSECI_CMDID_ENABLE DPSECI_CMD_V1(0x002)
34 #define DPSECI_CMDID_DISABLE DPSECI_CMD_V1(0x003)
35 #define DPSECI_CMDID_GET_ATTR DPSECI_CMD_V1(0x004)
36 #define DPSECI_CMDID_RESET DPSECI_CMD_V1(0x005)
37 #define DPSECI_CMDID_IS_ENABLED DPSECI_CMD_V1(0x006)
39 #define DPSECI_CMDID_SET_RX_QUEUE DPSECI_CMD_V1(0x194)
40 #define DPSECI_CMDID_GET_RX_QUEUE DPSECI_CMD_V1(0x196)
41 #define DPSECI_CMDID_GET_TX_QUEUE DPSECI_CMD_V1(0x197)
42 #define DPSECI_CMDID_GET_SEC_ATTR DPSECI_CMD_V2(0x198)
43 #define DPSECI_CMDID_SET_CONGESTION_NOTIFICATION DPSECI_CMD_V1(0x170)
44 #define DPSECI_CMDID_GET_CONGESTION_NOTIFICATION DPSECI_CMD_V1(0x171)
46 /* Macros for accessing command fields smaller than 1 byte */
47 #define DPSECI_MASK(field) \
48 GENMASK(DPSECI_##field##_SHIFT + DPSECI_##field##_SIZE - 1, \
49 DPSECI_##field##_SHIFT)
51 #define dpseci_set_field(var, field, val) \
52 ((var) |= (((val) << DPSECI_##field##_SHIFT) & DPSECI_MASK(field)))
54 #define dpseci_get_field(var, field) \
55 (((var) & DPSECI_MASK(field)) >> DPSECI_##field##_SHIFT)
57 struct dpseci_cmd_open {
58 __le32 dpseci_id;
61 #define DPSECI_ENABLE_SHIFT 0
62 #define DPSECI_ENABLE_SIZE 1
64 struct dpseci_rsp_is_enabled {
65 u8 is_enabled;
68 struct dpseci_rsp_get_attributes {
69 __le32 id;
70 __le32 pad0;
71 u8 num_tx_queues;
72 u8 num_rx_queues;
73 u8 pad1[6];
74 __le32 options;
77 #define DPSECI_DEST_TYPE_SHIFT 0
78 #define DPSECI_DEST_TYPE_SIZE 4
80 #define DPSECI_ORDER_PRESERVATION_SHIFT 0
81 #define DPSECI_ORDER_PRESERVATION_SIZE 1
83 struct dpseci_cmd_queue {
84 __le32 dest_id;
85 u8 priority;
86 u8 queue;
87 u8 dest_type;
88 u8 pad;
89 __le64 user_ctx;
90 union {
91 __le32 options;
92 __le32 fqid;
94 u8 order_preservation_en;
97 struct dpseci_rsp_get_tx_queue {
98 __le32 pad;
99 __le32 fqid;
100 u8 priority;
103 struct dpseci_rsp_get_sec_attr {
104 __le16 ip_id;
105 u8 major_rev;
106 u8 minor_rev;
107 u8 era;
108 u8 pad0[3];
109 u8 deco_num;
110 u8 zuc_auth_acc_num;
111 u8 zuc_enc_acc_num;
112 u8 pad1;
113 u8 snow_f8_acc_num;
114 u8 snow_f9_acc_num;
115 u8 crc_acc_num;
116 u8 pad2;
117 u8 pk_acc_num;
118 u8 kasumi_acc_num;
119 u8 rng_acc_num;
120 u8 pad3;
121 u8 md_acc_num;
122 u8 arc4_acc_num;
123 u8 des_acc_num;
124 u8 aes_acc_num;
125 u8 ccha_acc_num;
126 u8 ptha_acc_num;
129 struct dpseci_rsp_get_api_version {
130 __le16 major;
131 __le16 minor;
134 #define DPSECI_CGN_DEST_TYPE_SHIFT 0
135 #define DPSECI_CGN_DEST_TYPE_SIZE 4
136 #define DPSECI_CGN_UNITS_SHIFT 4
137 #define DPSECI_CGN_UNITS_SIZE 2
139 struct dpseci_cmd_congestion_notification {
140 __le32 dest_id;
141 __le16 notification_mode;
142 u8 priority;
143 u8 options;
144 __le64 message_iova;
145 __le64 message_ctx;
146 __le32 threshold_entry;
147 __le32 threshold_exit;
150 #endif /* _DPSECI_CMD_H_ */