Skip to content

Commit

Permalink
esp.c: start removal of manual STAT_TC setting when transfer counter …
Browse files Browse the repository at this point in the history
…reaches zero

This should be exclusively managed by esp_set_tc() rather than being manually
set in multiple places. Start by removing the occurrences exclusive to PDMA
and command completion which are those that can be currently removed without
affecting any test images.

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-8-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 c5d7df2 commit 0c5ae73
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions hw/scsi/esp.c
Original file line number Diff line number Diff line change
Expand Up @@ -611,11 +611,6 @@ static void do_dma_pdma_cb(ESPState *s)
s->async_len -= len;
s->ti_size -= len;
esp_set_tc(s, esp_get_tc(s) - len);

if (esp_get_tc(s) == 0) {
/* Indicate transfer to FIFO is complete */
s->rregs[ESP_RSTAT] |= STAT_TC;
}
return;
}

Expand Down Expand Up @@ -720,9 +715,6 @@ static void esp_do_dma(ESPState *s)
esp_set_tc(s, esp_get_tc(s) - len);
esp_set_pdma_cb(s, DO_DMA_PDMA_CB);
esp_raise_drq(s);

/* Indicate transfer to FIFO is complete */
s->rregs[ESP_RSTAT] |= STAT_TC;
return;
}
}
Expand Down Expand Up @@ -870,7 +862,8 @@ void esp_command_complete(SCSIRequest *req, size_t resid)
* transfers from the target the last byte is still in the FIFO
*/
if (s->ti_size == 0) {
s->rregs[ESP_RSTAT] = STAT_TC | STAT_ST;
s->rregs[ESP_RSTAT] &= ~7;
s->rregs[ESP_RSTAT] |= STAT_ST;
esp_dma_done(s);
esp_lower_drq(s);
}
Expand Down

0 comments on commit 0c5ae73

Please sign in to comment.