Commit 31c2a146ec3ac18f01c645c3c0d779f138c0d805
1 parent
ec6338ba
Revert "Last AIO Patch" as requested by Fabrice, it is incomplete and
breaks other (non-Windows) systems. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3552 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
18 additions
and
38 deletions
hw/ide.c
| @@ -358,7 +358,7 @@ typedef struct IDEState { | @@ -358,7 +358,7 @@ typedef struct IDEState { | ||
| 358 | uint8_t *data_ptr; | 358 | uint8_t *data_ptr; |
| 359 | uint8_t *data_end; | 359 | uint8_t *data_end; |
| 360 | uint8_t io_buffer[MAX_MULT_SECTORS*512 + 4]; | 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 | uint32_t irq_count; /* counts IRQs when using win2k install hack */ | 362 | uint32_t irq_count; /* counts IRQs when using win2k install hack */ |
| 363 | /* CF-ATA extended error */ | 363 | /* CF-ATA extended error */ |
| 364 | uint8_t ext_error; | 364 | uint8_t ext_error; |
| @@ -865,44 +865,10 @@ static void ide_sector_write_timer_cb(void *opaque) | @@ -865,44 +865,10 @@ static void ide_sector_write_timer_cb(void *opaque) | ||
| 865 | ide_set_irq(s); | 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 | static void ide_sector_write(IDEState *s) | 868 | static void ide_sector_write(IDEState *s) |
| 892 | { | 869 | { |
| 893 | - BMDMAState *bm; | ||
| 894 | int64_t sector_num; | 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 | s->status = READY_STAT | SEEK_STAT; | 873 | s->status = READY_STAT | SEEK_STAT; |
| 908 | sector_num = ide_get_sector(s); | 874 | sector_num = ide_get_sector(s); |
| @@ -912,6 +878,7 @@ static void ide_sector_write(IDEState *s) | @@ -912,6 +878,7 @@ static void ide_sector_write(IDEState *s) | ||
| 912 | n = s->nsector; | 878 | n = s->nsector; |
| 913 | if (n > s->req_nb_sectors) | 879 | if (n > s->req_nb_sectors) |
| 914 | n = s->req_nb_sectors; | 880 | n = s->req_nb_sectors; |
| 881 | + ret = bdrv_write(s->bs, sector_num, s->io_buffer, n); | ||
| 915 | s->nsector -= n; | 882 | s->nsector -= n; |
| 916 | if (s->nsector == 0) { | 883 | if (s->nsector == 0) { |
| 917 | /* no more sectors to write */ | 884 | /* no more sectors to write */ |
| @@ -924,8 +891,21 @@ static void ide_sector_write(IDEState *s) | @@ -924,8 +891,21 @@ static void ide_sector_write(IDEState *s) | ||
| 924 | } | 891 | } |
| 925 | ide_set_sector(s, sector_num + n); | 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 | /* XXX: handle errors */ | 911 | /* XXX: handle errors */ |