From ac58fe7b2c67a9be142beacd4c6ee51f3264d90f Mon Sep 17 00:00:00 2001 From: Mark Cave-Ayland Date: Thu, 4 Jun 2015 22:59:35 +0100 Subject: macio: switch pmac_dma_write() over to new offset/len implementation In particular, this fixes a bug whereby chains of overlapping head/tail chains would incorrectly write over each other's remainder cache. This is the access pattern used by OS X/Darwin and fixes an issue with a corrupt Darwin installation in my local tests. While we are here, rename the DBDMA_io struct property remainder to head_remainder for clarification. Signed-off-by: Mark Cave-Ayland Reviewed-by: John Snow Message-id: 1433455177-21243-3-git-send-email-mark.cave-ayland@ilande.co.uk Signed-off-by: John Snow --- include/hw/ppc/mac_dbdma.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/hw/ppc') diff --git a/include/hw/ppc/mac_dbdma.h b/include/hw/ppc/mac_dbdma.h index c5803279da..7f247fa4f1 100644 --- a/include/hw/ppc/mac_dbdma.h +++ b/include/hw/ppc/mac_dbdma.h @@ -40,7 +40,8 @@ struct DBDMA_io { /* DMA is in progress, don't start another one */ bool processing; /* unaligned last sector of a request */ - uint8_t remainder[0x200]; + uint8_t head_remainder[0x200]; + uint8_t tail_remainder[0x200]; int remainder_len; QEMUIOVector iov; }; -- cgit 1.4.1 From 0ba98885a0e965a17df214ab12b819ef630d8a14 Mon Sep 17 00:00:00 2001 From: Mark Cave-Ayland Date: Thu, 4 Jun 2015 22:59:37 +0100 Subject: macio: remove remainder_len DBDMA_io property Since the block alignment code is now effectively independent of the DMA implementation, this variable is no longer required and can be removed. Signed-off-by: Mark Cave-Ayland Reviewed-by: John Snow Message-id: 1433455177-21243-5-git-send-email-mark.cave-ayland@ilande.co.uk Signed-off-by: John Snow --- hw/ide/macio.c | 13 ------------- include/hw/ppc/mac_dbdma.h | 1 - 2 files changed, 14 deletions(-) (limited to 'include/hw/ppc') diff --git a/hw/ide/macio.c b/hw/ide/macio.c index d353bd254c..dd52d50732 100644 --- a/hw/ide/macio.c +++ b/hw/ide/macio.c @@ -278,7 +278,6 @@ static void pmac_ide_transfer_cb(void *opaque, int ret) MACIO_DPRINTF("DMA error: %d\n", ret); m->aiocb = NULL; ide_dma_error(s); - io->remainder_len = 0; goto done; } @@ -509,9 +508,6 @@ static void ide_dbdma_start(IDEDMA *dma, IDEState *s, BlockCompletionFunc *cb) { MACIOIDEState *m = container_of(dma, MACIOIDEState, dma); - DBDMAState *dbdma = m->dbdma; - DBDMA_io *io; - int i; s->io_buffer_index = 0; if (s->drive_kind == IDE_CD) { @@ -526,15 +522,6 @@ static void ide_dbdma_start(IDEDMA *dma, IDEState *s, MACIO_DPRINTF("lba: %x size: %x\n", s->lba, s->io_buffer_size); MACIO_DPRINTF("-------------------------\n"); - for (i = 0; i < DBDMA_CHANNELS; i++) { - io = &dbdma->channels[i].io; - - if (io->opaque == m) { - io->remainder_len = 0; - } - } - - MACIO_DPRINTF("\n"); m->dma_active = true; DBDMA_kick(m->dbdma); } diff --git a/include/hw/ppc/mac_dbdma.h b/include/hw/ppc/mac_dbdma.h index 7f247fa4f1..c6870212e9 100644 --- a/include/hw/ppc/mac_dbdma.h +++ b/include/hw/ppc/mac_dbdma.h @@ -42,7 +42,6 @@ struct DBDMA_io { /* unaligned last sector of a request */ uint8_t head_remainder[0x200]; uint8_t tail_remainder[0x200]; - int remainder_len; QEMUIOVector iov; }; -- cgit 1.4.1