1
2
3
4
5
6
7#ifndef __ECORE_MCP_H__
8#define __ECORE_MCP_H__
9
10#include "bcm_osal.h"
11#include "mcp_public.h"
12#include "ecore.h"
13#include "ecore_mcp_api.h"
14#include "ecore_dev_api.h"
15
16
17
18
19
20
21
22#define MCP_PF_ID_BY_REL(p_hwfn, rel_pfid) (ECORE_IS_BB((p_hwfn)->p_dev) ? \
23 ((rel_pfid) | \
24 ((p_hwfn)->abs_pf_id & 1) << 3) : \
25 rel_pfid)
26#define MCP_PF_ID(p_hwfn) MCP_PF_ID_BY_REL(p_hwfn, (p_hwfn)->rel_pf_id)
27
28struct ecore_mcp_info {
29
30 osal_list_t cmd_list;
31
32
33
34
35 osal_spinlock_t cmd_lock;
36
37
38 bool b_block_cmd;
39
40
41
42
43 osal_spinlock_t link_lock;
44
45
46 u32 public_base;
47
48 u32 drv_mb_addr;
49
50 u32 mfw_mb_addr;
51
52 u32 port_addr;
53
54
55 u16 drv_mb_seq;
56
57 u16 drv_pulse_seq;
58
59 struct ecore_mcp_link_params link_input;
60 struct ecore_mcp_link_state link_output;
61 struct ecore_mcp_link_capabilities link_capabilities;
62
63 struct ecore_mcp_function_info func_info;
64
65 u8 *mfw_mb_cur;
66 u8 *mfw_mb_shadow;
67 u16 mfw_mb_length;
68 u32 mcp_hist;
69
70
71 u32 capabilities;
72};
73
74struct ecore_mcp_mb_params {
75 u32 cmd;
76 u32 param;
77 void *p_data_src;
78 void *p_data_dst;
79 u32 mcp_resp;
80 u32 mcp_param;
81 u8 data_src_size;
82 u8 data_dst_size;
83 u32 flags;
84#define ECORE_MB_FLAG_CAN_SLEEP (0x1 << 0)
85#define ECORE_MB_FLAG_AVOID_BLOCK (0x1 << 1)
86#define ECORE_MB_FLAGS_IS_SET(params, flag) \
87 ((params) != OSAL_NULL && ((params)->flags & ECORE_MB_FLAG_##flag))
88};
89
90struct ecore_drv_tlv_hdr {
91 u8 tlv_type;
92 u8 tlv_length;
93 u8 tlv_reserved;
94#define ECORE_DRV_TLV_FLAGS_CHANGED 0x01
95 u8 tlv_flags;
96};
97
98
99
100
101
102
103
104
105
106enum _ecore_status_t ecore_mcp_cmd_init(struct ecore_hwfn *p_hwfn,
107 struct ecore_ptt *p_ptt);
108
109
110
111
112
113
114
115
116void ecore_mcp_cmd_port_init(struct ecore_hwfn *p_hwfn,
117 struct ecore_ptt *p_ptt);
118
119
120
121
122
123
124
125
126
127enum _ecore_status_t ecore_mcp_free(struct ecore_hwfn *p_hwfn);
128
129
130
131
132
133
134
135
136
137
138
139
140
141enum _ecore_status_t ecore_mcp_handle_events(struct ecore_hwfn *p_hwfn,
142 struct ecore_ptt *p_ptt);
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158enum _ecore_status_t ecore_issue_pulse(struct ecore_hwfn *p_hwfn,
159 struct ecore_ptt *p_ptt);
160
161enum ecore_drv_role {
162 ECORE_DRV_ROLE_OS,
163 ECORE_DRV_ROLE_KDUMP,
164};
165
166struct ecore_load_req_params {
167
168 enum ecore_drv_role drv_role;
169 u8 timeout_val;
170 bool avoid_eng_reset;
171 enum ecore_override_force_load override_force_load;
172
173
174 u32 load_code;
175};
176
177
178
179
180
181
182
183
184
185
186
187enum _ecore_status_t ecore_mcp_load_req(struct ecore_hwfn *p_hwfn,
188 struct ecore_ptt *p_ptt,
189 struct ecore_load_req_params *p_params);
190
191
192
193
194
195
196
197
198
199enum _ecore_status_t ecore_mcp_load_done(struct ecore_hwfn *p_hwfn,
200 struct ecore_ptt *p_ptt);
201
202
203
204
205
206
207
208
209
210enum _ecore_status_t ecore_mcp_unload_req(struct ecore_hwfn *p_hwfn,
211 struct ecore_ptt *p_ptt);
212
213
214
215
216
217
218
219
220
221enum _ecore_status_t ecore_mcp_unload_done(struct ecore_hwfn *p_hwfn,
222 struct ecore_ptt *p_ptt);
223
224
225
226
227
228
229
230void ecore_mcp_read_mb(struct ecore_hwfn *p_hwfn,
231 struct ecore_ptt *p_ptt);
232
233
234
235
236
237
238
239
240
241
242enum _ecore_status_t ecore_mcp_ack_vf_flr(struct ecore_hwfn *p_hwfn,
243 struct ecore_ptt *p_ptt,
244 u32 *vfs_to_ack);
245
246
247
248
249
250
251
252
253enum _ecore_status_t ecore_mcp_fill_shmem_func_info(struct ecore_hwfn *p_hwfn,
254 struct ecore_ptt *p_ptt);
255
256
257
258
259
260
261
262
263
264enum _ecore_status_t ecore_mcp_reset(struct ecore_hwfn *p_hwfn,
265 struct ecore_ptt *p_ptt);
266
267
268
269
270
271
272
273
274bool ecore_mcp_is_init(struct ecore_hwfn *p_hwfn);
275
276
277
278
279
280
281
282
283
284
285
286enum _ecore_status_t ecore_mcp_config_vf_msix(struct ecore_hwfn *p_hwfn,
287 struct ecore_ptt *p_ptt,
288 u8 vf_id, u8 num);
289
290
291
292
293
294
295
296
297
298enum _ecore_status_t ecore_mcp_halt(struct ecore_hwfn *p_hwfn,
299 struct ecore_ptt *p_ptt);
300
301
302
303
304
305
306
307
308
309enum _ecore_status_t ecore_mcp_resume(struct ecore_hwfn *p_hwfn,
310 struct ecore_ptt *p_ptt);
311int __ecore_configure_pf_max_bandwidth(struct ecore_hwfn *p_hwfn,
312 struct ecore_ptt *p_ptt,
313 struct ecore_mcp_link_state *p_link,
314 u8 max_bw);
315int __ecore_configure_pf_min_bandwidth(struct ecore_hwfn *p_hwfn,
316 struct ecore_ptt *p_ptt,
317 struct ecore_mcp_link_state *p_link,
318 u8 min_bw);
319enum _ecore_status_t ecore_mcp_mask_parities(struct ecore_hwfn *p_hwfn,
320 struct ecore_ptt *p_ptt,
321 u32 mask_parities);
322
323
324
325
326
327
328
329
330enum _ecore_status_t ecore_mcp_mdump_set_values(struct ecore_hwfn *p_hwfn,
331 struct ecore_ptt *p_ptt,
332 u32 epoch);
333
334
335
336
337
338
339
340
341
342
343enum _ecore_status_t ecore_mcp_mdump_trigger(struct ecore_hwfn *p_hwfn,
344 struct ecore_ptt *p_ptt);
345
346struct ecore_mdump_retain_data {
347 u32 valid;
348 u32 epoch;
349 u32 pf;
350 u32 status;
351};
352
353
354
355
356
357
358
359
360
361
362enum _ecore_status_t
363ecore_mcp_mdump_get_retain(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
364 struct ecore_mdump_retain_data *p_mdump_retain);
365
366
367
368
369
370
371
372
373
374
375
376
377enum _ecore_status_t
378ecore_mcp_set_resc_max_val(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
379 enum ecore_resources res_id, u32 resc_max_val,
380 u32 *p_mcp_resp);
381
382
383
384
385
386
387
388
389
390
391
392
393
394enum _ecore_status_t
395ecore_mcp_get_resc_info(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
396 enum ecore_resources res_id, u32 *p_mcp_resp,
397 u32 *p_resc_num, u32 *p_resc_start);
398
399
400
401
402
403
404
405
406
407enum _ecore_status_t ecore_mcp_initiate_pf_flr(struct ecore_hwfn *p_hwfn,
408 struct ecore_ptt *p_ptt);
409
410#define ECORE_MCP_RESC_LOCK_MIN_VAL RESOURCE_DUMP
411#define ECORE_MCP_RESC_LOCK_MAX_VAL 31
412
413enum ecore_resc_lock {
414 ECORE_RESC_LOCK_DBG_DUMP = ECORE_MCP_RESC_LOCK_MIN_VAL,
415
416
417
418 ECORE_RESC_LOCK_RESC_ALLOC = ECORE_MCP_RESC_LOCK_MAX_VAL,
419
420
421
422
423 ECORE_RESC_LOCK_RESC_INVALID,
424};
425
426struct ecore_resc_lock_params {
427
428 u8 resource;
429
430
431 u8 timeout;
432#define ECORE_MCP_RESC_LOCK_TO_DEFAULT 0
433#define ECORE_MCP_RESC_LOCK_TO_NONE 255
434
435
436 u8 retry_num;
437#define ECORE_MCP_RESC_LOCK_RETRY_CNT_DFLT 10
438
439
440 u16 retry_interval;
441#define ECORE_MCP_RESC_LOCK_RETRY_VAL_DFLT 10000
442
443
444 bool sleep_b4_retry;
445
446
447 bool b_granted;
448
449
450
451
452 u8 owner;
453};
454
455
456
457
458
459
460
461
462
463
464enum _ecore_status_t
465ecore_mcp_resc_lock(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
466 struct ecore_resc_lock_params *p_params);
467
468struct ecore_resc_unlock_params {
469
470 u8 resource;
471
472
473 bool b_force;
474
475
476 bool b_released;
477};
478
479
480
481
482
483
484
485
486
487
488enum _ecore_status_t
489ecore_mcp_resc_unlock(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
490 struct ecore_resc_unlock_params *p_params);
491
492
493
494
495
496
497
498
499
500void ecore_mcp_resc_lock_default_init(struct ecore_resc_lock_params *p_lock,
501 struct ecore_resc_unlock_params *p_unlock,
502 enum ecore_resc_lock resource,
503 bool b_is_permanent);
504
505
506
507
508
509
510
511enum _ecore_status_t ecore_mcp_get_capabilities(struct ecore_hwfn *p_hwfn,
512 struct ecore_ptt *p_ptt);
513
514
515
516
517
518
519
520
521enum _ecore_status_t ecore_mcp_set_capabilities(struct ecore_hwfn *p_hwfn,
522 struct ecore_ptt *p_ptt);
523
524enum ecore_mcp_drv_attr_cmd {
525 ECORE_MCP_DRV_ATTR_CMD_READ,
526 ECORE_MCP_DRV_ATTR_CMD_WRITE,
527 ECORE_MCP_DRV_ATTR_CMD_READ_CLEAR,
528 ECORE_MCP_DRV_ATTR_CMD_CLEAR,
529};
530
531struct ecore_mcp_drv_attr {
532 enum ecore_mcp_drv_attr_cmd attr_cmd;
533 u32 attr_num;
534
535
536
537
538
539 u32 val;
540
541
542
543
544 u32 mask;
545 u32 offset;
546};
547
548
549
550
551
552
553
554
555enum _ecore_status_t
556ecore_mcp_drv_attribute(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
557 struct ecore_mcp_drv_attr *p_drv_attr);
558
559
560
561
562
563
564
565void
566ecore_mcp_read_ufp_config(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt);
567
568void ecore_mcp_wol_wr(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
569 u32 offset, u32 val);
570
571
572
573
574
575
576
577enum _ecore_status_t ecore_mcp_get_engine_config(struct ecore_hwfn *p_hwfn,
578 struct ecore_ptt *p_ptt);
579
580
581
582
583
584
585
586enum _ecore_status_t ecore_mcp_get_ppfid_bitmap(struct ecore_hwfn *p_hwfn,
587 struct ecore_ptt *p_ptt);
588
589#endif
590