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