linux/drivers/net/ethernet/qlogic/qla3xxx.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * QLogic QLA3xxx NIC HBA Driver
 * Copyright (c)  2003-2006 QLogic Corporation
 */

#define pr_fmt(fmt)

#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/module.h>
#include <linux/list.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/dmapool.h>
#include <linux/mempool.h>
#include <linux/spinlock.h>
#include <linux/kthread.h>
#include <linux/interrupt.h>
#include <linux/errno.h>
#include <linux/ioport.h>
#include <linux/ip.h>
#include <linux/in.h>
#include <linux/if_arp.h>
#include <linux/if_ether.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/ethtool.h>
#include <linux/skbuff.h>
#include <linux/rtnetlink.h>
#include <linux/if_vlan.h>
#include <linux/delay.h>
#include <linux/mm.h>
#include <linux/prefetch.h>

#include "qla3xxx.h"

#define DRV_NAME
#define DRV_STRING
#define DRV_VERSION

static const char ql3xxx_driver_name[] =;
static const char ql3xxx_driver_version[] =;

#define TIMED_OUT_MSG

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_VERSION();

static const u32 default_msg
    =;

static int debug =;		/* defaults above */
module_param(debug, int, 0);
MODULE_PARM_DESC();

static int msi;
module_param(msi, int, 0);
MODULE_PARM_DESC();

static const struct pci_device_id ql3xxx_pci_tbl[] =;

MODULE_DEVICE_TABLE(pci, ql3xxx_pci_tbl);

/*
 *  These are the known PHY's which are used
 */
enum PHY_DEVICE_TYPE {};

struct PHY_DEVICE_INFO {};

static const struct PHY_DEVICE_INFO PHY_DEVICES[] =;


/*
 * Caller must take hw_lock.
 */
static int ql_sem_spinlock(struct ql3_adapter *qdev,
			    u32 sem_mask, u32 sem_bits)
{}

static void ql_sem_unlock(struct ql3_adapter *qdev, u32 sem_mask)
{}

static int ql_sem_lock(struct ql3_adapter *qdev, u32 sem_mask, u32 sem_bits)
{}

/*
 * Caller holds hw_lock.
 */
static int ql_wait_for_drvr_lock(struct ql3_adapter *qdev)
{}

static void ql_set_register_page(struct ql3_adapter *qdev, u32 page)
{}

static u32 ql_read_common_reg_l(struct ql3_adapter *qdev, u32 __iomem *reg)
{}

static u32 ql_read_common_reg(struct ql3_adapter *qdev, u32 __iomem *reg)
{}

static u32 ql_read_page0_reg_l(struct ql3_adapter *qdev, u32 __iomem *reg)
{}

static u32 ql_read_page0_reg(struct ql3_adapter *qdev, u32 __iomem *reg)
{}

static void ql_write_common_reg_l(struct ql3_adapter *qdev,
				u32 __iomem *reg, u32 value)
{}

static void ql_write_common_reg(struct ql3_adapter *qdev,
				u32 __iomem *reg, u32 value)
{}

static void ql_write_nvram_reg(struct ql3_adapter *qdev,
				u32 __iomem *reg, u32 value)
{}

static void ql_write_page0_reg(struct ql3_adapter *qdev,
			       u32 __iomem *reg, u32 value)
{}

/*
 * Caller holds hw_lock. Only called during init.
 */
static void ql_write_page1_reg(struct ql3_adapter *qdev,
			       u32 __iomem *reg, u32 value)
{}

/*
 * Caller holds hw_lock. Only called during init.
 */
static void ql_write_page2_reg(struct ql3_adapter *qdev,
			       u32 __iomem *reg, u32 value)
{}

static void ql_disable_interrupts(struct ql3_adapter *qdev)
{}

static void ql_enable_interrupts(struct ql3_adapter *qdev)
{}

static void ql_release_to_lrg_buf_free_list(struct ql3_adapter *qdev,
					    struct ql_rcv_buf_cb *lrg_buf_cb)
{}

static struct ql_rcv_buf_cb *ql_get_from_lrg_buf_free_list(struct ql3_adapter
							   *qdev)
{}

static u32 addrBits =;
static u32 dataBits =;

static void fm93c56a_deselect(struct ql3_adapter *qdev);
static void eeprom_readword(struct ql3_adapter *qdev, u32 eepromAddr,
			    unsigned short *value);

