Patchwork Compile ide/core only once

login
register
mail settings
Submitter Blue Swirl
Date March 24, 2010, 8:53 p.m.
Message ID <f43fc5581003241353n1163ab0oc557dea2e4dbca6@mail.gmail.com>
Download mbox | patch
Permalink /patch/48470/
State New
Headers show

Comments

Blue Swirl - March 24, 2010, 8:53 p.m.
Make win2k install hack unconditional as it is still restricted to
x86 only in vl.c.

Replace TARGET_PAGE_SIZE with 4096 because that figure is already
used later.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 Makefile.objs                        |    1 +
 Makefile.target                      |   11 ++++-------
 default-configs/arm-softmmu.mak      |    1 +
 default-configs/i386-softmmu.mak     |    1 +
 default-configs/mips-softmmu.mak     |    1 +
 default-configs/mips64-softmmu.mak   |    1 +
 default-configs/mips64el-softmmu.mak |    1 +
 default-configs/mipsel-softmmu.mak   |    1 +
 default-configs/ppc-softmmu.mak      |    1 +
 default-configs/ppc64-softmmu.mak    |    1 +
 default-configs/ppcemb-softmmu.mak   |    1 +
 default-configs/sh4-softmmu.mak      |    1 +
 default-configs/sh4eb-softmmu.mak    |    1 +
 default-configs/sparc64-softmmu.mak  |    1 +
 default-configs/x86_64-softmmu.mak   |    1 +
 hw/ide/core.c                        |   10 +++-------
 vl.c                                 |    2 +-
 17 files changed, 22 insertions(+), 15 deletions(-)
Aurelien Jarno - March 26, 2010, 10:33 p.m.
On Wed, Mar 24, 2010 at 10:53:19PM +0200, Blue Swirl wrote:
> Make win2k install hack unconditional as it is still restricted to
> x86 only in vl.c.
> 
> Replace TARGET_PAGE_SIZE with 4096 because that figure is already
> used later.

This patch has been mangled by your mailer and does not apply correctly
without manual patching.

> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
> ---
>  Makefile.objs                        |    1 +
>  Makefile.target                      |   11 ++++-------
>  default-configs/arm-softmmu.mak      |    1 +
>  default-configs/i386-softmmu.mak     |    1 +
>  default-configs/mips-softmmu.mak     |    1 +
>  default-configs/mips64-softmmu.mak   |    1 +
>  default-configs/mips64el-softmmu.mak |    1 +
>  default-configs/mipsel-softmmu.mak   |    1 +
>  default-configs/ppc-softmmu.mak      |    1 +
>  default-configs/ppc64-softmmu.mak    |    1 +
>  default-configs/ppcemb-softmmu.mak   |    1 +
>  default-configs/sh4-softmmu.mak      |    1 +
>  default-configs/sh4eb-softmmu.mak    |    1 +
>  default-configs/sparc64-softmmu.mak  |    1 +
>  default-configs/x86_64-softmmu.mak   |    1 +
>  hw/ide/core.c                        |   10 +++-------
>  vl.c                                 |    2 +-
>  17 files changed, 22 insertions(+), 15 deletions(-)
> 
> diff --git a/Makefile.objs b/Makefile.objs
> index 281f7a6..fe81f6c 100644
> --- a/Makefile.objs
> +++ b/Makefile.objs
> @@ -161,6 +161,7 @@ hw-obj-$(CONFIG_LAN9118) += lan9118.o
>  hw-obj-$(CONFIG_NE2000_ISA) += ne2000-isa.o
> 
>  # IDE
> +hw-obj-$(CONFIG_IDE_CORE) += ide/core.o
>  hw-obj-$(CONFIG_IDE_QDEV) += ide/qdev.o
>  hw-obj-$(CONFIG_IDE_PCI) += ide/pci.o
>  hw-obj-$(CONFIG_IDE_ISA) += ide/isa.o
> diff --git a/Makefile.target b/Makefile.target
> index eb4d010..a17de90 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -181,8 +181,7 @@ obj-y += rtl8139.o
>  obj-y += e1000.o
> 
>  # Hardware support
> -obj-i386-y = ide/core.o
> -obj-i386-y += pckbd.o dma.o
> +obj-i386-y = pckbd.o dma.o
>  obj-i386-y += vga.o
>  obj-i386-y += mc146818rtc.o i8259.o pc.o
>  obj-i386-y += cirrus_vga.o apic.o ioapic.o acpi.o piix_pci.o
> @@ -191,7 +190,7 @@ obj-i386-y += device-hotplug.o pci-hotplug.o
> smbios.o wdt_ib700.o
>  obj-i386-y += debugcon.o multiboot.o
> 
>  # shared objects
> -obj-ppc-y = ppc.o ide/core.o ide/macio.o
> +obj-ppc-y = ppc.o ide/macio.o
>  obj-ppc-y += vga.o dma.o openpic.o
>  # PREP target
>  obj-ppc-y += pckbd.o i8259.o mc146818rtc.o
> @@ -215,7 +214,6 @@ obj-mips-y += mips_addr.o mips_timer.o mips_int.o
>  obj-mips-y += dma.o vga.o i8259.o rc4030.o
>  obj-mips-y += vga-isa-mm.o
>  obj-mips-y += g364fb.o jazz_led.o dp8393x.o
> -obj-mips-y += ide/core.o
>  obj-mips-y += gt64xxx.o pckbd.o mc146818rtc.o acpi.o ds1225y.o
>  obj-mips-y += piix4.o cirrus_vga.o
>  obj-mips-y += mipsnet.o
> @@ -248,7 +246,6 @@ obj-cris-y += pflash_cfi02.o
> 
>  ifeq ($(TARGET_ARCH), sparc64)
>  obj-sparc-y = sun4u.o pckbd.o apb_pci.o
> -obj-sparc-y += ide/core.o
>  obj-sparc-y += vga.o
>  obj-sparc-y += mc146818rtc.o
>  obj-sparc-y += cirrus_vga.o
> @@ -268,7 +265,7 @@ obj-arm-y += arm-semi.o
>  obj-arm-y += pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
>  obj-arm-y += pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
>  obj-arm-y += pflash_cfi01.o gumstix.o
> -obj-arm-y += zaurus.o ide/core.o ide/microdrive.o spitz.o tosa.o tc6393xb.o
> +obj-arm-y += zaurus.o ide/microdrive.o spitz.o tosa.o tc6393xb.o
>  obj-arm-y += omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o
>  obj-arm-y += omap2.o omap_dss.o soc_dma.o
>  obj-arm-y += omap_sx1.o palm.o tsc210x.o
> @@ -282,7 +279,7 @@ obj-arm-y += syborg_virtio.o
> 
>  obj-sh4-y = shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
>  obj-sh4-y += sh_timer.o sh_serial.o sh_intc.o sh_pci.o sm501.o
> -obj-sh4-y += ide/core.o ide/mmio.o
> +obj-sh4-y += ide/mmio.o
> 
>  obj-m68k-y = an5206.o mcf5206.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
>  obj-m68k-y += m68k-semi.o dummy_m68k.o
> diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-softmmu.mak
> index 02ad192..ea878a4 100644
> --- a/default-configs/arm-softmmu.mak
> +++ b/default-configs/arm-softmmu.mak
> @@ -8,6 +8,7 @@ CONFIG_ECC=y
>  CONFIG_SERIAL=y
>  CONFIG_PTIMER=y
>  CONFIG_SD=y
> +CONFIG_IDE_CORE=y
>  CONFIG_MAX7310=y
>  CONFIG_WM8750=y
>  CONFIG_TWL92230=y
> diff --git a/default-configs/i386-softmmu.mak b/default-configs/i386-softmmu.mak
> index 4dbf656..59eb670 100644
> --- a/default-configs/i386-softmmu.mak
> +++ b/default-configs/i386-softmmu.mak
> @@ -9,6 +9,7 @@ CONFIG_I8254=y
>  CONFIG_PCSPK=y
>  CONFIG_USB_UHCI=y
>  CONFIG_FDC=y
> +CONFIG_IDE_CORE=y
>  CONFIG_IDE_QDEV=y
>  CONFIG_IDE_PCI=y
>  CONFIG_IDE_ISA=y
> diff --git a/default-configs/mips-softmmu.mak b/default-configs/mips-softmmu.mak
> index 345a093..cb48ed1 100644
> --- a/default-configs/mips-softmmu.mak
> +++ b/default-configs/mips-softmmu.mak
> @@ -10,6 +10,7 @@ CONFIG_I8254=y
>  CONFIG_PCSPK=y
>  CONFIG_USB_UHCI=y
>  CONFIG_FDC=y
> +CONFIG_IDE_CORE=y
>  CONFIG_IDE_QDEV=y
>  CONFIG_IDE_PCI=y
>  CONFIG_IDE_ISA=y
> diff --git a/default-configs/mips64-softmmu.mak
> b/default-configs/mips64-softmmu.mak
> index 5900ee6..585d6bb 100644
> --- a/default-configs/mips64-softmmu.mak
> +++ b/default-configs/mips64-softmmu.mak
> @@ -10,6 +10,7 @@ CONFIG_I8254=y
>  CONFIG_PCSPK=y
>  CONFIG_USB_UHCI=y
>  CONFIG_FDC=y
> +CONFIG_IDE_CORE=y
>  CONFIG_IDE_QDEV=y
>  CONFIG_IDE_PCI=y
>  CONFIG_IDE_ISA=y
> diff --git a/default-configs/mips64el-softmmu.mak
> b/default-configs/mips64el-softmmu.mak
> index 3e1ba93..f68c2e0 100644
> --- a/default-configs/mips64el-softmmu.mak
> +++ b/default-configs/mips64el-softmmu.mak
> @@ -10,6 +10,7 @@ CONFIG_I8254=y
>  CONFIG_PCSPK=y
>  CONFIG_USB_UHCI=y
>  CONFIG_FDC=y
> +CONFIG_IDE_CORE=y
>  CONFIG_IDE_QDEV=y
>  CONFIG_IDE_PCI=y
>  CONFIG_IDE_ISA=y
> diff --git a/default-configs/mipsel-softmmu.mak
> b/default-configs/mipsel-softmmu.mak
> index 17b83d0..bb4644d 100644
> --- a/default-configs/mipsel-softmmu.mak
> +++ b/default-configs/mipsel-softmmu.mak
> @@ -10,6 +10,7 @@ CONFIG_I8254=y
>  CONFIG_PCSPK=y
>  CONFIG_USB_UHCI=y
>  CONFIG_FDC=y
> +CONFIG_IDE_CORE=y
>  CONFIG_IDE_QDEV=y
>  CONFIG_IDE_PCI=y
>  CONFIG_IDE_ISA=y
> diff --git a/default-configs/ppc-softmmu.mak b/default-configs/ppc-softmmu.mak
> index 5fe591c..49d6109 100644
> --- a/default-configs/ppc-softmmu.mak
> +++ b/default-configs/ppc-softmmu.mak
> @@ -9,6 +9,7 @@ CONFIG_VGA_PCI=y
>  CONFIG_SERIAL=y
>  CONFIG_I8254=y
>  CONFIG_FDC=y
> +CONFIG_IDE_CORE=y
>  CONFIG_IDE_QDEV=y
>  CONFIG_IDE_PCI=y
>  CONFIG_IDE_ISA=y
> diff --git a/default-configs/ppc64-softmmu.mak
> b/default-configs/ppc64-softmmu.mak
> index fe05073..6289164 100644
> --- a/default-configs/ppc64-softmmu.mak
> +++ b/default-configs/ppc64-softmmu.mak
> @@ -9,6 +9,7 @@ CONFIG_VGA_PCI=y
>  CONFIG_SERIAL=y
>  CONFIG_I8254=y
>  CONFIG_FDC=y
> +CONFIG_IDE_CORE=y
>  CONFIG_IDE_QDEV=y
>  CONFIG_IDE_PCI=y
>  CONFIG_IDE_ISA=y
> diff --git a/default-configs/ppcemb-softmmu.mak
> b/default-configs/ppcemb-softmmu.mak
> index 54fcef1..829d060 100644
> --- a/default-configs/ppcemb-softmmu.mak
> +++ b/default-configs/ppcemb-softmmu.mak
> @@ -9,6 +9,7 @@ CONFIG_VGA_PCI=y
>  CONFIG_SERIAL=y
>  CONFIG_I8254=y
>  CONFIG_FDC=y
> +CONFIG_IDE_CORE=y
>  CONFIG_IDE_QDEV=y
>  CONFIG_IDE_PCI=y
>  CONFIG_IDE_ISA=y
> diff --git a/default-configs/sh4-softmmu.mak b/default-configs/sh4-softmmu.mak
> index 79a4195..3df4705 100644
> --- a/default-configs/sh4-softmmu.mak
> +++ b/default-configs/sh4-softmmu.mak
> @@ -3,3 +3,4 @@
>  CONFIG_USB_OHCI=y
>  CONFIG_SERIAL=y
>  CONFIG_PTIMER=y
> +CONFIG_IDE_CORE=y
> diff --git a/default-configs/sh4eb-softmmu.mak
> b/default-configs/sh4eb-softmmu.mak
> index 73af23b..5fccd2c 100644
> --- a/default-configs/sh4eb-softmmu.mak
> +++ b/default-configs/sh4eb-softmmu.mak
> @@ -3,3 +3,4 @@
>  CONFIG_USB_OHCI=y
>  CONFIG_SERIAL=y
>  CONFIG_PTIMER=y
> +CONFIG_IDE_CORE=y
> diff --git a/default-configs/sparc64-softmmu.mak
> b/default-configs/sparc64-softmmu.mak
> index 14aab35..e45cf8c 100644
> --- a/default-configs/sparc64-softmmu.mak
> +++ b/default-configs/sparc64-softmmu.mak
> @@ -7,6 +7,7 @@ CONFIG_VGA_PCI=y
>  CONFIG_SERIAL=y
>  CONFIG_PARALLEL=y
>  CONFIG_FDC=y
> +CONFIG_IDE_CORE=y
>  CONFIG_IDE_QDEV=y
>  CONFIG_IDE_PCI=y
>  CONFIG_IDE_ISA=y
> diff --git a/default-configs/x86_64-softmmu.mak
> b/default-configs/x86_64-softmmu.mak
> index a9992af..e7e32d7 100644
> --- a/default-configs/x86_64-softmmu.mak
> +++ b/default-configs/x86_64-softmmu.mak
> @@ -9,6 +9,7 @@ CONFIG_I8254=y
>  CONFIG_PCSPK=y
>  CONFIG_USB_UHCI=y
>  CONFIG_FDC=y
> +CONFIG_IDE_CORE=y
>  CONFIG_IDE_QDEV=y
>  CONFIG_IDE_PCI=y
>  CONFIG_IDE_ISA=y
> diff --git a/hw/ide/core.c b/hw/ide/core.c
> index 67480bb..4c7a694 100644
> --- a/hw/ide/core.c
> +++ b/hw/ide/core.c
> @@ -26,7 +26,6 @@
>  #include <hw/pc.h>
>  #include <hw/pci.h>
>  #include <hw/scsi.h>
> -#include <hw/sh.h>
>  #include "block.h"
>  #include "block_int.h"
>  #include "qemu-timer.h"
> @@ -434,7 +433,7 @@ static int dma_buf_prepare(BMDMAState *bm, int is_write)
>      } prd;
>      int l, len;
> 
> -    qemu_sglist_init(&s->sg, s->nsector / (TARGET_PAGE_SIZE/512) + 1);
> +    qemu_sglist_init(&s->sg, s->nsector / (4096 / 512) + 1);
>      s->io_buffer_size = 0;
>      for(;;) {
>          if (bm->cur_prd_len == 0) {
> @@ -651,7 +650,6 @@ static void ide_sector_write(IDEState *s)
>      }
>      ide_set_sector(s, sector_num + n);
> 
> -#ifdef TARGET_I386
>      if (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
> @@ -659,11 +657,9 @@ static void ide_sector_write(IDEState *s)
>             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_mod_timer(s->sector_write_timer,
>                         qemu_get_clock(vm_clock) +
> (get_ticks_per_sec() / 1000));
> -    } else
> -#endif
> -    {
> +    } else {
>          ide_set_irq(s->bus);
>      }
>  }
> diff --git a/vl.c b/vl.c
> index d69250c..f12363c 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -207,8 +207,8 @@ int no_quit = 0;
>  CharDriverState *serial_hds[MAX_SERIAL_PORTS];
>  CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
>  CharDriverState *virtcon_hds[MAX_VIRTIO_CONSOLES];
> -#ifdef TARGET_I386
>  int win2k_install_hack = 0;
> +#ifdef TARGET_I386
>  int rtc_td_hack = 0;
>  #endif
>  int usb_enabled = 0;
> -- 
> 1.6.2.4
> 
> 
>
Aurelien Jarno - March 26, 2010, 10:34 p.m.
On Wed, Mar 24, 2010 at 10:53:19PM +0200, Blue Swirl wrote:
> Make win2k install hack unconditional as it is still restricted to
> x86 only in vl.c.
> 
> Replace TARGET_PAGE_SIZE with 4096 because that figure is already
> used later.

