esp.c: rename esp_dma_done() to esp_dma_ti_check()

This is because a single DMA request can be transferred using multiple TI
commands, and so a TC equal to zero may not represent the completion of
the SCSI DMA command.

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-32-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
This commit is contained in:
Mark Cave-Ayland 2024-01-12 12:53:23 +00:00
parent af74b3c15d
commit 004826d03e

View File

@ -543,7 +543,7 @@ static void write_response(ESPState *s)
esp_raise_irq(s);
}
static void esp_dma_done(ESPState *s)
static void esp_dma_ti_check(ESPState *s)
{
if (esp_get_tc(s) == 0 && fifo8_num_used(&s->fifo) < 2) {
s->rregs[ESP_RINTR] |= INTR_BS;
@ -613,7 +613,7 @@ static void do_dma_pdma_cb(ESPState *s)
return;
}
esp_dma_done(s);
esp_dma_ti_check(s);
} else {
if (s->async_len == 0 && fifo8_num_used(&s->fifo) < 2) {
/* Defer until the scsi layer has completed */
@ -622,7 +622,7 @@ static void do_dma_pdma_cb(ESPState *s)
return;
}
esp_dma_done(s);
esp_dma_ti_check(s);
/* Copy device data to FIFO */
len = MIN(s->async_len, esp_get_tc(s));
@ -708,7 +708,7 @@ static void esp_do_dma(ESPState *s)
return;
}
esp_dma_done(s);
esp_dma_ti_check(s);
} else {
esp_set_pdma_cb(s, DO_DMA_PDMA_CB);
esp_raise_drq(s);
@ -719,7 +719,7 @@ static void esp_do_dma(ESPState *s)
return;
}
esp_dma_done(s);
esp_dma_ti_check(s);
}
} else {
if (s->dma_memory_write) {
@ -736,7 +736,7 @@ static void esp_do_dma(ESPState *s)
return;
}
esp_dma_done(s);
esp_dma_ti_check(s);
} else {
/* Copy device data to FIFO */
len = MIN(len, fifo8_num_free(&s->fifo));
@ -754,7 +754,7 @@ static void esp_do_dma(ESPState *s)
return;
}
esp_dma_done(s);
esp_dma_ti_check(s);
}
}
}
@ -890,7 +890,7 @@ void esp_command_complete(SCSIRequest *req, size_t resid)
* this)
*/
esp_set_tc(s, 0);
esp_dma_done(s);
esp_dma_ti_check(s);
} else {
/*
* Transfer truncated: raise INTR_BS to indicate early change of
@ -939,7 +939,7 @@ void esp_transfer_data(SCSIRequest *req, uint32_t len)
if (s->ti_cmd == (CMD_TI | CMD_DMA)) {
/* When the SCSI layer returns more data, raise deferred INTR_BS */
esp_dma_done(s);
esp_dma_ti_check(s);
esp_do_dma(s);
} else if (s->ti_cmd == CMD_TI) {