0001
0002
0003
0004
0005
0006
0007 #ifndef _QED_HW_H
0008 #define _QED_HW_H
0009
0010 #include <linux/types.h>
0011 #include <linux/bitops.h>
0012 #include <linux/slab.h>
0013 #include <linux/string.h>
0014 #include "qed.h"
0015 #include "qed_dev_api.h"
0016
0017
0018 struct qed_ptt;
0019
0020 enum reserved_ptts {
0021 RESERVED_PTT_EDIAG,
0022 RESERVED_PTT_USER_SPACE,
0023 RESERVED_PTT_MAIN,
0024 RESERVED_PTT_DPC,
0025 RESERVED_PTT_MAX
0026 };
0027
0028 enum _dmae_cmd_dst_mask {
0029 DMAE_CMD_DST_MASK_NONE = 0,
0030 DMAE_CMD_DST_MASK_PCIE = 1,
0031 DMAE_CMD_DST_MASK_GRC = 2
0032 };
0033
0034 enum _dmae_cmd_src_mask {
0035 DMAE_CMD_SRC_MASK_PCIE = 0,
0036 DMAE_CMD_SRC_MASK_GRC = 1
0037 };
0038
0039 enum _dmae_cmd_crc_mask {
0040 DMAE_CMD_COMP_CRC_EN_MASK_NONE = 0,
0041 DMAE_CMD_COMP_CRC_EN_MASK_SET = 1
0042 };
0043
0044
0045 #define DMAE_GO_VALUE 0x1
0046
0047 #define DMAE_COMPLETION_VAL 0xD1AE
0048 #define DMAE_CMD_ENDIANITY 0x2
0049
0050 #define DMAE_CMD_SIZE 14
0051 #define DMAE_CMD_SIZE_TO_FILL (DMAE_CMD_SIZE - 5)
0052 #define DMAE_MIN_WAIT_TIME 0x2
0053 #define DMAE_MAX_CLIENTS 32
0054
0055
0056
0057
0058
0059
0060
0061
0062 void qed_gtt_init(struct qed_hwfn *p_hwfn);
0063
0064
0065
0066
0067
0068
0069
0070
0071 void qed_ptt_invalidate(struct qed_hwfn *p_hwfn);
0072
0073
0074
0075
0076
0077
0078
0079
0080 int qed_ptt_pool_alloc(struct qed_hwfn *p_hwfn);
0081
0082
0083
0084
0085
0086
0087
0088
0089 void qed_ptt_pool_free(struct qed_hwfn *p_hwfn);
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099 u32 qed_ptt_get_hw_addr(struct qed_hwfn *p_hwfn,
0100 struct qed_ptt *p_ptt);
0101
0102
0103
0104
0105
0106
0107
0108
0109 u32 qed_ptt_get_bar_addr(struct qed_ptt *p_ptt);
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120 void qed_ptt_set_win(struct qed_hwfn *p_hwfn,
0121 struct qed_ptt *p_ptt,
0122 u32 new_hw_addr);
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132 struct qed_ptt *qed_get_reserved_ptt(struct qed_hwfn *p_hwfn,
0133 enum reserved_ptts ptt_idx);
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145 void qed_wr(struct qed_hwfn *p_hwfn,
0146 struct qed_ptt *p_ptt,
0147 u32 hw_addr,
0148 u32 val);
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159 u32 qed_rd(struct qed_hwfn *p_hwfn,
0160 struct qed_ptt *p_ptt,
0161 u32 hw_addr);
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174 void qed_memcpy_from(struct qed_hwfn *p_hwfn,
0175 struct qed_ptt *p_ptt,
0176 void *dest,
0177 u32 hw_addr,
0178 size_t n);
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191 void qed_memcpy_to(struct qed_hwfn *p_hwfn,
0192 struct qed_ptt *p_ptt,
0193 u32 hw_addr,
0194 void *src,
0195 size_t n);
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209 void qed_fid_pretend(struct qed_hwfn *p_hwfn,
0210 struct qed_ptt *p_ptt,
0211 u16 fid);
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222 void qed_port_pretend(struct qed_hwfn *p_hwfn,
0223 struct qed_ptt *p_ptt,
0224 u8 port_id);
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234 void qed_port_unpretend(struct qed_hwfn *p_hwfn,
0235 struct qed_ptt *p_ptt);
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248 void qed_port_fid_pretend(struct qed_hwfn *p_hwfn,
0249 struct qed_ptt *p_ptt, u8 port_id, u16 fid);
0250
0251
0252
0253
0254
0255
0256
0257
0258
0259 u32 qed_vfid_to_concrete(struct qed_hwfn *p_hwfn, u8 vfid);
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269 u32 qed_dmae_idx_to_go_cmd(u8 idx);
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279 int qed_dmae_info_alloc(struct qed_hwfn *p_hwfn);
0280
0281
0282
0283
0284
0285
0286
0287
0288
0289 void qed_dmae_info_free(struct qed_hwfn *p_hwfn);
0290
0291 union qed_qm_pq_params {
0292 struct {
0293 u8 q_idx;
0294 } iscsi;
0295
0296 struct {
0297 u8 tc;
0298 } core;
0299
0300 struct {
0301 u8 is_vf;
0302 u8 vf_id;
0303 u8 tc;
0304 } eth;
0305
0306 struct {
0307 u8 dcqcn;
0308 u8 qpid;
0309 } roce;
0310 };
0311
0312 int qed_init_fw_data(struct qed_dev *cdev,
0313 const u8 *fw_data);
0314
0315 int qed_dmae_sanity(struct qed_hwfn *p_hwfn,
0316 struct qed_ptt *p_ptt, const char *phase);
0317
0318 #define QED_HW_ERR_MAX_STR_SIZE 256
0319
0320
0321
0322
0323
0324
0325
0326
0327
0328
0329
0330
0331
0332 void __printf(4, 5) __cold qed_hw_err_notify(struct qed_hwfn *p_hwfn,
0333 struct qed_ptt *p_ptt,
0334 enum qed_hw_err_type err_type,
0335 const char *fmt, ...);
0336 #endif