linux/drivers/scsi/sym53c8xx_2/sym_glue.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Device driver for the SYMBIOS/LSILOGIC 53C8XX and 53C1010 family 
 * of PCI-SCSI IO processors.
 *
 * Copyright (C) 1999-2001  Gerard Roudier <[email protected]>
 * Copyright (c) 2003-2005  Matthew Wilcox <[email protected]>
 *
 * This driver is derived from the Linux sym53c8xx driver.
 * Copyright (C) 1998-2000  Gerard Roudier
 *
 * The sym53c8xx driver is derived from the ncr53c8xx driver that had been 
 * a port of the FreeBSD ncr driver to Linux-1.2.13.
 *
 * The original ncr driver has been written for 386bsd and FreeBSD by
 *         Wolfgang Stanglmeier        <[email protected]>
 *         Stefan Esser                <[email protected]>
 * Copyright (C) 1994  Wolfgang Stanglmeier
 *
 * Other major contributions:
 *
 * NVRAM detection and reading.
 * Copyright (C) 1997 Richard Waltham <[email protected]>
 *
 *-----------------------------------------------------------------------------
 */
#include <linux/ctype.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/spinlock.h>
#include <scsi/scsi.h>
#include <scsi/scsi_tcq.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_transport.h>

#include "sym_glue.h"
#include "sym_nvram.h"

#define NAME53C
#define NAME53C8XX

struct sym_driver_setup sym_driver_setup =;
unsigned int sym_debug_flags =;

static char *excl_string;
static char *safe_string;
module_param_named(cmd_per_lun, sym_driver_setup.max_tag, ushort, 0);
module_param_named(burst, sym_driver_setup.burst_order, byte, 0);
module_param_named(led, sym_driver_setup.scsi_led, byte, 0);
module_param_named(diff, sym_driver_setup.scsi_diff, byte, 0);
module_param_named(irqm, sym_driver_setup.irq_mode, byte, 0);
module_param_named(buschk, sym_driver_setup.scsi_bus_check, byte, 0);
module_param_named(hostid, sym_driver_setup.host_id, byte, 0);
module_param_named(verb, sym_driver_setup.verbose, byte, 0);
module_param_named(debug, sym_debug_flags, uint, 0);
module_param_named(settle, sym_driver_setup.settle_delay, byte, 0);
module_param_named(nvram, sym_driver_setup.use_nvram, byte, 0);
module_param_named(excl, excl_string, charp, 0);
module_param_named(safe, safe_string, charp, 0);

MODULE_PARM_DESC();
MODULE_PARM_DESC();
MODULE_PARM_DESC();
MODULE_PARM_DESC();
MODULE_PARM_DESC();
MODULE_PARM_DESC();
MODULE_PARM_DESC();
MODULE_PARM_DESC();
MODULE_PARM_DESC();
MODULE_PARM_DESC();
MODULE_PARM_DESC();
MODULE_PARM_DESC();
MODULE_PARM_DESC();

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

static void sym2_setup_params(void)
{}

static struct scsi_transport_template *sym2_transport_template =;

/*
 *  Driver private area in the SCSI command structure.
 */
struct sym_ucmd {};

#define SYM_UCMD_PTR(cmd)
#define SYM_SOFTC_PTR(cmd)

/*
 *  Complete a pending CAM CCB.
 */
void sym_xpt_done(struct sym_hcb *np, struct scsi_cmnd *cmd)
{}

/*
 *  Tell the SCSI layer about a BUS RESET.
 */
void sym_xpt_async_bus_reset(struct sym_hcb *np)
{}

/*
 *  Choose the more appropriate CAM status if 
 *  the IO encountered an extended error.
 */
static int sym_xerr_cam_status(int cam_status, int x_status)
{}

/*
 *  Build CAM result for a failed or auto-sensed IO.
 */
void sym_set_cam_result_error(struct sym_hcb *np, struct sym_ccb *cp, int resid)
{}

static int sym_scatter(struct sym_hcb *np, struct sym_ccb *cp, struct scsi_cmnd *cmd)
{}

/*
 *  Queue a SCSI command.
 */
static int sym_queue_command(struct sym_hcb *np, struct scsi_cmnd *cmd)
{}

/*
 *  Setup buffers and pointers that address the CDB.
 */
static inline int sym_setup_cdb(struct sym_hcb *np, struct scsi_cmnd *cmd, struct sym_ccb *cp)
{}

/*
 *  Setup pointers that address the data and start the I/O.
 */
int sym_setup_data_and_start(struct sym_hcb *np, struct scsi_cmnd *cmd, struct sym_ccb *cp)
{}


/*
 *  timer daemon.
 *
 *  Misused to keep the driver running when
 *  interrupts are not configured correctly.
 */
