diff options
Diffstat (limited to 'drivers/ata/libata-eh.c')
-rw-r--r-- | drivers/ata/libata-eh.c | 116 |
1 files changed, 68 insertions, 48 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 32da9a93ce44..8147a8386370 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -422,7 +422,7 @@ static void ata_eh_clear_action(struct ata_link *link, struct ata_device *dev, | |||
422 | 422 | ||
423 | if (!dev) { | 423 | if (!dev) { |
424 | ehi->action &= ~action; | 424 | ehi->action &= ~action; |
425 | ata_link_for_each_dev(tdev, link) | 425 | ata_for_each_dev(tdev, link, ALL) |
426 | ehi->dev_action[tdev->devno] &= ~action; | 426 | ehi->dev_action[tdev->devno] &= ~action; |
427 | } else { | 427 | } else { |
428 | /* doesn't make sense for port-wide EH actions */ | 428 | /* doesn't make sense for port-wide EH actions */ |
@@ -430,7 +430,7 @@ static void ata_eh_clear_action(struct ata_link *link, struct ata_device *dev, | |||
430 | 430 | ||
431 | /* break ehi->action into ehi->dev_action */ | 431 | /* break ehi->action into ehi->dev_action */ |
432 | if (ehi->action & action) { | 432 | if (ehi->action & action) { |
433 | ata_link_for_each_dev(tdev, link) | 433 | ata_for_each_dev(tdev, link, ALL) |
434 | ehi->dev_action[tdev->devno] |= | 434 | ehi->dev_action[tdev->devno] |= |
435 | ehi->action & action; | 435 | ehi->action & action; |
436 | ehi->action &= ~action; | 436 | ehi->action &= ~action; |
@@ -491,6 +491,31 @@ enum blk_eh_timer_return ata_scsi_timed_out(struct scsi_cmnd *cmd) | |||
491 | return ret; | 491 | return ret; |
492 | } | 492 | } |
493 | 493 | ||
494 | static void ata_eh_unload(struct ata_port *ap) | ||
495 | { | ||
496 | struct ata_link *link; | ||
497 | struct ata_device *dev; | ||
498 | unsigned long flags; | ||
499 | |||
500 | /* Restore SControl IPM and SPD for the next driver and | ||
501 | * disable attached devices. | ||
502 | */ | ||
503 | ata_for_each_link(link, ap, PMP_FIRST) { | ||
504 | sata_scr_write(link, SCR_CONTROL, link->saved_scontrol & 0xff0); | ||
505 | ata_for_each_dev(dev, link, ALL) | ||
506 | ata_dev_disable(dev); | ||
507 | } | ||
508 | |||
509 | /* freeze and set UNLOADED */ | ||
510 | spin_lock_irqsave(ap->lock, flags); | ||
511 | |||
512 | ata_port_freeze(ap); /* won't be thawed */ | ||
513 | ap->pflags &= ~ATA_PFLAG_EH_PENDING; /* clear pending from freeze */ | ||
514 | ap->pflags |= ATA_PFLAG_UNLOADED; | ||
515 | |||
516 | spin_unlock_irqrestore(ap->lock, flags); | ||
517 | } | ||
518 | |||
494 | /** | 519 | /** |
495 | * ata_scsi_error - SCSI layer error handler callback | 520 | * ata_scsi_error - SCSI layer error handler callback |
496 | * @host: SCSI host on which error occurred | 521 | * @host: SCSI host on which error occurred |
@@ -592,7 +617,7 @@ void ata_scsi_error(struct Scsi_Host *host) | |||
592 | /* fetch & clear EH info */ | 617 | /* fetch & clear EH info */ |
593 | spin_lock_irqsave(ap->lock, flags); | 618 | spin_lock_irqsave(ap->lock, flags); |
594 | 619 | ||
595 | __ata_port_for_each_link(link, ap) { | 620 | ata_for_each_link(link, ap, HOST_FIRST) { |
596 | struct ata_eh_context *ehc = &link->eh_context; | 621 | struct ata_eh_context *ehc = &link->eh_context; |
597 | struct ata_device *dev; | 622 | struct ata_device *dev; |
598 | 623 | ||
@@ -600,12 +625,9 @@ void ata_scsi_error(struct Scsi_Host *host) | |||
600 | link->eh_context.i = link->eh_info; | 625 | link->eh_context.i = link->eh_info; |
601 | memset(&link->eh_info, 0, sizeof(link->eh_info)); | 626 | memset(&link->eh_info, 0, sizeof(link->eh_info)); |
602 | 627 | ||
603 | ata_link_for_each_dev(dev, link) { | 628 | ata_for_each_dev(dev, link, ENABLED) { |
604 | int devno = dev->devno; | 629 | int devno = dev->devno; |
605 | 630 | ||
606 | if (!ata_dev_enabled(dev)) | ||
607 | continue; | ||
608 | |||
609 | ehc->saved_xfer_mode[devno] = dev->xfer_mode; | 631 | ehc->saved_xfer_mode[devno] = dev->xfer_mode; |
610 | if (ata_ncq_enabled(dev)) | 632 | if (ata_ncq_enabled(dev)) |
611 | ehc->saved_ncq_enabled |= 1 << devno; | 633 | ehc->saved_ncq_enabled |= 1 << devno; |
@@ -621,8 +643,13 @@ void ata_scsi_error(struct Scsi_Host *host) | |||
621 | /* invoke EH, skip if unloading or suspended */ | 643 | /* invoke EH, skip if unloading or suspended */ |
622 | if (!(ap->pflags & (ATA_PFLAG_UNLOADING | ATA_PFLAG_SUSPENDED))) | 644 | if (!(ap->pflags & (ATA_PFLAG_UNLOADING | ATA_PFLAG_SUSPENDED))) |
623 | ap->ops->error_handler(ap); | 645 | ap->ops->error_handler(ap); |
624 | else | 646 | else { |
647 | /* if unloading, commence suicide */ | ||
648 | if ((ap->pflags & ATA_PFLAG_UNLOADING) && | ||
649 | !(ap->pflags & ATA_PFLAG_UNLOADED)) | ||
650 | ata_eh_unload(ap); | ||
625 | ata_eh_finish(ap); | 651 | ata_eh_finish(ap); |
652 | } | ||
626 | 653 | ||
627 | /* process port suspend request */ | 654 | /* process port suspend request */ |
628 | ata_eh_handle_port_suspend(ap); | 655 | ata_eh_handle_port_suspend(ap); |
@@ -644,7 +671,7 @@ void ata_scsi_error(struct Scsi_Host *host) | |||
644 | } | 671 | } |
645 | 672 | ||
646 | /* this run is complete, make sure EH info is clear */ | 673 | /* this run is complete, make sure EH info is clear */ |
647 | __ata_port_for_each_link(link, ap) | 674 | ata_for_each_link(link, ap, HOST_FIRST) |
648 | memset(&link->eh_info, 0, sizeof(link->eh_info)); | 675 | memset(&link->eh_info, 0, sizeof(link->eh_info)); |
649 | 676 | ||
650 | /* Clear host_eh_scheduled while holding ap->lock such | 677 | /* Clear host_eh_scheduled while holding ap->lock such |
@@ -1025,7 +1052,7 @@ int sata_async_notification(struct ata_port *ap) | |||
1025 | struct ata_link *link; | 1052 | struct ata_link *link; |
1026 | 1053 | ||
1027 | /* check and notify ATAPI AN */ | 1054 | /* check and notify ATAPI AN */ |
1028 | ata_port_for_each_link(link, ap) { | 1055 | ata_for_each_link(link, ap, EDGE) { |
1029 | if (!(sntf & (1 << link->pmp))) | 1056 | if (!(sntf & (1 << link->pmp))) |
1030 | continue; | 1057 | continue; |
1031 | 1058 | ||
@@ -2005,7 +2032,7 @@ void ata_eh_autopsy(struct ata_port *ap) | |||
2005 | { | 2032 | { |
2006 | struct ata_link *link; | 2033 | struct ata_link *link; |
2007 | 2034 | ||
2008 | ata_port_for_each_link(link, ap) | 2035 | ata_for_each_link(link, ap, EDGE) |
2009 | ata_eh_link_autopsy(link); | 2036 | ata_eh_link_autopsy(link); |
2010 | 2037 | ||
2011 | /* Handle the frigging slave link. Autopsy is done similarly | 2038 | /* Handle the frigging slave link. Autopsy is done similarly |
@@ -2219,7 +2246,7 @@ void ata_eh_report(struct ata_port *ap) | |||
2219 | { | 2246 | { |
2220 | struct ata_link *link; | 2247 | struct ata_link *link; |
2221 | 2248 | ||
2222 | __ata_port_for_each_link(link, ap) | 2249 | ata_for_each_link(link, ap, HOST_FIRST) |
2223 | ata_eh_link_report(link); | 2250 | ata_eh_link_report(link); |
2224 | } | 2251 | } |
2225 | 2252 | ||
@@ -2230,7 +2257,7 @@ static int ata_do_reset(struct ata_link *link, ata_reset_fn_t reset, | |||
2230 | struct ata_device *dev; | 2257 | struct ata_device *dev; |
2231 | 2258 | ||
2232 | if (clear_classes) | 2259 | if (clear_classes) |
2233 | ata_link_for_each_dev(dev, link) | 2260 | ata_for_each_dev(dev, link, ALL) |
2234 | classes[dev->devno] = ATA_DEV_UNKNOWN; | 2261 | classes[dev->devno] = ATA_DEV_UNKNOWN; |
2235 | 2262 | ||
2236 | return reset(link, classes, deadline); | 2263 | return reset(link, classes, deadline); |
@@ -2294,7 +2321,7 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2294 | 2321 | ||
2295 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET); | 2322 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET); |
2296 | 2323 | ||
2297 | ata_link_for_each_dev(dev, link) { | 2324 | ata_for_each_dev(dev, link, ALL) { |
2298 | /* If we issue an SRST then an ATA drive (not ATAPI) | 2325 | /* If we issue an SRST then an ATA drive (not ATAPI) |
2299 | * may change configuration and be in PIO0 timing. If | 2326 | * may change configuration and be in PIO0 timing. If |
2300 | * we do a hard reset (or are coming from power on) | 2327 | * we do a hard reset (or are coming from power on) |
@@ -2355,7 +2382,7 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2355 | "port disabled. ignoring.\n"); | 2382 | "port disabled. ignoring.\n"); |
2356 | ehc->i.action &= ~ATA_EH_RESET; | 2383 | ehc->i.action &= ~ATA_EH_RESET; |
2357 | 2384 | ||
2358 | ata_link_for_each_dev(dev, link) | 2385 | ata_for_each_dev(dev, link, ALL) |
2359 | classes[dev->devno] = ATA_DEV_NONE; | 2386 | classes[dev->devno] = ATA_DEV_NONE; |
2360 | 2387 | ||
2361 | rc = 0; | 2388 | rc = 0; |
@@ -2369,7 +2396,7 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2369 | * bang classes and return. | 2396 | * bang classes and return. |
2370 | */ | 2397 | */ |
2371 | if (reset && !(ehc->i.action & ATA_EH_RESET)) { | 2398 | if (reset && !(ehc->i.action & ATA_EH_RESET)) { |
2372 | ata_link_for_each_dev(dev, link) | 2399 | ata_for_each_dev(dev, link, ALL) |
2373 | classes[dev->devno] = ATA_DEV_NONE; | 2400 | classes[dev->devno] = ATA_DEV_NONE; |
2374 | rc = 0; | 2401 | rc = 0; |
2375 | goto out; | 2402 | goto out; |
@@ -2454,7 +2481,7 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2454 | /* | 2481 | /* |
2455 | * Post-reset processing | 2482 | * Post-reset processing |
2456 | */ | 2483 | */ |
2457 | ata_link_for_each_dev(dev, link) { | 2484 | ata_for_each_dev(dev, link, ALL) { |
2458 | /* After the reset, the device state is PIO 0 and the | 2485 | /* After the reset, the device state is PIO 0 and the |
2459 | * controller state is undefined. Reset also wakes up | 2486 | * controller state is undefined. Reset also wakes up |
2460 | * drives from sleeping mode. | 2487 | * drives from sleeping mode. |
@@ -2510,7 +2537,7 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2510 | * can be reliably detected and retried. | 2537 | * can be reliably detected and retried. |
2511 | */ | 2538 | */ |
2512 | nr_unknown = 0; | 2539 | nr_unknown = 0; |
2513 | ata_link_for_each_dev(dev, link) { | 2540 | ata_for_each_dev(dev, link, ALL) { |
2514 | /* convert all ATA_DEV_UNKNOWN to ATA_DEV_NONE */ | 2541 | /* convert all ATA_DEV_UNKNOWN to ATA_DEV_NONE */ |
2515 | if (classes[dev->devno] == ATA_DEV_UNKNOWN) { | 2542 | if (classes[dev->devno] == ATA_DEV_UNKNOWN) { |
2516 | classes[dev->devno] = ATA_DEV_NONE; | 2543 | classes[dev->devno] = ATA_DEV_NONE; |
@@ -2619,8 +2646,8 @@ static inline void ata_eh_pull_park_action(struct ata_port *ap) | |||
2619 | 2646 | ||
2620 | spin_lock_irqsave(ap->lock, flags); | 2647 | spin_lock_irqsave(ap->lock, flags); |
2621 | INIT_COMPLETION(ap->park_req_pending); | 2648 | INIT_COMPLETION(ap->park_req_pending); |
2622 | ata_port_for_each_link(link, ap) { | 2649 | ata_for_each_link(link, ap, EDGE) { |
2623 | ata_link_for_each_dev(dev, link) { | 2650 | ata_for_each_dev(dev, link, ALL) { |
2624 | struct ata_eh_info *ehi = &link->eh_info; | 2651 | struct ata_eh_info *ehi = &link->eh_info; |
2625 | 2652 | ||
2626 | link->eh_context.i.dev_action[dev->devno] |= | 2653 | link->eh_context.i.dev_action[dev->devno] |= |
@@ -2675,7 +2702,7 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link, | |||
2675 | * be done backwards such that PDIAG- is released by the slave | 2702 | * be done backwards such that PDIAG- is released by the slave |
2676 | * device before the master device is identified. | 2703 | * device before the master device is identified. |
2677 | */ | 2704 | */ |
2678 | ata_link_for_each_dev_reverse(dev, link) { | 2705 | ata_for_each_dev(dev, link, ALL_REVERSE) { |
2679 | unsigned int action = ata_eh_dev_action(dev); | 2706 | unsigned int action = ata_eh_dev_action(dev); |
2680 | unsigned int readid_flags = 0; | 2707 | unsigned int readid_flags = 0; |
2681 | 2708 | ||
@@ -2744,7 +2771,7 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link, | |||
2744 | /* Configure new devices forward such that user doesn't see | 2771 | /* Configure new devices forward such that user doesn't see |
2745 | * device detection messages backwards. | 2772 | * device detection messages backwards. |
2746 | */ | 2773 | */ |
2747 | ata_link_for_each_dev(dev, link) { | 2774 | ata_for_each_dev(dev, link, ALL) { |
2748 | if (!(new_mask & (1 << dev->devno)) || | 2775 | if (!(new_mask & (1 << dev->devno)) || |
2749 | dev->class == ATA_DEV_PMP) | 2776 | dev->class == ATA_DEV_PMP) |
2750 | continue; | 2777 | continue; |
@@ -2793,10 +2820,7 @@ int ata_set_mode(struct ata_link *link, struct ata_device **r_failed_dev) | |||
2793 | int rc; | 2820 | int rc; |
2794 | 2821 | ||
2795 | /* if data transfer is verified, clear DUBIOUS_XFER on ering top */ | 2822 | /* if data transfer is verified, clear DUBIOUS_XFER on ering top */ |
2796 | ata_link_for_each_dev(dev, link) { | 2823 | ata_for_each_dev(dev, link, ENABLED) { |
2797 | if (!ata_dev_enabled(dev)) | ||
2798 | continue; | ||
2799 | |||
2800 | if (!(dev->flags & ATA_DFLAG_DUBIOUS_XFER)) { | 2824 | if (!(dev->flags & ATA_DFLAG_DUBIOUS_XFER)) { |
2801 | struct ata_ering_entry *ent; | 2825 | struct ata_ering_entry *ent; |
2802 | 2826 | ||
@@ -2813,14 +2837,11 @@ int ata_set_mode(struct ata_link *link, struct ata_device **r_failed_dev) | |||
2813 | rc = ata_do_set_mode(link, r_failed_dev); | 2837 | rc = ata_do_set_mode(link, r_failed_dev); |
2814 | 2838 | ||
2815 | /* if transfer mode has changed, set DUBIOUS_XFER on device */ | 2839 | /* if transfer mode has changed, set DUBIOUS_XFER on device */ |
2816 | ata_link_for_each_dev(dev, link) { | 2840 | ata_for_each_dev(dev, link, ENABLED) { |
2817 | struct ata_eh_context *ehc = &link->eh_context; | 2841 | struct ata_eh_context *ehc = &link->eh_context; |
2818 | u8 saved_xfer_mode = ehc->saved_xfer_mode[dev->devno]; | 2842 | u8 saved_xfer_mode = ehc->saved_xfer_mode[dev->devno]; |
2819 | u8 saved_ncq = !!(ehc->saved_ncq_enabled & (1 << dev->devno)); | 2843 | u8 saved_ncq = !!(ehc->saved_ncq_enabled & (1 << dev->devno)); |
2820 | 2844 | ||
2821 | if (!ata_dev_enabled(dev)) | ||
2822 | continue; | ||
2823 | |||
2824 | if (dev->xfer_mode != saved_xfer_mode || | 2845 | if (dev->xfer_mode != saved_xfer_mode || |
2825 | ata_ncq_enabled(dev) != saved_ncq) | 2846 | ata_ncq_enabled(dev) != saved_ncq) |
2826 | dev->flags |= ATA_DFLAG_DUBIOUS_XFER; | 2847 | dev->flags |= ATA_DFLAG_DUBIOUS_XFER; |
@@ -2881,9 +2902,8 @@ static int ata_link_nr_enabled(struct ata_link *link) | |||
2881 | struct ata_device *dev; | 2902 | struct ata_device *dev; |
2882 | int cnt = 0; | 2903 | int cnt = 0; |
2883 | 2904 | ||
2884 | ata_link_for_each_dev(dev, link) | 2905 | ata_for_each_dev(dev, link, ENABLED) |
2885 | if (ata_dev_enabled(dev)) | 2906 | cnt++; |
2886 | cnt++; | ||
2887 | return cnt; | 2907 | return cnt; |
2888 | } | 2908 | } |
2889 | 2909 | ||
@@ -2892,7 +2912,7 @@ static int ata_link_nr_vacant(struct ata_link *link) | |||
2892 | struct ata_device *dev; | 2912 | struct ata_device *dev; |
2893 | int cnt = 0; | 2913 | int cnt = 0; |
2894 | 2914 | ||
2895 | ata_link_for_each_dev(dev, link) | 2915 | ata_for_each_dev(dev, link, ALL) |
2896 | if (dev->class == ATA_DEV_UNKNOWN) | 2916 | if (dev->class == ATA_DEV_UNKNOWN) |
2897 | cnt++; | 2917 | cnt++; |
2898 | return cnt; | 2918 | return cnt; |
@@ -2918,7 +2938,7 @@ static int ata_eh_skip_recovery(struct ata_link *link) | |||
2918 | return 0; | 2938 | return 0; |
2919 | 2939 | ||
2920 | /* skip if class codes for all vacant slots are ATA_DEV_NONE */ | 2940 | /* skip if class codes for all vacant slots are ATA_DEV_NONE */ |
2921 | ata_link_for_each_dev(dev, link) { | 2941 | ata_for_each_dev(dev, link, ALL) { |
2922 | if (dev->class == ATA_DEV_UNKNOWN && | 2942 | if (dev->class == ATA_DEV_UNKNOWN && |
2923 | ehc->classes[dev->devno] != ATA_DEV_NONE) | 2943 | ehc->classes[dev->devno] != ATA_DEV_NONE) |
2924 | return 0; | 2944 | return 0; |
@@ -3026,7 +3046,7 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
3026 | DPRINTK("ENTER\n"); | 3046 | DPRINTK("ENTER\n"); |
3027 | 3047 | ||
3028 | /* prep for recovery */ | 3048 | /* prep for recovery */ |
3029 | ata_port_for_each_link(link, ap) { | 3049 | ata_for_each_link(link, ap, EDGE) { |
3030 | struct ata_eh_context *ehc = &link->eh_context; | 3050 | struct ata_eh_context *ehc = &link->eh_context; |
3031 | 3051 | ||
3032 | /* re-enable link? */ | 3052 | /* re-enable link? */ |
@@ -3038,7 +3058,7 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
3038 | ata_eh_done(link, NULL, ATA_EH_ENABLE_LINK); | 3058 | ata_eh_done(link, NULL, ATA_EH_ENABLE_LINK); |
3039 | } | 3059 | } |
3040 | 3060 | ||
3041 | ata_link_for_each_dev(dev, link) { | 3061 | ata_for_each_dev(dev, link, ALL) { |
3042 | if (link->flags & ATA_LFLAG_NO_RETRY) | 3062 | if (link->flags & ATA_LFLAG_NO_RETRY) |
3043 | ehc->tries[dev->devno] = 1; | 3063 | ehc->tries[dev->devno] = 1; |
3044 | else | 3064 | else |
@@ -3068,19 +3088,19 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
3068 | goto out; | 3088 | goto out; |
3069 | 3089 | ||
3070 | /* prep for EH */ | 3090 | /* prep for EH */ |
3071 | ata_port_for_each_link(link, ap) { | 3091 | ata_for_each_link(link, ap, EDGE) { |
3072 | struct ata_eh_context *ehc = &link->eh_context; | 3092 | struct ata_eh_context *ehc = &link->eh_context; |
3073 | 3093 | ||
3074 | /* skip EH if possible. */ | 3094 | /* skip EH if possible. */ |
3075 | if (ata_eh_skip_recovery(link)) | 3095 | if (ata_eh_skip_recovery(link)) |
3076 | ehc->i.action = 0; | 3096 | ehc->i.action = 0; |
3077 | 3097 | ||
3078 | ata_link_for_each_dev(dev, link) | 3098 | ata_for_each_dev(dev, link, ALL) |
3079 | ehc->classes[dev->devno] = ATA_DEV_UNKNOWN; | 3099 | ehc->classes[dev->devno] = ATA_DEV_UNKNOWN; |
3080 | } | 3100 | } |
3081 | 3101 | ||
3082 | /* reset */ | 3102 | /* reset */ |
3083 | ata_port_for_each_link(link, ap) { | 3103 | ata_for_each_link(link, ap, EDGE) { |
3084 | struct ata_eh_context *ehc = &link->eh_context; | 3104 | struct ata_eh_context *ehc = &link->eh_context; |
3085 | 3105 | ||
3086 | if (!(ehc->i.action & ATA_EH_RESET)) | 3106 | if (!(ehc->i.action & ATA_EH_RESET)) |
@@ -3105,8 +3125,8 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
3105 | ata_eh_pull_park_action(ap); | 3125 | ata_eh_pull_park_action(ap); |
3106 | 3126 | ||
3107 | deadline = jiffies; | 3127 | deadline = jiffies; |
3108 | ata_port_for_each_link(link, ap) { | 3128 | ata_for_each_link(link, ap, EDGE) { |
3109 | ata_link_for_each_dev(dev, link) { | 3129 | ata_for_each_dev(dev, link, ALL) { |
3110 | struct ata_eh_context *ehc = &link->eh_context; | 3130 | struct ata_eh_context *ehc = &link->eh_context; |
3111 | unsigned long tmp; | 3131 | unsigned long tmp; |
3112 | 3132 | ||
@@ -3134,8 +3154,8 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
3134 | deadline = wait_for_completion_timeout(&ap->park_req_pending, | 3154 | deadline = wait_for_completion_timeout(&ap->park_req_pending, |
3135 | deadline - now); | 3155 | deadline - now); |
3136 | } while (deadline); | 3156 | } while (deadline); |
3137 | ata_port_for_each_link(link, ap) { | 3157 | ata_for_each_link(link, ap, EDGE) { |
3138 | ata_link_for_each_dev(dev, link) { | 3158 | ata_for_each_dev(dev, link, ALL) { |
3139 | if (!(link->eh_context.unloaded_mask & | 3159 | if (!(link->eh_context.unloaded_mask & |
3140 | (1 << dev->devno))) | 3160 | (1 << dev->devno))) |
3141 | continue; | 3161 | continue; |
@@ -3146,7 +3166,7 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
3146 | } | 3166 | } |
3147 | 3167 | ||
3148 | /* the rest */ | 3168 | /* the rest */ |
3149 | ata_port_for_each_link(link, ap) { | 3169 | ata_for_each_link(link, ap, EDGE) { |
3150 | struct ata_eh_context *ehc = &link->eh_context; | 3170 | struct ata_eh_context *ehc = &link->eh_context; |
3151 | 3171 | ||
3152 | /* revalidate existing devices and attach new ones */ | 3172 | /* revalidate existing devices and attach new ones */ |
@@ -3172,7 +3192,7 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
3172 | * disrupting the current users of the device. | 3192 | * disrupting the current users of the device. |
3173 | */ | 3193 | */ |
3174 | if (ehc->i.flags & ATA_EHI_DID_RESET) { | 3194 | if (ehc->i.flags & ATA_EHI_DID_RESET) { |
3175 | ata_link_for_each_dev(dev, link) { | 3195 | ata_for_each_dev(dev, link, ALL) { |
3176 | if (dev->class != ATA_DEV_ATAPI) | 3196 | if (dev->class != ATA_DEV_ATAPI) |
3177 | continue; | 3197 | continue; |
3178 | rc = atapi_eh_clear_ua(dev); | 3198 | rc = atapi_eh_clear_ua(dev); |
@@ -3183,7 +3203,7 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
3183 | 3203 | ||
3184 | /* configure link power saving */ | 3204 | /* configure link power saving */ |
3185 | if (ehc->i.action & ATA_EH_LPM) | 3205 | if (ehc->i.action & ATA_EH_LPM) |
3186 | ata_link_for_each_dev(dev, link) | 3206 | ata_for_each_dev(dev, link, ALL) |
3187 | ata_dev_enable_pm(dev, ap->pm_policy); | 3207 | ata_dev_enable_pm(dev, ap->pm_policy); |
3188 | 3208 | ||
3189 | /* this link is okay now */ | 3209 | /* this link is okay now */ |
@@ -3288,7 +3308,7 @@ void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
3288 | rc = ata_eh_recover(ap, prereset, softreset, hardreset, postreset, | 3308 | rc = ata_eh_recover(ap, prereset, softreset, hardreset, postreset, |
3289 | NULL); | 3309 | NULL); |
3290 | if (rc) { | 3310 | if (rc) { |
3291 | ata_link_for_each_dev(dev, &ap->link) | 3311 | ata_for_each_dev(dev, &ap->link, ALL) |
3292 | ata_dev_disable(dev); | 3312 | ata_dev_disable(dev); |
3293 | } | 3313 | } |
3294 | 3314 | ||