18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ 28c2ecf20Sopenharmony_ci/* QLogic qed NIC Driver 38c2ecf20Sopenharmony_ci * Copyright (c) 2015-2017 QLogic Corporation 48c2ecf20Sopenharmony_ci * Copyright (c) 2019-2020 Marvell International Ltd. 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#ifndef _QED_H 88c2ecf20Sopenharmony_ci#define _QED_H 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include <linux/types.h> 118c2ecf20Sopenharmony_ci#include <linux/io.h> 128c2ecf20Sopenharmony_ci#include <linux/delay.h> 138c2ecf20Sopenharmony_ci#include <linux/firmware.h> 148c2ecf20Sopenharmony_ci#include <linux/interrupt.h> 158c2ecf20Sopenharmony_ci#include <linux/list.h> 168c2ecf20Sopenharmony_ci#include <linux/mutex.h> 178c2ecf20Sopenharmony_ci#include <linux/pci.h> 188c2ecf20Sopenharmony_ci#include <linux/slab.h> 198c2ecf20Sopenharmony_ci#include <linux/string.h> 208c2ecf20Sopenharmony_ci#include <linux/workqueue.h> 218c2ecf20Sopenharmony_ci#include <linux/zlib.h> 228c2ecf20Sopenharmony_ci#include <linux/hashtable.h> 238c2ecf20Sopenharmony_ci#include <linux/qed/qed_if.h> 248c2ecf20Sopenharmony_ci#include "qed_debug.h" 258c2ecf20Sopenharmony_ci#include "qed_hsi.h" 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ciextern const struct qed_common_ops qed_common_ops_pass; 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci#define QED_MAJOR_VERSION 8 308c2ecf20Sopenharmony_ci#define QED_MINOR_VERSION 37 318c2ecf20Sopenharmony_ci#define QED_REVISION_VERSION 0 328c2ecf20Sopenharmony_ci#define QED_ENGINEERING_VERSION 20 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci#define QED_VERSION \ 358c2ecf20Sopenharmony_ci ((QED_MAJOR_VERSION << 24) | (QED_MINOR_VERSION << 16) | \ 368c2ecf20Sopenharmony_ci (QED_REVISION_VERSION << 8) | QED_ENGINEERING_VERSION) 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci#define STORM_FW_VERSION \ 398c2ecf20Sopenharmony_ci ((FW_MAJOR_VERSION << 24) | (FW_MINOR_VERSION << 16) | \ 408c2ecf20Sopenharmony_ci (FW_REVISION_VERSION << 8) | FW_ENGINEERING_VERSION) 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci#define MAX_HWFNS_PER_DEVICE (4) 438c2ecf20Sopenharmony_ci#define NAME_SIZE 16 448c2ecf20Sopenharmony_ci#define VER_SIZE 16 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci#define QED_WFQ_UNIT 100 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci#define QED_WID_SIZE (1024) 498c2ecf20Sopenharmony_ci#define QED_MIN_WIDS (4) 508c2ecf20Sopenharmony_ci#define QED_PF_DEMS_SIZE (4) 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci/* cau states */ 538c2ecf20Sopenharmony_cienum qed_coalescing_mode { 548c2ecf20Sopenharmony_ci QED_COAL_MODE_DISABLE, 558c2ecf20Sopenharmony_ci QED_COAL_MODE_ENABLE 568c2ecf20Sopenharmony_ci}; 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_cienum qed_nvm_cmd { 598c2ecf20Sopenharmony_ci QED_PUT_FILE_BEGIN = DRV_MSG_CODE_NVM_PUT_FILE_BEGIN, 608c2ecf20Sopenharmony_ci QED_PUT_FILE_DATA = DRV_MSG_CODE_NVM_PUT_FILE_DATA, 618c2ecf20Sopenharmony_ci QED_NVM_WRITE_NVRAM = DRV_MSG_CODE_NVM_WRITE_NVRAM, 628c2ecf20Sopenharmony_ci QED_GET_MCP_NVM_RESP = 0xFFFFFF00 638c2ecf20Sopenharmony_ci}; 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_cistruct qed_eth_cb_ops; 668c2ecf20Sopenharmony_cistruct qed_dev_info; 678c2ecf20Sopenharmony_ciunion qed_mcp_protocol_stats; 688c2ecf20Sopenharmony_cienum qed_mcp_protocol_type; 698c2ecf20Sopenharmony_cienum qed_mfw_tlv_type; 708c2ecf20Sopenharmony_ciunion qed_mfw_tlv_data; 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci/* helpers */ 738c2ecf20Sopenharmony_ci#define QED_MFW_GET_FIELD(name, field) \ 748c2ecf20Sopenharmony_ci (((name) & (field ## _MASK)) >> (field ## _SHIFT)) 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci#define QED_MFW_SET_FIELD(name, field, value) \ 778c2ecf20Sopenharmony_ci do { \ 788c2ecf20Sopenharmony_ci (name) &= ~(field ## _MASK); \ 798c2ecf20Sopenharmony_ci (name) |= (((value) << (field ## _SHIFT)) & (field ## _MASK));\ 808c2ecf20Sopenharmony_ci } while (0) 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_cistatic inline u32 qed_db_addr(u32 cid, u32 DEMS) 838c2ecf20Sopenharmony_ci{ 848c2ecf20Sopenharmony_ci u32 db_addr = FIELD_VALUE(DB_LEGACY_ADDR_DEMS, DEMS) | 858c2ecf20Sopenharmony_ci (cid * QED_PF_DEMS_SIZE); 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci return db_addr; 888c2ecf20Sopenharmony_ci} 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_cistatic inline u32 qed_db_addr_vf(u32 cid, u32 DEMS) 918c2ecf20Sopenharmony_ci{ 928c2ecf20Sopenharmony_ci u32 db_addr = FIELD_VALUE(DB_LEGACY_ADDR_DEMS, DEMS) | 938c2ecf20Sopenharmony_ci FIELD_VALUE(DB_LEGACY_ADDR_ICID, cid); 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ci return db_addr; 968c2ecf20Sopenharmony_ci} 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci#define ALIGNED_TYPE_SIZE(type_name, p_hwfn) \ 998c2ecf20Sopenharmony_ci ((sizeof(type_name) + (u32)(1 << (p_hwfn->cdev->cache_shift)) - 1) & \ 1008c2ecf20Sopenharmony_ci ~((1 << (p_hwfn->cdev->cache_shift)) - 1)) 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ci#define for_each_hwfn(cdev, i) for (i = 0; i < cdev->num_hwfns; i++) 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci#define D_TRINE(val, cond1, cond2, true1, true2, def) \ 1058c2ecf20Sopenharmony_ci (val == (cond1) ? true1 : \ 1068c2ecf20Sopenharmony_ci (val == (cond2) ? true2 : def)) 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ci/* forward */ 1098c2ecf20Sopenharmony_cistruct qed_ptt_pool; 1108c2ecf20Sopenharmony_cistruct qed_spq; 1118c2ecf20Sopenharmony_cistruct qed_sb_info; 1128c2ecf20Sopenharmony_cistruct qed_sb_attn_info; 1138c2ecf20Sopenharmony_cistruct qed_cxt_mngr; 1148c2ecf20Sopenharmony_cistruct qed_sb_sp_info; 1158c2ecf20Sopenharmony_cistruct qed_ll2_info; 1168c2ecf20Sopenharmony_cistruct qed_mcp_info; 1178c2ecf20Sopenharmony_cistruct qed_llh_info; 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_cistruct qed_rt_data { 1208c2ecf20Sopenharmony_ci u32 *init_val; 1218c2ecf20Sopenharmony_ci bool *b_valid; 1228c2ecf20Sopenharmony_ci}; 1238c2ecf20Sopenharmony_ci 1248c2ecf20Sopenharmony_cienum qed_tunn_mode { 1258c2ecf20Sopenharmony_ci QED_MODE_L2GENEVE_TUNN, 1268c2ecf20Sopenharmony_ci QED_MODE_IPGENEVE_TUNN, 1278c2ecf20Sopenharmony_ci QED_MODE_L2GRE_TUNN, 1288c2ecf20Sopenharmony_ci QED_MODE_IPGRE_TUNN, 1298c2ecf20Sopenharmony_ci QED_MODE_VXLAN_TUNN, 1308c2ecf20Sopenharmony_ci}; 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_cienum qed_tunn_clss { 1338c2ecf20Sopenharmony_ci QED_TUNN_CLSS_MAC_VLAN, 1348c2ecf20Sopenharmony_ci QED_TUNN_CLSS_MAC_VNI, 1358c2ecf20Sopenharmony_ci QED_TUNN_CLSS_INNER_MAC_VLAN, 1368c2ecf20Sopenharmony_ci QED_TUNN_CLSS_INNER_MAC_VNI, 1378c2ecf20Sopenharmony_ci QED_TUNN_CLSS_MAC_VLAN_DUAL_STAGE, 1388c2ecf20Sopenharmony_ci MAX_QED_TUNN_CLSS, 1398c2ecf20Sopenharmony_ci}; 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_cistruct qed_tunn_update_type { 1428c2ecf20Sopenharmony_ci bool b_update_mode; 1438c2ecf20Sopenharmony_ci bool b_mode_enabled; 1448c2ecf20Sopenharmony_ci enum qed_tunn_clss tun_cls; 1458c2ecf20Sopenharmony_ci}; 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_cistruct qed_tunn_update_udp_port { 1488c2ecf20Sopenharmony_ci bool b_update_port; 1498c2ecf20Sopenharmony_ci u16 port; 1508c2ecf20Sopenharmony_ci}; 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_cistruct qed_tunnel_info { 1538c2ecf20Sopenharmony_ci struct qed_tunn_update_type vxlan; 1548c2ecf20Sopenharmony_ci struct qed_tunn_update_type l2_geneve; 1558c2ecf20Sopenharmony_ci struct qed_tunn_update_type ip_geneve; 1568c2ecf20Sopenharmony_ci struct qed_tunn_update_type l2_gre; 1578c2ecf20Sopenharmony_ci struct qed_tunn_update_type ip_gre; 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_ci struct qed_tunn_update_udp_port vxlan_port; 1608c2ecf20Sopenharmony_ci struct qed_tunn_update_udp_port geneve_port; 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_ci bool b_update_rx_cls; 1638c2ecf20Sopenharmony_ci bool b_update_tx_cls; 1648c2ecf20Sopenharmony_ci}; 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_cistruct qed_tunn_start_params { 1678c2ecf20Sopenharmony_ci unsigned long tunn_mode; 1688c2ecf20Sopenharmony_ci u16 vxlan_udp_port; 1698c2ecf20Sopenharmony_ci u16 geneve_udp_port; 1708c2ecf20Sopenharmony_ci u8 update_vxlan_udp_port; 1718c2ecf20Sopenharmony_ci u8 update_geneve_udp_port; 1728c2ecf20Sopenharmony_ci u8 tunn_clss_vxlan; 1738c2ecf20Sopenharmony_ci u8 tunn_clss_l2geneve; 1748c2ecf20Sopenharmony_ci u8 tunn_clss_ipgeneve; 1758c2ecf20Sopenharmony_ci u8 tunn_clss_l2gre; 1768c2ecf20Sopenharmony_ci u8 tunn_clss_ipgre; 1778c2ecf20Sopenharmony_ci}; 1788c2ecf20Sopenharmony_ci 1798c2ecf20Sopenharmony_cistruct qed_tunn_update_params { 1808c2ecf20Sopenharmony_ci unsigned long tunn_mode_update_mask; 1818c2ecf20Sopenharmony_ci unsigned long tunn_mode; 1828c2ecf20Sopenharmony_ci u16 vxlan_udp_port; 1838c2ecf20Sopenharmony_ci u16 geneve_udp_port; 1848c2ecf20Sopenharmony_ci u8 update_rx_pf_clss; 1858c2ecf20Sopenharmony_ci u8 update_tx_pf_clss; 1868c2ecf20Sopenharmony_ci u8 update_vxlan_udp_port; 1878c2ecf20Sopenharmony_ci u8 update_geneve_udp_port; 1888c2ecf20Sopenharmony_ci u8 tunn_clss_vxlan; 1898c2ecf20Sopenharmony_ci u8 tunn_clss_l2geneve; 1908c2ecf20Sopenharmony_ci u8 tunn_clss_ipgeneve; 1918c2ecf20Sopenharmony_ci u8 tunn_clss_l2gre; 1928c2ecf20Sopenharmony_ci u8 tunn_clss_ipgre; 1938c2ecf20Sopenharmony_ci}; 1948c2ecf20Sopenharmony_ci 1958c2ecf20Sopenharmony_ci/* The PCI personality is not quite synonymous to protocol ID: 1968c2ecf20Sopenharmony_ci * 1. All personalities need CORE connections 1978c2ecf20Sopenharmony_ci * 2. The Ethernet personality may support also the RoCE/iWARP protocol 1988c2ecf20Sopenharmony_ci */ 1998c2ecf20Sopenharmony_cienum qed_pci_personality { 2008c2ecf20Sopenharmony_ci QED_PCI_ETH, 2018c2ecf20Sopenharmony_ci QED_PCI_FCOE, 2028c2ecf20Sopenharmony_ci QED_PCI_ISCSI, 2038c2ecf20Sopenharmony_ci QED_PCI_ETH_ROCE, 2048c2ecf20Sopenharmony_ci QED_PCI_ETH_IWARP, 2058c2ecf20Sopenharmony_ci QED_PCI_ETH_RDMA, 2068c2ecf20Sopenharmony_ci QED_PCI_DEFAULT, /* default in shmem */ 2078c2ecf20Sopenharmony_ci}; 2088c2ecf20Sopenharmony_ci 2098c2ecf20Sopenharmony_ci/* All VFs are symmetric, all counters are PF + all VFs */ 2108c2ecf20Sopenharmony_cistruct qed_qm_iids { 2118c2ecf20Sopenharmony_ci u32 cids; 2128c2ecf20Sopenharmony_ci u32 vf_cids; 2138c2ecf20Sopenharmony_ci u32 tids; 2148c2ecf20Sopenharmony_ci}; 2158c2ecf20Sopenharmony_ci 2168c2ecf20Sopenharmony_ci/* HW / FW resources, output of features supported below, most information 2178c2ecf20Sopenharmony_ci * is received from MFW. 2188c2ecf20Sopenharmony_ci */ 2198c2ecf20Sopenharmony_cienum qed_resources { 2208c2ecf20Sopenharmony_ci QED_SB, 2218c2ecf20Sopenharmony_ci QED_L2_QUEUE, 2228c2ecf20Sopenharmony_ci QED_VPORT, 2238c2ecf20Sopenharmony_ci QED_RSS_ENG, 2248c2ecf20Sopenharmony_ci QED_PQ, 2258c2ecf20Sopenharmony_ci QED_RL, 2268c2ecf20Sopenharmony_ci QED_MAC, 2278c2ecf20Sopenharmony_ci QED_VLAN, 2288c2ecf20Sopenharmony_ci QED_RDMA_CNQ_RAM, 2298c2ecf20Sopenharmony_ci QED_ILT, 2308c2ecf20Sopenharmony_ci QED_LL2_RAM_QUEUE, 2318c2ecf20Sopenharmony_ci QED_LL2_CTX_QUEUE, 2328c2ecf20Sopenharmony_ci QED_CMDQS_CQS, 2338c2ecf20Sopenharmony_ci QED_RDMA_STATS_QUEUE, 2348c2ecf20Sopenharmony_ci QED_BDQ, 2358c2ecf20Sopenharmony_ci QED_MAX_RESC, 2368c2ecf20Sopenharmony_ci}; 2378c2ecf20Sopenharmony_ci 2388c2ecf20Sopenharmony_cienum QED_FEATURE { 2398c2ecf20Sopenharmony_ci QED_PF_L2_QUE, 2408c2ecf20Sopenharmony_ci QED_VF, 2418c2ecf20Sopenharmony_ci QED_RDMA_CNQ, 2428c2ecf20Sopenharmony_ci QED_ISCSI_CQ, 2438c2ecf20Sopenharmony_ci QED_FCOE_CQ, 2448c2ecf20Sopenharmony_ci QED_VF_L2_QUE, 2458c2ecf20Sopenharmony_ci QED_MAX_FEATURES, 2468c2ecf20Sopenharmony_ci}; 2478c2ecf20Sopenharmony_ci 2488c2ecf20Sopenharmony_cienum qed_dev_cap { 2498c2ecf20Sopenharmony_ci QED_DEV_CAP_ETH, 2508c2ecf20Sopenharmony_ci QED_DEV_CAP_FCOE, 2518c2ecf20Sopenharmony_ci QED_DEV_CAP_ISCSI, 2528c2ecf20Sopenharmony_ci QED_DEV_CAP_ROCE, 2538c2ecf20Sopenharmony_ci QED_DEV_CAP_IWARP, 2548c2ecf20Sopenharmony_ci}; 2558c2ecf20Sopenharmony_ci 2568c2ecf20Sopenharmony_cienum qed_wol_support { 2578c2ecf20Sopenharmony_ci QED_WOL_SUPPORT_NONE, 2588c2ecf20Sopenharmony_ci QED_WOL_SUPPORT_PME, 2598c2ecf20Sopenharmony_ci}; 2608c2ecf20Sopenharmony_ci 2618c2ecf20Sopenharmony_cienum qed_db_rec_exec { 2628c2ecf20Sopenharmony_ci DB_REC_DRY_RUN, 2638c2ecf20Sopenharmony_ci DB_REC_REAL_DEAL, 2648c2ecf20Sopenharmony_ci DB_REC_ONCE, 2658c2ecf20Sopenharmony_ci}; 2668c2ecf20Sopenharmony_ci 2678c2ecf20Sopenharmony_cistruct qed_hw_info { 2688c2ecf20Sopenharmony_ci /* PCI personality */ 2698c2ecf20Sopenharmony_ci enum qed_pci_personality personality; 2708c2ecf20Sopenharmony_ci#define QED_IS_RDMA_PERSONALITY(dev) \ 2718c2ecf20Sopenharmony_ci ((dev)->hw_info.personality == QED_PCI_ETH_ROCE || \ 2728c2ecf20Sopenharmony_ci (dev)->hw_info.personality == QED_PCI_ETH_IWARP || \ 2738c2ecf20Sopenharmony_ci (dev)->hw_info.personality == QED_PCI_ETH_RDMA) 2748c2ecf20Sopenharmony_ci#define QED_IS_ROCE_PERSONALITY(dev) \ 2758c2ecf20Sopenharmony_ci ((dev)->hw_info.personality == QED_PCI_ETH_ROCE || \ 2768c2ecf20Sopenharmony_ci (dev)->hw_info.personality == QED_PCI_ETH_RDMA) 2778c2ecf20Sopenharmony_ci#define QED_IS_IWARP_PERSONALITY(dev) \ 2788c2ecf20Sopenharmony_ci ((dev)->hw_info.personality == QED_PCI_ETH_IWARP || \ 2798c2ecf20Sopenharmony_ci (dev)->hw_info.personality == QED_PCI_ETH_RDMA) 2808c2ecf20Sopenharmony_ci#define QED_IS_L2_PERSONALITY(dev) \ 2818c2ecf20Sopenharmony_ci ((dev)->hw_info.personality == QED_PCI_ETH || \ 2828c2ecf20Sopenharmony_ci QED_IS_RDMA_PERSONALITY(dev)) 2838c2ecf20Sopenharmony_ci#define QED_IS_FCOE_PERSONALITY(dev) \ 2848c2ecf20Sopenharmony_ci ((dev)->hw_info.personality == QED_PCI_FCOE) 2858c2ecf20Sopenharmony_ci#define QED_IS_ISCSI_PERSONALITY(dev) \ 2868c2ecf20Sopenharmony_ci ((dev)->hw_info.personality == QED_PCI_ISCSI) 2878c2ecf20Sopenharmony_ci 2888c2ecf20Sopenharmony_ci /* Resource Allocation scheme results */ 2898c2ecf20Sopenharmony_ci u32 resc_start[QED_MAX_RESC]; 2908c2ecf20Sopenharmony_ci u32 resc_num[QED_MAX_RESC]; 2918c2ecf20Sopenharmony_ci#define RESC_START(_p_hwfn, resc) ((_p_hwfn)->hw_info.resc_start[resc]) 2928c2ecf20Sopenharmony_ci#define RESC_NUM(_p_hwfn, resc) ((_p_hwfn)->hw_info.resc_num[resc]) 2938c2ecf20Sopenharmony_ci#define RESC_END(_p_hwfn, resc) (RESC_START(_p_hwfn, resc) + \ 2948c2ecf20Sopenharmony_ci RESC_NUM(_p_hwfn, resc)) 2958c2ecf20Sopenharmony_ci 2968c2ecf20Sopenharmony_ci u32 feat_num[QED_MAX_FEATURES]; 2978c2ecf20Sopenharmony_ci#define FEAT_NUM(_p_hwfn, resc) ((_p_hwfn)->hw_info.feat_num[resc]) 2988c2ecf20Sopenharmony_ci 2998c2ecf20Sopenharmony_ci /* Amount of traffic classes HW supports */ 3008c2ecf20Sopenharmony_ci u8 num_hw_tc; 3018c2ecf20Sopenharmony_ci 3028c2ecf20Sopenharmony_ci /* Amount of TCs which should be active according to DCBx or upper 3038c2ecf20Sopenharmony_ci * layer driver configuration. 3048c2ecf20Sopenharmony_ci */ 3058c2ecf20Sopenharmony_ci u8 num_active_tc; 3068c2ecf20Sopenharmony_ci 3078c2ecf20Sopenharmony_ci u8 offload_tc; 3088c2ecf20Sopenharmony_ci bool offload_tc_set; 3098c2ecf20Sopenharmony_ci 3108c2ecf20Sopenharmony_ci bool multi_tc_roce_en; 3118c2ecf20Sopenharmony_ci#define IS_QED_MULTI_TC_ROCE(p_hwfn) ((p_hwfn)->hw_info.multi_tc_roce_en) 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_ci u32 concrete_fid; 3148c2ecf20Sopenharmony_ci u16 opaque_fid; 3158c2ecf20Sopenharmony_ci u16 ovlan; 3168c2ecf20Sopenharmony_ci u32 part_num[4]; 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_ci unsigned char hw_mac_addr[ETH_ALEN]; 3198c2ecf20Sopenharmony_ci u64 node_wwn; 3208c2ecf20Sopenharmony_ci u64 port_wwn; 3218c2ecf20Sopenharmony_ci 3228c2ecf20Sopenharmony_ci u16 num_fcoe_conns; 3238c2ecf20Sopenharmony_ci 3248c2ecf20Sopenharmony_ci struct qed_igu_info *p_igu_info; 3258c2ecf20Sopenharmony_ci 3268c2ecf20Sopenharmony_ci u32 hw_mode; 3278c2ecf20Sopenharmony_ci unsigned long device_capabilities; 3288c2ecf20Sopenharmony_ci u16 mtu; 3298c2ecf20Sopenharmony_ci 3308c2ecf20Sopenharmony_ci enum qed_wol_support b_wol_support; 3318c2ecf20Sopenharmony_ci}; 3328c2ecf20Sopenharmony_ci 3338c2ecf20Sopenharmony_ci/* maximun size of read/write commands (HW limit) */ 3348c2ecf20Sopenharmony_ci#define DMAE_MAX_RW_SIZE 0x2000 3358c2ecf20Sopenharmony_ci 3368c2ecf20Sopenharmony_cistruct qed_dmae_info { 3378c2ecf20Sopenharmony_ci /* Mutex for synchronizing access to functions */ 3388c2ecf20Sopenharmony_ci struct mutex mutex; 3398c2ecf20Sopenharmony_ci 3408c2ecf20Sopenharmony_ci u8 channel; 3418c2ecf20Sopenharmony_ci 3428c2ecf20Sopenharmony_ci dma_addr_t completion_word_phys_addr; 3438c2ecf20Sopenharmony_ci 3448c2ecf20Sopenharmony_ci /* The memory location where the DMAE writes the completion 3458c2ecf20Sopenharmony_ci * value when an operation is finished on this context. 3468c2ecf20Sopenharmony_ci */ 3478c2ecf20Sopenharmony_ci u32 *p_completion_word; 3488c2ecf20Sopenharmony_ci 3498c2ecf20Sopenharmony_ci dma_addr_t intermediate_buffer_phys_addr; 3508c2ecf20Sopenharmony_ci 3518c2ecf20Sopenharmony_ci /* An intermediate buffer for DMAE operations that use virtual 3528c2ecf20Sopenharmony_ci * addresses - data is DMA'd to/from this buffer and then 3538c2ecf20Sopenharmony_ci * memcpy'd to/from the virtual address 3548c2ecf20Sopenharmony_ci */ 3558c2ecf20Sopenharmony_ci u32 *p_intermediate_buffer; 3568c2ecf20Sopenharmony_ci 3578c2ecf20Sopenharmony_ci dma_addr_t dmae_cmd_phys_addr; 3588c2ecf20Sopenharmony_ci struct dmae_cmd *p_dmae_cmd; 3598c2ecf20Sopenharmony_ci}; 3608c2ecf20Sopenharmony_ci 3618c2ecf20Sopenharmony_cistruct qed_wfq_data { 3628c2ecf20Sopenharmony_ci /* when feature is configured for at least 1 vport */ 3638c2ecf20Sopenharmony_ci u32 min_speed; 3648c2ecf20Sopenharmony_ci bool configured; 3658c2ecf20Sopenharmony_ci}; 3668c2ecf20Sopenharmony_ci 3678c2ecf20Sopenharmony_cistruct qed_qm_info { 3688c2ecf20Sopenharmony_ci struct init_qm_pq_params *qm_pq_params; 3698c2ecf20Sopenharmony_ci struct init_qm_vport_params *qm_vport_params; 3708c2ecf20Sopenharmony_ci struct init_qm_port_params *qm_port_params; 3718c2ecf20Sopenharmony_ci u16 start_pq; 3728c2ecf20Sopenharmony_ci u8 start_vport; 3738c2ecf20Sopenharmony_ci u16 pure_lb_pq; 3748c2ecf20Sopenharmony_ci u16 first_ofld_pq; 3758c2ecf20Sopenharmony_ci u16 first_llt_pq; 3768c2ecf20Sopenharmony_ci u16 pure_ack_pq; 3778c2ecf20Sopenharmony_ci u16 ooo_pq; 3788c2ecf20Sopenharmony_ci u16 first_vf_pq; 3798c2ecf20Sopenharmony_ci u16 first_mcos_pq; 3808c2ecf20Sopenharmony_ci u16 first_rl_pq; 3818c2ecf20Sopenharmony_ci u16 num_pqs; 3828c2ecf20Sopenharmony_ci u16 num_vf_pqs; 3838c2ecf20Sopenharmony_ci u8 num_vports; 3848c2ecf20Sopenharmony_ci u8 max_phys_tcs_per_port; 3858c2ecf20Sopenharmony_ci u8 ooo_tc; 3868c2ecf20Sopenharmony_ci bool pf_rl_en; 3878c2ecf20Sopenharmony_ci bool pf_wfq_en; 3888c2ecf20Sopenharmony_ci bool vport_rl_en; 3898c2ecf20Sopenharmony_ci bool vport_wfq_en; 3908c2ecf20Sopenharmony_ci u8 pf_wfq; 3918c2ecf20Sopenharmony_ci u32 pf_rl; 3928c2ecf20Sopenharmony_ci struct qed_wfq_data *wfq_data; 3938c2ecf20Sopenharmony_ci u8 num_pf_rls; 3948c2ecf20Sopenharmony_ci}; 3958c2ecf20Sopenharmony_ci 3968c2ecf20Sopenharmony_ci#define QED_OVERFLOW_BIT 1 3978c2ecf20Sopenharmony_ci 3988c2ecf20Sopenharmony_cistruct qed_db_recovery_info { 3998c2ecf20Sopenharmony_ci struct list_head list; 4008c2ecf20Sopenharmony_ci 4018c2ecf20Sopenharmony_ci /* Lock to protect the doorbell recovery mechanism list */ 4028c2ecf20Sopenharmony_ci spinlock_t lock; 4038c2ecf20Sopenharmony_ci bool dorq_attn; 4048c2ecf20Sopenharmony_ci u32 db_recovery_counter; 4058c2ecf20Sopenharmony_ci unsigned long overflow; 4068c2ecf20Sopenharmony_ci}; 4078c2ecf20Sopenharmony_ci 4088c2ecf20Sopenharmony_cistruct storm_stats { 4098c2ecf20Sopenharmony_ci u32 address; 4108c2ecf20Sopenharmony_ci u32 len; 4118c2ecf20Sopenharmony_ci}; 4128c2ecf20Sopenharmony_ci 4138c2ecf20Sopenharmony_cistruct qed_storm_stats { 4148c2ecf20Sopenharmony_ci struct storm_stats mstats; 4158c2ecf20Sopenharmony_ci struct storm_stats pstats; 4168c2ecf20Sopenharmony_ci struct storm_stats tstats; 4178c2ecf20Sopenharmony_ci struct storm_stats ustats; 4188c2ecf20Sopenharmony_ci}; 4198c2ecf20Sopenharmony_ci 4208c2ecf20Sopenharmony_cistruct qed_fw_data { 4218c2ecf20Sopenharmony_ci struct fw_ver_info *fw_ver_info; 4228c2ecf20Sopenharmony_ci const u8 *modes_tree_buf; 4238c2ecf20Sopenharmony_ci union init_op *init_ops; 4248c2ecf20Sopenharmony_ci const u32 *arr_data; 4258c2ecf20Sopenharmony_ci const u32 *fw_overlays; 4268c2ecf20Sopenharmony_ci u32 fw_overlays_len; 4278c2ecf20Sopenharmony_ci u32 init_ops_size; 4288c2ecf20Sopenharmony_ci}; 4298c2ecf20Sopenharmony_ci 4308c2ecf20Sopenharmony_cienum qed_mf_mode_bit { 4318c2ecf20Sopenharmony_ci /* Supports PF-classification based on tag */ 4328c2ecf20Sopenharmony_ci QED_MF_OVLAN_CLSS, 4338c2ecf20Sopenharmony_ci 4348c2ecf20Sopenharmony_ci /* Supports PF-classification based on MAC */ 4358c2ecf20Sopenharmony_ci QED_MF_LLH_MAC_CLSS, 4368c2ecf20Sopenharmony_ci 4378c2ecf20Sopenharmony_ci /* Supports PF-classification based on protocol type */ 4388c2ecf20Sopenharmony_ci QED_MF_LLH_PROTO_CLSS, 4398c2ecf20Sopenharmony_ci 4408c2ecf20Sopenharmony_ci /* Requires a default PF to be set */ 4418c2ecf20Sopenharmony_ci QED_MF_NEED_DEF_PF, 4428c2ecf20Sopenharmony_ci 4438c2ecf20Sopenharmony_ci /* Allow LL2 to multicast/broadcast */ 4448c2ecf20Sopenharmony_ci QED_MF_LL2_NON_UNICAST, 4458c2ecf20Sopenharmony_ci 4468c2ecf20Sopenharmony_ci /* Allow Cross-PF [& child VFs] Tx-switching */ 4478c2ecf20Sopenharmony_ci QED_MF_INTER_PF_SWITCH, 4488c2ecf20Sopenharmony_ci 4498c2ecf20Sopenharmony_ci /* Unified Fabtic Port support enabled */ 4508c2ecf20Sopenharmony_ci QED_MF_UFP_SPECIFIC, 4518c2ecf20Sopenharmony_ci 4528c2ecf20Sopenharmony_ci /* Disable Accelerated Receive Flow Steering (aRFS) */ 4538c2ecf20Sopenharmony_ci QED_MF_DISABLE_ARFS, 4548c2ecf20Sopenharmony_ci 4558c2ecf20Sopenharmony_ci /* Use vlan for steering */ 4568c2ecf20Sopenharmony_ci QED_MF_8021Q_TAGGING, 4578c2ecf20Sopenharmony_ci 4588c2ecf20Sopenharmony_ci /* Use stag for steering */ 4598c2ecf20Sopenharmony_ci QED_MF_8021AD_TAGGING, 4608c2ecf20Sopenharmony_ci 4618c2ecf20Sopenharmony_ci /* Allow DSCP to TC mapping */ 4628c2ecf20Sopenharmony_ci QED_MF_DSCP_TO_TC_MAP, 4638c2ecf20Sopenharmony_ci 4648c2ecf20Sopenharmony_ci /* Do not insert a vlan tag with id 0 */ 4658c2ecf20Sopenharmony_ci QED_MF_DONT_ADD_VLAN0_TAG, 4668c2ecf20Sopenharmony_ci}; 4678c2ecf20Sopenharmony_ci 4688c2ecf20Sopenharmony_cienum qed_ufp_mode { 4698c2ecf20Sopenharmony_ci QED_UFP_MODE_ETS, 4708c2ecf20Sopenharmony_ci QED_UFP_MODE_VNIC_BW, 4718c2ecf20Sopenharmony_ci QED_UFP_MODE_UNKNOWN 4728c2ecf20Sopenharmony_ci}; 4738c2ecf20Sopenharmony_ci 4748c2ecf20Sopenharmony_cienum qed_ufp_pri_type { 4758c2ecf20Sopenharmony_ci QED_UFP_PRI_OS, 4768c2ecf20Sopenharmony_ci QED_UFP_PRI_VNIC, 4778c2ecf20Sopenharmony_ci QED_UFP_PRI_UNKNOWN 4788c2ecf20Sopenharmony_ci}; 4798c2ecf20Sopenharmony_ci 4808c2ecf20Sopenharmony_cistruct qed_ufp_info { 4818c2ecf20Sopenharmony_ci enum qed_ufp_pri_type pri_type; 4828c2ecf20Sopenharmony_ci enum qed_ufp_mode mode; 4838c2ecf20Sopenharmony_ci u8 tc; 4848c2ecf20Sopenharmony_ci}; 4858c2ecf20Sopenharmony_ci 4868c2ecf20Sopenharmony_cienum BAR_ID { 4878c2ecf20Sopenharmony_ci BAR_ID_0, /* used for GRC */ 4888c2ecf20Sopenharmony_ci BAR_ID_1 /* Used for doorbells */ 4898c2ecf20Sopenharmony_ci}; 4908c2ecf20Sopenharmony_ci 4918c2ecf20Sopenharmony_cistruct qed_nvm_image_info { 4928c2ecf20Sopenharmony_ci u32 num_images; 4938c2ecf20Sopenharmony_ci struct bist_nvm_image_att *image_att; 4948c2ecf20Sopenharmony_ci bool valid; 4958c2ecf20Sopenharmony_ci}; 4968c2ecf20Sopenharmony_ci 4978c2ecf20Sopenharmony_cienum qed_hsi_def_type { 4988c2ecf20Sopenharmony_ci QED_HSI_DEF_MAX_NUM_VFS, 4998c2ecf20Sopenharmony_ci QED_HSI_DEF_MAX_NUM_L2_QUEUES, 5008c2ecf20Sopenharmony_ci QED_HSI_DEF_MAX_NUM_PORTS, 5018c2ecf20Sopenharmony_ci QED_HSI_DEF_MAX_SB_PER_PATH, 5028c2ecf20Sopenharmony_ci QED_HSI_DEF_MAX_NUM_PFS, 5038c2ecf20Sopenharmony_ci QED_HSI_DEF_MAX_NUM_VPORTS, 5048c2ecf20Sopenharmony_ci QED_HSI_DEF_NUM_ETH_RSS_ENGINE, 5058c2ecf20Sopenharmony_ci QED_HSI_DEF_MAX_QM_TX_QUEUES, 5068c2ecf20Sopenharmony_ci QED_HSI_DEF_NUM_PXP_ILT_RECORDS, 5078c2ecf20Sopenharmony_ci QED_HSI_DEF_NUM_RDMA_STATISTIC_COUNTERS, 5088c2ecf20Sopenharmony_ci QED_HSI_DEF_MAX_QM_GLOBAL_RLS, 5098c2ecf20Sopenharmony_ci QED_HSI_DEF_MAX_PBF_CMD_LINES, 5108c2ecf20Sopenharmony_ci QED_HSI_DEF_MAX_BTB_BLOCKS, 5118c2ecf20Sopenharmony_ci QED_NUM_HSI_DEFS 5128c2ecf20Sopenharmony_ci}; 5138c2ecf20Sopenharmony_ci 5148c2ecf20Sopenharmony_ci#define DRV_MODULE_VERSION \ 5158c2ecf20Sopenharmony_ci __stringify(QED_MAJOR_VERSION) "." \ 5168c2ecf20Sopenharmony_ci __stringify(QED_MINOR_VERSION) "." \ 5178c2ecf20Sopenharmony_ci __stringify(QED_REVISION_VERSION) "." \ 5188c2ecf20Sopenharmony_ci __stringify(QED_ENGINEERING_VERSION) 5198c2ecf20Sopenharmony_ci 5208c2ecf20Sopenharmony_cistruct qed_simd_fp_handler { 5218c2ecf20Sopenharmony_ci void *token; 5228c2ecf20Sopenharmony_ci void (*func)(void *); 5238c2ecf20Sopenharmony_ci}; 5248c2ecf20Sopenharmony_ci 5258c2ecf20Sopenharmony_cienum qed_slowpath_wq_flag { 5268c2ecf20Sopenharmony_ci QED_SLOWPATH_MFW_TLV_REQ, 5278c2ecf20Sopenharmony_ci QED_SLOWPATH_PERIODIC_DB_REC, 5288c2ecf20Sopenharmony_ci}; 5298c2ecf20Sopenharmony_ci 5308c2ecf20Sopenharmony_cistruct qed_hwfn { 5318c2ecf20Sopenharmony_ci struct qed_dev *cdev; 5328c2ecf20Sopenharmony_ci u8 my_id; /* ID inside the PF */ 5338c2ecf20Sopenharmony_ci#define IS_LEAD_HWFN(edev) (!((edev)->my_id)) 5348c2ecf20Sopenharmony_ci u8 rel_pf_id; /* Relative to engine*/ 5358c2ecf20Sopenharmony_ci u8 abs_pf_id; 5368c2ecf20Sopenharmony_ci#define QED_PATH_ID(_p_hwfn) \ 5378c2ecf20Sopenharmony_ci (QED_IS_K2((_p_hwfn)->cdev) ? 0 : ((_p_hwfn)->abs_pf_id & 1)) 5388c2ecf20Sopenharmony_ci u8 port_id; 5398c2ecf20Sopenharmony_ci bool b_active; 5408c2ecf20Sopenharmony_ci 5418c2ecf20Sopenharmony_ci u32 dp_module; 5428c2ecf20Sopenharmony_ci u8 dp_level; 5438c2ecf20Sopenharmony_ci char name[NAME_SIZE]; 5448c2ecf20Sopenharmony_ci 5458c2ecf20Sopenharmony_ci bool hw_init_done; 5468c2ecf20Sopenharmony_ci 5478c2ecf20Sopenharmony_ci u8 num_funcs_on_engine; 5488c2ecf20Sopenharmony_ci u8 enabled_func_idx; 5498c2ecf20Sopenharmony_ci 5508c2ecf20Sopenharmony_ci /* BAR access */ 5518c2ecf20Sopenharmony_ci void __iomem *regview; 5528c2ecf20Sopenharmony_ci void __iomem *doorbells; 5538c2ecf20Sopenharmony_ci u64 db_phys_addr; 5548c2ecf20Sopenharmony_ci unsigned long db_size; 5558c2ecf20Sopenharmony_ci 5568c2ecf20Sopenharmony_ci /* PTT pool */ 5578c2ecf20Sopenharmony_ci struct qed_ptt_pool *p_ptt_pool; 5588c2ecf20Sopenharmony_ci 5598c2ecf20Sopenharmony_ci /* HW info */ 5608c2ecf20Sopenharmony_ci struct qed_hw_info hw_info; 5618c2ecf20Sopenharmony_ci 5628c2ecf20Sopenharmony_ci /* rt_array (for init-tool) */ 5638c2ecf20Sopenharmony_ci struct qed_rt_data rt_data; 5648c2ecf20Sopenharmony_ci 5658c2ecf20Sopenharmony_ci /* SPQ */ 5668c2ecf20Sopenharmony_ci struct qed_spq *p_spq; 5678c2ecf20Sopenharmony_ci 5688c2ecf20Sopenharmony_ci /* EQ */ 5698c2ecf20Sopenharmony_ci struct qed_eq *p_eq; 5708c2ecf20Sopenharmony_ci 5718c2ecf20Sopenharmony_ci /* Consolidate Q*/ 5728c2ecf20Sopenharmony_ci struct qed_consq *p_consq; 5738c2ecf20Sopenharmony_ci 5748c2ecf20Sopenharmony_ci /* Slow-Path definitions */ 5758c2ecf20Sopenharmony_ci struct tasklet_struct sp_dpc; 5768c2ecf20Sopenharmony_ci bool b_sp_dpc_enabled; 5778c2ecf20Sopenharmony_ci 5788c2ecf20Sopenharmony_ci struct qed_ptt *p_main_ptt; 5798c2ecf20Sopenharmony_ci struct qed_ptt *p_dpc_ptt; 5808c2ecf20Sopenharmony_ci 5818c2ecf20Sopenharmony_ci /* PTP will be used only by the leading function. 5828c2ecf20Sopenharmony_ci * Usage of all PTP-apis should be synchronized as result. 5838c2ecf20Sopenharmony_ci */ 5848c2ecf20Sopenharmony_ci struct qed_ptt *p_ptp_ptt; 5858c2ecf20Sopenharmony_ci 5868c2ecf20Sopenharmony_ci struct qed_sb_sp_info *p_sp_sb; 5878c2ecf20Sopenharmony_ci struct qed_sb_attn_info *p_sb_attn; 5888c2ecf20Sopenharmony_ci 5898c2ecf20Sopenharmony_ci /* Protocol related */ 5908c2ecf20Sopenharmony_ci bool using_ll2; 5918c2ecf20Sopenharmony_ci struct qed_ll2_info *p_ll2_info; 5928c2ecf20Sopenharmony_ci struct qed_ooo_info *p_ooo_info; 5938c2ecf20Sopenharmony_ci struct qed_rdma_info *p_rdma_info; 5948c2ecf20Sopenharmony_ci struct qed_iscsi_info *p_iscsi_info; 5958c2ecf20Sopenharmony_ci struct qed_fcoe_info *p_fcoe_info; 5968c2ecf20Sopenharmony_ci struct qed_pf_params pf_params; 5978c2ecf20Sopenharmony_ci 5988c2ecf20Sopenharmony_ci bool b_rdma_enabled_in_prs; 5998c2ecf20Sopenharmony_ci u32 rdma_prs_search_reg; 6008c2ecf20Sopenharmony_ci 6018c2ecf20Sopenharmony_ci struct qed_cxt_mngr *p_cxt_mngr; 6028c2ecf20Sopenharmony_ci 6038c2ecf20Sopenharmony_ci /* Flag indicating whether interrupts are enabled or not*/ 6048c2ecf20Sopenharmony_ci bool b_int_enabled; 6058c2ecf20Sopenharmony_ci bool b_int_requested; 6068c2ecf20Sopenharmony_ci 6078c2ecf20Sopenharmony_ci /* True if the driver requests for the link */ 6088c2ecf20Sopenharmony_ci bool b_drv_link_init; 6098c2ecf20Sopenharmony_ci 6108c2ecf20Sopenharmony_ci struct qed_vf_iov *vf_iov_info; 6118c2ecf20Sopenharmony_ci struct qed_pf_iov *pf_iov_info; 6128c2ecf20Sopenharmony_ci struct qed_mcp_info *mcp_info; 6138c2ecf20Sopenharmony_ci 6148c2ecf20Sopenharmony_ci struct qed_dcbx_info *p_dcbx_info; 6158c2ecf20Sopenharmony_ci 6168c2ecf20Sopenharmony_ci struct qed_ufp_info ufp_info; 6178c2ecf20Sopenharmony_ci 6188c2ecf20Sopenharmony_ci struct qed_dmae_info dmae_info; 6198c2ecf20Sopenharmony_ci 6208c2ecf20Sopenharmony_ci /* QM init */ 6218c2ecf20Sopenharmony_ci struct qed_qm_info qm_info; 6228c2ecf20Sopenharmony_ci struct qed_storm_stats storm_stats; 6238c2ecf20Sopenharmony_ci 6248c2ecf20Sopenharmony_ci /* Buffer for unzipping firmware data */ 6258c2ecf20Sopenharmony_ci void *unzip_buf; 6268c2ecf20Sopenharmony_ci 6278c2ecf20Sopenharmony_ci struct dbg_tools_data dbg_info; 6288c2ecf20Sopenharmony_ci void *dbg_user_info; 6298c2ecf20Sopenharmony_ci struct virt_mem_desc dbg_arrays[MAX_BIN_DBG_BUFFER_TYPE]; 6308c2ecf20Sopenharmony_ci 6318c2ecf20Sopenharmony_ci /* PWM region specific data */ 6328c2ecf20Sopenharmony_ci u16 wid_count; 6338c2ecf20Sopenharmony_ci u32 dpi_size; 6348c2ecf20Sopenharmony_ci u32 dpi_count; 6358c2ecf20Sopenharmony_ci 6368c2ecf20Sopenharmony_ci /* This is used to calculate the doorbell address */ 6378c2ecf20Sopenharmony_ci u32 dpi_start_offset; 6388c2ecf20Sopenharmony_ci 6398c2ecf20Sopenharmony_ci /* If one of the following is set then EDPM shouldn't be used */ 6408c2ecf20Sopenharmony_ci u8 dcbx_no_edpm; 6418c2ecf20Sopenharmony_ci u8 db_bar_no_edpm; 6428c2ecf20Sopenharmony_ci 6438c2ecf20Sopenharmony_ci /* L2-related */ 6448c2ecf20Sopenharmony_ci struct qed_l2_info *p_l2_info; 6458c2ecf20Sopenharmony_ci 6468c2ecf20Sopenharmony_ci /* Mechanism for recovering from doorbell drop */ 6478c2ecf20Sopenharmony_ci struct qed_db_recovery_info db_recovery_info; 6488c2ecf20Sopenharmony_ci 6498c2ecf20Sopenharmony_ci /* Nvm images number and attributes */ 6508c2ecf20Sopenharmony_ci struct qed_nvm_image_info nvm_info; 6518c2ecf20Sopenharmony_ci 6528c2ecf20Sopenharmony_ci struct phys_mem_desc *fw_overlay_mem; 6538c2ecf20Sopenharmony_ci struct qed_ptt *p_arfs_ptt; 6548c2ecf20Sopenharmony_ci 6558c2ecf20Sopenharmony_ci struct qed_simd_fp_handler simd_proto_handler[64]; 6568c2ecf20Sopenharmony_ci 6578c2ecf20Sopenharmony_ci#ifdef CONFIG_QED_SRIOV 6588c2ecf20Sopenharmony_ci struct workqueue_struct *iov_wq; 6598c2ecf20Sopenharmony_ci struct delayed_work iov_task; 6608c2ecf20Sopenharmony_ci unsigned long iov_task_flags; 6618c2ecf20Sopenharmony_ci#endif 6628c2ecf20Sopenharmony_ci struct z_stream_s *stream; 6638c2ecf20Sopenharmony_ci bool slowpath_wq_active; 6648c2ecf20Sopenharmony_ci struct workqueue_struct *slowpath_wq; 6658c2ecf20Sopenharmony_ci struct delayed_work slowpath_task; 6668c2ecf20Sopenharmony_ci unsigned long slowpath_task_flags; 6678c2ecf20Sopenharmony_ci u32 periodic_db_rec_count; 6688c2ecf20Sopenharmony_ci}; 6698c2ecf20Sopenharmony_ci 6708c2ecf20Sopenharmony_cistruct pci_params { 6718c2ecf20Sopenharmony_ci int pm_cap; 6728c2ecf20Sopenharmony_ci 6738c2ecf20Sopenharmony_ci unsigned long mem_start; 6748c2ecf20Sopenharmony_ci unsigned long mem_end; 6758c2ecf20Sopenharmony_ci unsigned int irq; 6768c2ecf20Sopenharmony_ci u8 pf_num; 6778c2ecf20Sopenharmony_ci}; 6788c2ecf20Sopenharmony_ci 6798c2ecf20Sopenharmony_cistruct qed_int_param { 6808c2ecf20Sopenharmony_ci u32 int_mode; 6818c2ecf20Sopenharmony_ci u8 num_vectors; 6828c2ecf20Sopenharmony_ci u8 min_msix_cnt; /* for minimal functionality */ 6838c2ecf20Sopenharmony_ci}; 6848c2ecf20Sopenharmony_ci 6858c2ecf20Sopenharmony_cistruct qed_int_params { 6868c2ecf20Sopenharmony_ci struct qed_int_param in; 6878c2ecf20Sopenharmony_ci struct qed_int_param out; 6888c2ecf20Sopenharmony_ci struct msix_entry *msix_table; 6898c2ecf20Sopenharmony_ci bool fp_initialized; 6908c2ecf20Sopenharmony_ci u8 fp_msix_base; 6918c2ecf20Sopenharmony_ci u8 fp_msix_cnt; 6928c2ecf20Sopenharmony_ci u8 rdma_msix_base; 6938c2ecf20Sopenharmony_ci u8 rdma_msix_cnt; 6948c2ecf20Sopenharmony_ci}; 6958c2ecf20Sopenharmony_ci 6968c2ecf20Sopenharmony_cistruct qed_dbg_feature { 6978c2ecf20Sopenharmony_ci struct dentry *dentry; 6988c2ecf20Sopenharmony_ci u8 *dump_buf; 6998c2ecf20Sopenharmony_ci u32 buf_size; 7008c2ecf20Sopenharmony_ci u32 dumped_dwords; 7018c2ecf20Sopenharmony_ci}; 7028c2ecf20Sopenharmony_ci 7038c2ecf20Sopenharmony_cistruct qed_dev { 7048c2ecf20Sopenharmony_ci u32 dp_module; 7058c2ecf20Sopenharmony_ci u8 dp_level; 7068c2ecf20Sopenharmony_ci char name[NAME_SIZE]; 7078c2ecf20Sopenharmony_ci 7088c2ecf20Sopenharmony_ci enum qed_dev_type type; 7098c2ecf20Sopenharmony_ci /* Translate type/revision combo into the proper conditions */ 7108c2ecf20Sopenharmony_ci#define QED_IS_BB(dev) ((dev)->type == QED_DEV_TYPE_BB) 7118c2ecf20Sopenharmony_ci#define QED_IS_BB_B0(dev) (QED_IS_BB(dev) && CHIP_REV_IS_B0(dev)) 7128c2ecf20Sopenharmony_ci#define QED_IS_AH(dev) ((dev)->type == QED_DEV_TYPE_AH) 7138c2ecf20Sopenharmony_ci#define QED_IS_K2(dev) QED_IS_AH(dev) 7148c2ecf20Sopenharmony_ci#define QED_IS_E4(dev) (QED_IS_BB(dev) || QED_IS_AH(dev)) 7158c2ecf20Sopenharmony_ci#define QED_IS_E5(dev) ((dev)->type == QED_DEV_TYPE_E5) 7168c2ecf20Sopenharmony_ci 7178c2ecf20Sopenharmony_ci u16 vendor_id; 7188c2ecf20Sopenharmony_ci 7198c2ecf20Sopenharmony_ci u16 device_id; 7208c2ecf20Sopenharmony_ci#define QED_DEV_ID_MASK 0xff00 7218c2ecf20Sopenharmony_ci#define QED_DEV_ID_MASK_BB 0x1600 7228c2ecf20Sopenharmony_ci#define QED_DEV_ID_MASK_AH 0x8000 7238c2ecf20Sopenharmony_ci 7248c2ecf20Sopenharmony_ci u16 chip_num; 7258c2ecf20Sopenharmony_ci#define CHIP_NUM_MASK 0xffff 7268c2ecf20Sopenharmony_ci#define CHIP_NUM_SHIFT 16 7278c2ecf20Sopenharmony_ci 7288c2ecf20Sopenharmony_ci u16 chip_rev; 7298c2ecf20Sopenharmony_ci#define CHIP_REV_MASK 0xf 7308c2ecf20Sopenharmony_ci#define CHIP_REV_SHIFT 12 7318c2ecf20Sopenharmony_ci#define CHIP_REV_IS_B0(_cdev) ((_cdev)->chip_rev == 1) 7328c2ecf20Sopenharmony_ci 7338c2ecf20Sopenharmony_ci u16 chip_metal; 7348c2ecf20Sopenharmony_ci#define CHIP_METAL_MASK 0xff 7358c2ecf20Sopenharmony_ci#define CHIP_METAL_SHIFT 4 7368c2ecf20Sopenharmony_ci 7378c2ecf20Sopenharmony_ci u16 chip_bond_id; 7388c2ecf20Sopenharmony_ci#define CHIP_BOND_ID_MASK 0xf 7398c2ecf20Sopenharmony_ci#define CHIP_BOND_ID_SHIFT 0 7408c2ecf20Sopenharmony_ci 7418c2ecf20Sopenharmony_ci u8 num_engines; 7428c2ecf20Sopenharmony_ci u8 num_ports; 7438c2ecf20Sopenharmony_ci u8 num_ports_in_engine; 7448c2ecf20Sopenharmony_ci u8 num_funcs_in_port; 7458c2ecf20Sopenharmony_ci 7468c2ecf20Sopenharmony_ci u8 path_id; 7478c2ecf20Sopenharmony_ci 7488c2ecf20Sopenharmony_ci unsigned long mf_bits; 7498c2ecf20Sopenharmony_ci 7508c2ecf20Sopenharmony_ci int pcie_width; 7518c2ecf20Sopenharmony_ci int pcie_speed; 7528c2ecf20Sopenharmony_ci 7538c2ecf20Sopenharmony_ci /* Add MF related configuration */ 7548c2ecf20Sopenharmony_ci u8 mcp_rev; 7558c2ecf20Sopenharmony_ci u8 boot_mode; 7568c2ecf20Sopenharmony_ci 7578c2ecf20Sopenharmony_ci /* WoL related configurations */ 7588c2ecf20Sopenharmony_ci u8 wol_config; 7598c2ecf20Sopenharmony_ci u8 wol_mac[ETH_ALEN]; 7608c2ecf20Sopenharmony_ci 7618c2ecf20Sopenharmony_ci u32 int_mode; 7628c2ecf20Sopenharmony_ci enum qed_coalescing_mode int_coalescing_mode; 7638c2ecf20Sopenharmony_ci u16 rx_coalesce_usecs; 7648c2ecf20Sopenharmony_ci u16 tx_coalesce_usecs; 7658c2ecf20Sopenharmony_ci 7668c2ecf20Sopenharmony_ci /* Start Bar offset of first hwfn */ 7678c2ecf20Sopenharmony_ci void __iomem *regview; 7688c2ecf20Sopenharmony_ci void __iomem *doorbells; 7698c2ecf20Sopenharmony_ci u64 db_phys_addr; 7708c2ecf20Sopenharmony_ci unsigned long db_size; 7718c2ecf20Sopenharmony_ci 7728c2ecf20Sopenharmony_ci /* PCI */ 7738c2ecf20Sopenharmony_ci u8 cache_shift; 7748c2ecf20Sopenharmony_ci 7758c2ecf20Sopenharmony_ci /* Init */ 7768c2ecf20Sopenharmony_ci const u32 *iro_arr; 7778c2ecf20Sopenharmony_ci#define IRO ((const struct iro *)p_hwfn->cdev->iro_arr) 7788c2ecf20Sopenharmony_ci 7798c2ecf20Sopenharmony_ci /* HW functions */ 7808c2ecf20Sopenharmony_ci u8 num_hwfns; 7818c2ecf20Sopenharmony_ci struct qed_hwfn hwfns[MAX_HWFNS_PER_DEVICE]; 7828c2ecf20Sopenharmony_ci 7838c2ecf20Sopenharmony_ci /* Engine affinity */ 7848c2ecf20Sopenharmony_ci u8 l2_affin_hint; 7858c2ecf20Sopenharmony_ci u8 fir_affin; 7868c2ecf20Sopenharmony_ci u8 iwarp_affin; 7878c2ecf20Sopenharmony_ci 7888c2ecf20Sopenharmony_ci /* SRIOV */ 7898c2ecf20Sopenharmony_ci struct qed_hw_sriov_info *p_iov_info; 7908c2ecf20Sopenharmony_ci#define IS_QED_SRIOV(cdev) (!!(cdev)->p_iov_info) 7918c2ecf20Sopenharmony_ci struct qed_tunnel_info tunnel; 7928c2ecf20Sopenharmony_ci bool b_is_vf; 7938c2ecf20Sopenharmony_ci u32 drv_type; 7948c2ecf20Sopenharmony_ci struct qed_eth_stats *reset_stats; 7958c2ecf20Sopenharmony_ci struct qed_fw_data *fw_data; 7968c2ecf20Sopenharmony_ci 7978c2ecf20Sopenharmony_ci u32 mcp_nvm_resp; 7988c2ecf20Sopenharmony_ci 7998c2ecf20Sopenharmony_ci /* Recovery */ 8008c2ecf20Sopenharmony_ci bool recov_in_prog; 8018c2ecf20Sopenharmony_ci 8028c2ecf20Sopenharmony_ci /* Indicates whether should prevent attentions from being reasserted */ 8038c2ecf20Sopenharmony_ci bool attn_clr_en; 8048c2ecf20Sopenharmony_ci 8058c2ecf20Sopenharmony_ci /* LLH info */ 8068c2ecf20Sopenharmony_ci u8 ppfid_bitmap; 8078c2ecf20Sopenharmony_ci struct qed_llh_info *p_llh_info; 8088c2ecf20Sopenharmony_ci 8098c2ecf20Sopenharmony_ci /* Linux specific here */ 8108c2ecf20Sopenharmony_ci struct qed_dev_info common_dev_info; 8118c2ecf20Sopenharmony_ci struct qede_dev *edev; 8128c2ecf20Sopenharmony_ci struct pci_dev *pdev; 8138c2ecf20Sopenharmony_ci u32 flags; 8148c2ecf20Sopenharmony_ci#define QED_FLAG_STORAGE_STARTED (BIT(0)) 8158c2ecf20Sopenharmony_ci int msg_enable; 8168c2ecf20Sopenharmony_ci 8178c2ecf20Sopenharmony_ci struct pci_params pci_params; 8188c2ecf20Sopenharmony_ci 8198c2ecf20Sopenharmony_ci struct qed_int_params int_params; 8208c2ecf20Sopenharmony_ci 8218c2ecf20Sopenharmony_ci u8 protocol; 8228c2ecf20Sopenharmony_ci#define IS_QED_ETH_IF(cdev) ((cdev)->protocol == QED_PROTOCOL_ETH) 8238c2ecf20Sopenharmony_ci#define IS_QED_FCOE_IF(cdev) ((cdev)->protocol == QED_PROTOCOL_FCOE) 8248c2ecf20Sopenharmony_ci 8258c2ecf20Sopenharmony_ci /* Callbacks to protocol driver */ 8268c2ecf20Sopenharmony_ci union { 8278c2ecf20Sopenharmony_ci struct qed_common_cb_ops *common; 8288c2ecf20Sopenharmony_ci struct qed_eth_cb_ops *eth; 8298c2ecf20Sopenharmony_ci struct qed_fcoe_cb_ops *fcoe; 8308c2ecf20Sopenharmony_ci struct qed_iscsi_cb_ops *iscsi; 8318c2ecf20Sopenharmony_ci } protocol_ops; 8328c2ecf20Sopenharmony_ci void *ops_cookie; 8338c2ecf20Sopenharmony_ci 8348c2ecf20Sopenharmony_ci#ifdef CONFIG_QED_LL2 8358c2ecf20Sopenharmony_ci struct qed_cb_ll2_info *ll2; 8368c2ecf20Sopenharmony_ci u8 ll2_mac_address[ETH_ALEN]; 8378c2ecf20Sopenharmony_ci#endif 8388c2ecf20Sopenharmony_ci struct qed_dbg_feature dbg_features[DBG_FEATURE_NUM]; 8398c2ecf20Sopenharmony_ci u8 engine_for_debug; 8408c2ecf20Sopenharmony_ci bool disable_ilt_dump; 8418c2ecf20Sopenharmony_ci bool dbg_bin_dump; 8428c2ecf20Sopenharmony_ci 8438c2ecf20Sopenharmony_ci DECLARE_HASHTABLE(connections, 10); 8448c2ecf20Sopenharmony_ci const struct firmware *firmware; 8458c2ecf20Sopenharmony_ci 8468c2ecf20Sopenharmony_ci bool print_dbg_data; 8478c2ecf20Sopenharmony_ci 8488c2ecf20Sopenharmony_ci u32 rdma_max_sge; 8498c2ecf20Sopenharmony_ci u32 rdma_max_inline; 8508c2ecf20Sopenharmony_ci u32 rdma_max_srq_sge; 8518c2ecf20Sopenharmony_ci u16 tunn_feature_mask; 8528c2ecf20Sopenharmony_ci 8538c2ecf20Sopenharmony_ci bool iwarp_cmt; 8548c2ecf20Sopenharmony_ci}; 8558c2ecf20Sopenharmony_ci 8568c2ecf20Sopenharmony_ciu32 qed_get_hsi_def_val(struct qed_dev *cdev, enum qed_hsi_def_type type); 8578c2ecf20Sopenharmony_ci 8588c2ecf20Sopenharmony_ci#define NUM_OF_VFS(dev) \ 8598c2ecf20Sopenharmony_ci qed_get_hsi_def_val(dev, QED_HSI_DEF_MAX_NUM_VFS) 8608c2ecf20Sopenharmony_ci#define NUM_OF_L2_QUEUES(dev) \ 8618c2ecf20Sopenharmony_ci qed_get_hsi_def_val(dev, QED_HSI_DEF_MAX_NUM_L2_QUEUES) 8628c2ecf20Sopenharmony_ci#define NUM_OF_PORTS(dev) \ 8638c2ecf20Sopenharmony_ci qed_get_hsi_def_val(dev, QED_HSI_DEF_MAX_NUM_PORTS) 8648c2ecf20Sopenharmony_ci#define NUM_OF_SBS(dev) \ 8658c2ecf20Sopenharmony_ci qed_get_hsi_def_val(dev, QED_HSI_DEF_MAX_SB_PER_PATH) 8668c2ecf20Sopenharmony_ci#define NUM_OF_ENG_PFS(dev) \ 8678c2ecf20Sopenharmony_ci qed_get_hsi_def_val(dev, QED_HSI_DEF_MAX_NUM_PFS) 8688c2ecf20Sopenharmony_ci#define NUM_OF_VPORTS(dev) \ 8698c2ecf20Sopenharmony_ci qed_get_hsi_def_val(dev, QED_HSI_DEF_MAX_NUM_VPORTS) 8708c2ecf20Sopenharmony_ci#define NUM_OF_RSS_ENGINES(dev) \ 8718c2ecf20Sopenharmony_ci qed_get_hsi_def_val(dev, QED_HSI_DEF_NUM_ETH_RSS_ENGINE) 8728c2ecf20Sopenharmony_ci#define NUM_OF_QM_TX_QUEUES(dev) \ 8738c2ecf20Sopenharmony_ci qed_get_hsi_def_val(dev, QED_HSI_DEF_MAX_QM_TX_QUEUES) 8748c2ecf20Sopenharmony_ci#define NUM_OF_PXP_ILT_RECORDS(dev) \ 8758c2ecf20Sopenharmony_ci qed_get_hsi_def_val(dev, QED_HSI_DEF_NUM_PXP_ILT_RECORDS) 8768c2ecf20Sopenharmony_ci#define NUM_OF_RDMA_STATISTIC_COUNTERS(dev) \ 8778c2ecf20Sopenharmony_ci qed_get_hsi_def_val(dev, QED_HSI_DEF_NUM_RDMA_STATISTIC_COUNTERS) 8788c2ecf20Sopenharmony_ci#define NUM_OF_QM_GLOBAL_RLS(dev) \ 8798c2ecf20Sopenharmony_ci qed_get_hsi_def_val(dev, QED_HSI_DEF_MAX_QM_GLOBAL_RLS) 8808c2ecf20Sopenharmony_ci#define NUM_OF_PBF_CMD_LINES(dev) \ 8818c2ecf20Sopenharmony_ci qed_get_hsi_def_val(dev, QED_HSI_DEF_MAX_PBF_CMD_LINES) 8828c2ecf20Sopenharmony_ci#define NUM_OF_BTB_BLOCKS(dev) \ 8838c2ecf20Sopenharmony_ci qed_get_hsi_def_val(dev, QED_HSI_DEF_MAX_BTB_BLOCKS) 8848c2ecf20Sopenharmony_ci 8858c2ecf20Sopenharmony_ci 8868c2ecf20Sopenharmony_ci/** 8878c2ecf20Sopenharmony_ci * @brief qed_concrete_to_sw_fid - get the sw function id from 8888c2ecf20Sopenharmony_ci * the concrete value. 8898c2ecf20Sopenharmony_ci * 8908c2ecf20Sopenharmony_ci * @param concrete_fid 8918c2ecf20Sopenharmony_ci * 8928c2ecf20Sopenharmony_ci * @return inline u8 8938c2ecf20Sopenharmony_ci */ 8948c2ecf20Sopenharmony_cistatic inline u8 qed_concrete_to_sw_fid(struct qed_dev *cdev, 8958c2ecf20Sopenharmony_ci u32 concrete_fid) 8968c2ecf20Sopenharmony_ci{ 8978c2ecf20Sopenharmony_ci u8 vfid = GET_FIELD(concrete_fid, PXP_CONCRETE_FID_VFID); 8988c2ecf20Sopenharmony_ci u8 pfid = GET_FIELD(concrete_fid, PXP_CONCRETE_FID_PFID); 8998c2ecf20Sopenharmony_ci u8 vf_valid = GET_FIELD(concrete_fid, 9008c2ecf20Sopenharmony_ci PXP_CONCRETE_FID_VFVALID); 9018c2ecf20Sopenharmony_ci u8 sw_fid; 9028c2ecf20Sopenharmony_ci 9038c2ecf20Sopenharmony_ci if (vf_valid) 9048c2ecf20Sopenharmony_ci sw_fid = vfid + MAX_NUM_PFS; 9058c2ecf20Sopenharmony_ci else 9068c2ecf20Sopenharmony_ci sw_fid = pfid; 9078c2ecf20Sopenharmony_ci 9088c2ecf20Sopenharmony_ci return sw_fid; 9098c2ecf20Sopenharmony_ci} 9108c2ecf20Sopenharmony_ci 9118c2ecf20Sopenharmony_ci#define PKT_LB_TC 9 9128c2ecf20Sopenharmony_ci#define MAX_NUM_VOQS_E4 20 9138c2ecf20Sopenharmony_ci 9148c2ecf20Sopenharmony_ciint qed_configure_vport_wfq(struct qed_dev *cdev, u16 vp_id, u32 rate); 9158c2ecf20Sopenharmony_civoid qed_configure_vp_wfq_on_link_change(struct qed_dev *cdev, 9168c2ecf20Sopenharmony_ci struct qed_ptt *p_ptt, 9178c2ecf20Sopenharmony_ci u32 min_pf_rate); 9188c2ecf20Sopenharmony_ci 9198c2ecf20Sopenharmony_civoid qed_clean_wfq_db(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt); 9208c2ecf20Sopenharmony_ciint qed_device_num_engines(struct qed_dev *cdev); 9218c2ecf20Sopenharmony_civoid qed_set_fw_mac_addr(__le16 *fw_msb, 9228c2ecf20Sopenharmony_ci __le16 *fw_mid, __le16 *fw_lsb, u8 *mac); 9238c2ecf20Sopenharmony_ci 9248c2ecf20Sopenharmony_ci#define QED_LEADING_HWFN(dev) (&dev->hwfns[0]) 9258c2ecf20Sopenharmony_ci#define QED_IS_CMT(dev) ((dev)->num_hwfns > 1) 9268c2ecf20Sopenharmony_ci/* Macros for getting the engine-affinitized hwfn (FIR: fcoe,iscsi,roce) */ 9278c2ecf20Sopenharmony_ci#define QED_FIR_AFFIN_HWFN(dev) (&(dev)->hwfns[dev->fir_affin]) 9288c2ecf20Sopenharmony_ci#define QED_IWARP_AFFIN_HWFN(dev) (&(dev)->hwfns[dev->iwarp_affin]) 9298c2ecf20Sopenharmony_ci#define QED_AFFIN_HWFN(dev) \ 9308c2ecf20Sopenharmony_ci (QED_IS_IWARP_PERSONALITY(QED_LEADING_HWFN(dev)) ? \ 9318c2ecf20Sopenharmony_ci QED_IWARP_AFFIN_HWFN(dev) : QED_FIR_AFFIN_HWFN(dev)) 9328c2ecf20Sopenharmony_ci#define QED_AFFIN_HWFN_IDX(dev) (IS_LEAD_HWFN(QED_AFFIN_HWFN(dev)) ? 0 : 1) 9338c2ecf20Sopenharmony_ci 9348c2ecf20Sopenharmony_ci/* Flags for indication of required queues */ 9358c2ecf20Sopenharmony_ci#define PQ_FLAGS_RLS (BIT(0)) 9368c2ecf20Sopenharmony_ci#define PQ_FLAGS_MCOS (BIT(1)) 9378c2ecf20Sopenharmony_ci#define PQ_FLAGS_LB (BIT(2)) 9388c2ecf20Sopenharmony_ci#define PQ_FLAGS_OOO (BIT(3)) 9398c2ecf20Sopenharmony_ci#define PQ_FLAGS_ACK (BIT(4)) 9408c2ecf20Sopenharmony_ci#define PQ_FLAGS_OFLD (BIT(5)) 9418c2ecf20Sopenharmony_ci#define PQ_FLAGS_VFS (BIT(6)) 9428c2ecf20Sopenharmony_ci#define PQ_FLAGS_LLT (BIT(7)) 9438c2ecf20Sopenharmony_ci#define PQ_FLAGS_MTC (BIT(8)) 9448c2ecf20Sopenharmony_ci 9458c2ecf20Sopenharmony_ci/* physical queue index for cm context intialization */ 9468c2ecf20Sopenharmony_ciu16 qed_get_cm_pq_idx(struct qed_hwfn *p_hwfn, u32 pq_flags); 9478c2ecf20Sopenharmony_ciu16 qed_get_cm_pq_idx_mcos(struct qed_hwfn *p_hwfn, u8 tc); 9488c2ecf20Sopenharmony_ciu16 qed_get_cm_pq_idx_vf(struct qed_hwfn *p_hwfn, u16 vf); 9498c2ecf20Sopenharmony_ciu16 qed_get_cm_pq_idx_ofld_mtc(struct qed_hwfn *p_hwfn, u8 tc); 9508c2ecf20Sopenharmony_ciu16 qed_get_cm_pq_idx_llt_mtc(struct qed_hwfn *p_hwfn, u8 tc); 9518c2ecf20Sopenharmony_ci 9528c2ecf20Sopenharmony_ci/* doorbell recovery mechanism */ 9538c2ecf20Sopenharmony_civoid qed_db_recovery_dp(struct qed_hwfn *p_hwfn); 9548c2ecf20Sopenharmony_civoid qed_db_recovery_execute(struct qed_hwfn *p_hwfn); 9558c2ecf20Sopenharmony_cibool qed_edpm_enabled(struct qed_hwfn *p_hwfn); 9568c2ecf20Sopenharmony_ci 9578c2ecf20Sopenharmony_ci/* Other Linux specific common definitions */ 9588c2ecf20Sopenharmony_ci#define DP_NAME(cdev) ((cdev)->name) 9598c2ecf20Sopenharmony_ci 9608c2ecf20Sopenharmony_ci#define REG_ADDR(cdev, offset) (void __iomem *)((u8 __iomem *)\ 9618c2ecf20Sopenharmony_ci (cdev->regview) + \ 9628c2ecf20Sopenharmony_ci (offset)) 9638c2ecf20Sopenharmony_ci 9648c2ecf20Sopenharmony_ci#define REG_RD(cdev, offset) readl(REG_ADDR(cdev, offset)) 9658c2ecf20Sopenharmony_ci#define REG_WR(cdev, offset, val) writel((u32)val, REG_ADDR(cdev, offset)) 9668c2ecf20Sopenharmony_ci#define REG_WR16(cdev, offset, val) writew((u16)val, REG_ADDR(cdev, offset)) 9678c2ecf20Sopenharmony_ci 9688c2ecf20Sopenharmony_ci#define DOORBELL(cdev, db_addr, val) \ 9698c2ecf20Sopenharmony_ci writel((u32)val, (void __iomem *)((u8 __iomem *)\ 9708c2ecf20Sopenharmony_ci (cdev->doorbells) + (db_addr))) 9718c2ecf20Sopenharmony_ci 9728c2ecf20Sopenharmony_ci#define MFW_PORT(_p_hwfn) ((_p_hwfn)->abs_pf_id % \ 9738c2ecf20Sopenharmony_ci qed_device_num_ports((_p_hwfn)->cdev)) 9748c2ecf20Sopenharmony_ciint qed_device_num_ports(struct qed_dev *cdev); 9758c2ecf20Sopenharmony_ci 9768c2ecf20Sopenharmony_ci/* Prototypes */ 9778c2ecf20Sopenharmony_ciint qed_fill_dev_info(struct qed_dev *cdev, 9788c2ecf20Sopenharmony_ci struct qed_dev_info *dev_info); 9798c2ecf20Sopenharmony_civoid qed_link_update(struct qed_hwfn *hwfn, struct qed_ptt *ptt); 9808c2ecf20Sopenharmony_civoid qed_bw_update(struct qed_hwfn *hwfn, struct qed_ptt *ptt); 9818c2ecf20Sopenharmony_ciu32 qed_unzip_data(struct qed_hwfn *p_hwfn, 9828c2ecf20Sopenharmony_ci u32 input_len, u8 *input_buf, 9838c2ecf20Sopenharmony_ci u32 max_size, u8 *unzip_buf); 9848c2ecf20Sopenharmony_ciint qed_recovery_process(struct qed_dev *cdev); 9858c2ecf20Sopenharmony_civoid qed_schedule_recovery_handler(struct qed_hwfn *p_hwfn); 9868c2ecf20Sopenharmony_civoid qed_hw_error_occurred(struct qed_hwfn *p_hwfn, 9878c2ecf20Sopenharmony_ci enum qed_hw_err_type err_type); 9888c2ecf20Sopenharmony_civoid qed_get_protocol_stats(struct qed_dev *cdev, 9898c2ecf20Sopenharmony_ci enum qed_mcp_protocol_type type, 9908c2ecf20Sopenharmony_ci union qed_mcp_protocol_stats *stats); 9918c2ecf20Sopenharmony_ciint qed_slowpath_irq_req(struct qed_hwfn *hwfn); 9928c2ecf20Sopenharmony_civoid qed_slowpath_irq_sync(struct qed_hwfn *p_hwfn); 9938c2ecf20Sopenharmony_ciint qed_mfw_tlv_req(struct qed_hwfn *hwfn); 9948c2ecf20Sopenharmony_ci 9958c2ecf20Sopenharmony_ciint qed_mfw_fill_tlv_data(struct qed_hwfn *hwfn, 9968c2ecf20Sopenharmony_ci enum qed_mfw_tlv_type type, 9978c2ecf20Sopenharmony_ci union qed_mfw_tlv_data *tlv_data); 9988c2ecf20Sopenharmony_ci 9998c2ecf20Sopenharmony_civoid qed_hw_info_set_offload_tc(struct qed_hw_info *p_info, u8 tc); 10008c2ecf20Sopenharmony_ci 10018c2ecf20Sopenharmony_civoid qed_periodic_db_rec_start(struct qed_hwfn *p_hwfn); 10028c2ecf20Sopenharmony_ci#endif /* _QED_H */ 1003