aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2024-01-12 12:53:27 +0000
committerMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2024-02-13 19:37:27 +0000
commit1b2e34ca2e86f6487a9fc8b575f3ea6ce294fc95 (patch)
treeade6a967b03b9d72854cab05422af09201a928ce
parent4460b86a04c705c009a0756f3ee67ec4831c56da (diff)
downloadqemu-1b2e34ca2e86f6487a9fc8b575f3ea6ce294fc95.zip
qemu-1b2e34ca2e86f6487a9fc8b575f3ea6ce294fc95.tar.gz
qemu-1b2e34ca2e86f6487a9fc8b575f3ea6ce294fc95.tar.bz2
esp.c: move end of SCSI transfer check after TC adjustment in do_dma_pdma_cb()
Now it is possible to move the end of SCSI transfer check to after the TC adjustment in do_dma_pdma_cb() when transferring data from the device without triggering an assert() in the SCSI code. This brings this check in line with all the others in esp_do_dma() and do_dma_pdma_cb(). 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-36-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
-rw-r--r--hw/scsi/esp.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index 9647be4..df4d5f8 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -615,15 +615,6 @@ static void do_dma_pdma_cb(ESPState *s)
esp_dma_ti_check(s);
} else {
- if (s->async_len == 0 && fifo8_num_used(&s->fifo) < 2) {
- /* Defer until the scsi layer has completed */
- scsi_req_continue(s->current_req);
- s->data_in_ready = false;
- return;
- }
-
- esp_dma_ti_check(s);
-
/* Copy device data to FIFO */
len = MIN(s->async_len, esp_get_tc(s));
len = MIN(len, fifo8_num_free(&s->fifo));
@@ -632,6 +623,15 @@ static void do_dma_pdma_cb(ESPState *s)
s->async_len -= len;
s->ti_size -= len;
esp_set_tc(s, esp_get_tc(s) - len);
+
+ if (s->async_len == 0 && fifo8_num_used(&s->fifo) < 2) {
+ /* Defer until the scsi layer has completed */
+ scsi_req_continue(s->current_req);
+ s->data_in_ready = false;
+ return;
+ }
+
+ esp_dma_ti_check(s);
}
}