ide: Update ide_drive_get to be HBA agnostic
commitd8f94e1bb275ab6a14a15220fd6afd0d04324aeb
authorJohn Snow <jsnow@redhat.com>
Wed, 1 Oct 2014 18:19:27 +0000 (1 14:19 -0400)
committerStefan Hajnoczi <stefanha@redhat.com>
Fri, 3 Oct 2014 09:30:33 +0000 (3 10:30 +0100)
treeb24bbaf0487f1288af282314c817c53ff3a06bed
parent1602651833c081e32366c9e534ad72e4287840c5
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>
12 files changed:
blockdev.c
hw/alpha/dp264.c
hw/i386/pc_piix.c
hw/ide/core.c
hw/mips/mips_fulong2e.c
hw/mips/mips_malta.c
hw/mips/mips_r4k.c
hw/ppc/mac_newworld.c
hw/ppc/mac_oldworld.c
hw/ppc/prep.c
hw/sparc64/sun4u.c
include/sysemu/blockdev.h