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:
ahci: add workaround for on-board 5723s on some gigabyte boards
ahci: Soften up the dmesg on SB600 PMP softreset failure recovery
Documentation/kernel-parameters.txt: document libata's ignore_hpa option
sata_nv: MSI support, disabled by default
libata: OCZ Vertex can't do HPA
pata_atiixp: fix second channel support
pata_at91: fix resource release

+103 -27
+4
Documentation/kernel-parameters.txt
··· 1115 libata.dma=4 Compact Flash DMA only 1116 Combinations also work, so libata.dma=3 enables DMA 1117 for disks and CDROMs, but not CFs. 1118 1119 libata.noacpi [LIBATA] Disables use of ACPI in libata suspend/resume 1120 when set.
··· 1115 libata.dma=4 Compact Flash DMA only 1116 Combinations also work, so libata.dma=3 enables DMA 1117 for disks and CDROMs, but not CFs. 1118 + 1119 + libata.ignore_hpa= [LIBATA] Ignore HPA limit 1120 + libata.ignore_hpa=0 keep BIOS limits (default) 1121 + libata.ignore_hpa=1 ignore limits, using full disk 1122 1123 libata.noacpi [LIBATA] Disables use of ACPI in libata suspend/resume 1124 when set.
+74 -5
drivers/ata/ahci.c
··· 219 AHCI_HFLAG_SECT255 = (1 << 8), /* max 255 sectors */ 220 AHCI_HFLAG_YES_NCQ = (1 << 9), /* force NCQ cap on */ 221 AHCI_HFLAG_NO_SUSPEND = (1 << 10), /* don't suspend */ 222 223 /* ap->flags bits */ 224 ··· 1665 int (*check_ready)(struct ata_link *link)) 1666 { 1667 struct ata_port *ap = link->ap; 1668 const char *reason = NULL; 1669 unsigned long now, msecs; 1670 struct ata_taskfile tf; ··· 1704 1705 /* wait for link to become ready */ 1706 rc = ata_wait_after_reset(link, deadline, check_ready); 1707 - /* link occupied, -ENODEV too is an error */ 1708 - if (rc) { 1709 reason = "device not ready"; 1710 goto fail; 1711 - } 1712 - *class = ahci_dev_classify(ap); 1713 1714 DPRINTK("EXIT, class=%u\n", *class); 1715 return 0; ··· 1785 irq_sts = readl(port_mmio + PORT_IRQ_STAT); 1786 if (irq_sts & PORT_IRQ_BAD_PMP) { 1787 ata_link_printk(link, KERN_WARNING, 1788 - "failed due to HW bug, retry pmp=0\n"); 1789 rc = ahci_do_softreset(link, class, 0, deadline, 1790 ahci_check_ready); 1791 } ··· 2739 return !ver || strcmp(ver, dmi->driver_data) < 0; 2740 } 2741 2742 static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 2743 { 2744 static int printed_version; ··· 2902 hpriv->flags |= AHCI_HFLAG_NO_SUSPEND; 2903 dev_printk(KERN_WARNING, &pdev->dev, 2904 "BIOS update required for suspend/resume\n"); 2905 } 2906 2907 /* CAP.NP sometimes indicate the index of the last enabled
··· 219 AHCI_HFLAG_SECT255 = (1 << 8), /* max 255 sectors */ 220 AHCI_HFLAG_YES_NCQ = (1 << 9), /* force NCQ cap on */ 221 AHCI_HFLAG_NO_SUSPEND = (1 << 10), /* don't suspend */ 222 + AHCI_HFLAG_SRST_TOUT_IS_OFFLINE = (1 << 11), /* treat SRST timeout as 223 + link offline */ 224 225 /* ap->flags bits */ 226 ··· 1663 int (*check_ready)(struct ata_link *link)) 1664 { 1665 struct ata_port *ap = link->ap; 1666 + struct ahci_host_priv *hpriv = ap->host->private_data; 1667 const char *reason = NULL; 1668 unsigned long now, msecs; 1669 struct ata_taskfile tf; ··· 1701 1702 /* wait for link to become ready */ 1703 rc = ata_wait_after_reset(link, deadline, check_ready); 1704 + if (rc == -EBUSY && hpriv->flags & AHCI_HFLAG_SRST_TOUT_IS_OFFLINE) { 1705 + /* 1706 + * Workaround for cases where link online status can't 1707 + * be trusted. Treat device readiness timeout as link 1708 + * offline. 1709 + */ 1710 + ata_link_printk(link, KERN_INFO, 1711 + "device not ready, treating as offline\n"); 1712 + *class = ATA_DEV_NONE; 1713 + } else if (rc) { 1714 + /* link occupied, -ENODEV too is an error */ 1715 reason = "device not ready"; 1716 goto fail; 1717 + } else 1718 + *class = ahci_dev_classify(ap); 1719 1720 DPRINTK("EXIT, class=%u\n", *class); 1721 return 0; ··· 1773 irq_sts = readl(port_mmio + PORT_IRQ_STAT); 1774 if (irq_sts & PORT_IRQ_BAD_PMP) { 1775 ata_link_printk(link, KERN_WARNING, 1776 + "applying SB600 PMP SRST workaround " 1777 + "and retrying\n"); 1778 rc = ahci_do_softreset(link, class, 0, deadline, 1779 ahci_check_ready); 1780 } ··· 2726 return !ver || strcmp(ver, dmi->driver_data) < 0; 2727 } 2728 2729 + static bool ahci_broken_online(struct pci_dev *pdev) 2730 + { 2731 + #define ENCODE_BUSDEVFN(bus, slot, func) \ 2732 + (void *)(unsigned long)(((bus) << 8) | PCI_DEVFN((slot), (func))) 2733 + static const struct dmi_system_id sysids[] = { 2734 + /* 2735 + * There are several gigabyte boards which use 2736 + * SIMG5723s configured as hardware RAID. Certain 2737 + * 5723 firmware revisions shipped there keep the link 2738 + * online but fail to answer properly to SRST or 2739 + * IDENTIFY when no device is attached downstream 2740 + * causing libata to retry quite a few times leading 2741 + * to excessive detection delay. 2742 + * 2743 + * As these firmwares respond to the second reset try 2744 + * with invalid device signature, considering unknown 2745 + * sig as offline works around the problem acceptably. 2746 + */ 2747 + { 2748 + .ident = "EP45-DQ6", 2749 + .matches = { 2750 + DMI_MATCH(DMI_BOARD_VENDOR, 2751 + "Gigabyte Technology Co., Ltd."), 2752 + DMI_MATCH(DMI_BOARD_NAME, "EP45-DQ6"), 2753 + }, 2754 + .driver_data = ENCODE_BUSDEVFN(0x0a, 0x00, 0), 2755 + }, 2756 + { 2757 + .ident = "EP45-DS5", 2758 + .matches = { 2759 + DMI_MATCH(DMI_BOARD_VENDOR, 2760 + "Gigabyte Technology Co., Ltd."), 2761 + DMI_MATCH(DMI_BOARD_NAME, "EP45-DS5"), 2762 + }, 2763 + .driver_data = ENCODE_BUSDEVFN(0x03, 0x00, 0), 2764 + }, 2765 + { } /* terminate list */ 2766 + }; 2767 + #undef ENCODE_BUSDEVFN 2768 + const struct dmi_system_id *dmi = dmi_first_match(sysids); 2769 + unsigned int val; 2770 + 2771 + if (!dmi) 2772 + return false; 2773 + 2774 + val = (unsigned long)dmi->driver_data; 2775 + 2776 + return pdev->bus->number == (val >> 8) && pdev->devfn == (val & 0xff); 2777 + } 2778 + 2779 static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 2780 { 2781 static int printed_version; ··· 2839 hpriv->flags |= AHCI_HFLAG_NO_SUSPEND; 2840 dev_printk(KERN_WARNING, &pdev->dev, 2841 "BIOS update required for suspend/resume\n"); 2842 + } 2843 + 2844 + if (ahci_broken_online(pdev)) { 2845 + hpriv->flags |= AHCI_HFLAG_SRST_TOUT_IS_OFFLINE; 2846 + dev_info(&pdev->dev, 2847 + "online status unreliable, applying workaround\n"); 2848 } 2849 2850 /* CAP.NP sometimes indicate the index of the last enabled
+3
drivers/ata/libata-core.c
··· 4302 { "WDC WD2500JD-00HBB0", "WD-WMAL71490727", ATA_HORKAGE_BROKEN_HPA }, 4303 { "MAXTOR 6L080L4", "A93.0500", ATA_HORKAGE_BROKEN_HPA }, 4304 4305 /* Devices which report 1 sector over size HPA */ 4306 { "ST340823A", NULL, ATA_HORKAGE_HPA_SIZE, }, 4307 { "ST320413A", NULL, ATA_HORKAGE_HPA_SIZE, },
··· 4302 { "WDC WD2500JD-00HBB0", "WD-WMAL71490727", ATA_HORKAGE_BROKEN_HPA }, 4303 { "MAXTOR 6L080L4", "A93.0500", ATA_HORKAGE_BROKEN_HPA }, 4304 4305 + /* this one allows HPA unlocking but fails IOs on the area */ 4306 + { "OCZ-VERTEX", "1.30", ATA_HORKAGE_BROKEN_HPA }, 4307 + 4308 /* Devices which report 1 sector over size HPA */ 4309 { "ST340823A", NULL, ATA_HORKAGE_HPA_SIZE, }, 4310 { "ST320413A", NULL, ATA_HORKAGE_HPA_SIZE, },
+4 -13
drivers/ata/pata_at91.c
··· 250 ata_port_desc(ap, "no IRQ, using PIO polling"); 251 } 252 253 - info = kzalloc(sizeof(*info), GFP_KERNEL); 254 255 if (!info) { 256 dev_err(dev, "failed to allocate memory for private data\n"); ··· 275 if (!info->ide_addr) { 276 dev_err(dev, "failed to map IO base\n"); 277 ret = -ENOMEM; 278 - goto err_ide_ioremap; 279 } 280 281 info->alt_addr = devm_ioremap(dev, ··· 284 if (!info->alt_addr) { 285 dev_err(dev, "failed to map CTL base\n"); 286 ret = -ENOMEM; 287 - goto err_alt_ioremap; 288 } 289 290 ap->ioaddr.cmd_addr = info->ide_addr; ··· 303 irq ? ata_sff_interrupt : NULL, 304 irq_flags, &pata_at91_sht); 305 306 - err_alt_ioremap: 307 - devm_iounmap(dev, info->ide_addr); 308 - 309 - err_ide_ioremap: 310 clk_put(info->mck); 311 - kfree(info); 312 - 313 return ret; 314 } 315 ··· 312 { 313 struct ata_host *host = dev_get_drvdata(&pdev->dev); 314 struct at91_ide_info *info; 315 - struct device *dev = &pdev->dev; 316 317 if (!host) 318 return 0; ··· 322 if (!info) 323 return 0; 324 325 - devm_iounmap(dev, info->ide_addr); 326 - devm_iounmap(dev, info->alt_addr); 327 clk_put(info->mck); 328 329 - kfree(info); 330 return 0; 331 } 332
··· 250 ata_port_desc(ap, "no IRQ, using PIO polling"); 251 } 252 253 + info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); 254 255 if (!info) { 256 dev_err(dev, "failed to allocate memory for private data\n"); ··· 275 if (!info->ide_addr) { 276 dev_err(dev, "failed to map IO base\n"); 277 ret = -ENOMEM; 278 + goto err_put; 279 } 280 281 info->alt_addr = devm_ioremap(dev, ··· 284 if (!info->alt_addr) { 285 dev_err(dev, "failed to map CTL base\n"); 286 ret = -ENOMEM; 287 + goto err_put; 288 } 289 290 ap->ioaddr.cmd_addr = info->ide_addr; ··· 303 irq ? ata_sff_interrupt : NULL, 304 irq_flags, &pata_at91_sht); 305 306 + err_put: 307 clk_put(info->mck); 308 return ret; 309 } 310 ··· 317 { 318 struct ata_host *host = dev_get_drvdata(&pdev->dev); 319 struct at91_ide_info *info; 320 321 if (!host) 322 return 0; ··· 328 if (!info) 329 return 0; 330 331 clk_put(info->mck); 332 333 return 0; 334 } 335
+10 -9
drivers/ata/pata_atiixp.c
··· 1 /* 2 * pata_atiixp.c - ATI PATA for new ATA layer 3 * (C) 2005 Red Hat Inc 4 * 5 * Based on 6 * ··· 62 63 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 64 int dn = 2 * ap->port_no + adev->devno; 65 - 66 - /* Check this is correct - the order is odd in both drivers */ 67 int timing_shift = (16 * ap->port_no) + 8 * (adev->devno ^ 1); 68 - u16 pio_mode_data, pio_timing_data; 69 70 pci_read_config_word(pdev, ATIIXP_IDE_PIO_MODE, &pio_mode_data); 71 pio_mode_data &= ~(0x7 << (4 * dn)); 72 pio_mode_data |= pio << (4 * dn); 73 pci_write_config_word(pdev, ATIIXP_IDE_PIO_MODE, pio_mode_data); 74 75 - pci_read_config_word(pdev, ATIIXP_IDE_PIO_TIMING, &pio_timing_data); 76 pio_timing_data &= ~(0xFF << timing_shift); 77 pio_timing_data |= (pio_timings[pio] << timing_shift); 78 - pci_write_config_word(pdev, ATIIXP_IDE_PIO_TIMING, pio_timing_data); 79 } 80 81 /** ··· 119 udma_mode_data |= dma << (4 * dn); 120 pci_write_config_word(pdev, ATIIXP_IDE_UDMA_MODE, udma_mode_data); 121 } else { 122 - u16 mwdma_timing_data; 123 - /* Check this is correct - the order is odd in both drivers */ 124 int timing_shift = (16 * ap->port_no) + 8 * (adev->devno ^ 1); 125 126 dma -= XFER_MW_DMA_0; 127 128 - pci_read_config_word(pdev, ATIIXP_IDE_MWDMA_TIMING, &mwdma_timing_data); 129 mwdma_timing_data &= ~(0xFF << timing_shift); 130 mwdma_timing_data |= (mwdma_timings[dma] << timing_shift); 131 - pci_write_config_word(pdev, ATIIXP_IDE_MWDMA_TIMING, mwdma_timing_data); 132 } 133 /* 134 * We must now look at the PIO mode situation. We may need to
··· 1 /* 2 * pata_atiixp.c - ATI PATA for new ATA layer 3 * (C) 2005 Red Hat Inc 4 + * (C) 2009 Bartlomiej Zolnierkiewicz 5 * 6 * Based on 7 * ··· 61 62 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 63 int dn = 2 * ap->port_no + adev->devno; 64 int timing_shift = (16 * ap->port_no) + 8 * (adev->devno ^ 1); 65 + u32 pio_timing_data; 66 + u16 pio_mode_data; 67 68 pci_read_config_word(pdev, ATIIXP_IDE_PIO_MODE, &pio_mode_data); 69 pio_mode_data &= ~(0x7 << (4 * dn)); 70 pio_mode_data |= pio << (4 * dn); 71 pci_write_config_word(pdev, ATIIXP_IDE_PIO_MODE, pio_mode_data); 72 73 + pci_read_config_dword(pdev, ATIIXP_IDE_PIO_TIMING, &pio_timing_data); 74 pio_timing_data &= ~(0xFF << timing_shift); 75 pio_timing_data |= (pio_timings[pio] << timing_shift); 76 + pci_write_config_dword(pdev, ATIIXP_IDE_PIO_TIMING, pio_timing_data); 77 } 78 79 /** ··· 119 udma_mode_data |= dma << (4 * dn); 120 pci_write_config_word(pdev, ATIIXP_IDE_UDMA_MODE, udma_mode_data); 121 } else { 122 int timing_shift = (16 * ap->port_no) + 8 * (adev->devno ^ 1); 123 + u32 mwdma_timing_data; 124 125 dma -= XFER_MW_DMA_0; 126 127 + pci_read_config_dword(pdev, ATIIXP_IDE_MWDMA_TIMING, 128 + &mwdma_timing_data); 129 mwdma_timing_data &= ~(0xFF << timing_shift); 130 mwdma_timing_data |= (mwdma_timings[dma] << timing_shift); 131 + pci_write_config_dword(pdev, ATIIXP_IDE_MWDMA_TIMING, 132 + mwdma_timing_data); 133 } 134 /* 135 * We must now look at the PIO mode situation. We may need to
+8
drivers/ata/sata_nv.c
··· 602 603 static int adma_enabled; 604 static int swncq_enabled = 1; 605 606 static void nv_adma_register_mode(struct ata_port *ap) 607 { ··· 2460 } else if (type == SWNCQ) 2461 nv_swncq_host_init(host); 2462 2463 pci_set_master(pdev); 2464 return ata_host_activate(host, pdev->irq, ipriv->irq_handler, 2465 IRQF_SHARED, ipriv->sht); ··· 2564 MODULE_PARM_DESC(adma, "Enable use of ADMA (Default: false)"); 2565 module_param_named(swncq, swncq_enabled, bool, 0444); 2566 MODULE_PARM_DESC(swncq, "Enable use of SWNCQ (Default: true)"); 2567
··· 602 603 static int adma_enabled; 604 static int swncq_enabled = 1; 605 + static int msi_enabled; 606 607 static void nv_adma_register_mode(struct ata_port *ap) 608 { ··· 2459 } else if (type == SWNCQ) 2460 nv_swncq_host_init(host); 2461 2462 + if (msi_enabled) { 2463 + dev_printk(KERN_NOTICE, &pdev->dev, "Using MSI\n"); 2464 + pci_enable_msi(pdev); 2465 + } 2466 + 2467 pci_set_master(pdev); 2468 return ata_host_activate(host, pdev->irq, ipriv->irq_handler, 2469 IRQF_SHARED, ipriv->sht); ··· 2558 MODULE_PARM_DESC(adma, "Enable use of ADMA (Default: false)"); 2559 module_param_named(swncq, swncq_enabled, bool, 0444); 2560 MODULE_PARM_DESC(swncq, "Enable use of SWNCQ (Default: true)"); 2561 + module_param_named(msi, msi_enabled, bool, 0444); 2562 + MODULE_PARM_DESC(msi, "Enable use of MSI (Default: false)"); 2563