source: trunk/packages/xen-3.1/xen-3.1/tools/ioemu/patches/qemu-tunable-ide-write-cache @ 34

Last change on this file since 34 was 34, checked in by hartmans, 18 years ago

Add xen and xen-common

File size: 1.8 KB
Line 
1Index: ioemu/hw/ide.c
2===================================================================
3--- ioemu.orig/hw/ide.c 2007-05-03 15:07:15.000000000 +0100
4+++ ioemu/hw/ide.c      2007-05-03 15:07:16.000000000 +0100
5@@ -305,6 +305,7 @@
6     PCIDevice *pci_dev;
7     struct BMDMAState *bmdma;
8     int drive_serial;
9+    int write_cache;
10     /* ide regs */
11     uint8_t feature;
12     uint8_t error;
13@@ -947,6 +948,9 @@
14     }
15     ide_set_sector(s, sector_num + n);
16     
17+    if (!s->write_cache)
18+        bdrv_flush(s->bs);
19+   
20 #ifdef TARGET_I386
21     if (win2k_install_hack && ((++s->irq_count % 16) == 0)) {
22         /* It seems there is a bug in the Windows 2000 installer HDD
23@@ -1021,6 +1025,10 @@
24         transfer_size -= len;
25         phys_addr += len;
26     }
27+    /* Ensure the data hit disk before telling the guest OS so. */
28+    if (!s->write_cache)
29+        bdrv_flush(s->bs);
30+
31     return transfer_size1 - transfer_size;
32 }
33 
34@@ -1831,7 +1839,15 @@
35             /* XXX: valid for CDROM ? */
36             switch(s->feature) {
37             case 0x02: /* write cache enable */
38+                s->write_cache = 1;
39+                s->status = READY_STAT | SEEK_STAT;
40+                ide_set_irq(s);
41+                break;
42             case 0x82: /* write cache disable */
43+                s->write_cache = 0;
44+                s->status = READY_STAT | SEEK_STAT;
45+                ide_set_irq(s);
46+                break;
47             case 0xaa: /* read look-ahead enable */
48             case 0x55: /* read look-ahead disable */
49                 s->status = READY_STAT | SEEK_STAT;
50@@ -2254,6 +2270,7 @@
51         s->irq = irq;
52         s->sector_write_timer = qemu_new_timer(vm_clock,
53                                                ide_sector_write_timer_cb, s);
54+        s->write_cache = 0;
55         ide_reset(s);
56     }
57 }
Note: See TracBrowser for help on using the repository browser.