[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 29/88] esp.c: fix premature end of phase logic esp_command_comple
|
From: |
Mark Cave-Ayland |
|
Subject: |
[PATCH 29/88] esp.c: fix premature end of phase logic esp_command_complete |
|
Date: |
Fri, 12 Jan 2024 12:53:21 +0000 |
There are two cases here: the first is when the TI command underflows, in which
case we raise INTR_BS to indicate an early change of phase, and the second is
when the TI command overflows because the host requested a transfer for more
data than is available. In the latter case force TC to zero so that the TI
completion logic executes correctly.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/scsi/esp.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index f20026c3dc..c6151d306e 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -887,7 +887,6 @@ void esp_command_complete(SCSIRequest *req, size_t resid)
if (s->ti_size != 0) {
trace_esp_command_complete_unexpected();
}
- s->ti_size = 0;
}
s->async_len = 0;
@@ -897,13 +896,26 @@ void esp_command_complete(SCSIRequest *req, size_t resid)
s->status = req->status;
/*
- * If the transfer is finished, switch to status phase. For non-DMA
- * transfers from the target the last byte is still in the FIFO
+ * Switch to status phase. For non-DMA transfers from the target the last
+ * byte is still in the FIFO
*/
+ esp_set_phase(s, STAT_ST);
if (s->ti_size == 0) {
- esp_set_phase(s, STAT_ST);
+ /*
+ * Transfer complete: force TC to zero just in case a TI command was
+ * requested for more data than the command returns (Solaris 8 does
+ * this)
+ */
+ esp_set_tc(s, 0);
esp_dma_done(s);
- esp_lower_drq(s);
+ } else {
+ /*
+ * Transfer truncated: raise INTR_BS to indicate early change of
+ * phase
+ */
+ s->rregs[ESP_RINTR] |= INTR_BS;
+ esp_raise_irq(s);
+ s->ti_size = 0;
}
if (s->current_req) {
--
2.39.2
- [PATCH 20/88] esp.c: update condition for esp_dma_done() in esp_do_dma() from device path, (continued)
- [PATCH 20/88] esp.c: update condition for esp_dma_done() in esp_do_dma() from device path, Mark Cave-Ayland, 2024/01/12
- [PATCH 23/88] esp.c: don't immediately raise INTR_BS if SCSI data needed in esp_do_dma(), Mark Cave-Ayland, 2024/01/12
- [PATCH 22/88] esp.c: ensure that the PDMA callback is called for every device read, Mark Cave-Ayland, 2024/01/12
- [PATCH 21/88] esp.c: update condition for esp_dma_done() in esp_do_dma() to device path, Mark Cave-Ayland, 2024/01/12
- [PATCH 25/88] esp.c: remove unaligned adjustment in do_dma_pdma_cb() to device path, Mark Cave-Ayland, 2024/01/12
- [PATCH 24/88] esp.c: remove TC adjustment in esp_do_dma() from device path, Mark Cave-Ayland, 2024/01/12
- [PATCH 26/88] esp.c: remove unneeded if() check in esp_transfer_data(), Mark Cave-Ayland, 2024/01/12
- [PATCH 27/88] esp.c: update end of transfer logic at the end of esp_transfer_data(), Mark Cave-Ayland, 2024/01/12
- [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 <=
- [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, 2024/01/12
- [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