[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 05/88] esp: move esp_select() to ESP selection commands from get_
|
From: |
Mark Cave-Ayland |
|
Subject: |
[PATCH 05/88] esp: move esp_select() to ESP selection commands from get_cmd() |
|
Date: |
Fri, 12 Jan 2024 12:52:57 +0000 |
Since the DREQ value depends upon the result of the selection process, add a
workaround to each esp_select() to manually assert DREQ durring the MESSAGE OUT
and COMMAND phases.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/scsi/esp.c | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index 89fce05e58..8c1c6bfc1c 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -263,10 +263,6 @@ static uint32_t get_cmd(ESPState *s, uint32_t maxlen)
dmalen = MIN(fifo8_num_free(&s->cmdfifo), dmalen);
fifo8_push_all(&s->cmdfifo, buf, dmalen);
} else {
- if (esp_select(s) < 0) {
- return -1;
- }
- esp_raise_drq(s);
return 0;
}
} else {
@@ -280,9 +276,6 @@ static uint32_t get_cmd(ESPState *s, uint32_t maxlen)
}
trace_esp_get_cmd(dmalen, target);
- if (esp_select(s) < 0) {
- return -1;
- }
return dmalen;
}
@@ -380,12 +373,18 @@ static void handle_satn(ESPState *s)
return;
}
esp_set_pdma_cb(s, SATN_PDMA_CB);
+ if (esp_select(s) < 0) {
+ return;
+ }
cmdlen = get_cmd(s, ESP_CMDFIFO_SZ);
if (cmdlen > 0) {
s->cmdfifo_cdb_offset = 1;
s->do_cmd = 0;
do_cmd(s);
} else if (cmdlen == 0) {
+ if (s->dma) {
+ esp_raise_drq(s);
+ }
s->do_cmd = 1;
/* Target present, but no cmd yet - switch to command phase */
s->rregs[ESP_RSEQ] = SEQ_CD;
@@ -411,12 +410,18 @@ static void handle_s_without_atn(ESPState *s)
return;
}
esp_set_pdma_cb(s, S_WITHOUT_SATN_PDMA_CB);
+ if (esp_select(s) < 0) {
+ return;
+ }
cmdlen = get_cmd(s, ESP_CMDFIFO_SZ);
if (cmdlen > 0) {
s->cmdfifo_cdb_offset = 0;
s->do_cmd = 0;
do_cmd(s);
} else if (cmdlen == 0) {
+ if (s->dma) {
+ esp_raise_drq(s);
+ }
s->do_cmd = 1;
/* Target present, but no cmd yet - switch to command phase */
s->rregs[ESP_RSEQ] = SEQ_CD;
@@ -446,6 +451,9 @@ static void handle_satn_stop(ESPState *s)
return;
}
esp_set_pdma_cb(s, SATN_STOP_PDMA_CB);
+ if (esp_select(s) < 0) {
+ return;
+ }
cmdlen = get_cmd(s, 1);
if (cmdlen > 0) {
trace_esp_handle_satn_stop(fifo8_num_used(&s->cmdfifo));
@@ -456,6 +464,9 @@ static void handle_satn_stop(ESPState *s)
s->rregs[ESP_RSEQ] = SEQ_MO;
esp_raise_irq(s);
} else if (cmdlen == 0) {
+ if (s->dma) {
+ esp_raise_drq(s);
+ }
s->do_cmd = 1;
/* Target present, switch to message out phase */
s->rregs[ESP_RSEQ] = SEQ_MO;
--
2.39.2
- [PATCH 00/88] esp: rework ESP emulation to use a SCSI phase-based state machine, Mark Cave-Ayland, 2024/01/12
- [PATCH 02/88] esp: move existing request cancel check into esp_select(), Mark Cave-Ayland, 2024/01/12
- [PATCH 04/88] esp: remove FIFO clear from esp_select(), Mark Cave-Ayland, 2024/01/12
- [PATCH 06/88] esp: update esp_set_tc() to set STAT_TC flag, Mark Cave-Ayland, 2024/01/12
- [PATCH 05/88] esp: move esp_select() to ESP selection commands from get_cmd(),
Mark Cave-Ayland <=
- [PATCH 01/88] esp: don't clear cmdfifo when esp_select() fails in get_cmd(), Mark Cave-Ayland, 2024/01/12
- [PATCH 03/88] esp.c: add FIFO wraparound support to esp_fifo_pop_buf(), Mark Cave-Ayland, 2024/01/12
- [PATCH 07/88] esp: start removal of manual STAT_TC setting when transfer counter reaches zero, Mark Cave-Ayland, 2024/01/12
- [PATCH 08/88] esp: move command execution logic to new esp_run_cmd() function, Mark Cave-Ayland, 2024/01/12
- [PATCH 09/88] esp: update TC check logic in do_dma_pdma_cb() to check for TC == 0, Mark Cave-Ayland, 2024/01/12
- [PATCH 10/88] esp: move buffer and TC logic into separate to/from device paths in esp_do_dma(), Mark Cave-Ayland, 2024/01/12
- [PATCH 11/88] esp.c: remove unused case from esp_pdma_read(), Mark Cave-Ayland, 2024/01/12
- [PATCH 12/88] esp.c: don't accumulate directly into cmdfifo, Mark Cave-Ayland, 2024/01/12
- [PATCH 13/88] esp.c: decrement the TC during MESSAGE OUT and COMMAND phases, Mark Cave-Ayland, 2024/01/12