summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mac_esp.c
diff options
context:
space:
mode:
authorFinn Thain2018-10-16 07:31:25 +0200
committerGreg Kroah-Hartman2018-11-13 20:08:32 +0100
commit1057c64748b615fdfdd28ea5ca0895675dca5e24 (patch)
treef156609d5a9f7824cc4b41b405e0f5ff99d4f49e /drivers/scsi/mac_esp.c
parentof: Add missing exports of node name compare functions (diff)
downloadkernel-qcow2-linux-1057c64748b615fdfdd28ea5ca0895675dca5e24.tar.gz
kernel-qcow2-linux-1057c64748b615fdfdd28ea5ca0895675dca5e24.tar.xz
kernel-qcow2-linux-1057c64748b615fdfdd28ea5ca0895675dca5e24.zip
scsi: esp_scsi: Track residual for PIO transfers
[ Upstream commit fd47d919d0c336e7c22862b51ee94927ffea227a ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/scsi/mac_esp.c')
-rw-r--r--drivers/scsi/mac_esp.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/scsi/mac_esp.c b/drivers/scsi/mac_esp.c
index eb551f3cc471..71879f2207e0 100644
--- a/drivers/scsi/mac_esp.c
+++ b/drivers/scsi/mac_esp.c
@@ -427,6 +427,8 @@ static void mac_esp_send_pio_cmd(struct esp *esp, u32 addr, u32 esp_count,
scsi_esp_cmd(esp, ESP_CMD_TI);
}
}
+
+ esp->send_cmd_residual = esp_count;
}
static int mac_esp_irq_pending(struct esp *esp)