0001
0002
0003
0004
0005
0006
0007 #ifndef _QED_INT_H
0008 #define _QED_INT_H
0009
0010 #include <linux/types.h>
0011 #include <linux/slab.h>
0012 #include "qed.h"
0013
0014
0015 #define IGU_PF_CONF_FUNC_EN (0x1 << 0)
0016 #define IGU_PF_CONF_MSI_MSIX_EN (0x1 << 1)
0017 #define IGU_PF_CONF_INT_LINE_EN (0x1 << 2)
0018 #define IGU_PF_CONF_ATTN_BIT_EN (0x1 << 3)
0019 #define IGU_PF_CONF_SINGLE_ISR_EN (0x1 << 4)
0020 #define IGU_PF_CONF_SIMD_MODE (0x1 << 5)
0021
0022 #define IGU_VF_CONF_FUNC_EN (0x1 << 0)
0023 #define IGU_VF_CONF_MSI_MSIX_EN (0x1 << 1)
0024 #define IGU_VF_CONF_SINGLE_ISR_EN (0x1 << 4)
0025 #define IGU_VF_CONF_PARENT_MASK (0xF)
0026 #define IGU_VF_CONF_PARENT_SHIFT 5
0027
0028
0029
0030 enum igu_ctrl_cmd {
0031 IGU_CTRL_CMD_TYPE_RD,
0032 IGU_CTRL_CMD_TYPE_WR,
0033 MAX_IGU_CTRL_CMD
0034 };
0035
0036
0037
0038 struct igu_ctrl_reg {
0039 u32 ctrl_data;
0040 #define IGU_CTRL_REG_FID_MASK 0xFFFF
0041 #define IGU_CTRL_REG_FID_SHIFT 0
0042 #define IGU_CTRL_REG_PXP_ADDR_MASK 0xFFF
0043 #define IGU_CTRL_REG_PXP_ADDR_SHIFT 16
0044 #define IGU_CTRL_REG_RESERVED_MASK 0x1
0045 #define IGU_CTRL_REG_RESERVED_SHIFT 28
0046 #define IGU_CTRL_REG_TYPE_MASK 0x1
0047 #define IGU_CTRL_REG_TYPE_SHIFT 31
0048 };
0049
0050 enum qed_coalescing_fsm {
0051 QED_COAL_RX_STATE_MACHINE,
0052 QED_COAL_TX_STATE_MACHINE
0053 };
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064 void qed_int_igu_enable_int(struct qed_hwfn *p_hwfn,
0065 struct qed_ptt *p_ptt,
0066 enum qed_int_mode int_mode);
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076 void qed_int_igu_disable_int(struct qed_hwfn *p_hwfn,
0077 struct qed_ptt *p_ptt);
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087 u64 qed_int_igu_read_sisr_reg(struct qed_hwfn *p_hwfn);
0088
0089 #define QED_SP_SB_ID 0xffff
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105 int qed_int_sb_init(struct qed_hwfn *p_hwfn,
0106 struct qed_ptt *p_ptt,
0107 struct qed_sb_info *sb_info,
0108 void *sb_virt_addr,
0109 dma_addr_t sb_phy_addr,
0110 u16 sb_id);
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120 void qed_int_sb_setup(struct qed_hwfn *p_hwfn,
0121 struct qed_ptt *p_ptt,
0122 struct qed_sb_info *sb_info);
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137 int qed_int_sb_release(struct qed_hwfn *p_hwfn,
0138 struct qed_sb_info *sb_info,
0139 u16 sb_id);
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150 void qed_int_sp_dpc(struct tasklet_struct *t);
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161 void qed_int_get_num_sbs(struct qed_hwfn *p_hwfn,
0162 struct qed_sb_cnt_info *p_sb_cnt_info);
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173 void qed_int_disable_post_isr_release(struct qed_dev *cdev);
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186 void qed_int_attn_clr_enable(struct qed_dev *cdev, bool clr_enable);
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198 int qed_int_get_sb_dbg(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
0199 struct qed_sb_info *p_sb, struct qed_sb_info_dbg *p_info);
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209
0210
0211 int qed_db_rec_handler(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);
0212
0213 #define QED_CAU_DEF_RX_TIMER_RES 0
0214 #define QED_CAU_DEF_TX_TIMER_RES 0
0215
0216 #define QED_SB_ATT_IDX 0x0001
0217 #define QED_SB_EVENT_MASK 0x0003
0218
0219 #define SB_ALIGNED_SIZE(p_hwfn) \
0220 ALIGNED_TYPE_SIZE(struct status_block, p_hwfn)
0221
0222 #define QED_SB_INVALID_IDX 0xffff
0223
0224 struct qed_igu_block {
0225 u8 status;
0226 #define QED_IGU_STATUS_FREE 0x01
0227 #define QED_IGU_STATUS_VALID 0x02
0228 #define QED_IGU_STATUS_PF 0x04
0229 #define QED_IGU_STATUS_DSB 0x08
0230
0231 u8 vector_number;
0232 u8 function_id;
0233 u8 is_pf;
0234
0235
0236 u16 igu_sb_id;
0237
0238 struct qed_sb_info *sb_info;
0239 };
0240
0241 struct qed_igu_info {
0242 struct qed_igu_block entry[MAX_TOT_SB_PER_PATH];
0243 u16 igu_dsb_id;
0244
0245 struct qed_sb_cnt_info usage;
0246
0247 bool b_allow_pf_vf_change;
0248 };
0249
0250
0251
0252
0253
0254
0255
0256
0257
0258
0259 int qed_int_igu_reset_cam(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269
0270 u16 qed_get_igu_sb_id(struct qed_hwfn *p_hwfn, u16 sb_id);
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280 struct qed_igu_block *qed_get_igu_free_sb(struct qed_hwfn *p_hwfn,
0281 bool b_is_pf);
0282
0283 void qed_int_igu_init_pure_rt(struct qed_hwfn *p_hwfn,
0284 struct qed_ptt *p_ptt,
0285 bool b_set,
0286 bool b_slowpath);
0287
0288 void qed_int_igu_init_rt(struct qed_hwfn *p_hwfn);
0289
0290
0291
0292
0293
0294
0295
0296
0297
0298
0299
0300
0301 int qed_int_igu_read_cam(struct qed_hwfn *p_hwfn,
0302 struct qed_ptt *p_ptt);
0303
0304 typedef int (*qed_int_comp_cb_t)(struct qed_hwfn *p_hwfn,
0305 void *cookie);
0306
0307
0308
0309
0310
0311
0312
0313
0314
0315
0316
0317
0318
0319
0320
0321
0322
0323
0324 int qed_int_register_cb(struct qed_hwfn *p_hwfn,
0325 qed_int_comp_cb_t comp_cb,
0326 void *cookie,
0327 u8 *sb_idx,
0328 __le16 **p_fw_cons);
0329
0330
0331
0332
0333
0334
0335
0336
0337
0338
0339
0340
0341 int qed_int_unregister_cb(struct qed_hwfn *p_hwfn,
0342 u8 pi);
0343
0344
0345
0346
0347
0348
0349
0350
0351 u16 qed_int_get_sp_sb_id(struct qed_hwfn *p_hwfn);
0352
0353
0354
0355
0356
0357
0358
0359
0360
0361
0362
0363
0364
0365
0366 void qed_int_igu_init_pure_rt_single(struct qed_hwfn *p_hwfn,
0367 struct qed_ptt *p_ptt,
0368 u16 igu_sb_id,
0369 u16 opaque,
0370 bool b_set);
0371
0372
0373
0374
0375
0376
0377
0378
0379
0380
0381
0382
0383
0384 void qed_int_cau_conf_sb(struct qed_hwfn *p_hwfn,
0385 struct qed_ptt *p_ptt,
0386 dma_addr_t sb_phys,
0387 u16 igu_sb_id,
0388 u16 vf_number,
0389 u8 vf_valid);
0390
0391
0392
0393
0394
0395
0396
0397
0398
0399 int qed_int_alloc(struct qed_hwfn *p_hwfn,
0400 struct qed_ptt *p_ptt);
0401
0402
0403
0404
0405
0406
0407
0408
0409 void qed_int_free(struct qed_hwfn *p_hwfn);
0410
0411
0412
0413
0414
0415
0416
0417
0418
0419 void qed_int_setup(struct qed_hwfn *p_hwfn,
0420 struct qed_ptt *p_ptt);
0421
0422
0423
0424
0425
0426
0427
0428
0429
0430
0431 int qed_int_igu_enable(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
0432 enum qed_int_mode int_mode);
0433
0434
0435
0436
0437
0438
0439
0440
0441
0442
0443
0444
0445 void qed_init_cau_sb_entry(struct qed_hwfn *p_hwfn,
0446 struct cau_sb_entry *p_sb_entry,
0447 u8 pf_id,
0448 u16 vf_number,
0449 u8 vf_valid);
0450
0451 int qed_int_set_timer_res(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
0452 u8 timer_res, u16 sb_id, bool tx);
0453
0454 #define QED_MAPPING_MEMORY_SIZE(dev) (NUM_OF_SBS(dev))
0455
0456 int qed_pglueb_rbc_attn_handler(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
0457 bool hw_init);
0458
0459 #endif