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 <email@example.com>
Reviewed-by: Markus Armbruster <firstname.lastname@example.org>
Reviewed-by: Michael S. Tsirkin <email@example.com>
Signed-off-by: Stefan Hajnoczi <firstname.lastname@example.org>