linux/drivers/scsi/pcmcia/nsp_cs.c

/*======================================================================

    NinjaSCSI-3 / NinjaSCSI-32Bi PCMCIA SCSI host adapter card driver
      By: YOKOTA Hiroshi <[email protected]>

    Ver.2.8   Support 32bit MMIO mode
              Support Synchronous Data Transfer Request (SDTR) mode
    Ver.2.0   Support 32bit PIO mode
    Ver.1.1.2 Fix for scatter list buffer exceeds
    Ver.1.1   Support scatter list
    Ver.0.1   Initial version

    This software may be used and distributed according to the terms of
    the GNU General Public License.

======================================================================*/

/***********************************************************************
    This driver is for these PCcards.

	I-O DATA PCSC-F	 (Workbit NinjaSCSI-3)
			"WBT", "NinjaSCSI-3", "R1.0"
	I-O DATA CBSC-II (Workbit NinjaSCSI-32Bi in 16bit mode)
			"IO DATA", "CBSC16	 ", "1"

***********************************************************************/

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/timer.h>
#include <linux/ioport.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/major.h>
#include <linux/blkdev.h>
#include <linux/stat.h>

#include <asm/io.h>
#include <asm/irq.h>

#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_ioctl.h>

#include <pcmcia/cistpl.h>
#include <pcmcia/cisreg.h>
#include <pcmcia/ds.h>

#include "nsp_cs.h"

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

#include "nsp_io.h"

/*====================================================================*/
/* Parameters that can be set with 'insmod' */

static int       nsp_burst_mode =;
module_param(nsp_burst_mode, int, 0);
MODULE_PARM_DESC();

/* Release IO ports after configuration? */
static bool       free_ports =;
module_param(free_ports, bool, 0);
MODULE_PARM_DESC();

static struct scsi_pointer *nsp_priv(struct scsi_cmnd *cmd)
{}

static struct scsi_host_template nsp_driver_template =;

static nsp_hw_data nsp_data_base; /* attach <-> detect glue */



/*
 * debug, error print
 */
#ifndef NSP_DEBUG
#define NSP_DEBUG_MASK
#define nsp_msg(type, args...)
#define nsp_dbg(mask, args...)
#else
#define NSP_DEBUG_MASK
#define nsp_msg
#define nsp_dbg
#endif

#define NSP_DEBUG_QUEUECOMMAND
#define NSP_DEBUG_REGISTER
#define NSP_DEBUG_AUTOSCSI
#define NSP_DEBUG_INTR
#define NSP_DEBUG_SGLIST
#define NSP_DEBUG_BUSFREE
#define NSP_DEBUG_CDB_CONTENTS
#define NSP_DEBUG_RESELECTION
#define NSP_DEBUG_MSGINOCCUR
#define NSP_DEBUG_EEPROM
#define NSP_DEBUG_MSGOUTOCCUR
#define NSP_DEBUG_BUSRESET
#define NSP_DEBUG_RESTART
#define NSP_DEBUG_SYNC
#define NSP_DEBUG_WAIT
#define NSP_DEBUG_TARGETFLAG
#define NSP_DEBUG_PROC
#define NSP_DEBUG_INIT
#define NSP_DEBUG_DATA_IO
#define NSP_SPECIAL_PRINT_REGISTER

#define NSP_DEBUG_BUF_LEN

static inline void nsp_inc_resid(struct scsi_cmnd *SCpnt, int residInc)
{}

__printf(4, 5)
static void nsp_cs_message(const char *func, int line, char *type, char *fmt, ...)
{}

#ifdef NSP_DEBUG
static void nsp_cs_dmessage(const char *func, int line, int mask, char *fmt, ...)
{
	va_list args;
	char buf[NSP_DEBUG_BUF_LEN];

	va_start(args, fmt);
	vsnprintf(buf, sizeof(buf), fmt, args);
	va_end(args);

	if (mask & NSP_DEBUG_MASK) {
		printk("nsp_cs-debug: 0x%x %s (%d): %s\n", mask, func, line, buf);
	}
}
#endif

/***********************************************************/

/*====================================================
 * Clenaup parameters and call done() functions.
 * You must be set SCpnt->result before call this function.
 */
static void nsp_scsi_done(struct scsi_cmnd *SCpnt)
{}

static int nsp_queuecommand_lck(struct scsi_cmnd *const SCpnt)
{}

static DEF_SCSI_QCMD(nsp_queuecommand)

/*
 * setup PIO FIFO transfer mode and enable/disable to data out
 */
