summary refs log tree commit diff stats
path: root/hw/sun4m.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-07-22 16:42:57 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-07-27 14:08:23 -0500
commit751c6a17042b5d011013d6963c0505d671cf708e (patch)
tree61a769ed1a1c16ebdfc1397ce9d775222dfa8e57 /hw/sun4m.c
parent8a14daa5a1ae22fcfc317f4727a88d6c15c39aae (diff)
downloadfocaccia-qemu-751c6a17042b5d011013d6963c0505d671cf708e.tar.gz
focaccia-qemu-751c6a17042b5d011013d6963c0505d671cf708e.zip
kill drives_table
First step cleaning up the drives handling.  This one does nothing but
removing drives_table[], still it became seriously big.

drive_get_index() is gone and is replaced by drives_get() which hands
out DriveInfo pointers instead of a table index.  This needs adaption in
*tons* of places all over.

The drives are now maintained as linked list.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/sun4m.c')
-rw-r--r--hw/sun4m.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/hw/sun4m.c b/hw/sun4m.c
index 1e668fca1f..274ee359ab 100644
--- a/hw/sun4m.c
+++ b/hw/sun4m.c
@@ -581,9 +581,9 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size,
     qemu_irq *cpu_halt;
     unsigned long kernel_size;
     BlockDriverState *fd[MAX_FD];
-    int drive_index;
     void *fw_cfg;
     DeviceState *dev;
+    DriveInfo *dinfo;
 
     /* init CPUs */
     if (!cpu_model)
@@ -662,9 +662,9 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size,
     if (hwdef->fd_base) {
         /* there is zero or one floppy drive */
         memset(fd, 0, sizeof(fd));
-        drive_index = drive_get_index(IF_FLOPPY, 0, 0);
-        if (drive_index != -1)
-            fd[0] = drives_table[drive_index].bdrv;
+        dinfo = drive_get(IF_FLOPPY, 0, 0);
+        if (dinfo)
+            fd[0] = dinfo->bdrv;
 
         sun4m_fdctrl_init(slavio_irq[hwdef->fd_irq], hwdef->fd_base, fd,
                           &fdc_tc);
@@ -1507,10 +1507,10 @@ static void sun4c_hw_init(const struct sun4c_hwdef *hwdef, ram_addr_t RAM_size,
     qemu_irq fdc_tc;
     unsigned long kernel_size;
     BlockDriverState *fd[MAX_FD];
-    int drive_index;
     void *fw_cfg;
     DeviceState *dev;
     unsigned int i;
+    DriveInfo *dinfo;
 
     /* init CPU */
     if (!cpu_model)
@@ -1565,9 +1565,9 @@ static void sun4c_hw_init(const struct sun4c_hwdef *hwdef, ram_addr_t RAM_size,
     if (hwdef->fd_base != (target_phys_addr_t)-1) {
         /* there is zero or one floppy drive */
         memset(fd, 0, sizeof(fd));
-        drive_index = drive_get_index(IF_FLOPPY, 0, 0);
-        if (drive_index != -1)
-            fd[0] = drives_table[drive_index].bdrv;
+        dinfo = drive_get(IF_FLOPPY, 0, 0);
+        if (dinfo)
+            fd[0] = dinfo->bdrv;
 
         sun4m_fdctrl_init(slavio_irq[hwdef->fd_irq], hwdef->fd_base, fd,
                           &fdc_tc);