linux/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * QLogic qlcnic NIC Driver
 * Copyright (c) 2009-2013 QLogic Corporation
 */

#include <linux/if_vlan.h>
#include <linux/ipv6.h>
#include <linux/ethtool.h>
#include <linux/interrupt.h>

#include "qlcnic.h"
#include "qlcnic_sriov.h"

static void __qlcnic_83xx_process_aen(struct qlcnic_adapter *);
static int qlcnic_83xx_clear_lb_mode(struct qlcnic_adapter *, u8);
static void qlcnic_83xx_configure_mac(struct qlcnic_adapter *, u8 *, u8,
				      struct qlcnic_cmd_args *);
static int qlcnic_83xx_get_port_config(struct qlcnic_adapter *);
static irqreturn_t qlcnic_83xx_handle_aen(int, void *);
static pci_ers_result_t qlcnic_83xx_io_error_detected(struct pci_dev *,
						      pci_channel_state_t);
static int qlcnic_83xx_set_port_config(struct qlcnic_adapter *);
static pci_ers_result_t qlcnic_83xx_io_slot_reset(struct pci_dev *);
static void qlcnic_83xx_io_resume(struct pci_dev *);
static int qlcnic_83xx_set_lb_mode(struct qlcnic_adapter *, u8);
static void qlcnic_83xx_set_mac_filter_count(struct qlcnic_adapter *);
static int qlcnic_83xx_resume(struct qlcnic_adapter *);
static int qlcnic_83xx_shutdown(struct pci_dev *);
static void qlcnic_83xx_get_beacon_state(struct qlcnic_adapter *);

#define RSS_HASHTYPE_IP_TCP
#define QLC_83XX_FW_MBX_CMD
#define QLC_SKIP_INACTIVE_PCI_REGS
#define QLC_MAX_LEGACY_FUNC_SUPP

/* 83xx Module type */
#define QLC_83XX_MODULE_FIBRE_10GBASE_LRM
#define QLC_83XX_MODULE_FIBRE_10GBASE_LR
#define QLC_83XX_MODULE_FIBRE_10GBASE_SR
#define QLC_83XX_MODULE_DA_10GE_PASSIVE_CP
#define QLC_83XX_MODULE_DA_10GE_ACTIVE_CP
#define QLC_83XX_MODULE_DA_10GE_LEGACY_CP
#define QLC_83XX_MODULE_FIBRE_1000BASE_SX
#define QLC_83XX_MODULE_FIBRE_1000BASE_LX
#define QLC_83XX_MODULE_FIBRE_1000BASE_CX
#define QLC_83XX_MODULE_TP_1000BASE_T
#define QLC_83XX_MODULE_DA_1GE_PASSIVE_CP
#define QLC_83XX_MODULE_UNKNOWN

/* Port types */
#define QLC_83XX_10_CAPABLE
#define QLC_83XX_100_CAPABLE
#define QLC_83XX_1G_CAPABLE
#define QLC_83XX_10G_CAPABLE
#define QLC_83XX_AUTONEG_ENABLE

static const struct qlcnic_mailbox_metadata qlcnic_83xx_mbx_tbl[] =;

const u32 qlcnic_83xx_ext_reg_tbl[] =;

const u32 qlcnic_83xx_reg_tbl[] =;

static struct qlcnic_hardware_ops qlcnic_83xx_hw_ops =;

static struct qlcnic_nic_template qlcnic_83xx_ops =;

void qlcnic_83xx_register_map(struct qlcnic_hardware_context *ahw)
{}

int qlcnic_83xx_get_fw_version(struct qlcnic_adapter *adapter)
{}

static int __qlcnic_set_win_base(struct qlcnic_adapter *adapter, u32 addr)
{}

int qlcnic_83xx_rd_reg_indirect(struct qlcnic_adapter *adapter, ulong addr,
				int *err)
{}

int qlcnic_83xx_wrt_reg_indirect(struct qlcnic_adapter *adapter, ulong addr,
				 u32 data)
{}

