diff options
Diffstat (limited to 'drivers/scsi/53c700.c')
-rw-r--r-- | drivers/scsi/53c700.c | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c index fabd4be2c985..d7557b932113 100644 --- a/drivers/scsi/53c700.c +++ b/drivers/scsi/53c700.c | |||
@@ -327,6 +327,7 @@ NCR_700_detect(struct scsi_host_template *tpnt, | |||
327 | tpnt->slave_alloc = NCR_700_slave_alloc; | 327 | tpnt->slave_alloc = NCR_700_slave_alloc; |
328 | tpnt->change_queue_depth = NCR_700_change_queue_depth; | 328 | tpnt->change_queue_depth = NCR_700_change_queue_depth; |
329 | tpnt->change_queue_type = NCR_700_change_queue_type; | 329 | tpnt->change_queue_type = NCR_700_change_queue_type; |
330 | tpnt->use_blk_tags = 1; | ||
330 | 331 | ||
331 | if(tpnt->name == NULL) | 332 | if(tpnt->name == NULL) |
332 | tpnt->name = "53c700"; | 333 | tpnt->name = "53c700"; |
@@ -592,19 +593,14 @@ NCR_700_scsi_done(struct NCR_700_Host_Parameters *hostdata, | |||
592 | hostdata->cmd = NULL; | 593 | hostdata->cmd = NULL; |
593 | 594 | ||
594 | if(SCp != NULL) { | 595 | if(SCp != NULL) { |
595 | struct NCR_700_command_slot *slot = | 596 | struct NCR_700_command_slot *slot = |
596 | (struct NCR_700_command_slot *)SCp->host_scribble; | 597 | (struct NCR_700_command_slot *)SCp->host_scribble; |
597 | 598 | ||
598 | dma_unmap_single(hostdata->dev, slot->pCmd, | 599 | dma_unmap_single(hostdata->dev, slot->pCmd, |
599 | MAX_COMMAND_SIZE, DMA_TO_DEVICE); | 600 | MAX_COMMAND_SIZE, DMA_TO_DEVICE); |
600 | if (slot->flags == NCR_700_FLAG_AUTOSENSE) { | 601 | if (slot->flags == NCR_700_FLAG_AUTOSENSE) { |
601 | char *cmnd = NCR_700_get_sense_cmnd(SCp->device); | 602 | char *cmnd = NCR_700_get_sense_cmnd(SCp->device); |
602 | #ifdef NCR_700_DEBUG | ||
603 | printk(" ORIGINAL CMD %p RETURNED %d, new return is %d sense is\n", | ||
604 | SCp, SCp->cmnd[7], result); | ||
605 | scsi_print_sense("53c700", SCp); | ||
606 | 603 | ||
607 | #endif | ||
608 | dma_unmap_single(hostdata->dev, slot->dma_handle, | 604 | dma_unmap_single(hostdata->dev, slot->dma_handle, |
609 | SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE); | 605 | SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE); |
610 | /* restore the old result if the request sense was | 606 | /* restore the old result if the request sense was |
@@ -906,8 +902,10 @@ process_message(struct Scsi_Host *host, struct NCR_700_Host_Parameters *hostdata | |||
906 | /* we're done negotiating */ | 902 | /* we're done negotiating */ |
907 | NCR_700_set_tag_neg_state(SCp->device, NCR_700_FINISHED_TAG_NEGOTIATION); | 903 | NCR_700_set_tag_neg_state(SCp->device, NCR_700_FINISHED_TAG_NEGOTIATION); |
908 | hostdata->tag_negotiated &= ~(1<<scmd_id(SCp)); | 904 | hostdata->tag_negotiated &= ~(1<<scmd_id(SCp)); |
905 | |||
909 | SCp->device->tagged_supported = 0; | 906 | SCp->device->tagged_supported = 0; |
910 | scsi_deactivate_tcq(SCp->device, host->cmd_per_lun); | 907 | scsi_adjust_queue_depth(SCp->device, host->cmd_per_lun); |
908 | scsi_set_tag_type(SCp->device, 0); | ||
911 | } else { | 909 | } else { |
912 | shost_printk(KERN_WARNING, host, | 910 | shost_printk(KERN_WARNING, host, |
913 | "(%d:%d) Unexpected REJECT Message %s\n", | 911 | "(%d:%d) Unexpected REJECT Message %s\n", |
@@ -1432,7 +1430,7 @@ NCR_700_start_command(struct scsi_cmnd *SCp) | |||
1432 | if((hostdata->tag_negotiated & (1<<scmd_id(SCp))) | 1430 | if((hostdata->tag_negotiated & (1<<scmd_id(SCp))) |
1433 | && (slot->tag != SCSI_NO_TAG && SCp->cmnd[0] != REQUEST_SENSE && | 1431 | && (slot->tag != SCSI_NO_TAG && SCp->cmnd[0] != REQUEST_SENSE && |
1434 | slot->flags != NCR_700_FLAG_AUTOSENSE)) { | 1432 | slot->flags != NCR_700_FLAG_AUTOSENSE)) { |
1435 | count += scsi_populate_tag_msg(SCp, &hostdata->msgout[count]); | 1433 | count += spi_populate_tag_msg(&hostdata->msgout[count], SCp); |
1436 | } | 1434 | } |
1437 | 1435 | ||
1438 | if(hostdata->fast && | 1436 | if(hostdata->fast && |
@@ -1772,7 +1770,7 @@ NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *) | |||
1772 | */ | 1770 | */ |
1773 | if(NCR_700_get_depth(SCp->device) != 0 | 1771 | if(NCR_700_get_depth(SCp->device) != 0 |
1774 | && (!(hostdata->tag_negotiated & (1<<scmd_id(SCp))) | 1772 | && (!(hostdata->tag_negotiated & (1<<scmd_id(SCp))) |
1775 | || !blk_rq_tagged(SCp->request))) { | 1773 | || !(SCp->flags & SCMD_TAGGED))) { |
1776 | CDEBUG(KERN_ERR, SCp, "has non zero depth %d\n", | 1774 | CDEBUG(KERN_ERR, SCp, "has non zero depth %d\n", |
1777 | NCR_700_get_depth(SCp->device)); | 1775 | NCR_700_get_depth(SCp->device)); |
1778 | return SCSI_MLQUEUE_DEVICE_BUSY; | 1776 | return SCSI_MLQUEUE_DEVICE_BUSY; |
@@ -1800,7 +1798,7 @@ NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *) | |||
1800 | printk("53c700: scsi%d, command ", SCp->device->host->host_no); | 1798 | printk("53c700: scsi%d, command ", SCp->device->host->host_no); |
1801 | scsi_print_command(SCp); | 1799 | scsi_print_command(SCp); |
1802 | #endif | 1800 | #endif |
1803 | if(blk_rq_tagged(SCp->request) | 1801 | if ((SCp->flags & SCMD_TAGGED) |
1804 | && (hostdata->tag_negotiated &(1<<scmd_id(SCp))) == 0 | 1802 | && (hostdata->tag_negotiated &(1<<scmd_id(SCp))) == 0 |
1805 | && NCR_700_get_tag_neg_state(SCp->device) == NCR_700_START_TAG_NEGOTIATION) { | 1803 | && NCR_700_get_tag_neg_state(SCp->device) == NCR_700_START_TAG_NEGOTIATION) { |
1806 | scmd_printk(KERN_ERR, SCp, "Enabling Tag Command Queuing\n"); | 1804 | scmd_printk(KERN_ERR, SCp, "Enabling Tag Command Queuing\n"); |
@@ -1814,7 +1812,7 @@ NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *) | |||
1814 | * | 1812 | * |
1815 | * FIXME: This will royally screw up on multiple LUN devices | 1813 | * FIXME: This will royally screw up on multiple LUN devices |
1816 | * */ | 1814 | * */ |
1817 | if(!blk_rq_tagged(SCp->request) | 1815 | if (!(SCp->flags & SCMD_TAGGED) |
1818 | && (hostdata->tag_negotiated &(1<<scmd_id(SCp)))) { | 1816 | && (hostdata->tag_negotiated &(1<<scmd_id(SCp)))) { |
1819 | scmd_printk(KERN_INFO, SCp, "Disabling Tag Command Queuing\n"); | 1817 | scmd_printk(KERN_INFO, SCp, "Disabling Tag Command Queuing\n"); |
1820 | hostdata->tag_negotiated &= ~(1<<scmd_id(SCp)); | 1818 | hostdata->tag_negotiated &= ~(1<<scmd_id(SCp)); |
@@ -1911,9 +1909,7 @@ NCR_700_abort(struct scsi_cmnd * SCp) | |||
1911 | { | 1909 | { |
1912 | struct NCR_700_command_slot *slot; | 1910 | struct NCR_700_command_slot *slot; |
1913 | 1911 | ||
1914 | scmd_printk(KERN_INFO, SCp, | 1912 | scmd_printk(KERN_INFO, SCp, "abort command\n"); |
1915 | "New error handler wants to abort command\n\t"); | ||
1916 | scsi_print_command(SCp); | ||
1917 | 1913 | ||
1918 | slot = (struct NCR_700_command_slot *)SCp->host_scribble; | 1914 | slot = (struct NCR_700_command_slot *)SCp->host_scribble; |
1919 | 1915 | ||
@@ -2056,13 +2052,10 @@ NCR_700_slave_configure(struct scsi_device *SDp) | |||
2056 | 2052 | ||
2057 | /* to do here: allocate memory; build a queue_full list */ | 2053 | /* to do here: allocate memory; build a queue_full list */ |
2058 | if(SDp->tagged_supported) { | 2054 | if(SDp->tagged_supported) { |
2059 | scsi_set_tag_type(SDp, MSG_ORDERED_TAG); | 2055 | scsi_adjust_queue_depth(SDp, NCR_700_DEFAULT_TAGS); |
2060 | scsi_activate_tcq(SDp, NCR_700_DEFAULT_TAGS); | ||
2061 | NCR_700_set_tag_neg_state(SDp, NCR_700_START_TAG_NEGOTIATION); | 2056 | NCR_700_set_tag_neg_state(SDp, NCR_700_START_TAG_NEGOTIATION); |
2062 | } else { | ||
2063 | /* initialise to default depth */ | ||
2064 | scsi_adjust_queue_depth(SDp, 0, SDp->host->cmd_per_lun); | ||
2065 | } | 2057 | } |
2058 | |||
2066 | if(hostdata->fast) { | 2059 | if(hostdata->fast) { |
2067 | /* Find the correct offset and period via domain validation */ | 2060 | /* Find the correct offset and period via domain validation */ |
2068 | if (!spi_initial_dv(SDp->sdev_target)) | 2061 | if (!spi_initial_dv(SDp->sdev_target)) |
@@ -2090,7 +2083,7 @@ NCR_700_change_queue_depth(struct scsi_device *SDp, int depth, int reason) | |||
2090 | if (depth > NCR_700_MAX_TAGS) | 2083 | if (depth > NCR_700_MAX_TAGS) |
2091 | depth = NCR_700_MAX_TAGS; | 2084 | depth = NCR_700_MAX_TAGS; |
2092 | 2085 | ||
2093 | scsi_adjust_queue_depth(SDp, scsi_get_tag_type(SDp), depth); | 2086 | scsi_adjust_queue_depth(SDp, depth); |
2094 | return depth; | 2087 | return depth; |
2095 | } | 2088 | } |
2096 | 2089 | ||
@@ -2101,8 +2094,6 @@ static int NCR_700_change_queue_type(struct scsi_device *SDp, int tag_type) | |||
2101 | struct NCR_700_Host_Parameters *hostdata = | 2094 | struct NCR_700_Host_Parameters *hostdata = |
2102 | (struct NCR_700_Host_Parameters *)SDp->host->hostdata[0]; | 2095 | (struct NCR_700_Host_Parameters *)SDp->host->hostdata[0]; |
2103 | 2096 | ||
2104 | scsi_set_tag_type(SDp, tag_type); | ||
2105 | |||
2106 | /* We have a global (per target) flag to track whether TCQ is | 2097 | /* We have a global (per target) flag to track whether TCQ is |
2107 | * enabled, so we'll be turning it off for the entire target here. | 2098 | * enabled, so we'll be turning it off for the entire target here. |
2108 | * our tag algorithm will fail if we mix tagged and untagged commands, | 2099 | * our tag algorithm will fail if we mix tagged and untagged commands, |
@@ -2110,15 +2101,16 @@ static int NCR_700_change_queue_type(struct scsi_device *SDp, int tag_type) | |||
2110 | if (change_tag) | 2101 | if (change_tag) |
2111 | scsi_target_quiesce(SDp->sdev_target); | 2102 | scsi_target_quiesce(SDp->sdev_target); |
2112 | 2103 | ||
2104 | scsi_set_tag_type(SDp, tag_type); | ||
2113 | if (!tag_type) { | 2105 | if (!tag_type) { |
2114 | /* shift back to the default unqueued number of commands | 2106 | /* shift back to the default unqueued number of commands |
2115 | * (the user can still raise this) */ | 2107 | * (the user can still raise this) */ |
2116 | scsi_deactivate_tcq(SDp, SDp->host->cmd_per_lun); | 2108 | scsi_adjust_queue_depth(SDp, SDp->host->cmd_per_lun); |
2117 | hostdata->tag_negotiated &= ~(1 << sdev_id(SDp)); | 2109 | hostdata->tag_negotiated &= ~(1 << sdev_id(SDp)); |
2118 | } else { | 2110 | } else { |
2119 | /* Here, we cleared the negotiation flag above, so this | 2111 | /* Here, we cleared the negotiation flag above, so this |
2120 | * will force the driver to renegotiate */ | 2112 | * will force the driver to renegotiate */ |
2121 | scsi_activate_tcq(SDp, SDp->queue_depth); | 2113 | scsi_adjust_queue_depth(SDp, SDp->queue_depth); |
2122 | if (change_tag) | 2114 | if (change_tag) |
2123 | NCR_700_set_tag_neg_state(SDp, NCR_700_START_TAG_NEGOTIATION); | 2115 | NCR_700_set_tag_neg_state(SDp, NCR_700_START_TAG_NEGOTIATION); |
2124 | } | 2116 | } |