aboutsummaryrefslogtreecommitdiff
path: root/hw/scsi
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2024-01-12 12:54:09 +0000
committerMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2024-02-13 19:37:28 +0000
commit215d257964c11d3b6dd1c86973f0a1f7d7d9d7aa (patch)
treecbf07ff48da94bb77432759dd37a658cd1448e7b /hw/scsi
parentacdee66d077371de049489f55a4bda5d1f4246c0 (diff)
downloadqemu-215d257964c11d3b6dd1c86973f0a1f7d7d9d7aa.zip
qemu-215d257964c11d3b6dd1c86973f0a1f7d7d9d7aa.tar.gz
qemu-215d257964c11d3b6dd1c86973f0a1f7d7d9d7aa.tar.bz2
esp.c: only transfer non-DMA MESSAGE OUT phase data for specific commands
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 NetBSD m68k under the Q800 machine once again. 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-78-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Diffstat (limited to 'hw/scsi')
-rw-r--r--hw/scsi/esp.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index 17e2db4..d63039a 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -712,14 +712,13 @@ static void esp_do_nodma(ESPState *s)
switch (esp_get_phase(s)) {
case STAT_MO:
- /* 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);
- s->cmdfifo_cdb_offset += n;
-
switch (s->rregs[ESP_CMD]) {
case CMD_SELATN:
+ /* 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);
+
if (fifo8_num_used(&s->cmdfifo) >= 1) {
/* First byte received, switch to command phase */
esp_set_phase(s, STAT_CD);
@@ -734,6 +733,11 @@ static void esp_do_nodma(ESPState *s)
break;
case CMD_SELATNS:
+ /* Copy one byte from FIFO into cmdfifo */
+ n = esp_fifo_pop_buf(&s->fifo, buf, 1);
+ n = MIN(fifo8_num_free(&s->cmdfifo), n);
+ fifo8_push_all(&s->cmdfifo, buf, n);
+
if (fifo8_num_used(&s->cmdfifo) >= 1) {
/* First byte received, stop in message out phase */
s->rregs[ESP_RSEQ] = SEQ_MO;
@@ -746,6 +750,11 @@ static void esp_do_nodma(ESPState *s)
break;
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);
+
/* ATN remains asserted until FIFO empty */
s->cmdfifo_cdb_offset = fifo8_num_used(&s->cmdfifo);
esp_set_phase(s, STAT_CD);