]> xenbits.xensource.com Git - qemu-xen-3.3-testing.git/commitdiff
ide: enable single word DMA
authorIan Jackson <iwj@mariner.uk.xensource.com>
Fri, 18 Jul 2008 13:33:07 +0000 (14:33 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 18 Jul 2008 13:33:07 +0000 (14:33 +0100)
Windows XP doesn't enable DMA by default on dvd-rom devices emulated by QEMU.
Furthermore if I try to manually enable DMA using Device Manager, the
DMA mode chosen by Windows is inexplicably one of the few modes
unsupported by QEMU: single word mode 2.
Since on virtual hardware single word DMA is not really slower than
multi word DMA, it makes sense for QEMU to support single word dma as
well.

This patch does exactly this.  We also make sure that mdma is
deactivated when sdma is active and vice versa.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
hw/ide.c

index 5420e0e2bc616a92bce06e0bc58a6e81c87e4a6a..f70ea30adaf9a0f94be10e1e27c8f3a6b054d82d 100644 (file)
--- a/hw/ide.c
+++ b/hw/ide.c
@@ -554,6 +554,7 @@ static void ide_identify(IDEState *s)
         put_le16(p + 59, 0x100 | s->mult_sectors);
     put_le16(p + 60, s->nb_sectors);
     put_le16(p + 61, s->nb_sectors >> 16);
+    put_le16(p + 62, 0x07); /* single word dma0-2 supported */
     put_le16(p + 63, 0x07); /* mdma0-2 supported */
     put_le16(p + 65, 120);
     put_le16(p + 66, 120);
@@ -606,6 +607,7 @@ static void ide_atapi_identify(IDEState *s)
 #ifdef USE_DMA_CDROM
     put_le16(p + 49, 1 << 9 | 1 << 8); /* DMA and LBA supported */
     put_le16(p + 53, 7); /* words 64-70, 54-58, 88 valid */
+    put_le16(p + 62, 7);  /* single word dma0-2 supported */
     put_le16(p + 63, 7);  /* mdma0-2 supported */
     put_le16(p + 64, 0x3f); /* PIO modes supported */
 #else
@@ -2200,14 +2202,22 @@ static void ide_ioport_write(void *opaque, uint32_t addr, uint32_t val)
                switch (s->nsector >> 3) {
                    case 0x00: /* pio default */
                    case 0x01: /* pio mode */
+                       put_le16(s->identify_data + 62,0x07);
+                       put_le16(s->identify_data + 63,0x07);
+                       put_le16(s->identify_data + 88,0x3f);
+                       break;
+                    case 0x02: /* sigle word dma mode*/
+                       put_le16(s->identify_data + 62,0x07 | (1 << (val + 8)));
                        put_le16(s->identify_data + 63,0x07);
                        put_le16(s->identify_data + 88,0x3f);
                        break;
                    case 0x04: /* mdma mode */
+                       put_le16(s->identify_data + 62,0x07);
                        put_le16(s->identify_data + 63,0x07 | (1 << (val + 8)));
                        put_le16(s->identify_data + 88,0x3f);
                        break;
                    case 0x08: /* udma mode */
+                       put_le16(s->identify_data + 62,0x07);
                        put_le16(s->identify_data + 63,0x07);
                        put_le16(s->identify_data + 88,0x3f | (1 << (val + 8)));
                        break;