This source file includes following definitions.
- get_current_node
- adf_sriov_configure
- adf_disable_sriov
- adf_enable_pf2vf_interrupts
- adf_disable_pf2vf_interrupts
- adf_vf2pf_init
- adf_vf2pf_shutdown
- adf_init_pf_wq
- adf_exit_pf_wq
- adf_init_vf_wq
- adf_exit_vf_wq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47 #ifndef ADF_DRV_H
48 #define ADF_DRV_H
49
50 #include <linux/list.h>
51 #include <linux/pci.h>
52 #include "adf_accel_devices.h"
53 #include "icp_qat_fw_loader_handle.h"
54 #include "icp_qat_hal.h"
55
56 #define ADF_MAJOR_VERSION 0
57 #define ADF_MINOR_VERSION 6
58 #define ADF_BUILD_VERSION 0
59 #define ADF_DRV_VERSION __stringify(ADF_MAJOR_VERSION) "." \
60 __stringify(ADF_MINOR_VERSION) "." \
61 __stringify(ADF_BUILD_VERSION)
62
63 #define ADF_STATUS_RESTARTING 0
64 #define ADF_STATUS_STARTING 1
65 #define ADF_STATUS_CONFIGURED 2
66 #define ADF_STATUS_STARTED 3
67 #define ADF_STATUS_AE_INITIALISED 4
68 #define ADF_STATUS_AE_UCODE_LOADED 5
69 #define ADF_STATUS_AE_STARTED 6
70 #define ADF_STATUS_PF_RUNNING 7
71 #define ADF_STATUS_IRQ_ALLOCATED 8
72
73 enum adf_dev_reset_mode {
74 ADF_DEV_RESET_ASYNC = 0,
75 ADF_DEV_RESET_SYNC
76 };
77
78 enum adf_event {
79 ADF_EVENT_INIT = 0,
80 ADF_EVENT_START,
81 ADF_EVENT_STOP,
82 ADF_EVENT_SHUTDOWN,
83 ADF_EVENT_RESTARTING,
84 ADF_EVENT_RESTARTED,
85 };
86
87 struct service_hndl {
88 int (*event_hld)(struct adf_accel_dev *accel_dev,
89 enum adf_event event);
90 unsigned long init_status[ADF_DEVS_ARRAY_SIZE];
91 unsigned long start_status[ADF_DEVS_ARRAY_SIZE];
92 char *name;
93 struct list_head list;
94 };
95
96 static inline int get_current_node(void)
97 {
98 return topology_physical_package_id(raw_smp_processor_id());
99 }
100
101 int adf_service_register(struct service_hndl *service);
102 int adf_service_unregister(struct service_hndl *service);
103
104 int adf_dev_init(struct adf_accel_dev *accel_dev);
105 int adf_dev_start(struct adf_accel_dev *accel_dev);
106 void adf_dev_stop(struct adf_accel_dev *accel_dev);
107 void adf_dev_shutdown(struct adf_accel_dev *accel_dev);
108
109 int adf_iov_putmsg(struct adf_accel_dev *accel_dev, u32 msg, u8 vf_nr);
110 void adf_pf2vf_notify_restarting(struct adf_accel_dev *accel_dev);
111 int adf_enable_vf2pf_comms(struct adf_accel_dev *accel_dev);
112 void adf_vf2pf_req_hndl(struct adf_accel_vf_info *vf_info);
113 void adf_devmgr_update_class_index(struct adf_hw_device_data *hw_data);
114 void adf_clean_vf_map(bool);
115
116 int adf_ctl_dev_register(void);
117 void adf_ctl_dev_unregister(void);
118 int adf_processes_dev_register(void);
119 void adf_processes_dev_unregister(void);
120
121 int adf_devmgr_add_dev(struct adf_accel_dev *accel_dev,
122 struct adf_accel_dev *pf);
123 void adf_devmgr_rm_dev(struct adf_accel_dev *accel_dev,
124 struct adf_accel_dev *pf);
125 struct list_head *adf_devmgr_get_head(void);
126 struct adf_accel_dev *adf_devmgr_get_dev_by_id(uint32_t id);
127 struct adf_accel_dev *adf_devmgr_get_first(void);
128 struct adf_accel_dev *adf_devmgr_pci_to_accel_dev(struct pci_dev *pci_dev);
129 int adf_devmgr_verify_id(uint32_t id);
130 void adf_devmgr_get_num_dev(uint32_t *num);
131 int adf_devmgr_in_reset(struct adf_accel_dev *accel_dev);
132 int adf_dev_started(struct adf_accel_dev *accel_dev);
133 int adf_dev_restarting_notify(struct adf_accel_dev *accel_dev);
134 int adf_dev_restarted_notify(struct adf_accel_dev *accel_dev);
135 int adf_ae_init(struct adf_accel_dev *accel_dev);
136 int adf_ae_shutdown(struct adf_accel_dev *accel_dev);
137 int adf_ae_fw_load(struct adf_accel_dev *accel_dev);
138 void adf_ae_fw_release(struct adf_accel_dev *accel_dev);
139 int adf_ae_start(struct adf_accel_dev *accel_dev);
140 int adf_ae_stop(struct adf_accel_dev *accel_dev);
141
142 int adf_enable_aer(struct adf_accel_dev *accel_dev, struct pci_driver *adf);
143 void adf_disable_aer(struct adf_accel_dev *accel_dev);
144 void adf_reset_sbr(struct adf_accel_dev *accel_dev);
145 void adf_reset_flr(struct adf_accel_dev *accel_dev);
146 void adf_dev_restore(struct adf_accel_dev *accel_dev);
147 int adf_init_aer(void);
148 void adf_exit_aer(void);
149 int adf_init_admin_comms(struct adf_accel_dev *accel_dev);
150 void adf_exit_admin_comms(struct adf_accel_dev *accel_dev);
151 int adf_send_admin_init(struct adf_accel_dev *accel_dev);
152 int adf_init_arb(struct adf_accel_dev *accel_dev);
153 void adf_exit_arb(struct adf_accel_dev *accel_dev);
154 void adf_update_ring_arb(struct adf_etr_ring_data *ring);
155
156 int adf_dev_get(struct adf_accel_dev *accel_dev);
157 void adf_dev_put(struct adf_accel_dev *accel_dev);
158 int adf_dev_in_use(struct adf_accel_dev *accel_dev);
159 int adf_init_etr_data(struct adf_accel_dev *accel_dev);
160 void adf_cleanup_etr_data(struct adf_accel_dev *accel_dev);
161 int qat_crypto_register(void);
162 int qat_crypto_unregister(void);
163 int qat_crypto_dev_config(struct adf_accel_dev *accel_dev);
164 struct qat_crypto_instance *qat_crypto_get_instance_node(int node);
165 void qat_crypto_put_instance(struct qat_crypto_instance *inst);
166 void qat_alg_callback(void *resp);
167 void qat_alg_asym_callback(void *resp);
168 int qat_algs_register(void);
169 void qat_algs_unregister(void);
170 int qat_asym_algs_register(void);
171 void qat_asym_algs_unregister(void);
172
173 int adf_isr_resource_alloc(struct adf_accel_dev *accel_dev);
174 void adf_isr_resource_free(struct adf_accel_dev *accel_dev);
175 int adf_vf_isr_resource_alloc(struct adf_accel_dev *accel_dev);
176 void adf_vf_isr_resource_free(struct adf_accel_dev *accel_dev);
177
178 int qat_hal_init(struct adf_accel_dev *accel_dev);
179 void qat_hal_deinit(struct icp_qat_fw_loader_handle *handle);
180 void qat_hal_start(struct icp_qat_fw_loader_handle *handle, unsigned char ae,
181 unsigned int ctx_mask);
182 void qat_hal_stop(struct icp_qat_fw_loader_handle *handle, unsigned char ae,
183 unsigned int ctx_mask);
184 void qat_hal_reset(struct icp_qat_fw_loader_handle *handle);
185 int qat_hal_clr_reset(struct icp_qat_fw_loader_handle *handle);
186 void qat_hal_set_live_ctx(struct icp_qat_fw_loader_handle *handle,
187 unsigned char ae, unsigned int ctx_mask);
188 int qat_hal_check_ae_active(struct icp_qat_fw_loader_handle *handle,
189 unsigned int ae);
190 int qat_hal_set_ae_lm_mode(struct icp_qat_fw_loader_handle *handle,
191 unsigned char ae, enum icp_qat_uof_regtype lm_type,
192 unsigned char mode);
193 int qat_hal_set_ae_ctx_mode(struct icp_qat_fw_loader_handle *handle,
194 unsigned char ae, unsigned char mode);
195 int qat_hal_set_ae_nn_mode(struct icp_qat_fw_loader_handle *handle,
196 unsigned char ae, unsigned char mode);
197 void qat_hal_set_pc(struct icp_qat_fw_loader_handle *handle,
198 unsigned char ae, unsigned int ctx_mask, unsigned int upc);
199 void qat_hal_wr_uwords(struct icp_qat_fw_loader_handle *handle,
200 unsigned char ae, unsigned int uaddr,
201 unsigned int words_num, uint64_t *uword);
202 void qat_hal_wr_umem(struct icp_qat_fw_loader_handle *handle, unsigned char ae,
203 unsigned int uword_addr, unsigned int words_num,
204 unsigned int *data);
205 int qat_hal_get_ins_num(void);
206 int qat_hal_batch_wr_lm(struct icp_qat_fw_loader_handle *handle,
207 unsigned char ae,
208 struct icp_qat_uof_batch_init *lm_init_header);
209 int qat_hal_init_gpr(struct icp_qat_fw_loader_handle *handle,
210 unsigned char ae, unsigned char ctx_mask,
211 enum icp_qat_uof_regtype reg_type,
212 unsigned short reg_num, unsigned int regdata);
213 int qat_hal_init_wr_xfer(struct icp_qat_fw_loader_handle *handle,
214 unsigned char ae, unsigned char ctx_mask,
215 enum icp_qat_uof_regtype reg_type,
216 unsigned short reg_num, unsigned int regdata);
217 int qat_hal_init_rd_xfer(struct icp_qat_fw_loader_handle *handle,
218 unsigned char ae, unsigned char ctx_mask,
219 enum icp_qat_uof_regtype reg_type,
220 unsigned short reg_num, unsigned int regdata);
221 int qat_hal_init_nn(struct icp_qat_fw_loader_handle *handle,
222 unsigned char ae, unsigned char ctx_mask,
223 unsigned short reg_num, unsigned int regdata);
224 int qat_hal_wr_lm(struct icp_qat_fw_loader_handle *handle,
225 unsigned char ae, unsigned short lm_addr, unsigned int value);
226 int qat_uclo_wr_all_uimage(struct icp_qat_fw_loader_handle *handle);
227 void qat_uclo_del_uof_obj(struct icp_qat_fw_loader_handle *handle);
228 int qat_uclo_wr_mimage(struct icp_qat_fw_loader_handle *handle, void *addr_ptr,
229 int mem_size);
230 int qat_uclo_map_obj(struct icp_qat_fw_loader_handle *handle,
231 void *addr_ptr, int mem_size);
232 #if defined(CONFIG_PCI_IOV)
233 int adf_sriov_configure(struct pci_dev *pdev, int numvfs);
234 void adf_disable_sriov(struct adf_accel_dev *accel_dev);
235 void adf_disable_vf2pf_interrupts(struct adf_accel_dev *accel_dev,
236 uint32_t vf_mask);
237 void adf_enable_vf2pf_interrupts(struct adf_accel_dev *accel_dev,
238 uint32_t vf_mask);
239 void adf_enable_pf2vf_interrupts(struct adf_accel_dev *accel_dev);
240 void adf_disable_pf2vf_interrupts(struct adf_accel_dev *accel_dev);
241
242 int adf_vf2pf_init(struct adf_accel_dev *accel_dev);
243 void adf_vf2pf_shutdown(struct adf_accel_dev *accel_dev);
244 int adf_init_pf_wq(void);
245 void adf_exit_pf_wq(void);
246 int adf_init_vf_wq(void);
247 void adf_exit_vf_wq(void);
248 #else
249 static inline int adf_sriov_configure(struct pci_dev *pdev, int numvfs)
250 {
251 return 0;
252 }
253
254 static inline void adf_disable_sriov(struct adf_accel_dev *accel_dev)
255 {
256 }
257
258 static inline void adf_enable_pf2vf_interrupts(struct adf_accel_dev *accel_dev)
259 {
260 }
261
262 static inline void adf_disable_pf2vf_interrupts(struct adf_accel_dev *accel_dev)
263 {
264 }
265
266 static inline int adf_vf2pf_init(struct adf_accel_dev *accel_dev)
267 {
268 return 0;
269 }
270
271 static inline void adf_vf2pf_shutdown(struct adf_accel_dev *accel_dev)
272 {
273 }
274
275 static inline int adf_init_pf_wq(void)
276 {
277 return 0;
278 }
279
280 static inline void adf_exit_pf_wq(void)
281 {
282 }
283
284 static inline int adf_init_vf_wq(void)
285 {
286 return 0;
287 }
288
289 static inline void adf_exit_vf_wq(void)
290 {
291 }
292
293 #endif
294 #endif