I don't really know this part of the code, but I would go for arbitrary
value removal, not the reverse.

> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
> ---
>  Makefile.objs                        |    1 +
>  Makefile.target                      |   11 ++++-------
>  default-configs/arm-softmmu.mak      |    1 +
>  default-configs/i386-softmmu.mak     |    1 +
>  default-configs/mips-softmmu.mak     |    1 +
>  default-configs/mips64-softmmu.mak   |    1 +
>  default-configs/mips64el-softmmu.mak |    1 +
>  default-configs/mipsel-softmmu.mak   |    1 +
>  default-configs/ppc-softmmu.mak      |    1 +
>  default-configs/ppc64-softmmu.mak    |    1 +
>  default-configs/ppcemb-softmmu.mak   |    1 +
>  default-configs/sh4-softmmu.mak      |    1 +
>  default-configs/sh4eb-softmmu.mak    |    1 +
>  default-configs/sparc64-softmmu.mak  |    1 +
>  default-configs/x86_64-softmmu.mak   |    1 +
>  hw/ide/core.c                        |   10 +++-------
>  vl.c                                 |    2 +-
>  17 files changed, 22 insertions(+), 15 deletions(-)
> 
> diff --git a/Makefile.objs b/Makefile.objs
> index 281f7a6..fe81f6c 100644
> --- a/Makefile.objs
> +++ b/Makefile.objs
> @@ -161,6 +161,7 @@ hw-obj-$(CONFIG_LAN9118) += lan9118.o
>  hw-obj-$(CONFIG_NE2000_ISA) += ne2000-isa.o
> 
>  # IDE
> +hw-obj-$(CONFIG_IDE_CORE) += ide/core.o
>  hw-obj-$(CONFIG_IDE_QDEV) += ide/qdev.o
>  hw-obj-$(CONFIG_IDE_PCI) += ide/pci.o
>  hw-obj-$(CONFIG_IDE_ISA) += ide/isa.o
> diff --git a/Makefile.target b/Makefile.target
> index eb4d010..a17de90 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -181,8 +181,7 @@ obj-y += rtl8139.o
>  obj-y += e1000.o
> 
>  # Hardware support
> -obj-i386-y = ide/core.o
> -obj-i386-y += pckbd.o dma.o
> +obj-i386-y = pckbd.o dma.o
>  obj-i386-y += vga.o
>  obj-i386-y += mc146818rtc.o i8259.o pc.o
>  obj-i386-y += cirrus_vga.o apic.o ioapic.o acpi.o piix_pci.o
> @@ -191,7 +190,7 @@ obj-i386-y += device-hotplug.o pci-hotplug.o
> smbios.o wdt_ib700.o
>  obj-i386-y += debugcon.o multiboot.o
> 
>  # shared objects
> -obj-ppc-y = ppc.o ide/core.o ide/macio.o
> +obj-ppc-y = ppc.o ide/macio.o
>  obj-ppc-y += vga.o dma.o openpic.o
>  # PREP target
>  obj-ppc-y += pckbd.o i8259.o mc146818rtc.o
> @@ -215,7 +214,6 @@ obj-mips-y += mips_addr.o mips_timer.o mips_int.o
>  obj-mips-y += dma.o vga.o i8259.o rc4030.o
>  obj-mips-y += vga-isa-mm.o
>  obj-mips-y += g364fb.o jazz_led.o dp8393x.o
> -obj-mips-y += ide/core.o
>  obj-mips-y += gt64xxx.o pckbd.o mc146818rtc.o acpi.o ds1225y.o
>  obj-mips-y += piix4.o cirrus_vga.o
>  obj-mips-y += mipsnet.o
> @@ -248,7 +246,6 @@ obj-cris-y += pflash_cfi02.o
> 
>  ifeq ($(TARGET_ARCH), sparc64)
>  obj-sparc-y = sun4u.o pckbd.o apb_pci.o
> -obj-sparc-y += ide/core.o
>  obj-sparc-y += vga.o
>  obj-sparc-y += mc146818rtc.o
>  obj-sparc-y += cirrus_vga.o
> @@ -268,7 +265,7 @@ obj-arm-y += arm-semi.o
>  obj-arm-y += pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
>  obj-arm-y += pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
>  obj-arm-y += pflash_cfi01.o gumstix.o
> -obj-arm-y += zaurus.o ide/core.o ide/microdrive.o spitz.o tosa.o tc6393xb.o
> +obj-arm-y += zaurus.o ide/microdrive.o spitz.o tosa.o tc6393xb.o
>  obj-arm-y += omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o
>  obj-arm-y += omap2.o omap_dss.o soc_dma.o
>  obj-arm-y += omap_sx1.o palm.o tsc210x.o
> @@ -282,7 +279,7 @@ obj-arm-y += syborg_virtio.o
> 
>  obj-sh4-y = shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
>  obj-sh4-y += sh_timer.o sh_serial.o sh_intc.o sh_pci.o sm501.o
> -obj-sh4-y += ide/core.o ide/mmio.o
> +obj-sh4-y += ide/mmio.o
> 
>  obj-m68k-y = an5206.o mcf5206.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
>  obj-m68k-y += m68k-semi.o dummy_m68k.o
> diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-softmmu.mak
> index 02ad192..ea878a4 100644
> --- a/default-configs/arm-softmmu.mak
> +++ b/default-configs/arm-softmmu.mak
> @@ -8,6 +8,7 @@ CONFIG_ECC=y
>  CONFIG_SERIAL=y
>  CONFIG_PTIMER=y
>  CONFIG_SD=y
> +CONFIG_IDE_CORE=y
>  CONFIG_MAX7310=y
>  CONFIG_WM8750=y
>  CONFIG_TWL92230=y
> diff --git a/default-configs/i386-softmmu.mak b/default-configs/i386-softmmu.mak
> index 4dbf656..59eb670 100644
> --- a/default-configs/i386-softmmu.mak
> +++ b/default-configs/i386-softmmu.mak
> @@ -9,6 +9,7 @@ CONFIG_I8254=y
>  CONFIG_PCSPK=y
>  CONFIG_USB_UHCI=y
>  CONFIG_FDC=y
> +CONFIG_IDE_CORE=y
>  CONFIG_IDE_QDEV=y
>  CONFIG_IDE_PCI=y
>  CONFIG_IDE_ISA=y
> diff --git a/default-configs/mips-softmmu.mak b/default-configs/mips-softmmu.mak
> index 345a093..cb48ed1 100644
> --- a/default-configs/mips-softmmu.mak
> +++ b/default-configs/mips-softmmu.mak
> @@ -10,6 +10,7 @@ CONFIG_I8254=y
>  CONFIG_PCSPK=y
>  CONFIG_USB_UHCI=y
>  CONFIG_FDC=y
> +CONFIG_IDE_CORE=y
>  CONFIG_IDE_QDEV=y
>  CONFIG_IDE_PCI=y
>  CONFIG_IDE_ISA=y
> diff --git a/default-configs/mips64-softmmu.mak
> b/default-configs/mips64-softmmu.mak
> index 5900ee6..585d6bb 100644
> --- a/default-configs/mips64-softmmu.mak
> +++ b/default-configs/mips64-softmmu.mak
> @@ -10,6 +10,7 @@ CONFIG_I8254=y
>  CONFIG_PCSPK=y
>  CONFIG_USB_UHCI=y
>  CONFIG_FDC=y
> +CONFIG_IDE_CORE=y
>  CONFIG_IDE_QDEV=y
>  CONFIG_IDE_PCI=y
>  CONFIG_IDE_ISA=y
> diff --git a/default-configs/mips64el-softmmu.mak
> b/default-configs/mips64el-softmmu.mak
> index 3e1ba93..f68c2e0 100644
> --- a/default-configs/mips64el-softmmu.mak
> +++ b/default-configs/mips64el-softmmu.mak
> @@ -10,6 +10,7 @@ CONFIG_I8254=y
>  CONFIG_PCSPK=y
>  CONFIG_USB_UHCI=y
>  CONFIG_FDC=y
> +CONFIG_IDE_CORE=y
>  CONFIG_IDE_QDEV=y
>  CONFIG_IDE_PCI=y
>  CONFIG_IDE_ISA=y
> diff --git a/default-configs/mipsel-softmmu.mak
> b/default-configs/mipsel-softmmu.mak
> index 17b83d0..bb4644d 100644
> --- a/default-configs/mipsel-softmmu.mak
> +++ b/default-configs/mipsel-softmmu.mak
> @@ -10,6 +10,7 @@ CONFIG_I8254=y
>  CONFIG_PCSPK=y
>  CONFIG_USB_UHCI=y
>  CONFIG_FDC=y
> +CONFIG_IDE_CORE=y
>  CONFIG_IDE_QDEV=y
>  CONFIG_IDE_PCI=y
>  CONFIG_IDE_ISA=y
> diff --git a/default-configs/ppc-softmmu.mak b/default-configs/ppc-softmmu.mak
> index 5fe591c..49d6109 100644
> --- a/default-configs/ppc-softmmu.mak
> +++ b/default-configs/ppc-softmmu.mak
> @@ -9,6 +9,7 @@ CONFIG_VGA_PCI=y
>  CONFIG_SERIAL=y
>  CONFIG_I8254=y
>  CONFIG_FDC=y
> +CONFIG_IDE_CORE=y
>  CONFIG_IDE_QDEV=y
>  CONFIG_IDE_PCI=y
>  CONFIG_IDE_ISA=y
> diff --git a/default-configs/ppc64-softmmu.mak
> b/default-configs/ppc64-softmmu.mak
> index fe05073..6289164 100644
> --- a/default-configs/ppc64-softmmu.mak
> +++ b/default-configs/ppc64-softmmu.mak
> @@ -9,6 +9,7 @@ CONFIG_VGA_PCI=y
>  CONFIG_SERIAL=y
>  CONFIG_I8254=y
>  CONFIG_FDC=y
> +CONFIG_IDE_CORE=y
>  CONFIG_IDE_QDEV=y
>  CONFIG_IDE_PCI=y
>  CONFIG_IDE_ISA=y
> diff --git a/default-configs/ppcemb-softmmu.mak
> b/default-configs/ppcemb-softmmu.mak
> index 54fcef1..829d060 100644
> --- a/default-configs/ppcemb-softmmu.mak
> +++ b/default-configs/ppcemb-softmmu.mak
> @@ -9,6 +9,7 @@ CONFIG_VGA_PCI=y
>  CONFIG_SERIAL=y
>  CONFIG_I8254=y
>  CONFIG_FDC=y
> +CONFIG_IDE_CORE=y
>  CONFIG_IDE_QDEV=y
>  CONFIG_IDE_PCI=y
>  CONFIG_IDE_ISA=y
> diff --git a/default-configs/sh4-softmmu.mak b/default-configs/sh4-softmmu.mak
> index 79a4195..3df4705 100644
> --- a/default-configs/sh4-softmmu.mak
> +++ b/default-configs/sh4-softmmu.mak
> @@ -3,3 +3,4 @@
>  CONFIG_USB_OHCI=y
>  CONFIG_SERIAL=y
>  CONFIG_PTIMER=y
> +CONFIG_IDE_CORE=y
> diff --git a/default-configs/sh4eb-softmmu.mak
> b/default-configs/sh4eb-softmmu.mak
> index 73af23b..5fccd2c 100644
> --- a/default-configs/sh4eb-softmmu.mak
> +++ b/default-configs/sh4eb-softmmu.mak
> @@ -3,3 +3,4 @@
>  CONFIG_USB_OHCI=y
>  CONFIG_SERIAL=y
>  CONFIG_PTIMER=y
> +CONFIG_IDE_CORE=y
> diff --git a/default-configs/sparc64-softmmu.mak
> b/default-configs/sparc64-softmmu.mak
> index 14aab35..e45cf8c 100644
> --- a/default-configs/sparc64-softmmu.mak
> +++ b/default-configs/sparc64-softmmu.mak
> @@ -7,6 +7,7 @@ CONFIG_VGA_PCI=y
>  CONFIG_SERIAL=y
>  CONFIG_PARALLEL=y
>  CONFIG_FDC=y
> +CONFIG_IDE_CORE=y
>  CONFIG_IDE_QDEV=y
>  CONFIG_IDE_PCI=y
>  CONFIG_IDE_ISA=y
> diff --git a/default-configs/x86_64-softmmu.mak
> b/default-configs/x86_64-softmmu.mak
> index a9992af..e7e32d7 100644
> --- a/default-configs/x86_64-softmmu.mak
> +++ b/default-configs/x86_64-softmmu.mak
> @@ -9,6 +9,7 @@ CONFIG_I8254=y
>  CONFIG_PCSPK=y
>  CONFIG_USB_UHCI=y
>  CONFIG_FDC=y
> +CONFIG_IDE_CORE=y
>  CONFIG_IDE_QDEV=y
>  CONFIG_IDE_PCI=y
>  CONFIG_IDE_ISA=y
> diff --git a/hw/ide/core.c b/hw/ide/core.c
> index 67480bb..4c7a694 100644
> --- a/hw/ide/core.c
> +++ b/hw/ide/core.c
> @@ -26,7 +26,6 @@
>  #include <hw/pc.h>
>  #include <hw/pci.h>
>  #include <hw/scsi.h>
> -#include <hw/sh.h>
>  #include "block.h"
>  #include "block_int.h"
>  #include "qemu-timer.h"
> @@ -434,7 +433,7 @@ static int dma_buf_prepare(BMDMAState *bm, int is_write)
>      } prd;
>      int l, len;
> 
> -    qemu_sglist_init(&s->sg, s->nsector / (TARGET_PAGE_SIZE/512) + 1);
> +    qemu_sglist_init(&s->sg, s->nsector / (4096 / 512) + 1);
>      s->io_buffer_size = 0;
>      for(;;) {
>          if (bm->cur_prd_len == 0) {
> @@ -651,7 +650,6 @@ static void ide_sector_write(IDEState *s)
>      }
>      ide_set_sector(s, sector_num + n);
> 
> -#ifdef TARGET_I386
>      if (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
> @@ -659,11 +657,9 @@ static void ide_sector_write(IDEState *s)
>             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_mod_timer(s->sector_write_timer,
>                         qemu_get_clock(vm_clock) +
> (get_ticks_per_sec() / 1000));
> -    } else
> -#endif
> -    {
> +    } else {
>          ide_set_irq(s->bus);
>      }
>  }
> diff --git a/vl.c b/vl.c
> index d69250c..f12363c 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -207,8 +207,8 @@ int no_quit = 0;
>  CharDriverState *serial_hds[MAX_SERIAL_PORTS];
>  CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
>  CharDriverState *virtcon_hds[MAX_VIRTIO_CONSOLES];
> -#ifdef TARGET_I386
>  int win2k_install_hack = 0;
> +#ifdef TARGET_I386
>  int rtc_td_hack = 0;
>  #endif
>  int usb_enabled = 0;
> -- 
> 1.6.2.4
> 
> 
>

