aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2021-03-04 22:10:29 +0000
committerMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2021-03-07 10:39:05 +0000
commit4ca2ba6fb0bdf1099a742a361d1e2ad227c3bbf4 (patch)
tree13118f0cffc8c2c04101282b49f657516f1190dd
parent960ebfd94e8f6ea879472e7efb84b1704f685d39 (diff)
downloadqemu-4ca2ba6fb0bdf1099a742a361d1e2ad227c3bbf4.zip
qemu-4ca2ba6fb0bdf1099a742a361d1e2ad227c3bbf4.tar.gz
qemu-4ca2ba6fb0bdf1099a742a361d1e2ad227c3bbf4.tar.bz2
esp: determine transfer direction directly from SCSI phase
The transfer direction is currently determined by checking the sign of ti_size but as this series progresses ti_size can be zero at the end of the transfer. Use the SCSI phase to determine the transfer direction as used in other SCSI controller implementations. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20210304221103.6369-9-mark.cave-ayland@ilande.co.uk>
-rw-r--r--hw/scsi/esp.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index e0676ae..5365523 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -356,7 +356,7 @@ static void esp_dma_done(ESPState *s)
static void do_dma_pdma_cb(ESPState *s)
{
- int to_device = (s->ti_size < 0);
+ int to_device = ((s->rregs[ESP_RSTAT] & 7) == STAT_DO);
int len = s->pdma_cur - s->pdma_start;
if (s->do_cmd) {
s->ti_size = 0;
@@ -392,7 +392,7 @@ static void do_dma_pdma_cb(ESPState *s)
static void esp_do_dma(ESPState *s)
{
uint32_t len;
- int to_device;
+ int to_device = ((s->rregs[ESP_RSTAT] & 7) == STAT_DO);
len = s->dma_left;
if (s->do_cmd) {
@@ -425,7 +425,6 @@ static void esp_do_dma(ESPState *s)
if (len > s->async_len) {
len = s->async_len;
}
- to_device = (s->ti_size < 0);
if (to_device) {
if (s->dma_memory_read) {
s->dma_memory_read(s->dma_opaque, s->async_buf, len);