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.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 01831312c360..94919ad03df1 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2783,6 +2783,12 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
2783 } else if (dev->class == ATA_DEV_UNKNOWN && 2783 } else if (dev->class == ATA_DEV_UNKNOWN &&
2784 ehc->tries[dev->devno] && 2784 ehc->tries[dev->devno] &&
2785 ata_class_enabled(ehc->classes[dev->devno])) { 2785 ata_class_enabled(ehc->classes[dev->devno])) {
2786 /* Temporarily set dev->class, it will be
2787 * permanently set once all configurations are
2788 * complete. This is necessary because new
2789 * device configuration is done in two
2790 * separate loops.
2791 */
2786 dev->class = ehc->classes[dev->devno]; 2792 dev->class = ehc->classes[dev->devno];
2787 2793
2788 if (dev->class == ATA_DEV_PMP) 2794 if (dev->class == ATA_DEV_PMP)
@@ -2790,6 +2796,11 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
2790 else 2796 else
2791 rc = ata_dev_read_id(dev, &dev->class, 2797 rc = ata_dev_read_id(dev, &dev->class,
2792 readid_flags, dev->id); 2798 readid_flags, dev->id);
2799
2800 /* read_id might have changed class, store and reset */
2801 ehc->classes[dev->devno] = dev->class;
2802 dev->class = ATA_DEV_UNKNOWN;
2803
2793 switch (rc) { 2804 switch (rc) {
2794 case 0: 2805 case 0:
2795 /* clear error info accumulated during probe */ 2806 /* clear error info accumulated during probe */
@@ -2799,13 +2810,11 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
2799 case -ENOENT: 2810 case -ENOENT:
2800 /* IDENTIFY was issued to non-existent 2811 /* IDENTIFY was issued to non-existent
2801 * device. No need to reset. Just 2812 * device. No need to reset. Just
2802 * thaw and kill the device. 2813 * thaw and ignore the device.
2803 */ 2814 */
2804 ata_eh_thaw_port(ap); 2815 ata_eh_thaw_port(ap);
2805 dev->class = ATA_DEV_UNKNOWN;
2806 break; 2816 break;
2807 default: 2817 default:
2808 dev->class = ATA_DEV_UNKNOWN;
2809 goto err; 2818 goto err;
2810 } 2819 }
2811 } 2820 }
@@ -2826,11 +2835,15 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
2826 dev->class == ATA_DEV_PMP) 2835 dev->class == ATA_DEV_PMP)
2827 continue; 2836 continue;
2828 2837
2838 dev->class = ehc->classes[dev->devno];
2839
2829 ehc->i.flags |= ATA_EHI_PRINTINFO; 2840 ehc->i.flags |= ATA_EHI_PRINTINFO;
2830 rc = ata_dev_configure(dev); 2841 rc = ata_dev_configure(dev);
2831 ehc->i.flags &= ~ATA_EHI_PRINTINFO; 2842 ehc->i.flags &= ~ATA_EHI_PRINTINFO;
2832 if (rc) 2843 if (rc) {
2844 dev->class = ATA_DEV_UNKNOWN;
2833 goto err; 2845 goto err;
2846 }
2834 2847
2835 spin_lock_irqsave(ap->lock, flags); 2848 spin_lock_irqsave(ap->lock, flags);
2836 ap->pflags |= ATA_PFLAG_SCSI_HOTPLUG; 2849 ap->pflags |= ATA_PFLAG_SCSI_HOTPLUG;
@@ -3494,6 +3507,8 @@ static void ata_eh_handle_port_suspend(struct ata_port *ap)
3494 */ 3507 */
3495static void ata_eh_handle_port_resume(struct ata_port *ap) 3508static void ata_eh_handle_port_resume(struct ata_port *ap)
3496{ 3509{
3510 struct ata_link *link;
3511 struct ata_device *dev;
3497 unsigned long flags; 3512 unsigned long flags;
3498 int rc = 0; 3513 int rc = 0;
3499 3514
@@ -3508,6 +3523,17 @@ static void ata_eh_handle_port_resume(struct ata_port *ap)
3508 3523
3509 WARN_ON(!(ap->pflags & ATA_PFLAG_SUSPENDED)); 3524 WARN_ON(!(ap->pflags & ATA_PFLAG_SUSPENDED));
3510 3525
3526 /*
3527 * Error timestamps are in jiffies which doesn't run while
3528 * suspended and PHY events during resume isn't too uncommon.
3529 * When the two are combined, it can lead to unnecessary speed
3530 * downs if the machine is suspended and resumed repeatedly.
3531 * Clear error history.
3532 */
3533 ata_for_each_link(link, ap, HOST_FIRST)
3534 ata_for_each_dev(dev, link, ALL)
3535 ata_ering_clear(&dev->ering);
3536
3511 ata_acpi_set_state(ap, PMSG_ON); 3537 ata_acpi_set_state(ap, PMSG_ON);
3512 3538
3513 if (ap->ops->port_resume) 3539 if (ap->ops->port_resume)