On 04/08/16 22:22, BALATON Zoltan wrote:
On Thu, 4 Aug 2016, Mark Cave-Ayland wrote:
This corresponds to this code in QEMU's hw/ide/macio.c:
if (s->lba == -1) { /* Non-block ATAPI transfer - just copy to RAM */ 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); ide_atapi_cmd_ok(s); m->dma_active = false; goto done; }
Here the QEMU block code should have already placed the generated TOC into s->io_buffer and DMA the first 14 bytes into RAM but for some reason that's not happening so the code is looping looking for a signature that isn't present.
Zoltan: this is very similar to the related issue you had with your MorphOS tests which this code should have resolved, unless I managed to get something wrong in my last rewrite of the macio code?
The above code did fix this in MorphOS back then but I haven't tried it recently (no time for it now). But I'd assume other OS-es would also be affected if it broke. Maybe to cross check you could also try OS X DP with a version before your last rewrite.
Oh wait - I think the problem is that the status count isn't being set to zero if you take the non-block codepath, and so the driver may consider the request failed if it checks res_count afterwards:
pmac_ide_atapi_transfer_cb DBDMA[1a]: dbdma_end DBDMA[1a]: conditional_wait DBDMA[1a]: dbdma_cmdptr_save 0x01072000 DBDMA[1a]: xfer_status 0x00008400 res_count 0x0800 ^^^^^^ DBDMA[1a]: conditional_interrupt DBDMA[1a]: conditional_branch DBDMA[1a]: dbdma_cmdptr_load 0x01072010 DBDMA[1a]: channel_run
Does the following patch for QEMU help at all?
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;
ATB,
Mark.