Patch

diff --git a/Makefile.objs b/Makefile.objs
index 281f7a6..fe81f6c 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -161,6 +161,7 @@  hw-obj-$(CONFIG_LAN9118) += lan9118.o
 hw-obj-$(CONFIG_NE2000_ISA) += ne2000-isa.o

 # IDE
+hw-obj-$(CONFIG_IDE_CORE) += ide/core.o
 hw-obj-$(CONFIG_IDE_QDEV) += ide/qdev.o
 hw-obj-$(CONFIG_IDE_PCI) += ide/pci.o
 hw-obj-$(CONFIG_IDE_ISA) += ide/isa.o
diff --git a/Makefile.target b/Makefile.target
index eb4d010..a17de90 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -181,8 +181,7 @@  obj-y += rtl8139.o
 obj-y += e1000.o

 # Hardware support
-obj-i386-y = ide/core.o
-obj-i386-y += pckbd.o dma.o
+obj-i386-y = pckbd.o dma.o
 obj-i386-y += vga.o
 obj-i386-y += mc146818rtc.o i8259.o pc.o
 obj-i386-y += cirrus_vga.o apic.o ioapic.o acpi.o piix_pci.o
@@ -191,7 +190,7 @@  obj-i386-y += device-hotplug.o pci-hotplug.o
smbios.o wdt_ib700.o
 obj-i386-y += debugcon.o multiboot.o

 # shared objects
