Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 60539fa3 authored by James Bottomley's avatar James Bottomley
Browse files

Merge remote-tracking branch 'mkp-scsi/4.5/scsi-queue' into misc

parents abaee091 a290dd57
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1045,6 +1045,9 @@ static int tw_chrdev_open(struct inode *inode, struct file *file)
static const struct file_operations tw_fops = {
	.owner		= THIS_MODULE,
	.unlocked_ioctl	= tw_chrdev_ioctl,
#ifdef CONFIG_COMPAT
	.compat_ioctl   = tw_chrdev_ioctl,
#endif
	.open		= tw_chrdev_open,
	.release	= NULL,
	.llseek		= noop_llseek,
+0 −17
Original line number Diff line number Diff line
@@ -1620,23 +1620,6 @@ config ATARI_SCSI
	  ST-DMA, replacing ACSI).  It does NOT support other schemes, like
	  in the Hades (without DMA).

config ATARI_SCSI_TOSHIBA_DELAY
	bool "Long delays for Toshiba CD-ROMs"
	depends on ATARI_SCSI
	help
	  This option increases the delay after a SCSI arbitration to
	  accommodate some flaky Toshiba CD-ROM drives. Say Y if you intend to
	  use a Toshiba CD-ROM drive; otherwise, the option is not needed and
	  would impact performance a bit, so say N.

config ATARI_SCSI_RESET_BOOT
	bool "Reset SCSI-devices at boottime"
	depends on ATARI_SCSI
	help
	  Reset the devices on your Atari whenever it boots.  This makes the
	  boot process fractionally longer but may assist recovery from errors
	  that leave the devices with SCSI operations partway completed.

config MAC_SCSI
	tristate "Macintosh NCR5380 SCSI"
	depends on MAC && SCSI=y
+1306 −1564

File changed.

Preview size limit exceeded, changes collapsed.

+38 −49
Original line number Diff line number Diff line
@@ -22,8 +22,13 @@
#ifndef NCR5380_H
#define NCR5380_H

#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/workqueue.h>
#include <scsi/scsi_dbg.h>
#include <scsi/scsi_eh.h>
#include <scsi/scsi_transport_spi.h>

#define NDEBUG_ARBITRATION	0x1
#define NDEBUG_AUTOSENSE	0x2
@@ -158,8 +163,7 @@
/* Write any value to this register to start an ini mode DMA receive */
#define START_DMA_INITIATOR_RECEIVE_REG 7	/* wo */

#define C400_CONTROL_STATUS_REG NCR53C400_register_offset-8	/* rw */

/* NCR 53C400(A) Control Status Register bits: */
#define CSR_RESET              0x80	/* wo  Resets 53c400 */
#define CSR_53C80_REG          0x80	/* ro  5380 registers busy */
#define CSR_TRANS_DIR          0x40	/* rw  Data transfer direction */
@@ -176,16 +180,6 @@
#define CSR_BASE CSR_53C80_INTR
#endif

/* Number of 128-byte blocks to be transferred */
#define C400_BLOCK_COUNTER_REG   NCR53C400_register_offset-7	/* rw */

/* Resume transfer after disconnect */
#define C400_RESUME_TRANSFER_REG NCR53C400_register_offset-6	/* wo */

/* Access to host buffer stack */
#define C400_HOST_BUFFER         NCR53C400_register_offset-4	/* rw */


/* Note : PHASE_* macros are based on the values of the STATUS register */
#define PHASE_MASK 	(SR_MSG | SR_CD | SR_IO)

@@ -205,16 +199,6 @@

#define PHASE_SR_TO_TCR(phase) ((phase) >> 2)

/*
 * The internal should_disconnect() function returns these based on the 
 * expected length of a disconnect if a device supports disconnect/
 * reconnect.
 */

#define DISCONNECT_NONE		0
#define DISCONNECT_TIME_TO_DATA	1
#define DISCONNECT_LONG		2

