diff options
Diffstat (limited to 'drivers/net/ethernet/qlogic/qed/qed_mcp.h')
| -rw-r--r-- | drivers/net/ethernet/qlogic/qed/qed_mcp.h | 175 |
1 files changed, 162 insertions, 13 deletions
diff --git a/drivers/net/ethernet/qlogic/qed/qed_mcp.h b/drivers/net/ethernet/qlogic/qed/qed_mcp.h index 8a5c988d0c3c..1adfe52b3905 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_mcp.h +++ b/drivers/net/ethernet/qlogic/qed/qed_mcp.h | |||
| @@ -213,6 +213,44 @@ enum qed_ov_wol { | |||
| 213 | QED_OV_WOL_ENABLED | 213 | QED_OV_WOL_ENABLED |
| 214 | }; | 214 | }; |
| 215 | 215 | ||
| 216 | enum qed_mfw_tlv_type { | ||
| 217 | QED_MFW_TLV_GENERIC = 0x1, /* Core driver TLVs */ | ||
| 218 | QED_MFW_TLV_ETH = 0x2, /* L2 driver TLVs */ | ||
| 219 | QED_MFW_TLV_FCOE = 0x4, /* FCoE protocol TLVs */ | ||
| 220 | QED_MFW_TLV_ISCSI = 0x8, /* SCSI protocol TLVs */ | ||
| 221 | QED_MFW_TLV_MAX = 0x16, | ||
| 222 | }; | ||
| 223 | |||
| 224 | struct qed_mfw_tlv_generic { | ||
| 225 | #define QED_MFW_TLV_FLAGS_SIZE 2 | ||
| 226 | struct { | ||
| 227 | u8 ipv4_csum_offload; | ||
| 228 | u8 lso_supported; | ||
| 229 | bool b_set; | ||
| 230 | } flags; | ||
| 231 | |||
| 232 | #define QED_MFW_TLV_MAC_COUNT 3 | ||
| 233 | /* First entry for primary MAC, 2 secondary MACs possible */ | ||
| 234 | u8 mac[QED_MFW_TLV_MAC_COUNT][6]; | ||
| 235 | bool mac_set[QED_MFW_TLV_MAC_COUNT]; | ||
| 236 | |||
| 237 | u64 rx_frames; | ||
| 238 | bool rx_frames_set; | ||
| 239 | u64 rx_bytes; | ||
| 240 | bool rx_bytes_set; | ||
| 241 | u64 tx_frames; | ||
| 242 | bool tx_frames_set; | ||
| 243 | u64 tx_bytes; | ||
| 244 | bool tx_bytes_set; | ||
| 245 | }; | ||
| 246 | |||
| 247 | union qed_mfw_tlv_data { | ||
| 248 | struct qed_mfw_tlv_generic generic; | ||
| 249 | struct qed_mfw_tlv_eth eth; | ||
| 250 | struct qed_mfw_tlv_fcoe fcoe; | ||
| 251 | struct qed_mfw_tlv_iscsi iscsi; | ||
| 252 | }; | ||
| 253 | |||
| 216 | /** | 254 | /** |
| 217 | * @brief - returns the link params of the hw function | 255 | * @brief - returns the link params of the hw function |
| 218 | * | 256 | * |
| @@ -284,14 +322,61 @@ int qed_mcp_get_mbi_ver(struct qed_hwfn *p_hwfn, | |||
| 284 | * @brief Get media type value of the port. | 322 | * @brief Get media type value of the port. |
| 285 | * | 323 | * |
| 286 | * @param cdev - qed dev pointer | 324 | * @param cdev - qed dev pointer |
| 325 | * @param p_ptt | ||
| 287 | * @param mfw_ver - media type value | 326 | * @param mfw_ver - media type value |
| 288 | * | 327 | * |
| 289 | * @return int - | 328 | * @return int - |
| 290 | * 0 - Operation was successul. | 329 | * 0 - Operation was successul. |
| 291 | * -EBUSY - Operation failed | 330 | * -EBUSY - Operation failed |
| 292 | */ | 331 | */ |
| 293 | int qed_mcp_get_media_type(struct qed_dev *cdev, | 332 | int qed_mcp_get_media_type(struct qed_hwfn *p_hwfn, |
| 294 | u32 *media_type); | 333 | struct qed_ptt *p_ptt, u32 *media_type); |
| 334 | |||
| 335 | /** | ||
| 336 | * @brief Get transceiver data of the port. | ||
| 337 | * | ||
| 338 | * @param cdev - qed dev pointer | ||
| 339 | * @param p_ptt | ||
| 340 | * @param p_transceiver_state - transceiver state. | ||
| 341 | * @param p_transceiver_type - media type value | ||
| 342 | * | ||
| 343 | * @return int - | ||
| 344 | * 0 - Operation was successful. | ||
| 345 | * -EBUSY - Operation failed | ||
| 346 | */ | ||
| 347 | int qed_mcp_get_transceiver_data(struct qed_hwfn *p_hwfn, | ||
| 348 | struct qed_ptt *p_ptt, | ||
| 349 | u32 *p_transceiver_state, | ||
| 350 | u32 *p_tranceiver_type); | ||
| 351 | |||
| 352 | /** | ||
| 353 | * @brief Get transceiver supported speed mask. | ||
| 354 | * | ||
| 355 | * @param cdev - qed dev pointer | ||
| 356 | * @param p_ptt | ||
| 357 | * @param p_speed_mask - Bit mask of all supported speeds. | ||
| 358 | * | ||
| 359 | * @return int - | ||
| 360 | * 0 - Operation was successful. | ||
| 361 | * -EBUSY - Operation failed | ||
| 362 | */ | ||
| 363 | |||
| 364 | int qed_mcp_trans_speed_mask(struct qed_hwfn *p_hwfn, | ||
| 365 | struct qed_ptt *p_ptt, u32 *p_speed_mask); | ||
| 366 | |||
| 367 | /** | ||
| 368 | * @brief Get board configuration. | ||
| 369 | * | ||
| 370 | * @param cdev - qed dev pointer | ||
| 371 | * @param p_ptt | ||
| 372 | * @param p_board_config - Board config. | ||
| 373 | * | ||
| 374 | * @return int - | ||
| 375 | * 0 - Operation was successful. | ||
| 376 | * -EBUSY - Operation failed | ||
| 377 | */ | ||
| 378 | int qed_mcp_get_board_config(struct qed_hwfn *p_hwfn, | ||
| 379 | struct qed_ptt *p_ptt, u32 *p_board_config); | ||
| 295 | 380 | ||
| 296 | /** | 381 | /** |
| 297 | * @brief General function for sending commands to the MCP | 382 | * @brief General function for sending commands to the MCP |
| @@ -486,7 +571,20 @@ struct qed_nvm_image_att { | |||
| 486 | * @brief Allows reading a whole nvram image | 571 | * @brief Allows reading a whole nvram image |
| 487 | * | 572 | * |
| 488 | * @param p_hwfn | 573 | * @param p_hwfn |
| 489 | * @param p_ptt | 574 | * @param image_id - image to get attributes for |
| 575 | * @param p_image_att - image attributes structure into which to fill data | ||
| 576 | * | ||
| 577 | * @return int - 0 - operation was successful. | ||
| 578 | */ | ||
| 579 | int | ||
| 580 | qed_mcp_get_nvm_image_att(struct qed_hwfn *p_hwfn, | ||
| 581 | enum qed_nvm_images image_id, | ||
| 582 | struct qed_nvm_image_att *p_image_att); | ||
| 583 | |||
| 584 | /** | ||
| 585 | * @brief Allows reading a whole nvram image | ||
| 586 | * | ||
| 587 | * @param p_hwfn | ||
| 490 | * @param image_id - image requested for reading | 588 | * @param image_id - image requested for reading |
| 491 | * @param p_buffer - allocated buffer into which to fill data | 589 | * @param p_buffer - allocated buffer into which to fill data |
| 492 | * @param buffer_len - length of the allocated buffer. | 590 | * @param buffer_len - length of the allocated buffer. |
| @@ -494,7 +592,6 @@ struct qed_nvm_image_att { | |||
| 494 | * @return 0 iff p_buffer now contains the nvram image. | 592 | * @return 0 iff p_buffer now contains the nvram image. |
| 495 | */ | 593 | */ |
| 496 | int qed_mcp_get_nvm_image(struct qed_hwfn *p_hwfn, | 594 | int qed_mcp_get_nvm_image(struct qed_hwfn *p_hwfn, |
| 497 | struct qed_ptt *p_ptt, | ||
| 498 | enum qed_nvm_images image_id, | 595 | enum qed_nvm_images image_id, |
| 499 | u8 *p_buffer, u32 buffer_len); | 596 | u8 *p_buffer, u32 buffer_len); |
| 500 | 597 | ||
| @@ -549,6 +646,17 @@ int qed_mcp_bist_nvm_get_image_att(struct qed_hwfn *p_hwfn, | |||
| 549 | struct bist_nvm_image_att *p_image_att, | 646 | struct bist_nvm_image_att *p_image_att, |
| 550 | u32 image_index); | 647 | u32 image_index); |
| 551 | 648 | ||
| 649 | /** | ||
| 650 | * @brief - Processes the TLV request from MFW i.e., get the required TLV info | ||
| 651 | * from the qed client and send it to the MFW. | ||
| 652 | * | ||
| 653 | * @param p_hwfn | ||
| 654 | * @param p_ptt | ||
| 655 | * | ||
| 656 | * @param return 0 upon success. | ||
| 657 | */ | ||
| 658 | int qed_mfw_process_tlv_req(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt); | ||
| 659 | |||
| 552 | /* Using hwfn number (and not pf_num) is required since in CMT mode, | 660 | /* Using hwfn number (and not pf_num) is required since in CMT mode, |
| 553 | * same pf_num may be used by two different hwfn | 661 | * same pf_num may be used by two different hwfn |
| 554 | * TODO - this shouldn't really be in .h file, but until all fields | 662 | * TODO - this shouldn't really be in .h file, but until all fields |
| @@ -574,11 +682,14 @@ struct qed_mcp_info { | |||
| 574 | */ | 682 | */ |
| 575 | spinlock_t cmd_lock; | 683 | spinlock_t cmd_lock; |
| 576 | 684 | ||
| 685 | /* Flag to indicate whether sending a MFW mailbox command is blocked */ | ||
| 686 | bool b_block_cmd; | ||
| 687 | |||
| 577 | /* Spinlock used for syncing SW link-changes and link-changes | 688 | /* Spinlock used for syncing SW link-changes and link-changes |
| 578 | * originating from attention context. | 689 | * originating from attention context. |
| 579 | */ | 690 | */ |
| 580 | spinlock_t link_lock; | 691 | spinlock_t link_lock; |
| 581 | bool block_mb_sending; | 692 | |
| 582 | u32 public_base; | 693 | u32 public_base; |
| 583 | u32 drv_mb_addr; | 694 | u32 drv_mb_addr; |
| 584 | u32 mfw_mb_addr; | 695 | u32 mfw_mb_addr; |
| @@ -599,14 +710,28 @@ struct qed_mcp_info { | |||
| 599 | }; | 710 | }; |
| 600 | 711 | ||
| 601 | struct qed_mcp_mb_params { | 712 | struct qed_mcp_mb_params { |
| 602 | u32 cmd; | 713 | u32 cmd; |
| 603 | u32 param; | 714 | u32 param; |
| 604 | void *p_data_src; | 715 | void *p_data_src; |
| 605 | u8 data_src_size; | 716 | void *p_data_dst; |
| 606 | void *p_data_dst; | 717 | u8 data_src_size; |
| 607 | u8 data_dst_size; | 718 | u8 data_dst_size; |
| 608 | u32 mcp_resp; | 719 | u32 mcp_resp; |
| 609 | u32 mcp_param; | 720 | u32 mcp_param; |
| 721 | u32 flags; | ||
| 722 | #define QED_MB_FLAG_CAN_SLEEP (0x1 << 0) | ||
| 723 | #define QED_MB_FLAG_AVOID_BLOCK (0x1 << 1) | ||
| 724 | #define QED_MB_FLAGS_IS_SET(params, flag) \ | ||
| 725 | ({ typeof(params) __params = (params); \ | ||
| 726 | (__params && (__params->flags & QED_MB_FLAG_ ## flag)); }) | ||
| 727 | }; | ||
| 728 | |||
| 729 | struct qed_drv_tlv_hdr { | ||
| 730 | u8 tlv_type; | ||
| 731 | u8 tlv_length; /* In dwords - not including this header */ | ||
| 732 | u8 tlv_reserved; | ||
| 733 | #define QED_DRV_TLV_FLAGS_CHANGED 0x01 | ||
| 734 | u8 tlv_flags; | ||
| 610 | }; | 735 | }; |
| 611 | 736 | ||
| 612 | /** | 737 | /** |
| @@ -771,6 +896,22 @@ int qed_mcp_nvm_rd_cmd(struct qed_hwfn *p_hwfn, | |||
| 771 | u32 *o_mcp_param, u32 *o_txn_size, u32 *o_buf); | 896 | u32 *o_mcp_param, u32 *o_txn_size, u32 *o_buf); |
| 772 | 897 | ||
| 773 | /** | 898 | /** |
| 899 | * @brief Read from sfp | ||
| 900 | * | ||
| 901 | * @param p_hwfn - hw function | ||
| 902 | * @param p_ptt - PTT required for register access | ||
| 903 | * @param port - transceiver port | ||
| 904 | * @param addr - I2C address | ||
| 905 | * @param offset - offset in sfp | ||
| 906 | * @param len - buffer length | ||
| 907 | * @param p_buf - buffer to read into | ||
| 908 | * | ||
| 909 | * @return int - 0 - operation was successful. | ||
| 910 | */ | ||
| 911 | int qed_mcp_phy_sfp_read(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, | ||
| 912 | u32 port, u32 addr, u32 offset, u32 len, u8 *p_buf); | ||
| 913 | |||
| 914 | /** | ||
| 774 | * @brief indicates whether the MFW objects [under mcp_info] are accessible | 915 | * @brief indicates whether the MFW objects [under mcp_info] are accessible |
| 775 | * | 916 | * |
| 776 | * @param p_hwfn | 917 | * @param p_hwfn |
| @@ -993,6 +1134,14 @@ int qed_mcp_get_capabilities(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt); | |||
| 993 | int qed_mcp_set_capabilities(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt); | 1134 | int qed_mcp_set_capabilities(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt); |
| 994 | 1135 | ||
| 995 | /** | 1136 | /** |
| 1137 | * @brief Read ufp config from the shared memory. | ||
| 1138 | * | ||
| 1139 | * @param p_hwfn | ||
| 1140 | * @param p_ptt | ||
| 1141 | */ | ||
| 1142 | void qed_mcp_read_ufp_config(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt); | ||
| 1143 | |||
| 1144 | /** | ||
| 996 | * @brief Populate the nvm info shadow in the given hardware function | 1145 | * @brief Populate the nvm info shadow in the given hardware function |
| 997 | * | 1146 | * |
| 998 | * @param p_hwfn | 1147 | * @param p_hwfn |