-obj-ppc-y = ppc.o ide/core.o ide/macio.o
+obj-ppc-y = ppc.o ide/macio.o
 obj-ppc-y += vga.o dma.o openpic.o
 # PREP target
 obj-ppc-y += pckbd.o i8259.o mc146818rtc.o
@@ -215,7 +214,6 @@  obj-mips-y += mips_addr.o mips_timer.o mips_int.o
 obj-mips-y += dma.o vga.o i8259.o rc4030.o
 obj-mips-y += vga-isa-mm.o
 obj-mips-y += g364fb.o jazz_led.o dp8393x.o
-obj-mips-y += ide/core.o
 obj-mips-y += gt64xxx.o pckbd.o mc146818rtc.o acpi.o ds1225y.o
 obj-mips-y += piix4.o cirrus_vga.o
 obj-mips-y += mipsnet.o
@@ -248,7 +246,6 @@  obj-cris-y += pflash_cfi02.o

 ifeq ($(TARGET_ARCH), sparc64)
 obj-sparc-y = sun4u.o pckbd.o apb_pci.o
-obj-sparc-y += ide/core.o
 obj-sparc-y += vga.o
 obj-sparc-y += mc146818rtc.o
 obj-sparc-y += cirrus_vga.o
@@ -268,7 +265,7 @@  obj-arm-y += arm-semi.o
 obj-arm-y += pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
 obj-arm-y += pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
 obj-arm-y += pflash_cfi01.o gumstix.o
