Skip to content

Commit

Permalink
esp.c: consolidate DMA and PDMA logic in STATUS and MESSAGE IN phases
Browse files Browse the repository at this point in the history
This allows the removal of duplicate logic shared between the two implementations.
Note that we restrict esp_raise_drq() to PDMA to help reduce the log verbosity
for normal DMA.

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-83-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
  • Loading branch information
mcayland committed Feb 13, 2024
1 parent 406e8a3 commit 421d1ca
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions hw/scsi/esp.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,12 +593,11 @@ static void esp_do_dma(ESPState *s)

if (s->dma_memory_write) {
s->dma_memory_write(s->dma_opaque, buf, len);
esp_set_tc(s, esp_get_tc(s) - len);
} else {
fifo8_push_all(&s->fifo, buf, len);
esp_set_tc(s, esp_get_tc(s) - len);
}

esp_set_tc(s, esp_get_tc(s) - len);
esp_set_phase(s, STAT_MI);

if (esp_get_tc(s) > 0) {
Expand Down Expand Up @@ -629,12 +628,12 @@ static void esp_do_dma(ESPState *s)

if (s->dma_memory_write) {
s->dma_memory_write(s->dma_opaque, buf, len);
esp_set_tc(s, esp_get_tc(s) - len);
} else {
fifo8_push_all(&s->fifo, buf, len);
esp_set_tc(s, esp_get_tc(s) - len);
}

esp_set_tc(s, esp_get_tc(s) - len);

/* Raise end of command interrupt */
s->rregs[ESP_RINTR] |= INTR_FC;
esp_raise_irq(s);
Expand Down

0 comments on commit 421d1ca

Please sign in to comment.