/*
 * Caller holds hw_lock.
 */
static void fm93c56a_select(struct ql3_adapter *qdev)
{}

/*
 * Caller holds hw_lock.
 */
static void fm93c56a_cmd(struct ql3_adapter *qdev, u32 cmd, u32 eepromAddr)
{}

/*
 * Caller holds hw_lock.
 */
static void fm93c56a_deselect(struct ql3_adapter *qdev)
{}

/*
 * Caller holds hw_lock.
 */
static void fm93c56a_datain(struct ql3_adapter *qdev, unsigned short *value)
{}

/*
 * Caller holds hw_lock.
 */
static void eeprom_readword(struct ql3_adapter *qdev,
			    u32 eepromAddr, unsigned short *value)
{}

static void ql_set_mac_addr(struct net_device *ndev, u16 *addr)
{}

static int ql_get_nvram_params(struct ql3_adapter *qdev)
{}

static const u32 PHYAddr[2] =;

static int ql_wait_for_mii_ready(struct ql3_adapter *qdev)
{}

static void ql_mii_enable_scan_mode(struct ql3_adapter *qdev)
{}

static u8 ql_mii_disable_scan_mode(struct ql3_adapter *qdev)
{}

static int ql_mii_write_reg_ex(struct ql3_adapter *qdev,
			       u16 regAddr, u16 value, u32 phyAddr)
{}

static int ql_mii_read_reg_ex(struct ql3_adapter *qdev, u16 regAddr,
			      u16 *value, u32 phyAddr)
{}

static int ql_mii_write_reg(struct ql3_adapter *qdev, u16 regAddr, u16 value)
{}

static int ql_mii_read_reg(struct ql3_adapter *qdev, u16 regAddr, u16 *value)
{}

static void ql_petbi_reset(struct ql3_adapter *qdev)
{}

static void ql_petbi_start_neg(struct ql3_adapter *qdev)
{}

static void ql_petbi_reset_ex(struct ql3_adapter *qdev)
{}

static void ql_petbi_start_neg_ex(struct ql3_adapter *qdev)
{}

static void ql_petbi_init(struct ql3_adapter *qdev)
{}

static void ql_petbi_init_ex(struct ql3_adapter *qdev)
{}

static int ql_is_petbi_neg_pause(struct ql3_adapter *qdev)
{}

static void phyAgereSpecificInit(struct ql3_adapter *qdev, u32 miiAddr)
{}

static enum PHY_DEVICE_TYPE getPhyType(struct ql3_adapter *qdev,
				       u16 phyIdReg0, u16 phyIdReg1)
{}

static int ql_phy_get_speed(struct ql3_adapter *qdev)
{}

static int ql_is_full_dup(struct ql3_adapter *qdev)
{}

static int ql_is_phy_neg_pause(struct ql3_adapter *qdev)
{}

static int PHY_Setup(struct ql3_adapter *qdev)
{}

/*
 * Caller holds hw_lock.
 */
static void ql_mac_enable(struct ql3_adapter *qdev, u32 enable)
{}

/*
 * Caller holds hw_lock.
 */
static void ql_mac_cfg_soft_reset(struct ql3_adapter *qdev, u32 enable)
{}

/*
 * Caller holds hw_lock.
 */
static void ql_mac_cfg_gig(struct ql3_adapter *qdev, u32 enable)
{}

/*
 * Caller holds hw_lock.
 */
static void ql_mac_cfg_full_dup(struct ql3_adapter *qdev, u32 enable)
{}

/*
 * Caller holds hw_lock.
 */
static void ql_mac_cfg_pause(struct ql3_adapter *qdev, u32 enable)
{}

/*
 * Caller holds hw_lock.
 */
static int ql_is_fiber(struct ql3_adapter *qdev)
{}

static int ql_is_auto_cfg(struct ql3_adapter *qdev)
{}

/*
 * Caller holds hw_lock.
 */
static int ql_is_auto_neg_complete(struct ql3_adapter *qdev)
{}

/*
 *  ql_is_neg_pause() returns 1 if pause was negotiated to be on
 */
static int ql_is_neg_pause(struct ql3_adapter *qdev)
{}

static int ql_auto_neg_error(struct ql3_adapter *qdev)
{}

static u32 ql_get_link_speed(struct ql3_adapter *qdev)
{}

static int ql_is_link_full_dup(struct ql3_adapter *qdev)
{}