-obj-arm-y += zaurus.o ide/core.o ide/microdrive.o spitz.o tosa.o tc6393xb.o
+obj-arm-y += zaurus.o ide/microdrive.o spitz.o tosa.o tc6393xb.o
 obj-arm-y += omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o
 obj-arm-y += omap2.o omap_dss.o soc_dma.o
 obj-arm-y += omap_sx1.o palm.o tsc210x.o
@@ -282,7 +279,7 @@  obj-arm-y += syborg_virtio.o

 obj-sh4-y = shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
 obj-sh4-y += sh_timer.o sh_serial.o sh_intc.o sh_pci.o sm501.o
-obj-sh4-y += ide/core.o ide/mmio.o
+obj-sh4-y += ide/mmio.o

 obj-m68k-y = an5206.o mcf5206.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
 obj-m68k-y += m68k-semi.o dummy_m68k.o
diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-softmmu.mak
index 02ad192..ea878a4 100644
--- a/default-configs/arm-softmmu.mak
+++ b/default-configs/arm-softmmu.mak
@@ -8,6 +8,7 @@  CONFIG_ECC=y
 CONFIG_SERIAL=y
 CONFIG_PTIMER=y
 CONFIG_SD=y
+CONFIG_IDE_CORE=y
 CONFIG_MAX7310=y
 CONFIG_WM8750=y
 CONFIG_TWL92230=y
