linux/drivers/scsi/qla2xxx/qla_nx.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * QLogic Fibre Channel HBA Driver
 * Copyright (c)  2003-2014 QLogic Corporation
 */
#include "qla_def.h"
#include <linux/delay.h>
#include <linux/io-64-nonatomic-lo-hi.h>
#include <linux/pci.h>
#include <linux/ratelimit.h>
#include <linux/vmalloc.h>
#include <scsi/scsi_tcq.h>

#define MASK(n)
#define MN_WIN(addr)
#define OCM_WIN(addr)
#define MS_WIN(addr)
#define QLA82XX_PCI_MN_2M
#define QLA82XX_PCI_MS_2M
#define QLA82XX_PCI_OCM0_2M
#define VALID_OCM_ADDR(addr)
#define GET_MEM_OFFS_2M(addr)
#define BLOCK_PROTECT_BITS

/* CRB window related */
#define CRB_BLK(off)
#define CRB_SUBBLK(off)
#define CRB_WINDOW_2M
#define QLA82XX_PCI_CAMQM_2M_END
#define CRB_HI(off)
#define QLA82XX_PCI_CAMQM_2M_BASE
#define CRB_INDIRECT_2M

#define MAX_CRB_XFORM
static unsigned long crb_addr_xform[MAX_CRB_XFORM];
static int qla82xx_crb_table_initialized;

#define qla82xx_crb_addr_transform(name)

const int MD_MIU_TEST_AGT_RDDATA[] =;

static void qla82xx_crb_addr_transform_setup(void)
{}

static struct crb_128M_2M_block_map crb_128M_2M_map[64] =;

/*
 * top 12 bits of crb internal address (hub, agent)
 */
static unsigned qla82xx_crb_hub_agt[64] =;

/* Device states */
static const char *const q_dev_state[] =;

const char *qdev_state(uint32_t dev_state)
{}

/*
 * In: 'off_in' is offset from CRB space in 128M pci map
 * Out: 'off_out' is 2M pci map addr
 * side effect: lock crb window
 */
static void
qla82xx_pci_set_crbwindow_2M(struct qla_hw_data *ha, ulong off_in,
			     void __iomem **off_out)
{}

static int
qla82xx_pci_get_crb_addr_2M(struct qla_hw_data *ha, ulong off_in,
			    void __iomem **off_out)
{}

#define CRB_WIN_LOCK_TIMEOUT
static int qla82xx_crb_win_lock(struct qla_hw_data *ha)
{}

int
qla82xx_wr_32(struct qla_hw_data *ha, ulong off_in, u32 data)
{}

int
qla82xx_rd_32(struct qla_hw_data *ha, ulong off_in)
{}

/*
 * Context: task, might sleep
 */
int qla82xx_idc_lock(struct qla_hw_data *ha)
{}

void qla82xx_idc_unlock(struct qla_hw_data *ha)
{}

/*
 * check memory access boundary.
 * used by test agent. support ddr access only for now
 */
static unsigned long
qla82xx_pci_mem_bound_check(struct qla_hw_data *ha,
	unsigned long long addr, int size)
{}

static int qla82xx_pci_set_window_warning_count;

static unsigned long
qla82xx_pci_set_window(struct qla_hw_data *ha, unsigned long long addr)
{}

/* check if address is in the same windows as the previous access */
static int qla82xx_pci_is_same_window(struct qla_hw_data *ha,
	unsigned long long addr)
{}

static int qla82xx_pci_mem_read_direct(struct qla_hw_data *ha,
	u64 off, void *data, int size)
{}

static int
qla82xx_pci_mem_write_direct(struct qla_hw_data *ha,
	u64 off, void *data, int size)
{}

#define MTU_FUDGE_FACTOR
static unsigned long
qla82xx_decode_crb_addr(unsigned long addr)
{}

static long rom_max_timeout =;
static long qla82xx_rom_lock_timeout =;

static int
qla82xx_rom_lock(struct qla_hw_data *ha)
{}

static void
qla82xx_rom_unlock(struct qla_hw_data *ha)
{}

static int
qla82xx_wait_rom_busy(struct qla_hw_data *ha)
{}

static int
qla82xx_wait_rom_done(struct qla_hw_data *ha)
{}

