/[qemu]/qemu/hw/ide.c
ViewVC logotype

Diff of /qemu/hw/ide.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.64 by ths, Sun Aug 19 21:46:53 2007 UTC revision 1.65 by ths, Sun Aug 26 17:42:20 2007 UTC
# Line 864  static void ide_sector_write_timer_cb(vo Line 864  static void ide_sector_write_timer_cb(vo
864      ide_set_irq(s);      ide_set_irq(s);
865  }  }
866    
867    static void ide_sector_write_aio_cb(void *opaque, int ret)
868    {
869        BMDMAState *bm = opaque;
870        IDEState *s = bm->ide_if;
871    
872    #ifdef TARGET_I386
873        if (win2k_install_hack && ((++s->irq_count % 16) == 0)) {
874            /* It seems there is a bug in the Windows 2000 installer HDD
875               IDE driver which fills the disk with empty logs when the
876               IDE write IRQ comes too early. This hack tries to correct
877               that at the expense of slower write performances. Use this
878               option _only_ to install Windows 2000. You must disable it
879               for normal use. */
880            qemu_mod_timer(s->sector_write_timer,
881                           qemu_get_clock(vm_clock) + (ticks_per_sec / 1000));
882        } else
883    #endif
884        {
885            ide_set_irq(s);
886        }
887        bm->aiocb = NULL;
888    }
889    
890  static void ide_sector_write(IDEState *s)  static void ide_sector_write(IDEState *s)
891  {  {
892        BMDMAState *bm;
893      int64_t sector_num;      int64_t sector_num;
894      int ret, n, n1;      int n, n1;
895    
896        s->io_buffer_index = 0;
897        s->io_buffer_size = 0;
898        bm = s->bmdma;
899        if(bm == NULL) {
900            bm = qemu_mallocz(sizeof(BMDMAState));
901            s->bmdma = bm;
902        }
903        bm->ide_if = s;
904        bm->dma_cb = ide_sector_write_aio_cb;
905    
906      s->status = READY_STAT | SEEK_STAT;      s->status = READY_STAT | SEEK_STAT;
907      sector_num = ide_get_sector(s);      sector_num = ide_get_sector(s);
# Line 877  static void ide_sector_write(IDEState *s Line 911  static void ide_sector_write(IDEState *s
911      n = s->nsector;      n = s->nsector;
912      if (n > s->req_nb_sectors)      if (n > s->req_nb_sectors)
913          n = s->req_nb_sectors;          n = s->req_nb_sectors;
     ret = bdrv_write(s->bs, sector_num, s->io_buffer, n);  
914      s->nsector -= n;      s->nsector -= n;
915      if (s->nsector == 0) {      if (s->nsector == 0) {
916          /* no more sectors to write */          /* no more sectors to write */
# Line 890  static void ide_sector_write(IDEState *s Line 923  static void ide_sector_write(IDEState *s
923      }      }
924      ide_set_sector(s, sector_num + n);      ide_set_sector(s, sector_num + n);
925            
926  #ifdef TARGET_I386      bm->aiocb = bdrv_aio_write(s->bs, sector_num, s->io_buffer, n,
927      if (win2k_install_hack && ((++s->irq_count % 16) == 0)) {                                 ide_sector_write_aio_cb, bm);
         /* It seems there is a bug in the Windows 2000 installer HDD  
            IDE driver which fills the disk with empty logs when the  
            IDE write IRQ comes too early. This hack tries to correct  
            that at the expense of slower write performances. Use this  
            option _only_ to install Windows 2000. You must disable it  
            for normal use. */  
         qemu_mod_timer(s->sector_write_timer,  
                        qemu_get_clock(vm_clock) + (ticks_per_sec / 1000));  
     } else  
 #endif  
     {  
         ide_set_irq(s);  
     }  
928  }  }
929    
930  /* XXX: handle errors */  /* XXX: handle errors */

Legend:
Removed from v.1.64  
changed lines
  Added in v.1.65

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26