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

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

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

/* Reset template definitions */
#define QLC_83XX_RESTART_TEMPLATE_SIZE
#define QLC_83XX_RESET_TEMPLATE_ADDR
#define QLC_83XX_RESET_SEQ_VERSION

#define QLC_83XX_OPCODE_NOP
#define QLC_83XX_OPCODE_WRITE_LIST
#define QLC_83XX_OPCODE_READ_WRITE_LIST
#define QLC_83XX_OPCODE_POLL_LIST
#define QLC_83XX_OPCODE_POLL_WRITE_LIST
#define QLC_83XX_OPCODE_READ_MODIFY_WRITE
#define QLC_83XX_OPCODE_SEQ_PAUSE
#define QLC_83XX_OPCODE_SEQ_END
#define QLC_83XX_OPCODE_TMPL_END
#define QLC_83XX_OPCODE_POLL_READ_LIST

/* EPORT control registers */
#define QLC_83XX_RESET_CONTROL
#define QLC_83XX_RESET_REG
#define QLC_83XX_RESET_PORT0
#define QLC_83XX_RESET_PORT1
#define QLC_83XX_RESET_PORT2
#define QLC_83XX_RESET_PORT3
#define QLC_83XX_RESET_SRESHIM
#define QLC_83XX_RESET_EPGSHIM
#define QLC_83XX_RESET_ETHERPCS

static int qlcnic_83xx_init_default_driver(struct qlcnic_adapter *adapter);
static int qlcnic_83xx_check_heartbeat(struct qlcnic_adapter *p_dev);
static int qlcnic_83xx_restart_hw(struct qlcnic_adapter *adapter);
static int qlcnic_83xx_check_hw_status(struct qlcnic_adapter *p_dev);
static int qlcnic_83xx_get_reset_instruction_template(struct qlcnic_adapter *);
static void qlcnic_83xx_stop_hw(struct qlcnic_adapter *);

/* Template header */
struct qlc_83xx_reset_hdr {} __packed;

/* Command entry header. */
struct qlc_83xx_entry_hdr {} __packed;

/* Generic poll command */
struct qlc_83xx_poll {} __packed;

/* Read modify write command */
struct qlc_83xx_rmw {} __packed;

/* Generic command with 2 DWORD */
struct qlc_83xx_entry {} __packed;

/* Generic command with 4 DWORD */
struct qlc_83xx_quad_entry {} __packed;
static const char *const qlc_83xx_idc_states[] =;

static int
qlcnic_83xx_idc_check_driver_presence_reg(struct qlcnic_adapter *adapter)
{}

static void qlcnic_83xx_idc_log_state_history(struct qlcnic_adapter *adapter)
{}

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

static void qlcnic_83xx_idc_update_minor_version(struct qlcnic_adapter *adapter)
{}

static int qlcnic_83xx_idc_update_major_version(struct qlcnic_adapter *adapter,
						int lock)
{}

static int
qlcnic_83xx_idc_update_drv_presence_reg(struct qlcnic_adapter *adapter,
					int status, int lock)
{}

static int qlcnic_83xx_idc_check_major_version(struct qlcnic_adapter *adapter)
{}

static int qlcnic_83xx_idc_clear_registers(struct qlcnic_adapter *adapter,
					   int lock)
{}

static int qlcnic_83xx_idc_update_drv_ack_reg(struct qlcnic_adapter *adapter,
					      int flag, int lock)
{}

static int qlcnic_83xx_idc_check_timeout(struct qlcnic_adapter *adapter,
					 int time_limit)
{}

/**
 * qlcnic_83xx_idc_check_reset_ack_reg
 *
 * @adapter: adapter structure
 *
 * Check ACK wait limit and clear the functions which failed to ACK
 *
 * Return 0 if all functions have acknowledged the reset request.
 **/
static int qlcnic_83xx_idc_check_reset_ack_reg(struct qlcnic_adapter *adapter)
{}

/**
 * qlcnic_83xx_idc_tx_soft_reset
 *
 * @adapter: adapter structure
 *
 * Handle context deletion and recreation request from transmit routine
 *
 * Returns -EBUSY  or Success (0)
 *
 **/
static int qlcnic_83xx_idc_tx_soft_reset(struct qlcnic_adapter *adapter)
{}

