summary refs log tree commit diff stats
path: root/hw/scsi/esp.c
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2024-01-12 12:53:05 +0000
committerMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2024-02-13 19:37:23 +0000
commita034765161b22fdd12d51ec7a30e65750e821107 (patch)
tree9e8b69b596fe52008c69a5d4034ecc6b8cb84141 /hw/scsi/esp.c
parent2572689bc83f683e59dce0591356718023386f43 (diff)
downloadfocaccia-qemu-a034765161b22fdd12d51ec7a30e65750e821107.tar.gz
focaccia-qemu-a034765161b22fdd12d51ec7a30e65750e821107.zip
esp.c: decrement the TC during MESSAGE OUT and COMMAND phases
This is to ensure that STAT_TC is triggered during the right parts of the
transfer when it is controlled exclusively by the TC.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Tested-by: Helge Deller <deller@gmx.de>
Tested-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20240112125420.514425-14-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Diffstat (limited to 'hw/scsi/esp.c')
-rw-r--r--hw/scsi/esp.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index 9e9bbe8431..f08b816aba 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -259,6 +259,7 @@ static uint32_t get_cmd(ESPState *s, uint32_t maxlen)
             s->dma_memory_read(s->dma_opaque, buf, dmalen);
             dmalen = MIN(fifo8_num_free(&s->cmdfifo), dmalen);
             fifo8_push_all(&s->cmdfifo, buf, dmalen);
+            esp_set_tc(s, esp_get_tc(s) - dmalen);
         } else {
             return 0;
         }
@@ -657,6 +658,7 @@ static void esp_do_dma(ESPState *s)
             len = MIN(len, fifo8_num_free(&s->cmdfifo));
             s->dma_memory_read(s->dma_opaque, buf, len);
             fifo8_push_all(&s->cmdfifo, buf, len);
+            esp_set_tc(s, esp_get_tc(s) - len);
         } else {
             esp_set_pdma_cb(s, DO_DMA_PDMA_CB);
             esp_raise_drq(s);