*/
#include <linux/config.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/blkdev.h>
+#include <linux/parport.h>
+#include <linux/workqueue.h>
+#include <linux/delay.h>
+#include <asm/io.h>
+
+#include <scsi/scsi.h>
+#include <scsi/scsi_cmnd.h>
+#include <scsi/scsi_device.h>
+#include <scsi/scsi_host.h>
/* The following #define is to avoid a clash with hosts.c */
#define IMM_PROBE_SPP 0x0001
#define IMM_PROBE_EPP17 0x0100
#define IMM_PROBE_EPP19 0x0200
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/blkdev.h>
-#include <asm/io.h>
-#include <linux/parport.h>
-#include <linux/workqueue.h>
-#include "scsi.h"
-#include "hosts.h"
typedef struct {
struct pardevice *dev; /* Parport device entry */
int base; /* Actual port address */
int base_hi; /* Hi Base address for ECP-ISA chipset */
int mode; /* Transfer mode */
- Scsi_Cmnd *cur_cmd; /* Current queued command */
+ struct scsi_cmnd *cur_cmd; /* Current queued command */
struct work_struct imm_tq; /* Polling interrupt stuff */
unsigned long jstart; /* Jiffies at start */
unsigned failed:1; /* Failure flag */
return *(imm_struct **)&host->hostdata;
}
-static spinlock_t arbitration_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(arbitration_lock);
static void got_it(imm_struct *dev)
{
if (imm_connect(dev, 0) != 1)
return -EIO;
imm_reset_pulse(dev->base);
- udelay(1000); /* Delay to allow devices to settle */
+ mdelay(1); /* Delay to allow devices to settle */
imm_disconnect(dev);
- udelay(1000); /* Another delay to allow devices to settle */
+ mdelay(1); /* Another delay to allow devices to settle */
return device_check(dev);
}
-static inline int imm_send_command(Scsi_Cmnd *cmd)
+static inline int imm_send_command(struct scsi_cmnd *cmd)
{
imm_struct *dev = imm_dev(cmd->device->host);
int k;
* The driver appears to remain stable if we speed up the parallel port
* i/o in this function, but not elsewhere.
*/
-static int imm_completion(Scsi_Cmnd *cmd)
+static int imm_completion(struct scsi_cmnd *cmd)
{
/* Return codes:
* -1 Error
static void imm_interrupt(void *data)
{
imm_struct *dev = (imm_struct *) data;
- Scsi_Cmnd *cmd = dev->cur_cmd;
+ struct scsi_cmnd *cmd = dev->cur_cmd;
struct Scsi_Host *host = cmd->device->host;
unsigned long flags;
case DID_OK:
break;
case DID_NO_CONNECT:
- printk("imm: no device at SCSI ID %i\n", cmd->target);
+ printk("imm: no device at SCSI ID %i\n", cmd->device->id);
break;
case DID_BUS_BUSY:
printk("imm: BUS BUSY - EPP timeout detected\n");
imm_pb_dismiss(dev);
spin_lock_irqsave(host->host_lock, flags);
- dev->cur_cmd = 0;
+ dev->cur_cmd = NULL;
cmd->scsi_done(cmd);
spin_unlock_irqrestore(host->host_lock, flags);
return;
}
-static int imm_engine(imm_struct *dev, Scsi_Cmnd *cmd)
+static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
{
unsigned short ppb = dev->base;
unsigned char l = 0, h = 0;
/* Phase 2 - We are now talking to the scsi bus */
case 2:
- if (!imm_select(dev, cmd->device->id)) {
+ if (!imm_select(dev, scmd_id(cmd))) {
imm_fail(dev, DID_NO_CONNECT);
return 0;
}
return 0;
}
-static int imm_queuecommand(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
+static int imm_queuecommand(struct scsi_cmnd *cmd,
+ void (*done)(struct scsi_cmnd *))
{
imm_struct *dev = imm_dev(cmd->device->host);
return 0;
}
-static int imm_abort(Scsi_Cmnd *cmd)
+static int imm_abort(struct scsi_cmnd *cmd)
{
imm_struct *dev = imm_dev(cmd->device->host);
/*
w_ctr(base, 0x04);
}
-static int imm_reset(Scsi_Cmnd *cmd)
+static int imm_reset(struct scsi_cmnd *cmd)
{
imm_struct *dev = imm_dev(cmd->device->host);
imm_connect(dev, CONNECT_NORMAL);
imm_reset_pulse(dev->base);
- udelay(1000); /* device settle delay */
+ mdelay(1); /* device settle delay */
imm_disconnect(dev);
- udelay(1000); /* device settle delay */
+ mdelay(1); /* device settle delay */
return SUCCESS;
}
return -ENODEV;
}
-static Scsi_Host_Template imm_template = {
+static int imm_adjust_queue(struct scsi_device *device)
+{
+ blk_queue_bounce_limit(device->request_queue, BLK_BOUNCE_HIGH);
+ return 0;
+}
+
+static struct scsi_host_template imm_template = {
.module = THIS_MODULE,
.proc_name = "imm",
.proc_info = imm_proc_info,
.cmd_per_lun = 1,
.use_clustering = ENABLE_CLUSTERING,
.can_queue = 1,
+ .slave_alloc = imm_adjust_queue,
+ .unchecked_isa_dma = 1, /* imm cannot deal with highmem, so
+ * this is an easy trick to ensure
+ * all io pages for this host reside
+ * in low memory */
};
/***************************************************************************