static int
qla82xx_md_rw_32(struct qla_hw_data *ha, uint32_t off, u32 data, uint8_t flag)
{}

static int
qla82xx_do_rom_fast_read(struct qla_hw_data *ha, int addr, int *valp)
{}

static int
qla82xx_rom_fast_read(struct qla_hw_data *ha, int addr, int *valp)
{}

static int
qla82xx_read_status_reg(struct qla_hw_data *ha, uint32_t *val)
{}

static int
qla82xx_flash_wait_write_finish(struct qla_hw_data *ha)
{}

static int
qla82xx_flash_set_write_enable(struct qla_hw_data *ha)
{}

static int
qla82xx_write_status_reg(struct qla_hw_data *ha, uint32_t val)
{}

static int
qla82xx_write_disable_flash(struct qla_hw_data *ha)
{}

static int
ql82xx_rom_lock_d(struct qla_hw_data *ha)
{}

static int
qla82xx_write_flash_dword(struct qla_hw_data *ha, uint32_t flashaddr,
	uint32_t data)
{}

/* This routine does CRB initialize sequence
 *  to put the ISP into operational state
 */
static int
qla82xx_pinit_from_rom(scsi_qla_host_t *vha)
{}

static int
qla82xx_pci_mem_write_2M(struct qla_hw_data *ha,
		u64 off, void *data, int size)
{}

static int
qla82xx_fw_load_from_flash(struct qla_hw_data *ha)
{}

int
qla82xx_pci_mem_read_2M(struct qla_hw_data *ha,
		u64 off, void *data, int size)
{}


static struct qla82xx_uri_table_desc *
qla82xx_get_table_desc(const u8 *unirom, int section)
{}

static struct qla82xx_uri_data_desc *
qla82xx_get_data_desc(struct qla_hw_data *ha,
	u32 section, u32 idx_offset)
{}

static u8 *
qla82xx_get_bootld_offset(struct qla_hw_data *ha)
{}

static u32 qla82xx_get_fw_size(struct qla_hw_data *ha)
{}

static u8 *
qla82xx_get_fw_offs(struct qla_hw_data *ha)
{}

/* PCI related functions */
int qla82xx_pci_region_offset(struct pci_dev *pdev, int region)
{}


int
qla82xx_iospace_config(struct qla_hw_data *ha)
{}

/* GS related functions */

/* Initialization related functions */

/**
 * qla82xx_pci_config() - Setup ISP82xx PCI configuration registers.
 * @vha: HA context
 *
 * Returns 0 on success.
*/
int
qla82xx_pci_config(scsi_qla_host_t *vha)
{}

/**
 * qla82xx_reset_chip() - Setup ISP82xx PCI configuration registers.
 * @vha: HA context
 *
 * Returns 0 on success.
 */
int
qla82xx_reset_chip(scsi_qla_host_t *vha)
{}

void qla82xx_config_rings(struct scsi_qla_host *vha)
{}

static int
qla82xx_fw_load_from_blob(struct qla_hw_data *ha)
{}

static int
qla82xx_set_product_offset(struct qla_hw_data *ha)
{}

static int
qla82xx_validate_firmware_blob(scsi_qla_host_t *vha, uint8_t fw_type)
{}

static int
qla82xx_check_cmdpeg_state(struct qla_hw_data *ha)
{}

static int
qla82xx_check_rcvpeg_state(struct qla_hw_data *ha)
{}

/* ISR related functions */
static struct qla82xx_legacy_intr_set legacy_intr[] =;

/*
 * qla82xx_mbx_completion() - Process mailbox command completions.
 * @ha: SCSI driver HA context
 * @mb0: Mailbox0 register
 */
void
qla82xx_mbx_completion(scsi_qla_host_t *vha, uint16_t mb0)
{}

/**
 * qla82xx_intr_handler() - Process interrupts for the ISP23xx and ISP63xx.
 * @irq: interrupt number
 * @dev_id: SCSI driver HA context
 *
 * Called by system whenever the host adapter generates an interrupt.
 *
 * Returns handled flag.
 */
irqreturn_t
qla82xx_intr_handler(int irq, void *dev_id)
{}

irqreturn_t
qla82xx_msix_default(int irq, void *dev_id)
{}

