1 Index: linux/2.4/drivers/scsi/scsi.c
2 diff -c linux/2.4/drivers/scsi/scsi.c:1.1.1.5 linux/2.4/drivers/scsi/scsi.c:1.1.1.5.2.3
3 *** linux/2.4/drivers/scsi/scsi.c:1.1.1.5 Thu Feb 22 16:36:55 2001
4 --- linux/2.4/drivers/scsi/scsi.c Fri Mar 9 14:45:43 2001
9 extern void scsi_old_done(Scsi_Cmnd * SCpnt);
10 extern void scsi_old_times_out(Scsi_Cmnd * SCpnt);
11 + extern int scsi_old_reset(Scsi_Cmnd *SCpnt, unsigned int flag);
14 + * private interface into the new error handling code
16 + extern int scsi_new_reset(Scsi_Cmnd *SCpnt, unsigned int flag);
19 * Function: scsi_initialize_queue()
24 scsi_release_commandblocks(SDpnt);
28 + /* Dummy done routine. We don't want the bogus command used for the
29 + * bus/device reset to find its way into the mid-layer so we intercept
32 + scsi_reset_provider_done_command(Scsi_Cmnd *SCpnt) {
33 + /* Empty function. Some low level drivers will call scsi_done
34 + * (and end up here), others won't bother */
39 + * Function: scsi_reset_provider
41 + * Purpose: Send requested reset to a bus or device at any phase.
43 + * Arguments: device - device to send reset to
44 + * flag - reset type (see scsi.h)
46 + * Returns: SUCCESS/FAILURE.
48 + * Notes: This is used by the SCSI Generic driver to provide
49 + * Bus/Device reset capability.
52 + scsi_reset_provider(Scsi_Device *dev, int flag)
56 + Scsi_Cmnd *SCpnt = ≻
58 + memset(&SCpnt->eh_timeout, 0, sizeof(SCpnt->eh_timeout));
59 + SCpnt->host = dev->host;
60 + SCpnt->device = dev;
61 + SCpnt->target = dev->id;
62 + SCpnt->lun = dev->lun;
63 + SCpnt->channel = dev->channel;
64 + SCpnt->request.rq_status = RQ_SCSI_BUSY;
65 + SCpnt->request.waiting = NULL;
67 + SCpnt->old_use_sg = 0;
68 + SCpnt->old_cmd_len = 0;
69 + SCpnt->underflow = 0;
70 + SCpnt->transfersize = 0;
72 + SCpnt->serial_number = 0;
73 + SCpnt->serial_number_at_timeout = 0;
74 + SCpnt->host_scribble = NULL;
76 + SCpnt->state = SCSI_STATE_INITIALIZING;
77 + SCpnt->owner = SCSI_OWNER_MIDLEVEL;
80 + memset(&SCpnt->cmnd, '\0', sizeof(SCpnt->cmnd));
82 + SCpnt->scsi_done = scsi_reset_provider_done_command;
84 + SCpnt->reset_chain = NULL;
86 + SCpnt->buffer = NULL;
88 + SCpnt->request_buffer = NULL;
89 + SCpnt->request_bufflen = 0;
91 + SCpnt->internal_timeout = NORMAL_TIMEOUT;
92 + SCpnt->abort_reason = DID_ABORT;
96 + SCpnt->sc_data_direction = SCSI_DATA_UNKNOWN;
97 + SCpnt->sc_request = NULL;
98 + SCpnt->sc_magic = SCSI_CMND_MAGIC;
100 + /* sometimes the command can get back into the timer chain, so
101 + * use the pid as an identifier */
105 + if(dev->host->hostt->use_new_eh_code) {
106 + rtn = scsi_new_reset(SCpnt, flag);
108 + unsigned long flags;
109 + spin_lock_irqsave(&io_request_lock, flags);
110 + rtn = scsi_old_reset(SCpnt, flag);
111 + spin_unlock_irqrestore(&io_request_lock, flags);
114 + scsi_delete_timer(SCpnt);
120 Index: linux/2.4/drivers/scsi/scsi.h
121 diff -c linux/2.4/drivers/scsi/scsi.h:1.1.1.3 linux/2.4/drivers/scsi/scsi.h:1.1.1.3.6.1
122 *** linux/2.4/drivers/scsi/scsi.h:1.1.1.3 Thu Jan 11 11:39:27 2001
123 --- linux/2.4/drivers/scsi/scsi.h Wed Feb 28 17:37:27 2001
127 remove_wait_queue(QUEUE, &wait);\
128 current->state = TASK_RUNNING; \
130 + /* old style reset request from external source (private to sg.c and
131 + * scsi_error.c, supplied by scsi_obsolete.c)
133 + #define SCSI_TRY_RESET_DEVICE 1
134 + #define SCSI_TRY_RESET_BUS 2
135 + #define SCSI_TRY_RESET_HOST 3
137 + extern int scsi_reset_provider(Scsi_Device *, int);
141 Index: linux/2.4/drivers/scsi/scsi_error.c
142 diff -c linux/2.4/drivers/scsi/scsi_error.c:1.1.1.3 linux/2.4/drivers/scsi/scsi_error.c:1.1.1.3.2.2
143 *** linux/2.4/drivers/scsi/scsi_error.c:1.1.1.3 Thu Feb 22 16:36:51 2001
144 --- linux/2.4/drivers/scsi/scsi_error.c Fri Mar 16 10:22:36 2001
161 + if(msg_byte(SCpnt->result) == COMMAND_COMPLETE
162 + && status_byte(SCpnt->result) == RESERVATION_CONFLICT)
163 + /* execute reservation conflict processing
179 - case RESERVATION_CONFLICT:
190 + case RESERVATION_CONFLICT:
191 + printk("scsi%d (%d,%d,%d) : RESERVATION CONFLICT\n",
192 + SCpnt->host->host_no, SCpnt->channel,
193 + SCpnt->device->id, SCpnt->device->lun);
194 + return SUCCESS; /* causes immediate I/O error */
202 if (host->eh_notify != NULL)
207 + * Function: scsi_new_reset
209 + * Purpose: Send requested reset to a bus or device at any phase.
211 + * Arguments: SCpnt - command ptr to send reset with (usually a dummy)
212 + * flag - reset type (see scsi.h)
214 + * Returns: SUCCESS/FAILURE.
216 + * Notes: This is used by the SCSI Generic driver to provide
217 + * Bus/Device reset capability.
220 + scsi_new_reset(Scsi_Cmnd *SCpnt, int flag)
225 + case SCSI_TRY_RESET_DEVICE:
226 + rtn = scsi_try_bus_device_reset(SCpnt, 0);
230 + case SCSI_TRY_RESET_BUS:
231 + rtn = scsi_try_bus_reset(SCpnt);
235 + case SCSI_TRY_RESET_HOST:
236 + rtn = scsi_try_host_reset(SCpnt);
245 Index: linux/2.4/drivers/scsi/scsi_obsolete.c
246 diff -c linux/2.4/drivers/scsi/scsi_obsolete.c:1.1.1.3 linux/2.4/drivers/scsi/scsi_obsolete.c:1.1.1.3.2.1
247 *** linux/2.4/drivers/scsi/scsi_obsolete.c:1.1.1.3 Thu Feb 22 16:37:01 2001
248 --- linux/2.4/drivers/scsi/scsi_obsolete.c Wed Feb 28 17:37:27 2001
253 case RESERVATION_CONFLICT:
254 ! printk("scsi%d, channel %d : RESERVATION CONFLICT performing"
255 ! " reset.\n", SCpnt->host->host_no, SCpnt->channel);
256 ! scsi_reset(SCpnt, SCSI_RESET_SYNCHRONOUS);
260 printk("Internal error %s %d \n"
261 "status byte = %d \n", __FILE__,
265 case RESERVATION_CONFLICT:
266 ! /* Most HAs will return an
267 ! * error for this, so usually
268 ! * reservation conflicts will
269 ! * be processed under
270 ! * DID_ERROR code */
271 ! printk("scsi%d (%d,%d,%d) : RESERVATION CONFLICT\n",
272 ! SCpnt->host->host_no, SCpnt->channel,
273 ! SCpnt->device->id, SCpnt->device->lun);
274 ! status = CMD_FINISHED; /* returns I/O error */
278 printk("Internal error %s %d \n"
279 "status byte = %d \n", __FILE__,
283 exit = (DRIVER_HARD | SUGGEST_ABORT);
286 + if(msg_byte(result) == COMMAND_COMPLETE
287 + && status_byte(result) == RESERVATION_CONFLICT) {
288 + printk("scsi%d (%d,%d,%d) : RESERVATION CONFLICT\n",
289 + SCpnt->host->host_no, SCpnt->channel,
290 + SCpnt->device->id, SCpnt->device->lun);
291 + status = CMD_FINISHED; /* returns I/O error */
295 exit = (DRIVER_HARD | SUGGEST_ABORT);
304 + /* This function exports SCSI Bus, Device or Host reset capability
305 + * and is for use with the SCSI generic driver.
308 + scsi_old_reset(Scsi_Cmnd *SCpnt, unsigned int flag)
311 + unsigned int old_flags = SCSI_RESET_SYNCHRONOUS;
314 + case SCSI_TRY_RESET_DEVICE:
315 + /* no suggestion flags to add, device reset is default */
317 + case SCSI_TRY_RESET_BUS:
318 + old_flags |= SCSI_RESET_SUGGEST_BUS_RESET;
320 + case SCSI_TRY_RESET_HOST:
321 + old_flags |= SCSI_RESET_SUGGEST_HOST_RESET;
326 + return (scsi_reset(SCpnt, old_flags) == 0) ? SUCCESS : FAILED;
330 * Overrides for Emacs so that we follow Linus's tabbing style.
331 Index: linux/2.4/drivers/scsi/scsi_syms.c
332 diff -c linux/2.4/drivers/scsi/scsi_syms.c:1.1.1.3 linux/2.4/drivers/scsi/scsi_syms.c:1.1.1.3.2.1
333 *** linux/2.4/drivers/scsi/scsi_syms.c:1.1.1.3 Thu Feb 22 16:37:31 2001
334 --- linux/2.4/drivers/scsi/scsi_syms.c Wed Feb 28 17:37:27 2001
338 EXPORT_SYMBOL(scsi_deregister_blocked_host);
341 + * This symbol is for the sg device only
343 + EXPORT_SYMBOL(scsi_reset_provider);
345 * These are here only while I debug the rest of the scsi stuff.
347 EXPORT_SYMBOL(scsi_hostlist);