2 * Copyright (c) 2017-2018 Cavium, Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
31 #ifndef __ECORE_MCP_API_H__
32 #define __ECORE_MCP_API_H__
34 #include "ecore_status.h"
36 struct ecore_mcp_link_speed_params {
38 u32 advertised_speeds; /* bitmask of DRV_SPEED_CAPABILITY */
39 u32 forced_speed; /* In Mb/s */
42 struct ecore_mcp_link_pause_params {
48 enum ecore_mcp_eee_mode {
49 ECORE_MCP_EEE_DISABLED,
50 ECORE_MCP_EEE_ENABLED,
51 ECORE_MCP_EEE_UNSUPPORTED
54 #ifndef __EXTRACT__LINUX__
55 struct ecore_link_eee_params {
57 #define ECORE_EEE_1G_ADV (1 << 0)
58 #define ECORE_EEE_10G_ADV (1 << 1)
59 /* Capabilities are represented using ECORE_EEE_*_ADV values */
67 struct ecore_mcp_link_params {
68 struct ecore_mcp_link_speed_params speed;
69 struct ecore_mcp_link_pause_params pause;
70 u32 loopback_mode; /* in PMM_LOOPBACK values */
71 struct ecore_link_eee_params eee;
74 struct ecore_mcp_link_capabilities {
75 u32 speed_capabilities;
76 bool default_speed_autoneg; /* In Mb/s */
77 u32 default_speed; /* In Mb/s */ /* __LINUX__THROW__ */
78 enum ecore_mcp_eee_mode default_eee;
83 struct ecore_mcp_link_state {
86 u32 min_pf_rate; /* In Mb/s */
88 /* Actual link speed in Mb/s */
91 /* PF max speed in MB/s, deduced from line_speed
92 * according to PF max bandwidth configuration.
99 bool parallel_detection;
102 #define ECORE_LINK_PARTNER_SPEED_1G_HD (1 << 0)
103 #define ECORE_LINK_PARTNER_SPEED_1G_FD (1 << 1)
104 #define ECORE_LINK_PARTNER_SPEED_10G (1 << 2)
105 #define ECORE_LINK_PARTNER_SPEED_20G (1 << 3)
106 #define ECORE_LINK_PARTNER_SPEED_25G (1 << 4)
107 #define ECORE_LINK_PARTNER_SPEED_40G (1 << 5)
108 #define ECORE_LINK_PARTNER_SPEED_50G (1 << 6)
109 #define ECORE_LINK_PARTNER_SPEED_100G (1 << 7)
110 u32 partner_adv_speed;
112 bool partner_tx_flow_ctrl_en;
113 bool partner_rx_flow_ctrl_en;
115 #define ECORE_LINK_PARTNER_SYMMETRIC_PAUSE (1)
116 #define ECORE_LINK_PARTNER_ASYMMETRIC_PAUSE (2)
117 #define ECORE_LINK_PARTNER_BOTH_PAUSE (3)
118 u8 partner_adv_pause;
127 struct ecore_mcp_function_info {
130 enum ecore_pci_personality protocol;
140 #define ECORE_MCP_VLAN_UNSET (0xffff)
146 #ifndef __EXTRACT__LINUX__
147 enum ecore_nvm_images {
148 ECORE_NVM_IMAGE_ISCSI_CFG,
149 ECORE_NVM_IMAGE_FCOE_CFG,
150 ECORE_NVM_IMAGE_MDUMP,
154 struct ecore_mcp_drv_version {
156 u8 name[MCP_DRV_VER_STR_SIZE - 4];
159 struct ecore_mcp_lan_stats {
165 #ifndef ECORE_PROTO_STATS
166 #define ECORE_PROTO_STATS
167 struct ecore_mcp_fcoe_stats {
174 struct ecore_mcp_iscsi_stats {
181 struct ecore_mcp_rdma_stats {
188 enum ecore_mcp_protocol_type {
190 ECORE_MCP_FCOE_STATS,
191 ECORE_MCP_ISCSI_STATS,
195 union ecore_mcp_protocol_stats {
196 struct ecore_mcp_lan_stats lan_stats;
197 struct ecore_mcp_fcoe_stats fcoe_stats;
198 struct ecore_mcp_iscsi_stats iscsi_stats;
199 struct ecore_mcp_rdma_stats rdma_stats;
203 enum ecore_ov_client {
205 ECORE_OV_CLIENT_USER,
206 ECORE_OV_CLIENT_VENDOR_SPEC
209 enum ecore_ov_driver_state {
210 ECORE_OV_DRIVER_STATE_NOT_LOADED,
211 ECORE_OV_DRIVER_STATE_DISABLED,
212 ECORE_OV_DRIVER_STATE_ACTIVE
216 ECORE_OV_WOL_DEFAULT,
217 ECORE_OV_WOL_DISABLED,
221 #ifndef __EXTRACT__LINUX__
222 #define ECORE_MAX_NPIV_ENTRIES 128
223 #define ECORE_WWN_SIZE 8
224 struct ecore_fc_npiv_tbl {
227 u8 wwpn[ECORE_MAX_NPIV_ENTRIES][ECORE_WWN_SIZE];
228 u8 wwnn[ECORE_MAX_NPIV_ENTRIES][ECORE_WWN_SIZE];
231 enum ecore_led_mode {
234 ECORE_LED_MODE_RESTORE
238 struct ecore_temperature_sensor {
245 #define ECORE_MAX_NUM_OF_SENSORS 7
246 struct ecore_temperature_info {
248 struct ecore_temperature_sensor sensors[ECORE_MAX_NUM_OF_SENSORS];
251 enum ecore_mba_img_idx {
252 ECORE_MBA_LEGACY_IDX,
253 ECORE_MBA_PCI3CLP_IDX,
260 ECORE_MAX_NUM_OF_ROMIMG
263 struct ecore_mba_vers {
264 u32 mba_vers[ECORE_MAX_NUM_OF_ROMIMG];
267 enum ecore_mfw_tlv_type {
268 ECORE_MFW_TLV_GENERIC = 0x1, /* Core driver TLVs */
269 ECORE_MFW_TLV_ETH = 0x2, /* L2 driver TLVs */
270 ECORE_MFW_TLV_FCOE = 0x4, /* FCoE protocol TLVs */
271 ECORE_MFW_TLV_ISCSI = 0x8, /* SCSI protocol TLVs */
272 ECORE_MFW_TLV_MAX = 0x16,
275 struct ecore_mfw_tlv_generic {
277 u8 ipv4_csum_offload;
282 #define ECORE_MFW_TLV_MAC_COUNT 3
283 /* First entry for primary MAC, 2 secondary MACs possible */
284 u8 mac[ECORE_MFW_TLV_MAC_COUNT][6];
285 bool mac_set[ECORE_MFW_TLV_MAC_COUNT];
297 #ifndef __EXTRACT__LINUX__
298 struct ecore_mfw_tlv_eth {
300 bool lso_maxoff_size_set;
302 bool lso_minseg_size_set;
306 bool tx_descr_size_set;
308 bool rx_descr_size_set;
312 bool tcp4_offloads_set;
314 bool tcp6_offloads_set;
316 bool tx_descr_qdepth_set;
318 bool rx_descr_qdepth_set;
320 #define ECORE_MFW_TLV_IOV_OFFLOAD_NONE (0)
321 #define ECORE_MFW_TLV_IOV_OFFLOAD_MULTIQUEUE (1)
322 #define ECORE_MFW_TLV_IOV_OFFLOAD_VEB (2)
323 #define ECORE_MFW_TLV_IOV_OFFLOAD_VEPA (3)
324 bool iov_offload_set;
330 bool num_txqs_full_set;
332 bool num_rxqs_full_set;
335 struct ecore_mfw_tlv_time {
345 struct ecore_mfw_tlv_fcoe {
347 bool scsi_timeout_set;
361 bool num_npiv_ids_set;
363 bool switch_name_set;
365 bool switch_portnum_set;
367 bool switch_portid_set;
369 bool vendor_name_set;
371 bool switch_model_set;
372 u8 switch_fw_version[8];
373 bool switch_fw_version_set;
379 #define ECORE_MFW_TLV_PORT_STATE_OFFLINE (0)
380 #define ECORE_MFW_TLV_PORT_STATE_LOOP (1)
381 #define ECORE_MFW_TLV_PORT_STATE_P2P (2)
382 #define ECORE_MFW_TLV_PORT_STATE_FABRIC (3)
384 u16 fip_tx_descr_size;
385 bool fip_tx_descr_size_set;
386 u16 fip_rx_descr_size;
387 bool fip_rx_descr_size_set;
389 bool link_failures_set;
390 u8 fcoe_boot_progress;
391 bool fcoe_boot_progress_set;
397 bool fcoe_txq_depth_set;
399 bool fcoe_rxq_depth_set;
401 bool fcoe_rx_frames_set;
403 bool fcoe_rx_bytes_set;
405 bool fcoe_tx_frames_set;
407 bool fcoe_tx_bytes_set;
410 u32 crc_err_src_fcid[5];
411 bool crc_err_src_fcid_set[5];
412 struct ecore_mfw_tlv_time crc_err[5];
418 bool primtive_err_set;
420 bool disparity_err_set;
421 u16 code_violation_err;
422 bool code_violation_err_set;
424 bool flogi_param_set[4];
425 struct ecore_mfw_tlv_time flogi_tstamp;
426 u32 flogi_acc_param[4];
427 bool flogi_acc_param_set[4];
428 struct ecore_mfw_tlv_time flogi_acc_tstamp;
431 struct ecore_mfw_tlv_time flogi_rjt_tstamp;
444 u32 plogi_dst_fcid[5];
445 bool plogi_dst_fcid_set[5];
446 struct ecore_mfw_tlv_time plogi_tstamp[5];
447 u32 plogi_acc_src_fcid[5];
448 bool plogi_acc_src_fcid_set[5];
449 struct ecore_mfw_tlv_time plogi_acc_tstamp[5];
456 u32 plogo_src_fcid[5];
457 bool plogo_src_fcid_set[5];
458 struct ecore_mfw_tlv_time plogo_tstamp[5];
470 bool rx_abts_acc_set;
472 bool rx_abts_rjt_set;
473 u32 abts_dst_fcid[5];
474 bool abts_dst_fcid_set[5];
475 struct ecore_mfw_tlv_time abts_tstamp[5];
478 u32 rx_rscn_nport[4];
479 bool rx_rscn_nport_set[4];
483 bool abort_task_sets_set;
507 bool scsi_cond_met_set;
512 u8 scsi_inter_cond_met;
513 bool scsi_inter_cond_met_set;
514 u8 scsi_rsv_conflicts;
515 bool scsi_rsv_conflicts_set;
517 bool scsi_tsk_full_set;
519 bool scsi_aca_active_set;
521 bool scsi_tsk_abort_set;
523 bool scsi_rx_chk_set[5];
524 struct ecore_mfw_tlv_time scsi_chk_tstamp[5];
527 struct ecore_mfw_tlv_iscsi {
529 bool target_llmnr_set;
531 bool header_digest_set;
533 bool data_digest_set;
535 #define ECORE_MFW_TLV_AUTH_METHOD_NONE (1)
536 #define ECORE_MFW_TLV_AUTH_METHOD_CHAP (2)
537 #define ECORE_MFW_TLV_AUTH_METHOD_MUTUAL_CHAP (3)
538 bool auth_method_set;
539 u16 boot_taget_portal;
540 bool boot_taget_portal_set;
544 bool tx_desc_size_set;
546 bool rx_desc_size_set;
548 bool boot_progress_set;
550 bool tx_desc_qdepth_set;
552 bool rx_desc_qdepth_set;
564 union ecore_mfw_tlv_data {
565 struct ecore_mfw_tlv_generic generic;
566 struct ecore_mfw_tlv_eth eth;
567 struct ecore_mfw_tlv_fcoe fcoe;
568 struct ecore_mfw_tlv_iscsi iscsi;
571 #ifndef __EXTRACT__LINUX__
572 enum ecore_hw_info_change {
573 ECORE_HW_INFO_CHANGE_OVLAN,
578 * @brief - returns the link params of the hw function
582 * @returns pointer to link params
584 struct ecore_mcp_link_params *ecore_mcp_get_link_params(struct ecore_hwfn
588 * @brief - return the link state of the hw function
592 * @returns pointer to link state
594 struct ecore_mcp_link_state *ecore_mcp_get_link_state(struct ecore_hwfn
598 * @brief - return the link capabilities of the hw function
602 * @returns pointer to link capabilities
604 struct ecore_mcp_link_capabilities
605 *ecore_mcp_get_link_capabilities(struct ecore_hwfn *p_hwfn);
608 * @brief Request the MFW to set the the link according to 'link_input'.
612 * @param b_up - raise link if `true'. Reset link if `false'.
614 * @return enum _ecore_status_t
616 enum _ecore_status_t ecore_mcp_set_link(struct ecore_hwfn *p_hwfn,
617 struct ecore_ptt *p_ptt,
621 * @brief Get the management firmware version value
625 * @param p_mfw_ver - mfw version value
626 * @param p_running_bundle_id - image id in nvram; Optional.
628 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
630 enum _ecore_status_t ecore_mcp_get_mfw_ver(struct ecore_hwfn *p_hwfn,
631 struct ecore_ptt *p_ptt,
633 u32 *p_running_bundle_id);
636 * @brief Get the MBI version value
640 * @param p_mbi_ver - A pointer to a variable to be filled with the MBI version.
642 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
644 enum _ecore_status_t ecore_mcp_get_mbi_ver(struct ecore_hwfn *p_hwfn,
645 struct ecore_ptt *p_ptt,
649 * @brief Get media type value of the port.
651 * @param p_dev - ecore dev pointer
653 * @param mfw_ver - media type value
655 * @return enum _ecore_status_t -
656 * ECORE_SUCCESS - Operation was successful.
657 * ECORE_BUSY - Operation failed
659 enum _ecore_status_t ecore_mcp_get_media_type(struct ecore_hwfn *p_hwfn,
660 struct ecore_ptt *p_ptt,
664 * @brief Get transciever data of the port.
666 * @param p_dev - ecore dev pointer
668 * @param p_transciever_type - media type value
670 * @return enum _ecore_status_t -
671 * ECORE_SUCCESS - Operation was successful.
672 * ECORE_BUSY - Operation failed
674 enum _ecore_status_t ecore_mcp_get_transceiver_data(struct ecore_hwfn *p_hwfn,
675 struct ecore_ptt *p_ptt,
676 u32 *p_tranceiver_type);
679 * @brief Get transciever supported speed mask.
681 * @param p_dev - ecore dev pointer
683 * @param p_speed_mask - Bit mask of all supported speeds.
685 * @return enum _ecore_status_t -
686 * ECORE_SUCCESS - Operation was successful.
687 * ECORE_BUSY - Operation failed
690 enum _ecore_status_t ecore_mcp_trans_speed_mask(struct ecore_hwfn *p_hwfn,
691 struct ecore_ptt *p_ptt,
695 * @brief Get board configuration.
697 * @param p_dev - ecore dev pointer
699 * @param p_board_config - Board config.
701 * @return enum _ecore_status_t -
702 * ECORE_SUCCESS - Operation was successful.
703 * ECORE_BUSY - Operation failed
705 enum _ecore_status_t ecore_mcp_get_board_config(struct ecore_hwfn *p_hwfn,
706 struct ecore_ptt *p_ptt,
707 u32 *p_board_config);
710 * @brief - Sends a command to the MCP mailbox.
712 * @param p_hwfn - hw function
713 * @param p_ptt - PTT required for register access
714 * @param cmd - command to be sent to the MCP
715 * @param param - Optional param
716 * @param o_mcp_resp - The MCP response code (exclude sequence)
717 * @param o_mcp_param - Optional parameter provided by the MCP response
719 * @return enum _ecore_status_t -
720 * ECORE_SUCCESS - operation was successful
721 * ECORE_BUSY - operation failed
723 enum _ecore_status_t ecore_mcp_cmd(struct ecore_hwfn *p_hwfn,
724 struct ecore_ptt *p_ptt, u32 cmd, u32 param,
725 u32 *o_mcp_resp, u32 *o_mcp_param);
728 * @brief - drains the nig, allowing completion to pass in case of pauses.
729 * (Should be called only from sleepable context)
734 enum _ecore_status_t ecore_mcp_drain(struct ecore_hwfn *p_hwfn,
735 struct ecore_ptt *p_ptt);
739 * @brief - return the mcp function info of the hw function
743 * @returns pointer to mcp function info
745 const struct ecore_mcp_function_info
746 *ecore_mcp_get_function_info(struct ecore_hwfn *p_hwfn);
751 * @brief - count number of function with a matching personality on engine.
755 * @param personalities - a bitmask of ecore_pci_personality values
757 * @returns the count of all devices on engine whose personality match one of
760 int ecore_mcp_get_personality_cnt(struct ecore_hwfn *p_hwfn,
761 struct ecore_ptt *p_ptt,
766 * @brief Get the flash size value
770 * @param p_flash_size - flash size in bytes to be filled.
772 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
774 enum _ecore_status_t ecore_mcp_get_flash_size(struct ecore_hwfn *p_hwfn,
775 struct ecore_ptt *p_ptt,
779 * @brief Send driver version to MFW
783 * @param version - Version value
784 * @param name - Protocol driver name
786 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
789 ecore_mcp_send_drv_version(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
790 struct ecore_mcp_drv_version *p_ver);
793 * @brief Read the MFW process kill counter
800 u32 ecore_get_process_kill_counter(struct ecore_hwfn *p_hwfn,
801 struct ecore_ptt *p_ptt);
804 * @brief Trigger a recovery process
809 * @return enum _ecore_status_t
811 enum _ecore_status_t ecore_start_recovery_process(struct ecore_hwfn *p_hwfn,
812 struct ecore_ptt *p_ptt);
815 * @brief A recovery handler must call this function as its first step.
816 * It is assumed that the handler is not run from an interrupt context.
821 * @return enum _ecore_status_t
823 enum _ecore_status_t ecore_recovery_prolog(struct ecore_dev *p_dev);
826 * @brief Notify MFW about the change in base device properties
830 * @param client - ecore client type
832 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
835 ecore_mcp_ov_update_current_config(struct ecore_hwfn *p_hwfn,
836 struct ecore_ptt *p_ptt,
837 enum ecore_ov_client client);
840 * @brief Notify MFW about the driver state
844 * @param drv_state - Driver state
846 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
849 ecore_mcp_ov_update_driver_state(struct ecore_hwfn *p_hwfn,
850 struct ecore_ptt *p_ptt,
851 enum ecore_ov_driver_state drv_state);
854 * @brief Read NPIV settings form the MFW
858 * @param p_table - Array to hold the FC NPIV data. Client need allocate the
859 * required buffer. The field 'count' specifies number of NPIV
860 * entries. A value of 0 means the table was not populated.
862 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
865 ecore_mcp_ov_get_fc_npiv(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
866 struct ecore_fc_npiv_tbl *p_table);
869 * @brief Send MTU size to MFW
873 * @param mtu - MTU size
875 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
877 enum _ecore_status_t ecore_mcp_ov_update_mtu(struct ecore_hwfn *p_hwfn,
878 struct ecore_ptt *p_ptt, u16 mtu);
881 * @brief Send MAC address to MFW
885 * @param mac - MAC address
887 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
890 ecore_mcp_ov_update_mac(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
894 * @brief Send WOL mode to MFW
898 * @param wol - WOL mode
900 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
903 ecore_mcp_ov_update_wol(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
904 enum ecore_ov_wol wol);
907 * @brief Set LED status
911 * @param mode - LED mode
913 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
915 enum _ecore_status_t ecore_mcp_set_led(struct ecore_hwfn *p_hwfn,
916 struct ecore_ptt *p_ptt,
917 enum ecore_led_mode mode);
920 * @brief Set secure mode
923 * @param addr - nvm offset
925 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
927 enum _ecore_status_t ecore_mcp_nvm_set_secure_mode(struct ecore_dev *p_dev,
931 * @brief Write to phy
934 * @param addr - nvm offset
935 * @param cmd - nvm command
936 * @param p_buf - nvm write buffer
937 * @param len - buffer len
939 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
941 enum _ecore_status_t ecore_mcp_phy_write(struct ecore_dev *p_dev, u32 cmd,
942 u32 addr, u8 *p_buf, u32 len);
945 * @brief Write to nvm
948 * @param addr - nvm offset
949 * @param cmd - nvm command
950 * @param p_buf - nvm write buffer
951 * @param len - buffer len
953 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
955 enum _ecore_status_t ecore_mcp_nvm_write(struct ecore_dev *p_dev, u32 cmd,
956 u32 addr, u8 *p_buf, u32 len);
959 * @brief Put file begin
962 * @param addr - nvm offset
964 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
966 enum _ecore_status_t ecore_mcp_nvm_put_file_begin(struct ecore_dev *p_dev,
973 * @param addr - nvm offset
975 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
977 enum _ecore_status_t ecore_mcp_nvm_del_file(struct ecore_dev *p_dev,
981 * @brief Check latest response
984 * @param p_buf - nvm write buffer
986 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
988 enum _ecore_status_t ecore_mcp_nvm_resp(struct ecore_dev *p_dev, u8 *p_buf);
991 * @brief Read from phy
994 * @param addr - nvm offset
995 * @param cmd - nvm command
996 * @param p_buf - nvm read buffer
997 * @param len - buffer len
999 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
1001 enum _ecore_status_t ecore_mcp_phy_read(struct ecore_dev *p_dev, u32 cmd,
1002 u32 addr, u8 *p_buf, u32 len);
1005 * @brief Read from nvm
1008 * @param addr - nvm offset
1009 * @param p_buf - nvm read buffer
1010 * @param len - buffer len
1012 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
1014 enum _ecore_status_t ecore_mcp_nvm_read(struct ecore_dev *p_dev, u32 addr,
1015 u8 *p_buf, u32 len);
1017 struct ecore_nvm_image_att {
1023 * @brief Allows reading a whole nvram image
1027 * @param image_id - image to get attributes for
1028 * @param p_image_att - image attributes structure into which to fill data
1030 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
1032 enum _ecore_status_t
1033 ecore_mcp_get_nvm_image_att(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
1034 enum ecore_nvm_images image_id,
1035 struct ecore_nvm_image_att *p_image_att);
1038 * @brief Allows reading a whole nvram image
1042 * @param image_id - image requested for reading
1043 * @param p_buffer - allocated buffer into which to fill data
1044 * @param buffer_len - length of the allocated buffer.
1046 * @return ECORE_SUCCESS iff p_buffer now contains the nvram image.
1048 enum _ecore_status_t ecore_mcp_get_nvm_image(struct ecore_hwfn *p_hwfn,
1049 struct ecore_ptt *p_ptt,
1050 enum ecore_nvm_images image_id,
1051 u8 *p_buffer, u32 buffer_len);
1054 * @brief - Sends an NVM write command request to the MFW with
1059 * @param cmd - Command: Either DRV_MSG_CODE_NVM_WRITE_NVRAM or
1060 * DRV_MSG_CODE_NVM_PUT_FILE_DATA
1061 * @param param - [0:23] - Offset [24:31] - Size
1062 * @param o_mcp_resp - MCP response
1063 * @param o_mcp_param - MCP response param
1064 * @param i_txn_size - Buffer size
1065 * @param i_buf - Pointer to the buffer
1067 * @param return ECORE_SUCCESS upon success.
1069 enum _ecore_status_t ecore_mcp_nvm_wr_cmd(struct ecore_hwfn *p_hwfn,
1070 struct ecore_ptt *p_ptt,
1079 * @brief - Sends an NVM read command request to the MFW to get
1084 * @param cmd - Command: DRV_MSG_CODE_NVM_GET_FILE_DATA or
1085 * DRV_MSG_CODE_NVM_READ_NVRAM commands
1086 * @param param - [0:23] - Offset [24:31] - Size
1087 * @param o_mcp_resp - MCP response
1088 * @param o_mcp_param - MCP response param
1089 * @param o_txn_size - Buffer size output
1090 * @param o_buf - Pointer to the buffer returned by the MFW.
1092 * @param return ECORE_SUCCESS upon success.
1094 enum _ecore_status_t ecore_mcp_nvm_rd_cmd(struct ecore_hwfn *p_hwfn,
1095 struct ecore_ptt *p_ptt,
1104 * @brief Read from sfp
1106 * @param p_hwfn - hw function
1107 * @param p_ptt - PTT required for register access
1108 * @param port - transceiver port
1109 * @param addr - I2C address
1110 * @param offset - offset in sfp
1111 * @param len - buffer length
1112 * @param p_buf - buffer to read into
1114 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
1116 enum _ecore_status_t ecore_mcp_phy_sfp_read(struct ecore_hwfn *p_hwfn,
1117 struct ecore_ptt *p_ptt,
1118 u32 port, u32 addr, u32 offset,
1119 u32 len, u8 *p_buf);
1122 * @brief Write to sfp
1124 * @param p_hwfn - hw function
1125 * @param p_ptt - PTT required for register access
1126 * @param port - transceiver port
1127 * @param addr - I2C address
1128 * @param offset - offset in sfp
1129 * @param len - buffer length
1130 * @param p_buf - buffer to write from
1132 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
1134 enum _ecore_status_t ecore_mcp_phy_sfp_write(struct ecore_hwfn *p_hwfn,
1135 struct ecore_ptt *p_ptt,
1136 u32 port, u32 addr, u32 offset,
1137 u32 len, u8 *p_buf);
1142 * @param p_hwfn - hw function
1143 * @param p_ptt - PTT required for register access
1144 * @param gpio - gpio number
1145 * @param gpio_val - value read from gpio
1147 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
1149 enum _ecore_status_t ecore_mcp_gpio_read(struct ecore_hwfn *p_hwfn,
1150 struct ecore_ptt *p_ptt,
1151 u16 gpio, u32 *gpio_val);
1156 * @param p_hwfn - hw function
1157 * @param p_ptt - PTT required for register access
1158 * @param gpio - gpio number
1159 * @param gpio_val - value to write to gpio
1161 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
1163 enum _ecore_status_t ecore_mcp_gpio_write(struct ecore_hwfn *p_hwfn,
1164 struct ecore_ptt *p_ptt,
1165 u16 gpio, u16 gpio_val);
1168 * @brief Gpio get information
1170 * @param p_hwfn - hw function
1171 * @param p_ptt - PTT required for register access
1172 * @param gpio - gpio number
1173 * @param gpio_direction - gpio is output (0) or input (1)
1174 * @param gpio_ctrl - gpio control is uninitialized (0),
1175 * path 0 (1), path 1 (2) or shared(3)
1177 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
1179 enum _ecore_status_t ecore_mcp_gpio_info(struct ecore_hwfn *p_hwfn,
1180 struct ecore_ptt *p_ptt,
1181 u16 gpio, u32 *gpio_direction,
1185 * @brief Bist register test
1187 * @param p_hwfn - hw function
1188 * @param p_ptt - PTT required for register access
1190 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
1192 enum _ecore_status_t ecore_mcp_bist_register_test(struct ecore_hwfn *p_hwfn,
1193 struct ecore_ptt *p_ptt);
1196 * @brief Bist clock test
1198 * @param p_hwfn - hw function
1199 * @param p_ptt - PTT required for register access
1201 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
1203 enum _ecore_status_t ecore_mcp_bist_clock_test(struct ecore_hwfn *p_hwfn,
1204 struct ecore_ptt *p_ptt);
1207 * @brief Bist nvm test - get number of images
1209 * @param p_hwfn - hw function
1210 * @param p_ptt - PTT required for register access
1211 * @param num_images - number of images if operation was
1212 * successful. 0 if not.
1214 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
1216 enum _ecore_status_t ecore_mcp_bist_nvm_test_get_num_images(struct ecore_hwfn *p_hwfn,
1217 struct ecore_ptt *p_ptt,
1221 * @brief Bist nvm test - get image attributes by index
1223 * @param p_hwfn - hw function
1224 * @param p_ptt - PTT required for register access
1225 * @param p_image_att - Attributes of image
1226 * @param image_index - Index of image to get information for
1228 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
1230 enum _ecore_status_t ecore_mcp_bist_nvm_test_get_image_att(struct ecore_hwfn *p_hwfn,
1231 struct ecore_ptt *p_ptt,
1232 struct bist_nvm_image_att *p_image_att,
1236 * @brief ecore_mcp_get_temperature_info - get the status of the temperature
1239 * @param p_hwfn - hw function
1240 * @param p_ptt - PTT required for register access
1241 * @param p_temp_status - A pointer to an ecore_temperature_info structure to
1242 * be filled with the temperature data
1244 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
1246 enum _ecore_status_t
1247 ecore_mcp_get_temperature_info(struct ecore_hwfn *p_hwfn,
1248 struct ecore_ptt *p_ptt,
1249 struct ecore_temperature_info *p_temp_info);
1252 * @brief Get MBA versions - get MBA sub images versions
1254 * @param p_hwfn - hw function
1255 * @param p_ptt - PTT required for register access
1256 * @param p_mba_vers - MBA versions array to fill
1258 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
1260 enum _ecore_status_t ecore_mcp_get_mba_versions(
1261 struct ecore_hwfn *p_hwfn,
1262 struct ecore_ptt *p_ptt,
1263 struct ecore_mba_vers *p_mba_vers);
1266 * @brief Count memory ecc events
1268 * @param p_hwfn - hw function
1269 * @param p_ptt - PTT required for register access
1270 * @param num_events - number of memory ecc events
1272 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
1274 enum _ecore_status_t ecore_mcp_mem_ecc_events(struct ecore_hwfn *p_hwfn,
1275 struct ecore_ptt *p_ptt,
1278 struct ecore_mdump_info {
1288 * @brief - Gets the MFW crash dump configuration and logs info.
1292 * @param p_mdump_info
1294 * @param return ECORE_SUCCESS upon success.
1296 enum _ecore_status_t
1297 ecore_mcp_mdump_get_info(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
1298 struct ecore_mdump_info *p_mdump_info);
1301 * @brief - Clears the MFW crash dump logs.
1306 * @param return ECORE_SUCCESS upon success.
1308 enum _ecore_status_t ecore_mcp_mdump_clear_logs(struct ecore_hwfn *p_hwfn,
1309 struct ecore_ptt *p_ptt);
1312 * @brief - Clear the mdump retained data.
1317 * @param return ECORE_SUCCESS upon success.
1319 enum _ecore_status_t ecore_mcp_mdump_clr_retain(struct ecore_hwfn *p_hwfn,
1320 struct ecore_ptt *p_ptt);
1323 * @brief - Gets the LLDP MAC address.
1327 * @param lldp_mac_addr - a buffer to be filled with the read LLDP MAC address.
1329 * @param return ECORE_SUCCESS upon success.
1331 enum _ecore_status_t ecore_mcp_get_lldp_mac(struct ecore_hwfn *p_hwfn,
1332 struct ecore_ptt *p_ptt,
1333 u8 lldp_mac_addr[ETH_ALEN]);
1336 * @brief - Sets the LLDP MAC address.
1340 * @param lldp_mac_addr - a buffer with the LLDP MAC address to be written.
1342 * @param return ECORE_SUCCESS upon success.
1344 enum _ecore_status_t ecore_mcp_set_lldp_mac(struct ecore_hwfn *p_hwfn,
1345 struct ecore_ptt *p_ptt,
1346 u8 lldp_mac_addr[ETH_ALEN]);
1349 * @brief - Processes the TLV request from MFW i.e., get the required TLV info
1350 * from the ecore client and send it to the MFW.
1355 * @param return ECORE_SUCCESS upon success.
1357 enum _ecore_status_t ecore_mfw_process_tlv_req(struct ecore_hwfn *p_hwfn,
1358 struct ecore_ptt *p_ptt);
1361 * @brief - Update fcoe vlan id value to the MFW.
1365 * @param vlan - fcoe vlan
1367 * @param return ECORE_SUCCESS upon success.
1369 enum _ecore_status_t
1370 ecore_mcp_update_fcoe_cvid(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
1374 * @brief - Update fabric name (wwn) value to the MFW.
1378 * @param wwn - world wide name
1380 * @param return ECORE_SUCCESS upon success.
1382 enum _ecore_status_t
1383 ecore_mcp_update_fcoe_fabric_name(struct ecore_hwfn *p_hwfn,
1384 struct ecore_ptt *p_ptt, u8 *wwn);
1387 * @brief - Return whether management firmware support smart AN
1391 * @return bool - true if feature is supported.
1393 bool ecore_mcp_is_smart_an_supported(struct ecore_hwfn *p_hwfn);
1396 * @brief - Return whether management firmware support setting of
1397 * PCI relaxed ordering.
1401 * @return bool - true if feature is supported.
1403 bool ecore_mcp_rlx_odr_supported(struct ecore_hwfn *p_hwfn);