[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 76/88] esp.c: only transfer non-DMA COMMAND phase data for specifi
From: |
Mark Cave-Ayland |
Subject: |
[PULL 76/88] esp.c: only transfer non-DMA COMMAND phase data for specific commands |
Date: |
Tue, 13 Feb 2024 19:40:40 +0000 |
The contents of the FIFO should only be copied to cmdfifo for ESP commands that
are sending data to the SCSI bus, which are the SEL_* commands and the TI
command. Otherwise any incoming data should be held in the FIFO as normal.
This fixes booting of really old 32-bit SPARC Linux kernels such as Aurelien's
debian_etch_sparc_small.qcow2 test image.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Tested-by: Helge Deller <deller@gmx.de>
Tested-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20240112125420.514425-77-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/scsi/esp.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index ca26415d5f..17e2db442c 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -757,13 +757,13 @@ static void esp_do_nodma(ESPState *s)
break;
case STAT_CD:
- /* Copy FIFO into cmdfifo */
- n = esp_fifo_pop_buf(&s->fifo, buf, fifo8_num_used(&s->fifo));
- n = MIN(fifo8_num_free(&s->cmdfifo), n);
- fifo8_push_all(&s->cmdfifo, buf, n);
-
switch (s->rregs[ESP_CMD]) {
case CMD_TI:
+ /* Copy FIFO into cmdfifo */
+ n = esp_fifo_pop_buf(&s->fifo, buf, fifo8_num_used(&s->fifo));
+ n = MIN(fifo8_num_free(&s->cmdfifo), n);
+ fifo8_push_all(&s->cmdfifo, buf, n);
+
cmdlen = fifo8_num_used(&s->cmdfifo);
trace_esp_handle_ti_cmd(cmdlen);
@@ -788,6 +788,11 @@ static void esp_do_nodma(ESPState *s)
case CMD_SEL | CMD_DMA:
case CMD_SELATN | CMD_DMA:
+ /* Copy FIFO into cmdfifo */
+ n = esp_fifo_pop_buf(&s->fifo, buf, fifo8_num_used(&s->fifo));
+ n = MIN(fifo8_num_free(&s->cmdfifo), n);
+ fifo8_push_all(&s->cmdfifo, buf, n);
+
/* Handle when DMA transfer is terminated by non-DMA FIFO write */
if (esp_cdb_length(s) && esp_cdb_length(s) ==
fifo8_num_used(&s->cmdfifo) - s->cmdfifo_cdb_offset) {
@@ -798,7 +803,11 @@ static void esp_do_nodma(ESPState *s)
case CMD_SEL:
case CMD_SELATN:
- /* FIFO already contain entire CDB */
+ /* FIFO already contain entire CDB: copy to cmdfifo and execute */
+ n = esp_fifo_pop_buf(&s->fifo, buf, fifo8_num_used(&s->fifo));
+ n = MIN(fifo8_num_free(&s->cmdfifo), n);
+ fifo8_push_all(&s->cmdfifo, buf, n);
+
do_cmd(s);
break;
}
--
2.39.2
- [PULL 87/88] esp.c: switch TypeInfo registration to use DEFINE_TYPES() macro, (continued)
- [PULL 87/88] esp.c: switch TypeInfo registration to use DEFINE_TYPES() macro, Mark Cave-Ayland, 2024/02/13
- [PULL 67/88] esp.c: replace get_cmd() with esp_do_nodma(), Mark Cave-Ayland, 2024/02/13
- [PULL 53/88] esp.c: replace do_dma_pdma_cb() with esp_do_dma(), Mark Cave-Ayland, 2024/02/13
- [PULL 88/88] esp.c: add my copyright to the file, Mark Cave-Ayland, 2024/02/13
- [PULL 83/88] esp.c: replace n variable with len in esp_do_nodma(), Mark Cave-Ayland, 2024/02/13
- [PULL 52/88] esp.c: move CMD_SELATNS end of command logic to esp_do_dma() and do_dma_pdma_cb(), Mark Cave-Ayland, 2024/02/13
- [PULL 62/88] esp.c: zero command register when TI command terminates due to phase change, Mark Cave-Ayland, 2024/02/13
- [PULL 77/88] esp.c: only transfer non-DMA MESSAGE OUT phase data for specific commands, Mark Cave-Ayland, 2024/02/13
- [PULL 55/88] esp.c: always use esp_do_dma() in pdma_cb(), Mark Cave-Ayland, 2024/02/13
- [PULL 85/88] esp.c: rename irq_data IRQ to drq_irq, Mark Cave-Ayland, 2024/02/13
- [PULL 76/88] esp.c: only transfer non-DMA COMMAND phase data for specific commands,
Mark Cave-Ayland <=
- [PULL 66/88] esp.c: process non-DMA FIFO writes in esp_do_nodma(), Mark Cave-Ayland, 2024/02/13
- [PULL 63/88] esp.c: remove unneeded ti_cmd field, Mark Cave-Ayland, 2024/02/13
- [PULL 50/88] esp.c: move CMD_TI end of message phase detection to esp_do_dma() and do_dma_pdma_cb(), Mark Cave-Ayland, 2024/02/13
- [PULL 86/88] esp.c: keep track of the DRQ state during DMA, Mark Cave-Ayland, 2024/02/13
- [PULL 61/88] esp.c: remove DATA IN phase logic when reading from FIFO, Mark Cave-Ayland, 2024/02/13
- [PULL 68/88] esp.c: move write_response() non-DMA logic to esp_do_nodma(), Mark Cave-Ayland, 2024/02/13
- [PULL 74/88] esp.c: handle non-DMA FIFO writes used to terminate DMA commands, Mark Cave-Ayland, 2024/02/13
- [PULL 59/88] esp.c: separate logic based upon ESP command in esp_transfer_data(), Mark Cave-Ayland, 2024/02/13
- [PULL 72/88] esp.c: handle TC underflow for DMA SCSI requests, Mark Cave-Ayland, 2024/02/13
- [PULL 75/88] esp.c: improve ESP_RSEQ logic consolidation, Mark Cave-Ayland, 2024/02/13