static void qlcnic_83xx_enable_legacy(struct qlcnic_adapter *adapter)
{}

static int qlcnic_83xx_calculate_msix_vector(struct qlcnic_adapter *adapter)
{}

int qlcnic_83xx_setup_intr(struct qlcnic_adapter *adapter)
{}

static inline void qlcnic_83xx_clear_legacy_intr_mask(struct qlcnic_adapter *adapter)
{}

static inline void qlcnic_83xx_set_legacy_intr_mask(struct qlcnic_adapter *adapter)
{}

static inline void qlcnic_83xx_enable_legacy_msix_mbx_intr(struct qlcnic_adapter
						    *adapter)
{}

void qlcnic_83xx_disable_mbx_intr(struct qlcnic_adapter *adapter)
{}

static inline void qlcnic_83xx_get_mbx_data(struct qlcnic_adapter *adapter,
				     struct qlcnic_cmd_args *cmd)
{}

irqreturn_t qlcnic_83xx_clear_legacy_intr(struct qlcnic_adapter *adapter)
{}

static inline void qlcnic_83xx_notify_mbx_response(struct qlcnic_mailbox *mbx)
{}

static void qlcnic_83xx_poll_process_aen(struct qlcnic_adapter *adapter)
{}

irqreturn_t qlcnic_83xx_intr(int irq, void *data)
{}

irqreturn_t qlcnic_83xx_tmp_intr(int irq, void *data)
{}

void qlcnic_83xx_free_mbx_intr(struct qlcnic_adapter *adapter)
{}

int qlcnic_83xx_setup_mbx_intr(struct qlcnic_adapter *adapter)
{}

void qlcnic_83xx_get_func_no(struct qlcnic_adapter *adapter)
{}

int qlcnic_83xx_cam_lock(struct qlcnic_adapter *adapter)
{}

void qlcnic_83xx_cam_unlock(struct qlcnic_adapter *adapter)
{}

void qlcnic_83xx_read_crb(struct qlcnic_adapter *adapter, char *buf,
			  loff_t offset, size_t size)
{}

void qlcnic_83xx_write_crb(struct qlcnic_adapter *adapter, char *buf,
			   loff_t offset, size_t size)
{}

int qlcnic_83xx_get_port_info(struct qlcnic_adapter *adapter)
{}

static void qlcnic_83xx_set_mac_filter_count(struct qlcnic_adapter *adapter)
{}

void qlcnic_83xx_enable_mbx_interrupt(struct qlcnic_adapter *adapter)
{}

void qlcnic_83xx_check_vf(struct qlcnic_adapter *adapter,
			  const struct pci_device_id *ent)
{}

static void qlcnic_83xx_handle_link_aen(struct qlcnic_adapter *adapter,
					u32 data[]);
static void qlcnic_83xx_handle_idc_comp_aen(struct qlcnic_adapter *adapter,
					    u32 data[]);

void qlcnic_dump_mbx(struct qlcnic_adapter *adapter,
		     struct qlcnic_cmd_args *cmd)
{}

static void qlcnic_83xx_poll_for_mbx_completion(struct qlcnic_adapter *adapter,
						struct qlcnic_cmd_args *cmd)
{}

int qlcnic_83xx_issue_cmd(struct qlcnic_adapter *adapter,
			  struct qlcnic_cmd_args *cmd)
{}

int qlcnic_83xx_alloc_mbx_args(struct qlcnic_cmd_args *mbx,
			       struct qlcnic_adapter *adapter, u32 type)
{}

void qlcnic_83xx_idc_aen_work(struct work_struct *work)
{}

static void qlcnic_83xx_handle_idc_comp_aen(struct qlcnic_adapter *adapter,
					    u32 data[])
{}

static void __qlcnic_83xx_process_aen(struct qlcnic_adapter *adapter)
{}

static void qlcnic_83xx_process_aen(struct qlcnic_adapter *adapter)
{}