/*
 * Caller holds hw_lock.
 */
static int ql_link_down_detect(struct ql3_adapter *qdev)
{}

/*
 * Caller holds hw_lock.
 */
static int ql_link_down_detect_clear(struct ql3_adapter *qdev)
{}

/*
 * Caller holds hw_lock.
 */
static int ql_this_adapter_controls_port(struct ql3_adapter *qdev)
{}

static void ql_phy_reset_ex(struct ql3_adapter *qdev)
{}

static void ql_phy_start_neg_ex(struct ql3_adapter *qdev)
{}

static void ql_phy_init_ex(struct ql3_adapter *qdev)
{}

/*
 * Caller holds hw_lock.
 */
static u32 ql_get_link_state(struct ql3_adapter *qdev)
{}

static int ql_port_start(struct ql3_adapter *qdev)
{}

static int ql_finish_auto_neg(struct ql3_adapter *qdev)
{}

static void ql_link_state_machine_work(struct work_struct *work)
{}

/*
 * Caller must take hw_lock and QL_PHY_GIO_SEM.
 */
static void ql_get_phy_owner(struct ql3_adapter *qdev)
{}

/*
 * Caller must take hw_lock and QL_PHY_GIO_SEM.
 */
static void ql_init_scan_mode(struct ql3_adapter *qdev)
{}

/*
 * MII_Setup needs to be called before taking the PHY out of reset
 * so that the management interface clock speed can be set properly.
 * It would be better if we had a way to disable MDC until after the
 * PHY is out of reset, but we don't have that capability.
 */
static int ql_mii_setup(struct ql3_adapter *qdev)
{}

#define SUPPORTED_OPTICAL_MODES
#define SUPPORTED_TP_MODES			\

static u32 ql_supported_modes(struct ql3_adapter *qdev)
{}

static int ql_get_auto_cfg_status(struct ql3_adapter *qdev)
{}

static u32 ql_get_speed(struct ql3_adapter *qdev)
{}

static int ql_get_full_dup(struct ql3_adapter *qdev)
{}

static int ql_get_link_ksettings(struct net_device *ndev,
				 struct ethtool_link_ksettings *cmd)
{}

static void ql_get_drvinfo(struct net_device *ndev,
			   struct ethtool_drvinfo *drvinfo)
{}

static u32 ql_get_msglevel(struct net_device *ndev)
{}

static void ql_set_msglevel(struct net_device *ndev, u32 value)
{}

static void ql_get_pauseparam(struct net_device *ndev,
			      struct ethtool_pauseparam *pause)
{}

static const struct ethtool_ops ql3xxx_ethtool_ops =;

static int ql_populate_free_queue(struct ql3_adapter *qdev)
{}

/*
 * Caller holds hw_lock.
 */
static void ql_update_small_bufq_prod_index(struct ql3_adapter *qdev)
{}

/*
 * Caller holds hw_lock.
 */
static void ql_update_lrg_bufq_prod_index(struct ql3_adapter *qdev)
{}

static void ql_process_mac_tx_intr(struct ql3_adapter *qdev,
				   struct ob_mac_iocb_rsp *mac_rsp)
{}

static void ql_get_sbuf(struct ql3_adapter *qdev)
{}

static struct ql_rcv_buf_cb *ql_get_lbuf(struct ql3_adapter *qdev)
{}

/*
 * The difference between 3022 and 3032 for inbound completions:
 * 3022 uses two buffers per completion.  The first buffer contains
 * (some) header info, the second the remainder of the headers plus
 * the data.  For this chip we reserve some space at the top of the
 * receive buffer so that the header info in buffer one can be
 * prepended to the buffer two.  Buffer two is the sent up while
 * buffer one is returned to the hardware to be reused.
 * 3032 receives all of it's data and headers in one buffer for a
 * simpler process.  3032 also supports checksum verification as
 * can be seen in ql_process_macip_rx_intr().
 */
static void ql_process_mac_rx_intr(struct ql3_adapter *qdev,
				   struct ib_mac_iocb_rsp *ib_mac_rsp_ptr)
{}

static void ql_process_macip_rx_intr(struct ql3_adapter *qdev,
				     struct ib_ip_iocb_rsp *ib_ip_rsp_ptr)
{}

static int ql_tx_rx_clean(struct ql3_adapter *qdev, int budget)
{}

static int ql_poll(struct napi_struct *napi, int budget)
{}