/**
 * qlcnic_83xx_idc_detach_driver
 *
 * @adapter: adapter structure
 * Detach net interface, stop TX and cleanup resources before the HW reset.
 * Returns: None
 *
 **/
static void qlcnic_83xx_idc_detach_driver(struct qlcnic_adapter *adapter)
{}

/**
 * qlcnic_83xx_idc_attach_driver
 *
 * @adapter: adapter structure
 *
 * Re-attach and re-enable net interface
 * Returns: None
 *
 **/
static void qlcnic_83xx_idc_attach_driver(struct qlcnic_adapter *adapter)
{}

static int qlcnic_83xx_idc_enter_failed_state(struct qlcnic_adapter *adapter,
					      int lock)
{}

static int qlcnic_83xx_idc_enter_init_state(struct qlcnic_adapter *adapter,
					    int lock)
{}

static int qlcnic_83xx_idc_enter_need_quiesce(struct qlcnic_adapter *adapter,
					      int lock)
{}

static int
qlcnic_83xx_idc_enter_need_reset_state(struct qlcnic_adapter *adapter, int lock)
{}

static int qlcnic_83xx_idc_enter_ready_state(struct qlcnic_adapter *adapter,
					     int lock)
{}

/**
 * qlcnic_83xx_idc_find_reset_owner_id
 *
 * @adapter: adapter structure
 *
 * NIC gets precedence over ISCSI and ISCSI has precedence over FCOE.
 * Within the same class, function with lowest PCI ID assumes ownership
 *
 * Returns: reset owner id or failure indication (-EIO)
 *
 **/
static int qlcnic_83xx_idc_find_reset_owner_id(struct qlcnic_adapter *adapter)
{}

static int qlcnic_83xx_idc_restart_hw(struct qlcnic_adapter *adapter, int lock)
{}

static int qlcnic_83xx_idc_check_fan_failure(struct qlcnic_adapter *adapter)
{}

int qlcnic_83xx_idc_reattach_driver(struct qlcnic_adapter *adapter)
{}

static void qlcnic_83xx_idc_update_idc_params(struct qlcnic_adapter *adapter)
{}

/**
 * qlcnic_83xx_idc_ready_state_entry
 *
 * @adapter: adapter structure
 *
 * Perform ready state initialization, this routine will get invoked only
 * once from READY state.
 *
 * Returns: Error code or Success(0)
 *
 **/
int qlcnic_83xx_idc_ready_state_entry(struct qlcnic_adapter *adapter)
{}

/**
 * qlcnic_83xx_idc_vnic_pf_entry
 *
 * @adapter: adapter structure
 *
 * Ensure vNIC mode privileged function starts only after vNIC mode is
 * enabled by management function.
 * If vNIC mode is ready, start initialization.
 *
 * Returns: -EIO or 0
 *
 **/
int qlcnic_83xx_idc_vnic_pf_entry(struct qlcnic_adapter *adapter)
{}

static int qlcnic_83xx_idc_unknown_state(struct qlcnic_adapter *adapter)
{}

/**
 * qlcnic_83xx_idc_cold_state_handler
 *
 * @adapter: adapter structure
 *
 * If HW is up and running device will enter READY state.
 * If firmware image from host needs to be loaded, device is
 * forced to start with the file firmware image.
 *
 * Returns: Error code or Success(0)
 *
 **/
static int qlcnic_83xx_idc_cold_state_handler(struct qlcnic_adapter *adapter)
{}

/**
 * qlcnic_83xx_idc_init_state
 *
 * @adapter: adapter structure
 *
 * Reset owner will restart the device from this state.
 * Device will enter failed state if it remains
 * in this state for more than DEV_INIT time limit.
 *
 * Returns: Error code or Success(0)
 *
 **/
static int qlcnic_83xx_idc_init_state(struct qlcnic_adapter *adapter)
{}

/**
 * qlcnic_83xx_idc_ready_state
 *
 * @adapter: adapter structure
 *
 * Perform IDC protocol specicifed actions after monitoring device state and
 * events.
 *
 * Returns: Error code or Success(0)
 *
 **/
static int qlcnic_83xx_idc_ready_state(struct qlcnic_adapter *adapter)
{}

/**
 * qlcnic_83xx_idc_need_reset_state
 *
 * @adapter: adapter structure
 *
 * Device will remain in this state until:
 *	Reset request ACK's are received from all the functions
 *	Wait time exceeds max time limit
 *
 * Returns: Error code or Success(0)
 *
 **/
