Commit 0d3d9a42 authored by Finn Thain's avatar Finn Thain Committed by Martin K. Petersen

ncr5380: Use dsprintk() for queue debugging

Print the command pointers in the log messages for debugging queue data
structures. The LIST and REMOVE macros can then be removed.
Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Tested-by: default avatarOndrej Zary <linux@rainbow-software.org>
Tested-by: default avatarMichael Schmitz <schmitzmic@gmail.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent e8a60144
...@@ -828,8 +828,9 @@ static void NCR5380_main(struct work_struct *work) ...@@ -828,8 +828,9 @@ static void NCR5380_main(struct work_struct *work)
*/ */
for (tmp = (struct scsi_cmnd *) hostdata->issue_queue, prev = NULL; tmp; prev = tmp, tmp = (struct scsi_cmnd *) tmp->host_scribble) for (tmp = (struct scsi_cmnd *) hostdata->issue_queue, prev = NULL; tmp; prev = tmp, tmp = (struct scsi_cmnd *) tmp->host_scribble)
{ {
if (prev != tmp) dsprintk(NDEBUG_QUEUES, instance, "main: tmp=%p target=%d busy=%d lun=%llu\n",
dprintk(NDEBUG_LISTS, "MAIN tmp=%p target=%d busy=%d lun=%llu\n", tmp, tmp->device->id, hostdata->busy[tmp->device->id], tmp->device->lun); tmp, scmd_id(tmp), hostdata->busy[scmd_id(tmp)],
tmp->device->lun);
/* When we find one, remove it from the issue queue. */ /* When we find one, remove it from the issue queue. */
if (!(hostdata->busy[tmp->device->id] & if (!(hostdata->busy[tmp->device->id] &
(1 << (u8)(tmp->device->lun & 0xff)))) { (1 << (u8)(tmp->device->lun & 0xff)))) {
...@@ -841,6 +842,9 @@ static void NCR5380_main(struct work_struct *work) ...@@ -841,6 +842,9 @@ static void NCR5380_main(struct work_struct *work)
hostdata->issue_queue = (struct scsi_cmnd *) tmp->host_scribble; hostdata->issue_queue = (struct scsi_cmnd *) tmp->host_scribble;
} }
tmp->host_scribble = NULL; tmp->host_scribble = NULL;
dsprintk(NDEBUG_MAIN | NDEBUG_QUEUES,
instance, "main: removed %p from issue queue %p\n",
tmp, prev);
/* /*
* Attempt to establish an I_T_L nexus here. * Attempt to establish an I_T_L nexus here.
...@@ -848,8 +852,6 @@ static void NCR5380_main(struct work_struct *work) ...@@ -848,8 +852,6 @@ static void NCR5380_main(struct work_struct *work)
* On failure, we must add the command back to the * On failure, we must add the command back to the
* issue queue so we can keep trying. * issue queue so we can keep trying.
*/ */
dprintk(NDEBUG_MAIN|NDEBUG_QUEUES, "scsi%d : main() : command for target %d lun %llu removed from issue_queue\n", instance->host_no, tmp->device->id, tmp->device->lun);
/* /*
* REQUEST SENSE commands are issued without tagged * REQUEST SENSE commands are issued without tagged
* queueing, even on SCSI-II devices because the * queueing, even on SCSI-II devices because the
...@@ -864,8 +866,10 @@ static void NCR5380_main(struct work_struct *work) ...@@ -864,8 +866,10 @@ static void NCR5380_main(struct work_struct *work)
LIST(tmp, hostdata->issue_queue); LIST(tmp, hostdata->issue_queue);
tmp->host_scribble = (unsigned char *) hostdata->issue_queue; tmp->host_scribble = (unsigned char *) hostdata->issue_queue;
hostdata->issue_queue = tmp; hostdata->issue_queue = tmp;
dsprintk(NDEBUG_MAIN | NDEBUG_QUEUES,
instance, "main: select() failed, %p returned to issue queue\n",
tmp);
done = 0; done = 0;
dprintk(NDEBUG_MAIN|NDEBUG_QUEUES, "scsi%d : main(): select() failed, returned to issue_queue\n", instance->host_no);
} }
if (hostdata->connected) if (hostdata->connected)
break; break;
...@@ -1847,8 +1851,11 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) { ...@@ -1847,8 +1851,11 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
/* Accept message by clearing ACK */ /* Accept message by clearing ACK */
sink = 1; sink = 1;
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
dsprintk(NDEBUG_QUEUES, instance,
"COMMAND COMPLETE %p target %d lun %llu\n",
cmd, scmd_id(cmd), cmd->device->lun);
hostdata->connected = NULL; hostdata->connected = NULL;
dprintk(NDEBUG_QUEUES, "scsi%d : command for target %d, lun %llu completed\n", instance->host_no, cmd->device->id, cmd->device->lun);
hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xFF)); hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xFF));
/* /*
...@@ -1881,14 +1888,12 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) { ...@@ -1881,14 +1888,12 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
if ((cmd->cmnd[0] != REQUEST_SENSE) && (status_byte(cmd->SCp.Status) == CHECK_CONDITION)) { if ((cmd->cmnd[0] != REQUEST_SENSE) && (status_byte(cmd->SCp.Status) == CHECK_CONDITION)) {
scsi_eh_prep_cmnd(cmd, &hostdata->ses, NULL, 0, ~0); scsi_eh_prep_cmnd(cmd, &hostdata->ses, NULL, 0, ~0);
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 *)
hostdata->issue_queue; hostdata->issue_queue;
hostdata->issue_queue = (struct scsi_cmnd *) cmd; hostdata->issue_queue = (struct scsi_cmnd *) cmd;
dsprintk(NDEBUG_QUEUES, instance, dsprintk(NDEBUG_AUTOSENSE | NDEBUG_QUEUES,
"REQUEST SENSE cmd %p added to head of issue queue\n", instance, "REQUEST SENSE cmd %p added to head of issue queue\n",
cmd); cmd);
} else { } else {
cmd->scsi_done(cmd); cmd->scsi_done(cmd);
...@@ -1925,7 +1930,10 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) { ...@@ -1925,7 +1930,10 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
hostdata->disconnected_queue; hostdata->disconnected_queue;
hostdata->connected = NULL; hostdata->connected = NULL;
hostdata->disconnected_queue = cmd; hostdata->disconnected_queue = cmd;
dprintk(NDEBUG_QUEUES, "scsi%d : command for target %d lun %llu was moved from connected to" " the disconnected_queue\n", instance->host_no, cmd->device->id, cmd->device->lun); dsprintk(NDEBUG_INFORMATION | NDEBUG_QUEUES,
instance, "connected command %p for target %d lun %llu moved to disconnected queue\n",
cmd, scmd_id(cmd), cmd->device->lun);
/* /*
* Restore phase bits to 0 so an interrupted selection, * Restore phase bits to 0 so an interrupted selection,
* arbitration can resume. * arbitration can resume.
...@@ -2178,7 +2186,11 @@ static void NCR5380_reselect(struct Scsi_Host *instance) { ...@@ -2178,7 +2186,11 @@ static void NCR5380_reselect(struct Scsi_Host *instance) {
break; break;
} }
} }
if (!tmp) {
if (tmp) {
dsprintk(NDEBUG_RESELECTION | NDEBUG_QUEUES, instance,
"reselect: removed %p from disconnected queue\n", tmp);
} else {
shost_printk(KERN_ERR, instance, "target bitmask 0x%02x lun %d not in disconnected queue.\n", shost_printk(KERN_ERR, instance, "target bitmask 0x%02x lun %d not in disconnected queue.\n",
target_mask, lun); target_mask, lun);
/* /*
......
...@@ -936,10 +936,8 @@ static void NCR5380_main(struct work_struct *work) ...@@ -936,10 +936,8 @@ static void NCR5380_main(struct work_struct *work)
prev = NULL; tmp; prev = tmp, tmp = NEXT(tmp)) { prev = NULL; tmp; prev = tmp, tmp = NEXT(tmp)) {
u8 lun = tmp->device->lun; u8 lun = tmp->device->lun;
dprintk(NDEBUG_LISTS, dsprintk(NDEBUG_QUEUES, instance, "main: tmp=%p target=%d busy=%d lun=%d\n",
"MAIN tmp=%p target=%d busy=%d lun=%d\n", tmp, scmd_id(tmp), hostdata->busy[scmd_id(tmp)], lun);
tmp, scmd_id(tmp), hostdata->busy[scmd_id(tmp)],
lun);
/* When we find one, remove it from the issue queue. */ /* When we find one, remove it from the issue queue. */
if ( if (
#ifdef SUPPORT_TAGS #ifdef SUPPORT_TAGS
...@@ -956,6 +954,10 @@ static void NCR5380_main(struct work_struct *work) ...@@ -956,6 +954,10 @@ static void NCR5380_main(struct work_struct *work)
hostdata->issue_queue = NEXT(tmp); hostdata->issue_queue = NEXT(tmp);
} }
SET_NEXT(tmp, NULL); SET_NEXT(tmp, NULL);
dsprintk(NDEBUG_MAIN | NDEBUG_QUEUES,
instance, "main: removed %p from issue queue %p\n",
tmp, prev);
hostdata->retain_dma_intr++; hostdata->retain_dma_intr++;
/* /*
...@@ -964,9 +966,6 @@ static void NCR5380_main(struct work_struct *work) ...@@ -964,9 +966,6 @@ static void NCR5380_main(struct work_struct *work)
* On failure, we must add the command back to the * On failure, we must add the command back to the
* issue queue so we can keep trying. * issue queue so we can keep trying.
*/ */
dprintk(NDEBUG_MAIN, "scsi%d: main(): command for target %d "
"lun %d removed from issue_queue\n",
HOSTNO, tmp->device->id, lun);
/* /*
* REQUEST SENSE commands are issued without tagged * REQUEST SENSE commands are issued without tagged
* queueing, even on SCSI-II devices because the * queueing, even on SCSI-II devices because the
...@@ -989,13 +988,14 @@ static void NCR5380_main(struct work_struct *work) ...@@ -989,13 +988,14 @@ static void NCR5380_main(struct work_struct *work)
LIST(tmp, hostdata->issue_queue); LIST(tmp, hostdata->issue_queue);
SET_NEXT(tmp, hostdata->issue_queue); SET_NEXT(tmp, hostdata->issue_queue);
hostdata->issue_queue = tmp; hostdata->issue_queue = tmp;
dsprintk(NDEBUG_MAIN | NDEBUG_QUEUES,
instance, "main: select() failed, %p returned to issue queue\n",
tmp);
#ifdef SUPPORT_TAGS #ifdef SUPPORT_TAGS
cmd_free_tag(tmp); cmd_free_tag(tmp);
#endif #endif
hostdata->retain_dma_intr--; hostdata->retain_dma_intr--;
done = 0; done = 0;
dprintk(NDEBUG_MAIN, "scsi%d: main(): select() failed, "
"returned to issue_queue\n", HOSTNO);
} }
if (hostdata->connected) if (hostdata->connected)
break; break;
...@@ -2017,8 +2017,9 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) ...@@ -2017,8 +2017,9 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
case COMMAND_COMPLETE: case COMMAND_COMPLETE:
/* Accept message by clearing ACK */ /* Accept message by clearing ACK */
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
dprintk(NDEBUG_QUEUES, "scsi%d: command for target %d, lun %llu " dsprintk(NDEBUG_QUEUES, instance,
"completed\n", HOSTNO, cmd->device->id, cmd->device->lun); "COMMAND COMPLETE %p target %d lun %llu\n",
cmd, scmd_id(cmd), cmd->device->lun);
hostdata->connected = NULL; hostdata->connected = NULL;
#ifdef SUPPORT_TAGS #ifdef SUPPORT_TAGS
...@@ -2067,13 +2068,11 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) ...@@ -2067,13 +2068,11 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
(status_byte(cmd->SCp.Status) == CHECK_CONDITION)) { (status_byte(cmd->SCp.Status) == CHECK_CONDITION)) {
scsi_eh_prep_cmnd(cmd, &hostdata->ses, NULL, 0, ~0); scsi_eh_prep_cmnd(cmd, &hostdata->ses, NULL, 0, ~0);
dprintk(NDEBUG_AUTOSENSE, "scsi%d: performing request sense\n", HOSTNO);
LIST(cmd,hostdata->issue_queue); LIST(cmd,hostdata->issue_queue);
SET_NEXT(cmd, hostdata->issue_queue); SET_NEXT(cmd, hostdata->issue_queue);
hostdata->issue_queue = (struct scsi_cmnd *) cmd; hostdata->issue_queue = (struct scsi_cmnd *) cmd;
dsprintk(NDEBUG_QUEUES, instance, dsprintk(NDEBUG_AUTOSENSE | NDEBUG_QUEUES,
"REQUEST SENSE cmd %p added to head of issue queue\n", instance, "REQUEST SENSE cmd %p added to head of issue queue\n",
cmd); cmd);
} else { } else {
cmd->scsi_done(cmd); cmd->scsi_done(cmd);
...@@ -2124,10 +2123,10 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) ...@@ -2124,10 +2123,10 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
SET_NEXT(cmd, hostdata->disconnected_queue); SET_NEXT(cmd, hostdata->disconnected_queue);
hostdata->connected = NULL; hostdata->connected = NULL;
hostdata->disconnected_queue = cmd; hostdata->disconnected_queue = cmd;
dprintk(NDEBUG_QUEUES, "scsi%d: command for target %d lun %llu was " dsprintk(NDEBUG_INFORMATION | NDEBUG_QUEUES,
"moved from connected to the " instance, "connected command %p for target %d lun %llu moved to disconnected queue\n",
"disconnected_queue\n", HOSTNO, cmd, scmd_id(cmd), cmd->device->lun);
cmd->device->id, cmd->device->lun);
/* /*
* Restore phase bits to 0 so an interrupted selection, * Restore phase bits to 0 so an interrupted selection,
* arbitration can resume. * arbitration can resume.
...@@ -2427,7 +2426,11 @@ static void NCR5380_reselect(struct Scsi_Host *instance) ...@@ -2427,7 +2426,11 @@ static void NCR5380_reselect(struct Scsi_Host *instance)
} }
} }
if (!tmp) { if (tmp) {
dsprintk(NDEBUG_RESELECTION | NDEBUG_QUEUES, instance,
"reselect: removed %p from disconnected queue\n", tmp);
} else {
#ifdef SUPPORT_TAGS #ifdef SUPPORT_TAGS
shost_printk(KERN_ERR, instance, "target bitmask 0x%02x lun %d tag %d not in disconnected queue.\n", shost_printk(KERN_ERR, instance, "target bitmask 0x%02x lun %d tag %d not in disconnected queue.\n",
target_mask, lun, tag); target_mask, lun, tag);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment