From: Mark Cave-Ayland Date: Fri, 5 Aug 2016 07:30:02 +0000 (+0100) Subject: macio: set res_count value to 0 after non-block ATAPI DMA transfers X-Git-Tag: v2.6.1~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ff71767e069f26fa617047c38c8eb65673c8ad16;p=thirdparty%2Fqemu.git macio: set res_count value to 0 after non-block ATAPI DMA transfers res_count should be set to the number of outstanding bytes after a DBDMA request. Unfortunately this wasn't being set to zero by the non-block transfer codepath meaning drivers that checked the descriptor result for such requests (e.g reading the CDROM TOC) would assume from a non-zero result that the transfer had failed. Signed-off-by: Mark Cave-Ayland Signed-off-by: David Gibson (cherry picked from commit 16275edb342342625cd7e7ac2048436474465b50) Conflicts: hw/ide/macio.c * removed context dependancy on ddd495e5 Signed-off-by: Michael Roth --- diff --git a/hw/ide/macio.c b/hw/ide/macio.c index 76256eb8a8d..664328d1740 100644 --- a/hw/ide/macio.c +++ b/hw/ide/macio.c @@ -275,6 +275,7 @@ static void pmac_ide_atapi_transfer_cb(void *opaque, int ret) /* Non-block ATAPI transfer - just copy to RAM */ s->io_buffer_size = MIN(s->io_buffer_size, io->len); cpu_physical_memory_write(io->addr, s->io_buffer, s->io_buffer_size); + io->len = 0; ide_atapi_cmd_ok(s); m->dma_active = false; goto done;