[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 21/42] esp: remove redundant pdma_start from ESPState
From: |
Mark Cave-Ayland |
Subject: |
[PULL 21/42] esp: remove redundant pdma_start from ESPState |
Date: |
Sun, 7 Mar 2021 12:08:29 +0000 |
Now that PDMA SCSI commands are accumulated in cmdbuf in the same way as normal
commands, the existing logic for locating the start of the SCSI command in
cmdbuf via cmdlen can be used. This enables the PDMA-specific pdma_start and
also get_pdma_buf() to be removed.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20210304221103.6369-22-mark.cave-ayland@ilande.co.uk>
---
hw/scsi/esp.c | 19 ++-----------------
include/hw/scsi/esp.h | 1 -
2 files changed, 2 insertions(+), 18 deletions(-)
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index 44fddf082c..38c05e97c3 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -131,24 +131,10 @@ static void set_pdma(ESPState *s, enum pdma_origin_id
origin,
uint32_t index, uint32_t len)
{
s->pdma_origin = origin;
- s->pdma_start = index;
s->pdma_cur = index;
s->pdma_len = len;
}
-static uint8_t *get_pdma_buf(ESPState *s)
-{
- switch (s->pdma_origin) {
- case TI:
- return s->ti_buf;
- case CMD:
- return s->cmdbuf;
- case ASYNC:
- return s->async_buf;
- }
- return NULL;
-}
-
static uint8_t esp_pdma_read(ESPState *s)
{
uint32_t dmalen = esp_get_tc(s);
@@ -339,7 +325,7 @@ static void s_without_satn_pdma_cb(ESPState *s)
}
s->do_cmd = 0;
if (s->cmdlen) {
- do_busid_cmd(s, get_pdma_buf(s) + s->pdma_start, 0);
+ do_busid_cmd(s, s->cmdbuf, 0);
}
}
@@ -441,7 +427,7 @@ static void esp_dma_done(ESPState *s)
static void do_dma_pdma_cb(ESPState *s)
{
int to_device = ((s->rregs[ESP_RSTAT] & 7) == STAT_DO);
- int len = s->pdma_cur - s->pdma_start;
+ int len = s->pdma_cur;
if (s->do_cmd) {
s->ti_size = 0;
@@ -867,7 +853,6 @@ static const VMStateDescription vmstate_esp_pdma = {
.fields = (VMStateField[]) {
VMSTATE_INT32(pdma_origin, ESPState),
VMSTATE_UINT32(pdma_len, ESPState),
- VMSTATE_UINT32(pdma_start, ESPState),
VMSTATE_UINT32(pdma_cur, ESPState),
VMSTATE_END_OF_LIST()
}
diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h
index 600d0c31ab..55b0aee762 100644
--- a/include/hw/scsi/esp.h
+++ b/include/hw/scsi/esp.h
@@ -58,7 +58,6 @@ struct ESPState {
void (*dma_cb)(ESPState *s);
int pdma_origin;
uint32_t pdma_len;
- uint32_t pdma_start;
uint32_t pdma_cur;
void (*pdma_cb)(ESPState *s);
--
2.20.1
- [PULL 11/42] esp: apply transfer length adjustment when STC is zero at TC load time, (continued)
- [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, 2021/03/07
- [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 <=
- [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
- [PULL 28/42] esp: use FIFO for PDMA transfers between initiator and device, Mark Cave-Ayland, 2021/03/07
- [PULL 27/42] esp: fix PDMA target selection, Mark Cave-Ayland, 2021/03/07
- [PULL 29/42] esp: remove pdma_origin from ESPState, Mark Cave-Ayland, 2021/03/07
- [PULL 30/42] esp: add 4 byte PDMA read and write transfers, Mark Cave-Ayland, 2021/03/07
- [PULL 31/42] esp: implement FIFO flush command, Mark Cave-Ayland, 2021/03/07