linux/drivers/scsi/bfa/bfad.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
 * Copyright (c) 2014- QLogic Corporation.
 * All rights reserved
 * www.qlogic.com
 *
 * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
 */

/*
 *  bfad.c Linux driver PCI interface module.
 */
#include <linux/module.h>
#include <linux/kthread.h>
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/pci.h>
#include <linux/firmware.h>
#include <linux/uaccess.h>
#include <asm/fcntl.h>

#include "bfad_drv.h"
#include "bfad_im.h"
#include "bfa_fcs.h"
#include "bfa_defs.h"
#include "bfa.h"

BFA_TRC_FILE();
DEFINE_MUTEX();
LIST_HEAD();

static int	bfad_inst;
static int      num_sgpgs_parm;
int		supported_fc4s;
char		*host_name, *os_name, *os_patch;
int		num_rports, num_ios, num_tms;
int		num_fcxps, num_ufbufs;
int		reqq_size, rspq_size, num_sgpgs;
int		rport_del_timeout =;
int		bfa_lun_queue_depth =;
int		bfa_io_max_sge =;
int		bfa_log_level =; /* WARNING log level */
int		ioc_auto_recover =;
int		bfa_linkup_delay =;
int		fdmi_enable =;
int		pcie_max_read_reqsz;
int		bfa_debugfs_enable =;
int		msix_disable_cb =, msix_disable_ct =;
int		max_xfer_size =;
static int	max_rport_logins =;

/* Firmware releated */
u32	bfi_image_cb_size, bfi_image_ct_size, bfi_image_ct2_size;
u32	*bfi_image_cb, *bfi_image_ct, *bfi_image_ct2;

#define BFAD_FW_FILE_CB
#define BFAD_FW_FILE_CT
#define BFAD_FW_FILE_CT2

static u32 *bfad_load_fwimg(struct pci_dev *pdev);
static void bfad_free_fwimg(void);
static void bfad_read_firmware(struct pci_dev *pdev, u32 **bfi_image,
		u32 *bfi_image_size, char *fw_name);

static const char *msix_name_ct[] =;

static const char *msix_name_cb[] =;

MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();

