diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-02-03 10:39:55 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-02-03 10:39:55 -0500 |
| commit | 52a84ec2f33debc86507fe7cffd8171660457bf2 (patch) | |
| tree | 9b2ca62d6a567960384a188c18ec7dc64a036cfa /drivers | |
| parent | b1792e367053968f2ddb48bc911d314143ce6242 (diff) | |
| parent | 9062712fa9ed13b531dfc2228086650b8bd6a255 (diff) | |
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev
* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev:
libata: implement HORKAGE_1_5_GBPS and apply it to WD My Book
libata: add no penalty retry request for EH device handling routines
libata: improve probe failure handling
libata: add @spd_limit to sata_down_spd_limit()
libata: clear dev->ering in smarter way
libata: check onlineness before using SPD in sata_down_spd_limit()
libata: move ata_dev_disable() to libata-eh.c
libata: fix EH device failure handling
sata_nv: ck804 has borked hardreset too
ide/libata: fix ata_id_is_cfa() (take 4)
libata: fix kernel-doc warnings
ahci: add a module parameter to ignore the SSS flags for async scanning
sata_mv: Fix chip type for Hightpoint RocketRaid 1740/1742
[libata] sata_sil: Fix compilation error with libata debugging enabled
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/ata/ahci.c | 9 | ||||
| -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 | 1 | ||||
| -rw-r--r-- | drivers/ata/libata.h | 4 | ||||
| -rw-r--r-- | drivers/ata/sata_mv.c | 4 | ||||
| -rw-r--r-- | drivers/ata/sata_nv.c | 7 | ||||
| -rw-r--r-- | drivers/ata/sata_sil.c | 2 |
9 files changed, 172 insertions, 40 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 77bba4c083cb..a603bbf9b1b7 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); |
| @@ -2692,8 +2697,10 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 2692 | host->iomap = pcim_iomap_table(pdev); | 2697 | host->iomap = pcim_iomap_table(pdev); |
| 2693 | host->private_data = hpriv; | 2698 | host->private_data = hpriv; |
| 2694 | 2699 | ||
| 2695 | if (!(hpriv->cap & HOST_CAP_SSS)) | 2700 | if (!(hpriv->cap & HOST_CAP_SSS) || ahci_ignore_sss) |
| 2696 | 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"); | ||
| 2697 | 2704 | ||
| 2698 | if (pi.flags & ATA_FLAG_EM) | 2705 | if (pi.flags & ATA_FLAG_EM) |
| 2699 | ahci_reset_em(host); | 2706 | ahci_reset_em(host); |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 88c242856dae..9fbf0595f3d4 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 8147a8386370..ce2ef0475339 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 98ca07a2db87..619f2c33950e 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 3c4c5ae277ba..b9747fa59e54 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
| @@ -415,6 +415,7 @@ int ata_std_bios_param(struct scsi_device *sdev, struct block_device *bdev, | |||
| 415 | 415 | ||
| 416 | /** | 416 | /** |
| 417 | * ata_get_identity - Handler for HDIO_GET_IDENTITY ioctl | 417 | * ata_get_identity - Handler for HDIO_GET_IDENTITY ioctl |
| 418 | * @ap: target port | ||
| 418 | * @sdev: SCSI device to get identify data for | 419 | * @sdev: SCSI device to get identify data for |
| 419 | * @arg: User buffer area for identify data | 420 | * @arg: User buffer area for identify data |
| 420 | * | 421 | * |
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index fe2839e58774..cea8014cd87e 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/sata_mv.c b/drivers/ata/sata_mv.c index f2d8a020ea53..4ae1a4138b47 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
| @@ -663,8 +663,8 @@ static const struct pci_device_id mv_pci_tbl[] = { | |||
| 663 | { PCI_VDEVICE(MARVELL, 0x5081), chip_508x }, | 663 | { PCI_VDEVICE(MARVELL, 0x5081), chip_508x }, |
| 664 | /* RocketRAID 1720/174x have different identifiers */ | 664 | /* RocketRAID 1720/174x have different identifiers */ |
| 665 | { PCI_VDEVICE(TTI, 0x1720), chip_6042 }, | 665 | { PCI_VDEVICE(TTI, 0x1720), chip_6042 }, |
| 666 | { PCI_VDEVICE(TTI, 0x1740), chip_508x }, | 666 | { PCI_VDEVICE(TTI, 0x1740), chip_6042 }, |
| 667 | { PCI_VDEVICE(TTI, 0x1742), chip_508x }, | 667 | { PCI_VDEVICE(TTI, 0x1742), chip_6042 }, |
| 668 | 668 | ||
| 669 | { PCI_VDEVICE(MARVELL, 0x6040), chip_604x }, | 669 | { PCI_VDEVICE(MARVELL, 0x6040), chip_604x }, |
| 670 | { PCI_VDEVICE(MARVELL, 0x6041), chip_604x }, | 670 | { PCI_VDEVICE(MARVELL, 0x6041), chip_604x }, |
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index c49ad0e61b6f..444af0415ca1 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
| @@ -436,11 +436,16 @@ static struct ata_port_operations nv_nf2_ops = { | |||
| 436 | .hardreset = nv_noclassify_hardreset, | 436 | .hardreset = nv_noclassify_hardreset, |
| 437 | }; | 437 | }; |
| 438 | 438 | ||
| 439 | /* 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 | */ | ||
| 440 | static struct ata_port_operations nv_ck804_ops = { | 444 | static struct ata_port_operations nv_ck804_ops = { |
| 441 | .inherits = &nv_common_ops, | 445 | .inherits = &nv_common_ops, |
| 442 | .freeze = nv_ck804_freeze, | 446 | .freeze = nv_ck804_freeze, |
| 443 | .thaw = nv_ck804_thaw, | 447 | .thaw = nv_ck804_thaw, |
| 448 | .hardreset = nv_noclassify_hardreset, | ||
| 444 | .host_stop = nv_ck804_host_stop, | 449 | .host_stop = nv_ck804_host_stop, |
| 445 | }; | 450 | }; |
| 446 | 451 | ||
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c index 9f029595f454..d0091609e210 100644 --- a/drivers/ata/sata_sil.c +++ b/drivers/ata/sata_sil.c | |||
| @@ -324,7 +324,7 @@ static void sil_fill_sg(struct ata_queued_cmd *qc) | |||
| 324 | 324 | ||
| 325 | prd->addr = cpu_to_le32(addr); | 325 | prd->addr = cpu_to_le32(addr); |
| 326 | prd->flags_len = cpu_to_le32(sg_len); | 326 | prd->flags_len = cpu_to_le32(sg_len); |
| 327 | 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); |
| 328 | 328 | ||
| 329 | last_prd = prd; | 329 | last_prd = prd; |
| 330 | prd++; | 330 | prd++; |