static void sym_timer(struct sym_hcb *np)
{}


/*
 *  PCI BUS error handler.
 */
void sym_log_bus_error(struct Scsi_Host *shost)
{}

/*
 * queuecommand method.  Entered with the host adapter lock held and
 * interrupts disabled.
 */
static int sym53c8xx_queue_command_lck(struct scsi_cmnd *cmd)
{}

static DEF_SCSI_QCMD(sym53c8xx_queue_command)

/*
 *  Linux entry point of the interrupt handler.
 */
static irqreturn_t sym53c8xx_intr(int irq, void *dev_id)
{}

/*
 *  Linux entry point of the timer handler
 */
static void sym53c8xx_timer(struct timer_list *t)
{}


/*
 *  What the eh thread wants us to perform.
 */
#define SYM_EH_ABORT
#define SYM_EH_DEVICE_RESET

/*
 *  Generic method for our eh processing.
 *  The 'op' argument tells what we have to do.
 */
/*
 * Error handlers called from the eh thread (one thread per HBA).
 */
static int sym53c8xx_eh_abort_handler(struct scsi_cmnd *cmd)
{}

static int sym53c8xx_eh_target_reset_handler(struct scsi_cmnd *cmd)
{}

static int sym53c8xx_eh_bus_reset_handler(struct scsi_cmnd *cmd)
{}

static int sym53c8xx_eh_host_reset_handler(struct scsi_cmnd *cmd)
{}

/*
 *  Tune device queuing depth, according to various limits.
 */
static void sym_tune_dev_queuing(struct sym_tcb *tp, int lun, u_short reqtags)
{}

static int sym53c8xx_slave_alloc(struct scsi_device *sdev)
{}

/*
 * Linux entry point for device queue sizing.
 */
static int sym53c8xx_slave_configure(struct scsi_device *sdev)
{}

static void sym53c8xx_slave_destroy(struct scsi_device *sdev)
{}

/*
 *  Linux entry point for info() function
 */
static const char *sym53c8xx_info (struct Scsi_Host *host)
{}


#ifdef SYM_LINUX_PROC_INFO_SUPPORT
/*
 *  Proc file system stuff
 *
 *  A read operation returns adapter information.
 *  A write operation is a control command.
 *  The string is parsed in the driver code and the command is passed 
 *  to the sym_usercmd() function.
 */

#ifdef SYM_LINUX_USER_COMMAND_SUPPORT

struct	sym_usrcmd {};

#define UC_SETSYNC
#define UC_SETTAGS
#define UC_SETDEBUG
#define UC_SETWIDE
#define UC_SETFLAG
#define UC_SETVERBOSE
#define UC_RESETDEV
#define UC_CLEARDEV

static void sym_exec_user_command (struct sym_hcb *np, struct sym_usrcmd *uc)
{}

static int sym_skip_spaces(char *ptr, int len)
{}

static int get_int_arg(char *ptr, int len, u_long *pv)
{}

static int is_keyword(char *ptr, int len, char *verb)
{}

#define SKIP_SPACES(ptr, len)

#define GET_INT_ARG(ptr, len, v)


/*
 * Parse a control command
 */

static int sym_user_command(struct Scsi_Host *shost, char *buffer, int length)
{}

#endif	/* SYM_LINUX_USER_COMMAND_SUPPORT */


/*
 *  Copy formatted information into the input buffer.
 */
static int sym_show_info(struct seq_file *m, struct Scsi_Host *shost)
{}

#endif /* SYM_LINUX_PROC_INFO_SUPPORT */

/*
 * Free resources claimed by sym_iomap_device().  Note that
 * sym_free_resources() should be used instead of this function after calling
 * sym_attach().
 */
static void sym_iounmap_device(struct sym_device *device)
{}

/*
 *	Free controller resources.
 */
static void sym_free_resources(struct sym_hcb *np, struct pci_dev *pdev,
		int do_free_irq)
{}

/*
 *  Host attach and initialisations.
 *
 *  Allocate host data and ncb structure.
 *  Remap MMIO region.
 *  Do chip initialization.
 *  If all is OK, install interrupt handling and
 *  start the timer daemon.
 */
static struct Scsi_Host *sym_attach(const struct scsi_host_template *tpnt, int unit,
				    struct sym_device *dev)
{}


/*
 *    Detect and try to read SYMBIOS and TEKRAM NVRAM.
 */
#if SYM_CONF_NVRAM_SUPPORT
static void sym_get_nvram(struct sym_device *devp, struct sym_nvram *nvp)
{}
#else
static inline void sym_get_nvram(struct sym_device *devp, struct sym_nvram *nvp)
{
}
#endif	/* SYM_CONF_NVRAM_SUPPORT */

