[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 38/88] esp.c: convert esp_do_dma() to switch statement based upon
|
From: |
Mark Cave-Ayland |
|
Subject: |
[PATCH 38/88] esp.c: convert esp_do_dma() to switch statement based upon SCSI phase |
|
Date: |
Fri, 12 Jan 2024 12:53:30 +0000 |
Currently only the DATA IN and DATA OUT phases are supported.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/scsi/esp.c | 40 +++++++++++++++++++++++++++-------------
1 file changed, 27 insertions(+), 13 deletions(-)
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index de8d98082a..67d1d39db2 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -626,7 +626,6 @@ static void do_dma_pdma_cb(ESPState *s)
static void esp_do_dma(ESPState *s)
{
uint32_t len, cmdlen;
- int to_device = (esp_get_phase(s) == STAT_DO);
uint8_t buf[ESP_CMDFIFO_SZ];
int n;
@@ -681,17 +680,19 @@ static void esp_do_dma(ESPState *s)
}
return;
}
- if (!s->current_req) {
- return;
- }
- if (s->async_len == 0 && esp_get_tc(s) && s->ti_size) {
- /* Defer until data is available. */
- return;
- }
- if (len > s->async_len) {
- len = s->async_len;
- }
- if (to_device) {
+
+ switch (esp_get_phase(s)) {
+ case STAT_DO:
+ if (!s->current_req) {
+ return;
+ }
+ if (s->async_len == 0 && esp_get_tc(s) && s->ti_size) {
+ /* Defer until data is available. */
+ return;
+ }
+ 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);
@@ -727,7 +728,19 @@ static void esp_do_dma(ESPState *s)
esp_dma_ti_check(s);
}
- } else {
+ break;
+
+ case STAT_DI:
+ if (!s->current_req) {
+ return;
+ }
+ if (s->async_len == 0 && esp_get_tc(s) && s->ti_size) {
+ /* Defer until data is available. */
+ return;
+ }
+ if (len > s->async_len) {
+ len = s->async_len;
+ }
if (s->dma_memory_write) {
s->dma_memory_write(s->dma_opaque, s->async_buf, len);
@@ -762,6 +775,7 @@ static void esp_do_dma(ESPState *s)
esp_dma_ti_check(s);
}
+ break;
}
}
--
2.39.2
- [PATCH 28/88] esp.c: consolidate async_len and TC == 0 checks in do_dma_pdma_cb() and esp_do_dma(), (continued)
- [PATCH 28/88] esp.c: consolidate async_len and TC == 0 checks in do_dma_pdma_cb() and esp_do_dma(), Mark Cave-Ayland, 2024/01/12
- [PATCH 30/88] esp.c: move TC and FIFO check logic into esp_dma_done(), Mark Cave-Ayland, 2024/01/12
- [PATCH 29/88] esp.c: fix premature end of phase logic esp_command_complete, Mark Cave-Ayland, 2024/01/12
- [PATCH 34/88] esp.c: update esp_do_dma() bypass if async_len is zero to include non-zero transfer check, Mark Cave-Ayland, 2024/01/12
- [PATCH 35/88] esp.c: move end of SCSI transfer check after TC adjustment in do_dma_pdma_cb(), Mark Cave-Ayland, 2024/01/12
- [PATCH 33/88] esp.c: copy logic for do_cmd transfers from do_dma_pdma_cb() to esp_do_dma(), Mark Cave-Ayland, 2024/01/12
- [PATCH 31/88] esp.c: rename esp_dma_done() to esp_dma_ti_check(), Mark Cave-Ayland, 2024/01/12
- [PATCH 32/88] esp.c: copy PDMA logic for transfers to device from do_dma_pdma_cb() to esp_do_dma(), Mark Cave-Ayland, 2024/01/12
- [PATCH 36/88] esp.c: remove s_without_satn_pdma_cb() PDMA callback, Mark Cave-Ayland, 2024/01/12
- [PATCH 37/88] esp.c: introduce esp_get_phase() function, Mark Cave-Ayland, 2024/01/12
- [PATCH 38/88] esp.c: convert esp_do_dma() to switch statement based upon SCSI phase,
Mark Cave-Ayland <=
- [PATCH 39/88] esp.c: convert do_dma_pdma_db() to switch statement based upon SCSI phase, Mark Cave-Ayland, 2024/01/12
- [PATCH 42/88] esp.c: convert do_dma_pdma_cb() do_cmd path to check for SCSI phase instead, Mark Cave-Ayland, 2024/01/12
- [PATCH 43/88] esp.c: convert esp_do_nodma() do_cmd path to check for SCSI phase instead, Mark Cave-Ayland, 2024/01/12
- [PATCH 40/88] esp.c: convert esp_do_nodma() to switch statement based upon SCSI phase, Mark Cave-Ayland, 2024/01/12
- [PATCH 41/88] esp.c: convert esp_do_dma() do_cmd path to check for SCSI phase instead, Mark Cave-Ayland, 2024/01/12
- [PATCH 45/88] esp.c: remove do_cmd from ESPState, Mark Cave-Ayland, 2024/01/12
- [PATCH 47/88] esp.c: untangle MESSAGE OUT and COMMAND phase logic in do_dma_pdma_cb(), Mark Cave-Ayland, 2024/01/12
- [PATCH 44/88] esp.c: convert esp_reg_write() do_cmd path to check for SCSI phase instead, Mark Cave-Ayland, 2024/01/12
- [PATCH 49/88] esp.c: move CMD_SELATN end of message phase detection to esp_do_dma() and do_dma_pdma_cb(), Mark Cave-Ayland, 2024/01/12
- [PATCH 46/88] esp.c: untangle MESSAGE OUT and COMMAND phase logic in esp_do_dma(), Mark Cave-Ayland, 2024/01/12