Commit e774a278d82c9391c9fb6c9af42cd08bb9364b9f

Authored by bellard
1 parent fa7cf687

-win2k-hack performance+DMA support (Leonardo E. Reiter)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1841 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 15 additions and 2 deletions
hw/ide.c
... ... @@ -336,6 +336,7 @@ typedef struct IDEState {
336 336 uint8_t *data_end;
337 337 uint8_t io_buffer[MAX_MULT_SECTORS*512 + 4];
338 338 QEMUTimer *sector_write_timer; /* only used for win2k instal hack */
  339 + uint32_t irq_count; /* counts IRQs when using win2k install hack */
339 340 } IDEState;
340 341  
341 342 #define BM_STATUS_DMAING 0x01
... ... @@ -712,7 +713,7 @@ static void ide_sector_write(IDEState *s)
712 713 ide_set_sector(s, sector_num + n);
713 714  
714 715 #ifdef TARGET_I386
715   - if (win2k_install_hack) {
  716 + if (win2k_install_hack && ((++s->irq_count % 16) == 0)) {
716 717 /* It seems there is a bug in the Windows 2000 installer HDD
717 718 IDE driver which fills the disk with empty logs when the
718 719 IDE write IRQ comes too early. This hack tries to correct
... ... @@ -750,7 +751,19 @@ static int ide_write_dma_cb(IDEState *s,
750 751 if (n == 0) {
751 752 /* end of transfer */
752 753 s->status = READY_STAT | SEEK_STAT;
753   - ide_set_irq(s);
  754 +#ifdef TARGET_I386
  755 + if (win2k_install_hack && ((++s->irq_count % 16) == 0)) {
  756 + /* It seems there is a bug in the Windows 2000 installer
  757 + HDD IDE driver which fills the disk with empty logs
  758 + when the IDE write IRQ comes too early. This hack tries
  759 + to correct that at the expense of slower write
  760 + performances. Use this option _only_ to install Windows
  761 + 2000. You must disable it for normal use. */
  762 + qemu_mod_timer(s->sector_write_timer,
  763 + qemu_get_clock(vm_clock) + (ticks_per_sec / 1000));
  764 + } else
  765 +#endif
  766 + ide_set_irq(s);
754 767 return 0;
755 768 }
756 769 if (n > MAX_MULT_SECTORS)
... ...