diff options
author | Boaz Harrosh <bharrosh@panasas.com> | 2007-09-10 15:37:45 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-10-12 14:55:07 -0400 |
commit | 28424d3a503d43482a5537e556f7b7652d8e56d8 (patch) | |
tree | cfdfea7e635461887b735610d00d15fc41e6d19a /drivers/scsi | |
parent | dff6de73f9d29868729cb1d21d86ba0dbd28871f (diff) |
[SCSI] NCR5380: Use scsi_eh API for REQUEST_SENSE invocation
- Use new scsi_eh_prep/restor_cmnd() for synchronous
REQUEST_SENSE invocation.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/NCR5380.c | 23 | ||||
-rw-r--r-- | drivers/scsi/NCR5380.h | 7 | ||||
-rw-r--r-- | drivers/scsi/atari_NCR5380.c | 23 | ||||
-rw-r--r-- | drivers/scsi/sun3_NCR5380.c | 18 |
4 files changed, 31 insertions, 40 deletions
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c index 5b27966d37f0..988f0bc5eda5 100644 --- a/drivers/scsi/NCR5380.c +++ b/drivers/scsi/NCR5380.c | |||
@@ -1542,9 +1542,7 @@ part2: | |||
1542 | hostdata->connected = cmd; | 1542 | hostdata->connected = cmd; |
1543 | hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun); | 1543 | hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun); |
1544 | 1544 | ||
1545 | if (cmd->SCp.ptr != (char *)cmd->sense_buffer) { | 1545 | initialize_SCp(cmd); |
1546 | initialize_SCp(cmd); | ||
1547 | } | ||
1548 | 1546 | ||
1549 | return 0; | 1547 | return 0; |
1550 | 1548 | ||
@@ -2280,19 +2278,16 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) { | |||
2280 | cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16); | 2278 | cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16); |
2281 | 2279 | ||
2282 | #ifdef AUTOSENSE | 2280 | #ifdef AUTOSENSE |
2281 | if ((cmd->cmnd[0] == REQUEST_SENSE) && | ||
2282 | hostdata->ses.cmd_len) { | ||
2283 | scsi_eh_restore_cmnd(cmd, &hostdata->ses); | ||
2284 | hostdata->ses.cmd_len = 0 ; | ||
2285 | } | ||
2286 | |||
2283 | if ((cmd->cmnd[0] != REQUEST_SENSE) && (status_byte(cmd->SCp.Status) == CHECK_CONDITION)) { | 2287 | if ((cmd->cmnd[0] != REQUEST_SENSE) && (status_byte(cmd->SCp.Status) == CHECK_CONDITION)) { |
2288 | scsi_eh_prep_cmnd(cmd, &hostdata->ses, NULL, 0, ~0); | ||
2289 | |||
2284 | dprintk(NDEBUG_AUTOSENSE, ("scsi%d : performing request sense\n", instance->host_no)); | 2290 | dprintk(NDEBUG_AUTOSENSE, ("scsi%d : performing request sense\n", instance->host_no)); |
2285 | cmd->cmnd[0] = REQUEST_SENSE; | ||
2286 | cmd->cmnd[1] &= 0xe0; | ||
2287 | cmd->cmnd[2] = 0; | ||
2288 | cmd->cmnd[3] = 0; | ||
2289 | cmd->cmnd[4] = sizeof(cmd->sense_buffer); | ||
2290 | cmd->cmnd[5] = 0; | ||
2291 | |||
2292 | cmd->SCp.buffer = NULL; | ||
2293 | cmd->SCp.buffers_residual = 0; | ||
2294 | cmd->SCp.ptr = (char *) cmd->sense_buffer; | ||
2295 | cmd->SCp.this_residual = sizeof(cmd->sense_buffer); | ||
2296 | 2291 | ||
2297 | LIST(cmd, hostdata->issue_queue); | 2292 | LIST(cmd, hostdata->issue_queue); |
2298 | cmd->host_scribble = (unsigned char *) | 2293 | cmd->host_scribble = (unsigned char *) |
diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h index bccf13f71532..bdc468c9e1d9 100644 --- a/drivers/scsi/NCR5380.h +++ b/drivers/scsi/NCR5380.h | |||
@@ -30,6 +30,10 @@ | |||
30 | 30 | ||
31 | #include <linux/interrupt.h> | 31 | #include <linux/interrupt.h> |
32 | 32 | ||
33 | #ifdef AUTOSENSE | ||
34 | #include <scsi/scsi_eh.h> | ||
35 | #endif | ||
36 | |||
33 | #define NCR5380_PUBLIC_RELEASE 7 | 37 | #define NCR5380_PUBLIC_RELEASE 7 |
34 | #define NCR53C400_PUBLIC_RELEASE 2 | 38 | #define NCR53C400_PUBLIC_RELEASE 2 |
35 | 39 | ||
@@ -281,6 +285,9 @@ struct NCR5380_hostdata { | |||
281 | unsigned pendingr; | 285 | unsigned pendingr; |
282 | unsigned pendingw; | 286 | unsigned pendingw; |
283 | #endif | 287 | #endif |
288 | #ifdef AUTOSENSE | ||
289 | struct scsi_eh_save ses; | ||
290 | #endif | ||
284 | }; | 291 | }; |
285 | 292 | ||
286 | #ifdef __KERNEL__ | 293 | #ifdef __KERNEL__ |
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c index 743df4c20cf4..52d0b87e9aa4 100644 --- a/drivers/scsi/atari_NCR5380.c +++ b/drivers/scsi/atari_NCR5380.c | |||
@@ -2235,24 +2235,17 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) | |||
2235 | cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16); | 2235 | cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16); |
2236 | 2236 | ||
2237 | #ifdef AUTOSENSE | 2237 | #ifdef AUTOSENSE |
2238 | if ((cmd->cmnd[0] == REQUEST_SENSE) && | ||
2239 | hostdata->ses.cmd_len) { | ||
2240 | scsi_eh_restore_cmnd(cmd, &hostdata->ses); | ||
2241 | hostdata->ses.cmd_len = 0 ; | ||
2242 | } | ||
2243 | |||
2238 | if ((cmd->cmnd[0] != REQUEST_SENSE) && | 2244 | if ((cmd->cmnd[0] != REQUEST_SENSE) && |
2239 | (status_byte(cmd->SCp.Status) == CHECK_CONDITION)) { | 2245 | (status_byte(cmd->SCp.Status) == CHECK_CONDITION)) { |
2246 | scsi_eh_prep_cmnd(cmd, &hostdata->ses, NULL, 0, ~0); | ||
2247 | |||
2240 | ASEN_PRINTK("scsi%d: performing request sense\n", HOSTNO); | 2248 | ASEN_PRINTK("scsi%d: performing request sense\n", HOSTNO); |
2241 | cmd->cmnd[0] = REQUEST_SENSE; | ||
2242 | cmd->cmnd[1] &= 0xe0; | ||
2243 | cmd->cmnd[2] = 0; | ||
2244 | cmd->cmnd[3] = 0; | ||
2245 | cmd->cmnd[4] = sizeof(cmd->sense_buffer); | ||
2246 | cmd->cmnd[5] = 0; | ||
2247 | cmd->cmd_len = COMMAND_SIZE(cmd->cmnd[0]); | ||
2248 | |||
2249 | cmd->use_sg = 0; | ||
2250 | /* this is initialized from initialize_SCp | ||
2251 | cmd->SCp.buffer = NULL; | ||
2252 | cmd->SCp.buffers_residual = 0; | ||
2253 | */ | ||
2254 | cmd->request_buffer = (char *) cmd->sense_buffer; | ||
2255 | cmd->request_bufflen = sizeof(cmd->sense_buffer); | ||
2256 | 2249 | ||
2257 | local_irq_save(flags); | 2250 | local_irq_save(flags); |
2258 | LIST(cmd,hostdata->issue_queue); | 2251 | LIST(cmd,hostdata->issue_queue); |
diff --git a/drivers/scsi/sun3_NCR5380.c b/drivers/scsi/sun3_NCR5380.c index 376953776ea3..dc15a22105f7 100644 --- a/drivers/scsi/sun3_NCR5380.c +++ b/drivers/scsi/sun3_NCR5380.c | |||
@@ -2254,25 +2254,21 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) | |||
2254 | cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16); | 2254 | cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16); |
2255 | 2255 | ||
2256 | #ifdef AUTOSENSE | 2256 | #ifdef AUTOSENSE |
2257 | if ((cmd->cmnd[0] == REQUEST_SENSE) && | ||
2258 | hostdata->ses.cmd_len) { | ||
2259 | scsi_eh_restore_cmnd(cmd, &hostdata->ses); | ||
2260 | hostdata->ses.cmd_len = 0 ; | ||
2261 | } | ||
2262 | |||
2257 | if ((cmd->cmnd[0] != REQUEST_SENSE) && | 2263 | if ((cmd->cmnd[0] != REQUEST_SENSE) && |
2258 | (status_byte(cmd->SCp.Status) == CHECK_CONDITION)) { | 2264 | (status_byte(cmd->SCp.Status) == CHECK_CONDITION)) { |
2265 | scsi_eh_prep_cmnd(cmd, &hostdata->ses, NULL, 0, ~0); | ||
2259 | ASEN_PRINTK("scsi%d: performing request sense\n", | 2266 | ASEN_PRINTK("scsi%d: performing request sense\n", |
2260 | HOSTNO); | 2267 | HOSTNO); |
2261 | cmd->cmnd[0] = REQUEST_SENSE; | ||
2262 | cmd->cmnd[1] &= 0xe0; | ||
2263 | cmd->cmnd[2] = 0; | ||
2264 | cmd->cmnd[3] = 0; | ||
2265 | cmd->cmnd[4] = sizeof(cmd->sense_buffer); | ||
2266 | cmd->cmnd[5] = 0; | ||
2267 | cmd->cmd_len = COMMAND_SIZE(cmd->cmnd[0]); | ||
2268 | |||
2269 | cmd->use_sg = 0; | ||
2270 | /* this is initialized from initialize_SCp | 2268 | /* this is initialized from initialize_SCp |
2271 | cmd->SCp.buffer = NULL; | 2269 | cmd->SCp.buffer = NULL; |
2272 | cmd->SCp.buffers_residual = 0; | 2270 | cmd->SCp.buffers_residual = 0; |
2273 | */ | 2271 | */ |
2274 | cmd->request_buffer = (char *) cmd->sense_buffer; | ||
2275 | cmd->request_bufflen = sizeof(cmd->sense_buffer); | ||
2276 | 2272 | ||
2277 | local_irq_save(flags); | 2273 | local_irq_save(flags); |
2278 | LIST(cmd,hostdata->issue_queue); | 2274 | LIST(cmd,hostdata->issue_queue); |