irqreturn_t
qla82xx_msix_rsp_q(int irq, void *dev_id)
{}

void
qla82xx_poll(int irq, void *dev_id)
{}

void
qla82xx_enable_intrs(struct qla_hw_data *ha)
{}

void
qla82xx_disable_intrs(struct qla_hw_data *ha)
{}

void qla82xx_init_flags(struct qla_hw_data *ha)
{}

static inline void
qla82xx_set_idc_version(scsi_qla_host_t *vha)
{}

inline void
qla82xx_set_drv_active(scsi_qla_host_t *vha)
{}

inline void
qla82xx_clear_drv_active(struct qla_hw_data *ha)
{}

static inline int
qla82xx_need_reset(struct qla_hw_data *ha)
{}

static inline void
qla82xx_set_rst_ready(struct qla_hw_data *ha)
{}

static inline void
qla82xx_clear_rst_ready(struct qla_hw_data *ha)
{}

static inline void
qla82xx_set_qsnt_ready(struct qla_hw_data *ha)
{}

void
qla82xx_clear_qsnt_ready(scsi_qla_host_t *vha)
{}

static int
qla82xx_load_fw(scsi_qla_host_t *vha)
{}

int
qla82xx_start_firmware(scsi_qla_host_t *vha)
{}

static __le32 *
qla82xx_read_flash_data(scsi_qla_host_t *vha, __le32 *dwptr, uint32_t faddr,
	uint32_t length)
{}

static int
qla82xx_unprotect_flash(struct qla_hw_data *ha)
{}

static int
qla82xx_protect_flash(struct qla_hw_data *ha)
{}

static int
qla82xx_erase_sector(struct qla_hw_data *ha, int addr)
{}

/*
 * Address and length are byte address
 */
void *
qla82xx_read_optrom_data(struct scsi_qla_host *vha, void *buf,
	uint32_t offset, uint32_t length)
{}

static int
qla82xx_write_flash_data(struct scsi_qla_host *vha, __le32 *dwptr,
	uint32_t faddr, uint32_t dwords)
{}

int
qla82xx_write_optrom_data(struct scsi_qla_host *vha, void *buf,
	uint32_t offset, uint32_t length)
{}

void
qla82xx_start_iocbs(scsi_qla_host_t *vha)
{}

static void
qla82xx_rom_lock_recovery(struct qla_hw_data *ha)
{}

/*
 * qla82xx_device_bootstrap
 *    Initialize device, set DEV_READY, start fw
 *
 * Note:
 *      IDC lock must be held upon entry
 *
 * Return:
 *    Success : 0
 *    Failed  : 1
 */
static int
qla82xx_device_bootstrap(scsi_qla_host_t *vha)
{}

/*
* qla82xx_need_qsnt_handler
*    Code to start quiescence sequence
*
* Note:
*      IDC lock must be held upon entry
*
* Return: void
*/

static void
qla82xx_need_qsnt_handler(scsi_qla_host_t *vha)
{}

/*
* qla82xx_wait_for_state_change
*    Wait for device state to change from given current state
*
* Note:
*     IDC lock must not be held upon entry
*
* Return:
*    Changed device state.
*/
uint32_t
qla82xx_wait_for_state_change(scsi_qla_host_t *vha, uint32_t curr_state)
{}

void
qla8xxx_dev_failed_handler(scsi_qla_host_t *vha)
{}

/*
 * qla82xx_need_reset_handler
 *    Code to start reset sequence
 *
 * Note:
 *      IDC lock must be held upon entry
 *
 * Return:
 *    Success : 0
 *    Failed  : 1
 */
static void
qla82xx_need_reset_handler(scsi_qla_host_t *vha)
{}

int
qla82xx_check_md_needed(scsi_qla_host_t *vha)
{}


static int
qla82xx_check_fw_alive(scsi_qla_host_t *vha)
{}

/*
 * qla82xx_device_state_handler
 *	Main state handler
 *
 * Note:
 *      IDC lock must be held upon entry
 *
 * Return:
 *    Success : 0
 *    Failed  : 1
 */
int
qla82xx_device_state_handler(scsi_qla_host_t *vha)
{}

static int qla82xx_check_temp(scsi_qla_host_t *vha)
{}

int qla82xx_read_temperature(scsi_qla_host_t *vha)
{}

