diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2009-08-14 11:36:14 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-08-27 20:30:11 -0500 |
commit | 2091ba23e838c3a8773c246238d7381333789852 (patch) | |
tree | f0fe63782f1532c1d193a92a701d11e1544e1fde /hw/fdc.c | |
parent | 3f9cb1c14dc368f41447db5f78d6248c4f100ad4 (diff) |
isa bus irq changes and fixes.
Changes:
(1) make isa-bus maintain isa irqs, complain when allocating
already taken irqs.
(2) note that (1) works only for isa devices converted to qdev
already (floppy and ps2/kbd/mouse right now), so more work
is needed to make this really useful.
(3) split floppy init into isa and sysbus versions.
(4) add sysbus->isa bridge & fix -M isapc breakage.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/fdc.c')
-rw-r--r-- | hw/fdc.c | 47 |
1 files changed, 28 insertions, 19 deletions
@@ -1871,33 +1871,42 @@ static void fdctrl_connect_drives(fdctrl_t *fdctrl, BlockDriverState **fds) } } -fdctrl_t *fdctrl_init (qemu_irq irq, int dma_chann, int mem_mapped, - target_phys_addr_t io_base, - BlockDriverState **fds) +fdctrl_t *fdctrl_init_isa(int isairq, int dma_chann, + uint32_t io_base, + BlockDriverState **fds) { fdctrl_t *fdctrl; + ISADevice *dev; - if (mem_mapped) { - DeviceState *dev; - fdctrl_sysbus_t *sys; + dev = isa_create_simple("isa-fdc", io_base, 0); + fdctrl = &(DO_UPCAST(fdctrl_isabus_t, busdev, dev)->state); + isa_connect_irq(dev, 0, isairq); - dev = qdev_create(NULL, "sysbus-fdc"); - qdev_init(dev); - sys = DO_UPCAST(fdctrl_sysbus_t, busdev.qdev, dev); - fdctrl = &sys->state; - sysbus_connect_irq(&sys->busdev, 0, irq); - sysbus_mmio_map(&sys->busdev, 0, io_base); - } else { - ISADevice *dev; + fdctrl->dma_chann = dma_chann; + DMA_register_channel(dma_chann, &fdctrl_transfer_handler, fdctrl); - dev = isa_create_simple("isa-fdc", io_base, 0); - fdctrl = &(DO_UPCAST(fdctrl_isabus_t, busdev, dev)->state); - isa_connect_irq(dev, 0, irq); - } + fdctrl_connect_drives(fdctrl, fds); + + return fdctrl; +} + +fdctrl_t *fdctrl_init_sysbus(qemu_irq irq, int dma_chann, + target_phys_addr_t mmio_base, + BlockDriverState **fds) +{ + fdctrl_t *fdctrl; + DeviceState *dev; + fdctrl_sysbus_t *sys; + + dev = qdev_create(NULL, "sysbus-fdc"); + qdev_init(dev); + sys = DO_UPCAST(fdctrl_sysbus_t, busdev.qdev, dev); + fdctrl = &sys->state; + sysbus_connect_irq(&sys->busdev, 0, irq); + sysbus_mmio_map(&sys->busdev, 0, mmio_base); fdctrl->dma_chann = dma_chann; DMA_register_channel(dma_chann, &fdctrl_transfer_handler, fdctrl); - fdctrl_connect_drives(fdctrl, fds); return fdctrl; |