aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2024-01-12 12:52:54 +0000
committerMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2024-02-13 19:37:02 +0000
commitcf40a5e42084e157e1cd7bed2619f3b44fbb3fe8 (patch)
tree58c98ce3fec7a636924e215bdd49b61c16e7d626
parentf3ace75be8d472f6ffd40501147f08c9616faf1c (diff)
downloadqemu-cf40a5e42084e157e1cd7bed2619f3b44fbb3fe8.zip
qemu-cf40a5e42084e157e1cd7bed2619f3b44fbb3fe8.tar.gz
qemu-cf40a5e42084e157e1cd7bed2619f3b44fbb3fe8.tar.bz2
esp.c: move existing request cancel check into esp_select()
Since get_cmd() can be called multiple times during a mixed FIFO/DMA request, move the existing request cancel check into esp_select() which always occurs at the start of new SCSI request. 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-3-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
-rw-r--r--hw/scsi/esp.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index 68d07ed..b382865 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -209,6 +209,11 @@ static int esp_select(ESPState *s)
s->ti_size = 0;
fifo8_reset(&s->fifo);
+ if (s->current_req) {
+ /* Started a new command before the old one finished. Cancel it. */
+ scsi_req_cancel(s->current_req);
+ }
+
s->current_dev = scsi_device_find(&s->bus, 0, target, 0);
if (!s->current_dev) {
/* No such drive */
@@ -235,11 +240,6 @@ static uint32_t get_cmd(ESPState *s, uint32_t maxlen)
uint32_t dmalen, n;
int target;
- if (s->current_req) {
- /* Started a new command before the old one finished. Cancel it. */
- scsi_req_cancel(s->current_req);
- }
-
target = s->wregs[ESP_WBUSID] & BUSID_DID;
if (s->dma) {
dmalen = MIN(esp_get_tc(s), maxlen);