static void qlcnic_83xx_mbx_poll_work(struct work_struct *work)
{}

void qlcnic_83xx_enable_mbx_poll(struct qlcnic_adapter *adapter)
{}

void qlcnic_83xx_disable_mbx_poll(struct qlcnic_adapter *adapter)
{}

static int qlcnic_83xx_add_rings(struct qlcnic_adapter *adapter)
{}

void qlcnic_83xx_del_rx_ctx(struct qlcnic_adapter *adapter)
{}

int qlcnic_83xx_create_rx_ctx(struct qlcnic_adapter *adapter)
{}

void qlcnic_83xx_del_tx_ctx(struct qlcnic_adapter *adapter,
			    struct qlcnic_host_tx_ring *tx_ring)
{}

int qlcnic_83xx_create_tx_ctx(struct qlcnic_adapter *adapter,
			      struct qlcnic_host_tx_ring *tx, int ring)
{}

static int qlcnic_83xx_diag_alloc_res(struct net_device *netdev, int test,
				      u8 num_sds_ring)
{}

static void qlcnic_83xx_diag_free_res(struct net_device *netdev,
				      u8 drv_sds_rings)
{}

static void qlcnic_83xx_get_beacon_state(struct qlcnic_adapter *adapter)
{}

int qlcnic_83xx_config_led(struct qlcnic_adapter *adapter, u32 state,
			   u32 beacon)
{}

int  qlcnic_83xx_set_led(struct net_device *netdev,
			 enum ethtool_phys_id_state state)
{}

void qlcnic_83xx_initialize_nic(struct qlcnic_adapter *adapter, int enable)
{}

static int qlcnic_83xx_set_port_config(struct qlcnic_adapter *adapter)
{}

static int qlcnic_83xx_get_port_config(struct qlcnic_adapter *adapter)
{}

int qlcnic_83xx_setup_link_event(struct qlcnic_adapter *adapter, int enable)
{}

static void qlcnic_83xx_set_interface_id_promisc(struct qlcnic_adapter *adapter,
						 u32 *interface_id)
{}

int qlcnic_83xx_nic_set_promisc(struct qlcnic_adapter *adapter, u32 mode)
{}

int qlcnic_83xx_loopback_test(struct net_device *netdev, u8 mode)
{}

static void qlcnic_extend_lb_idc_cmpltn_wait(struct qlcnic_adapter *adapter,
					     u32 *max_wait_count)
{}

static int qlcnic_83xx_set_lb_mode(struct qlcnic_adapter *adapter, u8 mode)
{}

static int qlcnic_83xx_clear_lb_mode(struct qlcnic_adapter *adapter, u8 mode)
{}

static void qlcnic_83xx_set_interface_id_ipaddr(struct qlcnic_adapter *adapter,
						u32 *interface_id)
{}

void qlcnic_83xx_config_ipaddr(struct qlcnic_adapter *adapter, __be32 ip,
			       int mode)
{}

int qlcnic_83xx_config_hw_lro(struct qlcnic_adapter *adapter, int mode)
{}

int qlcnic_83xx_config_rss(struct qlcnic_adapter *adapter, int enable)
{}

static void qlcnic_83xx_set_interface_id_macaddr(struct qlcnic_adapter *adapter,
						 u32 *interface_id)
{}

int qlcnic_83xx_sre_macaddr_change(struct qlcnic_adapter *adapter, u8 *addr,
				   u16 vlan_id, u8 op)
{}

void qlcnic_83xx_change_l2_filter(struct qlcnic_adapter *adapter, u64 *addr,
				  u16 vlan_id,
				  struct qlcnic_host_tx_ring *tx_ring)
{}

static void qlcnic_83xx_configure_mac(struct qlcnic_adapter *adapter, u8 *mac,
				      u8 type, struct qlcnic_cmd_args *cmd)
{}

int qlcnic_83xx_get_mac_address(struct qlcnic_adapter *adapter, u8 *mac,
				u8 function)
{}

