1
2
3
4
5
6
7#ifndef _QED_HW_H
8#define _QED_HW_H
9
10#include <linux/types.h>
11#include <linux/bitops.h>
12#include <linux/slab.h>
13#include <linux/string.h>
14#include "qed.h"
15#include "qed_dev_api.h"
16
17
18struct qed_ptt;
19
20enum reserved_ptts {
21 RESERVED_PTT_EDIAG,
22 RESERVED_PTT_USER_SPACE,
23 RESERVED_PTT_MAIN,
24 RESERVED_PTT_DPC,
25 RESERVED_PTT_MAX
26};
27
28enum _dmae_cmd_dst_mask {
29 DMAE_CMD_DST_MASK_NONE = 0,
30 DMAE_CMD_DST_MASK_PCIE = 1,
31 DMAE_CMD_DST_MASK_GRC = 2
32};
33
34enum _dmae_cmd_src_mask {
35 DMAE_CMD_SRC_MASK_PCIE = 0,
36 DMAE_CMD_SRC_MASK_GRC = 1
37};
38
39enum _dmae_cmd_crc_mask {
40 DMAE_CMD_COMP_CRC_EN_MASK_NONE = 0,
41 DMAE_CMD_COMP_CRC_EN_MASK_SET = 1
42};
43
44
45#define DMAE_GO_VALUE 0x1
46
47#define DMAE_COMPLETION_VAL 0xD1AE
48#define DMAE_CMD_ENDIANITY 0x2
49
50#define DMAE_CMD_SIZE 14
51#define DMAE_CMD_SIZE_TO_FILL (DMAE_CMD_SIZE - 5)
52#define DMAE_MIN_WAIT_TIME 0x2
53#define DMAE_MAX_CLIENTS 32
54
55
56
57
58
59
60void qed_gtt_init(struct qed_hwfn *p_hwfn);
61
62
63
64
65
66
67void qed_ptt_invalidate(struct qed_hwfn *p_hwfn);
68
69
70
71
72
73
74
75
76int qed_ptt_pool_alloc(struct qed_hwfn *p_hwfn);
77
78
79
80
81
82
83void qed_ptt_pool_free(struct qed_hwfn *p_hwfn);
84
85
86
87
88
89
90
91
92
93u32 qed_ptt_get_hw_addr(struct qed_hwfn *p_hwfn,
94 struct qed_ptt *p_ptt);
95
96
97
98
99
100
101
102
103
104u32 qed_ptt_get_bar_addr(struct qed_ptt *p_ptt);
105
106
107
108
109
110
111
112
113void qed_ptt_set_win(struct qed_hwfn *p_hwfn,
114 struct qed_ptt *p_ptt,
115 u32 new_hw_addr);
116
117
118
119
120
121
122
123
124
125struct qed_ptt *qed_get_reserved_ptt(struct qed_hwfn *p_hwfn,
126 enum reserved_ptts ptt_idx);
127
128
129
130
131
132
133
134
135
136void qed_wr(struct qed_hwfn *p_hwfn,
137 struct qed_ptt *p_ptt,
138 u32 hw_addr,
139 u32 val);
140
141
142
143
144
145
146
147
148
149u32 qed_rd(struct qed_hwfn *p_hwfn,
150 struct qed_ptt *p_ptt,
151 u32 hw_addr);
152
153
154
155
156
157
158
159
160
161
162
163void qed_memcpy_from(struct qed_hwfn *p_hwfn,
164 struct qed_ptt *p_ptt,
165 void *dest,
166 u32 hw_addr,
167 size_t n);
168
169
170
171
172
173
174
175
176
177
178
179void qed_memcpy_to(struct qed_hwfn *p_hwfn,
180 struct qed_ptt *p_ptt,
181 u32 hw_addr,
182 void *src,
183 size_t n);
184
185
186
187
188
189
190
191
192
193
194
195void qed_fid_pretend(struct qed_hwfn *p_hwfn,
196 struct qed_ptt *p_ptt,
197 u16 fid);
198
199
200
201
202
203
204
205
206
207void qed_port_pretend(struct qed_hwfn *p_hwfn,
208 struct qed_ptt *p_ptt,
209 u8 port_id);
210
211
212
213
214
215
216
217
218void qed_port_unpretend(struct qed_hwfn *p_hwfn,
219 struct qed_ptt *p_ptt);
220
221
222
223
224
225
226
227
228
229
230void qed_port_fid_pretend(struct qed_hwfn *p_hwfn,
231 struct qed_ptt *p_ptt, u8 port_id, u16 fid);
232
233
234
235
236
237
238
239
240
241u32 qed_vfid_to_concrete(struct qed_hwfn *p_hwfn, u8 vfid);
242
243
244
245
246
247
248u32 qed_dmae_idx_to_go_cmd(u8 idx);
249
250
251
252
253
254
255int qed_dmae_info_alloc(struct qed_hwfn *p_hwfn);
256
257
258
259
260
261
262
263void qed_dmae_info_free(struct qed_hwfn *p_hwfn);
264
265union qed_qm_pq_params {
266 struct {
267 u8 q_idx;
268 } iscsi;
269
270 struct {
271 u8 tc;
272 } core;
273
274 struct {
275 u8 is_vf;
276 u8 vf_id;
277 u8 tc;
278 } eth;
279
280 struct {
281 u8 dcqcn;
282 u8 qpid;
283 } roce;
284};
285
286int qed_init_fw_data(struct qed_dev *cdev,
287 const u8 *fw_data);
288
289int qed_dmae_sanity(struct qed_hwfn *p_hwfn,
290 struct qed_ptt *p_ptt, const char *phase);
291
292#define QED_HW_ERR_MAX_STR_SIZE 256
293
294
295
296
297
298
299
300
301
302
303
304void __printf(4, 5) __cold qed_hw_err_notify(struct qed_hwfn *p_hwfn,
305 struct qed_ptt *p_ptt,
306 enum qed_hw_err_type err_type,
307 const char *fmt, ...);
308#endif
309