[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/4] esp-pci.c: use correct address register for PCI DMA transfer
From: |
Mark Cave-Ayland |
Subject: |
[PATCH 1/4] esp-pci.c: use correct address register for PCI DMA transfers |
Date: |
Fri, 12 Jan 2024 13:15:26 +0000 |
The current code in esp_pci_dma_memory_rw() sets the DMA address to the value
of the DMA_SPA (Starting Physical Address) register which is incorrect: this
means that for each callback from the SCSI layer the DMA address is set back
to the starting address.
In the case where only a single SCSI callback occurs (currently for transfer
lengths < 128kB) this works fine, however for larger transfers the DMA address
wraps back to the initial starting address, corrupting the buffer holding the
data transferred to the guest.
Fix esp_pci_dma_memory_rw() to use the DMA_WAC (Working Address Counter) for
the DMA address which is correctly incremented across multiple SCSI layer
transfers.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/scsi/esp-pci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/scsi/esp-pci.c b/hw/scsi/esp-pci.c
index 93b3429e0f..7117725371 100644
--- a/hw/scsi/esp-pci.c
+++ b/hw/scsi/esp-pci.c
@@ -275,7 +275,7 @@ static void esp_pci_dma_memory_rw(PCIESPState *pci, uint8_t
*buf, int len,
qemu_log_mask(LOG_UNIMP, "am53c974: MDL transfer not implemented\n");
}
- addr = pci->dma_regs[DMA_SPA];
+ addr = pci->dma_regs[DMA_WAC];
if (pci->dma_regs[DMA_WBC] < len) {
len = pci->dma_regs[DMA_WBC];
}
--
2.39.2
- [PATCH 0/4] esp-pci: fixes for Linux and MS-DOS, Mark Cave-Ayland, 2024/01/12
- [PATCH 2/4] esp-pci.c: generate PCI interrupt from separate ESP and PCI sources, Mark Cave-Ayland, 2024/01/12
- [PATCH 4/4] esp-pci.c: set DMA_STAT_BCMBLT when BLAST command issued, Mark Cave-Ayland, 2024/01/12
- [PATCH 1/4] esp-pci.c: use correct address register for PCI DMA transfers,
Mark Cave-Ayland <=
- [PATCH 3/4] esp-pci.c: synchronise setting of DMA_STAT_DONE with ESP completion interrupt, Mark Cave-Ayland, 2024/01/12
- Re: [PATCH 0/4] esp-pci: fixes for Linux and MS-DOS, Philippe Mathieu-Daudé, 2024/01/16
- Re: [PATCH 0/4] esp-pci: fixes for Linux and MS-DOS, Michael Tokarev, 2024/01/20