diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2009-07-22 16:42:57 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-07-27 14:08:23 -0500 |
commit | 751c6a17042b5d011013d6963c0505d671cf708e (patch) | |
tree | 61a769ed1a1c16ebdfc1397ce9d775222dfa8e57 /hw/mips_r4k.c | |
parent | 8a14daa5a1ae22fcfc317f4727a88d6c15c39aae (diff) |
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/mips_r4k.c')
-rw-r--r-- | hw/mips_r4k.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/hw/mips_r4k.c b/hw/mips_r4k.c index 7f8af7413a..476612cea5 100644 --- a/hw/mips_r4k.c +++ b/hw/mips_r4k.c @@ -155,8 +155,8 @@ void mips_r4k_init (ram_addr_t ram_size, RTCState *rtc_state; int i; qemu_irq *i8259; - int index; BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; + DriveInfo *dinfo; /* init CPUs */ if (cpu_model == NULL) { @@ -208,11 +208,11 @@ void mips_r4k_init (ram_addr_t ram_size, bios_offset | IO_MEM_ROM); load_image_targphys(filename, 0x1fc00000, BIOS_SIZE); - } else if ((index = drive_get_index(IF_PFLASH, 0, 0)) > -1) { + } else if ((dinfo = drive_get(IF_PFLASH, 0, 0)) != NULL) { uint32_t mips_rom = 0x00400000; bios_offset = qemu_ram_alloc(mips_rom); if (!pflash_cfi01_register(0x1fc00000, bios_offset, - drives_table[index].bdrv, sector_len, mips_rom / sector_len, + dinfo->bdrv, sector_len, mips_rom / sector_len, 4, 0, 0, 0, 0)) { fprintf(stderr, "qemu: Error registering flash memory.\n"); } @@ -267,11 +267,8 @@ void mips_r4k_init (ram_addr_t ram_size, } for(i = 0; i < MAX_IDE_BUS * MAX_IDE_DEVS; i++) { - index = drive_get_index(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); - if (index != -1) - hd[i] = drives_table[index].bdrv; - else - hd[i] = NULL; + dinfo = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); + hd[i] = dinfo ? dinfo->bdrv : NULL; } for(i = 0; i < MAX_IDE_BUS; i++) |