aboutsummaryrefslogtreecommitdiff
path: root/hw/fdc.h
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2011-02-05 16:32:23 +0000
committerBlue Swirl <blauwirbel@gmail.com>2011-02-20 09:33:46 +0000
commit63ffb564dca94f8bda01ed6d209784104630a4d2 (patch)
tree4804b4a3feea7e6854e9fe869901f4a964391e06 /hw/fdc.h
parentd288c7ba7beb7975fe4bc15b0b14b9fd14da0a03 (diff)
fdc: refactor device creation
Turn fdc_init_isa into an inline function. Get floppy geometry directly from the drives. Don't expose FDCtrl. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'hw/fdc.h')
-rw-r--r--hw/fdc.h24
1 files changed, 17 insertions, 7 deletions
diff --git a/hw/fdc.h b/hw/fdc.h
index 30ac970cc1..3b2fb3b248 100644
--- a/hw/fdc.h
+++ b/hw/fdc.h
@@ -1,18 +1,28 @@
#ifndef HW_FDC_H
#define HW_FDC_H
+#include "isa.h"
#include "blockdev.h"
/* fdc.c */
#define MAX_FD 2
-typedef struct FDCtrl FDCtrl;
+static inline void fdctrl_init_isa(DriveInfo **fds)
+{
+ ISADevice *dev;
-FDCtrl *fdctrl_init_isa(DriveInfo **fds);
-FDCtrl *fdctrl_init_sysbus(qemu_irq irq, int dma_chann,
- target_phys_addr_t mmio_base, DriveInfo **fds);
-FDCtrl *sun4m_fdctrl_init(qemu_irq irq, target_phys_addr_t io_base,
- DriveInfo **fds, qemu_irq *fdc_tc);
-FDriveType fdctrl_get_drive_type(FDCtrl *fdctrl, int drive_num);
+ dev = isa_create("isa-fdc");
+ if (fds[0]) {
+ qdev_prop_set_drive_nofail(&dev->qdev, "driveA", fds[0]->bdrv);
+ }
+ if (fds[1]) {
+ qdev_prop_set_drive_nofail(&dev->qdev, "driveB", fds[1]->bdrv);
+ }
+ qdev_init_nofail(&dev->qdev);
+}
+void fdctrl_init_sysbus(qemu_irq irq, int dma_chann,
+ target_phys_addr_t mmio_base, DriveInfo **fds);
+void sun4m_fdctrl_init(qemu_irq irq, target_phys_addr_t io_base,
+ DriveInfo **fds, qemu_irq *fdc_tc);
#endif