[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 5/5] esp: correctly accumulate extended messages for PDMA
From: |
Mark Cave-Ayland |
Subject: |
[PATCH 5/5] esp: correctly accumulate extended messages for PDMA |
Date: |
Wed, 19 May 2021 11:08:03 +0100 |
Commit 799d90d818 "esp: transition to message out phase after SATN and stop
command" added logic to correctly handle extended messages for DMA requests
but not for PDMA requests.
Apply the same logic in esp_do_dma() to do_dma_pdma_cb() so that extended
messages terminated with a PDMA request are accumulated correctly. This allows
the ESP device to respond correctly to the SDTR negotiation initiated by the
NetBSD ESP driver without causing errors and timeouts on boot.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/scsi/esp.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index a6f7c6c1bf..2063bf1786 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -493,9 +493,26 @@ static void do_dma_pdma_cb(ESPState *s)
}
s->ti_size = 0;
- s->do_cmd = 0;
- do_cmd(s);
- esp_lower_drq(s);
+ if ((s->rregs[ESP_RSTAT] & 7) == STAT_CD) {
+ /* No command received */
+ if (s->cmdfifo_cdb_offset == fifo8_num_used(&s->cmdfifo)) {
+ return;
+ }
+
+ /* Command has been received */
+ s->do_cmd = 0;
+ do_cmd(s);
+ } else {
+ /*
+ * Extra message out bytes received: update cmdfifo_cdb_offset
+ * and then switch to commmand phase
+ */
+ s->cmdfifo_cdb_offset = fifo8_num_used(&s->cmdfifo);
+ s->rregs[ESP_RSTAT] = STAT_TC | STAT_CD;
+ s->rregs[ESP_RSEQ] = SEQ_CD;
+ s->rregs[ESP_RINTR] |= INTR_BS;
+ esp_raise_irq(s);
+ }
return;
}
--
2.20.1
- [PATCH 0/5] esp: fixes for MacOS toolbox ROM, Mark Cave-Ayland, 2021/05/19
- [PATCH 2/5] esp: handle non-DMA transfers from the target one byte at a time, Mark Cave-Ayland, 2021/05/19
- [PATCH 3/5] esp: ensure PDMA write transfers are flushed from the FIFO to the target immediately, Mark Cave-Ayland, 2021/05/19
- [PATCH 4/5] esp: revert 75ef849696 "esp: correctly fill bus id with requested lun", Mark Cave-Ayland, 2021/05/19
- [PATCH 5/5] esp: correctly accumulate extended messages for PDMA,
Mark Cave-Ayland <=
- [PATCH 1/5] esp: allow non-DMA callback in esp_transfer_data() initial transfer, Mark Cave-Ayland, 2021/05/19
- Re: [PATCH 0/5] esp: fixes for MacOS toolbox ROM, Mark Cave-Ayland, 2021/05/28