esp: remove dma_left from ESPState
commit6cc88d6bf932a905ce36e933dc078eeb6b54ac92
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Thu, 4 Mar 2021 22:10:34 +0000 (4 22:10 +0000)
committerMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Sun, 7 Mar 2021 10:39:05 +0000 (7 10:39 +0000)
tree51c86f762e37ff6f8211372c20c37a32db5b0365
parent5eb7a23fb22f10f09cecba61e7bf61cecaee3f96
esp: remove dma_left from ESPState

The ESP device already keeps track of the remaining bytes left to transfer via
its TC (transfer counter) register which is decremented for each byte that
is transferred across the SCSI bus.

Switch the transfer logic to use the value of TC instead of dma_left and then
remove dma_left completely, adding logic to the vmstate_esp post_load() function
to transfer the old dma_left value to the TC register during migration from
older versions.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20210304221103.6369-14-mark.cave-ayland@ilande.co.uk>
hw/scsi/esp.c
include/hw/scsi/esp.h