[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>
This commit is contained in:
committed by
James Bottomley
parent
dff6de73f9
commit
28424d3a50
@@ -1542,9 +1542,7 @@ part2:
|
|||||||
hostdata->connected = cmd;
|
hostdata->connected = cmd;
|
||||||
hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun);
|
hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun);
|
||||||
|
|
||||||
if (cmd->SCp.ptr != (char *)cmd->sense_buffer) {
|
initialize_SCp(cmd);
|
||||||
initialize_SCp(cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -2280,19 +2278,16 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
|
|||||||
cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16);
|
cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16);
|
||||||
|
|
||||||
#ifdef AUTOSENSE
|
#ifdef AUTOSENSE
|
||||||
if ((cmd->cmnd[0] != REQUEST_SENSE) && (status_byte(cmd->SCp.Status) == CHECK_CONDITION)) {
|
if ((cmd->cmnd[0] == REQUEST_SENSE) &&
|
||||||
dprintk(NDEBUG_AUTOSENSE, ("scsi%d : performing request sense\n", instance->host_no));
|
hostdata->ses.cmd_len) {
|
||||||
cmd->cmnd[0] = REQUEST_SENSE;
|
scsi_eh_restore_cmnd(cmd, &hostdata->ses);
|
||||||
cmd->cmnd[1] &= 0xe0;
|
hostdata->ses.cmd_len = 0 ;
|
||||||
cmd->cmnd[2] = 0;
|
}
|
||||||
cmd->cmnd[3] = 0;
|
|
||||||
cmd->cmnd[4] = sizeof(cmd->sense_buffer);
|
|
||||||
cmd->cmnd[5] = 0;
|
|
||||||
|
|
||||||
cmd->SCp.buffer = NULL;
|
if ((cmd->cmnd[0] != REQUEST_SENSE) && (status_byte(cmd->SCp.Status) == CHECK_CONDITION)) {
|
||||||
cmd->SCp.buffers_residual = 0;
|
scsi_eh_prep_cmnd(cmd, &hostdata->ses, NULL, 0, ~0);
|
||||||
cmd->SCp.ptr = (char *) cmd->sense_buffer;
|
|
||||||
cmd->SCp.this_residual = sizeof(cmd->sense_buffer);
|
dprintk(NDEBUG_AUTOSENSE, ("scsi%d : performing request sense\n", instance->host_no));
|
||||||
|
|
||||||
LIST(cmd, hostdata->issue_queue);
|
LIST(cmd, hostdata->issue_queue);
|
||||||
cmd->host_scribble = (unsigned char *)
|
cmd->host_scribble = (unsigned char *)
|
||||||
|
@@ -30,6 +30,10 @@
|
|||||||
|
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
|
|
||||||
|
#ifdef AUTOSENSE
|
||||||
|
#include <scsi/scsi_eh.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define NCR5380_PUBLIC_RELEASE 7
|
#define NCR5380_PUBLIC_RELEASE 7
|
||||||
#define NCR53C400_PUBLIC_RELEASE 2
|
#define NCR53C400_PUBLIC_RELEASE 2
|
||||||
|
|
||||||
@@ -281,6 +285,9 @@ struct NCR5380_hostdata {
|
|||||||
unsigned pendingr;
|
unsigned pendingr;
|
||||||
unsigned pendingw;
|
unsigned pendingw;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef AUTOSENSE
|
||||||
|
struct scsi_eh_save ses;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
|
@@ -2235,24 +2235,17 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
|
|||||||
cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16);
|
cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16);
|
||||||
|
|
||||||
#ifdef AUTOSENSE
|
#ifdef AUTOSENSE
|
||||||
|
if ((cmd->cmnd[0] == REQUEST_SENSE) &&
|
||||||
|
hostdata->ses.cmd_len) {
|
||||||
|
scsi_eh_restore_cmnd(cmd, &hostdata->ses);
|
||||||
|
hostdata->ses.cmd_len = 0 ;
|
||||||
|
}
|
||||||
|
|
||||||
if ((cmd->cmnd[0] != REQUEST_SENSE) &&
|
if ((cmd->cmnd[0] != REQUEST_SENSE) &&
|
||||||
(status_byte(cmd->SCp.Status) == CHECK_CONDITION)) {
|
(status_byte(cmd->SCp.Status) == CHECK_CONDITION)) {
|
||||||
ASEN_PRINTK("scsi%d: performing request sense\n", HOSTNO);
|
scsi_eh_prep_cmnd(cmd, &hostdata->ses, NULL, 0, ~0);
|
||||||
cmd->cmnd[0] = REQUEST_SENSE;
|
|
||||||
cmd->cmnd[1] &= 0xe0;
|
|
||||||
cmd->cmnd[2] = 0;
|
|
||||||
cmd->cmnd[3] = 0;
|
|
||||||
cmd->cmnd[4] = sizeof(cmd->sense_buffer);
|
|
||||||
cmd->cmnd[5] = 0;
|
|
||||||
cmd->cmd_len = COMMAND_SIZE(cmd->cmnd[0]);
|
|
||||||
|
|
||||||
cmd->use_sg = 0;
|
ASEN_PRINTK("scsi%d: performing request sense\n", HOSTNO);
|
||||||
/* this is initialized from initialize_SCp
|
|
||||||
cmd->SCp.buffer = NULL;
|
|
||||||
cmd->SCp.buffers_residual = 0;
|
|
||||||
*/
|
|
||||||
cmd->request_buffer = (char *) cmd->sense_buffer;
|
|
||||||
cmd->request_bufflen = sizeof(cmd->sense_buffer);
|
|
||||||
|
|
||||||
local_irq_save(flags);
|
local_irq_save(flags);
|
||||||
LIST(cmd,hostdata->issue_queue);
|
LIST(cmd,hostdata->issue_queue);
|
||||||
|
@@ -2254,25 +2254,21 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
|
|||||||
cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16);
|
cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16);
|
||||||
|
|
||||||
#ifdef AUTOSENSE
|
#ifdef AUTOSENSE
|
||||||
|
if ((cmd->cmnd[0] == REQUEST_SENSE) &&
|
||||||
|
hostdata->ses.cmd_len) {
|
||||||
|
scsi_eh_restore_cmnd(cmd, &hostdata->ses);
|
||||||
|
hostdata->ses.cmd_len = 0 ;
|
||||||
|
}
|
||||||
|
|
||||||
if ((cmd->cmnd[0] != REQUEST_SENSE) &&
|
if ((cmd->cmnd[0] != REQUEST_SENSE) &&
|
||||||
(status_byte(cmd->SCp.Status) == CHECK_CONDITION)) {
|
(status_byte(cmd->SCp.Status) == CHECK_CONDITION)) {
|
||||||
|
scsi_eh_prep_cmnd(cmd, &hostdata->ses, NULL, 0, ~0);
|
||||||
ASEN_PRINTK("scsi%d: performing request sense\n",
|
ASEN_PRINTK("scsi%d: performing request sense\n",
|
||||||
HOSTNO);
|
HOSTNO);
|
||||||
cmd->cmnd[0] = REQUEST_SENSE;
|
|
||||||
cmd->cmnd[1] &= 0xe0;
|
|
||||||
cmd->cmnd[2] = 0;
|
|
||||||
cmd->cmnd[3] = 0;
|
|
||||||
cmd->cmnd[4] = sizeof(cmd->sense_buffer);
|
|
||||||
cmd->cmnd[5] = 0;
|
|
||||||
cmd->cmd_len = COMMAND_SIZE(cmd->cmnd[0]);
|
|
||||||
|
|
||||||
cmd->use_sg = 0;
|
|
||||||
/* this is initialized from initialize_SCp
|
/* this is initialized from initialize_SCp
|
||||||
cmd->SCp.buffer = NULL;
|
cmd->SCp.buffer = NULL;
|
||||||
cmd->SCp.buffers_residual = 0;
|
cmd->SCp.buffers_residual = 0;
|
||||||
*/
|
*/
|
||||||
cmd->request_buffer = (char *) cmd->sense_buffer;
|
|
||||||
cmd->request_bufflen = sizeof(cmd->sense_buffer);
|
|
||||||
|
|
||||||
local_irq_save(flags);
|
local_irq_save(flags);
|
||||||
LIST(cmd,hostdata->issue_queue);
|
LIST(cmd,hostdata->issue_queue);
|
||||||
|
Reference in New Issue
Block a user