summary refs log tree commit diff stats
path: root/hw/mainstone.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/mainstone.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/mainstone.c')
-rw-r--r--hw/mainstone.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/hw/mainstone.c b/hw/mainstone.c
index 151ea0e341..3e517f0704 100644
--- a/hw/mainstone.c
+++ b/hw/mainstone.c
@@ -77,7 +77,8 @@ static void mainstone_common_init(ram_addr_t ram_size,
     target_phys_addr_t mainstone_flash_base[] = { MST_FLASH_0, MST_FLASH_1 };
     PXA2xxState *cpu;
     qemu_irq *mst_irq;
-    int i, index;
+    DriveInfo *dinfo;
+    int i;
 
     if (!cpu_model)
         cpu_model = "pxa270-c5";
@@ -92,8 +93,8 @@ static void mainstone_common_init(ram_addr_t ram_size,
 
     /* There are two 32MiB flash devices on the board */
     for (i = 0; i < 2; i ++) {
-        index = drive_get_index(IF_PFLASH, 0, i);
-        if (index == -1) {
+        dinfo = drive_get(IF_PFLASH, 0, i);
+        if (!dinfo) {
             fprintf(stderr, "Two flash images must be given with the "
                     "'pflash' parameter\n");
             exit(1);
@@ -101,7 +102,7 @@ static void mainstone_common_init(ram_addr_t ram_size,
 
         if (!pflash_cfi01_register(mainstone_flash_base[i],
                                 qemu_ram_alloc(MAINSTONE_FLASH),
-                                drives_table[index].bdrv, sector_len,
+                                dinfo->bdrv, sector_len,
                                 MAINSTONE_FLASH / sector_len, 4, 0, 0, 0, 0)) {
             fprintf(stderr, "qemu: Error registering flash memory.\n");
             exit(1);