[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 16/42] esp: use pdma_origin directly in esp_pdma_read()/esp_pdma_w
From: |
Mark Cave-Ayland |
Subject: |
[PULL 16/42] esp: use pdma_origin directly in esp_pdma_read()/esp_pdma_write() |
Date: |
Sun, 7 Mar 2021 12:08:24 +0000 |
This is the first step in removing get_pdma_buf() from esp.c.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20210304221103.6369-17-mark.cave-ayland@ilande.co.uk>
---
hw/scsi/esp.c | 34 ++++++++++++++++++++++++++++------
1 file changed, 28 insertions(+), 6 deletions(-)
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index 0fafc866a4..58be98f047 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -153,16 +153,38 @@ static uint8_t *get_pdma_buf(ESPState *s)
static uint8_t esp_pdma_read(ESPState *s)
{
- uint8_t *buf = get_pdma_buf(s);
-
- return buf[s->pdma_cur++];
+ switch (s->pdma_origin) {
+ case PDMA:
+ return s->pdma_buf[s->pdma_cur++];
+ case TI:
+ return s->ti_buf[s->pdma_cur++];
+ case CMD:
+ return s->cmdbuf[s->pdma_cur++];
+ case ASYNC:
+ return s->async_buf[s->pdma_cur++];
+ default:
+ g_assert_not_reached();
+ }
}
static void esp_pdma_write(ESPState *s, uint8_t val)
{
- uint8_t *buf = get_pdma_buf(s);
-
- buf[s->pdma_cur++] = val;
+ switch (s->pdma_origin) {
+ case PDMA:
+ s->pdma_buf[s->pdma_cur++] = val;
+ break;
+ case TI:
+ s->ti_buf[s->pdma_cur++] = val;
+ break;
+ case CMD:
+ s->cmdbuf[s->pdma_cur++] = val;
+ break;
+ case ASYNC:
+ s->async_buf[s->pdma_cur++] = val;
+ break;
+ default:
+ g_assert_not_reached();
+ }
}
static int get_cmd_cb(ESPState *s)
--
2.20.1
- [PULL 06/42] esp: fix esp_reg_read() trace event, (continued)
- [PULL 06/42] esp: fix esp_reg_read() trace event, Mark Cave-Ayland, 2021/03/07
- [PULL 07/42] esp: add PDMA trace events, Mark Cave-Ayland, 2021/03/07
- [PULL 08/42] esp: determine transfer direction directly from SCSI phase, Mark Cave-Ayland, 2021/03/07
- [PULL 09/42] esp: introduce esp_get_tc() and esp_set_tc(), Mark Cave-Ayland, 2021/03/07
- [PULL 10/42] esp: introduce esp_get_stc(), Mark Cave-Ayland, 2021/03/07
- [PULL 11/42] esp: apply transfer length adjustment when STC is zero at TC load time, Mark Cave-Ayland, 2021/03/07
- [PULL 12/42] esp: remove dma_counter from ESPState, Mark Cave-Ayland, 2021/03/07
- [PULL 13/42] esp: remove dma_left from ESPState, Mark Cave-Ayland, 2021/03/07
- [PULL 14/42] esp: remove minlen restriction in handle_ti, Mark Cave-Ayland, 2021/03/07
- [PULL 15/42] esp: introduce esp_pdma_read() and esp_pdma_write() functions, Mark Cave-Ayland, 2021/03/07
- [PULL 16/42] esp: use pdma_origin directly in esp_pdma_read()/esp_pdma_write(),
Mark Cave-Ayland <=
- [PULL 17/42] esp: move pdma_len and TC logic into esp_pdma_read()/esp_pdma_write(), Mark Cave-Ayland, 2021/03/07
- [PULL 18/42] esp: accumulate SCSI commands for PDMA transfers in cmdbuf instead of pdma_buf, Mark Cave-Ayland, 2021/03/07
- [PULL 19/42] esp: remove buf parameter from do_cmd(), Mark Cave-Ayland, 2021/03/07
- [PULL 20/42] esp: remove the buf and buflen parameters from get_cmd(), Mark Cave-Ayland, 2021/03/07
- [PULL 21/42] esp: remove redundant pdma_start from ESPState, Mark Cave-Ayland, 2021/03/07
- [PULL 22/42] esp: move PDMA length adjustments into esp_pdma_read()/esp_pdma_write(), Mark Cave-Ayland, 2021/03/07
- [PULL 23/42] esp: use ti_wptr/ti_rptr to manage the current FIFO position for PDMA, Mark Cave-Ayland, 2021/03/07
- [PULL 24/42] esp: use in-built TC to determine PDMA transfer length, Mark Cave-Ayland, 2021/03/07
- [PULL 25/42] esp: remove CMD pdma_origin, Mark Cave-Ayland, 2021/03/07
- [PULL 26/42] esp: rename get_cmd_cb() to esp_select(), Mark Cave-Ayland, 2021/03/07