aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2021-03-04 22:10:42 +0000
committerMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2021-03-07 10:39:05 +0000
commit2c573cfe19cd3f4cad7540ec542c40e54305d56a (patch)
treeb73eeb210d650077cb63e355b2c9d0f6cd808a42
parentcfcea0f9d76f56d1a756a5ead28f5a8900b750e3 (diff)
downloadqemu-2c573cfe19cd3f4cad7540ec542c40e54305d56a.zip
qemu-2c573cfe19cd3f4cad7540ec542c40e54305d56a.tar.gz
qemu-2c573cfe19cd3f4cad7540ec542c40e54305d56a.tar.bz2
esp: remove redundant pdma_start from ESPState
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>
-rw-r--r--hw/scsi/esp.c19
-rw-r--r--include/hw/scsi/esp.h1
2 files changed, 2 insertions, 18 deletions
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index 44fddf0..38c05e9 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 600d0c3..55b0aee 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);