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