summaryrefslogtreecommitdiff
path: root/hw/ppc_oldworld.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/ppc_oldworld.c
parent8a14daa5a1ae22fcfc317f4727a88d6c15c39aae (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/ppc_oldworld.c')
-rw-r--r--hw/ppc_oldworld.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c
index 56b2876684..7931f44088 100644
--- a/hw/ppc_oldworld.c
+++ b/hw/ppc_oldworld.c
@@ -135,7 +135,7 @@ static void ppc_heathrow_init (ram_addr_t ram_size,
int escc_mem_index, ide_mem_index[2];
uint16_t ppc_boot_device;
BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
- int index;
+ DriveInfo *dinfo;
void *fw_cfg;
void *dbdma;
uint8_t *vga_bios_ptr;
@@ -328,31 +328,19 @@ static void ppc_heathrow_init (ram_addr_t ram_size,
}
/* First IDE channel is a MAC IDE on the MacIO bus */
- index = drive_get_index(IF_IDE, 0, 0);
- if (index == -1)
- hd[0] = NULL;
- else
- hd[0] = drives_table[index].bdrv;
- index = drive_get_index(IF_IDE, 0, 1);
- if (index == -1)
- hd[1] = NULL;
- else
- hd[1] = drives_table[index].bdrv;
+ dinfo = drive_get(IF_IDE, 0, 0);
+ hd[0] = dinfo ? dinfo->bdrv : NULL;
+ dinfo = drive_get(IF_IDE, 0, 1);
+ hd[1] = dinfo ? dinfo->bdrv : NULL;
dbdma = DBDMA_init(&dbdma_mem_index);
ide_mem_index[0] = -1;
ide_mem_index[1] = pmac_ide_init(hd, pic[0x0D], dbdma, 0x16, pic[0x02]);
/* Second IDE channel is a CMD646 on the PCI bus */
- index = drive_get_index(IF_IDE, 1, 0);
- if (index == -1)
- hd[0] = NULL;
- else
- hd[0] = drives_table[index].bdrv;
- index = drive_get_index(IF_IDE, 1, 1);
- if (index == -1)
- hd[1] = NULL;
- else
- hd[1] = drives_table[index].bdrv;
+ dinfo = drive_get(IF_IDE, 1, 0);
+ hd[0] = dinfo ? dinfo->bdrv : NULL;
+ dinfo = drive_get(IF_IDE, 1, 1);
+ hd[1] = dinfo ? dinfo->bdrv : NULL;
hd[3] = hd[2] = NULL;
pci_cmd646_ide_init(pci_bus, hd, 0);