static int qlcnic_83xx_idc_need_reset_state(struct qlcnic_adapter *adapter)
{}

static int qlcnic_83xx_idc_need_quiesce_state(struct qlcnic_adapter *adapter)
{}

static void qlcnic_83xx_idc_failed_state(struct qlcnic_adapter *adapter)
{}

static int qlcnic_83xx_idc_quiesce_state(struct qlcnic_adapter *adapter)
{}

static int qlcnic_83xx_idc_check_state_validity(struct qlcnic_adapter *adapter,
						u32 state)
{}

#define QLC_83XX_ENCAP_TYPE_VXLAN
#define QLC_83XX_MATCH_ENCAP_ID
#define QLC_83XX_SET_VXLAN_UDP_DPORT
#define QLC_83XX_VXLAN_UDP_DPORT(PORT)

#define QLCNIC_ENABLE_INGRESS_ENCAP_PARSING
#define QLCNIC_DISABLE_INGRESS_ENCAP_PARSING

int qlcnic_set_vxlan_port(struct qlcnic_adapter *adapter, u16 port)
{}

int qlcnic_set_vxlan_parsing(struct qlcnic_adapter *adapter, u16 port)
{}

static void qlcnic_83xx_periodic_tasks(struct qlcnic_adapter *adapter)
{}

/**
 * qlcnic_83xx_idc_poll_dev_state
 *
 * @work: kernel work queue structure used to schedule the function
 *
 * Poll device state periodically and perform state specific
 * actions defined by Inter Driver Communication (IDC) protocol.
 *
 * Returns: None
 *
 **/
void qlcnic_83xx_idc_poll_dev_state(struct work_struct *work)
{}

static void qlcnic_83xx_setup_idc_parameters(struct qlcnic_adapter *adapter)
{}

static int
qlcnic_83xx_idc_first_to_load_function_handler(struct qlcnic_adapter *adapter)
{}

int qlcnic_83xx_idc_init(struct qlcnic_adapter *adapter)
{}

void qlcnic_83xx_idc_exit(struct qlcnic_adapter *adapter)
{}

void qlcnic_83xx_idc_request_reset(struct qlcnic_adapter *adapter, u32 key)
{}

static int qlcnic_83xx_copy_bootloader(struct qlcnic_adapter *adapter)
{}

static int qlcnic_83xx_copy_fw_file(struct qlcnic_adapter *adapter)
{}

static void qlcnic_83xx_dump_pause_control_regs(struct qlcnic_adapter *adapter)
{}


static void qlcnic_83xx_disable_pause_frames(struct qlcnic_adapter *adapter)
{}

static void qlcnic_83xx_take_eport_out_of_reset(struct qlcnic_adapter *adapter)
{}

static int qlcnic_83xx_check_heartbeat(struct qlcnic_adapter *p_dev)
{}

static int qlcnic_83xx_check_cmd_peg_status(struct qlcnic_adapter *p_dev)
{}

static int qlcnic_83xx_check_hw_status(struct qlcnic_adapter *p_dev)
{}

static int qlcnic_83xx_poll_reg(struct qlcnic_adapter *p_dev, u32 addr,
				int duration, u32 mask, u32 status)
{}

static int qlcnic_83xx_reset_template_checksum(struct qlcnic_adapter *p_dev)
{}

static int qlcnic_83xx_get_reset_instruction_template(struct qlcnic_adapter *p_dev)
{}

/* Read Write HW register command */
static void qlcnic_83xx_read_write_crb_reg(struct qlcnic_adapter *p_dev,
					   u32 raddr, u32 waddr)
{}

/* Read Modify Write HW register command */
static void qlcnic_83xx_rmw_crb_reg(struct qlcnic_adapter *p_dev,
				    u32 raddr, u32 waddr,
				    struct qlc_83xx_rmw *p_rmw_hdr)
{}

/* Write HW register command */
static void qlcnic_83xx_write_list(struct qlcnic_adapter *p_dev,
				   struct qlc_83xx_entry_hdr *p_hdr)
{}

/* Read and Write instruction */
static void qlcnic_83xx_read_write_list(struct qlcnic_adapter *p_dev,
					struct qlc_83xx_entry_hdr *p_hdr)
{}