diff --git a/default-configs/i386-softmmu.mak b/default-configs/i386-softmmu.mak
index 4dbf656..59eb670 100644
--- a/default-configs/i386-softmmu.mak
+++ b/default-configs/i386-softmmu.mak
@@ -9,6 +9,7 @@  CONFIG_I8254=y
 CONFIG_PCSPK=y
 CONFIG_USB_UHCI=y
 CONFIG_FDC=y
+CONFIG_IDE_CORE=y
 CONFIG_IDE_QDEV=y
 CONFIG_IDE_PCI=y
 CONFIG_IDE_ISA=y
diff --git a/default-configs/mips-softmmu.mak b/default-configs/mips-softmmu.mak
index 345a093..cb48ed1 100644
--- a/default-configs/mips-softmmu.mak
+++ b/default-configs/mips-softmmu.mak
@@ -10,6 +10,7 @@  CONFIG_I8254=y
 CONFIG_PCSPK=y
 CONFIG_USB_UHCI=y
 CONFIG_FDC=y
+CONFIG_IDE_CORE=y
 CONFIG_IDE_QDEV=y
 CONFIG_IDE_PCI=y
 CONFIG_IDE_ISA=y
diff --git a/default-configs/mips64-softmmu.mak
b/default-configs/mips64-softmmu.mak
index 5900ee6..585d6bb 100644
--- a/default-configs/mips64-softmmu.mak
+++ b/default-configs/mips64-softmmu.mak
@@ -10,6 +10,7 @@  CONFIG_I8254=y
 CONFIG_PCSPK=y
 CONFIG_USB_UHCI=y
 CONFIG_FDC=y
+CONFIG_IDE_CORE=y
 CONFIG_IDE_QDEV=y
 CONFIG_IDE_PCI=y
 CONFIG_IDE_ISA=y
diff --git a/default-configs/mips64el-softmmu.mak
b/default-configs/mips64el-softmmu.mak
index 3e1ba93..f68c2e0 100644
--- a/default-configs/mips64el-softmmu.mak
+++ b/default-configs/mips64el-softmmu.mak
@@ -10,6 +10,7 @@  CONFIG_I8254=y
 CONFIG_PCSPK=y
 CONFIG_USB_UHCI=y
 CONFIG_FDC=y
+CONFIG_IDE_CORE=y
 CONFIG_IDE_QDEV=y
 CONFIG_IDE_PCI=y
 CONFIG_IDE_ISA=y
diff --git a/default-configs/mipsel-softmmu.mak
b/default-configs/mipsel-softmmu.mak
index 17b83d0..bb4644d 100644
--- a/default-configs/mipsel-softmmu.mak
+++ b/default-configs/mipsel-softmmu.mak
@@ -10,6 +10,7 @@  CONFIG_I8254=y
 CONFIG_PCSPK=y
 CONFIG_USB_UHCI=y
 CONFIG_FDC=y
+CONFIG_IDE_CORE=y
 CONFIG_IDE_QDEV=y
 CONFIG_IDE_PCI=y
 CONFIG_IDE_ISA=y
