patch-2.3.16 linux/drivers/scsi/mesh.c
Next file: linux/drivers/scsi/mesh.h
Previous file: linux/drivers/scsi/ips.h
Back to the patch index
Back to the overall index
- Lines: 140
- Date:
Tue Aug 31 11:35:59 1999
- Orig file:
v2.3.15/linux/drivers/scsi/mesh.c
- Orig date:
Wed Dec 30 10:55:07 1998
diff -u --recursive --new-file v2.3.15/linux/drivers/scsi/mesh.c linux/drivers/scsi/mesh.c
@@ -40,6 +40,8 @@
* - retry arbitration if lost (unless higher levels do this for us)
*/
+#define MESH_NEW_STYLE_EH
+
#if 1
#undef KERN_DEBUG
#define KERN_DEBUG KERN_WARNING
@@ -151,10 +153,12 @@
u8 msgout[16];
struct dbdma_cmd *dma_cmds; /* space for dbdma commands, aligned */
int clk_freq;
+ struct mesh_target tgts[8];
+#ifndef MESH_NEW_STYLE_EH
Scsi_Cmnd *completed_q;
Scsi_Cmnd *completed_qtail;
- struct mesh_target tgts[8];
struct tq_struct tqueue;
+#endif
#ifdef MESH_DBG
int log_ix;
int n_log;
@@ -186,7 +190,9 @@
static void mesh_dump_regs(struct mesh_state *);
static void mesh_start(struct mesh_state *);
static void mesh_start_cmd(struct mesh_state *, Scsi_Cmnd *);
+#ifndef MESH_NEW_STYLE_EH
static void finish_cmds(void *);
+#endif
static void add_sdtr_msg(struct mesh_state *);
static void set_sdtr(struct mesh_state *, int, int);
static void start_phase(struct mesh_state *);
@@ -252,8 +258,10 @@
continue;
}
mesh_host->unique_id = nmeshes;
+#ifndef MODULE
note_scsi_host(mesh, mesh_host);
-
+#endif
+
ms = (struct mesh_state *) mesh_host->hostdata;
if (ms == 0)
panic("no mesh state");
@@ -282,10 +290,10 @@
ms->tgts[tgt].sync_params = ASYNC_PARAMS;
ms->tgts[tgt].current_req = 0;
}
-
+#ifndef MESH_NEW_STYLE_EH
ms->tqueue.routine = finish_cmds;
ms->tqueue.data = ms;
-
+#endif
*prev_statep = ms;
prev_statep = &ms->next;
@@ -428,7 +436,9 @@
{
handle_reset(ms);
restore_flags(flags);
+#ifndef MESH_NEW_STYLE_EH
finish_cmds(ms);
+#endif
ret |= SCSI_RESET_SUCCESS;
}
return ret;
@@ -677,6 +687,7 @@
}
}
+#ifndef MESH_NEW_STYLE_EH
static void
finish_cmds(void *data)
{
@@ -685,18 +696,18 @@
unsigned long flags;
for (;;) {
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&io_request_lock, flags);
cmd = ms->completed_q;
if (cmd == NULL) {
- restore_flags(flags);
+ spin_unlock_irqrestore(&io_request_lock, flags);
break;
}
ms->completed_q = (Scsi_Cmnd *) cmd->host_scribble;
- restore_flags(flags);
(*cmd->scsi_done)(cmd);
+ spin_unlock_irqrestore(&io_request_lock, flags);
}
}
+#endif /* MESH_NEW_STYLE_EH */
static inline void
add_sdtr_msg(struct mesh_state *ms)
@@ -762,8 +773,8 @@
Scsi_Cmnd *cmd = ms->current_req;
struct mesh_target *tp = &ms->tgts[ms->conn_tgt];
- dlog(ms, "start_phase err/exc/fc/seq = %.8x",
- MKWORD(mr->error, mr->exception, mr->fifo_count, mr->sequence));
+ dlog(ms, "start_phase nmo/exc/fc/seq = %.8x",
+ MKWORD(ms->n_msgout, mr->exception, mr->fifo_count, mr->sequence));
out_8(&mr->interrupt, INT_ERROR | INT_EXCEPTION | INT_CMDDONE);
seq = use_active_neg + (ms->n_msgout? SEQ_ATN: 0);
switch (ms->msgphase) {
@@ -1057,6 +1068,7 @@
t = 230; /* wait up to 230us */
while ((mr->bus_status0 & BS0_REQ) == 0) {
if (--t < 0) {
+ dlog(ms, "impatient for req", ms->n_msgout);
ms->msgphase = msg_none;
break;
}
@@ -1643,7 +1655,9 @@
static void
mesh_completed(struct mesh_state *ms, Scsi_Cmnd *cmd)
{
-#if 0
+#ifdef MESH_NEW_STYLE_EH
+ (*cmd->scsi_done)(cmd);
+#else
if (ms->completed_q == NULL)
ms->completed_q = cmd;
else
@@ -1652,9 +1666,7 @@
cmd->host_scribble = NULL;
queue_task(&ms->tqueue, &tq_immediate);
mark_bh(IMMEDIATE_BH);
-#else
- (*cmd->scsi_done)(cmd);
-#endif
+#endif /* MESH_NEW_STYLE_EH */
}
/*
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)