mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 16:53:55 -06:00
ide: Update ide_drive_get to be HBA agnostic
Instead of duplicating the logic for the if_ide (bus,unit) mappings, rely on the blockdev layer for managing those mappings for us, and use the drive_get_by_index call instead. This allows ide_drive_get to work for AHCI HBAs as well, and can be used in the Q35 initialization. Lastly, change the nature of the argument to ide_drive_get so that represents the number of total drives we can support, and not the total number of buses. This will prevent array overflows if the units-per-default-bus property ever needs to be adjusted for compatibility reasons. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-id: 1412187569-23452-5-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
1602651833
commit
d8f94e1bb2
12 changed files with 44 additions and 14 deletions
|
@ -400,7 +400,7 @@ static void ppc_core99_init(MachineState *machine)
|
|||
macio_init(macio, pic_mem, escc_bar);
|
||||
|
||||
/* We only emulate 2 out of 3 IDE controllers for now */
|
||||
ide_drive_get(hd, MAX_IDE_BUS);
|
||||
ide_drive_get(hd, ARRAY_SIZE(hd));
|
||||
|
||||
macio_ide = MACIO_IDE(object_resolve_path_component(OBJECT(macio),
|
||||
"ide[0]"));
|
||||
|
|
|
@ -278,7 +278,7 @@ static void ppc_heathrow_init(MachineState *machine)
|
|||
pci_nic_init_nofail(&nd_table[i], pci_bus, "ne2k_pci", NULL);
|
||||
|
||||
|
||||
ide_drive_get(hd, MAX_IDE_BUS);
|
||||
ide_drive_get(hd, ARRAY_SIZE(hd));
|
||||
|
||||
macio = pci_create(pci_bus, -1, TYPE_OLDWORLD_MACIO);
|
||||
dev = DEVICE(macio);
|
||||
|
|
|
@ -519,7 +519,7 @@ static void ppc_prep_init(MachineState *machine)
|
|||
}
|
||||
}
|
||||
|
||||
ide_drive_get(hd, MAX_IDE_BUS);
|
||||
ide_drive_get(hd, ARRAY_SIZE(hd));
|
||||
for(i = 0; i < MAX_IDE_BUS; i++) {
|
||||
isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i], ide_irq[i],
|
||||
hd[2 * i],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue