summaryrefslogtreecommitdiffstats
path: root/hw/scsi/esp.c
diff options
context:
space:
mode:
authorMark Cave-Ayland2021-03-04 23:10:32 +0100
committerMark Cave-Ayland2021-03-07 11:39:05 +0100
commit96676c2f749d9da99ee03ec0eee342bd7d09de26 (patch)
tree851ddeebaf32c4bc681f3f0b0c85a4a2419b09c9 /hw/scsi/esp.c
parentesp: introduce esp_get_stc() (diff)
downloadqemu-96676c2f749d9da99ee03ec0eee342bd7d09de26.tar.gz
qemu-96676c2f749d9da99ee03ec0eee342bd7d09de26.tar.xz
qemu-96676c2f749d9da99ee03ec0eee342bd7d09de26.zip
esp: apply transfer length adjustment when STC is zero at TC load time
Perform the length adjustment whereby a value of 0 in the STC represents a transfer length of 0x10000 at the point where the TC is loaded at the start of a DMA command rather than just when a TI (Transfer Information) command is executed. This better matches the description as given in the datasheet. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20210304221103.6369-12-mark.cave-ayland@ilande.co.uk>
Diffstat (limited to 'hw/scsi/esp.c')
-rw-r--r--hw/scsi/esp.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index 125bdea32a..349067eb6a 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -561,9 +561,6 @@ static void handle_ti(ESPState *s)
}
dmalen = esp_get_tc(s);
- if (dmalen == 0) {
- dmalen = 0x10000;
- }
s->dma_counter = dmalen;
if (s->do_cmd) {
@@ -698,7 +695,11 @@ void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t val)
if (val & CMD_DMA) {
s->dma = 1;
/* Reload DMA counter. */
- esp_set_tc(s, esp_get_stc(s));
+ if (esp_get_stc(s) == 0) {
+ esp_set_tc(s, 0x10000);
+ } else {
+ esp_set_tc(s, esp_get_stc(s));
+ }
} else {
s->dma = 0;
}