]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
ide, vl: turn -win2k-hack into a property on IDE devices
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 20 Feb 2024 16:09:30 +0000 (17:09 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 27 Feb 2024 23:23:39 +0000 (00:23 +0100)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/ide/core.c
hw/ide/ide-dev.c
include/hw/ide/ide-dev.h
include/sysemu/sysemu.h
qemu-options.hx
system/globals.c
system/vl.c

index 501df37faa35a74185179f575ceabd5bdda7fc66..e8cb2dac929db95a88a1bb7e53c7cad52ecdce89 100644 (file)
@@ -1059,7 +1059,7 @@ static void ide_sector_write_cb(void *opaque, int ret)
                            ide_sector_write);
     }
 
-    if (win2k_install_hack && ((++s->irq_count % 16) == 0)) {
+    if (s->win2k_install_hack && ((++s->irq_count % 16) == 0)) {
         /* 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
@@ -2597,6 +2597,7 @@ int ide_init_drive(IDEState *s, IDEDevice *dev, IDEDriveKind kind, Error **errp)
     s->drive_kind = kind;
 
     blk_get_geometry(s->blk, &nb_sectors);
+    s->win2k_install_hack = dev->win2k_install_hack;
     s->cylinders = dev->conf.cyls;
     s->heads = s->drive_heads = dev->conf.heads;
     s->sectors = s->drive_sectors = dev->conf.secs;
index 722c4e78caacfff50eb42d03ff63105311714708..03f796779880690b734c542321b2f57e3237dfc6 100644 (file)
@@ -31,6 +31,7 @@
 
 static Property ide_props[] = {
     DEFINE_PROP_UINT32("unit", IDEDevice, unit, -1),
+    DEFINE_PROP_BOOL("win2k-install-hack", IDEDevice, win2k_install_hack, false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
index 708cc0fda342b0789d09eb3430880c95b4772580..9a0d71db4e18957509ff9a007c23d7035dfd137d 100644 (file)
@@ -65,6 +65,7 @@ struct IDEState {
     int drive_serial;
     char drive_serial_str[21];
     char drive_model_str[41];
+    bool win2k_install_hack;
     uint64_t wwn;
     /* ide regs */
     uint8_t feature;
@@ -163,6 +164,7 @@ struct IDEDevice {
      * 0xffff        - reserved
      */
     uint16_t rotation_rate;
+    bool win2k_install_hack;
 };
 
 typedef struct IDEDrive {
index 73a37949c24d1b5f511f6d2aaf7a7494f5af5349..eb1dc1e4eda7400d7e1ce99e475e7e945b7302b2 100644 (file)
@@ -41,7 +41,6 @@ extern int graphic_height;
 extern int graphic_depth;
 extern int display_opengl;
 extern const char *keyboard_layout;
-extern int win2k_install_hack;
 extern int graphic_rotate;
 extern int old_param;
 extern uint8_t *boot_splash_filedata;
index 1136642c21df80675f054922a4f1b7bd1389c23e..9a47385c15713f1f46e4c796d9b18bded5782ec6 100644 (file)
@@ -2641,7 +2641,8 @@ SRST
 ``-win2k-hack``
     Use it when installing Windows 2000 to avoid a disk full bug. After
     Windows 2000 is installed, you no longer need this option (this
-    option slows down the IDE transfers).
+    option slows down the IDE transfers).  Synonym of ``-global
+    ide-device.win2k-install-hack=on``.
 ERST
 
 DEF("no-fd-bootchk", 0, QEMU_OPTION_no_fd_bootchk,
index 5d0046ba105b54791c8bc5ffef6a2f15449ce42f..e35358420105c7d55269b130c6da30d5e81e7fe4 100644 (file)
@@ -40,7 +40,6 @@ int autostart = 1;
 int vga_interface_type = VGA_NONE;
 bool vga_interface_created;
 Chardev *parallel_hds[MAX_PARALLEL_PORTS];
-int win2k_install_hack;
 int graphic_rotate;
 QEMUOptionRom option_rom[MAX_OPTION_ROMS];
 int nb_option_roms;
index 98bf0c386b481e1e7538ccf453613dbdb3da6c62..e480afd7a00bc56135d715fd01fe2232da5fbb86 100644 (file)
@@ -3265,7 +3265,7 @@ void qemu_init(int argc, char **argv)
                 pid_file = optarg;
                 break;
             case QEMU_OPTION_win2k_hack:
-                win2k_install_hack = 1;
+                object_register_sugar_prop("ide-device", "win2k-install-hack", "true", true);
                 break;
             case QEMU_OPTION_acpitable:
                 opts = qemu_opts_parse_noisily(qemu_find_opts("acpi"),