summaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorDarren Stevens <darren@stevens-zone.net>2017-01-23 14:33:36 -0500
committerTejun Heo <tj@kernel.org>2017-01-23 14:35:17 -0500
commit589d572671fe7ca342d25cde07a0e310a6912971 (patch)
tree1320912a578de647f54598f3bfbb2d6faa1c9e83 /drivers/ata
parentd786b91f422c6ad4c0d9bb9c1bef2dd5008e3d9d (diff)
libata-sff: Don't scan disabled ports when checking for legacy mode.
libata-sff.c checks for legacy mode by testing if both primary and secondary ports on a controller are in legacy mode and selects legacy if either one is. However on some south bridge chips (e.g AMD SB600/SB700) the secondary port is not wired, and when it is disabled by setting the disable bit in the PCI header it appears as a fixed legacy port. Prevent incorrect detection by not testing ports that are marked as 'dummy' tj: Addressed Sergei's review points. Other style edits. Signed-off-by: Darren Stevens <darren@stevens-zone.net> Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/libata-sff.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 4441b5c5e4fb..2bd92dca3e62 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -2428,11 +2428,21 @@ int ata_pci_sff_activate_host(struct ata_host *host,
2428 return rc; 2428 return rc;
2429 2429
2430 if ((pdev->class >> 8) == PCI_CLASS_STORAGE_IDE) { 2430 if ((pdev->class >> 8) == PCI_CLASS_STORAGE_IDE) {
2431 u8 tmp8, mask; 2431 u8 tmp8, mask = 0;
2432 2432
2433 /* TODO: What if one channel is in native mode ... */ 2433 /*
2434 * ATA spec says we should use legacy mode when one
2435 * port is in legacy mode, but disabled ports on some
2436 * PCI hosts appear as fixed legacy ports, e.g SB600/700
2437 * on which the secondary port is not wired, so
2438 * ignore ports that are marked as 'dummy' during
2439 * this check
2440 */
2434 pci_read_config_byte(pdev, PCI_CLASS_PROG, &tmp8); 2441 pci_read_config_byte(pdev, PCI_CLASS_PROG, &tmp8);
2435 mask = (1 << 2) | (1 << 0); 2442 if (!ata_port_is_dummy(host->ports[0]))
2443 mask |= (1 << 0);
2444 if (!ata_port_is_dummy(host->ports[1]))
2445 mask |= (1 << 2);
2436 if ((tmp8 & mask) != mask) 2446 if ((tmp8 & mask) != mask)
2437 legacy_mode = 1; 2447 legacy_mode = 1;
2438 } 2448 }