/* Poll HW register command */
static void qlcnic_83xx_poll_list(struct qlcnic_adapter *p_dev,
				  struct qlc_83xx_entry_hdr *p_hdr)
{}

/* Poll and write HW register command */
static void qlcnic_83xx_poll_write_list(struct qlcnic_adapter *p_dev,
					struct qlc_83xx_entry_hdr *p_hdr)
{}

/* Read Modify Write register command */
static void qlcnic_83xx_read_modify_write(struct qlcnic_adapter *p_dev,
					  struct qlc_83xx_entry_hdr *p_hdr)
{}

static void qlcnic_83xx_pause(struct qlc_83xx_entry_hdr *p_hdr)
{}

/* Read and poll register command */
static void qlcnic_83xx_poll_read_list(struct qlcnic_adapter *p_dev,
				       struct qlc_83xx_entry_hdr *p_hdr)
{}

static inline void qlcnic_83xx_seq_end(struct qlcnic_adapter *p_dev)
{}

static void qlcnic_83xx_template_end(struct qlcnic_adapter *p_dev)
{}

/**
* qlcnic_83xx_exec_template_cmd
*
* @p_dev: adapter structure
* @p_buff: Poiter to instruction template
*
* Template provides instructions to stop, restart and initalize firmware.
* These instructions are abstracted as a series of read, write and
* poll operations on hardware registers. Register information and operation
* specifics are not exposed to the driver. Driver reads the template from
* flash and executes the instructions located at pre-defined offsets.
*
* Returns: None
* */
static void qlcnic_83xx_exec_template_cmd(struct qlcnic_adapter *p_dev,
					  char *p_buff)
{}

static void qlcnic_83xx_stop_hw(struct qlcnic_adapter *p_dev)
{}

static void qlcnic_83xx_start_hw(struct qlcnic_adapter *p_dev)
{}

static void qlcnic_83xx_init_hw(struct qlcnic_adapter *p_dev)
{}

/* POST FW related definations*/
#define QLC_83XX_POST_SIGNATURE_REG
#define QLC_83XX_POST_MODE_REG
#define QLC_83XX_POST_FAST_MODE
#define QLC_83XX_POST_MEDIUM_MODE
#define QLC_83XX_POST_SLOW_MODE

/* POST Timeout values in milliseconds */
#define QLC_83XX_POST_FAST_MODE_TIMEOUT
#define QLC_83XX_POST_MED_MODE_TIMEOUT
#define QLC_83XX_POST_SLOW_MODE_TIMEOUT

/* POST result values */
#define QLC_83XX_POST_PASS
#define QLC_83XX_POST_ASIC_STRESS_TEST_FAIL
#define QLC_83XX_POST_DDR_TEST_FAIL
#define QLC_83XX_POST_ASIC_MEMORY_TEST_FAIL
#define QLC_83XX_POST_FLASH_TEST_FAIL

static int qlcnic_83xx_run_post(struct qlcnic_adapter *adapter)
{}

static int qlcnic_83xx_load_fw_image_from_host(struct qlcnic_adapter *adapter)
{}

static int qlcnic_83xx_restart_hw(struct qlcnic_adapter *adapter)
{}

static int qlcnic_83xx_get_nic_configuration(struct qlcnic_adapter *adapter)
{}

int qlcnic_83xx_configure_opmode(struct qlcnic_adapter *adapter)
{}

static void qlcnic_83xx_config_buff_descriptors(struct qlcnic_adapter *adapter)
{}

static int qlcnic_83xx_init_default_driver(struct qlcnic_adapter *adapter)
{}

#define IS_QLC_83XX_USED(a, b, c)
static void qlcnic_83xx_clear_function_resources(struct qlcnic_adapter *adapter)
{}

static int qlcnic_83xx_get_fw_info(struct qlcnic_adapter *adapter)
{}

static void qlcnic_83xx_init_rings(struct qlcnic_adapter *adapter)
{}

int qlcnic_83xx_init(struct qlcnic_adapter *adapter)
{}

void qlcnic_83xx_aer_stop_poll_work(struct qlcnic_adapter *adapter)
{}

int qlcnic_83xx_aer_reset(struct qlcnic_adapter *adapter)
{}

void qlcnic_83xx_aer_start_poll_work(struct qlcnic_adapter *adapter)
{}