diff options
Diffstat (limited to 'drivers/ata/libata-eh.c')
-rw-r--r-- | drivers/ata/libata-eh.c | 49 |
1 files changed, 41 insertions, 8 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 8cb35bb87605..8d64f8fd8f1d 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -1800,10 +1800,8 @@ static void ata_eh_link_autopsy(struct ata_link *link) | |||
1800 | qc->err_mask &= ~AC_ERR_OTHER; | 1800 | qc->err_mask &= ~AC_ERR_OTHER; |
1801 | 1801 | ||
1802 | /* SENSE_VALID trumps dev/unknown error and revalidation */ | 1802 | /* SENSE_VALID trumps dev/unknown error and revalidation */ |
1803 | if (qc->flags & ATA_QCFLAG_SENSE_VALID) { | 1803 | if (qc->flags & ATA_QCFLAG_SENSE_VALID) |
1804 | qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER); | 1804 | qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER); |
1805 | ehc->i.action &= ~ATA_EH_REVALIDATE; | ||
1806 | } | ||
1807 | 1805 | ||
1808 | /* accumulate error info */ | 1806 | /* accumulate error info */ |
1809 | ehc->i.dev = qc->dev; | 1807 | ehc->i.dev = qc->dev; |
@@ -1816,7 +1814,8 @@ static void ata_eh_link_autopsy(struct ata_link *link) | |||
1816 | if (ap->pflags & ATA_PFLAG_FROZEN || | 1814 | if (ap->pflags & ATA_PFLAG_FROZEN || |
1817 | all_err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT)) | 1815 | all_err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT)) |
1818 | ehc->i.action |= ATA_EH_SOFTRESET; | 1816 | ehc->i.action |= ATA_EH_SOFTRESET; |
1819 | else if (all_err_mask) | 1817 | else if ((is_io && all_err_mask) || |
1818 | (!is_io && (all_err_mask & ~AC_ERR_DEV))) | ||
1820 | ehc->i.action |= ATA_EH_REVALIDATE; | 1819 | ehc->i.action |= ATA_EH_REVALIDATE; |
1821 | 1820 | ||
1822 | /* if we have offending qcs and the associated failed device */ | 1821 | /* if we have offending qcs and the associated failed device */ |
@@ -1879,7 +1878,9 @@ static void ata_eh_link_report(struct ata_link *link) | |||
1879 | for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { | 1878 | for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { |
1880 | struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); | 1879 | struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); |
1881 | 1880 | ||
1882 | if (!(qc->flags & ATA_QCFLAG_FAILED) || qc->dev->link != link) | 1881 | if (!(qc->flags & ATA_QCFLAG_FAILED) || qc->dev->link != link || |
1882 | ((qc->flags & ATA_QCFLAG_QUIET) && | ||
1883 | qc->err_mask == AC_ERR_DEV)) | ||
1883 | continue; | 1884 | continue; |
1884 | if (qc->flags & ATA_QCFLAG_SENSE_VALID && !qc->err_mask) | 1885 | if (qc->flags & ATA_QCFLAG_SENSE_VALID && !qc->err_mask) |
1885 | continue; | 1886 | continue; |
@@ -2083,6 +2084,25 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2083 | 2084 | ||
2084 | ata_eh_about_to_do(link, NULL, ehc->i.action & ATA_EH_RESET_MASK); | 2085 | ata_eh_about_to_do(link, NULL, ehc->i.action & ATA_EH_RESET_MASK); |
2085 | 2086 | ||
2087 | ata_link_for_each_dev(dev, link) { | ||
2088 | /* If we issue an SRST then an ATA drive (not ATAPI) | ||
2089 | * may change configuration and be in PIO0 timing. If | ||
2090 | * we do a hard reset (or are coming from power on) | ||
2091 | * this is true for ATA or ATAPI. Until we've set a | ||
2092 | * suitable controller mode we should not touch the | ||
2093 | * bus as we may be talking too fast. | ||
2094 | */ | ||
2095 | dev->pio_mode = XFER_PIO_0; | ||
2096 | |||
2097 | /* If the controller has a pio mode setup function | ||
2098 | * then use it to set the chipset to rights. Don't | ||
2099 | * touch the DMA setup as that will be dealt with when | ||
2100 | * configuring devices. | ||
2101 | */ | ||
2102 | if (ap->ops->set_piomode) | ||
2103 | ap->ops->set_piomode(ap, dev); | ||
2104 | } | ||
2105 | |||
2086 | /* Determine which reset to use and record in ehc->i.action. | 2106 | /* Determine which reset to use and record in ehc->i.action. |
2087 | * prereset() may examine and modify it. | 2107 | * prereset() may examine and modify it. |
2088 | */ | 2108 | */ |
@@ -2208,9 +2228,11 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2208 | ata_link_for_each_dev(dev, link) { | 2228 | ata_link_for_each_dev(dev, link) { |
2209 | /* After the reset, the device state is PIO 0 | 2229 | /* After the reset, the device state is PIO 0 |
2210 | * and the controller state is undefined. | 2230 | * and the controller state is undefined. |
2211 | * Record the mode. | 2231 | * Reset also wakes up drives from sleeping |
2232 | * mode. | ||
2212 | */ | 2233 | */ |
2213 | dev->pio_mode = XFER_PIO_0; | 2234 | dev->pio_mode = XFER_PIO_0; |
2235 | dev->flags &= ~ATA_DFLAG_SLEEPING; | ||
2214 | 2236 | ||
2215 | if (ata_link_offline(link)) | 2237 | if (ata_link_offline(link)) |
2216 | continue; | 2238 | continue; |
@@ -2416,7 +2438,7 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err) | |||
2416 | /* give it just one more chance */ | 2438 | /* give it just one more chance */ |
2417 | ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1); | 2439 | ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1); |
2418 | case -EIO: | 2440 | case -EIO: |
2419 | if (ehc->tries[dev->devno] == 1) { | 2441 | if (ehc->tries[dev->devno] == 1 && dev->pio_mode > XFER_PIO_0) { |
2420 | /* This is the last chance, better to slow | 2442 | /* This is the last chance, better to slow |
2421 | * down than lose it. | 2443 | * down than lose it. |
2422 | */ | 2444 | */ |
@@ -2607,6 +2629,10 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
2607 | ehc->i.flags &= ~ATA_EHI_SETMODE; | 2629 | ehc->i.flags &= ~ATA_EHI_SETMODE; |
2608 | } | 2630 | } |
2609 | 2631 | ||
2632 | if (ehc->i.action & ATA_EHI_LPM) | ||
2633 | ata_link_for_each_dev(dev, link) | ||
2634 | ata_dev_enable_pm(dev, ap->pm_policy); | ||
2635 | |||
2610 | /* this link is okay now */ | 2636 | /* this link is okay now */ |
2611 | ehc->i.flags = 0; | 2637 | ehc->i.flags = 0; |
2612 | continue; | 2638 | continue; |
@@ -2672,8 +2698,15 @@ void ata_eh_finish(struct ata_port *ap) | |||
2672 | /* FIXME: Once EH migration is complete, | 2698 | /* FIXME: Once EH migration is complete, |
2673 | * generate sense data in this function, | 2699 | * generate sense data in this function, |
2674 | * considering both err_mask and tf. | 2700 | * considering both err_mask and tf. |
2701 | * | ||
2702 | * There's no point in retrying invalid | ||
2703 | * (detected by libata) and non-IO device | ||
2704 | * errors (rejected by device). Finish them | ||
2705 | * immediately. | ||
2675 | */ | 2706 | */ |
2676 | if (qc->err_mask & AC_ERR_INVALID) | 2707 | if ((qc->err_mask & AC_ERR_INVALID) || |
2708 | (!(qc->flags & ATA_QCFLAG_IO) && | ||
2709 | qc->err_mask == AC_ERR_DEV)) | ||
2677 | ata_eh_qc_complete(qc); | 2710 | ata_eh_qc_complete(qc); |
2678 | else | 2711 | else |
2679 | ata_eh_qc_retry(qc); | 2712 | ata_eh_qc_retry(qc); |