Revision 2091ba23 hw/fdc.c

b/hw/fdc.c
1871 1871
    }
1872 1872
}
1873 1873

  
1874
fdctrl_t *fdctrl_init (qemu_irq irq, int dma_chann, int mem_mapped,
1875
                       target_phys_addr_t io_base,
1876
                       BlockDriverState **fds)
1874
fdctrl_t *fdctrl_init_isa(int isairq, int dma_chann,
1875
                          uint32_t io_base,
1876
                          BlockDriverState **fds)
1877 1877
{
1878 1878
    fdctrl_t *fdctrl;
1879
    ISADevice *dev;
1879 1880

  
1880
    if (mem_mapped) {
1881
        DeviceState *dev;
1882
        fdctrl_sysbus_t *sys;
1881
    dev = isa_create_simple("isa-fdc", io_base, 0);
1882
    fdctrl = &(DO_UPCAST(fdctrl_isabus_t, busdev, dev)->state);
1883
    isa_connect_irq(dev, 0, isairq);
1883 1884

  
1884
        dev = qdev_create(NULL, "sysbus-fdc");
1885
        qdev_init(dev);
1886
        sys = DO_UPCAST(fdctrl_sysbus_t, busdev.qdev, dev);
1887
        fdctrl = &sys->state;
1888
        sysbus_connect_irq(&sys->busdev, 0, irq);
1889
        sysbus_mmio_map(&sys->busdev, 0, io_base);
1890
    } else {
1891
        ISADevice *dev;
1885
    fdctrl->dma_chann = dma_chann;
1886
    DMA_register_channel(dma_chann, &fdctrl_transfer_handler, fdctrl);
1892 1887

  
1893
        dev = isa_create_simple("isa-fdc", io_base, 0);
1894
        fdctrl = &(DO_UPCAST(fdctrl_isabus_t, busdev, dev)->state);
1895
        isa_connect_irq(dev, 0, irq);
1896
    }
1888
    fdctrl_connect_drives(fdctrl, fds);
1889

  
1890
    return fdctrl;
1891
}
1892

  
1893
fdctrl_t *fdctrl_init_sysbus(qemu_irq irq, int dma_chann,
1894
                             target_phys_addr_t mmio_base,
1895
                             BlockDriverState **fds)
1896
{
1897
    fdctrl_t *fdctrl;
1898
    DeviceState *dev;
1899
    fdctrl_sysbus_t *sys;
1900

  
1901
    dev = qdev_create(NULL, "sysbus-fdc");
1902
    qdev_init(dev);
1903
    sys = DO_UPCAST(fdctrl_sysbus_t, busdev.qdev, dev);
1904
    fdctrl = &sys->state;
1905
    sysbus_connect_irq(&sys->busdev, 0, irq);
1906
    sysbus_mmio_map(&sys->busdev, 0, mmio_base);
1897 1907

  
1898 1908
    fdctrl->dma_chann = dma_chann;
1899 1909
    DMA_register_channel(dma_chann, &fdctrl_transfer_handler, fdctrl);
1900

  
1901 1910
    fdctrl_connect_drives(fdctrl, fds);
1902 1911

  
1903 1912
    return fdctrl;

Also available in: Unified diff