diff options
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/Kconfig | 6 | ||||
-rw-r--r-- | drivers/ata/ahci.c | 41 | ||||
-rw-r--r-- | drivers/ata/ata_piix.c | 34 | ||||
-rw-r--r-- | drivers/ata/libata-core.c | 96 | ||||
-rw-r--r-- | drivers/ata/libata-eh.c | 87 | ||||
-rw-r--r-- | drivers/ata/libata-pmp.c | 2 | ||||
-rw-r--r-- | drivers/ata/libata-scsi.c | 21 | ||||
-rw-r--r-- | drivers/ata/libata-sff.c | 12 | ||||
-rw-r--r-- | drivers/ata/libata.h | 4 | ||||
-rw-r--r-- | drivers/ata/pata_rb532_cf.c | 2 | ||||
-rw-r--r-- | drivers/ata/pata_via.c | 22 | ||||
-rw-r--r-- | drivers/ata/sata_mv.c | 60 | ||||
-rw-r--r-- | drivers/ata/sata_nv.c | 77 | ||||
-rw-r--r-- | drivers/ata/sata_sil.c | 39 |
14 files changed, 391 insertions, 112 deletions
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 503a908afc8..0bcf2646467 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
@@ -112,11 +112,11 @@ config ATA_PIIX | |||
112 | If unsure, say N. | 112 | If unsure, say N. |
113 | 113 | ||
114 | config SATA_MV | 114 | config SATA_MV |
115 | tristate "Marvell SATA support (HIGHLY EXPERIMENTAL)" | 115 | tristate "Marvell SATA support" |
116 | depends on EXPERIMENTAL | ||
117 | help | 116 | help |
118 | This option enables support for the Marvell Serial ATA family. | 117 | This option enables support for the Marvell Serial ATA family. |
119 | Currently supports 88SX[56]0[48][01] chips. | 118 | Currently supports 88SX[56]0[48][01] PCI(-X) chips, |
119 | as well as the newer [67]042 PCI-X/PCIe and SOC devices. | ||
120 | 120 | ||
121 | If unsure, say N. | 121 | If unsure, say N. |
122 | 122 | ||
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 96039671e3b..a603bbf9b1b 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -61,9 +61,14 @@ | |||
61 | #define EM_MSG_LED_VALUE_ON 0x00010000 | 61 | #define EM_MSG_LED_VALUE_ON 0x00010000 |
62 | 62 | ||
63 | static int ahci_skip_host_reset; | 63 | static int ahci_skip_host_reset; |
64 | static int ahci_ignore_sss; | ||
65 | |||
64 | module_param_named(skip_host_reset, ahci_skip_host_reset, int, 0444); | 66 | module_param_named(skip_host_reset, ahci_skip_host_reset, int, 0444); |
65 | MODULE_PARM_DESC(skip_host_reset, "skip global host reset (0=don't skip, 1=skip)"); | 67 | MODULE_PARM_DESC(skip_host_reset, "skip global host reset (0=don't skip, 1=skip)"); |
66 | 68 | ||
69 | module_param_named(ignore_sss, ahci_ignore_sss, int, 0444); | ||
70 | MODULE_PARM_DESC(ignore_sss, "Ignore staggered spinup flag (0=don't ignore, 1=ignore)"); | ||
71 | |||
67 | static int ahci_enable_alpm(struct ata_port *ap, | 72 | static int ahci_enable_alpm(struct ata_port *ap, |
68 | enum link_pm policy); | 73 | enum link_pm policy); |
69 | static void ahci_disable_alpm(struct ata_port *ap); | 74 | static void ahci_disable_alpm(struct ata_port *ap); |
@@ -2548,6 +2553,32 @@ static void ahci_p5wdh_workaround(struct ata_host *host) | |||
2548 | } | 2553 | } |
2549 | } | 2554 | } |
2550 | 2555 | ||
2556 | static bool ahci_broken_system_poweroff(struct pci_dev *pdev) | ||
2557 | { | ||
2558 | static const struct dmi_system_id broken_systems[] = { | ||
2559 | { | ||
2560 | .ident = "HP Compaq nx6310", | ||
2561 | .matches = { | ||
2562 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
2563 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq nx6310"), | ||
2564 | }, | ||
2565 | /* PCI slot number of the controller */ | ||
2566 | .driver_data = (void *)0x1FUL, | ||
2567 | }, | ||
2568 | |||
2569 | { } /* terminate list */ | ||
2570 | }; | ||
2571 | const struct dmi_system_id *dmi = dmi_first_match(broken_systems); | ||
2572 | |||
2573 | if (dmi) { | ||
2574 | unsigned long slot = (unsigned long)dmi->driver_data; | ||
2575 | /* apply the quirk only to on-board controllers */ | ||
2576 | return slot == PCI_SLOT(pdev->devfn); | ||
2577 | } | ||
2578 | |||
2579 | return false; | ||
2580 | } | ||
2581 | |||
2551 | static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | 2582 | static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
2552 | { | 2583 | { |
2553 | static int printed_version; | 2584 | static int printed_version; |
@@ -2647,6 +2678,12 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2647 | } | 2678 | } |
2648 | } | 2679 | } |
2649 | 2680 | ||
2681 | if (ahci_broken_system_poweroff(pdev)) { | ||
2682 | pi.flags |= ATA_FLAG_NO_POWEROFF_SPINDOWN; | ||
2683 | dev_info(&pdev->dev, | ||
2684 | "quirky BIOS, skipping spindown on poweroff\n"); | ||
2685 | } | ||
2686 | |||
2650 | /* CAP.NP sometimes indicate the index of the last enabled | 2687 | /* CAP.NP sometimes indicate the index of the last enabled |
2651 | * port, at other times, that of the last possible port, so | 2688 | * port, at other times, that of the last possible port, so |
2652 | * determining the maximum port number requires looking at | 2689 | * determining the maximum port number requires looking at |
@@ -2660,8 +2697,10 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2660 | host->iomap = pcim_iomap_table(pdev); | 2697 | host->iomap = pcim_iomap_table(pdev); |
2661 | host->private_data = hpriv; | 2698 | host->private_data = hpriv; |
2662 | 2699 | ||
2663 | if (!(hpriv->cap & HOST_CAP_SSS)) | 2700 | if (!(hpriv->cap & HOST_CAP_SSS) || ahci_ignore_sss) |
2664 | host->flags |= ATA_HOST_PARALLEL_SCAN; | 2701 | host->flags |= ATA_HOST_PARALLEL_SCAN; |
2702 | else | ||
2703 | printk(KERN_INFO "ahci: SSS flag set, parallel bus scan disabled\n"); | ||
2665 | 2704 | ||
2666 | if (pi.flags & ATA_FLAG_EM) | 2705 | if (pi.flags & ATA_FLAG_EM) |
2667 | ahci_reset_em(host); | 2706 | ahci_reset_em(host); |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 887d8f46a28..54961c0b2c7 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -1387,6 +1387,32 @@ static void piix_iocfg_bit18_quirk(struct ata_host *host) | |||
1387 | } | 1387 | } |
1388 | } | 1388 | } |
1389 | 1389 | ||
1390 | static bool piix_broken_system_poweroff(struct pci_dev *pdev) | ||
1391 | { | ||
1392 | static const struct dmi_system_id broken_systems[] = { | ||
1393 | { | ||
1394 | .ident = "HP Compaq 2510p", | ||
1395 | .matches = { | ||
1396 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
1397 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq 2510p"), | ||
1398 | }, | ||
1399 | /* PCI slot number of the controller */ | ||
1400 | .driver_data = (void *)0x1FUL, | ||
1401 | }, | ||
1402 | |||
1403 | { } /* terminate list */ | ||
1404 | }; | ||
1405 | const struct dmi_system_id *dmi = dmi_first_match(broken_systems); | ||
1406 | |||
1407 | if (dmi) { | ||
1408 | unsigned long slot = (unsigned long)dmi->driver_data; | ||
1409 | /* apply the quirk only to on-board controllers */ | ||
1410 | return slot == PCI_SLOT(pdev->devfn); | ||
1411 | } | ||
1412 | |||
1413 | return false; | ||
1414 | } | ||
1415 | |||
1390 | /** | 1416 | /** |
1391 | * piix_init_one - Register PIIX ATA PCI device with kernel services | 1417 | * piix_init_one - Register PIIX ATA PCI device with kernel services |
1392 | * @pdev: PCI device to register | 1418 | * @pdev: PCI device to register |
@@ -1422,6 +1448,14 @@ static int __devinit piix_init_one(struct pci_dev *pdev, | |||
1422 | if (!in_module_init) | 1448 | if (!in_module_init) |
1423 | return -ENODEV; | 1449 | return -ENODEV; |
1424 | 1450 | ||
1451 | if (piix_broken_system_poweroff(pdev)) { | ||
1452 | piix_port_info[ent->driver_data].flags |= | ||
1453 | ATA_FLAG_NO_POWEROFF_SPINDOWN | | ||
1454 | ATA_FLAG_NO_HIBERNATE_SPINDOWN; | ||
1455 | dev_info(&pdev->dev, "quirky BIOS, skipping spindown " | ||
1456 | "on poweroff and hibernation\n"); | ||
1457 | } | ||
1458 | |||
1425 | port_info[0] = piix_port_info[ent->driver_data]; | 1459 | port_info[0] = piix_port_info[ent->driver_data]; |
1426 | port_info[1] = piix_port_info[ent->driver_data]; | 1460 | port_info[1] = piix_port_info[ent->driver_data]; |
1427 | 1461 | ||
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 88c242856da..9fbf0595f3d 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -164,6 +164,11 @@ MODULE_LICENSE("GPL"); | |||
164 | MODULE_VERSION(DRV_VERSION); | 164 | MODULE_VERSION(DRV_VERSION); |
165 | 165 | ||
166 | 166 | ||
167 | static bool ata_sstatus_online(u32 sstatus) | ||
168 | { | ||
169 | return (sstatus & 0xf) == 0x3; | ||
170 | } | ||
171 | |||
167 | /** | 172 | /** |
168 | * ata_link_next - link iteration helper | 173 | * ata_link_next - link iteration helper |
169 | * @link: the previous link, NULL to start | 174 | * @link: the previous link, NULL to start |
@@ -1015,18 +1020,6 @@ static const char *sata_spd_string(unsigned int spd) | |||
1015 | return spd_str[spd - 1]; | 1020 | return spd_str[spd - 1]; |
1016 | } | 1021 | } |
1017 | 1022 | ||
1018 | void ata_dev_disable(struct ata_device *dev) | ||
1019 | { | ||
1020 | if (ata_dev_enabled(dev)) { | ||
1021 | if (ata_msg_drv(dev->link->ap)) | ||
1022 | ata_dev_printk(dev, KERN_WARNING, "disabled\n"); | ||
1023 | ata_acpi_on_disable(dev); | ||
1024 | ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 | | ||
1025 | ATA_DNXFER_QUIET); | ||
1026 | dev->class++; | ||
1027 | } | ||
1028 | } | ||
1029 | |||
1030 | static int ata_dev_set_dipm(struct ata_device *dev, enum link_pm policy) | 1023 | static int ata_dev_set_dipm(struct ata_device *dev, enum link_pm policy) |
1031 | { | 1024 | { |
1032 | struct ata_link *link = dev->link; | 1025 | struct ata_link *link = dev->link; |
@@ -2239,6 +2232,40 @@ retry: | |||
2239 | return rc; | 2232 | return rc; |
2240 | } | 2233 | } |
2241 | 2234 | ||
2235 | static int ata_do_link_spd_horkage(struct ata_device *dev) | ||
2236 | { | ||
2237 | struct ata_link *plink = ata_dev_phys_link(dev); | ||
2238 | u32 target, target_limit; | ||
2239 | |||
2240 | if (!sata_scr_valid(plink)) | ||
2241 | return 0; | ||
2242 | |||
2243 | if (dev->horkage & ATA_HORKAGE_1_5_GBPS) | ||
2244 | target = 1; | ||
2245 | else | ||
2246 | return 0; | ||
2247 | |||
2248 | target_limit = (1 << target) - 1; | ||
2249 | |||
2250 | /* if already on stricter limit, no need to push further */ | ||
2251 | if (plink->sata_spd_limit <= target_limit) | ||
2252 | return 0; | ||
2253 | |||
2254 | plink->sata_spd_limit = target_limit; | ||
2255 | |||
2256 | /* Request another EH round by returning -EAGAIN if link is | ||
2257 | * going faster than the target speed. Forward progress is | ||
2258 | * guaranteed by setting sata_spd_limit to target_limit above. | ||
2259 | */ | ||
2260 | if (plink->sata_spd > target) { | ||
2261 | ata_dev_printk(dev, KERN_INFO, | ||
2262 | "applying link speed limit horkage to %s\n", | ||
2263 | sata_spd_string(target)); | ||
2264 | return -EAGAIN; | ||
2265 | } | ||
2266 | return 0; | ||
2267 | } | ||
2268 | |||
2242 | static inline u8 ata_dev_knobble(struct ata_device *dev) | 2269 | static inline u8 ata_dev_knobble(struct ata_device *dev) |
2243 | { | 2270 | { |
2244 | struct ata_port *ap = dev->link->ap; | 2271 | struct ata_port *ap = dev->link->ap; |
@@ -2329,6 +2356,10 @@ int ata_dev_configure(struct ata_device *dev) | |||
2329 | return 0; | 2356 | return 0; |
2330 | } | 2357 | } |
2331 | 2358 | ||
2359 | rc = ata_do_link_spd_horkage(dev); | ||
2360 | if (rc) | ||
2361 | return rc; | ||
2362 | |||
2332 | /* let ACPI work its magic */ | 2363 | /* let ACPI work its magic */ |
2333 | rc = ata_acpi_on_devcfg(dev); | 2364 | rc = ata_acpi_on_devcfg(dev); |
2334 | if (rc) | 2365 | if (rc) |
@@ -2784,7 +2815,7 @@ int ata_bus_probe(struct ata_port *ap) | |||
2784 | /* This is the last chance, better to slow | 2815 | /* This is the last chance, better to slow |
2785 | * down than lose it. | 2816 | * down than lose it. |
2786 | */ | 2817 | */ |
2787 | sata_down_spd_limit(&ap->link); | 2818 | sata_down_spd_limit(&ap->link, 0); |
2788 | ata_down_xfermask_limit(dev, ATA_DNXFER_PIO); | 2819 | ata_down_xfermask_limit(dev, ATA_DNXFER_PIO); |
2789 | } | 2820 | } |
2790 | } | 2821 | } |
@@ -2880,21 +2911,27 @@ void ata_port_disable(struct ata_port *ap) | |||
2880 | /** | 2911 | /** |
2881 | * sata_down_spd_limit - adjust SATA spd limit downward | 2912 | * sata_down_spd_limit - adjust SATA spd limit downward |
2882 | * @link: Link to adjust SATA spd limit for | 2913 | * @link: Link to adjust SATA spd limit for |
2914 | * @spd_limit: Additional limit | ||
2883 | * | 2915 | * |
2884 | * Adjust SATA spd limit of @link downward. Note that this | 2916 | * Adjust SATA spd limit of @link downward. Note that this |
2885 | * function only adjusts the limit. The change must be applied | 2917 | * function only adjusts the limit. The change must be applied |
2886 | * using sata_set_spd(). | 2918 | * using sata_set_spd(). |
2887 | * | 2919 | * |
2920 | * If @spd_limit is non-zero, the speed is limited to equal to or | ||
2921 | * lower than @spd_limit if such speed is supported. If | ||
2922 | * @spd_limit is slower than any supported speed, only the lowest | ||
2923 | * supported speed is allowed. | ||
2924 | * | ||
2888 | * LOCKING: | 2925 | * LOCKING: |
2889 | * Inherited from caller. | 2926 | * Inherited from caller. |
2890 | * | 2927 | * |
2891 | * RETURNS: | 2928 | * RETURNS: |
2892 | * 0 on success, negative errno on failure | 2929 | * 0 on success, negative errno on failure |
2893 | */ | 2930 | */ |
2894 | int sata_down_spd_limit(struct ata_link *link) | 2931 | int sata_down_spd_limit(struct ata_link *link, u32 spd_limit) |
2895 | { | 2932 | { |
2896 | u32 sstatus, spd, mask; | 2933 | u32 sstatus, spd, mask; |
2897 | int rc, highbit; | 2934 | int rc, bit; |
2898 | 2935 | ||
2899 | if (!sata_scr_valid(link)) | 2936 | if (!sata_scr_valid(link)) |
2900 | return -EOPNOTSUPP; | 2937 | return -EOPNOTSUPP; |
@@ -2903,7 +2940,7 @@ int sata_down_spd_limit(struct ata_link *link) | |||
2903 | * If not, use cached value in link->sata_spd. | 2940 | * If not, use cached value in link->sata_spd. |
2904 | */ | 2941 | */ |
2905 | rc = sata_scr_read(link, SCR_STATUS, &sstatus); | 2942 | rc = sata_scr_read(link, SCR_STATUS, &sstatus); |
2906 | if (rc == 0) | 2943 | if (rc == 0 && ata_sstatus_online(sstatus)) |
2907 | spd = (sstatus >> 4) & 0xf; | 2944 | spd = (sstatus >> 4) & 0xf; |
2908 | else | 2945 | else |
2909 | spd = link->sata_spd; | 2946 | spd = link->sata_spd; |
@@ -2913,8 +2950,8 @@ int sata_down_spd_limit(struct ata_link *link) | |||
2913 | return -EINVAL; | 2950 | return -EINVAL; |
2914 | 2951 | ||
2915 | /* unconditionally mask off the highest bit */ | 2952 | /* unconditionally mask off the highest bit */ |
2916 | highbit = fls(mask) - 1; | 2953 | bit = fls(mask) - 1; |
2917 | mask &= ~(1 << highbit); | 2954 | mask &= ~(1 << bit); |
2918 | 2955 | ||
2919 | /* Mask off all speeds higher than or equal to the current | 2956 | /* Mask off all speeds higher than or equal to the current |
2920 | * one. Force 1.5Gbps if current SPD is not available. | 2957 | * one. Force 1.5Gbps if current SPD is not available. |
@@ -2928,6 +2965,15 @@ int sata_down_spd_limit(struct ata_link *link) | |||
2928 | if (!mask) | 2965 | if (!mask) |
2929 | return -EINVAL; | 2966 | return -EINVAL; |
2930 | 2967 | ||
2968 | if (spd_limit) { | ||
2969 | if (mask & ((1 << spd_limit) - 1)) | ||
2970 | mask &= (1 << spd_limit) - 1; | ||
2971 | else { | ||
2972 | bit = ffs(mask) - 1; | ||
2973 | mask = 1 << bit; | ||
2974 | } | ||
2975 | } | ||
2976 | |||
2931 | link->sata_spd_limit = mask; | 2977 | link->sata_spd_limit = mask; |
2932 | 2978 | ||
2933 | ata_link_printk(link, KERN_WARNING, "limiting SATA link speed to %s\n", | 2979 | ata_link_printk(link, KERN_WARNING, "limiting SATA link speed to %s\n", |
@@ -4215,6 +4261,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4215 | /* Devices that do not need bridging limits applied */ | 4261 | /* Devices that do not need bridging limits applied */ |
4216 | { "MTRON MSP-SATA*", NULL, ATA_HORKAGE_BRIDGE_OK, }, | 4262 | { "MTRON MSP-SATA*", NULL, ATA_HORKAGE_BRIDGE_OK, }, |
4217 | 4263 | ||
4264 | /* Devices which aren't very happy with higher link speeds */ | ||
4265 | { "WD My Book", NULL, ATA_HORKAGE_1_5_GBPS, }, | ||
4266 | |||
4218 | /* End Marker */ | 4267 | /* End Marker */ |
4219 | { } | 4268 | { } |
4220 | }; | 4269 | }; |
@@ -4709,8 +4758,7 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words) | |||
4709 | 4758 | ||
4710 | /** | 4759 | /** |
4711 | * ata_qc_new - Request an available ATA command, for queueing | 4760 | * ata_qc_new - Request an available ATA command, for queueing |
4712 | * @ap: Port associated with device @dev | 4761 | * @ap: target port |
4713 | * @dev: Device from whom we request an available command structure | ||
4714 | * | 4762 | * |
4715 | * LOCKING: | 4763 | * LOCKING: |
4716 | * None. | 4764 | * None. |
@@ -5175,7 +5223,7 @@ bool ata_phys_link_online(struct ata_link *link) | |||
5175 | u32 sstatus; | 5223 | u32 sstatus; |
5176 | 5224 | ||
5177 | if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0 && | 5225 | if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0 && |
5178 | (sstatus & 0xf) == 0x3) | 5226 | ata_sstatus_online(sstatus)) |
5179 | return true; | 5227 | return true; |
5180 | return false; | 5228 | return false; |
5181 | } | 5229 | } |
@@ -5199,7 +5247,7 @@ bool ata_phys_link_offline(struct ata_link *link) | |||
5199 | u32 sstatus; | 5247 | u32 sstatus; |
5200 | 5248 | ||
5201 | if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0 && | 5249 | if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0 && |
5202 | (sstatus & 0xf) != 0x3) | 5250 | !ata_sstatus_online(sstatus)) |
5203 | return true; | 5251 | return true; |
5204 | return false; | 5252 | return false; |
5205 | } | 5253 | } |
@@ -5412,8 +5460,8 @@ void ata_dev_init(struct ata_device *dev) | |||
5412 | dev->horkage = 0; | 5460 | dev->horkage = 0; |
5413 | spin_unlock_irqrestore(ap->lock, flags); | 5461 | spin_unlock_irqrestore(ap->lock, flags); |
5414 | 5462 | ||
5415 | memset((void *)dev + ATA_DEVICE_CLEAR_OFFSET, 0, | 5463 | memset((void *)dev + ATA_DEVICE_CLEAR_BEGIN, 0, |
5416 | sizeof(*dev) - ATA_DEVICE_CLEAR_OFFSET); | 5464 | ATA_DEVICE_CLEAR_END - ATA_DEVICE_CLEAR_BEGIN); |
5417 | dev->pio_mask = UINT_MAX; | 5465 | dev->pio_mask = UINT_MAX; |
5418 | dev->mwdma_mask = UINT_MAX; | 5466 | dev->mwdma_mask = UINT_MAX; |
5419 | dev->udma_mask = UINT_MAX; | 5467 | dev->udma_mask = UINT_MAX; |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 8147a838637..ce2ef047533 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -82,6 +82,10 @@ enum { | |||
82 | ATA_EH_FASTDRAIN_INTERVAL = 3000, | 82 | ATA_EH_FASTDRAIN_INTERVAL = 3000, |
83 | 83 | ||
84 | ATA_EH_UA_TRIES = 5, | 84 | ATA_EH_UA_TRIES = 5, |
85 | |||
86 | /* probe speed down parameters, see ata_eh_schedule_probe() */ | ||
87 | ATA_EH_PROBE_TRIAL_INTERVAL = 60000, /* 1 min */ | ||
88 | ATA_EH_PROBE_TRIALS = 2, | ||
85 | }; | 89 | }; |
86 | 90 | ||
87 | /* The following table determines how we sequence resets. Each entry | 91 | /* The following table determines how we sequence resets. Each entry |
@@ -1176,6 +1180,32 @@ void ata_eh_qc_retry(struct ata_queued_cmd *qc) | |||
1176 | } | 1180 | } |
1177 | 1181 | ||
1178 | /** | 1182 | /** |
1183 | * ata_dev_disable - disable ATA device | ||
1184 | * @dev: ATA device to disable | ||
1185 | * | ||
1186 | * Disable @dev. | ||
1187 | * | ||
1188 | * Locking: | ||
1189 | * EH context. | ||
1190 | */ | ||
1191 | void ata_dev_disable(struct ata_device *dev) | ||
1192 | { | ||
1193 | if (!ata_dev_enabled(dev)) | ||
1194 | return; | ||
1195 | |||
1196 | if (ata_msg_drv(dev->link->ap)) | ||
1197 | ata_dev_printk(dev, KERN_WARNING, "disabled\n"); | ||
1198 | ata_acpi_on_disable(dev); | ||
1199 | ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 | ATA_DNXFER_QUIET); | ||
1200 | dev->class++; | ||
1201 | |||
1202 | /* From now till the next successful probe, ering is used to | ||
1203 | * track probe failures. Clear accumulated device error info. | ||
1204 | */ | ||
1205 | ata_ering_clear(&dev->ering); | ||
1206 | } | ||
1207 | |||
1208 | /** | ||
1179 | * ata_eh_detach_dev - detach ATA device | 1209 | * ata_eh_detach_dev - detach ATA device |
1180 | * @dev: ATA device to detach | 1210 | * @dev: ATA device to detach |
1181 | * | 1211 | * |
@@ -1849,7 +1879,7 @@ static unsigned int ata_eh_speed_down(struct ata_device *dev, | |||
1849 | /* speed down? */ | 1879 | /* speed down? */ |
1850 | if (verdict & ATA_EH_SPDN_SPEED_DOWN) { | 1880 | if (verdict & ATA_EH_SPDN_SPEED_DOWN) { |
1851 | /* speed down SATA link speed if possible */ | 1881 | /* speed down SATA link speed if possible */ |
1852 | if (sata_down_spd_limit(link) == 0) { | 1882 | if (sata_down_spd_limit(link, 0) == 0) { |
1853 | action |= ATA_EH_RESET; | 1883 | action |= ATA_EH_RESET; |
1854 | goto done; | 1884 | goto done; |
1855 | } | 1885 | } |
@@ -2601,11 +2631,11 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2601 | } | 2631 | } |
2602 | 2632 | ||
2603 | if (try == max_tries - 1) { | 2633 | if (try == max_tries - 1) { |
2604 | sata_down_spd_limit(link); | 2634 | sata_down_spd_limit(link, 0); |
2605 | if (slave) | 2635 | if (slave) |
2606 | sata_down_spd_limit(slave); | 2636 | sata_down_spd_limit(slave, 0); |
2607 | } else if (rc == -EPIPE) | 2637 | } else if (rc == -EPIPE) |
2608 | sata_down_spd_limit(failed_link); | 2638 | sata_down_spd_limit(failed_link, 0); |
2609 | 2639 | ||
2610 | if (hardreset) | 2640 | if (hardreset) |
2611 | reset = hardreset; | 2641 | reset = hardreset; |
@@ -2744,6 +2774,8 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link, | |||
2744 | readid_flags, dev->id); | 2774 | readid_flags, dev->id); |
2745 | switch (rc) { | 2775 | switch (rc) { |
2746 | case 0: | 2776 | case 0: |
2777 | /* clear error info accumulated during probe */ | ||
2778 | ata_ering_clear(&dev->ering); | ||
2747 | new_mask |= 1 << dev->devno; | 2779 | new_mask |= 1 << dev->devno; |
2748 | break; | 2780 | break; |
2749 | case -ENOENT: | 2781 | case -ENOENT: |
@@ -2947,9 +2979,24 @@ static int ata_eh_skip_recovery(struct ata_link *link) | |||
2947 | return 1; | 2979 | return 1; |
2948 | } | 2980 | } |
2949 | 2981 | ||
2982 | static int ata_count_probe_trials_cb(struct ata_ering_entry *ent, void *void_arg) | ||
2983 | { | ||
2984 | u64 interval = msecs_to_jiffies(ATA_EH_PROBE_TRIAL_INTERVAL); | ||
2985 | u64 now = get_jiffies_64(); | ||
2986 | int *trials = void_arg; | ||
2987 | |||
2988 | if (ent->timestamp < now - min(now, interval)) | ||
2989 | return -1; | ||
2990 | |||
2991 | (*trials)++; | ||
2992 | return 0; | ||
2993 | } | ||
2994 | |||
2950 | static int ata_eh_schedule_probe(struct ata_device *dev) | 2995 | static int ata_eh_schedule_probe(struct ata_device *dev) |
2951 | { | 2996 | { |
2952 | struct ata_eh_context *ehc = &dev->link->eh_context; | 2997 | struct ata_eh_context *ehc = &dev->link->eh_context; |
2998 | struct ata_link *link = ata_dev_phys_link(dev); | ||
2999 | int trials = 0; | ||
2953 | 3000 | ||
2954 | if (!(ehc->i.probe_mask & (1 << dev->devno)) || | 3001 | if (!(ehc->i.probe_mask & (1 << dev->devno)) || |
2955 | (ehc->did_probe_mask & (1 << dev->devno))) | 3002 | (ehc->did_probe_mask & (1 << dev->devno))) |
@@ -2962,6 +3009,25 @@ static int ata_eh_schedule_probe(struct ata_device *dev) | |||
2962 | ehc->saved_xfer_mode[dev->devno] = 0; | 3009 | ehc->saved_xfer_mode[dev->devno] = 0; |
2963 | ehc->saved_ncq_enabled &= ~(1 << dev->devno); | 3010 | ehc->saved_ncq_enabled &= ~(1 << dev->devno); |
2964 | 3011 | ||
3012 | /* Record and count probe trials on the ering. The specific | ||
3013 | * error mask used is irrelevant. Because a successful device | ||
3014 | * detection clears the ering, this count accumulates only if | ||
3015 | * there are consecutive failed probes. | ||
3016 | * | ||
3017 | * If the count is equal to or higher than ATA_EH_PROBE_TRIALS | ||
3018 | * in the last ATA_EH_PROBE_TRIAL_INTERVAL, link speed is | ||
3019 | * forced to 1.5Gbps. | ||
3020 | * | ||
3021 | * This is to work around cases where failed link speed | ||
3022 | * negotiation results in device misdetection leading to | ||
3023 | * infinite DEVXCHG or PHRDY CHG events. | ||
3024 | */ | ||
3025 | ata_ering_record(&dev->ering, 0, AC_ERR_OTHER); | ||
3026 | ata_ering_map(&dev->ering, ata_count_probe_trials_cb, &trials); | ||
3027 | |||
3028 | if (trials > ATA_EH_PROBE_TRIALS) | ||
3029 | sata_down_spd_limit(link, 1); | ||
3030 | |||
2965 | return 1; | 3031 | return 1; |
2966 | } | 3032 | } |
2967 | 3033 | ||
@@ -2969,7 +3035,11 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err) | |||
2969 | { | 3035 | { |
2970 | struct ata_eh_context *ehc = &dev->link->eh_context; | 3036 | struct ata_eh_context *ehc = &dev->link->eh_context; |
2971 | 3037 | ||
2972 | ehc->tries[dev->devno]--; | 3038 | /* -EAGAIN from EH routine indicates retry without prejudice. |
3039 | * The requester is responsible for ensuring forward progress. | ||
3040 | */ | ||
3041 | if (err != -EAGAIN) | ||
3042 | ehc->tries[dev->devno]--; | ||
2973 | 3043 | ||
2974 | switch (err) { | 3044 | switch (err) { |
2975 | case -ENODEV: | 3045 | case -ENODEV: |
@@ -2979,12 +3049,13 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err) | |||
2979 | /* give it just one more chance */ | 3049 | /* give it just one more chance */ |
2980 | ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1); | 3050 | ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1); |
2981 | case -EIO: | 3051 | case -EIO: |
2982 | if (ehc->tries[dev->devno] == 1 && dev->pio_mode > XFER_PIO_0) { | 3052 | if (ehc->tries[dev->devno] == 1) { |
2983 | /* This is the last chance, better to slow | 3053 | /* This is the last chance, better to slow |
2984 | * down than lose it. | 3054 | * down than lose it. |
2985 | */ | 3055 | */ |
2986 | sata_down_spd_limit(ata_dev_phys_link(dev)); | 3056 | sata_down_spd_limit(ata_dev_phys_link(dev), 0); |
2987 | ata_down_xfermask_limit(dev, ATA_DNXFER_PIO); | 3057 | if (dev->pio_mode > XFER_PIO_0) |
3058 | ata_down_xfermask_limit(dev, ATA_DNXFER_PIO); | ||
2988 | } | 3059 | } |
2989 | } | 3060 | } |
2990 | 3061 | ||
diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c index 98ca07a2db8..619f2c33950 100644 --- a/drivers/ata/libata-pmp.c +++ b/drivers/ata/libata-pmp.c | |||
@@ -729,7 +729,7 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap, | |||
729 | if (tries) { | 729 | if (tries) { |
730 | /* consecutive revalidation failures? speed down */ | 730 | /* consecutive revalidation failures? speed down */ |
731 | if (reval_failed) | 731 | if (reval_failed) |
732 | sata_down_spd_limit(link); | 732 | sata_down_spd_limit(link, 0); |
733 | else | 733 | else |
734 | reval_failed = 1; | 734 | reval_failed = 1; |
735 | 735 | ||
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index a1a6e6298c3..b9747fa59e5 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <linux/libata.h> | 46 | #include <linux/libata.h> |
47 | #include <linux/hdreg.h> | 47 | #include <linux/hdreg.h> |
48 | #include <linux/uaccess.h> | 48 | #include <linux/uaccess.h> |
49 | #include <linux/suspend.h> | ||
49 | 50 | ||
50 | #include "libata.h" | 51 | #include "libata.h" |
51 | 52 | ||
@@ -414,6 +415,7 @@ int ata_std_bios_param(struct scsi_device *sdev, struct block_device *bdev, | |||
414 | 415 | ||
415 | /** | 416 | /** |
416 | * ata_get_identity - Handler for HDIO_GET_IDENTITY ioctl | 417 | * ata_get_identity - Handler for HDIO_GET_IDENTITY ioctl |
418 | * @ap: target port | ||
417 | * @sdev: SCSI device to get identify data for | 419 | * @sdev: SCSI device to get identify data for |
418 | * @arg: User buffer area for identify data | 420 | * @arg: User buffer area for identify data |
419 | * | 421 | * |
@@ -1303,6 +1305,17 @@ static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc) | |||
1303 | 1305 | ||
1304 | tf->command = ATA_CMD_VERIFY; /* READ VERIFY */ | 1306 | tf->command = ATA_CMD_VERIFY; /* READ VERIFY */ |
1305 | } else { | 1307 | } else { |
1308 | /* Some odd clown BIOSen issue spindown on power off (ACPI S4 | ||
1309 | * or S5) causing some drives to spin up and down again. | ||
1310 | */ | ||
1311 | if ((qc->ap->flags & ATA_FLAG_NO_POWEROFF_SPINDOWN) && | ||
1312 | system_state == SYSTEM_POWER_OFF) | ||
1313 | goto skip; | ||
1314 | |||
1315 | if ((qc->ap->flags & ATA_FLAG_NO_HIBERNATE_SPINDOWN) && | ||
1316 | system_entering_hibernation()) | ||
1317 | goto skip; | ||
1318 | |||
1306 | /* XXX: This is for backward compatibility, will be | 1319 | /* XXX: This is for backward compatibility, will be |
1307 | * removed. Read Documentation/feature-removal-schedule.txt | 1320 | * removed. Read Documentation/feature-removal-schedule.txt |
1308 | * for more info. | 1321 | * for more info. |
@@ -1326,8 +1339,7 @@ static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc) | |||
1326 | scmd->scsi_done = qc->scsidone; | 1339 | scmd->scsi_done = qc->scsidone; |
1327 | qc->scsidone = ata_delayed_done; | 1340 | qc->scsidone = ata_delayed_done; |
1328 | } | 1341 | } |
1329 | scmd->result = SAM_STAT_GOOD; | 1342 | goto skip; |
1330 | return 1; | ||
1331 | } | 1343 | } |
1332 | 1344 | ||
1333 | /* Issue ATA STANDBY IMMEDIATE command */ | 1345 | /* Issue ATA STANDBY IMMEDIATE command */ |
@@ -1343,10 +1355,13 @@ static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc) | |||
1343 | 1355 | ||
1344 | return 0; | 1356 | return 0; |
1345 | 1357 | ||
1346 | invalid_fld: | 1358 | invalid_fld: |
1347 | ata_scsi_set_sense(scmd, ILLEGAL_REQUEST, 0x24, 0x0); | 1359 | ata_scsi_set_sense(scmd, ILLEGAL_REQUEST, 0x24, 0x0); |
1348 | /* "Invalid field in cbd" */ | 1360 | /* "Invalid field in cbd" */ |
1349 | return 1; | 1361 | return 1; |
1362 | skip: | ||
1363 | scmd->result = SAM_STAT_GOOD; | ||
1364 | return 1; | ||
1350 | } | 1365 | } |
1351 | 1366 | ||
1352 | 1367 | ||
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 5a4aad123c4..0b299b0f817 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -1322,7 +1322,7 @@ fsm_start: | |||
1322 | * condition. Mark hint. | 1322 | * condition. Mark hint. |
1323 | */ | 1323 | */ |
1324 | ata_ehi_push_desc(ehi, "ST-ATA: " | 1324 | ata_ehi_push_desc(ehi, "ST-ATA: " |
1325 | "DRQ=1 with device error, " | 1325 | "DRQ=0 without device error, " |
1326 | "dev_stat 0x%X", status); | 1326 | "dev_stat 0x%X", status); |
1327 | qc->err_mask |= AC_ERR_HSM | | 1327 | qc->err_mask |= AC_ERR_HSM | |
1328 | AC_ERR_NODEV_HINT; | 1328 | AC_ERR_NODEV_HINT; |
@@ -1358,6 +1358,16 @@ fsm_start: | |||
1358 | qc->err_mask |= AC_ERR_HSM; | 1358 | qc->err_mask |= AC_ERR_HSM; |
1359 | } | 1359 | } |
1360 | 1360 | ||
1361 | /* There are oddball controllers with | ||
1362 | * status register stuck at 0x7f and | ||
1363 | * lbal/m/h at zero which makes it | ||
1364 | * pass all other presence detection | ||
1365 | * mechanisms we have. Set NODEV_HINT | ||
1366 | * for it. Kernel bz#7241. | ||
1367 | */ | ||
1368 | if (status == 0x7f) | ||
1369 | qc->err_mask |= AC_ERR_NODEV_HINT; | ||
1370 | |||
1361 | /* ata_pio_sectors() might change the | 1371 | /* ata_pio_sectors() might change the |
1362 | * state to HSM_ST_LAST. so, the state | 1372 | * state to HSM_ST_LAST. so, the state |
1363 | * is changed after ata_pio_sectors(). | 1373 | * is changed after ata_pio_sectors(). |
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index fe2839e5877..cea8014cd87 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h | |||
@@ -79,7 +79,6 @@ extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, | |||
79 | u64 block, u32 n_block, unsigned int tf_flags, | 79 | u64 block, u32 n_block, unsigned int tf_flags, |
80 | unsigned int tag); | 80 | unsigned int tag); |
81 | extern u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev); | 81 | extern u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev); |
82 | extern void ata_dev_disable(struct ata_device *dev); | ||
83 | extern void ata_pio_queue_task(struct ata_port *ap, void *data, | 82 | extern void ata_pio_queue_task(struct ata_port *ap, void *data, |
84 | unsigned long delay); | 83 | unsigned long delay); |
85 | extern void ata_port_flush_task(struct ata_port *ap); | 84 | extern void ata_port_flush_task(struct ata_port *ap); |
@@ -100,7 +99,7 @@ extern int ata_dev_reread_id(struct ata_device *dev, unsigned int readid_flags); | |||
100 | extern int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class, | 99 | extern int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class, |
101 | unsigned int readid_flags); | 100 | unsigned int readid_flags); |
102 | extern int ata_dev_configure(struct ata_device *dev); | 101 | extern int ata_dev_configure(struct ata_device *dev); |
103 | extern int sata_down_spd_limit(struct ata_link *link); | 102 | extern int sata_down_spd_limit(struct ata_link *link, u32 spd_limit); |
104 | extern int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel); | 103 | extern int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel); |
105 | extern void ata_sg_clean(struct ata_queued_cmd *qc); | 104 | extern void ata_sg_clean(struct ata_queued_cmd *qc); |
106 | extern void ata_qc_free(struct ata_queued_cmd *qc); | 105 | extern void ata_qc_free(struct ata_queued_cmd *qc); |
@@ -160,6 +159,7 @@ extern void ata_scsi_error(struct Scsi_Host *host); | |||
160 | extern void ata_port_wait_eh(struct ata_port *ap); | 159 | extern void ata_port_wait_eh(struct ata_port *ap); |
161 | extern void ata_eh_fastdrain_timerfn(unsigned long arg); | 160 | extern void ata_eh_fastdrain_timerfn(unsigned long arg); |
162 | extern void ata_qc_schedule_eh(struct ata_queued_cmd *qc); | 161 | extern void ata_qc_schedule_eh(struct ata_queued_cmd *qc); |
162 | extern void ata_dev_disable(struct ata_device *dev); | ||
163 | extern void ata_eh_detach_dev(struct ata_device *dev); | 163 | extern void ata_eh_detach_dev(struct ata_device *dev); |
164 | extern void ata_eh_about_to_do(struct ata_link *link, struct ata_device *dev, | 164 | extern void ata_eh_about_to_do(struct ata_link *link, struct ata_device *dev, |
165 | unsigned int action); | 165 | unsigned int action); |
diff --git a/drivers/ata/pata_rb532_cf.c b/drivers/ata/pata_rb532_cf.c index c2e6fb9f2ef..ebfcda26d63 100644 --- a/drivers/ata/pata_rb532_cf.c +++ b/drivers/ata/pata_rb532_cf.c | |||
@@ -63,8 +63,6 @@ static inline void rb532_pata_finish_io(struct ata_port *ap) | |||
63 | ata_sff_sync might be sufficient. */ | 63 | ata_sff_sync might be sufficient. */ |
64 | ata_sff_dma_pause(ap); | 64 | ata_sff_dma_pause(ap); |
65 | ndelay(RB500_CF_IO_DELAY); | 65 | ndelay(RB500_CF_IO_DELAY); |
66 | |||
67 | set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH); | ||
68 | } | 66 | } |
69 | 67 | ||
70 | static void rb532_pata_exec_command(struct ata_port *ap, | 68 | static void rb532_pata_exec_command(struct ata_port *ap, |
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c index 681169c9c64..79a6c9a0b72 100644 --- a/drivers/ata/pata_via.c +++ b/drivers/ata/pata_via.c | |||
@@ -86,6 +86,10 @@ enum { | |||
86 | VIA_SATA_PATA = 0x800, /* SATA/PATA combined configuration */ | 86 | VIA_SATA_PATA = 0x800, /* SATA/PATA combined configuration */ |
87 | }; | 87 | }; |
88 | 88 | ||
89 | enum { | ||
90 | VIA_IDFLAG_SINGLE = (1 << 0), /* single channel controller) */ | ||
91 | }; | ||
92 | |||
89 | /* | 93 | /* |
90 | * VIA SouthBridge chips. | 94 | * VIA SouthBridge chips. |
91 | */ | 95 | */ |
@@ -97,8 +101,12 @@ static const struct via_isa_bridge { | |||
97 | u8 rev_max; | 101 | u8 rev_max; |
98 | u16 flags; | 102 | u16 flags; |
99 | } via_isa_bridges[] = { | 103 | } via_isa_bridges[] = { |
104 | { "vx855", PCI_DEVICE_ID_VIA_VX855, 0x00, 0x2f, | ||
105 | VIA_UDMA_133 | VIA_BAD_AST | VIA_SATA_PATA }, | ||
100 | { "vx800", PCI_DEVICE_ID_VIA_VX800, 0x00, 0x2f, VIA_UDMA_133 | | 106 | { "vx800", PCI_DEVICE_ID_VIA_VX800, 0x00, 0x2f, VIA_UDMA_133 | |
101 | VIA_BAD_AST | VIA_SATA_PATA }, | 107 | VIA_BAD_AST | VIA_SATA_PATA }, |
108 | { "vt8261", PCI_DEVICE_ID_VIA_8261, 0x00, 0x2f, | ||
109 | VIA_UDMA_133 | VIA_BAD_AST }, | ||
102 | { "vt8237s", PCI_DEVICE_ID_VIA_8237S, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 110 | { "vt8237s", PCI_DEVICE_ID_VIA_8237S, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, |
103 | { "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 }, |
104 | { "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 }, |
@@ -122,6 +130,8 @@ static const struct via_isa_bridge { | |||
122 | { "vt82c586", PCI_DEVICE_ID_VIA_82C586_0, 0x00, 0x0f, VIA_UDMA_NONE | VIA_SET_FIFO }, | 130 | { "vt82c586", PCI_DEVICE_ID_VIA_82C586_0, 0x00, 0x0f, VIA_UDMA_NONE | VIA_SET_FIFO }, |
123 | { "vt82c576", PCI_DEVICE_ID_VIA_82C576, 0x00, 0x2f, VIA_UDMA_NONE | VIA_SET_FIFO | VIA_NO_UNMASK }, | 131 | { "vt82c576", PCI_DEVICE_ID_VIA_82C576, 0x00, 0x2f, VIA_UDMA_NONE | VIA_SET_FIFO | VIA_NO_UNMASK }, |
124 | { "vt82c576", PCI_DEVICE_ID_VIA_82C576, 0x00, 0x2f, VIA_UDMA_NONE | VIA_SET_FIFO | VIA_NO_UNMASK | VIA_BAD_ID }, | 132 | { "vt82c576", PCI_DEVICE_ID_VIA_82C576, 0x00, 0x2f, VIA_UDMA_NONE | VIA_SET_FIFO | VIA_NO_UNMASK | VIA_BAD_ID }, |
133 | { "vtxxxx", PCI_DEVICE_ID_VIA_ANON, 0x00, 0x2f, | ||
134 | VIA_UDMA_133 | VIA_BAD_AST }, | ||
125 | { NULL } | 135 | { NULL } |
126 | }; | 136 | }; |
127 | 137 | ||
@@ -460,6 +470,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
460 | static int printed_version; | 470 | static int printed_version; |
461 | u8 enable; | 471 | u8 enable; |
462 | u32 timing; | 472 | u32 timing; |
473 | unsigned long flags = id->driver_data; | ||
463 | int rc; | 474 | int rc; |
464 | 475 | ||
465 | if (!printed_version++) | 476 | if (!printed_version++) |
@@ -469,9 +480,13 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
469 | if (rc) | 480 | if (rc) |
470 | return rc; | 481 | return rc; |
471 | 482 | ||
483 | if (flags & VIA_IDFLAG_SINGLE) | ||
484 | ppi[1] = &ata_dummy_port_info; | ||
485 | |||
472 | /* To find out how the IDE will behave and what features we | 486 | /* To find out how the IDE will behave and what features we |
473 | actually have to look at the bridge not the IDE controller */ | 487 | actually have to look at the bridge not the IDE controller */ |
474 | for (config = via_isa_bridges; config->id; config++) | 488 | for (config = via_isa_bridges; config->id != PCI_DEVICE_ID_VIA_ANON; |
489 | config++) | ||
475 | if ((isa = pci_get_device(PCI_VENDOR_ID_VIA + | 490 | if ((isa = pci_get_device(PCI_VENDOR_ID_VIA + |
476 | !!(config->flags & VIA_BAD_ID), | 491 | !!(config->flags & VIA_BAD_ID), |
477 | config->id, NULL))) { | 492 | config->id, NULL))) { |
@@ -482,10 +497,6 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
482 | pci_dev_put(isa); | 497 | pci_dev_put(isa); |
483 | } | 498 | } |
484 | 499 | ||
485 | if (!config->id) { | ||
486 | printk(KERN_WARNING "via: Unknown VIA SouthBridge, disabling.\n"); | ||
487 | return -ENODEV; | ||
488 | } | ||
489 | pci_dev_put(isa); | 500 | pci_dev_put(isa); |
490 | 501 | ||
491 | if (!(config->flags & VIA_NO_ENABLES)) { | 502 | if (!(config->flags & VIA_NO_ENABLES)) { |
@@ -587,6 +598,7 @@ static const struct pci_device_id via[] = { | |||
587 | { PCI_VDEVICE(VIA, 0x1571), }, | 598 | { PCI_VDEVICE(VIA, 0x1571), }, |
588 | { PCI_VDEVICE(VIA, 0x3164), }, | 599 | { PCI_VDEVICE(VIA, 0x3164), }, |
589 | { PCI_VDEVICE(VIA, 0x5324), }, | 600 | { PCI_VDEVICE(VIA, 0x5324), }, |
601 | { PCI_VDEVICE(VIA, 0xC409), VIA_IDFLAG_SINGLE }, | ||
590 | 602 | ||
591 | { }, | 603 | { }, |
592 | }; | 604 | }; |
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index 86918634a4c..4ae1a4138b4 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -33,10 +33,6 @@ | |||
33 | * | 33 | * |
34 | * --> ATAPI support (Marvell claims the 60xx/70xx chips can do it). | 34 | * --> ATAPI support (Marvell claims the 60xx/70xx chips can do it). |
35 | * | 35 | * |
36 | * --> Investigate problems with PCI Message Signalled Interrupts (MSI). | ||
37 | * | ||
38 | * --> Cache frequently-accessed registers in mv_port_priv to reduce overhead. | ||
39 | * | ||
40 | * --> Develop a low-power-consumption strategy, and implement it. | 36 | * --> Develop a low-power-consumption strategy, and implement it. |
41 | * | 37 | * |
42 | * --> [Experiment, low priority] Investigate interrupt coalescing. | 38 | * --> [Experiment, low priority] Investigate interrupt coalescing. |
@@ -72,7 +68,7 @@ | |||
72 | #include <linux/libata.h> | 68 | #include <linux/libata.h> |
73 | 69 | ||
74 | #define DRV_NAME "sata_mv" | 70 | #define DRV_NAME "sata_mv" |
75 | #define DRV_VERSION "1.24" | 71 | #define DRV_VERSION "1.25" |
76 | 72 | ||
77 | enum { | 73 | enum { |
78 | /* BAR's are enumerated in terms of pci_resource_start() terms */ | 74 | /* BAR's are enumerated in terms of pci_resource_start() terms */ |
@@ -351,8 +347,6 @@ enum { | |||
351 | 347 | ||
352 | EDMA_HALTCOND_OFS = 0x60, /* GenIIe halt conditions */ | 348 | EDMA_HALTCOND_OFS = 0x60, /* GenIIe halt conditions */ |
353 | 349 | ||
354 | GEN_II_NCQ_MAX_SECTORS = 256, /* max sects/io on Gen2 w/NCQ */ | ||
355 | |||
356 | /* Host private flags (hp_flags) */ | 350 | /* Host private flags (hp_flags) */ |
357 | MV_HP_FLAG_MSI = (1 << 0), | 351 | MV_HP_FLAG_MSI = (1 << 0), |
358 | MV_HP_ERRATA_50XXB0 = (1 << 1), | 352 | MV_HP_ERRATA_50XXB0 = (1 << 1), |
@@ -669,8 +663,8 @@ static const struct pci_device_id mv_pci_tbl[] = { | |||
669 | { PCI_VDEVICE(MARVELL, 0x5081), chip_508x }, | 663 | { PCI_VDEVICE(MARVELL, 0x5081), chip_508x }, |
670 | /* RocketRAID 1720/174x have different identifiers */ | 664 | /* RocketRAID 1720/174x have different identifiers */ |
671 | { PCI_VDEVICE(TTI, 0x1720), chip_6042 }, | 665 | { PCI_VDEVICE(TTI, 0x1720), chip_6042 }, |
672 | { PCI_VDEVICE(TTI, 0x1740), chip_508x }, | 666 | { PCI_VDEVICE(TTI, 0x1740), chip_6042 }, |
673 | { PCI_VDEVICE(TTI, 0x1742), chip_508x }, | 667 | { PCI_VDEVICE(TTI, 0x1742), chip_6042 }, |
674 | 668 | ||
675 | { PCI_VDEVICE(MARVELL, 0x6040), chip_604x }, | 669 | { PCI_VDEVICE(MARVELL, 0x6040), chip_604x }, |
676 | { PCI_VDEVICE(MARVELL, 0x6041), chip_604x }, | 670 | { PCI_VDEVICE(MARVELL, 0x6041), chip_604x }, |
@@ -883,19 +877,15 @@ static void mv_start_dma(struct ata_port *ap, void __iomem *port_mmio, | |||
883 | struct mv_host_priv *hpriv = ap->host->private_data; | 877 | struct mv_host_priv *hpriv = ap->host->private_data; |
884 | int hardport = mv_hardport_from_port(ap->port_no); | 878 | int hardport = mv_hardport_from_port(ap->port_no); |
885 | void __iomem *hc_mmio = mv_hc_base_from_port( | 879 | void __iomem *hc_mmio = mv_hc_base_from_port( |
886 | mv_host_base(ap->host), hardport); | 880 | mv_host_base(ap->host), ap->port_no); |
887 | u32 hc_irq_cause, ipending; | 881 | u32 hc_irq_cause; |
888 | 882 | ||
889 | /* clear EDMA event indicators, if any */ | 883 | /* clear EDMA event indicators, if any */ |
890 | writelfl(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); | 884 | writelfl(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); |
891 | 885 | ||
892 | /* clear EDMA interrupt indicator, if any */ | 886 | /* clear pending irq events */ |
893 | hc_irq_cause = readl(hc_mmio + HC_IRQ_CAUSE_OFS); | 887 | hc_irq_cause = ~((DEV_IRQ | DMA_IRQ) << hardport); |
894 | ipending = (DEV_IRQ | DMA_IRQ) << hardport; | 888 | writelfl(hc_irq_cause, hc_mmio + HC_IRQ_CAUSE_OFS); |
895 | if (hc_irq_cause & ipending) { | ||
896 | writelfl(hc_irq_cause & ~ipending, | ||
897 | hc_mmio + HC_IRQ_CAUSE_OFS); | ||
898 | } | ||
899 | 889 | ||
900 | mv_edma_cfg(ap, want_ncq); | 890 | mv_edma_cfg(ap, want_ncq); |
901 | 891 | ||
@@ -1099,20 +1089,12 @@ static void mv6_dev_config(struct ata_device *adev) | |||
1099 | * | 1089 | * |
1100 | * Gen-II does not support NCQ over a port multiplier | 1090 | * Gen-II does not support NCQ over a port multiplier |
1101 | * (no FIS-based switching). | 1091 | * (no FIS-based switching). |
1102 | * | ||
1103 | * We don't have hob_nsect when doing NCQ commands on Gen-II. | ||
1104 | * See mv_qc_prep() for more info. | ||
1105 | */ | 1092 | */ |
1106 | if (adev->flags & ATA_DFLAG_NCQ) { | 1093 | if (adev->flags & ATA_DFLAG_NCQ) { |
1107 | if (sata_pmp_attached(adev->link->ap)) { | 1094 | if (sata_pmp_attached(adev->link->ap)) { |
1108 | adev->flags &= ~ATA_DFLAG_NCQ; | 1095 | adev->flags &= ~ATA_DFLAG_NCQ; |
1109 | ata_dev_printk(adev, KERN_INFO, | 1096 | ata_dev_printk(adev, KERN_INFO, |
1110 | "NCQ disabled for command-based switching\n"); | 1097 | "NCQ disabled for command-based switching\n"); |
1111 | } else if (adev->max_sectors > GEN_II_NCQ_MAX_SECTORS) { | ||
1112 | adev->max_sectors = GEN_II_NCQ_MAX_SECTORS; | ||
1113 | ata_dev_printk(adev, KERN_INFO, | ||
1114 | "max_sectors limited to %u for NCQ\n", | ||
1115 | adev->max_sectors); | ||
1116 | } | 1098 | } |
1117 | } | 1099 | } |
1118 | } | 1100 | } |
@@ -1450,7 +1432,8 @@ static void mv_qc_prep(struct ata_queued_cmd *qc) | |||
1450 | * only 11 bytes...so we must pick and choose required | 1432 | * only 11 bytes...so we must pick and choose required |
1451 | * registers based on the command. So, we drop feature and | 1433 | * registers based on the command. So, we drop feature and |
1452 | * hob_feature for [RW] DMA commands, but they are needed for | 1434 | * hob_feature for [RW] DMA commands, but they are needed for |
1453 | * NCQ. NCQ will drop hob_nsect. | 1435 | * NCQ. NCQ will drop hob_nsect, which is not needed there |
1436 | * (nsect is used only for the tag; feat/hob_feat hold true nsect). | ||
1454 | */ | 1437 | */ |
1455 | switch (tf->command) { | 1438 | switch (tf->command) { |
1456 | case ATA_CMD_READ: | 1439 | case ATA_CMD_READ: |
@@ -2214,9 +2197,15 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance) | |||
2214 | struct ata_host *host = dev_instance; | 2197 | struct ata_host *host = dev_instance; |
2215 | struct mv_host_priv *hpriv = host->private_data; | 2198 | struct mv_host_priv *hpriv = host->private_data; |
2216 | unsigned int handled = 0; | 2199 | unsigned int handled = 0; |
2200 | int using_msi = hpriv->hp_flags & MV_HP_FLAG_MSI; | ||
2217 | u32 main_irq_cause, pending_irqs; | 2201 | u32 main_irq_cause, pending_irqs; |
2218 | 2202 | ||
2219 | spin_lock(&host->lock); | 2203 | spin_lock(&host->lock); |
2204 | |||
2205 | /* for MSI: block new interrupts while in here */ | ||
2206 | if (using_msi) | ||
2207 | writel(0, hpriv->main_irq_mask_addr); | ||
2208 | |||
2220 | main_irq_cause = readl(hpriv->main_irq_cause_addr); | 2209 | main_irq_cause = readl(hpriv->main_irq_cause_addr); |
2221 | pending_irqs = main_irq_cause & hpriv->main_irq_mask; | 2210 | pending_irqs = main_irq_cause & hpriv->main_irq_mask; |
2222 | /* | 2211 | /* |
@@ -2230,6 +2219,11 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance) | |||
2230 | handled = mv_host_intr(host, pending_irqs); | 2219 | handled = mv_host_intr(host, pending_irqs); |
2231 | } | 2220 | } |
2232 | spin_unlock(&host->lock); | 2221 | spin_unlock(&host->lock); |
2222 | |||
2223 | /* for MSI: unmask; interrupt cause bits will retrigger now */ | ||
2224 | if (using_msi) | ||
2225 | writel(hpriv->main_irq_mask, hpriv->main_irq_mask_addr); | ||
2226 | |||
2233 | return IRQ_RETVAL(handled); | 2227 | return IRQ_RETVAL(handled); |
2234 | } | 2228 | } |
2235 | 2229 | ||
@@ -2821,8 +2815,7 @@ static void mv_eh_thaw(struct ata_port *ap) | |||
2821 | writel(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); | 2815 | writel(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); |
2822 | 2816 | ||
2823 | /* clear pending irq events */ | 2817 | /* clear pending irq events */ |
2824 | hc_irq_cause = readl(hc_mmio + HC_IRQ_CAUSE_OFS); | 2818 | hc_irq_cause = ~((DEV_IRQ | DMA_IRQ) << hardport); |
2825 | hc_irq_cause &= ~((DEV_IRQ | DMA_IRQ) << hardport); | ||
2826 | writelfl(hc_irq_cause, hc_mmio + HC_IRQ_CAUSE_OFS); | 2819 | writelfl(hc_irq_cause, hc_mmio + HC_IRQ_CAUSE_OFS); |
2827 | 2820 | ||
2828 | mv_enable_port_irqs(ap, ERR_IRQ); | 2821 | mv_enable_port_irqs(ap, ERR_IRQ); |
@@ -3075,6 +3068,9 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx) | |||
3075 | hpriv->main_irq_mask_addr = mmio + PCI_HC_MAIN_IRQ_MASK_OFS; | 3068 | hpriv->main_irq_mask_addr = mmio + PCI_HC_MAIN_IRQ_MASK_OFS; |
3076 | } | 3069 | } |
3077 | 3070 | ||
3071 | /* initialize shadow irq mask with register's value */ | ||
3072 | hpriv->main_irq_mask = readl(hpriv->main_irq_mask_addr); | ||
3073 | |||
3078 | /* global interrupt mask: 0 == mask everything */ | 3074 | /* global interrupt mask: 0 == mask everything */ |
3079 | mv_set_main_irq_mask(host, ~0, 0); | 3075 | mv_set_main_irq_mask(host, ~0, 0); |
3080 | 3076 | ||
@@ -3430,9 +3426,9 @@ static int mv_pci_init_one(struct pci_dev *pdev, | |||
3430 | if (rc) | 3426 | if (rc) |
3431 | return rc; | 3427 | return rc; |
3432 | 3428 | ||
3433 | /* Enable interrupts */ | 3429 | /* Enable message-switched interrupts, if requested */ |
3434 | if (msi && pci_enable_msi(pdev)) | 3430 | if (msi && pci_enable_msi(pdev) == 0) |
3435 | pci_intx(pdev, 1); | 3431 | hpriv->hp_flags |= MV_HP_FLAG_MSI; |
3436 | 3432 | ||
3437 | mv_dump_pci_cfg(pdev, 0x68); | 3433 | mv_dump_pci_cfg(pdev, 0x68); |
3438 | mv_print_info(host); | 3434 | mv_print_info(host); |
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index 6f146061432..444af0415ca 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
@@ -305,10 +305,10 @@ static irqreturn_t nv_ck804_interrupt(int irq, void *dev_instance); | |||
305 | static int nv_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); | 305 | static int nv_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); |
306 | static int nv_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); | 306 | static int nv_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); |
307 | 307 | ||
308 | static int nv_noclassify_hardreset(struct ata_link *link, unsigned int *class, | ||
309 | unsigned long deadline); | ||
308 | static void nv_nf2_freeze(struct ata_port *ap); | 310 | static void nv_nf2_freeze(struct ata_port *ap); |
309 | static void nv_nf2_thaw(struct ata_port *ap); | 311 | static void nv_nf2_thaw(struct ata_port *ap); |
310 | static int nv_nf2_hardreset(struct ata_link *link, unsigned int *class, | ||
311 | unsigned long deadline); | ||
312 | static void nv_ck804_freeze(struct ata_port *ap); | 312 | static void nv_ck804_freeze(struct ata_port *ap); |
313 | static void nv_ck804_thaw(struct ata_port *ap); | 313 | static void nv_ck804_thaw(struct ata_port *ap); |
314 | static int nv_adma_slave_config(struct scsi_device *sdev); | 314 | static int nv_adma_slave_config(struct scsi_device *sdev); |
@@ -352,6 +352,7 @@ enum nv_host_type | |||
352 | NFORCE3 = NFORCE2, /* NF2 == NF3 as far as sata_nv is concerned */ | 352 | NFORCE3 = NFORCE2, /* NF2 == NF3 as far as sata_nv is concerned */ |
353 | CK804, | 353 | CK804, |
354 | ADMA, | 354 | ADMA, |
355 | MCP5x, | ||
355 | SWNCQ, | 356 | SWNCQ, |
356 | }; | 357 | }; |
357 | 358 | ||
@@ -363,10 +364,10 @@ static const struct pci_device_id nv_pci_tbl[] = { | |||
363 | { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA2), CK804 }, | 364 | { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA2), CK804 }, |
364 | { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA), CK804 }, | 365 | { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA), CK804 }, |
365 | { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA2), CK804 }, | 366 | { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA2), CK804 }, |
366 | { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA), SWNCQ }, | 367 | { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA), MCP5x }, |
367 | { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2), SWNCQ }, | 368 | { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2), MCP5x }, |
368 | { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA), SWNCQ }, | 369 | { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA), MCP5x }, |
369 | { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA2), SWNCQ }, | 370 | { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA2), MCP5x }, |
370 | { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA), GENERIC }, | 371 | { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA), GENERIC }, |
371 | { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA2), GENERIC }, | 372 | { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA2), GENERIC }, |
372 | { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA3), GENERIC }, | 373 | { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA3), GENERIC }, |
@@ -432,14 +433,19 @@ static struct ata_port_operations nv_nf2_ops = { | |||
432 | .inherits = &nv_common_ops, | 433 | .inherits = &nv_common_ops, |
433 | .freeze = nv_nf2_freeze, | 434 | .freeze = nv_nf2_freeze, |
434 | .thaw = nv_nf2_thaw, | 435 | .thaw = nv_nf2_thaw, |
435 | .hardreset = nv_nf2_hardreset, | 436 | .hardreset = nv_noclassify_hardreset, |
436 | }; | 437 | }; |
437 | 438 | ||
438 | /* CK804 finally gets hardreset right */ | 439 | /* For initial probing after boot and hot plugging, hardreset mostly |
440 | * works fine on CK804 but curiously, reprobing on the initial port by | ||
441 | * rescanning or rmmod/insmod fails to acquire the initial D2H Reg FIS | ||
442 | * in somewhat undeterministic way. Use noclassify hardreset. | ||
443 | */ | ||
439 | static struct ata_port_operations nv_ck804_ops = { | 444 | static struct ata_port_operations nv_ck804_ops = { |
440 | .inherits = &nv_common_ops, | 445 | .inherits = &nv_common_ops, |
441 | .freeze = nv_ck804_freeze, | 446 | .freeze = nv_ck804_freeze, |
442 | .thaw = nv_ck804_thaw, | 447 | .thaw = nv_ck804_thaw, |
448 | .hardreset = nv_noclassify_hardreset, | ||
443 | .host_stop = nv_ck804_host_stop, | 449 | .host_stop = nv_ck804_host_stop, |
444 | }; | 450 | }; |
445 | 451 | ||
@@ -467,8 +473,19 @@ static struct ata_port_operations nv_adma_ops = { | |||
467 | .host_stop = nv_adma_host_stop, | 473 | .host_stop = nv_adma_host_stop, |
468 | }; | 474 | }; |
469 | 475 | ||
476 | /* Kernel bz#12351 reports that when SWNCQ is enabled, for hotplug to | ||
477 | * work, hardreset should be used and hardreset can't report proper | ||
478 | * signature, which suggests that mcp5x is closer to nf2 as long as | ||
479 | * reset quirkiness is concerned. Define separate ops for mcp5x with | ||
480 | * nv_noclassify_hardreset(). | ||
481 | */ | ||
482 | static struct ata_port_operations nv_mcp5x_ops = { | ||
483 | .inherits = &nv_common_ops, | ||
484 | .hardreset = nv_noclassify_hardreset, | ||
485 | }; | ||
486 | |||
470 | static struct ata_port_operations nv_swncq_ops = { | 487 | static struct ata_port_operations nv_swncq_ops = { |
471 | .inherits = &nv_generic_ops, | 488 | .inherits = &nv_mcp5x_ops, |
472 | 489 | ||
473 | .qc_defer = ata_std_qc_defer, | 490 | .qc_defer = ata_std_qc_defer, |
474 | .qc_prep = nv_swncq_qc_prep, | 491 | .qc_prep = nv_swncq_qc_prep, |
@@ -531,6 +548,15 @@ static const struct ata_port_info nv_port_info[] = { | |||
531 | .port_ops = &nv_adma_ops, | 548 | .port_ops = &nv_adma_ops, |
532 | .private_data = NV_PI_PRIV(nv_adma_interrupt, &nv_adma_sht), | 549 | .private_data = NV_PI_PRIV(nv_adma_interrupt, &nv_adma_sht), |
533 | }, | 550 | }, |
551 | /* MCP5x */ | ||
552 | { | ||
553 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, | ||
554 | .pio_mask = NV_PIO_MASK, | ||
555 | .mwdma_mask = NV_MWDMA_MASK, | ||
556 | .udma_mask = NV_UDMA_MASK, | ||
557 | .port_ops = &nv_mcp5x_ops, | ||
558 | .private_data = NV_PI_PRIV(nv_generic_interrupt, &nv_sht), | ||
559 | }, | ||
534 | /* SWNCQ */ | 560 | /* SWNCQ */ |
535 | { | 561 | { |
536 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 562 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
@@ -1530,6 +1556,17 @@ static int nv_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val) | |||
1530 | return 0; | 1556 | return 0; |
1531 | } | 1557 | } |
1532 | 1558 | ||
1559 | static int nv_noclassify_hardreset(struct ata_link *link, unsigned int *class, | ||
1560 | unsigned long deadline) | ||
1561 | { | ||
1562 | bool online; | ||
1563 | int rc; | ||
1564 | |||
1565 | rc = sata_link_hardreset(link, sata_deb_timing_hotplug, deadline, | ||
1566 | &online, NULL); | ||
1567 | return online ? -EAGAIN : rc; | ||
1568 | } | ||
1569 | |||
1533 | static void nv_nf2_freeze(struct ata_port *ap) | 1570 | static void nv_nf2_freeze(struct ata_port *ap) |
1534 | { | 1571 | { |
1535 | void __iomem *scr_addr = ap->host->ports[0]->ioaddr.scr_addr; | 1572 | void __iomem *scr_addr = ap->host->ports[0]->ioaddr.scr_addr; |
@@ -1554,17 +1591,6 @@ static void nv_nf2_thaw(struct ata_port *ap) | |||
1554 | iowrite8(mask, scr_addr + NV_INT_ENABLE); | 1591 | iowrite8(mask, scr_addr + NV_INT_ENABLE); |
1555 | } | 1592 | } |
1556 | 1593 | ||
1557 | static int nv_nf2_hardreset(struct ata_link *link, unsigned int *class, | ||
1558 | unsigned long deadline) | ||
1559 | { | ||
1560 | bool online; | ||
1561 | int rc; | ||
1562 | |||
1563 | rc = sata_link_hardreset(link, sata_deb_timing_hotplug, deadline, | ||
1564 | &online, NULL); | ||
1565 | return online ? -EAGAIN : rc; | ||
1566 | } | ||
1567 | |||
1568 | static void nv_ck804_freeze(struct ata_port *ap) | 1594 | static void nv_ck804_freeze(struct ata_port *ap) |
1569 | { | 1595 | { |
1570 | void __iomem *mmio_base = ap->host->iomap[NV_MMIO_BAR]; | 1596 | void __iomem *mmio_base = ap->host->iomap[NV_MMIO_BAR]; |
@@ -2355,14 +2381,9 @@ static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2355 | if (type == CK804 && adma_enabled) { | 2381 | if (type == CK804 && adma_enabled) { |
2356 | dev_printk(KERN_NOTICE, &pdev->dev, "Using ADMA mode\n"); | 2382 | dev_printk(KERN_NOTICE, &pdev->dev, "Using ADMA mode\n"); |
2357 | type = ADMA; | 2383 | type = ADMA; |
2358 | } | 2384 | } else if (type == MCP5x && swncq_enabled) { |
2359 | 2385 | dev_printk(KERN_NOTICE, &pdev->dev, "Using SWNCQ mode\n"); | |
2360 | if (type == SWNCQ) { | 2386 | type = SWNCQ; |
2361 | if (swncq_enabled) | ||
2362 | dev_printk(KERN_NOTICE, &pdev->dev, | ||
2363 | "Using SWNCQ mode\n"); | ||
2364 | else | ||
2365 | type = GENERIC; | ||
2366 | } | 2387 | } |
2367 | 2388 | ||
2368 | ppi[0] = &nv_port_info[type]; | 2389 | ppi[0] = &nv_port_info[type]; |
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c index 564c142b03b..d0091609e21 100644 --- a/drivers/ata/sata_sil.c +++ b/drivers/ata/sata_sil.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <linux/device.h> | 44 | #include <linux/device.h> |
45 | #include <scsi/scsi_host.h> | 45 | #include <scsi/scsi_host.h> |
46 | #include <linux/libata.h> | 46 | #include <linux/libata.h> |
47 | #include <linux/dmi.h> | ||
47 | 48 | ||
48 | #define DRV_NAME "sata_sil" | 49 | #define DRV_NAME "sata_sil" |
49 | #define DRV_VERSION "2.4" | 50 | #define DRV_VERSION "2.4" |
@@ -323,7 +324,7 @@ static void sil_fill_sg(struct ata_queued_cmd *qc) | |||
323 | 324 | ||
324 | prd->addr = cpu_to_le32(addr); | 325 | prd->addr = cpu_to_le32(addr); |
325 | prd->flags_len = cpu_to_le32(sg_len); | 326 | prd->flags_len = cpu_to_le32(sg_len); |
326 | VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", pi, addr, sg_len); | 327 | VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", si, addr, sg_len); |
327 | 328 | ||
328 | last_prd = prd; | 329 | last_prd = prd; |
329 | prd++; | 330 | prd++; |
@@ -695,11 +696,38 @@ static void sil_init_controller(struct ata_host *host) | |||
695 | } | 696 | } |
696 | } | 697 | } |
697 | 698 | ||
699 | static bool sil_broken_system_poweroff(struct pci_dev *pdev) | ||
700 | { | ||
701 | static const struct dmi_system_id broken_systems[] = { | ||
702 | { | ||
703 | .ident = "HP Compaq nx6325", | ||
704 | .matches = { | ||
705 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
706 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq nx6325"), | ||
707 | }, | ||
708 | /* PCI slot number of the controller */ | ||
709 | .driver_data = (void *)0x12UL, | ||
710 | }, | ||
711 | |||
712 | { } /* terminate list */ | ||
713 | }; | ||
714 | const struct dmi_system_id *dmi = dmi_first_match(broken_systems); | ||
715 | |||
716 | if (dmi) { | ||
717 | unsigned long slot = (unsigned long)dmi->driver_data; | ||
718 | /* apply the quirk only to on-board controllers */ | ||
719 | return slot == PCI_SLOT(pdev->devfn); | ||
720 | } | ||
721 | |||
722 | return false; | ||
723 | } | ||
724 | |||
698 | static int sil_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | 725 | static int sil_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
699 | { | 726 | { |
700 | static int printed_version; | 727 | static int printed_version; |
701 | int board_id = ent->driver_data; | 728 | int board_id = ent->driver_data; |
702 | const struct ata_port_info *ppi[] = { &sil_port_info[board_id], NULL }; | 729 | struct ata_port_info pi = sil_port_info[board_id]; |
730 | const struct ata_port_info *ppi[] = { &pi, NULL }; | ||
703 | struct ata_host *host; | 731 | struct ata_host *host; |
704 | void __iomem *mmio_base; | 732 | void __iomem *mmio_base; |
705 | int n_ports, rc; | 733 | int n_ports, rc; |
@@ -713,6 +741,13 @@ static int sil_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
713 | if (board_id == sil_3114) | 741 | if (board_id == sil_3114) |
714 | n_ports = 4; | 742 | n_ports = 4; |
715 | 743 | ||
744 | if (sil_broken_system_poweroff(pdev)) { | ||
745 | pi.flags |= ATA_FLAG_NO_POWEROFF_SPINDOWN | | ||
746 | ATA_FLAG_NO_HIBERNATE_SPINDOWN; | ||
747 | dev_info(&pdev->dev, "quirky BIOS, skipping spindown " | ||
748 | "on poweroff and hibernation\n"); | ||
749 | } | ||
750 | |||
716 | host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports); | 751 | host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports); |
717 | if (!host) | 752 | if (!host) |
718 | return -ENOMEM; | 753 | return -ENOMEM; |