static int qlcnic_83xx_set_rx_intr_coal(struct qlcnic_adapter *adapter)
{}

static int qlcnic_83xx_set_tx_intr_coal(struct qlcnic_adapter *adapter)
{}

int qlcnic_83xx_set_rx_tx_intr_coal(struct qlcnic_adapter *adapter)
{}

int qlcnic_83xx_config_intr_coal(struct qlcnic_adapter *adapter,
				 struct ethtool_coalesce *ethcoal)
{}

static void qlcnic_83xx_handle_link_aen(struct qlcnic_adapter *adapter,
					u32 data[])
{}

static irqreturn_t qlcnic_83xx_handle_aen(int irq, void *data)
{}

int qlcnic_83xx_set_nic_info(struct qlcnic_adapter *adapter,
			     struct qlcnic_info *nic)
{}

int qlcnic_83xx_get_nic_info(struct qlcnic_adapter *adapter,
			     struct qlcnic_info *npar_info, u8 func_id)
{}

int qlcnic_get_pci_func_type(struct qlcnic_adapter *adapter, u16 type,
			     u16 *nic, u16 *fcoe, u16 *iscsi)
{}

int qlcnic_83xx_get_pci_info(struct qlcnic_adapter *adapter,
			     struct qlcnic_pci_info *pci_info)
{}

int qlcnic_83xx_config_intrpt(struct qlcnic_adapter *adapter, bool op_type)
{}

int qlcnic_83xx_lock_flash(struct qlcnic_adapter *adapter)
{}

void qlcnic_83xx_unlock_flash(struct qlcnic_adapter *adapter)
{}

int qlcnic_83xx_lockless_flash_read32(struct qlcnic_adapter *adapter,
				      u32 flash_addr, u8 *p_data,
				      int count)
{}

static int qlcnic_83xx_poll_flash_status_reg(struct qlcnic_adapter *adapter)
{}

int qlcnic_83xx_enable_flash_write(struct qlcnic_adapter *adapter)
{}

int qlcnic_83xx_disable_flash_write(struct qlcnic_adapter *adapter)
{}

int qlcnic_83xx_read_flash_mfg_id(struct qlcnic_adapter *adapter)
{}

int qlcnic_83xx_read_flash_descriptor_table(struct qlcnic_adapter *adapter)
{}

int qlcnic_83xx_erase_flash_sector(struct qlcnic_adapter *adapter,
				   u32 sector_start_addr)
{}

int qlcnic_83xx_flash_write32(struct qlcnic_adapter *adapter, u32 addr,
			      u32 *p_data)
{}

int qlcnic_83xx_flash_bulk_write(struct qlcnic_adapter *adapter, u32 addr,
				 u32 *p_data, int count)
{}

static void qlcnic_83xx_recover_driver_lock(struct qlcnic_adapter *adapter)
{}

int qlcnic_83xx_lock_driver(struct qlcnic_adapter *adapter)
{}

void qlcnic_83xx_unlock_driver(struct qlcnic_adapter *adapter)
{}

int qlcnic_ms_mem_write128(struct qlcnic_adapter *adapter, u64 addr,
				u32 *data, u32 count)
{}

int qlcnic_83xx_flash_read32(struct qlcnic_adapter *adapter, u32 flash_addr,
			     u8 *p_data, int count)
{}

void qlcnic_83xx_get_port_type(struct qlcnic_adapter *adapter)
{}

int qlcnic_83xx_test_link(struct qlcnic_adapter *adapter)
{}

int qlcnic_83xx_get_link_ksettings(struct qlcnic_adapter *adapter,
				   struct ethtool_link_ksettings *ecmd)
{}

int qlcnic_83xx_set_link_ksettings(struct qlcnic_adapter *adapter,
				   const struct ethtool_link_ksettings *ecmd)
{}

static inline u64 *qlcnic_83xx_copy_stats(struct qlcnic_cmd_args *cmd,
					  u64 *data, int index)
{}