static int sym_check_supported(struct sym_device *device)
{}

/*
 * Ignore Symbios chips controlled by various RAID controllers.
 * These controllers set value 0x52414944 at RAM end - 16.
 */
static int sym_check_raid(struct sym_device *device)
{}

static int sym_set_workarounds(struct sym_device *device)
{}

/*
 * Map HBA registers and on-chip SRAM (if present).
 */
static int sym_iomap_device(struct sym_device *device)
{}

/*
 * The NCR PQS and PDS cards are constructed as a DEC bridge
 * behind which sits a proprietary NCR memory controller and
 * either four or two 53c875s as separate devices.  We can tell
 * if an 875 is part of a PQS/PDS or not since if it is, it will
 * be on the same bus as the memory controller.  In its usual
 * mode of operation, the 875s are slaved to the memory
 * controller for all transfers.  To operate with the Linux
 * driver, the memory controller is disabled and the 875s
 * freed to function independently.  The only wrinkle is that
 * the preset SCSI ID (which may be zero) must be read in from
 * a special configuration space register of the 875.
 */
static void sym_config_pqs(struct pci_dev *pdev, struct sym_device *sym_dev)
{}

/*
 *  Called before unloading the module.
 *  Detach the host.
 *  We have to free resources and halt the NCR chip.
 */
static int sym_detach(struct Scsi_Host *shost, struct pci_dev *pdev)
{}

/*
 * Driver host template.
 */
static const struct scsi_host_template sym2_template =;

static int attach_count;

static int sym2_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{}

static void sym2_remove(struct pci_dev *pdev)
{}

/**
 * sym2_io_error_detected() - called when PCI error is detected
 * @pdev: pointer to PCI device
 * @state: current state of the PCI slot
 */
static pci_ers_result_t sym2_io_error_detected(struct pci_dev *pdev,
                                         pci_channel_state_t state)
{}

/**
 * sym2_io_slot_dump - Enable MMIO and dump debug registers
 * @pdev: pointer to PCI device
 */
static pci_ers_result_t sym2_io_slot_dump(struct pci_dev *pdev)
{}

/**
 * sym2_reset_workarounds - hardware-specific work-arounds
 * @pdev: pointer to PCI device
 *
 * This routine is similar to sym_set_workarounds(), except
 * that, at this point, we already know that the device was
 * successfully initialized at least once before, and so most
 * of the steps taken there are un-needed here.
 */
static void sym2_reset_workarounds(struct pci_dev *pdev)
{}

/**
 * sym2_io_slot_reset() - called when the pci bus has been reset.
 * @pdev: pointer to PCI device
 *
 * Restart the card from scratch.
 */
static pci_ers_result_t sym2_io_slot_reset(struct pci_dev *pdev)
{}

/**
 * sym2_io_resume() - resume normal ops after PCI reset
 * @pdev: pointer to PCI device
 *
 * Called when the error recovery driver tells us that its
 * OK to resume normal operation. Use completion to allow
 * halted scsi ops to resume.
 */
static void sym2_io_resume(struct pci_dev *pdev)
{}

static void sym2_get_signalling(struct Scsi_Host *shost)
{}

static void sym2_set_offset(struct scsi_target *starget, int offset)
{}

static void sym2_set_period(struct scsi_target *starget, int period)
{}

static void sym2_set_width(struct scsi_target *starget, int width)
{}

static void sym2_set_dt(struct scsi_target *starget, int dt)
{}

#if 0
static void sym2_set_iu(struct scsi_target *starget, int iu)
{
	struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
	struct sym_hcb *np = sym_get_hcb(shost);
	struct sym_tcb *tp = &np->target[starget->id];

	if (iu)
		tp->tgoal.iu = tp->tgoal.dt = 1;
	else
		tp->tgoal.iu = 0;
	tp->tgoal.check_nego = 1;
}

static void sym2_set_qas(struct scsi_target *starget, int qas)
{
	struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
	struct sym_hcb *np = sym_get_hcb(shost);
	struct sym_tcb *tp = &np->target[starget->id];

	if (qas)
		tp->tgoal.dt = tp->tgoal.qas = 1;
	else
		tp->tgoal.qas = 0;
	tp->tgoal.check_nego = 1;
}
#endif

static struct spi_function_template sym2_transport_functions =;

static struct pci_device_id sym2_id_table[] =;

MODULE_DEVICE_TABLE(pci, sym2_id_table);

static const struct pci_error_handlers sym2_err_handler =;

static struct pci_driver sym2_driver =;

static int __init sym2_init(void)
{}

static void __exit sym2_exit(void)
{}

module_init();
module_exit(sym2_exit);