aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-eh.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/libata-eh.c')
-rw-r--r--drivers/ata/libata-eh.c46
1 files changed, 18 insertions, 28 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index a34adc2c85df..06a92c58a49d 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2170,6 +2170,9 @@ int ata_eh_reset(struct ata_link *link, int classify,
2170 /* 2170 /*
2171 * Perform reset 2171 * Perform reset
2172 */ 2172 */
2173 if (ata_is_host_link(link))
2174 ata_eh_freeze_port(ap);
2175
2173 deadline = jiffies + ata_eh_reset_timeouts[try++]; 2176 deadline = jiffies + ata_eh_reset_timeouts[try++];
2174 2177
2175 if (reset) { 2178 if (reset) {
@@ -2238,6 +2241,10 @@ int ata_eh_reset(struct ata_link *link, int classify,
2238 if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0) 2241 if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0)
2239 link->sata_spd = (sstatus >> 4) & 0xf; 2242 link->sata_spd = (sstatus >> 4) & 0xf;
2240 2243
2244 /* thaw the port */
2245 if (ata_is_host_link(link))
2246 ata_eh_thaw_port(ap);
2247
2241 if (postreset) 2248 if (postreset)
2242 postreset(link, classes); 2249 postreset(link, classes);
2243 2250
@@ -2589,7 +2596,7 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
2589 struct ata_link *link; 2596 struct ata_link *link;
2590 struct ata_device *dev; 2597 struct ata_device *dev;
2591 int nr_failed_devs, nr_disabled_devs; 2598 int nr_failed_devs, nr_disabled_devs;
2592 int reset, rc; 2599 int rc;
2593 unsigned long flags; 2600 unsigned long flags;
2594 2601
2595 DPRINTK("ENTER\n"); 2602 DPRINTK("ENTER\n");
@@ -2632,7 +2639,6 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
2632 rc = 0; 2639 rc = 0;
2633 nr_failed_devs = 0; 2640 nr_failed_devs = 0;
2634 nr_disabled_devs = 0; 2641 nr_disabled_devs = 0;
2635 reset = 0;
2636 2642
2637 /* if UNLOADING, finish immediately */ 2643 /* if UNLOADING, finish immediately */
2638 if (ap->pflags & ATA_PFLAG_UNLOADING) 2644 if (ap->pflags & ATA_PFLAG_UNLOADING)
@@ -2646,40 +2652,24 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
2646 if (ata_eh_skip_recovery(link)) 2652 if (ata_eh_skip_recovery(link))
2647 ehc->i.action = 0; 2653 ehc->i.action = 0;
2648 2654
2649 /* do we need to reset? */
2650 if (ehc->i.action & ATA_EH_RESET)
2651 reset = 1;
2652
2653 ata_link_for_each_dev(dev, link) 2655 ata_link_for_each_dev(dev, link)
2654 ehc->classes[dev->devno] = ATA_DEV_UNKNOWN; 2656 ehc->classes[dev->devno] = ATA_DEV_UNKNOWN;
2655 } 2657 }
2656 2658
2657 /* reset */ 2659 /* reset */
2658 if (reset) { 2660 ata_port_for_each_link(link, ap) {
2659 /* if PMP is attached, this function only deals with 2661 struct ata_eh_context *ehc = &link->eh_context;
2660 * downstream links, port should stay thawed.
2661 */
2662 if (!sata_pmp_attached(ap))
2663 ata_eh_freeze_port(ap);
2664
2665 ata_port_for_each_link(link, ap) {
2666 struct ata_eh_context *ehc = &link->eh_context;
2667 2662
2668 if (!(ehc->i.action & ATA_EH_RESET)) 2663 if (!(ehc->i.action & ATA_EH_RESET))
2669 continue; 2664 continue;
2670 2665
2671 rc = ata_eh_reset(link, ata_link_nr_vacant(link), 2666 rc = ata_eh_reset(link, ata_link_nr_vacant(link),
2672 prereset, softreset, hardreset, 2667 prereset, softreset, hardreset, postreset);
2673 postreset); 2668 if (rc) {
2674 if (rc) { 2669 ata_link_printk(link, KERN_ERR,
2675 ata_link_printk(link, KERN_ERR, 2670 "reset failed, giving up\n");
2676 "reset failed, giving up\n"); 2671 goto out;
2677 goto out;
2678 }
2679 } 2672 }
2680
2681 if (!sata_pmp_attached(ap))
2682 ata_eh_thaw_port(ap);
2683 } 2673 }
2684 2674
2685 /* the rest */ 2675 /* the rest */