diff options
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/ahci.c | 201 | ||||
-rw-r--r-- | drivers/ata/libata-acpi.c | 40 | ||||
-rw-r--r-- | drivers/ata/libata-core.c | 15 | ||||
-rw-r--r-- | drivers/ata/libata-eh.c | 56 | ||||
-rw-r--r-- | drivers/ata/libata.h | 2 | ||||
-rw-r--r-- | drivers/ata/pata_ali.c | 2 | ||||
-rw-r--r-- | drivers/ata/pata_atiixp.c | 2 | ||||
-rw-r--r-- | drivers/ata/pata_atp867x.c | 101 | ||||
-rw-r--r-- | drivers/ata/pata_sc1200.c | 3 | ||||
-rw-r--r-- | drivers/ata/pata_via.c | 2 | ||||
-rw-r--r-- | drivers/ata/sata_mv.c | 29 | ||||
-rw-r--r-- | drivers/ata/sata_nv.c | 18 |
12 files changed, 325 insertions, 146 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index acd1162712b1..a06f5d6375a8 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -122,6 +122,7 @@ enum { | |||
122 | HOST_VERSION = 0x10, /* AHCI spec. version compliancy */ | 122 | HOST_VERSION = 0x10, /* AHCI spec. version compliancy */ |
123 | HOST_EM_LOC = 0x1c, /* Enclosure Management location */ | 123 | HOST_EM_LOC = 0x1c, /* Enclosure Management location */ |
124 | HOST_EM_CTL = 0x20, /* Enclosure Management Control */ | 124 | HOST_EM_CTL = 0x20, /* Enclosure Management Control */ |
125 | HOST_CAP2 = 0x24, /* host capabilities, extended */ | ||
125 | 126 | ||
126 | /* HOST_CTL bits */ | 127 | /* HOST_CTL bits */ |
127 | HOST_RESET = (1 << 0), /* reset controller; self-clear */ | 128 | HOST_RESET = (1 << 0), /* reset controller; self-clear */ |
@@ -129,16 +130,29 @@ enum { | |||
129 | HOST_AHCI_EN = (1 << 31), /* AHCI enabled */ | 130 | HOST_AHCI_EN = (1 << 31), /* AHCI enabled */ |
130 | 131 | ||
131 | /* HOST_CAP bits */ | 132 | /* HOST_CAP bits */ |
133 | HOST_CAP_SXS = (1 << 5), /* Supports External SATA */ | ||
132 | HOST_CAP_EMS = (1 << 6), /* Enclosure Management support */ | 134 | HOST_CAP_EMS = (1 << 6), /* Enclosure Management support */ |
133 | HOST_CAP_SSC = (1 << 14), /* Slumber capable */ | 135 | HOST_CAP_CCC = (1 << 7), /* Command Completion Coalescing */ |
136 | HOST_CAP_PART = (1 << 13), /* Partial state capable */ | ||
137 | HOST_CAP_SSC = (1 << 14), /* Slumber state capable */ | ||
138 | HOST_CAP_PIO_MULTI = (1 << 15), /* PIO multiple DRQ support */ | ||
139 | HOST_CAP_FBS = (1 << 16), /* FIS-based switching support */ | ||
134 | HOST_CAP_PMP = (1 << 17), /* Port Multiplier support */ | 140 | HOST_CAP_PMP = (1 << 17), /* Port Multiplier support */ |
141 | HOST_CAP_ONLY = (1 << 18), /* Supports AHCI mode only */ | ||
135 | HOST_CAP_CLO = (1 << 24), /* Command List Override support */ | 142 | HOST_CAP_CLO = (1 << 24), /* Command List Override support */ |
143 | HOST_CAP_LED = (1 << 25), /* Supports activity LED */ | ||
136 | HOST_CAP_ALPM = (1 << 26), /* Aggressive Link PM support */ | 144 | HOST_CAP_ALPM = (1 << 26), /* Aggressive Link PM support */ |
137 | HOST_CAP_SSS = (1 << 27), /* Staggered Spin-up */ | 145 | HOST_CAP_SSS = (1 << 27), /* Staggered Spin-up */ |
146 | HOST_CAP_MPS = (1 << 28), /* Mechanical presence switch */ | ||
138 | HOST_CAP_SNTF = (1 << 29), /* SNotification register */ | 147 | HOST_CAP_SNTF = (1 << 29), /* SNotification register */ |
139 | HOST_CAP_NCQ = (1 << 30), /* Native Command Queueing */ | 148 | HOST_CAP_NCQ = (1 << 30), /* Native Command Queueing */ |
140 | HOST_CAP_64 = (1 << 31), /* PCI DAC (64-bit DMA) support */ | 149 | HOST_CAP_64 = (1 << 31), /* PCI DAC (64-bit DMA) support */ |
141 | 150 | ||
151 | /* HOST_CAP2 bits */ | ||
152 | HOST_CAP2_BOH = (1 << 0), /* BIOS/OS handoff supported */ | ||
153 | HOST_CAP2_NVMHCI = (1 << 1), /* NVMHCI supported */ | ||
154 | HOST_CAP2_APST = (1 << 2), /* Automatic partial to slumber */ | ||
155 | |||
142 | /* registers for each SATA port */ | 156 | /* registers for each SATA port */ |
143 | PORT_LST_ADDR = 0x00, /* command list DMA addr */ | 157 | PORT_LST_ADDR = 0x00, /* command list DMA addr */ |
144 | PORT_LST_ADDR_HI = 0x04, /* command list DMA addr hi */ | 158 | PORT_LST_ADDR_HI = 0x04, /* command list DMA addr hi */ |
@@ -267,8 +281,10 @@ struct ahci_em_priv { | |||
267 | struct ahci_host_priv { | 281 | struct ahci_host_priv { |
268 | unsigned int flags; /* AHCI_HFLAG_* */ | 282 | unsigned int flags; /* AHCI_HFLAG_* */ |
269 | u32 cap; /* cap to use */ | 283 | u32 cap; /* cap to use */ |
284 | u32 cap2; /* cap2 to use */ | ||
270 | u32 port_map; /* port map to use */ | 285 | u32 port_map; /* port map to use */ |
271 | u32 saved_cap; /* saved initial cap */ | 286 | u32 saved_cap; /* saved initial cap */ |
287 | u32 saved_cap2; /* saved initial cap2 */ | ||
272 | u32 saved_port_map; /* saved initial port_map */ | 288 | u32 saved_port_map; /* saved initial port_map */ |
273 | u32 em_loc; /* enclosure management location */ | 289 | u32 em_loc; /* enclosure management location */ |
274 | }; | 290 | }; |
@@ -331,12 +347,15 @@ static void ahci_init_sw_activity(struct ata_link *link); | |||
331 | 347 | ||
332 | static ssize_t ahci_show_host_caps(struct device *dev, | 348 | static ssize_t ahci_show_host_caps(struct device *dev, |
333 | struct device_attribute *attr, char *buf); | 349 | struct device_attribute *attr, char *buf); |
350 | static ssize_t ahci_show_host_cap2(struct device *dev, | ||
351 | struct device_attribute *attr, char *buf); | ||
334 | static ssize_t ahci_show_host_version(struct device *dev, | 352 | static ssize_t ahci_show_host_version(struct device *dev, |
335 | struct device_attribute *attr, char *buf); | 353 | struct device_attribute *attr, char *buf); |
336 | static ssize_t ahci_show_port_cmd(struct device *dev, | 354 | static ssize_t ahci_show_port_cmd(struct device *dev, |
337 | struct device_attribute *attr, char *buf); | 355 | struct device_attribute *attr, char *buf); |
338 | 356 | ||
339 | DEVICE_ATTR(ahci_host_caps, S_IRUGO, ahci_show_host_caps, NULL); | 357 | DEVICE_ATTR(ahci_host_caps, S_IRUGO, ahci_show_host_caps, NULL); |
358 | DEVICE_ATTR(ahci_host_cap2, S_IRUGO, ahci_show_host_cap2, NULL); | ||
340 | DEVICE_ATTR(ahci_host_version, S_IRUGO, ahci_show_host_version, NULL); | 359 | DEVICE_ATTR(ahci_host_version, S_IRUGO, ahci_show_host_version, NULL); |
341 | DEVICE_ATTR(ahci_port_cmd, S_IRUGO, ahci_show_port_cmd, NULL); | 360 | DEVICE_ATTR(ahci_port_cmd, S_IRUGO, ahci_show_port_cmd, NULL); |
342 | 361 | ||
@@ -345,6 +364,7 @@ static struct device_attribute *ahci_shost_attrs[] = { | |||
345 | &dev_attr_em_message_type, | 364 | &dev_attr_em_message_type, |
346 | &dev_attr_em_message, | 365 | &dev_attr_em_message, |
347 | &dev_attr_ahci_host_caps, | 366 | &dev_attr_ahci_host_caps, |
367 | &dev_attr_ahci_host_cap2, | ||
348 | &dev_attr_ahci_host_version, | 368 | &dev_attr_ahci_host_version, |
349 | &dev_attr_ahci_port_cmd, | 369 | &dev_attr_ahci_port_cmd, |
350 | NULL | 370 | NULL |
@@ -447,7 +467,8 @@ static const struct ata_port_info ahci_port_info[] = { | |||
447 | [board_ahci_sb600] = | 467 | [board_ahci_sb600] = |
448 | { | 468 | { |
449 | AHCI_HFLAGS (AHCI_HFLAG_IGN_SERR_INTERNAL | | 469 | AHCI_HFLAGS (AHCI_HFLAG_IGN_SERR_INTERNAL | |
450 | AHCI_HFLAG_NO_MSI | AHCI_HFLAG_SECT255), | 470 | AHCI_HFLAG_NO_MSI | AHCI_HFLAG_SECT255 | |
471 | AHCI_HFLAG_32BIT_ONLY), | ||
451 | .flags = AHCI_FLAG_COMMON, | 472 | .flags = AHCI_FLAG_COMMON, |
452 | .pio_mask = ATA_PIO4, | 473 | .pio_mask = ATA_PIO4, |
453 | .udma_mask = ATA_UDMA6, | 474 | .udma_mask = ATA_UDMA6, |
@@ -554,7 +575,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
554 | { PCI_VDEVICE(ATI, 0x4395), board_ahci_sb700 }, /* ATI SB700/800 */ | 575 | { PCI_VDEVICE(ATI, 0x4395), board_ahci_sb700 }, /* ATI SB700/800 */ |
555 | 576 | ||
556 | /* AMD */ | 577 | /* AMD */ |
557 | { PCI_VDEVICE(AMD, 0x7800), board_ahci }, /* AMD SB900 */ | 578 | { PCI_VDEVICE(AMD, 0x7800), board_ahci }, /* AMD Hudson-2 */ |
558 | /* AMD is using RAID class only for ahci controllers */ | 579 | /* AMD is using RAID class only for ahci controllers */ |
559 | { PCI_VENDOR_ID_AMD, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | 580 | { PCI_VENDOR_ID_AMD, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
560 | PCI_CLASS_STORAGE_RAID << 8, 0xffffff, board_ahci }, | 581 | PCI_CLASS_STORAGE_RAID << 8, 0xffffff, board_ahci }, |
@@ -584,6 +605,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
584 | { PCI_VDEVICE(NVIDIA, 0x0559), board_ahci_yesncq }, /* MCP67 */ | 605 | { PCI_VDEVICE(NVIDIA, 0x0559), board_ahci_yesncq }, /* MCP67 */ |
585 | { PCI_VDEVICE(NVIDIA, 0x055a), board_ahci_yesncq }, /* MCP67 */ | 606 | { PCI_VDEVICE(NVIDIA, 0x055a), board_ahci_yesncq }, /* MCP67 */ |
586 | { PCI_VDEVICE(NVIDIA, 0x055b), board_ahci_yesncq }, /* MCP67 */ | 607 | { PCI_VDEVICE(NVIDIA, 0x055b), board_ahci_yesncq }, /* MCP67 */ |
608 | { PCI_VDEVICE(NVIDIA, 0x0580), board_ahci_yesncq }, /* Linux ID */ | ||
587 | { PCI_VDEVICE(NVIDIA, 0x07f0), board_ahci_yesncq }, /* MCP73 */ | 609 | { PCI_VDEVICE(NVIDIA, 0x07f0), board_ahci_yesncq }, /* MCP73 */ |
588 | { PCI_VDEVICE(NVIDIA, 0x07f1), board_ahci_yesncq }, /* MCP73 */ | 610 | { PCI_VDEVICE(NVIDIA, 0x07f1), board_ahci_yesncq }, /* MCP73 */ |
589 | { PCI_VDEVICE(NVIDIA, 0x07f2), board_ahci_yesncq }, /* MCP73 */ | 611 | { PCI_VDEVICE(NVIDIA, 0x07f2), board_ahci_yesncq }, /* MCP73 */ |
@@ -732,6 +754,16 @@ static ssize_t ahci_show_host_caps(struct device *dev, | |||
732 | return sprintf(buf, "%x\n", hpriv->cap); | 754 | return sprintf(buf, "%x\n", hpriv->cap); |
733 | } | 755 | } |
734 | 756 | ||
757 | static ssize_t ahci_show_host_cap2(struct device *dev, | ||
758 | struct device_attribute *attr, char *buf) | ||
759 | { | ||
760 | struct Scsi_Host *shost = class_to_shost(dev); | ||
761 | struct ata_port *ap = ata_shost_to_port(shost); | ||
762 | struct ahci_host_priv *hpriv = ap->host->private_data; | ||
763 | |||
764 | return sprintf(buf, "%x\n", hpriv->cap2); | ||
765 | } | ||
766 | |||
735 | static ssize_t ahci_show_host_version(struct device *dev, | 767 | static ssize_t ahci_show_host_version(struct device *dev, |
736 | struct device_attribute *attr, char *buf) | 768 | struct device_attribute *attr, char *buf) |
737 | { | 769 | { |
@@ -771,7 +803,7 @@ static void ahci_save_initial_config(struct pci_dev *pdev, | |||
771 | struct ahci_host_priv *hpriv) | 803 | struct ahci_host_priv *hpriv) |
772 | { | 804 | { |
773 | void __iomem *mmio = pcim_iomap_table(pdev)[AHCI_PCI_BAR]; | 805 | void __iomem *mmio = pcim_iomap_table(pdev)[AHCI_PCI_BAR]; |
774 | u32 cap, port_map; | 806 | u32 cap, cap2, vers, port_map; |
775 | int i; | 807 | int i; |
776 | int mv; | 808 | int mv; |
777 | 809 | ||
@@ -784,6 +816,14 @@ static void ahci_save_initial_config(struct pci_dev *pdev, | |||
784 | hpriv->saved_cap = cap = readl(mmio + HOST_CAP); | 816 | hpriv->saved_cap = cap = readl(mmio + HOST_CAP); |
785 | hpriv->saved_port_map = port_map = readl(mmio + HOST_PORTS_IMPL); | 817 | hpriv->saved_port_map = port_map = readl(mmio + HOST_PORTS_IMPL); |
786 | 818 | ||
819 | /* CAP2 register is only defined for AHCI 1.2 and later */ | ||
820 | vers = readl(mmio + HOST_VERSION); | ||
821 | if ((vers >> 16) > 1 || | ||
822 | ((vers >> 16) == 1 && (vers & 0xFFFF) >= 0x200)) | ||
823 | hpriv->saved_cap2 = cap2 = readl(mmio + HOST_CAP2); | ||
824 | else | ||
825 | hpriv->saved_cap2 = cap2 = 0; | ||
826 | |||
787 | /* some chips have errata preventing 64bit use */ | 827 | /* some chips have errata preventing 64bit use */ |
788 | if ((cap & HOST_CAP_64) && (hpriv->flags & AHCI_HFLAG_32BIT_ONLY)) { | 828 | if ((cap & HOST_CAP_64) && (hpriv->flags & AHCI_HFLAG_32BIT_ONLY)) { |
789 | dev_printk(KERN_INFO, &pdev->dev, | 829 | dev_printk(KERN_INFO, &pdev->dev, |
@@ -869,6 +909,7 @@ static void ahci_save_initial_config(struct pci_dev *pdev, | |||
869 | 909 | ||
870 | /* record values to use during operation */ | 910 | /* record values to use during operation */ |
871 | hpriv->cap = cap; | 911 | hpriv->cap = cap; |
912 | hpriv->cap2 = cap2; | ||
872 | hpriv->port_map = port_map; | 913 | hpriv->port_map = port_map; |
873 | } | 914 | } |
874 | 915 | ||
@@ -887,6 +928,8 @@ static void ahci_restore_initial_config(struct ata_host *host) | |||
887 | void __iomem *mmio = host->iomap[AHCI_PCI_BAR]; | 928 | void __iomem *mmio = host->iomap[AHCI_PCI_BAR]; |
888 | 929 | ||
889 | writel(hpriv->saved_cap, mmio + HOST_CAP); | 930 | writel(hpriv->saved_cap, mmio + HOST_CAP); |
931 | if (hpriv->saved_cap2) | ||
932 | writel(hpriv->saved_cap2, mmio + HOST_CAP2); | ||
890 | writel(hpriv->saved_port_map, mmio + HOST_PORTS_IMPL); | 933 | writel(hpriv->saved_port_map, mmio + HOST_PORTS_IMPL); |
891 | (void) readl(mmio + HOST_PORTS_IMPL); /* flush */ | 934 | (void) readl(mmio + HOST_PORTS_IMPL); /* flush */ |
892 | } | 935 | } |
@@ -2534,13 +2577,14 @@ static void ahci_print_info(struct ata_host *host) | |||
2534 | struct ahci_host_priv *hpriv = host->private_data; | 2577 | struct ahci_host_priv *hpriv = host->private_data; |
2535 | struct pci_dev *pdev = to_pci_dev(host->dev); | 2578 | struct pci_dev *pdev = to_pci_dev(host->dev); |
2536 | void __iomem *mmio = host->iomap[AHCI_PCI_BAR]; | 2579 | void __iomem *mmio = host->iomap[AHCI_PCI_BAR]; |
2537 | u32 vers, cap, impl, speed; | 2580 | u32 vers, cap, cap2, impl, speed; |
2538 | const char *speed_s; | 2581 | const char *speed_s; |
2539 | u16 cc; | 2582 | u16 cc; |
2540 | const char *scc_s; | 2583 | const char *scc_s; |
2541 | 2584 | ||
2542 | vers = readl(mmio + HOST_VERSION); | 2585 | vers = readl(mmio + HOST_VERSION); |
2543 | cap = hpriv->cap; | 2586 | cap = hpriv->cap; |
2587 | cap2 = hpriv->cap2; | ||
2544 | impl = hpriv->port_map; | 2588 | impl = hpriv->port_map; |
2545 | 2589 | ||
2546 | speed = (cap >> 20) & 0xf; | 2590 | speed = (cap >> 20) & 0xf; |
@@ -2583,25 +2627,29 @@ static void ahci_print_info(struct ata_host *host) | |||
2583 | "flags: " | 2627 | "flags: " |
2584 | "%s%s%s%s%s%s%s" | 2628 | "%s%s%s%s%s%s%s" |
2585 | "%s%s%s%s%s%s%s" | 2629 | "%s%s%s%s%s%s%s" |
2586 | "%s\n" | 2630 | "%s%s%s%s%s%s\n" |
2587 | , | 2631 | , |
2588 | 2632 | ||
2589 | cap & (1 << 31) ? "64bit " : "", | 2633 | cap & HOST_CAP_64 ? "64bit " : "", |
2590 | cap & (1 << 30) ? "ncq " : "", | 2634 | cap & HOST_CAP_NCQ ? "ncq " : "", |
2591 | cap & (1 << 29) ? "sntf " : "", | 2635 | cap & HOST_CAP_SNTF ? "sntf " : "", |
2592 | cap & (1 << 28) ? "ilck " : "", | 2636 | cap & HOST_CAP_MPS ? "ilck " : "", |
2593 | cap & (1 << 27) ? "stag " : "", | 2637 | cap & HOST_CAP_SSS ? "stag " : "", |
2594 | cap & (1 << 26) ? "pm " : "", | 2638 | cap & HOST_CAP_ALPM ? "pm " : "", |
2595 | cap & (1 << 25) ? "led " : "", | 2639 | cap & HOST_CAP_LED ? "led " : "", |
2596 | 2640 | cap & HOST_CAP_CLO ? "clo " : "", | |
2597 | cap & (1 << 24) ? "clo " : "", | 2641 | cap & HOST_CAP_ONLY ? "only " : "", |
2598 | cap & (1 << 19) ? "nz " : "", | 2642 | cap & HOST_CAP_PMP ? "pmp " : "", |
2599 | cap & (1 << 18) ? "only " : "", | 2643 | cap & HOST_CAP_FBS ? "fbs " : "", |
2600 | cap & (1 << 17) ? "pmp " : "", | 2644 | cap & HOST_CAP_PIO_MULTI ? "pio " : "", |
2601 | cap & (1 << 15) ? "pio " : "", | 2645 | cap & HOST_CAP_SSC ? "slum " : "", |
2602 | cap & (1 << 14) ? "slum " : "", | 2646 | cap & HOST_CAP_PART ? "part " : "", |
2603 | cap & (1 << 13) ? "part " : "", | 2647 | cap & HOST_CAP_CCC ? "ccc " : "", |
2604 | cap & (1 << 6) ? "ems ": "" | 2648 | cap & HOST_CAP_EMS ? "ems " : "", |
2649 | cap & HOST_CAP_SXS ? "sxs " : "", | ||
2650 | cap2 & HOST_CAP2_APST ? "apst " : "", | ||
2651 | cap2 & HOST_CAP2_NVMHCI ? "nvmp " : "", | ||
2652 | cap2 & HOST_CAP2_BOH ? "boh " : "" | ||
2605 | ); | 2653 | ); |
2606 | } | 2654 | } |
2607 | 2655 | ||
@@ -2650,17 +2698,15 @@ static void ahci_p5wdh_workaround(struct ata_host *host) | |||
2650 | } | 2698 | } |
2651 | } | 2699 | } |
2652 | 2700 | ||
2653 | /* | 2701 | /* only some SB600 ahci controllers can do 64bit DMA */ |
2654 | * SB600 ahci controller on certain boards can't do 64bit DMA with | 2702 | static bool ahci_sb600_enable_64bit(struct pci_dev *pdev) |
2655 | * older BIOS. | ||
2656 | */ | ||
2657 | static bool ahci_sb600_32bit_only(struct pci_dev *pdev) | ||
2658 | { | 2703 | { |
2659 | static const struct dmi_system_id sysids[] = { | 2704 | static const struct dmi_system_id sysids[] = { |
2660 | /* | 2705 | /* |
2661 | * The oldest version known to be broken is 0901 and | 2706 | * The oldest version known to be broken is 0901 and |
2662 | * working is 1501 which was released on 2007-10-26. | 2707 | * working is 1501 which was released on 2007-10-26. |
2663 | * Force 32bit DMA on anything older than 1501. | 2708 | * Enable 64bit DMA on 1501 and anything newer. |
2709 | * | ||
2664 | * Please read bko#9412 for more info. | 2710 | * Please read bko#9412 for more info. |
2665 | */ | 2711 | */ |
2666 | { | 2712 | { |
@@ -2672,48 +2718,29 @@ static bool ahci_sb600_32bit_only(struct pci_dev *pdev) | |||
2672 | }, | 2718 | }, |
2673 | .driver_data = "20071026", /* yyyymmdd */ | 2719 | .driver_data = "20071026", /* yyyymmdd */ |
2674 | }, | 2720 | }, |
2675 | /* | ||
2676 | * It's yet unknown whether more recent BIOS fixes the | ||
2677 | * problem. Blacklist the whole board for the time | ||
2678 | * being. Please read the following thread for more | ||
2679 | * info. | ||
2680 | * | ||
2681 | * http://thread.gmane.org/gmane.linux.ide/42326 | ||
2682 | */ | ||
2683 | { | ||
2684 | .ident = "Gigabyte GA-MA69VM-S2", | ||
2685 | .matches = { | ||
2686 | DMI_MATCH(DMI_BOARD_VENDOR, | ||
2687 | "Gigabyte Technology Co., Ltd."), | ||
2688 | DMI_MATCH(DMI_BOARD_NAME, "GA-MA69VM-S2"), | ||
2689 | }, | ||
2690 | }, | ||
2691 | { } | 2721 | { } |
2692 | }; | 2722 | }; |
2693 | const struct dmi_system_id *match; | 2723 | const struct dmi_system_id *match; |
2724 | int year, month, date; | ||
2725 | char buf[9]; | ||
2694 | 2726 | ||
2695 | match = dmi_first_match(sysids); | 2727 | match = dmi_first_match(sysids); |
2696 | if (pdev->bus->number != 0 || pdev->devfn != PCI_DEVFN(0x12, 0) || | 2728 | if (pdev->bus->number != 0 || pdev->devfn != PCI_DEVFN(0x12, 0) || |
2697 | !match) | 2729 | !match) |
2698 | return false; | 2730 | return false; |
2699 | 2731 | ||
2700 | if (match->driver_data) { | 2732 | dmi_get_date(DMI_BIOS_DATE, &year, &month, &date); |
2701 | int year, month, date; | 2733 | snprintf(buf, sizeof(buf), "%04d%02d%02d", year, month, date); |
2702 | char buf[9]; | ||
2703 | |||
2704 | dmi_get_date(DMI_BIOS_DATE, &year, &month, &date); | ||
2705 | snprintf(buf, sizeof(buf), "%04d%02d%02d", year, month, date); | ||
2706 | |||
2707 | if (strcmp(buf, match->driver_data) >= 0) | ||
2708 | return false; | ||
2709 | 2734 | ||
2735 | if (strcmp(buf, match->driver_data) >= 0) { | ||
2736 | dev_printk(KERN_WARNING, &pdev->dev, "%s: enabling 64bit DMA\n", | ||
2737 | match->ident); | ||
2738 | return true; | ||
2739 | } else { | ||
2710 | dev_printk(KERN_WARNING, &pdev->dev, "%s: BIOS too old, " | 2740 | dev_printk(KERN_WARNING, &pdev->dev, "%s: BIOS too old, " |
2711 | "forcing 32bit DMA, update BIOS\n", match->ident); | 2741 | "forcing 32bit DMA, update BIOS\n", match->ident); |
2712 | } else | 2742 | return false; |
2713 | dev_printk(KERN_WARNING, &pdev->dev, "%s: this board can't " | 2743 | } |
2714 | "do 64bit DMA, forcing 32bit\n", match->ident); | ||
2715 | |||
2716 | return true; | ||
2717 | } | 2744 | } |
2718 | 2745 | ||
2719 | static bool ahci_broken_system_poweroff(struct pci_dev *pdev) | 2746 | static bool ahci_broken_system_poweroff(struct pci_dev *pdev) |
@@ -2858,6 +2885,55 @@ static bool ahci_broken_online(struct pci_dev *pdev) | |||
2858 | return pdev->bus->number == (val >> 8) && pdev->devfn == (val & 0xff); | 2885 | return pdev->bus->number == (val >> 8) && pdev->devfn == (val & 0xff); |
2859 | } | 2886 | } |
2860 | 2887 | ||
2888 | #ifdef CONFIG_ATA_ACPI | ||
2889 | static void ahci_gtf_filter_workaround(struct ata_host *host) | ||
2890 | { | ||
2891 | static const struct dmi_system_id sysids[] = { | ||
2892 | /* | ||
2893 | * Aspire 3810T issues a bunch of SATA enable commands | ||
2894 | * via _GTF including an invalid one and one which is | ||
2895 | * rejected by the device. Among the successful ones | ||
2896 | * is FPDMA non-zero offset enable which when enabled | ||
2897 | * only on the drive side leads to NCQ command | ||
2898 | * failures. Filter it out. | ||
2899 | */ | ||
2900 | { | ||
2901 | .ident = "Aspire 3810T", | ||
2902 | .matches = { | ||
2903 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
2904 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 3810T"), | ||
2905 | }, | ||
2906 | .driver_data = (void *)ATA_ACPI_FILTER_FPDMA_OFFSET, | ||
2907 | }, | ||
2908 | { } | ||
2909 | }; | ||
2910 | const struct dmi_system_id *dmi = dmi_first_match(sysids); | ||
2911 | unsigned int filter; | ||
2912 | int i; | ||
2913 | |||
2914 | if (!dmi) | ||
2915 | return; | ||
2916 | |||
2917 | filter = (unsigned long)dmi->driver_data; | ||
2918 | dev_printk(KERN_INFO, host->dev, | ||
2919 | "applying extra ACPI _GTF filter 0x%x for %s\n", | ||
2920 | filter, dmi->ident); | ||
2921 | |||
2922 | for (i = 0; i < host->n_ports; i++) { | ||
2923 | struct ata_port *ap = host->ports[i]; | ||
2924 | struct ata_link *link; | ||
2925 | struct ata_device *dev; | ||
2926 | |||
2927 | ata_for_each_link(link, ap, EDGE) | ||
2928 | ata_for_each_dev(dev, link, ALL) | ||
2929 | dev->gtf_filter |= filter; | ||
2930 | } | ||
2931 | } | ||
2932 | #else | ||
2933 | static inline void ahci_gtf_filter_workaround(struct ata_host *host) | ||
2934 | {} | ||
2935 | #endif | ||
2936 | |||
2861 | static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | 2937 | static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
2862 | { | 2938 | { |
2863 | static int printed_version; | 2939 | static int printed_version; |
@@ -2926,9 +3002,9 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2926 | if (board_id == board_ahci_sb700 && pdev->revision >= 0x40) | 3002 | if (board_id == board_ahci_sb700 && pdev->revision >= 0x40) |
2927 | hpriv->flags &= ~AHCI_HFLAG_IGN_SERR_INTERNAL; | 3003 | hpriv->flags &= ~AHCI_HFLAG_IGN_SERR_INTERNAL; |
2928 | 3004 | ||
2929 | /* apply sb600 32bit only quirk */ | 3005 | /* only some SB600s can do 64bit DMA */ |
2930 | if (ahci_sb600_32bit_only(pdev)) | 3006 | if (ahci_sb600_enable_64bit(pdev)) |
2931 | hpriv->flags |= AHCI_HFLAG_32BIT_ONLY; | 3007 | hpriv->flags &= ~AHCI_HFLAG_32BIT_ONLY; |
2932 | 3008 | ||
2933 | if ((hpriv->flags & AHCI_HFLAG_NO_MSI) || pci_enable_msi(pdev)) | 3009 | if ((hpriv->flags & AHCI_HFLAG_NO_MSI) || pci_enable_msi(pdev)) |
2934 | pci_intx(pdev, 1); | 3010 | pci_intx(pdev, 1); |
@@ -3023,6 +3099,9 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3023 | /* apply workaround for ASUS P5W DH Deluxe mainboard */ | 3099 | /* apply workaround for ASUS P5W DH Deluxe mainboard */ |
3024 | ahci_p5wdh_workaround(host); | 3100 | ahci_p5wdh_workaround(host); |
3025 | 3101 | ||
3102 | /* apply gtf filter quirk */ | ||
3103 | ahci_gtf_filter_workaround(host); | ||
3104 | |||
3026 | /* initialize adapter */ | 3105 | /* initialize adapter */ |
3027 | rc = ahci_configure_dma_masks(pdev, hpriv->cap & HOST_CAP_64); | 3106 | rc = ahci_configure_dma_masks(pdev, hpriv->cap & HOST_CAP_64); |
3028 | if (rc) | 3107 | if (rc) |
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index 01964b6e6f6b..b0882cddfd4c 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
@@ -20,19 +20,9 @@ | |||
20 | 20 | ||
21 | #include <acpi/acpi_bus.h> | 21 | #include <acpi/acpi_bus.h> |
22 | 22 | ||
23 | enum { | 23 | unsigned int ata_acpi_gtf_filter = ATA_ACPI_FILTER_DEFAULT; |
24 | ATA_ACPI_FILTER_SETXFER = 1 << 0, | ||
25 | ATA_ACPI_FILTER_LOCK = 1 << 1, | ||
26 | ATA_ACPI_FILTER_DIPM = 1 << 2, | ||
27 | |||
28 | ATA_ACPI_FILTER_DEFAULT = ATA_ACPI_FILTER_SETXFER | | ||
29 | ATA_ACPI_FILTER_LOCK | | ||
30 | ATA_ACPI_FILTER_DIPM, | ||
31 | }; | ||
32 | |||
33 | static unsigned int ata_acpi_gtf_filter = ATA_ACPI_FILTER_DEFAULT; | ||
34 | module_param_named(acpi_gtf_filter, ata_acpi_gtf_filter, int, 0644); | 24 | module_param_named(acpi_gtf_filter, ata_acpi_gtf_filter, int, 0644); |
35 | MODULE_PARM_DESC(acpi_gtf_filter, "filter mask for ACPI _GTF commands, set to filter out (0x1=set xfermode, 0x2=lock/freeze lock, 0x4=DIPM)"); | 25 | MODULE_PARM_DESC(acpi_gtf_filter, "filter mask for ACPI _GTF commands, set to filter out (0x1=set xfermode, 0x2=lock/freeze lock, 0x4=DIPM, 0x8=FPDMA non-zero offset, 0x10=FPDMA DMA Setup FIS auto-activate)"); |
36 | 26 | ||
37 | #define NO_PORT_MULT 0xffff | 27 | #define NO_PORT_MULT 0xffff |
38 | #define SATA_ADR(root, pmp) (((root) << 16) | (pmp)) | 28 | #define SATA_ADR(root, pmp) (((root) << 16) | (pmp)) |
@@ -613,10 +603,11 @@ static void ata_acpi_gtf_to_tf(struct ata_device *dev, | |||
613 | tf->command = gtf->tf[6]; /* 0x1f7 */ | 603 | tf->command = gtf->tf[6]; /* 0x1f7 */ |
614 | } | 604 | } |
615 | 605 | ||
616 | static int ata_acpi_filter_tf(const struct ata_taskfile *tf, | 606 | static int ata_acpi_filter_tf(struct ata_device *dev, |
607 | const struct ata_taskfile *tf, | ||
617 | const struct ata_taskfile *ptf) | 608 | const struct ata_taskfile *ptf) |
618 | { | 609 | { |
619 | if (ata_acpi_gtf_filter & ATA_ACPI_FILTER_SETXFER) { | 610 | if (dev->gtf_filter & ATA_ACPI_FILTER_SETXFER) { |
620 | /* libata doesn't use ACPI to configure transfer mode. | 611 | /* libata doesn't use ACPI to configure transfer mode. |
621 | * It will only confuse device configuration. Skip. | 612 | * It will only confuse device configuration. Skip. |
622 | */ | 613 | */ |
@@ -625,7 +616,7 @@ static int ata_acpi_filter_tf(const struct ata_taskfile *tf, | |||
625 | return 1; | 616 | return 1; |
626 | } | 617 | } |
627 | 618 | ||
628 | if (ata_acpi_gtf_filter & ATA_ACPI_FILTER_LOCK) { | 619 | if (dev->gtf_filter & ATA_ACPI_FILTER_LOCK) { |
629 | /* BIOS writers, sorry but we don't wanna lock | 620 | /* BIOS writers, sorry but we don't wanna lock |
630 | * features unless the user explicitly said so. | 621 | * features unless the user explicitly said so. |
631 | */ | 622 | */ |
@@ -647,12 +638,23 @@ static int ata_acpi_filter_tf(const struct ata_taskfile *tf, | |||
647 | return 1; | 638 | return 1; |
648 | } | 639 | } |
649 | 640 | ||
650 | if (ata_acpi_gtf_filter & ATA_ACPI_FILTER_DIPM) { | 641 | if (tf->command == ATA_CMD_SET_FEATURES && |
642 | tf->feature == SETFEATURES_SATA_ENABLE) { | ||
651 | /* inhibit enabling DIPM */ | 643 | /* inhibit enabling DIPM */ |
652 | if (tf->command == ATA_CMD_SET_FEATURES && | 644 | if (dev->gtf_filter & ATA_ACPI_FILTER_DIPM && |
653 | tf->feature == SETFEATURES_SATA_ENABLE && | ||
654 | tf->nsect == SATA_DIPM) | 645 | tf->nsect == SATA_DIPM) |
655 | return 1; | 646 | return 1; |
647 | |||
648 | /* inhibit FPDMA non-zero offset */ | ||
649 | if (dev->gtf_filter & ATA_ACPI_FILTER_FPDMA_OFFSET && | ||
650 | (tf->nsect == SATA_FPDMA_OFFSET || | ||
651 | tf->nsect == SATA_FPDMA_IN_ORDER)) | ||
652 | return 1; | ||
653 | |||
654 | /* inhibit FPDMA auto activation */ | ||
655 | if (dev->gtf_filter & ATA_ACPI_FILTER_FPDMA_AA && | ||
656 | tf->nsect == SATA_FPDMA_AA) | ||
657 | return 1; | ||
656 | } | 658 | } |
657 | 659 | ||
658 | return 0; | 660 | return 0; |
@@ -704,7 +706,7 @@ static int ata_acpi_run_tf(struct ata_device *dev, | |||
704 | pptf = &ptf; | 706 | pptf = &ptf; |
705 | } | 707 | } |
706 | 708 | ||
707 | if (!ata_acpi_filter_tf(&tf, pptf)) { | 709 | if (!ata_acpi_filter_tf(dev, &tf, pptf)) { |
708 | rtf = tf; | 710 | rtf = tf; |
709 | err_mask = ata_exec_internal(dev, &rtf, NULL, | 711 | err_mask = ata_exec_internal(dev, &rtf, NULL, |
710 | DMA_NONE, NULL, 0, 0); | 712 | DMA_NONE, NULL, 0, 0); |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 0ddaf43d68c6..d7f0f1b1ae3e 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -5028,12 +5028,14 @@ void ata_qc_complete(struct ata_queued_cmd *qc) | |||
5028 | qc->flags |= ATA_QCFLAG_FAILED; | 5028 | qc->flags |= ATA_QCFLAG_FAILED; |
5029 | 5029 | ||
5030 | if (unlikely(qc->flags & ATA_QCFLAG_FAILED)) { | 5030 | if (unlikely(qc->flags & ATA_QCFLAG_FAILED)) { |
5031 | if (!ata_tag_internal(qc->tag)) { | 5031 | /* always fill result TF for failed qc */ |
5032 | /* always fill result TF for failed qc */ | 5032 | fill_result_tf(qc); |
5033 | fill_result_tf(qc); | 5033 | |
5034 | if (!ata_tag_internal(qc->tag)) | ||
5034 | ata_qc_schedule_eh(qc); | 5035 | ata_qc_schedule_eh(qc); |
5035 | return; | 5036 | else |
5036 | } | 5037 | __ata_qc_complete(qc); |
5038 | return; | ||
5037 | } | 5039 | } |
5038 | 5040 | ||
5039 | WARN_ON_ONCE(ap->pflags & ATA_PFLAG_FROZEN); | 5041 | WARN_ON_ONCE(ap->pflags & ATA_PFLAG_FROZEN); |
@@ -5591,6 +5593,9 @@ void ata_link_init(struct ata_port *ap, struct ata_link *link, int pmp) | |||
5591 | 5593 | ||
5592 | dev->link = link; | 5594 | dev->link = link; |
5593 | dev->devno = dev - link->device; | 5595 | dev->devno = dev - link->device; |
5596 | #ifdef CONFIG_ATA_ACPI | ||
5597 | dev->gtf_filter = ata_acpi_gtf_filter; | ||
5598 | #endif | ||
5594 | ata_dev_init(dev); | 5599 | ata_dev_init(dev); |
5595 | } | 5600 | } |
5596 | } | 5601 | } |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index a04488f0de88..bba2ae5df1c2 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -2667,14 +2667,14 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2667 | dev->pio_mode = XFER_PIO_0; | 2667 | dev->pio_mode = XFER_PIO_0; |
2668 | dev->flags &= ~ATA_DFLAG_SLEEPING; | 2668 | dev->flags &= ~ATA_DFLAG_SLEEPING; |
2669 | 2669 | ||
2670 | if (!ata_phys_link_offline(ata_dev_phys_link(dev))) { | 2670 | if (ata_phys_link_offline(ata_dev_phys_link(dev))) |
2671 | /* apply class override */ | 2671 | continue; |
2672 | if (lflags & ATA_LFLAG_ASSUME_ATA) | 2672 | |
2673 | classes[dev->devno] = ATA_DEV_ATA; | 2673 | /* apply class override */ |
2674 | else if (lflags & ATA_LFLAG_ASSUME_SEMB) | 2674 | if (lflags & ATA_LFLAG_ASSUME_ATA) |
2675 | classes[dev->devno] = ATA_DEV_SEMB_UNSUP; | 2675 | classes[dev->devno] = ATA_DEV_ATA; |
2676 | } else | 2676 | else if (lflags & ATA_LFLAG_ASSUME_SEMB) |
2677 | classes[dev->devno] = ATA_DEV_NONE; | 2677 | classes[dev->devno] = ATA_DEV_SEMB_UNSUP; |
2678 | } | 2678 | } |
2679 | 2679 | ||
2680 | /* record current link speed */ | 2680 | /* record current link speed */ |
@@ -2713,34 +2713,48 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2713 | ap->pflags &= ~ATA_PFLAG_EH_PENDING; | 2713 | ap->pflags &= ~ATA_PFLAG_EH_PENDING; |
2714 | spin_unlock_irqrestore(link->ap->lock, flags); | 2714 | spin_unlock_irqrestore(link->ap->lock, flags); |
2715 | 2715 | ||
2716 | /* Make sure onlineness and classification result correspond. | 2716 | /* |
2717 | * Make sure onlineness and classification result correspond. | ||
2717 | * Hotplug could have happened during reset and some | 2718 | * Hotplug could have happened during reset and some |
2718 | * controllers fail to wait while a drive is spinning up after | 2719 | * controllers fail to wait while a drive is spinning up after |
2719 | * being hotplugged causing misdetection. By cross checking | 2720 | * being hotplugged causing misdetection. By cross checking |
2720 | * link onlineness and classification result, those conditions | 2721 | * link on/offlineness and classification result, those |
2721 | * can be reliably detected and retried. | 2722 | * conditions can be reliably detected and retried. |
2722 | */ | 2723 | */ |
2723 | nr_unknown = 0; | 2724 | nr_unknown = 0; |
2724 | ata_for_each_dev(dev, link, ALL) { | 2725 | ata_for_each_dev(dev, link, ALL) { |
2725 | /* convert all ATA_DEV_UNKNOWN to ATA_DEV_NONE */ | 2726 | if (ata_phys_link_online(ata_dev_phys_link(dev))) { |
2726 | if (classes[dev->devno] == ATA_DEV_UNKNOWN) { | 2727 | if (classes[dev->devno] == ATA_DEV_UNKNOWN) { |
2727 | classes[dev->devno] = ATA_DEV_NONE; | 2728 | ata_dev_printk(dev, KERN_DEBUG, "link online " |
2728 | if (ata_phys_link_online(ata_dev_phys_link(dev))) | 2729 | "but device misclassifed\n"); |
2730 | classes[dev->devno] = ATA_DEV_NONE; | ||
2729 | nr_unknown++; | 2731 | nr_unknown++; |
2732 | } | ||
2733 | } else if (ata_phys_link_offline(ata_dev_phys_link(dev))) { | ||
2734 | if (ata_class_enabled(classes[dev->devno])) | ||
2735 | ata_dev_printk(dev, KERN_DEBUG, "link offline, " | ||
2736 | "clearing class %d to NONE\n", | ||
2737 | classes[dev->devno]); | ||
2738 | classes[dev->devno] = ATA_DEV_NONE; | ||
2739 | } else if (classes[dev->devno] == ATA_DEV_UNKNOWN) { | ||
2740 | ata_dev_printk(dev, KERN_DEBUG, "link status unknown, " | ||
2741 | "clearing UNKNOWN to NONE\n"); | ||
2742 | classes[dev->devno] = ATA_DEV_NONE; | ||
2730 | } | 2743 | } |
2731 | } | 2744 | } |
2732 | 2745 | ||
2733 | if (classify && nr_unknown) { | 2746 | if (classify && nr_unknown) { |
2734 | if (try < max_tries) { | 2747 | if (try < max_tries) { |
2735 | ata_link_printk(link, KERN_WARNING, "link online but " | 2748 | ata_link_printk(link, KERN_WARNING, "link online but " |
2736 | "device misclassified, retrying\n"); | 2749 | "%d devices misclassified, retrying\n", |
2750 | nr_unknown); | ||
2737 | failed_link = link; | 2751 | failed_link = link; |
2738 | rc = -EAGAIN; | 2752 | rc = -EAGAIN; |
2739 | goto fail; | 2753 | goto fail; |
2740 | } | 2754 | } |
2741 | ata_link_printk(link, KERN_WARNING, | 2755 | ata_link_printk(link, KERN_WARNING, |
2742 | "link online but device misclassified, " | 2756 | "link online but %d devices misclassified, " |
2743 | "device detection might fail\n"); | 2757 | "device detection might fail\n", nr_unknown); |
2744 | } | 2758 | } |
2745 | 2759 | ||
2746 | /* reset successful, schedule revalidation */ | 2760 | /* reset successful, schedule revalidation */ |
@@ -2967,12 +2981,14 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link, | |||
2967 | * device detection messages backwards. | 2981 | * device detection messages backwards. |
2968 | */ | 2982 | */ |
2969 | ata_for_each_dev(dev, link, ALL) { | 2983 | ata_for_each_dev(dev, link, ALL) { |
2970 | if (!(new_mask & (1 << dev->devno)) || | 2984 | if (!(new_mask & (1 << dev->devno))) |
2971 | dev->class == ATA_DEV_PMP) | ||
2972 | continue; | 2985 | continue; |
2973 | 2986 | ||
2974 | dev->class = ehc->classes[dev->devno]; | 2987 | dev->class = ehc->classes[dev->devno]; |
2975 | 2988 | ||
2989 | if (dev->class == ATA_DEV_PMP) | ||
2990 | continue; | ||
2991 | |||
2976 | ehc->i.flags |= ATA_EHI_PRINTINFO; | 2992 | ehc->i.flags |= ATA_EHI_PRINTINFO; |
2977 | rc = ata_dev_configure(dev); | 2993 | rc = ata_dev_configure(dev); |
2978 | ehc->i.flags &= ~ATA_EHI_PRINTINFO; | 2994 | ehc->i.flags &= ~ATA_EHI_PRINTINFO; |
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index be8e2628f82c..823e63096362 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h | |||
@@ -118,6 +118,8 @@ extern void ata_lpm_schedule(struct ata_port *ap, enum link_pm); | |||
118 | 118 | ||
119 | /* libata-acpi.c */ | 119 | /* libata-acpi.c */ |
120 | #ifdef CONFIG_ATA_ACPI | 120 | #ifdef CONFIG_ATA_ACPI |
121 | extern unsigned int ata_acpi_gtf_filter; | ||
122 | |||
121 | extern void ata_acpi_associate_sata_port(struct ata_port *ap); | 123 | extern void ata_acpi_associate_sata_port(struct ata_port *ap); |
122 | extern void ata_acpi_associate(struct ata_host *host); | 124 | extern void ata_acpi_associate(struct ata_host *host); |
123 | extern void ata_acpi_dissociate(struct ata_host *host); | 125 | extern void ata_acpi_dissociate(struct ata_host *host); |
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c index fc9c5d6d7d80..1432dc9d0ab8 100644 --- a/drivers/ata/pata_ali.c +++ b/drivers/ata/pata_ali.c | |||
@@ -290,7 +290,7 @@ static void ali_warn_atapi_dma(struct ata_device *adev) | |||
290 | 290 | ||
291 | if (print_info && adev->class == ATA_DEV_ATAPI && !ali_atapi_dma) { | 291 | if (print_info && adev->class == ATA_DEV_ATAPI && !ali_atapi_dma) { |
292 | ata_dev_printk(adev, KERN_WARNING, | 292 | ata_dev_printk(adev, KERN_WARNING, |
293 | "WARNING: ATAPI DMA disabled for reliablity issues. It can be enabled\n"); | 293 | "WARNING: ATAPI DMA disabled for reliability issues. It can be enabled\n"); |
294 | ata_dev_printk(adev, KERN_WARNING, | 294 | ata_dev_printk(adev, KERN_WARNING, |
295 | "WARNING: via pata_ali.atapi_dma modparam or corresponding sysfs node.\n"); | 295 | "WARNING: via pata_ali.atapi_dma modparam or corresponding sysfs node.\n"); |
296 | } | 296 | } |
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c index aa4b3f6ae771..ae4454d4e955 100644 --- a/drivers/ata/pata_atiixp.c +++ b/drivers/ata/pata_atiixp.c | |||
@@ -246,7 +246,7 @@ static const struct pci_device_id atiixp[] = { | |||
246 | { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP400_IDE), }, | 246 | { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP400_IDE), }, |
247 | { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP600_IDE), }, | 247 | { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP600_IDE), }, |
248 | { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP700_IDE), }, | 248 | { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP700_IDE), }, |
249 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_SB900_IDE), }, | 249 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_HUDSON2_IDE), }, |
250 | 250 | ||
251 | { }, | 251 | { }, |
252 | }; | 252 | }; |
diff --git a/drivers/ata/pata_atp867x.c b/drivers/ata/pata_atp867x.c index 7990de925d2e..6fe7ded40c6a 100644 --- a/drivers/ata/pata_atp867x.c +++ b/drivers/ata/pata_atp867x.c | |||
@@ -118,20 +118,13 @@ struct atp867x_priv { | |||
118 | int pci66mhz; | 118 | int pci66mhz; |
119 | }; | 119 | }; |
120 | 120 | ||
121 | static inline u8 atp867x_speed_to_mode(u8 speed) | ||
122 | { | ||
123 | return speed - XFER_UDMA_0 + 1; | ||
124 | } | ||
125 | |||
126 | static void atp867x_set_dmamode(struct ata_port *ap, struct ata_device *adev) | 121 | static void atp867x_set_dmamode(struct ata_port *ap, struct ata_device *adev) |
127 | { | 122 | { |
128 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 123 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
129 | struct atp867x_priv *dp = ap->private_data; | 124 | struct atp867x_priv *dp = ap->private_data; |
130 | u8 speed = adev->dma_mode; | 125 | u8 speed = adev->dma_mode; |
131 | u8 b; | 126 | u8 b; |
132 | u8 mode; | 127 | u8 mode = speed - XFER_UDMA_0 + 1; |
133 | |||
134 | mode = atp867x_speed_to_mode(speed); | ||
135 | 128 | ||
136 | /* | 129 | /* |
137 | * Doc 6.6.9: decrease the udma mode value by 1 for safer UDMA speed | 130 | * Doc 6.6.9: decrease the udma mode value by 1 for safer UDMA speed |
@@ -156,25 +149,38 @@ static void atp867x_set_dmamode(struct ata_port *ap, struct ata_device *adev) | |||
156 | iowrite8(b, dp->dma_mode); | 149 | iowrite8(b, dp->dma_mode); |
157 | } | 150 | } |
158 | 151 | ||
159 | static int atp867x_get_active_clocks_shifted(unsigned int clk) | 152 | static int atp867x_get_active_clocks_shifted(struct ata_port *ap, |
153 | unsigned int clk) | ||
160 | { | 154 | { |
155 | struct atp867x_priv *dp = ap->private_data; | ||
161 | unsigned char clocks = clk; | 156 | unsigned char clocks = clk; |
162 | 157 | ||
158 | /* | ||
159 | * Doc 6.6.9: increase the clock value by 1 for safer PIO speed | ||
160 | * on 66MHz bus | ||
161 | */ | ||
162 | if (dp->pci66mhz) | ||
163 | clocks++; | ||
164 | |||
163 | switch (clocks) { | 165 | switch (clocks) { |
164 | case 0: | 166 | case 0: |
165 | clocks = 1; | 167 | clocks = 1; |
166 | break; | 168 | break; |
167 | case 1 ... 7: | 169 | case 1 ... 6: |
168 | break; | ||
169 | case 8 ... 12: | ||
170 | clocks = 7; | ||
171 | break; | 170 | break; |
172 | default: | 171 | default: |
173 | printk(KERN_WARNING "ATP867X: active %dclk is invalid. " | 172 | printk(KERN_WARNING "ATP867X: active %dclk is invalid. " |
174 | "Using default 8clk.\n", clk); | 173 | "Using 12clk.\n", clk); |
175 | clocks = 0; /* 8 clk */ | 174 | case 9 ... 12: |
175 | clocks = 7; /* 12 clk */ | ||
176 | break; | 176 | break; |
177 | case 7: | ||
178 | case 8: /* default 8 clk */ | ||
179 | clocks = 0; | ||
180 | goto active_clock_shift_done; | ||
177 | } | 181 | } |
182 | |||
183 | active_clock_shift_done: | ||
178 | return clocks << ATP867X_IO_PIOSPD_ACTIVE_SHIFT; | 184 | return clocks << ATP867X_IO_PIOSPD_ACTIVE_SHIFT; |
179 | } | 185 | } |
180 | 186 | ||
@@ -188,20 +194,20 @@ static int atp867x_get_recover_clocks_shifted(unsigned int clk) | |||
188 | break; | 194 | break; |
189 | case 1 ... 11: | 195 | case 1 ... 11: |
190 | break; | 196 | break; |
191 | case 12: | 197 | case 13: |
192 | clocks = 0; | 198 | case 14: |
193 | break; | 199 | --clocks; /* by the spec */ |
194 | case 13: case 14: | ||
195 | --clocks; | ||
196 | break; | 200 | break; |
197 | case 15: | 201 | case 15: |
198 | break; | 202 | break; |
199 | default: | 203 | default: |
200 | printk(KERN_WARNING "ATP867X: recover %dclk is invalid. " | 204 | printk(KERN_WARNING "ATP867X: recover %dclk is invalid. " |
201 | "Using default 15clk.\n", clk); | 205 | "Using default 12clk.\n", clk); |
202 | clocks = 0; /* 12 clk */ | 206 | case 12: /* default 12 clk */ |
207 | clocks = 0; | ||
203 | break; | 208 | break; |
204 | } | 209 | } |
210 | |||
205 | return clocks << ATP867X_IO_PIOSPD_RECOVER_SHIFT; | 211 | return clocks << ATP867X_IO_PIOSPD_RECOVER_SHIFT; |
206 | } | 212 | } |
207 | 213 | ||
@@ -230,25 +236,38 @@ static void atp867x_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
230 | b = (b & ~ATP867X_IO_DMAMODE_MSTR_MASK); | 236 | b = (b & ~ATP867X_IO_DMAMODE_MSTR_MASK); |
231 | iowrite8(b, dp->dma_mode); | 237 | iowrite8(b, dp->dma_mode); |
232 | 238 | ||
233 | b = atp867x_get_active_clocks_shifted(t.active) | | 239 | b = atp867x_get_active_clocks_shifted(ap, t.active) | |
234 | atp867x_get_recover_clocks_shifted(t.recover); | 240 | atp867x_get_recover_clocks_shifted(t.recover); |
235 | if (dp->pci66mhz) | ||
236 | b += 0x10; | ||
237 | 241 | ||
238 | if (adev->devno & 1) | 242 | if (adev->devno & 1) |
239 | iowrite8(b, dp->slave_piospd); | 243 | iowrite8(b, dp->slave_piospd); |
240 | else | 244 | else |
241 | iowrite8(b, dp->mstr_piospd); | 245 | iowrite8(b, dp->mstr_piospd); |
242 | 246 | ||
243 | /* | 247 | b = atp867x_get_active_clocks_shifted(ap, t.act8b) | |
244 | * use the same value for comand timing as for PIO timimg | 248 | atp867x_get_recover_clocks_shifted(t.rec8b); |
245 | */ | 249 | |
246 | iowrite8(b, dp->eightb_piospd); | 250 | iowrite8(b, dp->eightb_piospd); |
247 | } | 251 | } |
248 | 252 | ||
253 | static int atp867x_cable_override(struct pci_dev *pdev) | ||
254 | { | ||
255 | if (pdev->subsystem_vendor == PCI_VENDOR_ID_ARTOP && | ||
256 | (pdev->subsystem_device == PCI_DEVICE_ID_ARTOP_ATP867A || | ||
257 | pdev->subsystem_device == PCI_DEVICE_ID_ARTOP_ATP867B)) { | ||
258 | return 1; | ||
259 | } | ||
260 | return 0; | ||
261 | } | ||
262 | |||
249 | static int atp867x_cable_detect(struct ata_port *ap) | 263 | static int atp867x_cable_detect(struct ata_port *ap) |
250 | { | 264 | { |
251 | return ATA_CBL_PATA40_SHORT; | 265 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
266 | |||
267 | if (atp867x_cable_override(pdev)) | ||
268 | return ATA_CBL_PATA40_SHORT; | ||
269 | |||
270 | return ATA_CBL_PATA_UNK; | ||
252 | } | 271 | } |
253 | 272 | ||
254 | static struct scsi_host_template atp867x_sht = { | 273 | static struct scsi_host_template atp867x_sht = { |
@@ -471,7 +490,6 @@ static int atp867x_init_one(struct pci_dev *pdev, | |||
471 | static const struct ata_port_info info_867x = { | 490 | static const struct ata_port_info info_867x = { |
472 | .flags = ATA_FLAG_SLAVE_POSS, | 491 | .flags = ATA_FLAG_SLAVE_POSS, |
473 | .pio_mask = ATA_PIO4, | 492 | .pio_mask = ATA_PIO4, |
474 | .mwdma_mask = ATA_MWDMA2, | ||
475 | .udma_mask = ATA_UDMA6, | 493 | .udma_mask = ATA_UDMA6, |
476 | .port_ops = &atp867x_ops, | 494 | .port_ops = &atp867x_ops, |
477 | }; | 495 | }; |
@@ -515,6 +533,23 @@ err_out: | |||
515 | return rc; | 533 | return rc; |
516 | } | 534 | } |
517 | 535 | ||
536 | #ifdef CONFIG_PM | ||
537 | static int atp867x_reinit_one(struct pci_dev *pdev) | ||
538 | { | ||
539 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | ||
540 | int rc; | ||
541 | |||
542 | rc = ata_pci_device_do_resume(pdev); | ||
543 | if (rc) | ||
544 | return rc; | ||
545 | |||
546 | atp867x_fixup(host); | ||
547 | |||
548 | ata_host_resume(host); | ||
549 | return 0; | ||
550 | } | ||
551 | #endif | ||
552 | |||
518 | static struct pci_device_id atp867x_pci_tbl[] = { | 553 | static struct pci_device_id atp867x_pci_tbl[] = { |
519 | { PCI_VDEVICE(ARTOP, PCI_DEVICE_ID_ARTOP_ATP867A), 0 }, | 554 | { PCI_VDEVICE(ARTOP, PCI_DEVICE_ID_ARTOP_ATP867A), 0 }, |
520 | { PCI_VDEVICE(ARTOP, PCI_DEVICE_ID_ARTOP_ATP867B), 0 }, | 555 | { PCI_VDEVICE(ARTOP, PCI_DEVICE_ID_ARTOP_ATP867B), 0 }, |
@@ -526,6 +561,10 @@ static struct pci_driver atp867x_driver = { | |||
526 | .id_table = atp867x_pci_tbl, | 561 | .id_table = atp867x_pci_tbl, |
527 | .probe = atp867x_init_one, | 562 | .probe = atp867x_init_one, |
528 | .remove = ata_pci_remove_one, | 563 | .remove = ata_pci_remove_one, |
564 | #ifdef CONFIG_PM | ||
565 | .suspend = ata_pci_device_suspend, | ||
566 | .resume = atp867x_reinit_one, | ||
567 | #endif | ||
529 | }; | 568 | }; |
530 | 569 | ||
531 | static int __init atp867x_init(void) | 570 | static int __init atp867x_init(void) |
diff --git a/drivers/ata/pata_sc1200.c b/drivers/ata/pata_sc1200.c index f49814d6fd2e..3bbed8322ecf 100644 --- a/drivers/ata/pata_sc1200.c +++ b/drivers/ata/pata_sc1200.c | |||
@@ -235,8 +235,7 @@ static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
235 | .udma_mask = ATA_UDMA2, | 235 | .udma_mask = ATA_UDMA2, |
236 | .port_ops = &sc1200_port_ops | 236 | .port_ops = &sc1200_port_ops |
237 | }; | 237 | }; |
238 | /* Can't enable port 2 yet, see top comments */ | 238 | const struct ata_port_info *ppi[] = { &info, NULL }; |
239 | const struct ata_port_info *ppi[] = { &info, }; | ||
240 | 239 | ||
241 | return ata_pci_sff_init_one(dev, ppi, &sc1200_sht, NULL); | 240 | return ata_pci_sff_init_one(dev, ppi, &sc1200_sht, NULL); |
242 | } | 241 | } |
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c index 45657cacec43..88984b803d6d 100644 --- a/drivers/ata/pata_via.c +++ b/drivers/ata/pata_via.c | |||
@@ -111,7 +111,7 @@ static const struct via_isa_bridge { | |||
111 | { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 111 | { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, |
112 | { "cx700", PCI_DEVICE_ID_VIA_CX700, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_SATA_PATA }, | 112 | { "cx700", PCI_DEVICE_ID_VIA_CX700, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_SATA_PATA }, |
113 | { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES }, | 113 | { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES }, |
114 | { "vt6415", PCI_DEVICE_ID_VIA_6415, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES }, | 114 | { "vt6415", PCI_DEVICE_ID_VIA_6415, 0x00, 0xff, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES }, |
115 | { "vt8237a", PCI_DEVICE_ID_VIA_8237A, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 115 | { "vt8237a", PCI_DEVICE_ID_VIA_8237A, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, |
116 | { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 116 | { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, |
117 | { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 117 | { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, |
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index 17f9ff9067a2..6f5093b7c8c5 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -1382,6 +1382,25 @@ static int mv_qc_defer(struct ata_queued_cmd *qc) | |||
1382 | */ | 1382 | */ |
1383 | if (pp->pp_flags & MV_PP_FLAG_DELAYED_EH) | 1383 | if (pp->pp_flags & MV_PP_FLAG_DELAYED_EH) |
1384 | return ATA_DEFER_PORT; | 1384 | return ATA_DEFER_PORT; |
1385 | |||
1386 | /* PIO commands need exclusive link: no other commands [DMA or PIO] | ||
1387 | * can run concurrently. | ||
1388 | * set excl_link when we want to send a PIO command in DMA mode | ||
1389 | * or a non-NCQ command in NCQ mode. | ||
1390 | * When we receive a command from that link, and there are no | ||
1391 | * outstanding commands, mark a flag to clear excl_link and let | ||
1392 | * the command go through. | ||
1393 | */ | ||
1394 | if (unlikely(ap->excl_link)) { | ||
1395 | if (link == ap->excl_link) { | ||
1396 | if (ap->nr_active_links) | ||
1397 | return ATA_DEFER_PORT; | ||
1398 | qc->flags |= ATA_QCFLAG_CLEAR_EXCL; | ||
1399 | return 0; | ||
1400 | } else | ||
1401 | return ATA_DEFER_PORT; | ||
1402 | } | ||
1403 | |||
1385 | /* | 1404 | /* |
1386 | * If the port is completely idle, then allow the new qc. | 1405 | * If the port is completely idle, then allow the new qc. |
1387 | */ | 1406 | */ |
@@ -1395,8 +1414,14 @@ static int mv_qc_defer(struct ata_queued_cmd *qc) | |||
1395 | * doesn't allow it. | 1414 | * doesn't allow it. |
1396 | */ | 1415 | */ |
1397 | if ((pp->pp_flags & MV_PP_FLAG_EDMA_EN) && | 1416 | if ((pp->pp_flags & MV_PP_FLAG_EDMA_EN) && |
1398 | (pp->pp_flags & MV_PP_FLAG_NCQ_EN) && ata_is_ncq(qc->tf.protocol)) | 1417 | (pp->pp_flags & MV_PP_FLAG_NCQ_EN)) { |
1399 | return 0; | 1418 | if (ata_is_ncq(qc->tf.protocol)) |
1419 | return 0; | ||
1420 | else { | ||
1421 | ap->excl_link = link; | ||
1422 | return ATA_DEFER_PORT; | ||
1423 | } | ||
1424 | } | ||
1400 | 1425 | ||
1401 | return ATA_DEFER_PORT; | 1426 | return ATA_DEFER_PORT; |
1402 | } | 1427 | } |
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index 86a40582999c..1eb4e020eb5c 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
@@ -1594,9 +1594,21 @@ static int nv_hardreset(struct ata_link *link, unsigned int *class, | |||
1594 | !ata_dev_enabled(link->device)) | 1594 | !ata_dev_enabled(link->device)) |
1595 | sata_link_hardreset(link, sata_deb_timing_hotplug, deadline, | 1595 | sata_link_hardreset(link, sata_deb_timing_hotplug, deadline, |
1596 | NULL, NULL); | 1596 | NULL, NULL); |
1597 | else if (!(ehc->i.flags & ATA_EHI_QUIET)) | 1597 | else { |
1598 | ata_link_printk(link, KERN_INFO, | 1598 | const unsigned long *timing = sata_ehc_deb_timing(ehc); |
1599 | "nv: skipping hardreset on occupied port\n"); | 1599 | int rc; |
1600 | |||
1601 | if (!(ehc->i.flags & ATA_EHI_QUIET)) | ||
1602 | ata_link_printk(link, KERN_INFO, "nv: skipping " | ||
1603 | "hardreset on occupied port\n"); | ||
1604 | |||
1605 | /* make sure the link is online */ | ||
1606 | rc = sata_link_resume(link, timing, deadline); | ||
1607 | /* whine about phy resume failure but proceed */ | ||
1608 | if (rc && rc != -EOPNOTSUPP) | ||
1609 | ata_link_printk(link, KERN_WARNING, "failed to resume " | ||
1610 | "link (errno=%d)\n", rc); | ||
1611 | } | ||
1600 | 1612 | ||
1601 | /* device signature acquisition is unreliable */ | 1613 | /* device signature acquisition is unreliable */ |
1602 | return -EAGAIN; | 1614 | return -EAGAIN; |