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>
This commit is contained in:
Mark Cave-Ayland 2021-03-04 22:10:34 +00:00
parent 5eb7a23fb2
commit 6cc88d6bf9
2 changed files with 34 additions and 18 deletions

View file

@ -48,8 +48,6 @@ struct ESPState {
uint32_t cmdlen;
uint32_t do_cmd;
/* The amount of data left in the current DMA transfer. */
uint32_t dma_left;
int dma_enabled;
uint32_t async_len;
@ -67,6 +65,9 @@ struct ESPState {
void (*pdma_cb)(ESPState *s);
uint8_t mig_version_id;
/* Legacy fields for vmstate_esp version < 5 */
uint32_t mig_dma_left;
};
#define TYPE_SYSBUS_ESP "sysbus-esp"