static u64 *qlcnic_83xx_fill_stats(struct qlcnic_adapter *adapter,
				   struct qlcnic_cmd_args *cmd, u64 *data,
				   int type, int *ret)
{}

void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data)
{}

#define QLCNIC_83XX_ADD_PORT0
#define QLCNIC_83XX_ADD_PORT1
#define QLCNIC_83XX_EXTENDED_MEM_SIZE
int qlcnic_83xx_extend_md_capab(struct qlcnic_adapter *adapter)
{}

int qlcnic_83xx_reg_test(struct qlcnic_adapter *adapter)
{}

inline int qlcnic_83xx_get_regs_len(struct qlcnic_adapter *adapter)
{}

int qlcnic_83xx_get_registers(struct qlcnic_adapter *adapter, u32 *regs_buff)
{}

int qlcnic_83xx_interrupt_test(struct net_device *netdev)
{}

void qlcnic_83xx_get_pauseparam(struct qlcnic_adapter *adapter,
				struct ethtool_pauseparam *pause)
{}

int qlcnic_83xx_set_pauseparam(struct qlcnic_adapter *adapter,
			       struct ethtool_pauseparam *pause)
{}

static int qlcnic_83xx_read_flash_status_reg(struct qlcnic_adapter *adapter)
{}

int qlcnic_83xx_flash_test(struct qlcnic_adapter *adapter)
{}

static int qlcnic_83xx_shutdown(struct pci_dev *pdev)
{}

static int qlcnic_83xx_resume(struct qlcnic_adapter *adapter)
{}

void qlcnic_83xx_reinit_mbx_work(struct qlcnic_mailbox *mbx)
{}

void qlcnic_83xx_free_mailbox(struct qlcnic_mailbox *mbx)
{}

static inline void
qlcnic_83xx_notify_cmd_completion(struct qlcnic_adapter *adapter,
				  struct qlcnic_cmd_args *cmd)
{}

static void qlcnic_83xx_flush_mbx_queue(struct qlcnic_adapter *adapter)
{}

static int qlcnic_83xx_check_mbx_status(struct qlcnic_adapter *adapter)
{}

static inline void qlcnic_83xx_signal_mbx_cmd(struct qlcnic_adapter *adapter,
					      u8 issue_cmd)
{}

static void qlcnic_83xx_dequeue_mbx_cmd(struct qlcnic_adapter *adapter,
					struct qlcnic_cmd_args *cmd)
{}

static void qlcnic_83xx_encode_mbx_cmd(struct qlcnic_adapter *adapter,
				       struct qlcnic_cmd_args *cmd)
{}

void qlcnic_83xx_detach_mailbox_work(struct qlcnic_adapter *adapter)
{}

static int qlcnic_83xx_enqueue_mbx_cmd(struct qlcnic_adapter *adapter,
				       struct qlcnic_cmd_args *cmd,
				       unsigned long *timeout)
{}

static int qlcnic_83xx_check_mac_rcode(struct qlcnic_adapter *adapter,
				       struct qlcnic_cmd_args *cmd)
{}

static void qlcnic_83xx_decode_mbx_rsp(struct qlcnic_adapter *adapter,
				       struct qlcnic_cmd_args *cmd)
{}

static inline void qlcnic_dump_mailbox_registers(struct qlcnic_adapter *adapter)
{}

static void qlcnic_83xx_mailbox_worker(struct work_struct *work)
{}

static const struct qlcnic_mbx_ops qlcnic_83xx_mbx_ops =;

int qlcnic_83xx_init_mailbox_work(struct qlcnic_adapter *adapter)
{}

static pci_ers_result_t qlcnic_83xx_io_error_detected(struct pci_dev *pdev,
						      pci_channel_state_t state)
{}

static pci_ers_result_t qlcnic_83xx_io_slot_reset(struct pci_dev *pdev)
{}

static void qlcnic_83xx_io_resume(struct pci_dev *pdev)
{}