[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 78/88] esp.c: consolidate DMA and PDMA logic in DATA OUT phase
|
From: |
Mark Cave-Ayland |
|
Subject: |
[PATCH 78/88] esp.c: consolidate DMA and PDMA logic in DATA OUT phase |
|
Date: |
Fri, 12 Jan 2024 12:54:10 +0000 |
This allows the removal of duplicate logic shared between the two
implementations.
Note that we restrict esp_raise_drq() to PDMA to help reduce the log verbosity
for normal DMA.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/scsi/esp.c | 35 ++++++++++++-----------------------
1 file changed, 12 insertions(+), 23 deletions(-)
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index d63039af89..394774c379 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -521,40 +521,29 @@ static void esp_do_dma(ESPState *s)
if (len > s->async_len) {
len = s->async_len;
}
+
if (s->dma_memory_read) {
s->dma_memory_read(s->dma_opaque, s->async_buf, len);
-
esp_set_tc(s, esp_get_tc(s) - len);
- s->async_buf += len;
- s->async_len -= len;
- s->ti_size += 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);
- return;
- }
-
- esp_dma_ti_check(s);
} else {
/* Copy FIFO data to device */
len = MIN(s->async_len, ESP_FIFO_SZ);
len = MIN(len, fifo8_num_used(&s->fifo));
- n = esp_fifo_pop_buf(&s->fifo, s->async_buf, len);
- s->async_buf += n;
- s->async_len -= n;
- s->ti_size += n;
-
+ len = esp_fifo_pop_buf(&s->fifo, s->async_buf, len);
esp_raise_drq(s);
+ }
- if (s->async_len == 0 && fifo8_num_used(&s->fifo) < 2) {
- /* Defer until the scsi layer has completed */
- scsi_req_continue(s->current_req);
- return;
- }
+ s->async_buf += len;
+ s->async_len -= len;
+ s->ti_size += len;
- esp_dma_ti_check(s);
+ if (s->async_len == 0 && fifo8_num_used(&s->fifo) < 2) {
+ /* Defer until the scsi layer has completed */
+ scsi_req_continue(s->current_req);
+ return;
}
+
+ esp_dma_ti_check(s);
break;
case STAT_DI:
--
2.39.2
- [PATCH 64/88] esp.c: don't raise INTR_BS interrupt in DATA IN phase until TI command issued, (continued)
- [PATCH 64/88] esp.c: don't raise INTR_BS interrupt in DATA IN phase until TI command issued, Mark Cave-Ayland, 2024/01/12
- [PATCH 50/88] esp.c: move CMD_TI end of message phase detection to esp_do_dma() and do_dma_pdma_cb(), Mark Cave-Ayland, 2024/01/12
- [PATCH 75/88] esp.c: improve ESP_RSEQ logic consolidation, Mark Cave-Ayland, 2024/01/12
- [PATCH 79/88] esp.c: consolidate DMA and PDMA logic in DATA IN phase, Mark Cave-Ayland, 2024/01/12
- [PATCH 71/88] esp.c: don't clear the SCSI phase when reading ESP_RINTR, Mark Cave-Ayland, 2024/01/12
- [PATCH 55/88] esp.c: always use esp_do_dma() in pdma_cb(), Mark Cave-Ayland, 2024/01/12
- [PATCH 70/88] esp.c: ensure that STAT_INT is cleared when reading ESP_RINTR, Mark Cave-Ayland, 2024/01/12
- [PATCH 80/88] esp.c: consolidate DMA and PDMA logic in MESSAGE OUT phase, Mark Cave-Ayland, 2024/01/12
- [PATCH 51/88] esp.c: don't use get_cmd() for CMD_SEL DMA commands, Mark Cave-Ayland, 2024/01/12
- [PATCH 65/88] esp.c: move non-DMA TI logic to separate esp_nodma_ti_dataout() function, Mark Cave-Ayland, 2024/01/12
- [PATCH 78/88] esp.c: consolidate DMA and PDMA logic in DATA OUT phase,
Mark Cave-Ayland <=
- [PATCH 59/88] esp.c: separate logic based upon ESP command in esp_transfer_data(), Mark Cave-Ayland, 2024/01/12
- [PATCH 73/88] esp.c: remove restriction on FIFO read access when DMA memory routines defined, Mark Cave-Ayland, 2024/01/12
- [PATCH 84/88] esp.c: implement DMA Transfer Pad command for DATA phases, Mark Cave-Ayland, 2024/01/12
- [PATCH 53/88] esp.c: replace do_dma_pdma_cb() with esp_do_dma(), Mark Cave-Ayland, 2024/01/12
- [PATCH 58/88] esp.c: separate logic based upon ESP command in esp_command_complete(), Mark Cave-Ayland, 2024/01/12
- [PATCH 61/88] esp.c: remove DATA IN phase logic when reading from FIFO, Mark Cave-Ayland, 2024/01/12
- [PATCH 77/88] esp.c: only transfer non-DMA MESSAGE OUT phase data for specific commands, Mark Cave-Ayland, 2024/01/12
- [PATCH 62/88] esp.c: zero command register when TI command terminates due to phase change, Mark Cave-Ayland, 2024/01/12
- [PATCH 63/88] esp.c: remove unneeded ti_cmd field, Mark Cave-Ayland, 2024/01/12
- [PATCH 82/88] esp.c: consolidate DMA and PDMA logic in STATUS and MESSAGE IN phases, Mark Cave-Ayland, 2024/01/12