static void nsp_setup_fifo(nsp_hw_data *data, bool enabled)
{}

static void nsphw_init_sync(nsp_hw_data *data)
{}

/*
 * Initialize Ninja hardware
 */
static void nsphw_init(nsp_hw_data *data)
{}

/*
 * Start selection phase
 */
static bool nsphw_start_selection(struct scsi_cmnd *const SCpnt)
{}

struct nsp_sync_table {};

static struct nsp_sync_table nsp_sync_table_40M[] =;

static struct nsp_sync_table nsp_sync_table_20M[] =;

/*
 * setup synchronous data transfer mode
 */
static int nsp_analyze_sdtr(struct scsi_cmnd *SCpnt)
{}


/*
 * start ninja hardware timer
 */
static void nsp_start_timer(struct scsi_cmnd *SCpnt, int time)
{}

/*
 * wait for bus phase change
 */
static int nsp_negate_signal(struct scsi_cmnd *SCpnt, unsigned char mask,
			     char *str)
{}

/*
 * expect Ninja Irq
 */
static int nsp_expect_signal(struct scsi_cmnd *SCpnt,
			     unsigned char current_phase,
			     unsigned char mask)
{}

/*
 * transfer SCSI message
 */
static int nsp_xfer(struct scsi_cmnd *const SCpnt, int phase)
{}

/*
 * get extra SCSI data from fifo
 */
static int nsp_dataphase_bypass(struct scsi_cmnd *const SCpnt)
{}

/*
 * accept reselection
 */
static void nsp_reselected(struct scsi_cmnd *SCpnt)
{}

/*
 * count how many data transferd
 */
static int nsp_fifo_count(struct scsi_cmnd *SCpnt)
{}

/* fifo size */
#define RFIFO_CRIT
#define WFIFO_CRIT

/*
 * read data in DATA IN phase
 */
static void nsp_pio_read(struct scsi_cmnd *const SCpnt)
{}

/*
 * write data in DATA OUT phase
 */
static void nsp_pio_write(struct scsi_cmnd *SCpnt)
{}
#undef RFIFO_CRIT
#undef WFIFO_CRIT

/*
 * setup synchronous/asynchronous data transfer mode
 */
static int nsp_nexus(struct scsi_cmnd *SCpnt)
{}

#include "nsp_message.c"
/*
 * interrupt handler
 */
static irqreturn_t nspintr(int irq, void *dev_id)
{}

#ifdef NSP_DEBUG
#include "nsp_debug.c"
#endif	/* NSP_DEBUG */

/*----------------------------------------------------------------*/
/* look for ninja3 card and init if found			  */
/*----------------------------------------------------------------*/
static struct Scsi_Host *nsp_detect(struct scsi_host_template *sht)
{}

/*----------------------------------------------------------------*/
/* return info string						  */
/*----------------------------------------------------------------*/
static const char *nsp_info(struct Scsi_Host *shpnt)
{}

static int nsp_show_info(struct seq_file *m, struct Scsi_Host *host)
{}

/*---------------------------------------------------------------*/
/* error handler                                                 */
/*---------------------------------------------------------------*/

/*
static int nsp_eh_abort(struct scsi_cmnd *SCpnt)
{
	nsp_dbg(NSP_DEBUG_BUSRESET, "SCpnt=0x%p", SCpnt);

	return nsp_eh_bus_reset(SCpnt);
}*/

static int nsp_bus_reset(nsp_hw_data *data)
{}

static int nsp_eh_bus_reset(struct scsi_cmnd *SCpnt)
{}

static int nsp_eh_host_reset(struct scsi_cmnd *SCpnt)
{}


/**********************************************************************
  PCMCIA functions
**********************************************************************/

static int nsp_cs_probe(struct pcmcia_device *link)
{} /* nsp_cs_attach */


static void nsp_cs_detach(struct pcmcia_device *link)
{} /* nsp_cs_detach */


static int nsp_cs_config_check(struct pcmcia_device *p_dev, void *priv_data)
{}

static int nsp_cs_config(struct pcmcia_device *link)
{} /* nsp_cs_config */


static void nsp_cs_release(struct pcmcia_device *link)
{} /* nsp_cs_release */

static int nsp_cs_suspend(struct pcmcia_device *link)
{}

static int nsp_cs_resume(struct pcmcia_device *link)
{}

/*======================================================================*
 *	module entry point
 *====================================================================*/
static const struct pcmcia_device_id nsp_cs_ids[] =;
MODULE_DEVICE_TABLE();

static struct pcmcia_driver nsp_driver =;
module_pcmcia_driver();

/* end */