diff options
author | Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 2024-01-12 12:53:31 +0000 |
---|---|---|
committer | Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 2024-02-13 19:37:28 +0000 |
commit | 844b3a84eaa3ae92e5c178cd985506f94756ad86 (patch) | |
tree | 711658001afe2d382754aac02079a4ba405871b1 /hw/scsi | |
parent | 1454dc765bc943b68ae3f4b0fce84ff202ea8de6 (diff) | |
download | qemu-844b3a84eaa3ae92e5c178cd985506f94756ad86.zip qemu-844b3a84eaa3ae92e5c178cd985506f94756ad86.tar.gz qemu-844b3a84eaa3ae92e5c178cd985506f94756ad86.tar.bz2 |
esp.c: convert do_dma_pdma_db() to switch statement based upon SCSI phase
Currently only the DATA IN and DATA OUT phases are supported.
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-40-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Diffstat (limited to 'hw/scsi')
-rw-r--r-- | hw/scsi/esp.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c index 67d1d39..f6d05b0 100644 --- a/hw/scsi/esp.c +++ b/hw/scsi/esp.c @@ -542,7 +542,6 @@ static void esp_dma_ti_check(ESPState *s) static void do_dma_pdma_cb(ESPState *s) { - int to_device = (esp_get_phase(s) == STAT_DO); uint8_t buf[ESP_CMDFIFO_SZ]; int len; uint32_t n; @@ -582,11 +581,11 @@ static void do_dma_pdma_cb(ESPState *s) return; } - if (!s->current_req) { - return; - } - - if (to_device) { + switch (esp_get_phase(s)) { + case STAT_DO: + if (!s->current_req) { + return; + } /* Copy FIFO data to device */ len = MIN(s->async_len, ESP_FIFO_SZ); len = MIN(len, fifo8_num_used(&s->fifo)); @@ -602,7 +601,12 @@ static void do_dma_pdma_cb(ESPState *s) } esp_dma_ti_check(s); - } else { + break; + + case STAT_DI: + if (!s->current_req) { + return; + } /* Copy device data to FIFO */ len = MIN(s->async_len, esp_get_tc(s)); len = MIN(len, fifo8_num_free(&s->fifo)); @@ -620,6 +624,7 @@ static void do_dma_pdma_cb(ESPState *s) } esp_dma_ti_check(s); + break; } } |