qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ide: enable single word DMA
@ 2008-07-16 11:51 Stefano Stabellini
  0 siblings, 0 replies; 2+ messages in thread
From: Stefano Stabellini @ 2008-07-16 11:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Ian Jackson

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.

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

---

diff --git a/hw/ide.c b/hw/ide.c
index 337621d..c2dfd54 100644
--- a/hw/ide.c
+++ b/hw/ide.c
@@ -569,6 +569,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);
@@ -620,6 +621,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
@@ -2197,6 +2199,10 @@ static void ide_ioport_write(void *opaque, uint32_t addr, uint32_t val)
 			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 + 88,0x3f);
+			break;
 		    case 0x04: /* mdma mode */
 			put_le16(s->identify_data + 63,0x07 | (1 << (val + 8)));
 			put_le16(s->identify_data + 88,0x3f);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Qemu-devel] [PATCH] ide: enable single word DMA
@ 2008-07-16 13:11 Stefano Stabellini
  0 siblings, 0 replies; 2+ messages in thread
From: Stefano Stabellini @ 2008-07-16 13:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: Ian Jackson

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.

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

---

diff --git a/hw/ide.c b/hw/ide.c
index 337621d..c2dfd54 100644
--- a/hw/ide.c
+++ b/hw/ide.c
@@ -569,6 +569,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);
@@ -620,6 +621,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
@@ -2197,6 +2199,10 @@ static void ide_ioport_write(void *opaque, uint32_t addr, uint32_t val)
 			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 + 88,0x3f);
+			break;
 		    case 0x04: /* mdma mode */
 			put_le16(s->identify_data + 63,0x07 | (1 << (val + 8)));
 			put_le16(s->identify_data + 88,0x3f);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-16 13:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-16 11:51 [Qemu-devel] [PATCH] ide: enable single word DMA Stefano Stabellini
  -- strict thread matches above, loose matches on Subject: below --
2008-07-16 13:11 Stefano Stabellini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).