module_param(os_name, charp, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();
module_param(os_patch, charp, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();
module_param(host_name, charp, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();
module_param(num_rports, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();
module_param(num_ios, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();
module_param(num_tms, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();
module_param(num_fcxps, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();
module_param(num_ufbufs, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();
module_param(reqq_size, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();
module_param(rspq_size, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();
module_param(num_sgpgs, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();
module_param(rport_del_timeout, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();
module_param(bfa_lun_queue_depth, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();
module_param(bfa_io_max_sge, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();
module_param(bfa_log_level, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();
module_param(ioc_auto_recover, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();
module_param(bfa_linkup_delay, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();
module_param(msix_disable_cb, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();
module_param(msix_disable_ct, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();
module_param(fdmi_enable, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();
module_param(pcie_max_read_reqsz, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();
module_param(bfa_debugfs_enable, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();
module_param(max_xfer_size, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();
module_param(max_rport_logins, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC();

static void
bfad_sm_uninit(struct bfad_s *bfad, enum bfad_sm_event event);
static void
bfad_sm_created(struct bfad_s *bfad, enum bfad_sm_event event);
static void
bfad_sm_initializing(struct bfad_s *bfad, enum bfad_sm_event event);
static void
bfad_sm_operational(struct bfad_s *bfad, enum bfad_sm_event event);
static void
bfad_sm_stopping(struct bfad_s *bfad, enum bfad_sm_event event);
static void
bfad_sm_failed(struct bfad_s *bfad, enum bfad_sm_event event);
static void
bfad_sm_fcs_exit(struct bfad_s *bfad, enum bfad_sm_event event);

/*
 * Beginning state for the driver instance, awaiting the pci_probe event
 */
static void
bfad_sm_uninit(struct bfad_s *bfad, enum bfad_sm_event event)
{}

/*
 * Driver Instance is created, awaiting event INIT to initialize the bfad
 */
static void
bfad_sm_created(struct bfad_s *bfad, enum bfad_sm_event event)
{}

static void
bfad_sm_initializing(struct bfad_s *bfad, enum bfad_sm_event event)
{}

static void
bfad_sm_failed(struct bfad_s *bfad, enum bfad_sm_event event)
{}

static void
bfad_sm_operational(struct bfad_s *bfad, enum bfad_sm_event event)
{}

static void
bfad_sm_fcs_exit(struct bfad_s *bfad, enum bfad_sm_event event)
{}

static void
bfad_sm_stopping(struct bfad_s *bfad, enum bfad_sm_event event)
{}

/*
 *  BFA callbacks
 */
void
bfad_hcb_comp(void *arg, bfa_status_t status)
{}

/*
 * bfa_init callback
 */
void
bfa_cb_init(void *drv, bfa_status_t init_status)
{}

/*
 *  BFA_FCS callbacks
 */
struct bfad_port_s *
bfa_fcb_lport_new(struct bfad_s *bfad, struct bfa_fcs_lport_s *port,
		 enum bfa_lport_role roles, struct bfad_vf_s *vf_drv,
		 struct bfad_vport_s *vp_drv)
{}

/*
 * FCS RPORT alloc callback, after successful PLOGI by FCS
 */
bfa_status_t
bfa_fcb_rport_alloc(struct bfad_s *bfad, struct bfa_fcs_rport_s **rport,
		    struct bfad_rport_s **rport_drv)
{}

/*
 * FCS PBC VPORT Create
 */
void
bfa_fcb_pbc_vport_create(struct bfad_s *bfad, struct bfi_pbc_vport_s pbc_vport)
{}

void
bfad_hal_mem_release(struct bfad_s *bfad)
{}

void
bfad_update_hal_cfg(struct bfa_iocfc_cfg_s *bfa_cfg)
{}

bfa_status_t
bfad_hal_mem_alloc(struct bfad_s *bfad)
{}

/*
 * Create a vport under a vf.
 */
bfa_status_t
bfad_vport_create(struct bfad_s *bfad, u16 vf_id,
		  struct bfa_lport_cfg_s *port_cfg, struct device *dev)
{}

void
bfad_bfa_tmo(struct timer_list *t)
{}

void
bfad_init_timer(struct bfad_s *bfad)
{}

int
bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad)
{}

void
bfad_pci_uninit(struct pci_dev *pdev, struct bfad_s *bfad)
{}

bfa_status_t
bfad_drv_init(struct bfad_s *bfad)
{}

void
bfad_drv_uninit(struct bfad_s *bfad)
{}

void
bfad_drv_start(struct bfad_s *bfad)
{}

void
bfad_fcs_stop(struct bfad_s *bfad)
{}

void
bfad_stop(struct bfad_s *bfad)
{}

bfa_status_t
bfad_cfg_pport(struct bfad_s *bfad, enum bfa_lport_role role)
{}

void
bfad_uncfg_pport(struct bfad_s *bfad)
{}

bfa_status_t
bfad_start_ops(struct bfad_s *bfad) {}

int
bfad_worker(void *ptr)
{}

/*
 *  BFA driver interrupt functions
 */
irqreturn_t
bfad_intx(int irq, void *dev_id)
{}

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

/*
 * Initialize the MSIX entry table.
 */
static void
bfad_init_msix_entry(struct bfad_s *bfad, struct msix_entry *msix_entries,
			 int mask, int max_bit)
{}

int
bfad_install_msix_handler(struct bfad_s *bfad)
{}

/*
 * Setup MSIX based interrupt.
 */
int
bfad_setup_intr(struct bfad_s *bfad)
{}

void
bfad_remove_intr(struct bfad_s *bfad)
{}

/*
 * PCI probe entry.
 */
int
bfad_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid)
{}

/*
 * PCI remove entry.
 */
void
bfad_pci_remove(struct pci_dev *pdev)
{}

/*
 * PCI Error Recovery entry, error detected.
 */
static pci_ers_result_t
bfad_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
{}

static int restart_bfa(struct bfad_s *bfad)
{}

/*
 * PCI Error Recovery entry, re-initialize the chip.
 */
static pci_ers_result_t
bfad_pci_slot_reset(struct pci_dev *pdev)
{}

static pci_ers_result_t
bfad_pci_mmio_enabled(struct pci_dev *pdev)
{}

static void
bfad_pci_resume(struct pci_dev *pdev)
{}

struct pci_device_id bfad_id_table[] =;

MODULE_DEVICE_TABLE(pci, bfad_id_table);

/*
 * PCI error recovery handlers.
 */
static struct pci_error_handlers bfad_err_handler =;

static struct pci_driver bfad_pci_driver =;

/*
 * Driver module init.
 */
static int __init
bfad_init(void)
{}

/*
 * Driver module exit.
 */
static void __exit
bfad_exit(void)
{}

/* Firmware handling */
static void
bfad_read_firmware(struct pci_dev *pdev, u32 **bfi_image,
		u32 *bfi_image_size, char *fw_name)
{}

static u32 *
bfad_load_fwimg(struct pci_dev *pdev)
{}

static void
bfad_free_fwimg(void)
{}

module_init();
module_exit(bfad_exit);
MODULE_LICENSE();
MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_VERSION();