Revision 31c2a146
b/hw/ide.c | ||
---|---|---|
358 | 358 |
uint8_t *data_ptr; |
359 | 359 |
uint8_t *data_end; |
360 | 360 |
uint8_t io_buffer[MAX_MULT_SECTORS*512 + 4]; |
361 |
QEMUTimer *sector_write_timer; /* only used for win2k instal hack */ |
|
361 |
QEMUTimer *sector_write_timer; /* only used for win2k install hack */
|
|
362 | 362 |
uint32_t irq_count; /* counts IRQs when using win2k install hack */ |
363 | 363 |
/* CF-ATA extended error */ |
364 | 364 |
uint8_t ext_error; |
... | ... | |
865 | 865 |
ide_set_irq(s); |
866 | 866 |
} |
867 | 867 |
|
868 |
static void ide_sector_write_aio_cb(void *opaque, int ret) |
|
869 |
{ |
|
870 |
BMDMAState *bm = opaque; |
|
871 |
IDEState *s = bm->ide_if; |
|
872 |
|
|
873 |
#ifdef TARGET_I386 |
|
874 |
if (win2k_install_hack && ((++s->irq_count % 16) == 0)) { |
|
875 |
/* It seems there is a bug in the Windows 2000 installer HDD |
|
876 |
IDE driver which fills the disk with empty logs when the |
|
877 |
IDE write IRQ comes too early. This hack tries to correct |
|
878 |
that at the expense of slower write performances. Use this |
|
879 |
option _only_ to install Windows 2000. You must disable it |
|
880 |
for normal use. */ |
|
881 |
qemu_mod_timer(s->sector_write_timer, |
|
882 |
qemu_get_clock(vm_clock) + (ticks_per_sec / 1000)); |
|
883 |
} else |
|
884 |
#endif |
|
885 |
{ |
|
886 |
ide_set_irq(s); |
|
887 |
} |
|
888 |
bm->aiocb = NULL; |
|
889 |
} |
|
890 |
|
|
891 | 868 |
static void ide_sector_write(IDEState *s) |
892 | 869 |
{ |
893 |
BMDMAState *bm; |
|
894 | 870 |
int64_t sector_num; |
895 |
int n, n1; |
|
896 |
|
|
897 |
s->io_buffer_index = 0; |
|
898 |
s->io_buffer_size = 0; |
|
899 |
bm = s->bmdma; |
|
900 |
if(bm == NULL) { |
|
901 |
bm = qemu_mallocz(sizeof(BMDMAState)); |
|
902 |
s->bmdma = bm; |
|
903 |
} |
|
904 |
bm->ide_if = s; |
|
905 |
bm->dma_cb = ide_sector_write_aio_cb; |
|
871 |
int ret, n, n1; |
|
906 | 872 |
|
907 | 873 |
s->status = READY_STAT | SEEK_STAT; |
908 | 874 |
sector_num = ide_get_sector(s); |
... | ... | |
912 | 878 |
n = s->nsector; |
913 | 879 |
if (n > s->req_nb_sectors) |
914 | 880 |
n = s->req_nb_sectors; |
881 |
ret = bdrv_write(s->bs, sector_num, s->io_buffer, n); |
|
915 | 882 |
s->nsector -= n; |
916 | 883 |
if (s->nsector == 0) { |
917 | 884 |
/* no more sectors to write */ |
... | ... | |
924 | 891 |
} |
925 | 892 |
ide_set_sector(s, sector_num + n); |
926 | 893 |
|
927 |
bm->aiocb = bdrv_aio_write(s->bs, sector_num, s->io_buffer, n, |
|
928 |
ide_sector_write_aio_cb, bm); |
|
894 |
#ifdef TARGET_I386 |
|
895 |
if (win2k_install_hack && ((++s->irq_count % 16) == 0)) { |
|
896 |
/* It seems there is a bug in the Windows 2000 installer HDD |
|
897 |
IDE driver which fills the disk with empty logs when the |
|
898 |
IDE write IRQ comes too early. This hack tries to correct |
|
899 |
that at the expense of slower write performances. Use this |
|
900 |
option _only_ to install Windows 2000. You must disable it |
|
901 |
for normal use. */ |
|
902 |
qemu_mod_timer(s->sector_write_timer, |
|
903 |
qemu_get_clock(vm_clock) + (ticks_per_sec / 1000)); |
|
904 |
} else |
|
905 |
#endif |
|
906 |
{ |
|
907 |
ide_set_irq(s); |
|
908 |
} |
|
929 | 909 |
} |
930 | 910 |
|
931 | 911 |
/* XXX: handle errors */ |
Also available in: Unified diff