net/qede/base: remove helper functions/structures
[dpdk.git] / drivers / net / qede / base / ecore_mcp_api.h
1 /*
2  * Copyright (c) 2016 QLogic Corporation.
3  * All rights reserved.
4  * www.qlogic.com
5  *
6  * See LICENSE.qede_pmd for copyright and licensing details.
7  */
8
9 #ifndef __ECORE_MCP_API_H__
10 #define __ECORE_MCP_API_H__
11
12 #include "ecore_status.h"
13
14 struct ecore_mcp_link_speed_params {
15         bool autoneg;
16         u32 advertised_speeds; /* bitmask of DRV_SPEED_CAPABILITY */
17         u32 forced_speed; /* In Mb/s */
18 };
19
20 struct ecore_mcp_link_pause_params {
21         bool autoneg;
22         bool forced_rx;
23         bool forced_tx;
24 };
25
26 enum ecore_mcp_eee_mode {
27         ECORE_MCP_EEE_DISABLED,
28         ECORE_MCP_EEE_ENABLED,
29         ECORE_MCP_EEE_UNSUPPORTED
30 };
31
32 struct ecore_link_eee_params {
33         u32 tx_lpi_timer;
34 #define ECORE_EEE_1G_ADV        (1 << 0)
35 #define ECORE_EEE_10G_ADV       (1 << 1)
36         /* Capabilities are represented using ECORE_EEE_*_ADV values */
37         u8 adv_caps;
38         u8 lp_adv_caps;
39         bool enable;
40         bool tx_lpi_enable;
41 };
42
43 struct ecore_mcp_link_params {
44         struct ecore_mcp_link_speed_params speed;
45         struct ecore_mcp_link_pause_params pause;
46         u32 loopback_mode; /* in PMM_LOOPBACK values */
47         struct ecore_link_eee_params eee;
48 };
49
50 struct ecore_mcp_link_capabilities {
51         u32 speed_capabilities;
52         bool default_speed_autoneg; /* In Mb/s */
53         u32 default_speed; /* In Mb/s */
54         enum ecore_mcp_eee_mode default_eee;
55         u32 eee_lpi_timer;
56         u8 eee_speed_caps;
57 };
58
59 struct ecore_mcp_link_state {
60         bool link_up;
61
62         u32 line_speed; /* In Mb/s */
63         u32 min_pf_rate; /* In Mb/s */
64         u32 speed; /* In Mb/s */
65         bool full_duplex;
66
67         bool an;
68         bool an_complete;
69         bool parallel_detection;
70         bool pfc_enabled;
71
72 #define ECORE_LINK_PARTNER_SPEED_1G_HD  (1 << 0)
73 #define ECORE_LINK_PARTNER_SPEED_1G_FD  (1 << 1)
74 #define ECORE_LINK_PARTNER_SPEED_10G    (1 << 2)
75 #define ECORE_LINK_PARTNER_SPEED_20G    (1 << 3)
76 #define ECORE_LINK_PARTNER_SPEED_25G    (1 << 4)
77 #define ECORE_LINK_PARTNER_SPEED_40G    (1 << 5)
78 #define ECORE_LINK_PARTNER_SPEED_50G    (1 << 6)
79 #define ECORE_LINK_PARTNER_SPEED_100G   (1 << 7)
80         u32 partner_adv_speed;
81
82         bool partner_tx_flow_ctrl_en;
83         bool partner_rx_flow_ctrl_en;
84
85 #define ECORE_LINK_PARTNER_SYMMETRIC_PAUSE (1)
86 #define ECORE_LINK_PARTNER_ASYMMETRIC_PAUSE (2)
87 #define ECORE_LINK_PARTNER_BOTH_PAUSE (3)
88         u8 partner_adv_pause;
89
90         bool sfp_tx_fault;
91
92         bool eee_active;
93         u8 eee_adv_caps;
94         u8 eee_lp_adv_caps;
95 };
96
97 struct ecore_mcp_function_info {
98         u8 pause_on_host;
99
100         enum ecore_pci_personality protocol;
101
102         u8 bandwidth_min;
103         u8 bandwidth_max;
104
105         u8 mac[ETH_ALEN];
106
107         u64 wwn_port;
108         u64 wwn_node;
109
110 #define ECORE_MCP_VLAN_UNSET            (0xffff)
111         u16 ovlan;
112
113         u16 mtu;
114 };
115
116 #ifndef __EXTRACT__LINUX__
117 enum ecore_nvm_images {
118         ECORE_NVM_IMAGE_ISCSI_CFG,
119         ECORE_NVM_IMAGE_FCOE_CFG,
120 };
121 #endif
122
123 struct ecore_mcp_drv_version {
124         u32 version;
125         u8 name[MCP_DRV_VER_STR_SIZE - 4];
126 };
127
128 struct ecore_mcp_lan_stats {
129         u64 ucast_rx_pkts;
130         u64 ucast_tx_pkts;
131         u32 fcs_err;
132 };
133
134 #ifndef ECORE_PROTO_STATS
135 #define ECORE_PROTO_STATS
136 struct ecore_mcp_fcoe_stats {
137         u64 rx_pkts;
138         u64 tx_pkts;
139         u32 fcs_err;
140         u32 login_failure;
141 };
142
143 struct ecore_mcp_iscsi_stats {
144         u64 rx_pdus;
145         u64 tx_pdus;
146         u64 rx_bytes;
147         u64 tx_bytes;
148 };
149
150 struct ecore_mcp_rdma_stats {
151         u64 rx_pkts;
152         u64 tx_pkts;
153         u64 rx_bytes;
154         u64 tx_byts;
155 };
156
157 enum ecore_mcp_protocol_type {
158         ECORE_MCP_LAN_STATS,
159         ECORE_MCP_FCOE_STATS,
160         ECORE_MCP_ISCSI_STATS,
161         ECORE_MCP_RDMA_STATS
162 };
163
164 union ecore_mcp_protocol_stats {
165         struct ecore_mcp_lan_stats lan_stats;
166         struct ecore_mcp_fcoe_stats fcoe_stats;
167         struct ecore_mcp_iscsi_stats iscsi_stats;
168         struct ecore_mcp_rdma_stats rdma_stats;
169 };
170 #endif
171
172 enum ecore_ov_client {
173         ECORE_OV_CLIENT_DRV,
174         ECORE_OV_CLIENT_USER,
175         ECORE_OV_CLIENT_VENDOR_SPEC
176 };
177
178 enum ecore_ov_driver_state {
179         ECORE_OV_DRIVER_STATE_NOT_LOADED,
180         ECORE_OV_DRIVER_STATE_DISABLED,
181         ECORE_OV_DRIVER_STATE_ACTIVE
182 };
183
184 #define ECORE_MAX_NPIV_ENTRIES 128
185 #define ECORE_WWN_SIZE 8
186 struct ecore_fc_npiv_tbl {
187         u32 count;
188         u8 wwpn[ECORE_MAX_NPIV_ENTRIES][ECORE_WWN_SIZE];
189         u8 wwnn[ECORE_MAX_NPIV_ENTRIES][ECORE_WWN_SIZE];
190 };
191
192 #ifndef __EXTRACT__LINUX__
193 enum ecore_led_mode {
194         ECORE_LED_MODE_OFF,
195         ECORE_LED_MODE_ON,
196         ECORE_LED_MODE_RESTORE
197 };
198 #endif
199
200 struct ecore_temperature_sensor {
201         u8 sensor_location;
202         u8 threshold_high;
203         u8 critical;
204         u8 current_temp;
205 };
206
207 #define ECORE_MAX_NUM_OF_SENSORS        7
208 struct ecore_temperature_info {
209         u32 num_sensors;
210         struct ecore_temperature_sensor sensors[ECORE_MAX_NUM_OF_SENSORS];
211 };
212
213 enum ecore_mba_img_idx {
214         ECORE_MBA_LEGACY_IDX,
215         ECORE_MBA_PCI3CLP_IDX,
216         ECORE_MBA_PCI3_IDX,
217         ECORE_MBA_FCODE_IDX,
218         ECORE_EFI_X86_IDX,
219         ECORE_EFI_IPF_IDX,
220         ECORE_EFI_EBC_IDX,
221         ECORE_EFI_X64_IDX,
222         ECORE_MAX_NUM_OF_ROMIMG
223 };
224
225 struct ecore_mba_vers {
226         u32 mba_vers[ECORE_MAX_NUM_OF_ROMIMG];
227 };
228
229 enum ecore_mfw_tlv_type {
230         ECORE_MFW_TLV_GENERIC = 0x1, /* Core driver TLVs */
231         ECORE_MFW_TLV_ETH = 0x2, /* L2 driver TLVs */
232         ECORE_MFW_TLV_FCOE = 0x4, /* FCoE protocol TLVs */
233         ECORE_MFW_TLV_ISCSI = 0x8, /* SCSI protocol TLVs */
234         ECORE_MFW_TLV_MAX = 0x16,
235 };
236
237 struct ecore_mfw_tlv_generic {
238         u16 feat_flags;
239         bool feat_flags_set;
240         u64 local_mac;
241         bool local_mac_set;
242         u64 additional_mac1;
243         bool additional_mac1_set;
244         u64 additional_mac2;
245         bool additional_mac2_set;
246         u8 drv_state;
247         bool drv_state_set;
248         u8 pxe_progress;
249         bool pxe_progress_set;
250         u64 rx_frames;
251         bool rx_frames_set;
252         u64 rx_bytes;
253         bool rx_bytes_set;
254         u64 tx_frames;
255         bool tx_frames_set;
256         u64 tx_bytes;
257         bool tx_bytes_set;
258 };
259
260 struct ecore_mfw_tlv_eth {
261         u16 lso_maxoff_size;
262         bool lso_maxoff_size_set;
263         u16 lso_minseg_size;
264         bool lso_minseg_size_set;
265         u8 prom_mode;
266         bool prom_mode_set;
267         u16 tx_descr_size;
268         bool tx_descr_size_set;
269         u16 rx_descr_size;
270         bool rx_descr_size_set;
271         u16 netq_count;
272         bool netq_count_set;
273         u32 tcp4_offloads;
274         bool tcp4_offloads_set;
275         u32 tcp6_offloads;
276         bool tcp6_offloads_set;
277         u16 tx_descr_qdepth;
278         bool tx_descr_qdepth_set;
279         u16 rx_descr_qdepth;
280         bool rx_descr_qdepth_set;
281         u8 iov_offload;
282         bool iov_offload_set;
283         u8 txqs_empty;
284         bool txqs_empty_set;
285         u8 rxqs_empty;
286         bool rxqs_empty_set;
287         u8 num_txqs_full;
288         bool num_txqs_full_set;
289         u8 num_rxqs_full;
290         bool num_rxqs_full_set;
291 };
292
293 struct ecore_mfw_tlv_fcoe {
294         u8 scsi_timeout;
295         bool scsi_timeout_set;
296         u32 rt_tov;
297         bool rt_tov_set;
298         u32 ra_tov;
299         bool ra_tov_set;
300         u32 ed_tov;
301         bool ed_tov_set;
302         u32 cr_tov;
303         bool cr_tov_set;
304         u8 boot_type;
305         bool boot_type_set;
306         u8 npiv_state;
307         bool npiv_state_set;
308         u32 num_npiv_ids;
309         bool num_npiv_ids_set;
310         u8 switch_name[8];
311         bool switch_name_set;
312         u16 switch_portnum;
313         bool switch_portnum_set;
314         u8 switch_portid[3];
315         bool switch_portid_set;
316         u8 vendor_name[8];
317         bool vendor_name_set;
318         u8 switch_model[8];
319         bool switch_model_set;
320         u8 switch_fw_version[8];
321         bool switch_fw_version_set;
322         u8 qos_pri;
323         bool qos_pri_set;
324         u8 port_alias[3];
325         bool port_alias_set;
326         u8 port_state;
327         bool port_state_set;
328         u16 fip_tx_descr_size;
329         bool fip_tx_descr_size_set;
330         u16 fip_rx_descr_size;
331         bool fip_rx_descr_size_set;
332         u16 link_failures;
333         bool link_failures_set;
334         u8 fcoe_boot_progress;
335         bool fcoe_boot_progress_set;
336         u64 rx_bcast;
337         bool rx_bcast_set;
338         u64 tx_bcast;
339         bool tx_bcast_set;
340         u16 fcoe_txq_depth;
341         bool fcoe_txq_depth_set;
342         u16 fcoe_rxq_depth;
343         bool fcoe_rxq_depth_set;
344         u64 fcoe_rx_frames;
345         bool fcoe_rx_frames_set;
346         u64 fcoe_rx_bytes;
347         bool fcoe_rx_bytes_set;
348         u64 fcoe_tx_frames;
349         bool fcoe_tx_frames_set;
350         u64 fcoe_tx_bytes;
351         bool fcoe_tx_bytes_set;
352         u16 crc_count;
353         bool crc_count_set;
354         u32 crc_err_src_fcid[5];
355         bool crc_err_src_fcid_set[5];
356         u8 crc_err_tstamp[5][14];
357         bool crc_err_tstamp_set[5];
358         u16 losync_err;
359         bool losync_err_set;
360         u16 losig_err;
361         bool losig_err_set;
362         u16 primtive_err;
363         bool primtive_err_set;
364         u16 disparity_err;
365         bool disparity_err_set;
366         u16 code_violation_err;
367         bool code_violation_err_set;
368         u32 flogi_param[4];
369         bool flogi_param_set[4];
370         u8 flogi_tstamp[14];
371         bool flogi_tstamp_set;
372         u32 flogi_acc_param[4];
373         bool flogi_acc_param_set[4];
374         u8 flogi_acc_tstamp[14];
375         bool flogi_acc_tstamp_set;
376         u32 flogi_rjt;
377         bool flogi_rjt_set;
378         u8 flogi_rjt_tstamp[14];
379         bool flogi_rjt_tstamp_set;
380         u32 fdiscs;
381         bool fdiscs_set;
382         u8 fdisc_acc;
383         bool fdisc_acc_set;
384         u8 fdisc_rjt;
385         bool fdisc_rjt_set;
386         u8 plogi;
387         bool plogi_set;
388         u8 plogi_acc;
389         bool plogi_acc_set;
390         u8 plogi_rjt;
391         bool plogi_rjt_set;
392         u32 plogi_dst_fcid[5];
393         bool plogi_dst_fcid_set[5];
394         u8 plogi_tstamp[5][14];
395         bool plogi_tstamp_set[5];
396         u32 plogi_acc_src_fcid[5];
397         bool plogi_acc_src_fcid_set[5];
398         u8 plogi_acc_tstamp[5][14];
399         bool plogi_acc_tstamp_set[5];
400         u8 tx_plogos;
401         bool tx_plogos_set;
402         u8 plogo_acc;
403         bool plogo_acc_set;
404         u8 plogo_rjt;
405         bool plogo_rjt_set;
406         u32 plogo_src_fcid[5];
407         bool plogo_src_fcid_set[5];
408         u8 plogo_tstamp[5][14];
409         bool plogo_tstamp_set[5];
410         u8 rx_logos;
411         bool rx_logos_set;
412         u8 tx_accs;
413         bool tx_accs_set;
414         u8 tx_prlis;
415         bool tx_prlis_set;
416         u8 rx_accs;
417         bool rx_accs_set;
418         u8 tx_abts;
419         bool tx_abts_set;
420         u8 rx_abts_acc;
421         bool rx_abts_acc_set;
422         u8 rx_abts_rjt;
423         bool rx_abts_rjt_set;
424         u32 abts_dst_fcid[5];
425         bool abts_dst_fcid_set[5];
426         u8 abts_tstamp[5][14];
427         bool abts_tstamp_set[5];
428         u8 rx_rscn;
429         bool rx_rscn_set;
430         u32 rx_rscn_nport[4];
431         bool rx_rscn_nport_set[4];
432         u8 tx_lun_rst;
433         bool tx_lun_rst_set;
434         u8 abort_task_sets;
435         bool abort_task_sets_set;
436         u8 tx_tprlos;
437         bool tx_tprlos_set;
438         u8 tx_nos;
439         bool tx_nos_set;
440         u8 rx_nos;
441         bool rx_nos_set;
442         u8 ols;
443         bool ols_set;
444         u8 lr;
445         bool lr_set;
446         u8 lrr;
447         bool lrr_set;
448         u8 tx_lip;
449         bool tx_lip_set;
450         u8 rx_lip;
451         bool rx_lip_set;
452         u8 eofa;
453         bool eofa_set;
454         u8 eofni;
455         bool eofni_set;
456         u8 scsi_chks;
457         bool scsi_chks_set;
458         u8 scsi_cond_met;
459         bool scsi_cond_met_set;
460         u8 scsi_busy;
461         bool scsi_busy_set;
462         u8 scsi_inter;
463         bool scsi_inter_set;
464         u8 scsi_inter_cond_met;
465         bool scsi_inter_cond_met_set;
466         u8 scsi_rsv_conflicts;
467         bool scsi_rsv_conflicts_set;
468         u8 scsi_tsk_full;
469         bool scsi_tsk_full_set;
470         u8 scsi_aca_active;
471         bool scsi_aca_active_set;
472         u8 scsi_tsk_abort;
473         bool scsi_tsk_abort_set;
474         u32 scsi_rx_chk[5];
475         bool scsi_rx_chk_set[5];
476         u8 scsi_chk_tstamp[5][14];
477         bool scsi_chk_tstamp_set[5];
478 };
479
480 struct ecore_mfw_tlv_iscsi {
481         u8 target_llmnr;
482         bool target_llmnr_set;
483         u8 header_digest;
484         bool header_digest_set;
485         u8 data_digest;
486         bool data_digest_set;
487         u8 auth_method;
488         bool auth_method_set;
489         u16 boot_taget_portal;
490         bool boot_taget_portal_set;
491         u16 frame_size;
492         bool frame_size_set;
493         u16 tx_desc_size;
494         bool tx_desc_size_set;
495         u16 rx_desc_size;
496         bool rx_desc_size_set;
497         u8 boot_progress;
498         bool boot_progress_set;
499         u16 tx_desc_qdepth;
500         bool tx_desc_qdepth_set;
501         u16 rx_desc_qdepth;
502         bool rx_desc_qdepth_set;
503         u64 rx_frames;
504         bool rx_frames_set;
505         u64 rx_bytes;
506         bool rx_bytes_set;
507         u64 tx_frames;
508         bool tx_frames_set;
509         u64 tx_bytes;
510         bool tx_bytes_set;
511 };
512
513 union ecore_mfw_tlv_data {
514         struct ecore_mfw_tlv_generic generic;
515         struct ecore_mfw_tlv_eth eth;
516         struct ecore_mfw_tlv_fcoe fcoe;
517         struct ecore_mfw_tlv_iscsi iscsi;
518 };
519
520 /**
521  * @brief - returns the link params of the hw function
522  *
523  * @param p_hwfn
524  *
525  * @returns pointer to link params
526  */
527 struct ecore_mcp_link_params *ecore_mcp_get_link_params(struct ecore_hwfn *);
528
529 /**
530  * @brief - return the link state of the hw function
531  *
532  * @param p_hwfn
533  *
534  * @returns pointer to link state
535  */
536 struct ecore_mcp_link_state *ecore_mcp_get_link_state(struct ecore_hwfn *);
537
538 /**
539  * @brief - return the link capabilities of the hw function
540  *
541  * @param p_hwfn
542  *
543  * @returns pointer to link capabilities
544  */
545 struct ecore_mcp_link_capabilities
546 *ecore_mcp_get_link_capabilities(struct ecore_hwfn *p_hwfn);
547
548 /**
549  * @brief Request the MFW to set the the link according to 'link_input'.
550  *
551  * @param p_hwfn
552  * @param p_ptt
553  * @param b_up - raise link if `true'. Reset link if `false'.
554  *
555  * @return enum _ecore_status_t
556  */
557 enum _ecore_status_t ecore_mcp_set_link(struct ecore_hwfn *p_hwfn,
558                                         struct ecore_ptt *p_ptt,
559                                         bool b_up);
560
561 /**
562  * @brief Get the management firmware version value
563  *
564  * @param p_hwfn
565  * @param p_ptt
566  * @param p_mfw_ver    - mfw version value
567  * @param p_running_bundle_id   - image id in nvram; Optional.
568  *
569  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
570  */
571 enum _ecore_status_t ecore_mcp_get_mfw_ver(struct ecore_hwfn *p_hwfn,
572                                            struct ecore_ptt *p_ptt,
573                                            u32 *p_mfw_ver,
574                                            u32 *p_running_bundle_id);
575
576 /**
577  * @brief Get media type value of the port.
578  *
579  * @param p_dev      - ecore dev pointer
580  * @param p_ptt
581  * @param mfw_ver    - media type value
582  *
583  * @return enum _ecore_status_t -
584  *      ECORE_SUCCESS - Operation was successful.
585  *      ECORE_BUSY - Operation failed
586  */
587 enum _ecore_status_t ecore_mcp_get_media_type(struct ecore_hwfn *p_hwfn,
588                                               struct ecore_ptt *p_ptt,
589                                               u32 *media_type);
590
591 /**
592  * @brief - Sends a command to the MCP mailbox.
593  *
594  * @param p_hwfn      - hw function
595  * @param p_ptt       - PTT required for register access
596  * @param cmd         - command to be sent to the MCP
597  * @param param       - optional param
598  * @param o_mcp_resp  - the MCP response code (exclude sequence)
599  * @param o_mcp_param - optional parameter provided by the MCP response
600  *
601  * @return enum _ecore_status_t -
602  *      ECORE_SUCCESS - operation was successful
603  *      ECORE_BUSY    - operation failed
604  */
605 enum _ecore_status_t ecore_mcp_cmd(struct ecore_hwfn *p_hwfn,
606                                    struct ecore_ptt *p_ptt, u32 cmd, u32 param,
607                                    u32 *o_mcp_resp, u32 *o_mcp_param);
608
609 /**
610  * @brief - drains the nig, allowing completion to pass in case of pauses.
611  *          (Should be called only from sleepable context)
612  *
613  * @param p_hwfn
614  * @param p_ptt
615  */
616 enum _ecore_status_t ecore_mcp_drain(struct ecore_hwfn *p_hwfn,
617                                      struct ecore_ptt *p_ptt);
618
619 #ifndef LINUX_REMOVE
620 /**
621  * @brief - return the mcp function info of the hw function
622  *
623  * @param p_hwfn
624  *
625  * @returns pointer to mcp function info
626  */
627 const struct ecore_mcp_function_info
628 *ecore_mcp_get_function_info(struct ecore_hwfn *p_hwfn);
629 #endif
630
631 #ifndef LINUX_REMOVE
632 /**
633  * @brief - count number of function with a matching personality on engine.
634  *
635  * @param p_hwfn
636  * @param p_ptt
637  * @param personalities - a bitmask of ecore_pci_personality values
638  *
639  * @returns the count of all devices on engine whose personality match one of
640  *          the bitsmasks.
641  */
642 int ecore_mcp_get_personality_cnt(struct ecore_hwfn *p_hwfn,
643                                   struct ecore_ptt *p_ptt,
644                                   u32 personalities);
645 #endif
646
647 /**
648  * @brief Get the flash size value
649  *
650  * @param p_hwfn
651  * @param p_ptt
652  * @param p_flash_size  - flash size in bytes to be filled.
653  *
654  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
655  */
656 enum _ecore_status_t ecore_mcp_get_flash_size(struct ecore_hwfn *p_hwfn,
657                                               struct ecore_ptt *p_ptt,
658                                               u32 *p_flash_size);
659
660 /**
661  * @brief Send driver version to MFW
662  *
663  * @param p_hwfn
664  * @param p_ptt
665  * @param version - Version value
666  * @param name - Protocol driver name
667  *
668  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
669  */
670 enum _ecore_status_t
671 ecore_mcp_send_drv_version(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
672                            struct ecore_mcp_drv_version *p_ver);
673
674 /**
675  * @brief Read the MFW process kill counter
676  *
677  * @param p_hwfn
678  * @param p_ptt
679  *
680  * @return u32
681  */
682 u32 ecore_get_process_kill_counter(struct ecore_hwfn *p_hwfn,
683                                    struct ecore_ptt *p_ptt);
684
685 /**
686  * @brief Trigger a recovery process
687  *
688  *  @param p_hwfn
689  *  @param p_ptt
690  *
691  * @return enum _ecore_status_t
692  */
693 enum _ecore_status_t ecore_start_recovery_process(struct ecore_hwfn *p_hwfn,
694                                                   struct ecore_ptt *p_ptt);
695
696 /**
697  * @brief A recovery handler must call this function as its first step.
698  *        It is assumed that the handler is not run from an interrupt context.
699  *
700  *  @param p_dev
701  *  @param p_ptt
702  *
703  * @return enum _ecore_status_t
704  */
705 enum _ecore_status_t ecore_recovery_prolog(struct ecore_dev *p_dev);
706
707 /**
708  * @brief Notify MFW about the change in base device properties
709  *
710  *  @param p_hwfn
711  *  @param p_ptt
712  *  @param client - ecore client type
713  *
714  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
715  */
716 enum _ecore_status_t
717 ecore_mcp_ov_update_current_config(struct ecore_hwfn *p_hwfn,
718                                    struct ecore_ptt *p_ptt,
719                                    enum ecore_ov_client client);
720
721 /**
722  * @brief Notify MFW about the driver state
723  *
724  *  @param p_hwfn
725  *  @param p_ptt
726  *  @param drv_state - Driver state
727  *
728  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
729  */
730 enum _ecore_status_t
731 ecore_mcp_ov_update_driver_state(struct ecore_hwfn *p_hwfn,
732                                  struct ecore_ptt *p_ptt,
733                                  enum ecore_ov_driver_state drv_state);
734
735 /**
736  * @brief Read NPIV settings form the MFW
737  *
738  *  @param p_hwfn
739  *  @param p_ptt
740  *  @param p_table - Array to hold the FC NPIV data. Client need allocate the
741  *                   required buffer. The field 'count' specifies number of NPIV
742  *                   entries. A value of 0 means the table was not populated.
743  *
744  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
745  */
746 enum _ecore_status_t
747 ecore_mcp_ov_get_fc_npiv(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
748                          struct ecore_fc_npiv_tbl *p_table);
749
750 /**
751  * @brief Send MTU size to MFW
752  *
753  *  @param p_hwfn
754  *  @param p_ptt
755  *  @param mtu - MTU size
756  *
757  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
758  */
759 enum _ecore_status_t ecore_mcp_ov_update_mtu(struct ecore_hwfn *p_hwfn,
760                                              struct ecore_ptt *p_ptt, u16 mtu);
761
762 /**
763  * @brief Set LED status
764  *
765  *  @param p_hwfn
766  *  @param p_ptt
767  *  @param mode - LED mode
768  *
769  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
770  */
771 enum _ecore_status_t ecore_mcp_set_led(struct ecore_hwfn *p_hwfn,
772                                        struct ecore_ptt *p_ptt,
773                                        enum ecore_led_mode mode);
774
775 /**
776  * @brief Set secure mode
777  *
778  *  @param p_dev
779  *  @param addr - nvm offset
780  *
781  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
782  */
783 enum _ecore_status_t ecore_mcp_nvm_set_secure_mode(struct ecore_dev *p_dev,
784                                                    u32 addr);
785
786 /**
787  * @brief Write to phy
788  *
789  *  @param p_dev
790  *  @param addr - nvm offset
791  *  @param cmd - nvm command
792  *  @param p_buf - nvm write buffer
793  *  @param len - buffer len
794  *
795  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
796  */
797 enum _ecore_status_t ecore_mcp_phy_write(struct ecore_dev *p_dev, u32 cmd,
798                                          u32 addr, u8 *p_buf, u32 len);
799
800 /**
801  * @brief Write to nvm
802  *
803  *  @param p_dev
804  *  @param addr - nvm offset
805  *  @param cmd - nvm command
806  *  @param p_buf - nvm write buffer
807  *  @param len - buffer len
808  *
809  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
810  */
811 enum _ecore_status_t ecore_mcp_nvm_write(struct ecore_dev *p_dev, u32 cmd,
812                                          u32 addr, u8 *p_buf, u32 len);
813
814 /**
815  * @brief Put file begin
816  *
817  *  @param p_dev
818  *  @param addr - nvm offset
819  *
820  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
821  */
822 enum _ecore_status_t ecore_mcp_nvm_put_file_begin(struct ecore_dev *p_dev,
823                                                   u32 addr);
824
825 /**
826  * @brief Delete file
827  *
828  *  @param p_dev
829  *  @param addr - nvm offset
830  *
831  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
832  */
833 enum _ecore_status_t ecore_mcp_nvm_del_file(struct ecore_dev *p_dev,
834                                             u32 addr);
835
836 /**
837  * @brief Check latest response
838  *
839  *  @param p_dev
840  *  @param p_buf - nvm write buffer
841  *
842  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
843  */
844 enum _ecore_status_t ecore_mcp_nvm_resp(struct ecore_dev *p_dev, u8 *p_buf);
845
846 /**
847  * @brief Read from phy
848  *
849  *  @param p_dev
850  *  @param addr - nvm offset
851  *  @param cmd - nvm command
852  *  @param p_buf - nvm write buffer
853  *  @param len - buffer len
854  *
855  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
856  */
857 enum _ecore_status_t ecore_mcp_phy_read(struct ecore_dev *p_dev, u32 cmd,
858                                         u32 addr, u8 *p_buf, u32 len);
859
860 /**
861  * @brief Read from nvm
862  *
863  *  @param p_dev
864  *  @param addr - nvm offset
865  *  @param p_buf - nvm write buffer
866  *  @param len - buffer len
867  *
868  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
869  */
870 enum _ecore_status_t ecore_mcp_nvm_read(struct ecore_dev *p_dev, u32 addr,
871                            u8 *p_buf, u32 len);
872
873 /**
874  * @brief - Sends an NVM write command request to the MFW with
875  *          payload.
876  *
877  * @param p_hwfn
878  * @param p_ptt
879  * @param cmd - Command: Either DRV_MSG_CODE_NVM_WRITE_NVRAM or
880  *            DRV_MSG_CODE_NVM_PUT_FILE_DATA
881  * @param param - [0:23] - Offset [24:31] - Size
882  * @param o_mcp_resp - MCP response
883  * @param o_mcp_param - MCP response param
884  * @param i_txn_size -  Buffer size
885  * @param i_buf - Pointer to the buffer
886  *
887  * @param return ECORE_SUCCESS upon success.
888  */
889 enum _ecore_status_t ecore_mcp_nvm_wr_cmd(struct ecore_hwfn *p_hwfn,
890                                           struct ecore_ptt *p_ptt,
891                                           u32 cmd,
892                                           u32 param,
893                                           u32 *o_mcp_resp,
894                                           u32 *o_mcp_param,
895                                           u32 i_txn_size,
896                                           u32 *i_buf);
897
898 /**
899  * @brief - Sends an NVM read command request to the MFW to get
900  *        a buffer.
901  *
902  * @param p_hwfn
903  * @param p_ptt
904  * @param cmd - Command: DRV_MSG_CODE_NVM_GET_FILE_DATA or
905  *            DRV_MSG_CODE_NVM_READ_NVRAM commands
906  * @param param - [0:23] - Offset [24:31] - Size
907  * @param o_mcp_resp - MCP response
908  * @param o_mcp_param - MCP response param
909  * @param o_txn_size -  Buffer size output
910  * @param o_buf - Pointer to the buffer returned by the MFW.
911  *
912  * @param return ECORE_SUCCESS upon success.
913  */
914 enum _ecore_status_t ecore_mcp_nvm_rd_cmd(struct ecore_hwfn *p_hwfn,
915                                           struct ecore_ptt *p_ptt,
916                                           u32 cmd,
917                                           u32 param,
918                                           u32 *o_mcp_resp,
919                                           u32 *o_mcp_param,
920                                           u32 *o_txn_size,
921                                           u32 *o_buf);
922
923 /**
924  * @brief Read from sfp
925  *
926  *  @param p_hwfn - hw function
927  *  @param p_ptt  - PTT required for register access
928  *  @param port   - transceiver port
929  *  @param addr   - I2C address
930  *  @param offset - offset in sfp
931  *  @param len    - buffer length
932  *  @param p_buf  - buffer to read into
933  *
934  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
935  */
936 enum _ecore_status_t ecore_mcp_phy_sfp_read(struct ecore_hwfn *p_hwfn,
937                                             struct ecore_ptt *p_ptt,
938                                             u32 port, u32 addr, u32 offset,
939                                             u32 len, u8 *p_buf);
940
941 /**
942  * @brief Write to sfp
943  *
944  *  @param p_hwfn - hw function
945  *  @param p_ptt  - PTT required for register access
946  *  @param port   - transceiver port
947  *  @param addr   - I2C address
948  *  @param offset - offset in sfp
949  *  @param len    - buffer length
950  *  @param p_buf  - buffer to write from
951  *
952  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
953  */
954 enum _ecore_status_t ecore_mcp_phy_sfp_write(struct ecore_hwfn *p_hwfn,
955                                              struct ecore_ptt *p_ptt,
956                                              u32 port, u32 addr, u32 offset,
957                                              u32 len, u8 *p_buf);
958
959 /**
960  * @brief Gpio read
961  *
962  *  @param p_hwfn    - hw function
963  *  @param p_ptt     - PTT required for register access
964  *  @param gpio      - gpio number
965  *  @param gpio_val  - value read from gpio
966  *
967  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
968  */
969 enum _ecore_status_t ecore_mcp_gpio_read(struct ecore_hwfn *p_hwfn,
970                                          struct ecore_ptt *p_ptt,
971                                          u16 gpio, u32 *gpio_val);
972
973 /**
974  * @brief Gpio write
975  *
976  *  @param p_hwfn    - hw function
977  *  @param p_ptt     - PTT required for register access
978  *  @param gpio      - gpio number
979  *  @param gpio_val  - value to write to gpio
980  *
981  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
982  */
983 enum _ecore_status_t ecore_mcp_gpio_write(struct ecore_hwfn *p_hwfn,
984                                           struct ecore_ptt *p_ptt,
985                                           u16 gpio, u16 gpio_val);
986
987 /**
988  * @brief Gpio get information
989  *
990  *  @param p_hwfn          - hw function
991  *  @param p_ptt           - PTT required for register access
992  *  @param gpio            - gpio number
993  *  @param gpio_direction  - gpio is output (0) or input (1)
994  *  @param gpio_ctrl       - gpio control is uninitialized (0),
995  *                         path 0 (1), path 1 (2) or shared(3)
996  *
997  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
998  */
999 enum _ecore_status_t ecore_mcp_gpio_info(struct ecore_hwfn *p_hwfn,
1000                                          struct ecore_ptt *p_ptt,
1001                                          u16 gpio, u32 *gpio_direction,
1002                                          u32 *gpio_ctrl);
1003
1004 /**
1005  * @brief Bist register test
1006  *
1007  *  @param p_hwfn    - hw function
1008  *  @param p_ptt     - PTT required for register access
1009  *
1010  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
1011  */
1012 enum _ecore_status_t ecore_mcp_bist_register_test(struct ecore_hwfn *p_hwfn,
1013                                                    struct ecore_ptt *p_ptt);
1014
1015 /**
1016  * @brief Bist clock test
1017  *
1018  *  @param p_hwfn    - hw function
1019  *  @param p_ptt     - PTT required for register access
1020  *
1021  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
1022  */
1023 enum _ecore_status_t ecore_mcp_bist_clock_test(struct ecore_hwfn *p_hwfn,
1024                                                 struct ecore_ptt *p_ptt);
1025
1026 /**
1027  * @brief Bist nvm test - get number of images
1028  *
1029  *  @param p_hwfn       - hw function
1030  *  @param p_ptt        - PTT required for register access
1031  *  @param num_images   - number of images if operation was
1032  *                        successful. 0 if not.
1033  *
1034  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
1035  */
1036 enum _ecore_status_t ecore_mcp_bist_nvm_test_get_num_images(
1037                                                 struct ecore_hwfn *p_hwfn,
1038                                                 struct ecore_ptt *p_ptt,
1039                                                 u32 *num_images);
1040
1041 /**
1042  * @brief Bist nvm test - get image attributes by index
1043  *
1044  *  @param p_hwfn      - hw function
1045  *  @param p_ptt       - PTT required for register access
1046  *  @param p_image_att - Attributes of image
1047  *  @param image_index - Index of image to get information for
1048  *
1049  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
1050  */
1051 enum _ecore_status_t ecore_mcp_bist_nvm_test_get_image_att(
1052                                         struct ecore_hwfn *p_hwfn,
1053                                         struct ecore_ptt *p_ptt,
1054                                         struct bist_nvm_image_att *p_image_att,
1055                                         u32 image_index);
1056
1057 /**
1058  * @brief ecore_mcp_get_temperature_info - get the status of the temperature
1059  *                                         sensors
1060  *
1061  *  @param p_hwfn        - hw function
1062  *  @param p_ptt         - PTT required for register access
1063  *  @param p_temp_status - A pointer to an ecore_temperature_info structure to
1064  *                         be filled with the temperature data
1065  *
1066  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
1067  */
1068 enum _ecore_status_t
1069 ecore_mcp_get_temperature_info(struct ecore_hwfn *p_hwfn,
1070                                struct ecore_ptt *p_ptt,
1071                                struct ecore_temperature_info *p_temp_info);
1072
1073 /**
1074  * @brief Get MBA versions - get MBA sub images versions
1075  *
1076  *  @param p_hwfn      - hw function
1077  *  @param p_ptt       - PTT required for register access
1078  *  @param p_mba_vers  - MBA versions array to fill
1079  *
1080  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
1081  */
1082 enum _ecore_status_t ecore_mcp_get_mba_versions(
1083         struct ecore_hwfn *p_hwfn,
1084         struct ecore_ptt *p_ptt,
1085         struct ecore_mba_vers *p_mba_vers);
1086
1087 /**
1088  * @brief Count memory ecc events
1089  *
1090  *  @param p_hwfn      - hw function
1091  *  @param p_ptt       - PTT required for register access
1092  *  @param num_events  - number of memory ecc events
1093  *
1094  * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
1095  */
1096 enum _ecore_status_t ecore_mcp_mem_ecc_events(struct ecore_hwfn *p_hwfn,
1097                                               struct ecore_ptt *p_ptt,
1098                                               u64 *num_events);
1099
1100 struct ecore_mdump_info {
1101         u32 reason;
1102         u32 version;
1103         u32 config;
1104         u32 epoch;
1105         u32 num_of_logs;
1106         u32 valid_logs;
1107 };
1108
1109 /**
1110  * @brief - Gets the MFW crash dump configuration and logs info.
1111  *
1112  * @param p_hwfn
1113  * @param p_ptt
1114  * @param p_mdump_info
1115  *
1116  * @param return ECORE_SUCCESS upon success.
1117  */
1118 enum _ecore_status_t
1119 ecore_mcp_mdump_get_info(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
1120                          struct ecore_mdump_info *p_mdump_info);
1121
1122 /**
1123  * @brief - Clears the MFW crash dump logs.
1124  *
1125  * @param p_hwfn
1126  * @param p_ptt
1127  *
1128  * @param return ECORE_SUCCESS upon success.
1129  */
1130 enum _ecore_status_t ecore_mcp_mdump_clear_logs(struct ecore_hwfn *p_hwfn,
1131                                                 struct ecore_ptt *p_ptt);
1132
1133 /**
1134  * @brief - Clear the mdump retained data.
1135  *
1136  * @param p_hwfn
1137  * @param p_ptt
1138  *
1139  * @param return ECORE_SUCCESS upon success.
1140  */
1141 enum _ecore_status_t ecore_mcp_mdump_clr_retain(struct ecore_hwfn *p_hwfn,
1142                                                 struct ecore_ptt *p_ptt);
1143
1144 /**
1145  * @brief - Processes the TLV request from MFW i.e., get the required TLV info
1146  *          from the ecore client and send it to the MFW.
1147  *
1148  * @param p_hwfn
1149  * @param p_ptt
1150  *
1151  * @param return ECORE_SUCCESS upon success.
1152  */
1153 enum _ecore_status_t ecore_mfw_process_tlv_req(struct ecore_hwfn *p_hwfn,
1154                                                struct ecore_ptt *p_ptt);
1155
1156
1157 /**
1158  * @brief - Return whether management firmware support smart AN
1159  *
1160  * @param p_hwfn
1161  *
1162  * @return bool - true iff feature is supported.
1163  */
1164 bool ecore_mcp_is_smart_an_supported(struct ecore_hwfn *p_hwfn);
1165 #endif