static irqreturn_t ql3xxx_isr(int irq, void *dev_id)
{}

/*
 * Get the total number of segments needed for the given number of fragments.
 * This is necessary because outbound address lists (OAL) will be used when
 * more than two frags are given.  Each address list has 5 addr/len pairs.
 * The 5th pair in each OAL is used to  point to the next OAL if more frags
 * are coming.  That is why the frags:segment count ratio is not linear.
 */
static int ql_get_seg_count(struct ql3_adapter *qdev, unsigned short frags)
{}

static void ql_hw_csum_setup(const struct sk_buff *skb,
			     struct ob_mac_iocb_req *mac_iocb_ptr)
{}

/*
 * Map the buffers for this transmit.
 * This will return NETDEV_TX_BUSY or NETDEV_TX_OK based on success.
 */
static int ql_send_map(struct ql3_adapter *qdev,
				struct ob_mac_iocb_req *mac_iocb_ptr,
				struct ql_tx_buf_cb *tx_cb,
				struct sk_buff *skb)
{}

/*
 * The difference between 3022 and 3032 sends:
 * 3022 only supports a simple single segment transmission.
 * 3032 supports checksumming and scatter/gather lists (fragments).
 * The 3032 supports sglists by using the 3 addr/len pairs (ALP)
 * in the IOCB plus a chain of outbound address lists (OAL) that
 * each contain 5 ALPs.  The last ALP of the IOCB (3rd) or OAL (5th)
 * will be used to point to an OAL when more ALP entries are required.
 * The IOCB is always the top of the chain followed by one or more
 * OALs (when necessary).
 */
static netdev_tx_t ql3xxx_send(struct sk_buff *skb,
			       struct net_device *ndev)
{}

static int ql_alloc_net_req_rsp_queues(struct ql3_adapter *qdev)
{}

static void ql_free_net_req_rsp_queues(struct ql3_adapter *qdev)
{}

static int ql_alloc_buffer_queues(struct ql3_adapter *qdev)
{}

static void ql_free_buffer_queues(struct ql3_adapter *qdev)
{}

static int ql_alloc_small_buffers(struct ql3_adapter *qdev)
{}

static void ql_free_small_buffers(struct ql3_adapter *qdev)
{}

static void ql_free_large_buffers(struct ql3_adapter *qdev)
{}

static void ql_init_large_buffers(struct ql3_adapter *qdev)
{}

static int ql_alloc_large_buffers(struct ql3_adapter *qdev)
{}

static void ql_free_send_free_list(struct ql3_adapter *qdev)
{}

static int ql_create_send_free_list(struct ql3_adapter *qdev)
{}

static int ql_alloc_mem_resources(struct ql3_adapter *qdev)
{}

static void ql_free_mem_resources(struct ql3_adapter *qdev)
{}

static int ql_init_misc_registers(struct ql3_adapter *qdev)
{}

static int ql_adapter_initialize(struct ql3_adapter *qdev)
{}

/*
 * Caller holds hw_lock.
 */
static int ql_adapter_reset(struct ql3_adapter *qdev)
{}

static void ql_set_mac_info(struct ql3_adapter *qdev)
{}

static void ql_display_dev_info(struct net_device *ndev)
{}

static int ql_adapter_down(struct ql3_adapter *qdev, int do_reset)
{}

static int ql_adapter_up(struct ql3_adapter *qdev)
{}

static int ql_cycle_adapter(struct ql3_adapter *qdev, int reset)
{}

static int ql3xxx_close(struct net_device *ndev)
{}

static int ql3xxx_open(struct net_device *ndev)
{}

static int ql3xxx_set_mac_address(struct net_device *ndev, void *p)
{}

static void ql3xxx_tx_timeout(struct net_device *ndev, unsigned int txqueue)
{}

static void ql_reset_work(struct work_struct *work)
{}

static void ql_tx_timeout_work(struct work_struct *work)
{}

static void ql_get_board_info(struct ql3_adapter *qdev)
{}

static void ql3xxx_timer(struct timer_list *t)
{}

static const struct net_device_ops ql3xxx_netdev_ops =;

static int ql3xxx_probe(struct pci_dev *pdev,
			const struct pci_device_id *pci_entry)
{}

static void ql3xxx_remove(struct pci_dev *pdev)
{}

static struct pci_driver ql3xxx_driver =;

module_pci_driver();