/* 
 * "Special" value for the (unsigned char) command tag, to indicate
 * I_T_L nexus instead of I_T_L_Q.
@@ -236,15 +220,11 @@
#define NO_IRQ		0
#endif

#define FLAG_HAS_LAST_BYTE_SENT		1	/* NCR53c81 or better */
#define FLAG_CHECK_LAST_BYTE_SENT	2	/* Only test once */
#define FLAG_NCR53C400			4	/* NCR53c400 */
#define FLAG_NO_DMA_FIXUP		1	/* No DMA errata workarounds */
#define FLAG_NO_PSEUDO_DMA		8	/* Inhibit DMA */
#define FLAG_DTC3181E			16	/* DTC3181E */
#define FLAG_LATE_DMA_SETUP		32	/* Setup NCR before DMA H/W */
#define FLAG_TAGGED_QUEUING		64	/* as X3T9.2 spelled it */

#ifndef ASM
#define FLAG_TOSHIBA_DELAY		128	/* Allow for borken CD-ROMs */

#ifdef SUPPORT_TAGS
struct tag_alloc {
@@ -258,33 +238,24 @@ struct NCR5380_hostdata {
	NCR5380_implementation_fields;		/* implementation specific */
	struct Scsi_Host *host;			/* Host backpointer */
	unsigned char id_mask, id_higher_mask;	/* 1 << id, all bits greater */
	unsigned char targets_present;		/* targets we have connected
						   to, so we can call a select
						   failure a retryable condition */
	volatile unsigned char busy[8];		/* index = target, bit = lun */
	unsigned char busy[8];			/* index = target, bit = lun */
#if defined(REAL_DMA) || defined(REAL_DMA_POLL)
	volatile int dma_len;			/* requested length of DMA */
	int dma_len;				/* requested length of DMA */
#endif
	volatile unsigned char last_message;	/* last message OUT */
	volatile struct scsi_cmnd *connected;	/* currently connected command */
	volatile struct scsi_cmnd *issue_queue;	/* waiting to be issued */
	volatile struct scsi_cmnd *disconnected_queue;	/* waiting for reconnect */
	volatile int restart_select;		/* we have disconnected,
						   used to restart 
						   NCR5380_select() */
	volatile unsigned aborted:1;		/* flag, says aborted */
	unsigned char last_message;		/* last message OUT */
	struct scsi_cmnd *connected;		/* currently connected cmnd */
	struct scsi_cmnd *selecting;		/* cmnd to be connected */
	struct list_head unissued;		/* waiting to be issued */
	struct list_head autosense;		/* priority issue queue */
	struct list_head disconnected;		/* waiting for reconnect */
	spinlock_t lock;			/* protects this struct */
	int flags;
	unsigned long time_expires;		/* in jiffies, set prior to sleeping */
	int select_time;			/* timer in select for target response */
	volatile struct scsi_cmnd *selecting;
	struct delayed_work coroutine;		/* our co-routine */
	struct scsi_eh_save ses;
	struct scsi_cmnd *sensing;
	char info[256];
	int read_overruns;                /* number of bytes to cut from a
	                                   * transfer to handle chip overruns */
	int retain_dma_intr;
	struct work_struct main_task;
	volatile int main_running;
#ifdef SUPPORT_TAGS
	struct tag_alloc TagAlloc[8][8];	/* 8 targets and 8 LUNs */
#endif
@@ -292,10 +263,23 @@ struct NCR5380_hostdata {
	unsigned spin_max_r;
	unsigned spin_max_w;
#endif
	struct workqueue_struct *work_q;
	unsigned long accesses_per_ms;	/* chip register accesses per ms */
};

#ifdef __KERNEL__

struct NCR5380_cmd {
	struct list_head list;
};

#define NCR5380_CMD_SIZE		(sizeof(struct NCR5380_cmd))

static inline struct scsi_cmnd *NCR5380_to_scmd(struct NCR5380_cmd *ncmd_ptr)
{
	return ((struct scsi_cmnd *)ncmd_ptr) - 1;
}

#ifndef NDEBUG
#define NDEBUG (0)
#endif
@@ -304,6 +288,11 @@ struct NCR5380_hostdata {
	do { if ((NDEBUG) & (flg)) \
		printk(KERN_DEBUG fmt, ## __VA_ARGS__); } while (0)

#define dsprintk(flg, host, fmt, ...) \
	do { if ((NDEBUG) & (flg)) \
		shost_printk(KERN_DEBUG, host, fmt, ## __VA_ARGS__); \
	} while (0)

#if NDEBUG
#define NCR5380_dprint(flg, arg) \
	do { if ((NDEBUG) & (flg)) NCR5380_print(arg); } while (0)
@@ -320,6 +309,7 @@ static void NCR5380_print(struct Scsi_Host *instance);
static int NCR5380_probe_irq(struct Scsi_Host *instance, int possible);
#endif
static int NCR5380_init(struct Scsi_Host *instance, int flags);
static int NCR5380_maybe_reset_bus(struct Scsi_Host *);
static void NCR5380_exit(struct Scsi_Host *instance);
static void NCR5380_information_transfer(struct Scsi_Host *instance);
#ifndef DONT_USE_INTR
@@ -328,7 +318,7 @@ static irqreturn_t NCR5380_intr(int irq, void *dev_id);
static void NCR5380_main(struct work_struct *work);
static const char *NCR5380_info(struct Scsi_Host *instance);
static void NCR5380_reselect(struct Scsi_Host *instance);
static int NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd);
static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *, struct scsi_cmnd *);
#if defined(PSEUDO_DMA) || defined(REAL_DMA) || defined(REAL_DMA_POLL)
static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data);
#endif
@@ -443,5 +433,4 @@ static __inline__ int NCR5380_pc_dma_residual(struct Scsi_Host *instance)
#endif				/* defined(i386) || defined(__alpha__) */
#endif				/* defined(REAL_DMA)  */
#endif				/* __KERNEL__ */
#endif				/* ndef ASM */
#endif				/* NCR5380_H */
+15 −16
Original line number Diff line number Diff line
@@ -4,9 +4,7 @@
 * Copyright 1995-2002, Russell King
 */
#include <linux/module.h>
#include <linux/signal.h>
#include <linux/ioport.h>
#include <linux/delay.h>
#include <linux/blkdev.h>
#include <linux/init.h>

@@ -15,15 +13,14 @@

#include <scsi/scsi_host.h>

#include <scsi/scsicam.h>

#define PSEUDO_DMA

#define priv(host)			((struct NCR5380_hostdata *)(host)->hostdata)
#define NCR5380_local_declare()		struct Scsi_Host *_instance
#define NCR5380_setup(instance)		_instance = instance
#define NCR5380_read(reg)		cumanascsi_read(_instance, reg)
#define NCR5380_write(reg, value)	cumanascsi_write(_instance, reg, value)
#define NCR5380_read(reg)		cumanascsi_read(instance, reg)
#define NCR5380_write(reg, value)	cumanascsi_write(instance, reg, value)

#define NCR5380_dma_xfer_len(instance, cmd, phase)	(cmd->transfersize)

#define NCR5380_intr			cumanascsi_intr
#define NCR5380_queue_command		cumanascsi_queue_command
#define NCR5380_info			cumanascsi_info
@@ -211,6 +208,8 @@ static struct scsi_host_template cumanascsi_template = {
	.cmd_per_lun		= 2,
	.use_clustering		= DISABLE_CLUSTERING,
	.proc_name		= "CumanaSCSI-1",
	.cmd_size		= NCR5380_CMD_SIZE,
	.max_sectors		= 128,
};

static int cumanascsi1_probe(struct expansion_card *ec,
@@ -240,23 +239,21 @@ static int cumanascsi1_probe(struct expansion_card *ec,

	host->irq = ec->irq;

	NCR5380_init(host, 0);
	ret = NCR5380_init(host, 0);
	if (ret)
		goto out_unmap;

	NCR5380_maybe_reset_bus(host);

        priv(host)->ctrl = 0;
        writeb(0, priv(host)->base + CTRL);

	host->n_io_port = 255;
	if (!(request_region(host->io_port, host->n_io_port, "CumanaSCSI-1"))) {
		ret = -EBUSY;
		goto out_unmap;
	}

	ret = request_irq(host->irq, cumanascsi_intr, 0,
			  "CumanaSCSI-1", host);
	if (ret) {
		printk("scsi%d: IRQ%d not free: %d\n",
		    host->host_no, host->irq, ret);
		goto out_unmap;
		goto out_exit;
	}

	ret = scsi_add_host(host, &ec->dev);
@@ -268,6 +265,8 @@ static int cumanascsi1_probe(struct expansion_card *ec,

 out_free_irq:
	free_irq(host->irq, host);
 out_exit:
	NCR5380_exit(host);
 out_unmap:
	iounmap(priv(host)->base);
	iounmap(priv(host)->dma);
Loading