Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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:
pata_atp867x: add Power Management support
pata_atp867x: PIO support fixes
pata_atp867x: clarifications in timings calculations and cable detection
pata_atp867x: fix it to not claim MWDMA support
libata: fix incorrect link online check during probe
ahci: filter FPDMA non-zero offset enable for Aspire 3810T
libata: make gtf_filter per-dev
libata: implement more acpi filtering options
libata: cosmetic updates
ahci: display all AHCI 1.3 HBA capability flags (v2)
pata_ali: trivial fix of a very frequent spelling mistake
ahci: disable 64bit DMA by default on SB600s

+280 -132
+133 -60
drivers/ata/ahci.c
··· 122 122 HOST_VERSION = 0x10, /* AHCI spec. version compliancy */ 123 123 HOST_EM_LOC = 0x1c, /* Enclosure Management location */ 124 124 HOST_EM_CTL = 0x20, /* Enclosure Management Control */ 125 + HOST_CAP2 = 0x24, /* host capabilities, extended */ 125 126 126 127 /* HOST_CTL bits */ 127 128 HOST_RESET = (1 << 0), /* reset controller; self-clear */ ··· 130 129 HOST_AHCI_EN = (1 << 31), /* AHCI enabled */ 131 130 132 131 /* HOST_CAP bits */ 132 + HOST_CAP_SXS = (1 << 5), /* Supports External SATA */ 133 133 HOST_CAP_EMS = (1 << 6), /* Enclosure Management support */ 134 - HOST_CAP_SSC = (1 << 14), /* Slumber capable */ 134 + HOST_CAP_CCC = (1 << 7), /* Command Completion Coalescing */ 135 + HOST_CAP_PART = (1 << 13), /* Partial state capable */ 136 + HOST_CAP_SSC = (1 << 14), /* Slumber state capable */ 137 + HOST_CAP_PIO_MULTI = (1 << 15), /* PIO multiple DRQ support */ 138 + HOST_CAP_FBS = (1 << 16), /* FIS-based switching support */ 135 139 HOST_CAP_PMP = (1 << 17), /* Port Multiplier support */ 140 + HOST_CAP_ONLY = (1 << 18), /* Supports AHCI mode only */ 136 141 HOST_CAP_CLO = (1 << 24), /* Command List Override support */ 142 + HOST_CAP_LED = (1 << 25), /* Supports activity LED */ 137 143 HOST_CAP_ALPM = (1 << 26), /* Aggressive Link PM support */ 138 144 HOST_CAP_SSS = (1 << 27), /* Staggered Spin-up */ 145 + HOST_CAP_MPS = (1 << 28), /* Mechanical presence switch */ 139 146 HOST_CAP_SNTF = (1 << 29), /* SNotification register */ 140 147 HOST_CAP_NCQ = (1 << 30), /* Native Command Queueing */ 141 148 HOST_CAP_64 = (1 << 31), /* PCI DAC (64-bit DMA) support */ 149 + 150 + /* HOST_CAP2 bits */ 151 + HOST_CAP2_BOH = (1 << 0), /* BIOS/OS handoff supported */ 152 + HOST_CAP2_NVMHCI = (1 << 1), /* NVMHCI supported */ 153 + HOST_CAP2_APST = (1 << 2), /* Automatic partial to slumber */ 142 154 143 155 /* registers for each SATA port */ 144 156 PORT_LST_ADDR = 0x00, /* command list DMA addr */ ··· 281 267 struct ahci_host_priv { 282 268 unsigned int flags; /* AHCI_HFLAG_* */ 283 269 u32 cap; /* cap to use */ 270 + u32 cap2; /* cap2 to use */ 284 271 u32 port_map; /* port map to use */ 285 272 u32 saved_cap; /* saved initial cap */ 273 + u32 saved_cap2; /* saved initial cap2 */ 286 274 u32 saved_port_map; /* saved initial port_map */ 287 275 u32 em_loc; /* enclosure management location */ 288 276 }; ··· 347 331 348 332 static ssize_t ahci_show_host_caps(struct device *dev, 349 333 struct device_attribute *attr, char *buf); 334 + static ssize_t ahci_show_host_cap2(struct device *dev, 335 + struct device_attribute *attr, char *buf); 350 336 static ssize_t ahci_show_host_version(struct device *dev, 351 337 struct device_attribute *attr, char *buf); 352 338 static ssize_t ahci_show_port_cmd(struct device *dev, 353 339 struct device_attribute *attr, char *buf); 354 340 355 341 DEVICE_ATTR(ahci_host_caps, S_IRUGO, ahci_show_host_caps, NULL); 342 + DEVICE_ATTR(ahci_host_cap2, S_IRUGO, ahci_show_host_cap2, NULL); 356 343 DEVICE_ATTR(ahci_host_version, S_IRUGO, ahci_show_host_version, NULL); 357 344 DEVICE_ATTR(ahci_port_cmd, S_IRUGO, ahci_show_port_cmd, NULL); 358 345 ··· 364 345 &dev_attr_em_message_type, 365 346 &dev_attr_em_message, 366 347 &dev_attr_ahci_host_caps, 348 + &dev_attr_ahci_host_cap2, 367 349 &dev_attr_ahci_host_version, 368 350 &dev_attr_ahci_port_cmd, 369 351 NULL ··· 467 447 [board_ahci_sb600] = 468 448 { 469 449 AHCI_HFLAGS (AHCI_HFLAG_IGN_SERR_INTERNAL | 470 - AHCI_HFLAG_NO_MSI | AHCI_HFLAG_SECT255), 450 + AHCI_HFLAG_NO_MSI | AHCI_HFLAG_SECT255 | 451 + AHCI_HFLAG_32BIT_ONLY), 471 452 .flags = AHCI_FLAG_COMMON, 472 453 .pio_mask = ATA_PIO4, 473 454 .udma_mask = ATA_UDMA6, ··· 753 732 return sprintf(buf, "%x\n", hpriv->cap); 754 733 } 755 734 735 + static ssize_t ahci_show_host_cap2(struct device *dev, 736 + struct device_attribute *attr, char *buf) 737 + { 738 + struct Scsi_Host *shost = class_to_shost(dev); 739 + struct ata_port *ap = ata_shost_to_port(shost); 740 + struct ahci_host_priv *hpriv = ap->host->private_data; 741 + 742 + return sprintf(buf, "%x\n", hpriv->cap2); 743 + } 744 + 756 745 static ssize_t ahci_show_host_version(struct device *dev, 757 746 struct device_attribute *attr, char *buf) 758 747 { ··· 802 771 struct ahci_host_priv *hpriv) 803 772 { 804 773 void __iomem *mmio = pcim_iomap_table(pdev)[AHCI_PCI_BAR]; 805 - u32 cap, port_map; 774 + u32 cap, cap2, vers, port_map; 806 775 int i; 807 776 int mv; 808 777 ··· 814 783 */ 815 784 hpriv->saved_cap = cap = readl(mmio + HOST_CAP); 816 785 hpriv->saved_port_map = port_map = readl(mmio + HOST_PORTS_IMPL); 786 + 787 + /* CAP2 register is only defined for AHCI 1.2 and later */ 788 + vers = readl(mmio + HOST_VERSION); 789 + if ((vers >> 16) > 1 || 790 + ((vers >> 16) == 1 && (vers & 0xFFFF) >= 0x200)) 791 + hpriv->saved_cap2 = cap2 = readl(mmio + HOST_CAP2); 792 + else 793 + hpriv->saved_cap2 = cap2 = 0; 817 794 818 795 /* some chips have errata preventing 64bit use */ 819 796 if ((cap & HOST_CAP_64) && (hpriv->flags & AHCI_HFLAG_32BIT_ONLY)) { ··· 908 869 909 870 /* record values to use during operation */ 910 871 hpriv->cap = cap; 872 + hpriv->cap2 = cap2; 911 873 hpriv->port_map = port_map; 912 874 } 913 875 ··· 927 887 void __iomem *mmio = host->iomap[AHCI_PCI_BAR]; 928 888 929 889 writel(hpriv->saved_cap, mmio + HOST_CAP); 890 + if (hpriv->saved_cap2) 891 + writel(hpriv->saved_cap2, mmio + HOST_CAP2); 930 892 writel(hpriv->saved_port_map, mmio + HOST_PORTS_IMPL); 931 893 (void) readl(mmio + HOST_PORTS_IMPL); /* flush */ 932 894 } ··· 2576 2534 struct ahci_host_priv *hpriv = host->private_data; 2577 2535 struct pci_dev *pdev = to_pci_dev(host->dev); 2578 2536 void __iomem *mmio = host->iomap[AHCI_PCI_BAR]; 2579 - u32 vers, cap, impl, speed; 2537 + u32 vers, cap, cap2, impl, speed; 2580 2538 const char *speed_s; 2581 2539 u16 cc; 2582 2540 const char *scc_s; 2583 2541 2584 2542 vers = readl(mmio + HOST_VERSION); 2585 2543 cap = hpriv->cap; 2544 + cap2 = hpriv->cap2; 2586 2545 impl = hpriv->port_map; 2587 2546 2588 2547 speed = (cap >> 20) & 0xf; ··· 2626 2583 "flags: " 2627 2584 "%s%s%s%s%s%s%s" 2628 2585 "%s%s%s%s%s%s%s" 2629 - "%s\n" 2586 + "%s%s%s%s%s%s\n" 2630 2587 , 2631 2588 2632 - cap & (1 << 31) ? "64bit " : "", 2633 - cap & (1 << 30) ? "ncq " : "", 2634 - cap & (1 << 29) ? "sntf " : "", 2635 - cap & (1 << 28) ? "ilck " : "", 2636 - cap & (1 << 27) ? "stag " : "", 2637 - cap & (1 << 26) ? "pm " : "", 2638 - cap & (1 << 25) ? "led " : "", 2639 - 2640 - cap & (1 << 24) ? "clo " : "", 2641 - cap & (1 << 19) ? "nz " : "", 2642 - cap & (1 << 18) ? "only " : "", 2643 - cap & (1 << 17) ? "pmp " : "", 2644 - cap & (1 << 15) ? "pio " : "", 2645 - cap & (1 << 14) ? "slum " : "", 2646 - cap & (1 << 13) ? "part " : "", 2647 - cap & (1 << 6) ? "ems ": "" 2589 + cap & HOST_CAP_64 ? "64bit " : "", 2590 + cap & HOST_CAP_NCQ ? "ncq " : "", 2591 + cap & HOST_CAP_SNTF ? "sntf " : "", 2592 + cap & HOST_CAP_MPS ? "ilck " : "", 2593 + cap & HOST_CAP_SSS ? "stag " : "", 2594 + cap & HOST_CAP_ALPM ? "pm " : "", 2595 + cap & HOST_CAP_LED ? "led " : "", 2596 + cap & HOST_CAP_CLO ? "clo " : "", 2597 + cap & HOST_CAP_ONLY ? "only " : "", 2598 + cap & HOST_CAP_PMP ? "pmp " : "", 2599 + cap & HOST_CAP_FBS ? "fbs " : "", 2600 + cap & HOST_CAP_PIO_MULTI ? "pio " : "", 2601 + cap & HOST_CAP_SSC ? "slum " : "", 2602 + cap & HOST_CAP_PART ? "part " : "", 2603 + cap & HOST_CAP_CCC ? "ccc " : "", 2604 + cap & HOST_CAP_EMS ? "ems " : "", 2605 + cap & HOST_CAP_SXS ? "sxs " : "", 2606 + cap2 & HOST_CAP2_APST ? "apst " : "", 2607 + cap2 & HOST_CAP2_NVMHCI ? "nvmp " : "", 2608 + cap2 & HOST_CAP2_BOH ? "boh " : "" 2648 2609 ); 2649 2610 } 2650 2611 ··· 2697 2650 } 2698 2651 } 2699 2652 2700 - /* 2701 - * SB600 ahci controller on certain boards can't do 64bit DMA with 2702 - * older BIOS. 2703 - */ 2704 - static bool ahci_sb600_32bit_only(struct pci_dev *pdev) 2653 + /* only some SB600 ahci controllers can do 64bit DMA */ 2654 + static bool ahci_sb600_enable_64bit(struct pci_dev *pdev) 2705 2655 { 2706 2656 static const struct dmi_system_id sysids[] = { 2707 2657 /* 2708 2658 * The oldest version known to be broken is 0901 and 2709 2659 * working is 1501 which was released on 2007-10-26. 2710 - * Force 32bit DMA on anything older than 1501. 2660 + * Enable 64bit DMA on 1501 and anything newer. 2661 + * 2711 2662 * Please read bko#9412 for more info. 2712 2663 */ 2713 2664 { ··· 2717 2672 }, 2718 2673 .driver_data = "20071026", /* yyyymmdd */ 2719 2674 }, 2720 - /* 2721 - * It's yet unknown whether more recent BIOS fixes the 2722 - * problem. Blacklist the whole board for the time 2723 - * being. Please read the following thread for more 2724 - * info. 2725 - * 2726 - * http://thread.gmane.org/gmane.linux.ide/42326 2727 - */ 2728 - { 2729 - .ident = "Gigabyte GA-MA69VM-S2", 2730 - .matches = { 2731 - DMI_MATCH(DMI_BOARD_VENDOR, 2732 - "Gigabyte Technology Co., Ltd."), 2733 - DMI_MATCH(DMI_BOARD_NAME, "GA-MA69VM-S2"), 2734 - }, 2735 - }, 2736 2675 { } 2737 2676 }; 2738 2677 const struct dmi_system_id *match; 2678 + int year, month, date; 2679 + char buf[9]; 2739 2680 2740 2681 match = dmi_first_match(sysids); 2741 2682 if (pdev->bus->number != 0 || pdev->devfn != PCI_DEVFN(0x12, 0) || 2742 2683 !match) 2743 2684 return false; 2744 2685 2745 - if (match->driver_data) { 2746 - int year, month, date; 2747 - char buf[9]; 2686 + dmi_get_date(DMI_BIOS_DATE, &year, &month, &date); 2687 + snprintf(buf, sizeof(buf), "%04d%02d%02d", year, month, date); 2748 2688 2749 - dmi_get_date(DMI_BIOS_DATE, &year, &month, &date); 2750 - snprintf(buf, sizeof(buf), "%04d%02d%02d", year, month, date); 2751 - 2752 - if (strcmp(buf, match->driver_data) >= 0) 2753 - return false; 2754 - 2689 + if (strcmp(buf, match->driver_data) >= 0) { 2690 + dev_printk(KERN_WARNING, &pdev->dev, "%s: enabling 64bit DMA\n", 2691 + match->ident); 2692 + return true; 2693 + } else { 2755 2694 dev_printk(KERN_WARNING, &pdev->dev, "%s: BIOS too old, " 2756 2695 "forcing 32bit DMA, update BIOS\n", match->ident); 2757 - } else 2758 - dev_printk(KERN_WARNING, &pdev->dev, "%s: this board can't " 2759 - "do 64bit DMA, forcing 32bit\n", match->ident); 2760 - 2761 - return true; 2696 + return false; 2697 + } 2762 2698 } 2763 2699 2764 2700 static bool ahci_broken_system_poweroff(struct pci_dev *pdev) ··· 2884 2858 return pdev->bus->number == (val >> 8) && pdev->devfn == (val & 0xff); 2885 2859 } 2886 2860 2861 + static void ahci_gtf_filter_workaround(struct ata_host *host) 2862 + { 2863 + static const struct dmi_system_id sysids[] = { 2864 + /* 2865 + * Aspire 3810T issues a bunch of SATA enable commands 2866 + * via _GTF including an invalid one and one which is 2867 + * rejected by the device. Among the successful ones 2868 + * is FPDMA non-zero offset enable which when enabled 2869 + * only on the drive side leads to NCQ command 2870 + * failures. Filter it out. 2871 + */ 2872 + { 2873 + .ident = "Aspire 3810T", 2874 + .matches = { 2875 + DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 2876 + DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 3810T"), 2877 + }, 2878 + .driver_data = (void *)ATA_ACPI_FILTER_FPDMA_OFFSET, 2879 + }, 2880 + { } 2881 + }; 2882 + const struct dmi_system_id *dmi = dmi_first_match(sysids); 2883 + unsigned int filter; 2884 + int i; 2885 + 2886 + if (!dmi) 2887 + return; 2888 + 2889 + filter = (unsigned long)dmi->driver_data; 2890 + dev_printk(KERN_INFO, host->dev, 2891 + "applying extra ACPI _GTF filter 0x%x for %s\n", 2892 + filter, dmi->ident); 2893 + 2894 + for (i = 0; i < host->n_ports; i++) { 2895 + struct ata_port *ap = host->ports[i]; 2896 + struct ata_link *link; 2897 + struct ata_device *dev; 2898 + 2899 + ata_for_each_link(link, ap, EDGE) 2900 + ata_for_each_dev(dev, link, ALL) 2901 + dev->gtf_filter |= filter; 2902 + } 2903 + } 2904 + 2887 2905 static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 2888 2906 { 2889 2907 static int printed_version; ··· 2996 2926 if (board_id == board_ahci_sb700 && pdev->revision >= 0x40) 2997 2927 hpriv->flags &= ~AHCI_HFLAG_IGN_SERR_INTERNAL; 2998 2928 2999 - /* apply sb600 32bit only quirk */ 3000 - if (ahci_sb600_32bit_only(pdev)) 3001 - hpriv->flags |= AHCI_HFLAG_32BIT_ONLY; 2929 + /* only some SB600s can do 64bit DMA */ 2930 + if (ahci_sb600_enable_64bit(pdev)) 2931 + hpriv->flags &= ~AHCI_HFLAG_32BIT_ONLY; 3002 2932 3003 2933 if ((hpriv->flags & AHCI_HFLAG_NO_MSI) || pci_enable_msi(pdev)) 3004 2934 pci_intx(pdev, 1); ··· 3092 3022 3093 3023 /* apply workaround for ASUS P5W DH Deluxe mainboard */ 3094 3024 ahci_p5wdh_workaround(host); 3025 + 3026 + /* apply gtf filter quirk */ 3027 + ahci_gtf_filter_workaround(host); 3095 3028 3096 3029 /* initialize adapter */ 3097 3030 rc = ahci_configure_dma_masks(pdev, hpriv->cap & HOST_CAP_64);
+21 -19
drivers/ata/libata-acpi.c
··· 20 20 21 21 #include <acpi/acpi_bus.h> 22 22 23 - enum { 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; 23 + unsigned int ata_acpi_gtf_filter = ATA_ACPI_FILTER_DEFAULT; 34 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 27 #define NO_PORT_MULT 0xffff 38 28 #define SATA_ADR(root, pmp) (((root) << 16) | (pmp)) ··· 603 613 tf->command = gtf->tf[6]; /* 0x1f7 */ 604 614 } 605 615 606 - static int ata_acpi_filter_tf(const struct ata_taskfile *tf, 616 + static int ata_acpi_filter_tf(struct ata_device *dev, 617 + const struct ata_taskfile *tf, 607 618 const struct ata_taskfile *ptf) 608 619 { 609 - if (ata_acpi_gtf_filter & ATA_ACPI_FILTER_SETXFER) { 620 + if (dev->gtf_filter & ATA_ACPI_FILTER_SETXFER) { 610 621 /* libata doesn't use ACPI to configure transfer mode. 611 622 * It will only confuse device configuration. Skip. 612 623 */ ··· 616 625 return 1; 617 626 } 618 627 619 - if (ata_acpi_gtf_filter & ATA_ACPI_FILTER_LOCK) { 628 + if (dev->gtf_filter & ATA_ACPI_FILTER_LOCK) { 620 629 /* BIOS writers, sorry but we don't wanna lock 621 630 * features unless the user explicitly said so. 622 631 */ ··· 638 647 return 1; 639 648 } 640 649 641 - if (ata_acpi_gtf_filter & ATA_ACPI_FILTER_DIPM) { 650 + if (tf->command == ATA_CMD_SET_FEATURES && 651 + tf->feature == SETFEATURES_SATA_ENABLE) { 642 652 /* inhibit enabling DIPM */ 643 - if (tf->command == ATA_CMD_SET_FEATURES && 644 - tf->feature == SETFEATURES_SATA_ENABLE && 653 + if (dev->gtf_filter & ATA_ACPI_FILTER_DIPM && 645 654 tf->nsect == SATA_DIPM) 655 + return 1; 656 + 657 + /* inhibit FPDMA non-zero offset */ 658 + if (dev->gtf_filter & ATA_ACPI_FILTER_FPDMA_OFFSET && 659 + (tf->nsect == SATA_FPDMA_OFFSET || 660 + tf->nsect == SATA_FPDMA_IN_ORDER)) 661 + return 1; 662 + 663 + /* inhibit FPDMA auto activation */ 664 + if (dev->gtf_filter & ATA_ACPI_FILTER_FPDMA_AA && 665 + tf->nsect == SATA_FPDMA_AA) 646 666 return 1; 647 667 } 648 668 ··· 706 704 pptf = &ptf; 707 705 } 708 706 709 - if (!ata_acpi_filter_tf(&tf, pptf)) { 707 + if (!ata_acpi_filter_tf(dev, &tf, pptf)) { 710 708 rtf = tf; 711 709 err_mask = ata_exec_internal(dev, &rtf, NULL, 712 710 DMA_NONE, NULL, 0, 0);
+3
drivers/ata/libata-core.c
··· 5591 5591 5592 5592 dev->link = link; 5593 5593 dev->devno = dev - link->device; 5594 + #ifdef CONFIG_ATA_ACPI 5595 + dev->gtf_filter = ata_acpi_gtf_filter; 5596 + #endif 5594 5597 ata_dev_init(dev); 5595 5598 } 5596 5599 }
+32 -18
drivers/ata/libata-eh.c
··· 2667 2667 dev->pio_mode = XFER_PIO_0; 2668 2668 dev->flags &= ~ATA_DFLAG_SLEEPING; 2669 2669 2670 - if (!ata_phys_link_offline(ata_dev_phys_link(dev))) { 2671 - /* apply class override */ 2672 - if (lflags & ATA_LFLAG_ASSUME_ATA) 2673 - classes[dev->devno] = ATA_DEV_ATA; 2674 - else if (lflags & ATA_LFLAG_ASSUME_SEMB) 2675 - classes[dev->devno] = ATA_DEV_SEMB_UNSUP; 2676 - } else 2677 - classes[dev->devno] = ATA_DEV_NONE; 2670 + if (ata_phys_link_offline(ata_dev_phys_link(dev))) 2671 + continue; 2672 + 2673 + /* apply class override */ 2674 + if (lflags & ATA_LFLAG_ASSUME_ATA) 2675 + classes[dev->devno] = ATA_DEV_ATA; 2676 + else if (lflags & ATA_LFLAG_ASSUME_SEMB) 2677 + classes[dev->devno] = ATA_DEV_SEMB_UNSUP; 2678 2678 } 2679 2679 2680 2680 /* record current link speed */ ··· 2713 2713 ap->pflags &= ~ATA_PFLAG_EH_PENDING; 2714 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 2718 * Hotplug could have happened during reset and some 2718 2719 * controllers fail to wait while a drive is spinning up after 2719 2720 * being hotplugged causing misdetection. By cross checking 2720 - * link onlineness and classification result, those conditions 2721 - * can be reliably detected and retried. 2721 + * link on/offlineness and classification result, those 2722 + * conditions can be reliably detected and retried. 2722 2723 */ 2723 2724 nr_unknown = 0; 2724 2725 ata_for_each_dev(dev, link, ALL) { 2725 - /* convert all ATA_DEV_UNKNOWN to ATA_DEV_NONE */ 2726 - if (classes[dev->devno] == ATA_DEV_UNKNOWN) { 2727 - classes[dev->devno] = ATA_DEV_NONE; 2728 - if (ata_phys_link_online(ata_dev_phys_link(dev))) 2726 + if (ata_phys_link_online(ata_dev_phys_link(dev))) { 2727 + if (classes[dev->devno] == ATA_DEV_UNKNOWN) { 2728 + ata_dev_printk(dev, KERN_DEBUG, "link online " 2729 + "but device misclassifed\n"); 2730 + classes[dev->devno] = ATA_DEV_NONE; 2729 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 2746 if (classify && nr_unknown) { 2734 2747 if (try < max_tries) { 2735 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 2751 failed_link = link; 2738 2752 rc = -EAGAIN; 2739 2753 goto fail; 2740 2754 } 2741 2755 ata_link_printk(link, KERN_WARNING, 2742 - "link online but device misclassified, " 2743 - "device detection might fail\n"); 2756 + "link online but %d devices misclassified, " 2757 + "device detection might fail\n", nr_unknown); 2744 2758 } 2745 2759 2746 2760 /* reset successful, schedule revalidation */
+2
drivers/ata/libata.h
··· 118 118 119 119 /* libata-acpi.c */ 120 120 #ifdef CONFIG_ATA_ACPI 121 + extern unsigned int ata_acpi_gtf_filter; 122 + 121 123 extern void ata_acpi_associate_sata_port(struct ata_port *ap); 122 124 extern void ata_acpi_associate(struct ata_host *host); 123 125 extern void ata_acpi_dissociate(struct ata_host *host);
+1 -1
drivers/ata/pata_ali.c
··· 290 290 291 291 if (print_info && adev->class == ATA_DEV_ATAPI && !ali_atapi_dma) { 292 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 294 ata_dev_printk(adev, KERN_WARNING, 295 295 "WARNING: via pata_ali.atapi_dma modparam or corresponding sysfs node.\n"); 296 296 }
+70 -31
drivers/ata/pata_atp867x.c
··· 118 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 121 static void atp867x_set_dmamode(struct ata_port *ap, struct ata_device *adev) 127 122 { 128 123 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 129 124 struct atp867x_priv *dp = ap->private_data; 130 125 u8 speed = adev->dma_mode; 131 126 u8 b; 132 - u8 mode; 133 - 134 - mode = atp867x_speed_to_mode(speed); 127 + u8 mode = speed - XFER_UDMA_0 + 1; 135 128 136 129 /* 137 130 * Doc 6.6.9: decrease the udma mode value by 1 for safer UDMA speed ··· 149 156 iowrite8(b, dp->dma_mode); 150 157 } 151 158 152 - static int atp867x_get_active_clocks_shifted(unsigned int clk) 159 + static int atp867x_get_active_clocks_shifted(struct ata_port *ap, 160 + unsigned int clk) 153 161 { 162 + struct atp867x_priv *dp = ap->private_data; 154 163 unsigned char clocks = clk; 164 + 165 + /* 166 + * Doc 6.6.9: increase the clock value by 1 for safer PIO speed 167 + * on 66MHz bus 168 + */ 169 + if (dp->pci66mhz) 170 + clocks++; 155 171 156 172 switch (clocks) { 157 173 case 0: 158 174 clocks = 1; 159 175 break; 160 - case 1 ... 7: 161 - break; 162 - case 8 ... 12: 163 - clocks = 7; 176 + case 1 ... 6: 164 177 break; 165 178 default: 166 179 printk(KERN_WARNING "ATP867X: active %dclk is invalid. " 167 - "Using default 8clk.\n", clk); 168 - clocks = 0; /* 8 clk */ 180 + "Using 12clk.\n", clk); 181 + case 9 ... 12: 182 + clocks = 7; /* 12 clk */ 169 183 break; 184 + case 7: 185 + case 8: /* default 8 clk */ 186 + clocks = 0; 187 + goto active_clock_shift_done; 170 188 } 189 + 190 + active_clock_shift_done: 171 191 return clocks << ATP867X_IO_PIOSPD_ACTIVE_SHIFT; 172 192 } 173 193 ··· 194 188 break; 195 189 case 1 ... 11: 196 190 break; 197 - case 12: 198 - clocks = 0; 199 - break; 200 - case 13: case 14: 201 - --clocks; 191 + case 13: 192 + case 14: 193 + --clocks; /* by the spec */ 202 194 break; 203 195 case 15: 204 196 break; 205 197 default: 206 198 printk(KERN_WARNING "ATP867X: recover %dclk is invalid. " 207 - "Using default 15clk.\n", clk); 208 - clocks = 0; /* 12 clk */ 199 + "Using default 12clk.\n", clk); 200 + case 12: /* default 12 clk */ 201 + clocks = 0; 209 202 break; 210 203 } 204 + 211 205 return clocks << ATP867X_IO_PIOSPD_RECOVER_SHIFT; 212 206 } 213 207 ··· 236 230 b = (b & ~ATP867X_IO_DMAMODE_MSTR_MASK); 237 231 iowrite8(b, dp->dma_mode); 238 232 239 - b = atp867x_get_active_clocks_shifted(t.active) | 240 - atp867x_get_recover_clocks_shifted(t.recover); 241 - if (dp->pci66mhz) 242 - b += 0x10; 233 + b = atp867x_get_active_clocks_shifted(ap, t.active) | 234 + atp867x_get_recover_clocks_shifted(t.recover); 243 235 244 236 if (adev->devno & 1) 245 237 iowrite8(b, dp->slave_piospd); 246 238 else 247 239 iowrite8(b, dp->mstr_piospd); 248 240 249 - /* 250 - * use the same value for comand timing as for PIO timimg 251 - */ 241 + b = atp867x_get_active_clocks_shifted(ap, t.act8b) | 242 + atp867x_get_recover_clocks_shifted(t.rec8b); 243 + 252 244 iowrite8(b, dp->eightb_piospd); 245 + } 246 + 247 + static int atp867x_cable_override(struct pci_dev *pdev) 248 + { 249 + if (pdev->subsystem_vendor == PCI_VENDOR_ID_ARTOP && 250 + (pdev->subsystem_device == PCI_DEVICE_ID_ARTOP_ATP867A || 251 + pdev->subsystem_device == PCI_DEVICE_ID_ARTOP_ATP867B)) { 252 + return 1; 253 + } 254 + return 0; 253 255 } 254 256 255 257 static int atp867x_cable_detect(struct ata_port *ap) 256 258 { 257 - return ATA_CBL_PATA40_SHORT; 259 + struct pci_dev *pdev = to_pci_dev(ap->host->dev); 260 + 261 + if (atp867x_cable_override(pdev)) 262 + return ATA_CBL_PATA40_SHORT; 263 + 264 + return ATA_CBL_PATA_UNK; 258 265 } 259 266 260 267 static struct scsi_host_template atp867x_sht = { ··· 490 471 static const struct ata_port_info info_867x = { 491 472 .flags = ATA_FLAG_SLAVE_POSS, 492 473 .pio_mask = ATA_PIO4, 493 - .mwdma_mask = ATA_MWDMA2, 494 474 .udma_mask = ATA_UDMA6, 495 475 .port_ops = &atp867x_ops, 496 476 }; ··· 533 515 return rc; 534 516 } 535 517 518 + #ifdef CONFIG_PM 519 + static int atp867x_reinit_one(struct pci_dev *pdev) 520 + { 521 + struct ata_host *host = dev_get_drvdata(&pdev->dev); 522 + int rc; 523 + 524 + rc = ata_pci_device_do_resume(pdev); 525 + if (rc) 526 + return rc; 527 + 528 + atp867x_fixup(host); 529 + 530 + ata_host_resume(host); 531 + return 0; 532 + } 533 + #endif 534 + 536 535 static struct pci_device_id atp867x_pci_tbl[] = { 537 536 { PCI_VDEVICE(ARTOP, PCI_DEVICE_ID_ARTOP_ATP867A), 0 }, 538 537 { PCI_VDEVICE(ARTOP, PCI_DEVICE_ID_ARTOP_ATP867B), 0 }, ··· 561 526 .id_table = atp867x_pci_tbl, 562 527 .probe = atp867x_init_one, 563 528 .remove = ata_pci_remove_one, 529 + #ifdef CONFIG_PM 530 + .suspend = ata_pci_device_suspend, 531 + .resume = atp867x_reinit_one, 532 + #endif 564 533 }; 565 534 566 535 static int __init atp867x_init(void)
+6 -3
include/linux/ata.h
··· 334 334 SETFEATURES_SATA_DISABLE = 0x90, /* Disable use of SATA feature */ 335 335 336 336 /* SETFEATURE Sector counts for SATA features */ 337 - SATA_AN = 0x05, /* Asynchronous Notification */ 338 - SATA_DIPM = 0x03, /* Device Initiated Power Management */ 339 - SATA_FPDMA_AA = 0x02, /* DMA Setup FIS Auto-Activate */ 337 + SATA_FPDMA_OFFSET = 0x01, /* FPDMA non-zero buffer offsets */ 338 + SATA_FPDMA_AA = 0x02, /* FPDMA Setup FIS Auto-Activate */ 339 + SATA_DIPM = 0x03, /* Device Initiated Power Management */ 340 + SATA_FPDMA_IN_ORDER = 0x04, /* FPDMA in-order data delivery */ 341 + SATA_AN = 0x05, /* Asynchronous Notification */ 342 + SATA_SSP = 0x06, /* Software Settings Preservation */ 340 343 341 344 /* feature values for SET_MAX */ 342 345 ATA_SET_MAX_ADDR = 0x00,
+12
include/linux/libata.h
··· 418 418 ATA_TIMING_ACTIVE | ATA_TIMING_RECOVER | 419 419 ATA_TIMING_DMACK_HOLD | ATA_TIMING_CYCLE | 420 420 ATA_TIMING_UDMA, 421 + 422 + /* ACPI constants */ 423 + ATA_ACPI_FILTER_SETXFER = 1 << 0, 424 + ATA_ACPI_FILTER_LOCK = 1 << 1, 425 + ATA_ACPI_FILTER_DIPM = 1 << 2, 426 + ATA_ACPI_FILTER_FPDMA_OFFSET = 1 << 3, /* FPDMA non-zero offset */ 427 + ATA_ACPI_FILTER_FPDMA_AA = 1 << 4, /* FPDMA auto activate */ 428 + 429 + ATA_ACPI_FILTER_DEFAULT = ATA_ACPI_FILTER_SETXFER | 430 + ATA_ACPI_FILTER_LOCK | 431 + ATA_ACPI_FILTER_DIPM, 421 432 }; 422 433 423 434 enum ata_xfer_mask { ··· 598 587 #ifdef CONFIG_ATA_ACPI 599 588 acpi_handle acpi_handle; 600 589 union acpi_object *gtf_cache; 590 + unsigned int gtf_filter; 601 591 #endif 602 592 /* n_sector is CLEAR_BEGIN, read comment above CLEAR_BEGIN */ 603 593 u64 n_sectors; /* size of device, if ATA */