From cef5f633f10124a8f32d7898896d9ff7594cf593 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Fri, 4 Dec 2009 07:07:08 -0500 Subject: [PATCH] Handle ATA controllers with only one port This happens on e.g. VirtualBox SATA controllers - just check the driver name before anything else. Signed-off-by: David Zeuthen --- src/adapter.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/adapter.c b/src/adapter.c index e5a43ae..2452a2a 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -462,22 +462,25 @@ update_info_fabric_and_num_ports (Adapter *adapter) g_dir_close (dir); } - if (num_scsi_host_objects > 1) + /* First try to use driver name to determine if this is ATA */ + if (driver != NULL && (g_str_has_prefix (driver, "pata_") || g_strcmp0 (driver, "ata_piix") == 0)) { - /* we're dealing with ATA */ + fabric = "ata_pata"; + num_ports = num_scsi_host_objects; + } + else if (driver != NULL && (g_str_has_prefix (driver, "sata_") || g_strcmp0 (driver, "ahci") == 0)) + { + fabric = "ata_sata"; + num_ports = num_scsi_host_objects; + } + else if (num_scsi_host_objects > 1) + { + /* we're definitely possibly (!) dealing with ATA */ num_ports = num_scsi_host_objects; /* use PCI class to zero in - maybe we also want to use driver names? */ fabric = "ata"; - if (driver != NULL && (g_str_has_prefix (driver, "pata_") || g_strcmp0 (driver, "ata_piix") == 0)) - { - fabric = "ata_pata"; - } - else if (driver != NULL && (g_str_has_prefix (driver, "sata_") || g_strcmp0 (driver, "ahci") == 0)) - { - fabric = "ata_sata"; - } - else if (subclass == 0x01 || subclass == 0x05) + if (subclass == 0x01 || subclass == 0x05) { fabric = "ata_pata"; } -- 2.7.4