summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/esp_scsi.c
diff options
context:
space:
mode:
authorFinn Thain <fthain@telegraphics.com.au>2018-10-16 16:31:25 +1100
committerMartin K. Petersen <martin.petersen@oracle.com>2018-10-17 21:34:20 -0400
commitfd47d919d0c336e7c22862b51ee94927ffea227a (patch)
tree08caf71e10f8c000181ab8fe75fe1aac97f316f3 /drivers/scsi/esp_scsi.c
parentb7ded0e8b0d11b6df1c4e5aa23a26e6629c21985 (diff)
downloadlinux-fd47d919d0c336e7c22862b51ee94927ffea227a.tar.bz2
scsi: esp_scsi: Track residual for PIO transfers
If a target disconnects during a PIO data transfer the command may fail when the target reconnects: scsi host1: DMA length is zero! scsi host1: cur adr[04380000] len[00000000] The scsi bus is then reset. This happens because the residual reached zero before the transfer was completed. The usual residual calculation relies on the Transfer Count registers. That works for DMA transfers but not for PIO transfers. Fix the problem by storing the PIO transfer residual and using that to correctly calculate bytes_sent. Fixes: 6fe07aaffbf0 ("[SCSI] m68k: new mac_esp scsi driver") Tested-by: Stan Johnson <userm57@yahoo.com> Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Tested-by: Michael Schmitz <schmitzmic@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/esp_scsi.c')
-rw-r--r--drivers/scsi/esp_scsi.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
index 5cd97d2e9105..cba58cf612e2 100644
--- a/drivers/scsi/esp_scsi.c
+++ b/drivers/scsi/esp_scsi.c
@@ -1352,6 +1352,7 @@ static int esp_data_bytes_sent(struct esp *esp, struct esp_cmd_entry *ent,
bytes_sent = esp->data_dma_len;
bytes_sent -= ecount;
+ bytes_sent -= esp->send_cmd_residual;
/*
* The am53c974 has a DMA 'pecularity'. The doc states: