Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev

* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev:
libata: kill spurious NCQ completion detection
ahci: don't attach if ICH6 is in combined mode
ata_piix: add Toshiba Tecra M4 to broken suspend list
ahci: fix engine reset failed message

+31 -90
+23 -73
drivers/ata/ahci.c
··· 193 193 ATA_FLAG_ACPI_SATA | ATA_FLAG_AN | 194 194 ATA_FLAG_IPM, 195 195 AHCI_LFLAG_COMMON = ATA_LFLAG_SKIP_D2H_BSY, 196 + 197 + ICH_MAP = 0x90, /* ICH MAP register */ 196 198 }; 197 199 198 200 struct ahci_cmd_hdr { ··· 1273 1271 1274 1272 /* prepare for SRST (AHCI-1.1 10.4.1) */ 1275 1273 rc = ahci_kick_engine(ap, 1); 1276 - if (rc) 1274 + if (rc && rc != -EOPNOTSUPP) 1277 1275 ata_link_printk(link, KERN_WARNING, 1278 - "failed to reset engine (errno=%d)", rc); 1276 + "failed to reset engine (errno=%d)\n", rc); 1279 1277 1280 1278 ata_tf_init(link->device, &tf); 1281 1279 ··· 1640 1638 struct ahci_host_priv *hpriv = ap->host->private_data; 1641 1639 int resetting = !!(ap->pflags & ATA_PFLAG_RESETTING); 1642 1640 u32 status, qc_active; 1643 - int rc, known_irq = 0; 1641 + int rc; 1644 1642 1645 1643 status = readl(port_mmio + PORT_IRQ_STAT); 1646 1644 writel(status, port_mmio + PORT_IRQ_STAT); ··· 1698 1696 1699 1697 rc = ata_qc_complete_multiple(ap, qc_active, NULL); 1700 1698 1701 - /* If resetting, spurious or invalid completions are expected, 1702 - * return unconditionally. 1703 - */ 1704 - if (resetting) 1705 - return; 1706 - 1707 - if (rc > 0) 1708 - return; 1709 - if (rc < 0) { 1699 + /* while resetting, invalid completions are expected */ 1700 + if (unlikely(rc < 0 && !resetting)) { 1710 1701 ehi->err_mask |= AC_ERR_HSM; 1711 1702 ehi->action |= ATA_EH_SOFTRESET; 1712 1703 ata_port_freeze(ap); 1713 - return; 1714 1704 } 1715 - 1716 - /* hmmm... a spurious interrupt */ 1717 - 1718 - /* if !NCQ, ignore. No modern ATA device has broken HSM 1719 - * implementation for non-NCQ commands. 1720 - */ 1721 - if (!ap->link.sactive) 1722 - return; 1723 - 1724 - if (status & PORT_IRQ_D2H_REG_FIS) { 1725 - if (!pp->ncq_saw_d2h) 1726 - ata_port_printk(ap, KERN_INFO, 1727 - "D2H reg with I during NCQ, " 1728 - "this message won't be printed again\n"); 1729 - pp->ncq_saw_d2h = 1; 1730 - known_irq = 1; 1731 - } 1732 - 1733 - if (status & PORT_IRQ_DMAS_FIS) { 1734 - if (!pp->ncq_saw_dmas) 1735 - ata_port_printk(ap, KERN_INFO, 1736 - "DMAS FIS during NCQ, " 1737 - "this message won't be printed again\n"); 1738 - pp->ncq_saw_dmas = 1; 1739 - known_irq = 1; 1740 - } 1741 - 1742 - if (status & PORT_IRQ_SDB_FIS) { 1743 - const __le32 *f = pp->rx_fis + RX_FIS_SDB; 1744 - 1745 - if (le32_to_cpu(f[1])) { 1746 - /* SDB FIS containing spurious completions 1747 - * might be dangerous, whine and fail commands 1748 - * with HSM violation. EH will turn off NCQ 1749 - * after several such failures. 1750 - */ 1751 - ata_ehi_push_desc(ehi, 1752 - "spurious completions during NCQ " 1753 - "issue=0x%x SAct=0x%x FIS=%08x:%08x", 1754 - readl(port_mmio + PORT_CMD_ISSUE), 1755 - readl(port_mmio + PORT_SCR_ACT), 1756 - le32_to_cpu(f[0]), le32_to_cpu(f[1])); 1757 - ehi->err_mask |= AC_ERR_HSM; 1758 - ehi->action |= ATA_EH_SOFTRESET; 1759 - ata_port_freeze(ap); 1760 - } else { 1761 - if (!pp->ncq_saw_sdb) 1762 - ata_port_printk(ap, KERN_INFO, 1763 - "spurious SDB FIS %08x:%08x during NCQ, " 1764 - "this message won't be printed again\n", 1765 - le32_to_cpu(f[0]), le32_to_cpu(f[1])); 1766 - pp->ncq_saw_sdb = 1; 1767 - } 1768 - known_irq = 1; 1769 - } 1770 - 1771 - if (!known_irq) 1772 - ata_port_printk(ap, KERN_INFO, "spurious interrupt " 1773 - "(irq_stat 0x%x active_tag 0x%x sactive 0x%x)\n", 1774 - status, ap->link.active_tag, ap->link.sactive); 1775 1705 } 1776 1706 1777 1707 static void ahci_irq_clear(struct ata_port *ap) ··· 2206 2272 pcim_pin_device(pdev); 2207 2273 if (rc) 2208 2274 return rc; 2275 + 2276 + if (pdev->vendor == PCI_VENDOR_ID_INTEL && 2277 + (pdev->device == 0x2652 || pdev->device == 0x2653)) { 2278 + u8 map; 2279 + 2280 + /* ICH6s share the same PCI ID for both piix and ahci 2281 + * modes. Enabling ahci mode while MAP indicates 2282 + * combined mode is a bad idea. Yield to ata_piix. 2283 + */ 2284 + pci_read_config_byte(pdev, ICH_MAP, &map); 2285 + if (map & 0x3) { 2286 + dev_printk(KERN_INFO, &pdev->dev, "controller is in " 2287 + "combined mode, can't enable AHCI mode\n"); 2288 + return -ENODEV; 2289 + } 2290 + } 2209 2291 2210 2292 hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL); 2211 2293 if (!hpriv)
+7
drivers/ata/ata_piix.c
··· 974 974 }, 975 975 }, 976 976 { 977 + .ident = "TECRA M4", 978 + .matches = { 979 + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), 980 + DMI_MATCH(DMI_PRODUCT_NAME, "Tecra M4"), 981 + }, 982 + }, 983 + { 977 984 .ident = "TECRA M5", 978 985 .matches = { 979 986 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
+1 -17
drivers/ata/libata-core.c
··· 4140 4140 /* Devices where NCQ should be avoided */ 4141 4141 /* NCQ is slow */ 4142 4142 { "WDC WD740ADFD-00", NULL, ATA_HORKAGE_NONCQ }, 4143 + { "WDC WD740ADFD-00NLR1", NULL, ATA_HORKAGE_NONCQ, }, 4143 4144 /* http://thread.gmane.org/gmane.linux.ide/14907 */ 4144 4145 { "FUJITSU MHT2060BH", NULL, ATA_HORKAGE_NONCQ }, 4145 4146 /* NCQ is broken */ ··· 4155 4154 { "HTS541060G9SA00", "MB3OC60D", ATA_HORKAGE_NONCQ, }, 4156 4155 { "HTS541080G9SA00", "MB4OC60D", ATA_HORKAGE_NONCQ, }, 4157 4156 { "HTS541010G9SA00", "MBZOC60D", ATA_HORKAGE_NONCQ, }, 4158 - /* Drives which do spurious command completion */ 4159 - { "HTS541680J9SA00", "SB2IC7EP", ATA_HORKAGE_NONCQ, }, 4160 - { "HTS541612J9SA00", "SBDIC7JP", ATA_HORKAGE_NONCQ, }, 4161 - { "HDT722516DLA380", "V43OA96A", ATA_HORKAGE_NONCQ, }, 4162 - { "Hitachi HTS541616J9SA00", "SB4OC70P", ATA_HORKAGE_NONCQ, }, 4163 - { "Hitachi HTS542525K9SA00", "BBFOC31P", ATA_HORKAGE_NONCQ, }, 4164 - { "WDC WD740ADFD-00NLR1", NULL, ATA_HORKAGE_NONCQ, }, 4165 - { "WDC WD3200AAJS-00RYA0", "12.01B01", ATA_HORKAGE_NONCQ, }, 4166 - { "FUJITSU MHV2080BH", "00840028", ATA_HORKAGE_NONCQ, }, 4167 - { "ST9120822AS", "3.CLF", ATA_HORKAGE_NONCQ, }, 4168 - { "ST9160821AS", "3.CLF", ATA_HORKAGE_NONCQ, }, 4169 - { "ST9160821AS", "3.ALD", ATA_HORKAGE_NONCQ, }, 4170 - { "ST9160821AS", "3.CCD", ATA_HORKAGE_NONCQ, }, 4171 - { "ST3160812AS", "3.ADJ", ATA_HORKAGE_NONCQ, }, 4172 - { "ST980813AS", "3.ADB", ATA_HORKAGE_NONCQ, }, 4173 - { "SAMSUNG HD401LJ", "ZZ100-15", ATA_HORKAGE_NONCQ, }, 4174 - { "Maxtor 7V300F0", "VA111900", ATA_HORKAGE_NONCQ, }, 4175 4157 4176 4158 /* devices which puke on READ_NATIVE_MAX */ 4177 4159 { "HDS724040KLSA80", "KFAOA20N", ATA_HORKAGE_BROKEN_HPA, },