diff mbox

macio: set res_count value to 0 after non-block ATAPI DMA transfers

Message ID 1470382202-28778-1-git-send-email-mark.cave-ayland@ilande.co.uk
State New
Headers show

Commit Message

Mark Cave-Ayland Aug. 5, 2016, 7:30 a.m. UTC
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 <mark.cave-ayland@ilande.co.uk>
---
 hw/ide/macio.c |    1 +
 1 file changed, 1 insertion(+)

Comments

David Gibson Aug. 5, 2016, 7:58 a.m. UTC | #1
On Fri, Aug 05, 2016 at 08:30:02AM +0100, Mark Cave-Ayland wrote:
> 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 <mark.cave-ayland@ilande.co.uk>

Applied to ppc-for-2.7

> ---
>  hw/ide/macio.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/ide/macio.c b/hw/ide/macio.c
> index 5a326af..76f97c2 100644
> --- a/hw/ide/macio.c
> +++ b/hw/ide/macio.c
> @@ -273,6 +273,7 @@ static void pmac_ide_atapi_transfer_cb(void *opaque, int ret)
>          s->io_buffer_size = MIN(s->io_buffer_size, io->len);
>          dma_memory_write(&address_space_memory, io->addr, s->io_buffer,
>                           s->io_buffer_size);
> +        io->len = 0;
>          ide_atapi_cmd_ok(s);
>          m->dma_active = false;
>          goto done;
diff mbox

Patch

diff --git a/hw/ide/macio.c b/hw/ide/macio.c
index 5a326af..76f97c2 100644
--- a/hw/ide/macio.c
+++ b/hw/ide/macio.c
@@ -273,6 +273,7 @@  static void pmac_ide_atapi_transfer_cb(void *opaque, int ret)
         s->io_buffer_size = MIN(s->io_buffer_size, io->len);
         dma_memory_write(&address_space_memory, io->addr, s->io_buffer,
                          s->io_buffer_size);
+        io->len = 0;
         ide_atapi_cmd_ok(s);
         m->dma_active = false;
         goto done;