cciss: factor out fix target status processing code from sendcmd functions
Factor out code to process target status of completed commands in sendcmd() and sendcmd_withirq_core(), and fix problem that bad target status was ignored in sendcmd_withirq_core. Signed-off-by: Stephen M. Cameron <scameron@beardog.cca.cpqcorp.net> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>hifive-unleashed-5.1
parent
b57695fe13
commit
3c2ab40296
|
@ -2267,6 +2267,31 @@ static int fill_cmd(CommandList_struct *c, __u8 cmd, int ctlr, void *buff,
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int check_target_status(ctlr_info_t *h, CommandList_struct *c)
|
||||||
|
{
|
||||||
|
switch (c->err_info->ScsiStatus) {
|
||||||
|
case SAM_STAT_GOOD:
|
||||||
|
return IO_OK;
|
||||||
|
case SAM_STAT_CHECK_CONDITION:
|
||||||
|
switch (0xf & c->err_info->SenseInfo[2]) {
|
||||||
|
case 0: return IO_OK; /* no sense */
|
||||||
|
case 1: return IO_OK; /* recovered error */
|
||||||
|
default:
|
||||||
|
printk(KERN_WARNING "cciss%d: cmd 0x%02x "
|
||||||
|
"check condition, sense key = 0x%02x\n",
|
||||||
|
h->ctlr, c->Request.CDB[0],
|
||||||
|
c->err_info->SenseInfo[2]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printk(KERN_WARNING "cciss%d: cmd 0x%02x"
|
||||||
|
"scsi status = 0x%02x\n", h->ctlr,
|
||||||
|
c->Request.CDB[0], c->err_info->ScsiStatus);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return IO_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
static int sendcmd_withirq_core(ctlr_info_t *h, CommandList_struct *c)
|
static int sendcmd_withirq_core(ctlr_info_t *h, CommandList_struct *c)
|
||||||
{
|
{
|
||||||
DECLARE_COMPLETION_ONSTACK(wait);
|
DECLARE_COMPLETION_ONSTACK(wait);
|
||||||
|
@ -2290,16 +2315,7 @@ resend_cmd2:
|
||||||
|
|
||||||
switch (c->err_info->CommandStatus) {
|
switch (c->err_info->CommandStatus) {
|
||||||
case CMD_TARGET_STATUS:
|
case CMD_TARGET_STATUS:
|
||||||
printk(KERN_WARNING "cciss: cmd 0x%02x "
|
return_status = check_target_status(h, c);
|
||||||
"has completed with errors\n", c->Request.CDB[0]);
|
|
||||||
if (c->err_info->ScsiStatus) {
|
|
||||||
printk(KERN_WARNING "cciss: cmd 0x%02x "
|
|
||||||
"has SCSI Status = %x\n",
|
|
||||||
c->Request.CDB[0], c->err_info->ScsiStatus);
|
|
||||||
if (c->err_info->ScsiStatus == SAM_STAT_CHECK_CONDITION)
|
|
||||||
printk(KERN_WARNING "sense key = 0x%02x\n",
|
|
||||||
0xf & c->err_info->SenseInfo[2]);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case CMD_DATA_UNDERRUN:
|
case CMD_DATA_UNDERRUN:
|
||||||
case CMD_DATA_OVERRUN:
|
case CMD_DATA_OVERRUN:
|
||||||
|
@ -2710,33 +2726,29 @@ resend_cmd1:
|
||||||
printk(KERN_WARNING "cciss%d: retried %p too many "
|
printk(KERN_WARNING "cciss%d: retried %p too many "
|
||||||
"times\n", h->ctlr, c);
|
"times\n", h->ctlr, c);
|
||||||
status = IO_ERROR;
|
status = IO_ERROR;
|
||||||
goto cleanup1;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c->err_info->CommandStatus == CMD_UNABORTABLE) {
|
if (c->err_info->CommandStatus == CMD_UNABORTABLE) {
|
||||||
printk(KERN_WARNING "cciss%d: command could not be "
|
printk(KERN_WARNING "cciss%d: command could not be "
|
||||||
"aborted.\n", h->ctlr);
|
"aborted.\n", h->ctlr);
|
||||||
status = IO_ERROR;
|
status = IO_ERROR;
|
||||||
goto cleanup1;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c->err_info->CommandStatus == CMD_TARGET_STATUS) {
|
||||||
|
status = check_target_status(h, c);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
printk(KERN_WARNING "cciss%d: sendcmd error\n", h->ctlr);
|
printk(KERN_WARNING "cciss%d: sendcmd error\n", h->ctlr);
|
||||||
printk(KERN_WARNING "cmd = 0x%02x, CommandStatus = 0x%02x\n",
|
printk(KERN_WARNING "cmd = 0x%02x, CommandStatus = 0x%02x\n",
|
||||||
c->Request.CDB[0], c->err_info->CommandStatus);
|
c->Request.CDB[0], c->err_info->CommandStatus);
|
||||||
if (c->err_info->CommandStatus == CMD_TARGET_STATUS) {
|
|
||||||
printk(KERN_WARNING "Target status = 0x%02x\n",
|
|
||||||
c->err_info->ScsiStatus);
|
|
||||||
if (c->err_info->ScsiStatus == 2) /* chk cond */
|
|
||||||
printk(KERN_WARNING "Sense key = 0x%02x\n",
|
|
||||||
0xf & c->err_info->SenseInfo[2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
status = IO_ERROR;
|
status = IO_ERROR;
|
||||||
goto cleanup1;
|
break;
|
||||||
|
|
||||||
} while (1);
|
} while (1);
|
||||||
|
|
||||||
cleanup1:
|
|
||||||
/* unlock the data buffer from DMA */
|
/* unlock the data buffer from DMA */
|
||||||
buff_dma_handle.val32.lower = c->SG[0].Addr.lower;
|
buff_dma_handle.val32.lower = c->SG[0].Addr.lower;
|
||||||
buff_dma_handle.val32.upper = c->SG[0].Addr.upper;
|
buff_dma_handle.val32.upper = c->SG[0].Addr.upper;
|
||||||
|
|
Loading…
Reference in New Issue