1
2
3
4
5
6
7
8
9#ifndef _QED_INT_H
10#define _QED_INT_H
11
12#include <linux/types.h>
13#include <linux/slab.h>
14#include "qed.h"
15
16
17#define IGU_PF_CONF_FUNC_EN (0x1 << 0)
18#define IGU_PF_CONF_MSI_MSIX_EN (0x1 << 1)
19#define IGU_PF_CONF_INT_LINE_EN (0x1 << 2)
20#define IGU_PF_CONF_ATTN_BIT_EN (0x1 << 3)
21#define IGU_PF_CONF_SINGLE_ISR_EN (0x1 << 4)
22#define IGU_PF_CONF_SIMD_MODE (0x1 << 5)
23
24#define IGU_VF_CONF_FUNC_EN (0x1 << 0)
25#define IGU_VF_CONF_MSI_MSIX_EN (0x1 << 1)
26#define IGU_VF_CONF_SINGLE_ISR_EN (0x1 << 4)
27#define IGU_VF_CONF_PARENT_MASK (0xF)
28#define IGU_VF_CONF_PARENT_SHIFT 5
29
30
31
32enum igu_ctrl_cmd {
33 IGU_CTRL_CMD_TYPE_RD,
34 IGU_CTRL_CMD_TYPE_WR,
35 MAX_IGU_CTRL_CMD
36};
37
38
39
40struct igu_ctrl_reg {
41 u32 ctrl_data;
42#define IGU_CTRL_REG_FID_MASK 0xFFFF
43#define IGU_CTRL_REG_FID_SHIFT 0
44#define IGU_CTRL_REG_PXP_ADDR_MASK 0xFFF
45#define IGU_CTRL_REG_PXP_ADDR_SHIFT 16
46#define IGU_CTRL_REG_RESERVED_MASK 0x1
47#define IGU_CTRL_REG_RESERVED_SHIFT 28
48#define IGU_CTRL_REG_TYPE_MASK 0x1
49#define IGU_CTRL_REG_TYPE_SHIFT 31
50};
51
52enum qed_coalescing_fsm {
53 QED_COAL_RX_STATE_MACHINE,
54 QED_COAL_TX_STATE_MACHINE
55};
56
57
58
59
60
61
62
63
64
65
66
67
68void qed_int_cau_conf_pi(struct qed_hwfn *p_hwfn,
69 struct qed_ptt *p_ptt,
70 u16 igu_sb_id,
71 u32 pi_index,
72 enum qed_coalescing_fsm coalescing_fsm,
73 u8 timeset);
74
75
76
77
78
79
80
81
82void qed_int_igu_enable_int(struct qed_hwfn *p_hwfn,
83 struct qed_ptt *p_ptt,
84 enum qed_int_mode int_mode);
85
86
87
88
89
90
91
92void qed_int_igu_disable_int(struct qed_hwfn *p_hwfn,
93 struct qed_ptt *p_ptt);
94
95
96
97
98
99
100
101
102
103u64 qed_int_igu_read_sisr_reg(struct qed_hwfn *p_hwfn);
104
105#define QED_SP_SB_ID 0xffff
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122int qed_int_sb_init(struct qed_hwfn *p_hwfn,
123 struct qed_ptt *p_ptt,
124 struct qed_sb_info *sb_info,
125 void *sb_virt_addr,
126 dma_addr_t sb_phy_addr,
127 u16 sb_id);
128
129
130
131
132
133
134
135void qed_int_sb_setup(struct qed_hwfn *p_hwfn,
136 struct qed_ptt *p_ptt,
137 struct qed_sb_info *sb_info);
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152int qed_int_sb_release(struct qed_hwfn *p_hwfn,
153 struct qed_sb_info *sb_info,
154 u16 sb_id);
155
156
157
158
159
160
161
162
163void qed_int_sp_dpc(unsigned long hwfn_cookie);
164
165
166
167
168
169
170
171
172
173
174void qed_int_get_num_sbs(struct qed_hwfn *p_hwfn,
175 struct qed_sb_cnt_info *p_sb_cnt_info);
176
177
178
179
180
181
182
183
184
185void qed_int_disable_post_isr_release(struct qed_dev *cdev);
186
187#define QED_CAU_DEF_RX_TIMER_RES 0
188#define QED_CAU_DEF_TX_TIMER_RES 0
189
190#define QED_SB_ATT_IDX 0x0001
191#define QED_SB_EVENT_MASK 0x0003
192
193#define SB_ALIGNED_SIZE(p_hwfn) \
194 ALIGNED_TYPE_SIZE(struct status_block, p_hwfn)
195
196struct qed_igu_block {
197 u8 status;
198#define QED_IGU_STATUS_FREE 0x01
199#define QED_IGU_STATUS_VALID 0x02
200#define QED_IGU_STATUS_PF 0x04
201
202 u8 vector_number;
203 u8 function_id;
204 u8 is_pf;
205};
206
207struct qed_igu_map {
208 struct qed_igu_block igu_blocks[MAX_TOT_SB_PER_PATH];
209};
210
211struct qed_igu_info {
212 struct qed_igu_map igu_map;
213 u16 igu_dsb_id;
214 u16 igu_base_sb;
215 u16 igu_base_sb_iov;
216 u16 igu_sb_cnt;
217 u16 igu_sb_cnt_iov;
218 u16 free_blks;
219};
220
221
222void qed_int_igu_init_pure_rt(struct qed_hwfn *p_hwfn,
223 struct qed_ptt *p_ptt,
224 bool b_set,
225 bool b_slowpath);
226
227void qed_int_igu_init_rt(struct qed_hwfn *p_hwfn);
228
229
230
231
232
233
234
235
236
237
238
239
240int qed_int_igu_read_cam(struct qed_hwfn *p_hwfn,
241 struct qed_ptt *p_ptt);
242
243typedef int (*qed_int_comp_cb_t)(struct qed_hwfn *p_hwfn,
244 void *cookie);
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265int qed_int_register_cb(struct qed_hwfn *p_hwfn,
266 qed_int_comp_cb_t comp_cb,
267 void *cookie,
268 u8 *sb_idx,
269 __le16 **p_fw_cons);
270
271
272
273
274
275
276
277
278
279
280
281
282int qed_int_unregister_cb(struct qed_hwfn *p_hwfn,
283 u8 pi);
284
285
286
287
288
289
290
291
292u16 qed_int_get_sp_sb_id(struct qed_hwfn *p_hwfn);
293
294
295
296
297
298
299
300
301
302
303
304void qed_int_igu_init_pure_rt_single(struct qed_hwfn *p_hwfn,
305 struct qed_ptt *p_ptt,
306 u32 sb_id,
307 u16 opaque,
308 bool b_set);
309
310
311
312
313
314
315
316
317
318
319
320
321void qed_int_cau_conf_sb(struct qed_hwfn *p_hwfn,
322 struct qed_ptt *p_ptt,
323 dma_addr_t sb_phys,
324 u16 igu_sb_id,
325 u16 vf_number,
326 u8 vf_valid);
327
328
329
330
331
332
333
334
335
336int qed_int_alloc(struct qed_hwfn *p_hwfn,
337 struct qed_ptt *p_ptt);
338
339
340
341
342
343
344void qed_int_free(struct qed_hwfn *p_hwfn);
345
346
347
348
349
350
351
352void qed_int_setup(struct qed_hwfn *p_hwfn,
353 struct qed_ptt *p_ptt);
354
355
356
357
358
359
360
361
362
363u16 qed_int_queue_id_from_sb_id(struct qed_hwfn *p_hwfn, u16 sb_id);
364
365
366
367
368
369
370
371
372
373
374int qed_int_igu_enable(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
375 enum qed_int_mode int_mode);
376
377
378
379
380
381
382
383
384
385
386void qed_init_cau_sb_entry(struct qed_hwfn *p_hwfn,
387 struct cau_sb_entry *p_sb_entry,
388 u8 pf_id,
389 u16 vf_number,
390 u8 vf_valid);
391
392int qed_int_set_timer_res(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
393 u8 timer_res, u16 sb_id, bool tx);
394
395#define QED_MAPPING_MEMORY_SIZE(dev) (NUM_OF_SBS(dev))
396
397#endif
398