scsi: g_NCR5380: End PDMA transfer correctly on target disconnection
authorOndrej Zary <linux@rainbow-software.org>
Mon, 3 Jul 2017 07:59:05 +0000 (03:59 -0400)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 7 Aug 2017 18:04:00 +0000 (14:04 -0400)
commite9dbadf7881375ebb234ff579838f85df2abe4cf
treec2ce36bb7471f10c4681e50d5809fba8383832ab
parent12b859b70661c5b7d0c37c33f03736b768552e35
scsi: g_NCR5380: End PDMA transfer correctly on target disconnection

When an IRQ arrives during PDMA transfer, pread() and pwrite() return
without waiting for the 53C80 registers to be ready and this ends up
messing up the chip state. This was observed with SONY CDU-55S which is
slow enough to disconnect during 4096-byte reads.

IRQ during PDMA is not an error so don't return -1. Instead, store the
remaining byte count for use by NCR5380_dma_residual().

[Poll for the BASR_END_DMA_TRANSFER condition rather than remove the
error message -- F.T.]

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Tested-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/g_NCR5380.c