From patchwork Fri Aug 28 13:47:03 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 32377 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id 182AFB7BCA for ; Sat, 29 Aug 2009 00:30:39 +1000 (EST) Received: from localhost ([127.0.0.1]:53688 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mh2TA-0005vS-4x for incoming@patchwork.ozlabs.org; Fri, 28 Aug 2009 10:30:24 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mh1nR-0000JW-7v for qemu-devel@nongnu.org; Fri, 28 Aug 2009 09:47:17 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mh1nM-0000Ce-MO for qemu-devel@nongnu.org; Fri, 28 Aug 2009 09:47:16 -0400 Received: from [199.232.76.173] (port=46538 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mh1nM-0000CN-GU for qemu-devel@nongnu.org; Fri, 28 Aug 2009 09:47:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:9854) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mh1nL-0008SC-Ng for qemu-devel@nongnu.org; Fri, 28 Aug 2009 09:47:12 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n7SDlAmv006340 for ; Fri, 28 Aug 2009 09:47:10 -0400 Received: from zweiblum.home.kraxel.org (vpn2-8-220.ams2.redhat.com [10.36.8.220]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id n7SDl6i4016344; Fri, 28 Aug 2009 09:47:07 -0400 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id 3786B700DC; Fri, 28 Aug 2009 15:47:04 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 28 Aug 2009 15:47:03 +0200 Message-Id: <1251467223-4839-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH] ide: pass down DriveInfo instead of BlockDriverState X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Gerd Hoffmann --- hw/ide.h | 12 ++++++------ hw/ide/core.c | 7 +++++-- hw/ide/internal.h | 2 +- hw/ide/isa.c | 2 +- hw/ide/macio.c | 2 +- hw/ide/microdrive.c | 2 +- hw/ide/mmio.c | 2 +- hw/ide/pci.c | 11 +++-------- hw/mips_malta.c | 5 ++--- hw/mips_r4k.c | 5 ++--- hw/pc.c | 15 +++++++-------- hw/pcmcia.h | 3 ++- hw/ppc_newworld.c | 6 ++---- hw/ppc_oldworld.c | 15 +++++---------- hw/ppc_prep.c | 5 ++--- hw/r2d.c | 2 +- hw/spitz.c | 2 +- hw/sun4u.c | 5 ++--- hw/tosa.c | 2 +- 19 files changed, 46 insertions(+), 59 deletions(-) diff --git a/hw/ide.h b/hw/ide.h index 56cf4ec..08bebb4 100644 --- a/hw/ide.h +++ b/hw/ide.h @@ -5,23 +5,23 @@ /* ide-isa.c */ void isa_ide_init(int iobase, int iobase2, qemu_irq irq, - BlockDriverState *hd0, BlockDriverState *hd1); + DriveInfo *hd0, DriveInfo *hd1); /* ide-pci.c */ -void pci_cmd646_ide_init(PCIBus *bus, BlockDriverState **hd_table, +void pci_cmd646_ide_init(PCIBus *bus, DriveInfo **hd_table, int secondary_ide_enabled); -void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn, +void pci_piix3_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn, qemu_irq *pic); -void pci_piix4_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn, +void pci_piix4_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn, qemu_irq *pic); /* ide-macio.c */ -int pmac_ide_init (BlockDriverState **hd_table, qemu_irq irq, +int pmac_ide_init (DriveInfo **hd_table, qemu_irq irq, void *dbdma, int channel, qemu_irq dma_irq); /* ide-mmio.c */ void mmio_ide_init (target_phys_addr_t membase, target_phys_addr_t membase2, qemu_irq irq, int shift, - BlockDriverState *hd0, BlockDriverState *hd1); + DriveInfo *hd0, DriveInfo *hd1); #endif /* HW_IDE_H */ diff --git a/hw/ide/core.c b/hw/ide/core.c index 79a3a9c..572a19d 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -2506,7 +2506,7 @@ void ide_reset(IDEState *s) s->media_changed = 0; } -void ide_init2(IDEBus *bus, BlockDriverState *hd0, BlockDriverState *hd1, +void ide_init2(IDEBus *bus, DriveInfo *hd0, DriveInfo *hd1, qemu_irq irq) { IDEState *s; @@ -2518,7 +2518,10 @@ void ide_init2(IDEBus *bus, BlockDriverState *hd0, BlockDriverState *hd1, s = bus->ifs + i; s->bus = bus; s->unit = i; - s->bs = (i == 0) ? hd0 : hd1; + if (i == 0 && hd0) + s->bs = hd0->bdrv; + if (i == 1 && hd1) + s->bs = hd1->bdrv; s->io_buffer = qemu_blockalign(s->bs, IDE_DMA_BUF_SECTORS*512 + 4); if (s->bs) { bdrv_get_geometry(s->bs, &nb_sectors); diff --git a/hw/ide/internal.h b/hw/ide/internal.h index 65991a8..fb00064 100644 --- a/hw/ide/internal.h +++ b/hw/ide/internal.h @@ -528,7 +528,7 @@ uint32_t ide_data_readw(void *opaque, uint32_t addr); void ide_data_writel(void *opaque, uint32_t addr, uint32_t val); uint32_t ide_data_readl(void *opaque, uint32_t addr); -void ide_init2(IDEBus *bus, BlockDriverState *hd0, BlockDriverState *hd1, +void ide_init2(IDEBus *bus, DriveInfo *hd0, DriveInfo *hd1, qemu_irq irq); void ide_init_ioport(IDEBus *bus, int iobase, int iobase2); diff --git a/hw/ide/isa.c b/hw/ide/isa.c index aa026c7..ec2d6fb 100644 --- a/hw/ide/isa.c +++ b/hw/ide/isa.c @@ -58,7 +58,7 @@ static int isa_ide_load(QEMUFile* f, void *opaque, int version_id) } void isa_ide_init(int iobase, int iobase2, qemu_irq irq, - BlockDriverState *hd0, BlockDriverState *hd1) + DriveInfo *hd0, DriveInfo *hd1) { ISAIDEState *s; diff --git a/hw/ide/macio.c b/hw/ide/macio.c index 4dc3568..959ea7e 100644 --- a/hw/ide/macio.c +++ b/hw/ide/macio.c @@ -334,7 +334,7 @@ static void pmac_ide_reset(void *opaque) /* hd_table must contain 4 block drivers */ /* PowerMac uses memory mapped registers, not I/O. Return the memory I/O index to access the ide. */ -int pmac_ide_init (BlockDriverState **hd_table, qemu_irq irq, +int pmac_ide_init (DriveInfo **hd_table, qemu_irq irq, void *dbdma, int channel, qemu_irq dma_irq) { MACIOIDEState *d; diff --git a/hw/ide/microdrive.c b/hw/ide/microdrive.c index a735452..887cde3 100644 --- a/hw/ide/microdrive.c +++ b/hw/ide/microdrive.c @@ -555,7 +555,7 @@ static int dscm1xxxx_detach(void *opaque) return 0; } -PCMCIACardState *dscm1xxxx_init(BlockDriverState *bdrv) +PCMCIACardState *dscm1xxxx_init(DriveInfo *bdrv) { MicroDriveState *md = (MicroDriveState *) qemu_mallocz(sizeof(MicroDriveState)); md->card.state = md; diff --git a/hw/ide/mmio.c b/hw/ide/mmio.c index 99ddf9d..acaa900 100644 --- a/hw/ide/mmio.c +++ b/hw/ide/mmio.c @@ -124,7 +124,7 @@ static int mmio_ide_load(QEMUFile* f, void *opaque, int version_id) void mmio_ide_init (target_phys_addr_t membase, target_phys_addr_t membase2, qemu_irq irq, int shift, - BlockDriverState *hd0, BlockDriverState *hd1) + DriveInfo *hd0, DriveInfo *hd1) { MMIOState *s = qemu_mallocz(sizeof(MMIOState)); IDEBus *bus = qemu_mallocz(sizeof(*bus)); diff --git a/hw/ide/pci.c b/hw/ide/pci.c index a3d6bd0..0e8583a 100644 --- a/hw/ide/pci.c +++ b/hw/ide/pci.c @@ -375,7 +375,7 @@ static void cmd646_reset(void *opaque) } /* CMD646 PCI IDE controller */ -void pci_cmd646_ide_init(PCIBus *bus, BlockDriverState **hd_table, +void pci_cmd646_ide_init(PCIBus *bus, DriveInfo **hd_table, int secondary_ide_enabled) { PCIIDEState *d; @@ -443,12 +443,11 @@ static void piix3_reset(void *opaque) /* hd_table must contain 4 block drivers */ /* NOTE: for the PIIX3, the IRQs and IOports are hardcoded */ -void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn, +void pci_piix3_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn, qemu_irq *pic) { PCIIDEState *d; uint8_t *pci_conf; - int i; /* register a function 1 of PIIX3 */ d = (PCIIDEState *)pci_register_device(bus, "PIIX3 IDE", @@ -475,16 +474,12 @@ void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn, ide_init_ioport(&d->bus[0], 0x1f0, 0x3f6); ide_init_ioport(&d->bus[1], 0x170, 0x376); - for (i = 0; i < 4; i++) - if (hd_table[i]) - hd_table[i]->private = &d->dev; - register_savevm("ide", 0, 3, pci_ide_save, pci_ide_load, d); } /* hd_table must contain 4 block drivers */ /* NOTE: for the PIIX4, the IRQs and IOports are hardcoded */ -void pci_piix4_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn, +void pci_piix4_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn, qemu_irq *pic) { PCIIDEState *d; diff --git a/hw/mips_malta.c b/hw/mips_malta.c index a70d79e..275f72c 100644 --- a/hw/mips_malta.c +++ b/hw/mips_malta.c @@ -775,7 +775,7 @@ void mips_malta_init (ram_addr_t ram_size, i2c_bus *smbus; int i; DriveInfo *dinfo; - BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; + DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; BlockDriverState *fd[MAX_FD]; int fl_idx = 0; int fl_sectors = 0; @@ -899,8 +899,7 @@ void mips_malta_init (ram_addr_t ram_size, } for(i = 0; i < MAX_IDE_BUS * MAX_IDE_DEVS; i++) { - dinfo = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); - hd[i] = dinfo ? dinfo->bdrv : NULL; + hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); } piix4_devfn = piix4_init(pci_bus, 80); diff --git a/hw/mips_r4k.c b/hw/mips_r4k.c index 24c1884..da5ca31 100644 --- a/hw/mips_r4k.c +++ b/hw/mips_r4k.c @@ -156,7 +156,7 @@ void mips_r4k_init (ram_addr_t ram_size, RTCState *rtc_state; int i; qemu_irq *i8259; - BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; + DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; DriveInfo *dinfo; /* init CPUs */ @@ -268,8 +268,7 @@ void mips_r4k_init (ram_addr_t ram_size, } for(i = 0; i < MAX_IDE_BUS * MAX_IDE_DEVS; i++) { - dinfo = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); - hd[i] = dinfo ? dinfo->bdrv : NULL; + hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); } for(i = 0; i < MAX_IDE_BUS; i++) diff --git a/hw/pc.c b/hw/pc.c index 32713b4..443a1f5 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -264,7 +264,7 @@ static int pc_boot_set(void *opaque, const char *boot_device) /* hd_table must contain 4 block drivers */ static void cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size, - const char *boot_device, BlockDriverState **hd_table) + const char *boot_device, DriveInfo **hd_table) { RTCState *s = rtc_state; int nbds, bds[3] = { 0, }; @@ -355,9 +355,9 @@ static void cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size, rtc_set_memory(s, 0x12, (hd_table[0] ? 0xf0 : 0) | (hd_table[1] ? 0x0f : 0)); if (hd_table[0]) - cmos_init_hd(0x19, 0x1b, hd_table[0]); + cmos_init_hd(0x19, 0x1b, hd_table[0]->bdrv); if (hd_table[1]) - cmos_init_hd(0x1a, 0x24, hd_table[1]); + cmos_init_hd(0x1a, 0x24, hd_table[1]->bdrv); val = 0; for (i = 0; i < 4; i++) { @@ -367,9 +367,9 @@ static void cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size, geometry. It is always such that: 1 <= sects <= 63, 1 <= heads <= 16, 1 <= cylinders <= 16383. The BIOS geometry can be different if a translation is done. */ - translation = bdrv_get_translation_hint(hd_table[i]); + translation = bdrv_get_translation_hint(hd_table[i]->bdrv); if (translation == BIOS_ATA_TRANSLATION_AUTO) { - bdrv_get_geometry_hint(hd_table[i], &cylinders, &heads, §ors); + bdrv_get_geometry_hint(hd_table[i]->bdrv, &cylinders, &heads, §ors); if (cylinders <= 1024 && heads <= 16 && sectors <= 63) { /* No translation. */ translation = 0; @@ -1131,7 +1131,7 @@ static void pc_init1(ram_addr_t ram_size, qemu_irq *i8259; IsaIrqState *isa_irq_state; DriveInfo *dinfo; - BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; + DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; BlockDriverState *fd[MAX_FD]; int using_vga = cirrus_vga_enabled || std_vga_enabled || vmsvga_enabled; void *fw_cfg; @@ -1360,8 +1360,7 @@ static void pc_init1(ram_addr_t ram_size, } for(i = 0; i < MAX_IDE_BUS * MAX_IDE_DEVS; i++) { - dinfo = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); - hd[i] = dinfo ? dinfo->bdrv : NULL; + hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); } if (pci_enabled) { diff --git a/hw/pcmcia.h b/hw/pcmcia.h index 7171504..cf2db9d 100644 --- a/hw/pcmcia.h +++ b/hw/pcmcia.h @@ -1,6 +1,7 @@ /* PCMCIA/Cardbus */ #include "qemu-common.h" +#include "sysemu.h" typedef struct { qemu_irq irq; @@ -48,4 +49,4 @@ struct PCMCIACardState { #define CISTPL_ENDMARK 0xff /* dscm1xxxx.c */ -PCMCIACardState *dscm1xxxx_init(BlockDriverState *bdrv); +PCMCIACardState *dscm1xxxx_init(DriveInfo *bdrv); diff --git a/hw/ppc_newworld.c b/hw/ppc_newworld.c index 3ad0057..4951ea7 100644 --- a/hw/ppc_newworld.c +++ b/hw/ppc_newworld.c @@ -107,8 +107,7 @@ static void ppc_core99_init (ram_addr_t ram_size, qemu_irq *dummy_irq; int pic_mem_index, dbdma_mem_index, cuda_mem_index, escc_mem_index; int ppc_boot_device; - DriveInfo *dinfo; - BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; + DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; void *fw_cfg; void *dbdma; uint8_t *vga_bios_ptr; @@ -316,8 +315,7 @@ static void ppc_core99_init (ram_addr_t ram_size, exit(1); } for(i = 0; i < MAX_IDE_BUS * MAX_IDE_DEVS; i++) { - dinfo = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); - hd[i] = dinfo ? dinfo->bdrv : NULL; + hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); } dbdma = DBDMA_init(&dbdma_mem_index); pci_cmd646_ide_init(pci_bus, hd, 0); diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c index fc0e6f7..25ab19e 100644 --- a/hw/ppc_oldworld.c +++ b/hw/ppc_oldworld.c @@ -137,8 +137,7 @@ static void ppc_heathrow_init (ram_addr_t ram_size, int pic_mem_index, nvram_mem_index, dbdma_mem_index, cuda_mem_index; int escc_mem_index, ide_mem_index[2]; uint16_t ppc_boot_device; - BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; - DriveInfo *dinfo; + DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; void *fw_cfg; void *dbdma; uint8_t *vga_bios_ptr; @@ -331,19 +330,15 @@ static void ppc_heathrow_init (ram_addr_t ram_size, } /* First IDE channel is a MAC IDE on the MacIO bus */ - dinfo = drive_get(IF_IDE, 0, 0); - hd[0] = dinfo ? dinfo->bdrv : NULL; - dinfo = drive_get(IF_IDE, 0, 1); - hd[1] = dinfo ? dinfo->bdrv : NULL; + hd[0] = drive_get(IF_IDE, 0, 0); + hd[1] = drive_get(IF_IDE, 0, 1); dbdma = DBDMA_init(&dbdma_mem_index); ide_mem_index[0] = -1; ide_mem_index[1] = pmac_ide_init(hd, pic[0x0D], dbdma, 0x16, pic[0x02]); /* Second IDE channel is a CMD646 on the PCI bus */ - dinfo = drive_get(IF_IDE, 1, 0); - hd[0] = dinfo ? dinfo->bdrv : NULL; - dinfo = drive_get(IF_IDE, 1, 1); - hd[1] = dinfo ? dinfo->bdrv : NULL; + hd[0] = drive_get(IF_IDE, 1, 0); + hd[1] = drive_get(IF_IDE, 1, 1); hd[3] = hd[2] = NULL; pci_cmd646_ide_init(pci_bus, hd, 0); diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c index 1cad17f..c081d58 100644 --- a/hw/ppc_prep.c +++ b/hw/ppc_prep.c @@ -563,7 +563,7 @@ static void ppc_prep_init (ram_addr_t ram_size, qemu_irq *i8259; int ppc_boot_device; DriveInfo *dinfo; - BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; + DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; BlockDriverState *fd[MAX_FD]; sysctrl = qemu_mallocz(sizeof(sysctrl_t)); @@ -703,8 +703,7 @@ static void ppc_prep_init (ram_addr_t ram_size, } for(i = 0; i < MAX_IDE_BUS * MAX_IDE_DEVS; i++) { - dinfo = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); - hd[i] = dinfo ? dinfo->bdrv : NULL; + hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); } for(i = 0; i < MAX_IDE_BUS; i++) { diff --git a/hw/r2d.c b/hw/r2d.c index 4667a5d..465f8a6 100644 --- a/hw/r2d.c +++ b/hw/r2d.c @@ -229,7 +229,7 @@ static void r2d_init(ram_addr_t ram_size, /* onboard CF (True IDE mode, Master only). */ if ((dinfo = drive_get(IF_IDE, 0, 0)) != NULL) mmio_ide_init(0x14001000, 0x1400080c, irq[CF_IDE], 1, - dinfo->bdrv, NULL); + dinfo, NULL); /* NIC: rtl8139 on-board, and 2 slots. */ for (i = 0; i < nb_nics; i++) diff --git a/hw/spitz.c b/hw/spitz.c index b9b59ef..e19b8a2 100644 --- a/hw/spitz.c +++ b/hw/spitz.c @@ -754,7 +754,7 @@ static void spitz_microdrive_attach(PXA2xxState *cpu, int slot) return; bs = dinfo->bdrv; if (bdrv_is_inserted(bs) && !bdrv_is_removable(bs)) { - md = dscm1xxxx_init(bs); + md = dscm1xxxx_init(dinfo); pxa2xx_pcmcia_attach(cpu->pcmcia[slot], md); } } diff --git a/hw/sun4u.c b/hw/sun4u.c index 012a76a..8e09011 100644 --- a/hw/sun4u.c +++ b/hw/sun4u.c @@ -558,7 +558,7 @@ static void sun4uv_init(ram_addr_t RAM_size, long initrd_size, kernel_size; PCIBus *pci_bus, *pci_bus2, *pci_bus3; qemu_irq *irq; - BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; + DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; BlockDriverState *fd[MAX_FD]; void *fw_cfg; DriveInfo *dinfo; @@ -609,9 +609,8 @@ static void sun4uv_init(ram_addr_t RAM_size, exit(1); } for(i = 0; i < MAX_IDE_BUS * MAX_IDE_DEVS; i++) { - dinfo = drive_get(IF_IDE, i / MAX_IDE_DEVS, + hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); - hd[i] = dinfo ? dinfo->bdrv : NULL; } pci_cmd646_ide_init(pci_bus, hd, 1); diff --git a/hw/tosa.c b/hw/tosa.c index 4c463e6..bc6591f 100644 --- a/hw/tosa.c +++ b/hw/tosa.c @@ -57,7 +57,7 @@ static void tosa_microdrive_attach(PXA2xxState *cpu) return; bs = dinfo->bdrv; if (bdrv_is_inserted(bs) && !bdrv_is_removable(bs)) { - md = dscm1xxxx_init(bs); + md = dscm1xxxx_init(dinfo); pxa2xx_pcmcia_attach(cpu->pcmcia[0], md); } }