aboutsummaryrefslogtreecommitdiff
path: root/hw/ide
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-08-28 15:47:03 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-09-04 09:37:27 -0500
commitf455e98cf437c7bb8f2b23888bbd302fef3a3b28 (patch)
tree453978b84f1054ecbfd4c0c18ebc05f8d89474d0 /hw/ide
parentddd9bbd93bb2c12ade72dff1790d6d292aac073f (diff)
ide: pass down DriveInfo instead of BlockDriverState
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/ide')
-rw-r--r--hw/ide/core.c7
-rw-r--r--hw/ide/internal.h2
-rw-r--r--hw/ide/isa.c2
-rw-r--r--hw/ide/macio.c2
-rw-r--r--hw/ide/microdrive.c2
-rw-r--r--hw/ide/mmio.c2
-rw-r--r--hw/ide/pci.c11
7 files changed, 13 insertions, 15 deletions
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 79a3a9c7ad..572a19dab4 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 8766a3ae2c..1420e253aa 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 aa026c7a62..ec2d6fbd87 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 820cc77be3..da2baa0fc1 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 a735452e50..887cde3c30 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 99ddf9d4d9..acaa900c89 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 a3d6bd0dc6..0e8583a040 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;