diff --git a/default-configs/ppc-softmmu.mak b/default-configs/ppc-softmmu.mak
index 5fe591c..49d6109 100644
--- a/default-configs/ppc-softmmu.mak
+++ b/default-configs/ppc-softmmu.mak
@@ -9,6 +9,7 @@  CONFIG_VGA_PCI=y
 CONFIG_SERIAL=y
 CONFIG_I8254=y
 CONFIG_FDC=y
+CONFIG_IDE_CORE=y
 CONFIG_IDE_QDEV=y
 CONFIG_IDE_PCI=y
 CONFIG_IDE_ISA=y
diff --git a/default-configs/ppc64-softmmu.mak
b/default-configs/ppc64-softmmu.mak
index fe05073..6289164 100644
--- a/default-configs/ppc64-softmmu.mak
+++ b/default-configs/ppc64-softmmu.mak
@@ -9,6 +9,7 @@  CONFIG_VGA_PCI=y
 CONFIG_SERIAL=y
 CONFIG_I8254=y
 CONFIG_FDC=y
+CONFIG_IDE_CORE=y
 CONFIG_IDE_QDEV=y
 CONFIG_IDE_PCI=y
 CONFIG_IDE_ISA=y
diff --git a/default-configs/ppcemb-softmmu.mak
b/default-configs/ppcemb-softmmu.mak
index 54fcef1..829d060 100644
--- a/default-configs/ppcemb-softmmu.mak
+++ b/default-configs/ppcemb-softmmu.mak
@@ -9,6 +9,7 @@  CONFIG_VGA_PCI=y
 CONFIG_SERIAL=y
 CONFIG_I8254=y
 CONFIG_FDC=y
+CONFIG_IDE_CORE=y
 CONFIG_IDE_QDEV=y
 CONFIG_IDE_PCI=y
 CONFIG_IDE_ISA=y
diff --git a/default-configs/sh4-softmmu.mak b/default-configs/sh4-softmmu.mak
index 79a4195..3df4705 100644
--- a/default-configs/sh4-softmmu.mak
+++ b/default-configs/sh4-softmmu.mak
@@ -3,3 +3,4 @@ 
 CONFIG_USB_OHCI=y
 CONFIG_SERIAL=y
 CONFIG_PTIMER=y
+CONFIG_IDE_CORE=y
diff --git a/default-configs/sh4eb-softmmu.mak
b/default-configs/sh4eb-softmmu.mak
index 73af23b..5fccd2c 100644
--- a/default-configs/sh4eb-softmmu.mak
+++ b/default-configs/sh4eb-softmmu.mak
@@ -3,3 +3,4 @@ 
 CONFIG_USB_OHCI=y
 CONFIG_SERIAL=y
 CONFIG_PTIMER=y
+CONFIG_IDE_CORE=y
diff --git a/default-configs/sparc64-softmmu.mak
b/default-configs/sparc64-softmmu.mak
index 14aab35..e45cf8c 100644
--- a/default-configs/sparc64-softmmu.mak
+++ b/default-configs/sparc64-softmmu.mak
@@ -7,6 +7,7 @@  CONFIG_VGA_PCI=y
 CONFIG_SERIAL=y
 CONFIG_PARALLEL=y
 CONFIG_FDC=y
+CONFIG_IDE_CORE=y
 CONFIG_IDE_QDEV=y
 CONFIG_IDE_PCI=y
 CONFIG_IDE_ISA=y
diff --git a/default-configs/x86_64-softmmu.mak
b/default-configs/x86_64-softmmu.mak
index a9992af..e7e32d7 100644
--- a/default-configs/x86_64-softmmu.mak
+++ b/default-configs/x86_64-softmmu.mak
@@ -9,6 +9,7 @@  CONFIG_I8254=y
 CONFIG_PCSPK=y
 CONFIG_USB_UHCI=y
 CONFIG_FDC=y
+CONFIG_IDE_CORE=y
 CONFIG_IDE_QDEV=y
 CONFIG_IDE_PCI=y
 CONFIG_IDE_ISA=y
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 67480bb..4c7a694 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -26,7 +26,6 @@ 
 #include <hw/pc.h>
 #include <hw/pci.h>
 #include <hw/scsi.h>
-#include <hw/sh.h>
 #include "block.h"
 #include "block_int.h"
 #include "qemu-timer.h"
@@ -434,7 +433,7 @@  static int dma_buf_prepare(BMDMAState *bm, int is_write)
     } prd;
     int l, len;

-    qemu_sglist_init(&s->sg, s->nsector / (TARGET_PAGE_SIZE/512) + 1);
+    qemu_sglist_init(&s->sg, s->nsector / (4096 / 512) + 1);
     s->io_buffer_size = 0;
     for(;;) {
         if (bm->cur_prd_len == 0) {
@@ -651,7 +650,6 @@  static void ide_sector_write(IDEState *s)
     }
     ide_set_sector(s, sector_num + n);

-#ifdef TARGET_I386
     if (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
@@ -659,11 +657,9 @@  static void ide_sector_write(IDEState *s)
            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_mod_timer(s->sector_write_timer,
                        qemu_get_clock(vm_clock) +
(get_ticks_per_sec() / 1000));
-    } else
-#endif
-    {
+    } else {
         ide_set_irq(s->bus);
     }
 }
diff --git a/vl.c b/vl.c
index d69250c..f12363c 100644
--- a/vl.c
+++ b/vl.c
@@ -207,8 +207,8 @@  int no_quit = 0;
 CharDriverState *serial_hds[MAX_SERIAL_PORTS];
 CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
 CharDriverState *virtcon_hds[MAX_VIRTIO_CONSOLES];
-#ifdef TARGET_I386
 int win2k_install_hack = 0;
+#ifdef TARGET_I386
 int rtc_td_hack = 0;
 #endif
 int usb_enabled = 0;