void qla82xx_clear_pending_mbx(scsi_qla_host_t *vha)
{}

void qla82xx_watchdog(scsi_qla_host_t *vha)
{}

int qla82xx_load_risc(scsi_qla_host_t *vha, uint32_t *srisc_addr)
{}

void
qla82xx_set_reset_owner(scsi_qla_host_t *vha)
{}

/*
 *  qla82xx_abort_isp
 *      Resets ISP and aborts all outstanding commands.
 *
 * Input:
 *      ha           = adapter block pointer.
 *
 * Returns:
 *      0 = success
 */
int
qla82xx_abort_isp(scsi_qla_host_t *vha)
{}

/*
 *  qla82xx_fcoe_ctx_reset
 *      Perform a quick reset and aborts all outstanding commands.
 *      This will only perform an FCoE context reset and avoids a full blown
 *      chip reset.
 *
 * Input:
 *      ha = adapter block pointer.
 *      is_reset_path = flag for identifying the reset path.
 *
 * Returns:
 *      0 = success
 */
int qla82xx_fcoe_ctx_reset(scsi_qla_host_t *vha)
{}

/*
 * qla2x00_wait_for_fcoe_ctx_reset
 *    Wait till the FCoE context is reset.
 *
 * Note:
 *    Does context switching here.
 *    Release SPIN_LOCK (if any) before calling this routine.
 *
 * Return:
 *    Success (fcoe_ctx reset is done) : 0
 *    Failed  (fcoe_ctx reset not completed within max loop timout ) : 1
 */
int qla2x00_wait_for_fcoe_ctx_reset(scsi_qla_host_t *vha)
{}

void
qla82xx_chip_reset_cleanup(scsi_qla_host_t *vha)
{}

/* Minidump related functions */
static int
qla82xx_minidump_process_control(scsi_qla_host_t *vha,
	qla82xx_md_entry_hdr_t *entry_hdr, __le32 **d_ptr)
{}

static void
qla82xx_minidump_process_rdocm(scsi_qla_host_t *vha,
	qla82xx_md_entry_hdr_t *entry_hdr, __le32 **d_ptr)
{}

static void
qla82xx_minidump_process_rdmux(scsi_qla_host_t *vha,
	qla82xx_md_entry_hdr_t *entry_hdr, __le32 **d_ptr)
{}

static void
qla82xx_minidump_process_rdcrb(scsi_qla_host_t *vha,
	qla82xx_md_entry_hdr_t *entry_hdr, __le32 **d_ptr)
{}

static int
qla82xx_minidump_process_l2tag(scsi_qla_host_t *vha,
	qla82xx_md_entry_hdr_t *entry_hdr, __le32 **d_ptr)
{}

static void
qla82xx_minidump_process_l1cache(scsi_qla_host_t *vha,
	qla82xx_md_entry_hdr_t *entry_hdr, __le32 **d_ptr)
{}

static void
qla82xx_minidump_process_queue(scsi_qla_host_t *vha,
	qla82xx_md_entry_hdr_t *entry_hdr, __le32 **d_ptr)
{}

static void
qla82xx_minidump_process_rdrom(scsi_qla_host_t *vha,
	qla82xx_md_entry_hdr_t *entry_hdr, __le32 **d_ptr)
{}

static int
qla82xx_minidump_process_rdmem(scsi_qla_host_t *vha,
	qla82xx_md_entry_hdr_t *entry_hdr, __le32 **d_ptr)
{}

int
qla82xx_validate_template_chksum(scsi_qla_host_t *vha)
{}

static void
qla82xx_mark_entry_skipped(scsi_qla_host_t *vha,
	qla82xx_md_entry_hdr_t *entry_hdr, int index)
{}

int
qla82xx_md_collect(scsi_qla_host_t *vha)
{}

int
qla82xx_md_alloc(scsi_qla_host_t *vha)
{}

void
qla82xx_md_free(scsi_qla_host_t *vha)
{}

void
qla82xx_md_prep(scsi_qla_host_t *vha)
{}

int
qla82xx_beacon_on(struct scsi_qla_host *vha)
{}

int
qla82xx_beacon_off(struct scsi_qla_host *vha)
{}

void
qla82xx_fw_dump(scsi_qla_host_t *vha)
{}