diff options
author | James Bottomley <James.Bottomley@steeleye.com> | 2005-11-28 16:41:58 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2005-12-01 16:59:43 -0500 |
commit | 349cd7cfe6ba0b2e7cd2afdc3e70ede845311afe (patch) | |
tree | de4a8552c91377a86c928ceca12807dc5d30c379 /drivers/scsi/scsi_transport_spi.c | |
parent | dce200670d63615120de17d4aed0a4fd777cc825 (diff) |
[SCSI] SPI DV: be more conservative about echo buffer usage
Some SCSI devices apparently get very confused if we try to use the
echo buffer on a non-DT negotiated bus (this mirrors the problems of
using PPR on non-LVD for some devices). The fix is to be far more
conservative about when we use an echo buffer. With this patch, we'll
now see what parameters are negotiated by the read only test, and only
look for an echo buffer if DT is negotiated.
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/scsi_transport_spi.c')
-rw-r--r-- | drivers/scsi/scsi_transport_spi.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index 718a2bc4ed5e..38a53b5f9e9a 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c | |||
@@ -812,12 +812,10 @@ spi_dv_device_internal(struct scsi_device *sdev, u8 *buffer) | |||
812 | if (!scsi_device_sync(sdev) && !scsi_device_dt(sdev)) | 812 | if (!scsi_device_sync(sdev) && !scsi_device_dt(sdev)) |
813 | return; | 813 | return; |
814 | 814 | ||
815 | /* see if the device has an echo buffer. If it does we can | 815 | /* len == -1 is the signal that we need to ascertain the |
816 | * do the SPI pattern write tests */ | 816 | * presence of an echo buffer before trying to use it. len == |
817 | 817 | * 0 means we don't have an echo buffer */ | |
818 | len = 0; | 818 | len = -1; |
819 | if (scsi_device_dt(sdev)) | ||
820 | len = spi_dv_device_get_echo_buffer(sdev, buffer); | ||
821 | 819 | ||
822 | retry: | 820 | retry: |
823 | 821 | ||
@@ -840,11 +838,23 @@ spi_dv_device_internal(struct scsi_device *sdev, u8 *buffer) | |||
840 | if (spi_min_period(starget) == 8) | 838 | if (spi_min_period(starget) == 8) |
841 | DV_SET(pcomp_en, 1); | 839 | DV_SET(pcomp_en, 1); |
842 | } | 840 | } |
841 | /* Do the read only INQUIRY tests */ | ||
842 | spi_dv_retrain(sdev, buffer, buffer + sdev->inquiry_len, | ||
843 | spi_dv_device_compare_inquiry); | ||
844 | /* See if we actually managed to negotiate and sustain DT */ | ||
845 | if (i->f->get_dt) | ||
846 | i->f->get_dt(starget); | ||
847 | |||
848 | /* see if the device has an echo buffer. If it does we can do | ||
849 | * the SPI pattern write tests. Because of some broken | ||
850 | * devices, we *only* try this on a device that has actually | ||
851 | * negotiated DT */ | ||
852 | |||
853 | if (len == -1 && spi_dt(starget)) | ||
854 | len = spi_dv_device_get_echo_buffer(sdev, buffer); | ||
843 | 855 | ||
844 | if (len == 0) { | 856 | if (len <= 0) { |
845 | starget_printk(KERN_INFO, starget, "Domain Validation skipping write tests\n"); | 857 | starget_printk(KERN_INFO, starget, "Domain Validation skipping write tests\n"); |
846 | spi_dv_retrain(sdev, buffer, buffer + len, | ||
847 | spi_dv_device_compare_inquiry); | ||
848 | return; | 858 | return; |
849 | } | 859 | } |
850 | 860 | ||