*
* (The IMM is the embedded controller in the ZIP Plus drive.)
*
- * Current Maintainer: David Campbell (Perth, Western Australia)
- * campbell@torque.net
- *
* My unoffical company acronym list is 21 pages long:
* FLA: Four letter acronym with built in facility for
* future expansion to five letters.
*/
-#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 work_struct imm_tq; /* Polling interrupt stuff */
+ struct scsi_cmnd *cur_cmd; /* Current queued command */
+ struct delayed_work imm_tq; /* Polling interrupt stuff */
unsigned long jstart; /* Jiffies at start */
unsigned failed:1; /* Failure flag */
unsigned dp:1; /* Data phase present */
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
* the scheduler's task queue to generate a stream of call-backs and
* complete the request when the drive is ready.
*/
-static void imm_interrupt(void *data)
+static void imm_interrupt(struct work_struct *work)
{
- imm_struct *dev = (imm_struct *) data;
- Scsi_Cmnd *cmd = dev->cur_cmd;
+ imm_struct *dev = container_of(work, imm_struct, imm_tq.work);
+ struct scsi_cmnd *cmd = dev->cur_cmd;
struct Scsi_Host *host = cmd->device->host;
unsigned long flags;
return;
}
if (imm_engine(dev, cmd)) {
- INIT_WORK(&dev->imm_tq, imm_interrupt, (void *) dev);
schedule_delayed_work(&dev->imm_tq, 1);
return;
}
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);
cmd->result = DID_ERROR << 16; /* default return code */
cmd->SCp.phase = 0; /* bus free */
- INIT_WORK(&dev->imm_tq, imm_interrupt, dev);
- schedule_work(&dev->imm_tq);
+ schedule_delayed_work(&dev->imm_tq, 0);
imm_pb_claim(dev);
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 = {
+/*
+ * imm cannot deal with highmem, so this causes all IO pages for this host
+ * to reside in low memory (hence mapped)
+ */
+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,
};
/***************************************************************************
{
struct Scsi_Host *host;
imm_struct *dev;
- DECLARE_WAIT_QUEUE_HEAD(waiting);
+ DECLARE_WAIT_QUEUE_HEAD_ONSTACK(waiting);
DEFINE_WAIT(wait);
int ports;
int modes, ppb;
else
ports = 8;
- INIT_WORK(&dev->imm_tq, imm_interrupt, dev);
+ INIT_DELAYED_WORK(&dev->imm_tq, imm_interrupt);
err = -ENOMEM;
host = scsi_host_alloc(&imm_template, sizeof(imm_struct *));