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

* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev:
libata and starting/stopping ATAPI floppy devices
sata_sil24: prevent hba lockup when pass-through ATA commands are used
Update kernel parameter document for libata DMA mode setting knobs.
libata: don't normalize UNKNOWN to NONE after reset
libata-pmp: propagate timeout to host link
libata-pmp: 4726 hates SRST
pata_ixp4xx_cf: fix compilation introduced by ata_port_desc() conversion
pata_pdc202xx_old: Further fixups
libata-sff: PCI IRQ handling fix
sata_qstor: use hardreset instead of softreset

+77 -32
+8
Documentation/kernel-parameters.txt
··· 883 883 lapic_timer_c2_ok [X86-32,x86-64,APIC] trust the local apic timer in 884 884 C2 power state. 885 885 886 + libata.dma= [LIBATA] DMA control 887 + libata.dma=0 Disable all PATA and SATA DMA 888 + libata.dma=1 PATA and SATA Disk DMA only 889 + libata.dma=2 ATAPI (CDROM) DMA only 890 + libata.dma=4 Compact Flash DMA only 891 + Combinations also work, so libata.dma=3 enables DMA 892 + for disks and CDROMs, but not CFs. 893 + 886 894 libata.noacpi [LIBATA] Disables use of ACPI in libata suspend/resume 887 895 when set. 888 896 Format: <int>
+16 -8
drivers/ata/libata-eh.c
··· 1733 1733 ehc->i.action &= ~ATA_EH_PERDEV_MASK; 1734 1734 } 1735 1735 1736 - /* consider speeding down */ 1736 + /* propagate timeout to host link */ 1737 + if ((all_err_mask & AC_ERR_TIMEOUT) && !ata_is_host_link(link)) 1738 + ap->link.eh_context.i.err_mask |= AC_ERR_TIMEOUT; 1739 + 1740 + /* record error and consider speeding down */ 1737 1741 dev = ehc->i.dev; 1738 - if (!dev && ata_link_max_devices(link) == 1 && 1739 - ata_dev_enabled(link->device)) 1740 - dev = link->device; 1742 + if (!dev && ((ata_link_max_devices(link) == 1 && 1743 + ata_dev_enabled(link->device)))) 1744 + dev = link->device; 1741 1745 1742 1746 if (dev) 1743 1747 ehc->i.action |= ata_eh_speed_down(dev, is_io, all_err_mask); ··· 1763 1759 { 1764 1760 struct ata_link *link; 1765 1761 1766 - __ata_port_for_each_link(link, ap) 1762 + ata_port_for_each_link(link, ap) 1767 1763 ata_eh_link_autopsy(link); 1764 + 1765 + /* Autopsy of fanout ports can affect host link autopsy. 1766 + * Perform host link autopsy last. 1767 + */ 1768 + if (ap->nr_pmp_links) 1769 + ata_eh_link_autopsy(&ap->link); 1768 1770 } 1769 1771 1770 1772 /** ··· 2167 2157 if (ata_link_offline(link)) 2168 2158 continue; 2169 2159 2170 - /* apply class override and convert UNKNOWN to NONE */ 2160 + /* apply class override */ 2171 2161 if (lflags & ATA_LFLAG_ASSUME_ATA) 2172 2162 classes[dev->devno] = ATA_DEV_ATA; 2173 2163 else if (lflags & ATA_LFLAG_ASSUME_SEMB) 2174 2164 classes[dev->devno] = ATA_DEV_SEMB_UNSUP; /* not yet */ 2175 - else if (classes[dev->devno] == ATA_DEV_UNKNOWN) 2176 - classes[dev->devno] = ATA_DEV_NONE; 2177 2165 } 2178 2166 2179 2167 /* record current link speed */
+5 -7
drivers/ata/libata-pmp.c
··· 495 495 /* SError.N need a kick in the ass to get working */ 496 496 link->flags |= ATA_LFLAG_HRST_TO_RESUME; 497 497 498 - /* class code report is unreliable */ 499 - if (link->pmp < 5) 500 - link->flags |= ATA_LFLAG_ASSUME_ATA; 501 - 502 - /* The config device, which can be either at 503 - * port 0 or 5, locks up on SRST. 498 + /* Class code report is unreliable and SRST 499 + * times out under certain configurations. 500 + * Config device can be at port 0 or 5 and 501 + * locks up on SRST. 504 502 */ 505 - if (link->pmp == 0 || link->pmp == 5) 503 + if (link->pmp <= 5) 506 504 link->flags |= ATA_LFLAG_NO_SRST | 507 505 ATA_LFLAG_ASSUME_ATA; 508 506
+2 -1
drivers/ata/libata-scsi.c
··· 872 872 873 873 ata_scsi_sdev_config(sdev); 874 874 875 - sdev->manage_start_stop = 1; 875 + if (dev->class == ATA_DEV_ATA) 876 + sdev->manage_start_stop = 1; 876 877 877 878 if (dev) 878 879 ata_scsi_dev_config(sdev, dev);
+5 -2
drivers/ata/libata-sff.c
··· 806 806 if (rc) 807 807 goto err_out; 808 808 809 - if (!legacy_mode) { 809 + if (!legacy_mode && pdev->irq) { 810 + /* We may have no IRQ assigned in which case we can poll. This 811 + shouldn't happen on a sane system but robustness is cheap 812 + in this case */ 810 813 rc = devm_request_irq(dev, pdev->irq, pi->port_ops->irq_handler, 811 814 IRQF_SHARED, DRV_NAME, host); 812 815 if (rc) ··· 817 814 818 815 ata_port_desc(host->ports[0], "irq %d", pdev->irq); 819 816 ata_port_desc(host->ports[1], "irq %d", pdev->irq); 820 - } else { 817 + } else if (legacy_mode) { 821 818 if (!ata_port_is_dummy(host->ports[0])) { 822 819 rc = devm_request_irq(dev, ATA_PRIMARY_IRQ(pdev), 823 820 pi->port_ops->irq_handler,
+2 -1
drivers/ata/pata_ixp4xx_cf.c
··· 130 130 .port_start = ata_port_start, 131 131 }; 132 132 133 - static void ixp4xx_setup_port(struct ata_ioports *ioaddr, 133 + static void ixp4xx_setup_port(struct ata_port *ap, 134 134 struct ixp4xx_pata_data *data, 135 135 unsigned long raw_cs0, unsigned long raw_cs1) 136 136 { 137 + struct ata_ioports *ioaddr = &ap->ioaddr; 137 138 unsigned long raw_cmd = raw_cs0; 138 139 unsigned long raw_ctl = raw_cs1 + 0x06; 139 140
+13 -2
drivers/ata/pata_pdc202xx_old.c
··· 215 215 /* Flip back to 33Mhz for PIO */ 216 216 if (adev->dma_mode >= XFER_UDMA_2) 217 217 iowrite8(ioread8(clock) & ~sel66, clock); 218 - 219 218 ata_bmdma_stop(qc); 219 + pdc202xx_set_piomode(ap, adev); 220 220 } 221 221 222 222 /** ··· 231 231 static void pdc2026x_dev_config(struct ata_device *adev) 232 232 { 233 233 adev->max_sectors = 256; 234 + } 235 + 236 + static int pdc2026x_port_start(struct ata_port *ap) 237 + { 238 + void __iomem *bmdma = ap->ioaddr.bmdma_addr; 239 + if (bmdma) { 240 + /* Enable burst mode */ 241 + u8 burst = ioread8(bmdma + 0x1f); 242 + iowrite8(burst | 0x01, bmdma + 0x1f); 243 + } 244 + return ata_sff_port_start(ap); 234 245 } 235 246 236 247 static struct scsi_host_template pdc202xx_sht = { ··· 324 313 .irq_clear = ata_bmdma_irq_clear, 325 314 .irq_on = ata_irq_on, 326 315 327 - .port_start = ata_sff_port_start, 316 + .port_start = pdc2026x_port_start, 328 317 }; 329 318 330 319 static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id)
+1 -1
drivers/ata/sata_qstor.c
··· 270 270 static void qs_error_handler(struct ata_port *ap) 271 271 { 272 272 qs_enter_reg_mode(ap); 273 - ata_do_eh(ap, qs_prereset, ata_std_softreset, NULL, 273 + ata_do_eh(ap, qs_prereset, NULL, sata_std_hardreset, 274 274 ata_std_postreset); 275 275 } 276 276
+25 -10
drivers/ata/sata_sil24.c
··· 832 832 struct ata_link *link = qc->dev->link; 833 833 struct ata_port *ap = link->ap; 834 834 u8 prot = qc->tf.protocol; 835 - int is_atapi = (prot == ATA_PROT_ATAPI || 836 - prot == ATA_PROT_ATAPI_NODATA || 837 - prot == ATA_PROT_ATAPI_DMA); 838 835 839 - /* ATAPI commands completing with CHECK_SENSE cause various 840 - * weird problems if other commands are active. PMP DMA CS 841 - * errata doesn't cover all and HSM violation occurs even with 842 - * only one other device active. Always run an ATAPI command 843 - * by itself. 844 - */ 836 + /* 837 + * There is a bug in the chip: 838 + * Port LRAM Causes the PRB/SGT Data to be Corrupted 839 + * If the host issues a read request for LRAM and SActive registers 840 + * while active commands are available in the port, PRB/SGT data in 841 + * the LRAM can become corrupted. This issue applies only when 842 + * reading from, but not writing to, the LRAM. 843 + * 844 + * Therefore, reading LRAM when there is no particular error [and 845 + * other commands may be outstanding] is prohibited. 846 + * 847 + * To avoid this bug there are two situations where a command must run 848 + * exclusive of any other commands on the port: 849 + * 850 + * - ATAPI commands which check the sense data 851 + * - Passthrough ATA commands which always have ATA_QCFLAG_RESULT_TF 852 + * set. 853 + * 854 + */ 855 + int is_excl = (prot == ATA_PROT_ATAPI || 856 + prot == ATA_PROT_ATAPI_NODATA || 857 + prot == ATA_PROT_ATAPI_DMA || 858 + (qc->flags & ATA_QCFLAG_RESULT_TF)); 859 + 845 860 if (unlikely(ap->excl_link)) { 846 861 if (link == ap->excl_link) { 847 862 if (ap->nr_active_links) ··· 864 849 qc->flags |= ATA_QCFLAG_CLEAR_EXCL; 865 850 } else 866 851 return ATA_DEFER_PORT; 867 - } else if (unlikely(is_atapi)) { 852 + } else if (unlikely(is_excl)) { 868 853 ap->excl_link = link; 869 854 if (ap->nr_active_links) 870 855 return ATA_DEFER_PORT;