esp.c: consolidate DMA and PDMA logic in DATA OUT phase
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-79-mark.cave-ayland@ilande.co.uk> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
This commit is contained in:
parent
215d257964
commit
0d17ce8212
@ -521,10 +521,18 @@ static void esp_do_dma(ESPState *s)
|
|||||||
if (len > s->async_len) {
|
if (len > s->async_len) {
|
||||||
len = s->async_len;
|
len = s->async_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->dma_memory_read) {
|
if (s->dma_memory_read) {
|
||||||
s->dma_memory_read(s->dma_opaque, s->async_buf, len);
|
s->dma_memory_read(s->dma_opaque, s->async_buf, len);
|
||||||
|
|
||||||
esp_set_tc(s, esp_get_tc(s) - len);
|
esp_set_tc(s, esp_get_tc(s) - len);
|
||||||
|
} else {
|
||||||
|
/* Copy FIFO data to device */
|
||||||
|
len = MIN(s->async_len, ESP_FIFO_SZ);
|
||||||
|
len = MIN(len, fifo8_num_used(&s->fifo));
|
||||||
|
len = esp_fifo_pop_buf(&s->fifo, s->async_buf, len);
|
||||||
|
esp_raise_drq(s);
|
||||||
|
}
|
||||||
|
|
||||||
s->async_buf += len;
|
s->async_buf += len;
|
||||||
s->async_len -= len;
|
s->async_len -= len;
|
||||||
s->ti_size += len;
|
s->ti_size += len;
|
||||||
@ -536,25 +544,6 @@ static void esp_do_dma(ESPState *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
esp_dma_ti_check(s);
|
esp_dma_ti_check(s);
|
||||||
} else {
|
|
||||||
/* Copy FIFO data to device */
|
|
||||||
len = MIN(s->async_len, ESP_FIFO_SZ);
|
|
||||||
len = MIN(len, fifo8_num_used(&s->fifo));
|
|
||||||
n = esp_fifo_pop_buf(&s->fifo, s->async_buf, len);
|
|
||||||
s->async_buf += n;
|
|
||||||
s->async_len -= n;
|
|
||||||
s->ti_size += n;
|
|
||||||
|
|
||||||
esp_raise_drq(s);
|
|
||||||
|
|
||||||
if (s->async_len == 0 && fifo8_num_used(&s->fifo) < 2) {
|
|
||||||
/* Defer until the scsi layer has completed */
|
|
||||||
scsi_req_continue(s->current_req);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
esp_dma_ti_check(s);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STAT_DI:
|
case STAT_DI:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user