diff options
author | Tejun Heo <htejun@gmail.com> | 2008-01-23 10:05:14 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-04-17 15:44:15 -0400 |
commit | cf48062658e7ab3bc55e10c65676c3c73c16f8bf (patch) | |
tree | 9a50a016ceb6051d8a30a43ea39f2a4d3d25570e | |
parent | 4b119e21d0c66c22e8ca03df05d9de623d0eb50f (diff) |
libata: prefer hardreset
When both soft and hard resets are available, libata preferred
softreset till now. The logic behind it was to be softer to devices;
however, this doesn't really help much. Rationales for the change:
* BIOS may freeze lock certain things during boot and softreset can't
unlock those. This by itself is okay but during operation PHY event
or other error conditions can trigger hardreset and the device may
end up with different configuration.
For example, after a hardreset, previously unlockable HPA can be
unlocked resulting in different device size and thus revalidation
failure. Similar condition can occur during or after resume.
* Certain ATAPI devices require hardreset to recover after certain
error conditions. On PATA, this is done by issuing the DEVICE RESET
command. On SATA, COMRESET has equivalent effect. The problem is
that DEVICE RESET needs its own execution protocol.
For SFF controllers with bare TF access, it can be easily
implemented but more advanced controllers (e.g. ahci and sata_sil24)
require specialized implementations. Simply using hardreset solves
the problem nicely.
* COMRESET initialization sequence is the norm in SATA land and many
SATA devices don't work properly if only SRST is used. For example,
some PMPs behave this way and libata works around by always issuing
hardreset if the host supports PMP.
Like the above example, libata has developed a number of mechanisms
aiming to promote softreset to hardreset if softreset is not going
to work. This approach is time consuming and error prone.
Also, note that, dependingon how you read the specs, it could be
argued that PMP fan-out ports require COMRESET to start operation.
In fact, all the PMPs on the market except one don't work properly
if COMRESET is not issued to fan-out ports after PMP reset.
* COMRESET is an integral part of SATA connection and any working
device should be able to handle COMRESET properly. After all, it's
the way to signal hardreset during reboot. This is the most used
and recommended (at least by the ahci spec) method of resetting
devices.
So, this patch makes libata prefer hardreset over softreset by making
the following changes.
* Rename ATA_EH_RESET_MASK to ATA_EH_RESET and use it whereever
ATA_EH_{SOFT|HARD}RESET used to be used. ATA_EH_{SOFT|HARD}RESET is
now only used to tell prereset whether soft or hard reset will be
issued.
* Strip out now unneeded promote-to-hardreset logics from
ata_eh_reset(), ata_std_prereset(), sata_pmp_std_prereset() and
other places.
Signed-off-by: Tejun Heo <htejun@gmail.com>
-rw-r--r-- | drivers/ata/ahci.c | 10 | ||||
-rw-r--r-- | drivers/ata/libata-core.c | 19 | ||||
-rw-r--r-- | drivers/ata/libata-eh.c | 99 | ||||
-rw-r--r-- | drivers/ata/libata-pmp.c | 28 | ||||
-rw-r--r-- | drivers/ata/libata-scsi.c | 4 | ||||
-rw-r--r-- | drivers/ata/sata_fsl.c | 2 | ||||
-rw-r--r-- | drivers/ata/sata_mv.c | 31 | ||||
-rw-r--r-- | drivers/ata/sata_nv.c | 12 | ||||
-rw-r--r-- | drivers/ata/sata_sil24.c | 54 | ||||
-rw-r--r-- | drivers/ata/sata_via.c | 2 | ||||
-rw-r--r-- | include/linux/libata.h | 8 |
11 files changed, 101 insertions, 168 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index b1eb4e24c86a..f6bbd52b1547 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -1663,7 +1663,7 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat) | |||
1663 | u32 *unk = (u32 *)(pp->rx_fis + RX_FIS_UNK); | 1663 | u32 *unk = (u32 *)(pp->rx_fis + RX_FIS_UNK); |
1664 | 1664 | ||
1665 | active_ehi->err_mask |= AC_ERR_HSM; | 1665 | active_ehi->err_mask |= AC_ERR_HSM; |
1666 | active_ehi->action |= ATA_EH_SOFTRESET; | 1666 | active_ehi->action |= ATA_EH_RESET; |
1667 | ata_ehi_push_desc(active_ehi, | 1667 | ata_ehi_push_desc(active_ehi, |
1668 | "unknown FIS %08x %08x %08x %08x" , | 1668 | "unknown FIS %08x %08x %08x %08x" , |
1669 | unk[0], unk[1], unk[2], unk[3]); | 1669 | unk[0], unk[1], unk[2], unk[3]); |
@@ -1671,19 +1671,19 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat) | |||
1671 | 1671 | ||
1672 | if (ap->nr_pmp_links && (irq_stat & PORT_IRQ_BAD_PMP)) { | 1672 | if (ap->nr_pmp_links && (irq_stat & PORT_IRQ_BAD_PMP)) { |
1673 | active_ehi->err_mask |= AC_ERR_HSM; | 1673 | active_ehi->err_mask |= AC_ERR_HSM; |
1674 | active_ehi->action |= ATA_EH_SOFTRESET; | 1674 | active_ehi->action |= ATA_EH_RESET; |
1675 | ata_ehi_push_desc(active_ehi, "incorrect PMP"); | 1675 | ata_ehi_push_desc(active_ehi, "incorrect PMP"); |
1676 | } | 1676 | } |
1677 | 1677 | ||
1678 | if (irq_stat & (PORT_IRQ_HBUS_ERR | PORT_IRQ_HBUS_DATA_ERR)) { | 1678 | if (irq_stat & (PORT_IRQ_HBUS_ERR | PORT_IRQ_HBUS_DATA_ERR)) { |
1679 | host_ehi->err_mask |= AC_ERR_HOST_BUS; | 1679 | host_ehi->err_mask |= AC_ERR_HOST_BUS; |
1680 | host_ehi->action |= ATA_EH_SOFTRESET; | 1680 | host_ehi->action |= ATA_EH_RESET; |
1681 | ata_ehi_push_desc(host_ehi, "host bus error"); | 1681 | ata_ehi_push_desc(host_ehi, "host bus error"); |
1682 | } | 1682 | } |
1683 | 1683 | ||
1684 | if (irq_stat & PORT_IRQ_IF_ERR) { | 1684 | if (irq_stat & PORT_IRQ_IF_ERR) { |
1685 | host_ehi->err_mask |= AC_ERR_ATA_BUS; | 1685 | host_ehi->err_mask |= AC_ERR_ATA_BUS; |
1686 | host_ehi->action |= ATA_EH_SOFTRESET; | 1686 | host_ehi->action |= ATA_EH_RESET; |
1687 | ata_ehi_push_desc(host_ehi, "interface fatal error"); | 1687 | ata_ehi_push_desc(host_ehi, "interface fatal error"); |
1688 | } | 1688 | } |
1689 | 1689 | ||
@@ -1771,7 +1771,7 @@ static void ahci_port_intr(struct ata_port *ap) | |||
1771 | /* while resetting, invalid completions are expected */ | 1771 | /* while resetting, invalid completions are expected */ |
1772 | if (unlikely(rc < 0 && !resetting)) { | 1772 | if (unlikely(rc < 0 && !resetting)) { |
1773 | ehi->err_mask |= AC_ERR_HSM; | 1773 | ehi->err_mask |= AC_ERR_HSM; |
1774 | ehi->action |= ATA_EH_SOFTRESET; | 1774 | ehi->action |= ATA_EH_RESET; |
1775 | ata_port_freeze(ap); | 1775 | ata_port_freeze(ap); |
1776 | } | 1776 | } |
1777 | } | 1777 | } |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index be95fdb69726..02e7ba43a3b3 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -3949,17 +3949,6 @@ int ata_std_prereset(struct ata_link *link, unsigned long deadline) | |||
3949 | const unsigned long *timing = sata_ehc_deb_timing(ehc); | 3949 | const unsigned long *timing = sata_ehc_deb_timing(ehc); |
3950 | int rc; | 3950 | int rc; |
3951 | 3951 | ||
3952 | /* handle link resume */ | ||
3953 | if ((ehc->i.flags & ATA_EHI_RESUME_LINK) && | ||
3954 | (link->flags & ATA_LFLAG_HRST_TO_RESUME)) | ||
3955 | ehc->i.action |= ATA_EH_HARDRESET; | ||
3956 | |||
3957 | /* Some PMPs don't work with only SRST, force hardreset if PMP | ||
3958 | * is supported. | ||
3959 | */ | ||
3960 | if (ap->flags & ATA_FLAG_PMP) | ||
3961 | ehc->i.action |= ATA_EH_HARDRESET; | ||
3962 | |||
3963 | /* if we're about to do hardreset, nothing more to do */ | 3952 | /* if we're about to do hardreset, nothing more to do */ |
3964 | if (ehc->i.action & ATA_EH_HARDRESET) | 3953 | if (ehc->i.action & ATA_EH_HARDRESET) |
3965 | return 0; | 3954 | return 0; |
@@ -6055,9 +6044,9 @@ void ata_qc_issue(struct ata_queued_cmd *qc) | |||
6055 | if (ata_sg_setup(qc)) | 6044 | if (ata_sg_setup(qc)) |
6056 | goto sg_err; | 6045 | goto sg_err; |
6057 | 6046 | ||
6058 | /* if device is sleeping, schedule softreset and abort the link */ | 6047 | /* if device is sleeping, schedule reset and abort the link */ |
6059 | if (unlikely(qc->dev->flags & ATA_DFLAG_SLEEPING)) { | 6048 | if (unlikely(qc->dev->flags & ATA_DFLAG_SLEEPING)) { |
6060 | link->eh_info.action |= ATA_EH_SOFTRESET; | 6049 | link->eh_info.action |= ATA_EH_RESET; |
6061 | ata_ehi_push_desc(&link->eh_info, "waking up from sleep"); | 6050 | ata_ehi_push_desc(&link->eh_info, "waking up from sleep"); |
6062 | ata_link_abort(link); | 6051 | ata_link_abort(link); |
6063 | return; | 6052 | return; |
@@ -6634,7 +6623,7 @@ int ata_host_suspend(struct ata_host *host, pm_message_t mesg) | |||
6634 | */ | 6623 | */ |
6635 | void ata_host_resume(struct ata_host *host) | 6624 | void ata_host_resume(struct ata_host *host) |
6636 | { | 6625 | { |
6637 | ata_host_request_pm(host, PMSG_ON, ATA_EH_SOFTRESET, | 6626 | ata_host_request_pm(host, PMSG_ON, ATA_EH_RESET, |
6638 | ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, 0); | 6627 | ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, 0); |
6639 | host->dev->power.power_state = PMSG_ON; | 6628 | host->dev->power.power_state = PMSG_ON; |
6640 | 6629 | ||
@@ -7171,7 +7160,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) | |||
7171 | 7160 | ||
7172 | ehi->probe_mask = | 7161 | ehi->probe_mask = |
7173 | (1 << ata_link_max_devices(&ap->link)) - 1; | 7162 | (1 << ata_link_max_devices(&ap->link)) - 1; |
7174 | ehi->action |= ATA_EH_SOFTRESET; | 7163 | ehi->action |= ATA_EH_RESET; |
7175 | ehi->flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET; | 7164 | ehi->flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET; |
7176 | 7165 | ||
7177 | ap->pflags &= ~ATA_PFLAG_INITIALIZING; | 7166 | ap->pflags &= ~ATA_PFLAG_INITIALIZING; |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index a5830329eda4..f7cae6400155 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -1079,16 +1079,9 @@ void ata_eh_about_to_do(struct ata_link *link, struct ata_device *dev, | |||
1079 | 1079 | ||
1080 | spin_lock_irqsave(ap->lock, flags); | 1080 | spin_lock_irqsave(ap->lock, flags); |
1081 | 1081 | ||
1082 | /* Reset is represented by combination of actions and EHI | 1082 | /* suck in and clear reset modifier */ |
1083 | * flags. Suck in all related bits before clearing eh_info to | 1083 | if (action & ATA_EH_RESET) { |
1084 | * avoid losing requested action. | ||
1085 | */ | ||
1086 | if (action & ATA_EH_RESET_MASK) { | ||
1087 | ehc->i.action |= ehi->action & ATA_EH_RESET_MASK; | ||
1088 | ehc->i.flags |= ehi->flags & ATA_EHI_RESET_MODIFIER_MASK; | 1084 | ehc->i.flags |= ehi->flags & ATA_EHI_RESET_MODIFIER_MASK; |
1089 | |||
1090 | /* make sure all reset actions are cleared & clear EHI flags */ | ||
1091 | action |= ATA_EH_RESET_MASK; | ||
1092 | ehi->flags &= ~ATA_EHI_RESET_MODIFIER_MASK; | 1085 | ehi->flags &= ~ATA_EHI_RESET_MODIFIER_MASK; |
1093 | } | 1086 | } |
1094 | 1087 | ||
@@ -1117,11 +1110,9 @@ void ata_eh_done(struct ata_link *link, struct ata_device *dev, | |||
1117 | { | 1110 | { |
1118 | struct ata_eh_context *ehc = &link->eh_context; | 1111 | struct ata_eh_context *ehc = &link->eh_context; |
1119 | 1112 | ||
1120 | /* if reset is complete, clear all reset actions & reset modifier */ | 1113 | /* if reset is complete, clear reset modifier */ |
1121 | if (action & ATA_EH_RESET_MASK) { | 1114 | if (action & ATA_EH_RESET) |
1122 | action |= ATA_EH_RESET_MASK; | ||
1123 | ehc->i.flags &= ~ATA_EHI_RESET_MODIFIER_MASK; | 1115 | ehc->i.flags &= ~ATA_EHI_RESET_MODIFIER_MASK; |
1124 | } | ||
1125 | 1116 | ||
1126 | ata_eh_clear_action(link, dev, &ehc->i, action); | 1117 | ata_eh_clear_action(link, dev, &ehc->i, action); |
1127 | } | 1118 | } |
@@ -1329,20 +1320,20 @@ static void ata_eh_analyze_serror(struct ata_link *link) | |||
1329 | 1320 | ||
1330 | if (serror & SERR_PERSISTENT) { | 1321 | if (serror & SERR_PERSISTENT) { |
1331 | err_mask |= AC_ERR_ATA_BUS; | 1322 | err_mask |= AC_ERR_ATA_BUS; |
1332 | action |= ATA_EH_HARDRESET; | 1323 | action |= ATA_EH_RESET; |
1333 | } | 1324 | } |
1334 | if (serror & | 1325 | if (serror & |
1335 | (SERR_DATA_RECOVERED | SERR_COMM_RECOVERED | SERR_DATA)) { | 1326 | (SERR_DATA_RECOVERED | SERR_COMM_RECOVERED | SERR_DATA)) { |
1336 | err_mask |= AC_ERR_ATA_BUS; | 1327 | err_mask |= AC_ERR_ATA_BUS; |
1337 | action |= ATA_EH_SOFTRESET; | 1328 | action |= ATA_EH_RESET; |
1338 | } | 1329 | } |
1339 | if (serror & SERR_PROTOCOL) { | 1330 | if (serror & SERR_PROTOCOL) { |
1340 | err_mask |= AC_ERR_HSM; | 1331 | err_mask |= AC_ERR_HSM; |
1341 | action |= ATA_EH_SOFTRESET; | 1332 | action |= ATA_EH_RESET; |
1342 | } | 1333 | } |
1343 | if (serror & SERR_INTERNAL) { | 1334 | if (serror & SERR_INTERNAL) { |
1344 | err_mask |= AC_ERR_SYSTEM; | 1335 | err_mask |= AC_ERR_SYSTEM; |
1345 | action |= ATA_EH_HARDRESET; | 1336 | action |= ATA_EH_RESET; |
1346 | } | 1337 | } |
1347 | 1338 | ||
1348 | /* Determine whether a hotplug event has occurred. Both | 1339 | /* Determine whether a hotplug event has occurred. Both |
@@ -1448,7 +1439,7 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc, | |||
1448 | 1439 | ||
1449 | if ((stat & (ATA_BUSY | ATA_DRQ | ATA_DRDY)) != ATA_DRDY) { | 1440 | if ((stat & (ATA_BUSY | ATA_DRQ | ATA_DRDY)) != ATA_DRDY) { |
1450 | qc->err_mask |= AC_ERR_HSM; | 1441 | qc->err_mask |= AC_ERR_HSM; |
1451 | return ATA_EH_SOFTRESET; | 1442 | return ATA_EH_RESET; |
1452 | } | 1443 | } |
1453 | 1444 | ||
1454 | if (stat & (ATA_ERR | ATA_DF)) | 1445 | if (stat & (ATA_ERR | ATA_DF)) |
@@ -1484,7 +1475,7 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc, | |||
1484 | } | 1475 | } |
1485 | 1476 | ||
1486 | if (qc->err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT | AC_ERR_ATA_BUS)) | 1477 | if (qc->err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT | AC_ERR_ATA_BUS)) |
1487 | action |= ATA_EH_SOFTRESET; | 1478 | action |= ATA_EH_RESET; |
1488 | 1479 | ||
1489 | return action; | 1480 | return action; |
1490 | } | 1481 | } |
@@ -1685,7 +1676,7 @@ static unsigned int ata_eh_speed_down(struct ata_device *dev, | |||
1685 | if (verdict & ATA_EH_SPDN_SPEED_DOWN) { | 1676 | if (verdict & ATA_EH_SPDN_SPEED_DOWN) { |
1686 | /* speed down SATA link speed if possible */ | 1677 | /* speed down SATA link speed if possible */ |
1687 | if (sata_down_spd_limit(link) == 0) { | 1678 | if (sata_down_spd_limit(link) == 0) { |
1688 | action |= ATA_EH_HARDRESET; | 1679 | action |= ATA_EH_RESET; |
1689 | goto done; | 1680 | goto done; |
1690 | } | 1681 | } |
1691 | 1682 | ||
@@ -1705,7 +1696,7 @@ static unsigned int ata_eh_speed_down(struct ata_device *dev, | |||
1705 | dev->spdn_cnt++; | 1696 | dev->spdn_cnt++; |
1706 | 1697 | ||
1707 | if (ata_down_xfermask_limit(dev, sel) == 0) { | 1698 | if (ata_down_xfermask_limit(dev, sel) == 0) { |
1708 | action |= ATA_EH_SOFTRESET; | 1699 | action |= ATA_EH_RESET; |
1709 | goto done; | 1700 | goto done; |
1710 | } | 1701 | } |
1711 | } | 1702 | } |
@@ -1719,7 +1710,7 @@ static unsigned int ata_eh_speed_down(struct ata_device *dev, | |||
1719 | (dev->xfer_shift != ATA_SHIFT_PIO)) { | 1710 | (dev->xfer_shift != ATA_SHIFT_PIO)) { |
1720 | if (ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO) == 0) { | 1711 | if (ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO) == 0) { |
1721 | dev->spdn_cnt = 0; | 1712 | dev->spdn_cnt = 0; |
1722 | action |= ATA_EH_SOFTRESET; | 1713 | action |= ATA_EH_RESET; |
1723 | goto done; | 1714 | goto done; |
1724 | } | 1715 | } |
1725 | } | 1716 | } |
@@ -1764,9 +1755,9 @@ static void ata_eh_link_autopsy(struct ata_link *link) | |||
1764 | ehc->i.serror |= serror; | 1755 | ehc->i.serror |= serror; |
1765 | ata_eh_analyze_serror(link); | 1756 | ata_eh_analyze_serror(link); |
1766 | } else if (rc != -EOPNOTSUPP) { | 1757 | } else if (rc != -EOPNOTSUPP) { |
1767 | /* SError read failed, force hardreset and probing */ | 1758 | /* SError read failed, force reset and probing */ |
1768 | ata_ehi_schedule_probe(&ehc->i); | 1759 | ata_ehi_schedule_probe(&ehc->i); |
1769 | ehc->i.action |= ATA_EH_HARDRESET; | 1760 | ehc->i.action |= ATA_EH_RESET; |
1770 | ehc->i.err_mask |= AC_ERR_OTHER; | 1761 | ehc->i.err_mask |= AC_ERR_OTHER; |
1771 | } | 1762 | } |
1772 | 1763 | ||
@@ -1814,7 +1805,7 @@ static void ata_eh_link_autopsy(struct ata_link *link) | |||
1814 | /* enforce default EH actions */ | 1805 | /* enforce default EH actions */ |
1815 | if (ap->pflags & ATA_PFLAG_FROZEN || | 1806 | if (ap->pflags & ATA_PFLAG_FROZEN || |
1816 | all_err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT)) | 1807 | all_err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT)) |
1817 | ehc->i.action |= ATA_EH_SOFTRESET; | 1808 | ehc->i.action |= ATA_EH_RESET; |
1818 | else if (((eflags & ATA_EFLAG_IS_IO) && all_err_mask) || | 1809 | else if (((eflags & ATA_EFLAG_IS_IO) && all_err_mask) || |
1819 | (!(eflags & ATA_EFLAG_IS_IO) && (all_err_mask & ~AC_ERR_DEV))) | 1810 | (!(eflags & ATA_EFLAG_IS_IO) && (all_err_mask & ~AC_ERR_DEV))) |
1820 | ehc->i.action |= ATA_EH_REVALIDATE; | 1811 | ehc->i.action |= ATA_EH_REVALIDATE; |
@@ -2118,7 +2109,6 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2118 | int try = 0; | 2109 | int try = 0; |
2119 | struct ata_device *dev; | 2110 | struct ata_device *dev; |
2120 | unsigned long deadline, now; | 2111 | unsigned long deadline, now; |
2121 | unsigned int tmp_action; | ||
2122 | ata_reset_fn_t reset; | 2112 | ata_reset_fn_t reset; |
2123 | unsigned long flags; | 2113 | unsigned long flags; |
2124 | u32 sstatus; | 2114 | u32 sstatus; |
@@ -2129,7 +2119,7 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2129 | ap->pflags |= ATA_PFLAG_RESETTING; | 2119 | ap->pflags |= ATA_PFLAG_RESETTING; |
2130 | spin_unlock_irqrestore(ap->lock, flags); | 2120 | spin_unlock_irqrestore(ap->lock, flags); |
2131 | 2121 | ||
2132 | ata_eh_about_to_do(link, NULL, ehc->i.action & ATA_EH_RESET_MASK); | 2122 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET); |
2133 | 2123 | ||
2134 | ata_link_for_each_dev(dev, link) { | 2124 | ata_link_for_each_dev(dev, link) { |
2135 | /* If we issue an SRST then an ATA drive (not ATAPI) | 2125 | /* If we issue an SRST then an ATA drive (not ATAPI) |
@@ -2159,17 +2149,15 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2159 | goto done; | 2149 | goto done; |
2160 | } | 2150 | } |
2161 | 2151 | ||
2162 | /* Determine which reset to use and record in ehc->i.action. | 2152 | /* prefer hardreset */ |
2163 | * prereset() may examine and modify it. | 2153 | ehc->i.action &= ~ATA_EH_RESET; |
2164 | */ | 2154 | if (hardreset) { |
2165 | if (softreset && (!hardreset || (!(lflags & ATA_LFLAG_NO_SRST) && | 2155 | reset = hardreset; |
2166 | !sata_set_spd_needed(link) && | 2156 | ehc->i.action = ATA_EH_HARDRESET; |
2167 | !(ehc->i.action & ATA_EH_HARDRESET)))) | 2157 | } else { |
2168 | tmp_action = ATA_EH_SOFTRESET; | 2158 | reset = softreset; |
2169 | else | 2159 | ehc->i.action = ATA_EH_SOFTRESET; |
2170 | tmp_action = ATA_EH_HARDRESET; | 2160 | } |
2171 | |||
2172 | ehc->i.action = (ehc->i.action & ~ATA_EH_RESET_MASK) | tmp_action; | ||
2173 | 2161 | ||
2174 | if (prereset) { | 2162 | if (prereset) { |
2175 | rc = prereset(link, jiffies + ATA_EH_PRERESET_TIMEOUT); | 2163 | rc = prereset(link, jiffies + ATA_EH_PRERESET_TIMEOUT); |
@@ -2177,7 +2165,7 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2177 | if (rc == -ENOENT) { | 2165 | if (rc == -ENOENT) { |
2178 | ata_link_printk(link, KERN_DEBUG, | 2166 | ata_link_printk(link, KERN_DEBUG, |
2179 | "port disabled. ignoring.\n"); | 2167 | "port disabled. ignoring.\n"); |
2180 | ehc->i.action &= ~ATA_EH_RESET_MASK; | 2168 | ehc->i.action &= ~ATA_EH_RESET; |
2181 | 2169 | ||
2182 | ata_link_for_each_dev(dev, link) | 2170 | ata_link_for_each_dev(dev, link) |
2183 | classes[dev->devno] = ATA_DEV_NONE; | 2171 | classes[dev->devno] = ATA_DEV_NONE; |
@@ -2190,12 +2178,8 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2190 | } | 2178 | } |
2191 | } | 2179 | } |
2192 | 2180 | ||
2193 | /* prereset() might have modified ehc->i.action */ | 2181 | /* prereset() might have cleared ATA_EH_RESET */ |
2194 | if (ehc->i.action & ATA_EH_HARDRESET) | 2182 | if (!(ehc->i.action & ATA_EH_RESET)) { |
2195 | reset = hardreset; | ||
2196 | else if (ehc->i.action & ATA_EH_SOFTRESET) | ||
2197 | reset = softreset; | ||
2198 | else { | ||
2199 | /* prereset told us not to reset, bang classes and return */ | 2183 | /* prereset told us not to reset, bang classes and return */ |
2200 | ata_link_for_each_dev(dev, link) | 2184 | ata_link_for_each_dev(dev, link) |
2201 | classes[dev->devno] = ATA_DEV_NONE; | 2185 | classes[dev->devno] = ATA_DEV_NONE; |
@@ -2203,14 +2187,6 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2203 | goto out; | 2187 | goto out; |
2204 | } | 2188 | } |
2205 | 2189 | ||
2206 | /* did prereset() screw up? if so, fix up to avoid oopsing */ | ||
2207 | if (!reset) { | ||
2208 | if (softreset) | ||
2209 | reset = softreset; | ||
2210 | else | ||
2211 | reset = hardreset; | ||
2212 | } | ||
2213 | |||
2214 | retry: | 2190 | retry: |
2215 | deadline = jiffies + ata_eh_reset_timeouts[try++]; | 2191 | deadline = jiffies + ata_eh_reset_timeouts[try++]; |
2216 | 2192 | ||
@@ -2240,7 +2216,7 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2240 | goto fail; | 2216 | goto fail; |
2241 | } | 2217 | } |
2242 | 2218 | ||
2243 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET_MASK); | 2219 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET); |
2244 | rc = ata_do_reset(link, reset, classes, deadline); | 2220 | rc = ata_do_reset(link, reset, classes, deadline); |
2245 | } | 2221 | } |
2246 | 2222 | ||
@@ -2290,7 +2266,7 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2290 | postreset(link, classes); | 2266 | postreset(link, classes); |
2291 | 2267 | ||
2292 | /* reset successful, schedule revalidation */ | 2268 | /* reset successful, schedule revalidation */ |
2293 | ata_eh_done(link, NULL, ehc->i.action & ATA_EH_RESET_MASK); | 2269 | ata_eh_done(link, NULL, ATA_EH_RESET); |
2294 | ehc->i.action |= ATA_EH_REVALIDATE; | 2270 | ehc->i.action |= ATA_EH_REVALIDATE; |
2295 | 2271 | ||
2296 | rc = 0; | 2272 | rc = 0; |
@@ -2548,7 +2524,7 @@ static int ata_eh_schedule_probe(struct ata_device *dev) | |||
2548 | ata_eh_detach_dev(dev); | 2524 | ata_eh_detach_dev(dev); |
2549 | ata_dev_init(dev); | 2525 | ata_dev_init(dev); |
2550 | ehc->did_probe_mask |= (1 << dev->devno); | 2526 | ehc->did_probe_mask |= (1 << dev->devno); |
2551 | ehc->i.action |= ATA_EH_SOFTRESET; | 2527 | ehc->i.action |= ATA_EH_RESET; |
2552 | ehc->saved_xfer_mode[dev->devno] = 0; | 2528 | ehc->saved_xfer_mode[dev->devno] = 0; |
2553 | ehc->saved_ncq_enabled &= ~(1 << dev->devno); | 2529 | ehc->saved_ncq_enabled &= ~(1 << dev->devno); |
2554 | 2530 | ||
@@ -2592,12 +2568,7 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err) | |||
2592 | 2568 | ||
2593 | return 1; | 2569 | return 1; |
2594 | } else { | 2570 | } else { |
2595 | /* soft didn't work? be haaaaard */ | 2571 | ehc->i.action |= ATA_EH_RESET; |
2596 | if (ehc->i.flags & ATA_EHI_DID_RESET) | ||
2597 | ehc->i.action |= ATA_EH_HARDRESET; | ||
2598 | else | ||
2599 | ehc->i.action |= ATA_EH_SOFTRESET; | ||
2600 | |||
2601 | return 0; | 2572 | return 0; |
2602 | } | 2573 | } |
2603 | } | 2574 | } |
@@ -2690,7 +2661,7 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
2690 | ehc->i.action = 0; | 2661 | ehc->i.action = 0; |
2691 | 2662 | ||
2692 | /* do we need to reset? */ | 2663 | /* do we need to reset? */ |
2693 | if (ehc->i.action & ATA_EH_RESET_MASK) | 2664 | if (ehc->i.action & ATA_EH_RESET) |
2694 | reset = 1; | 2665 | reset = 1; |
2695 | 2666 | ||
2696 | ata_link_for_each_dev(dev, link) | 2667 | ata_link_for_each_dev(dev, link) |
@@ -2708,7 +2679,7 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
2708 | ata_port_for_each_link(link, ap) { | 2679 | ata_port_for_each_link(link, ap) { |
2709 | struct ata_eh_context *ehc = &link->eh_context; | 2680 | struct ata_eh_context *ehc = &link->eh_context; |
2710 | 2681 | ||
2711 | if (!(ehc->i.action & ATA_EH_RESET_MASK)) | 2682 | if (!(ehc->i.action & ATA_EH_RESET)) |
2712 | continue; | 2683 | continue; |
2713 | 2684 | ||
2714 | rc = ata_eh_reset(link, ata_link_nr_vacant(link), | 2685 | rc = ata_eh_reset(link, ata_link_nr_vacant(link), |
diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c index d91f5090ba9d..8439fc8efdd6 100644 --- a/drivers/ata/libata-pmp.c +++ b/drivers/ata/libata-pmp.c | |||
@@ -194,15 +194,6 @@ int sata_pmp_std_prereset(struct ata_link *link, unsigned long deadline) | |||
194 | const unsigned long *timing = sata_ehc_deb_timing(ehc); | 194 | const unsigned long *timing = sata_ehc_deb_timing(ehc); |
195 | int rc; | 195 | int rc; |
196 | 196 | ||
197 | /* force HRST? */ | ||
198 | if (link->flags & ATA_LFLAG_NO_SRST) | ||
199 | ehc->i.action |= ATA_EH_HARDRESET; | ||
200 | |||
201 | /* handle link resume */ | ||
202 | if ((ehc->i.flags & ATA_EHI_RESUME_LINK) && | ||
203 | (link->flags & ATA_LFLAG_HRST_TO_RESUME)) | ||
204 | ehc->i.action |= ATA_EH_HARDRESET; | ||
205 | |||
206 | /* if we're about to do hardreset, nothing more to do */ | 197 | /* if we're about to do hardreset, nothing more to do */ |
207 | if (ehc->i.action & ATA_EH_HARDRESET) | 198 | if (ehc->i.action & ATA_EH_HARDRESET) |
208 | return 0; | 199 | return 0; |
@@ -445,7 +436,7 @@ static int sata_pmp_init_links(struct ata_port *ap, int nr_ports) | |||
445 | 436 | ||
446 | link->flags = 0; | 437 | link->flags = 0; |
447 | ehc->i.probe_mask |= 1; | 438 | ehc->i.probe_mask |= 1; |
448 | ehc->i.action |= ATA_EH_SOFTRESET; | 439 | ehc->i.action |= ATA_EH_RESET; |
449 | ehc->i.flags |= ATA_EHI_RESUME_LINK; | 440 | ehc->i.flags |= ATA_EHI_RESUME_LINK; |
450 | } | 441 | } |
451 | 442 | ||
@@ -840,13 +831,12 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap, | |||
840 | retry: | 831 | retry: |
841 | ehc->classes[0] = ATA_DEV_UNKNOWN; | 832 | ehc->classes[0] = ATA_DEV_UNKNOWN; |
842 | 833 | ||
843 | if (ehc->i.action & ATA_EH_RESET_MASK) { | 834 | if (ehc->i.action & ATA_EH_RESET) { |
844 | struct ata_link *tlink; | 835 | struct ata_link *tlink; |
845 | 836 | ||
846 | ata_eh_freeze_port(ap); | 837 | ata_eh_freeze_port(ap); |
847 | 838 | ||
848 | /* reset */ | 839 | /* reset */ |
849 | ehc->i.action = ATA_EH_HARDRESET; | ||
850 | rc = ata_eh_reset(link, 0, prereset, softreset, hardreset, | 840 | rc = ata_eh_reset(link, 0, prereset, softreset, hardreset, |
851 | postreset); | 841 | postreset); |
852 | if (rc) { | 842 | if (rc) { |
@@ -890,11 +880,11 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap, | |||
890 | reval_failed = 1; | 880 | reval_failed = 1; |
891 | 881 | ||
892 | ata_dev_printk(dev, KERN_WARNING, | 882 | ata_dev_printk(dev, KERN_WARNING, |
893 | "retrying hardreset%s\n", | 883 | "retrying reset%s\n", |
894 | sleep ? " in 5 secs" : ""); | 884 | sleep ? " in 5 secs" : ""); |
895 | if (sleep) | 885 | if (sleep) |
896 | ssleep(5); | 886 | ssleep(5); |
897 | ehc->i.action |= ATA_EH_HARDRESET; | 887 | ehc->i.action |= ATA_EH_RESET; |
898 | goto retry; | 888 | goto retry; |
899 | } else { | 889 | } else { |
900 | ata_dev_printk(dev, KERN_ERR, "failed to recover PMP " | 890 | ata_dev_printk(dev, KERN_ERR, "failed to recover PMP " |
@@ -938,10 +928,8 @@ static int sata_pmp_eh_handle_disabled_links(struct ata_port *ap) | |||
938 | /* Some PMPs require hardreset sequence to get | 928 | /* Some PMPs require hardreset sequence to get |
939 | * SError.N working. | 929 | * SError.N working. |
940 | */ | 930 | */ |
941 | if ((link->flags & ATA_LFLAG_HRST_TO_RESUME) && | 931 | sata_link_hardreset(link, sata_deb_timing_normal, |
942 | (link->eh_context.i.flags & ATA_EHI_RESUME_LINK)) | 932 | jiffies + ATA_TMOUT_INTERNAL_QUICK); |
943 | sata_link_hardreset(link, sata_deb_timing_normal, | ||
944 | jiffies + ATA_TMOUT_INTERNAL_QUICK); | ||
945 | 933 | ||
946 | /* unconditionally clear SError.N */ | 934 | /* unconditionally clear SError.N */ |
947 | rc = sata_scr_write(link, SCR_ERROR, SERR_PHYRDY_CHG); | 935 | rc = sata_scr_write(link, SCR_ERROR, SERR_PHYRDY_CHG); |
@@ -1124,7 +1112,7 @@ static int sata_pmp_eh_recover(struct ata_port *ap, | |||
1124 | 1112 | ||
1125 | link_fail: | 1113 | link_fail: |
1126 | if (sata_pmp_handle_link_fail(link, link_tries)) { | 1114 | if (sata_pmp_handle_link_fail(link, link_tries)) { |
1127 | pmp_ehc->i.action |= ATA_EH_HARDRESET; | 1115 | pmp_ehc->i.action |= ATA_EH_RESET; |
1128 | goto retry; | 1116 | goto retry; |
1129 | } | 1117 | } |
1130 | 1118 | ||
@@ -1142,7 +1130,7 @@ static int sata_pmp_eh_recover(struct ata_port *ap, | |||
1142 | if (--pmp_tries) { | 1130 | if (--pmp_tries) { |
1143 | ata_port_printk(ap, KERN_WARNING, | 1131 | ata_port_printk(ap, KERN_WARNING, |
1144 | "failed to recover PMP, retrying in 5 secs\n"); | 1132 | "failed to recover PMP, retrying in 5 secs\n"); |
1145 | pmp_ehc->i.action |= ATA_EH_HARDRESET; | 1133 | pmp_ehc->i.action |= ATA_EH_RESET; |
1146 | ssleep(5); | 1134 | ssleep(5); |
1147 | goto retry; | 1135 | goto retry; |
1148 | } | 1136 | } |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 15795394b0a8..1f036a7b14f3 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -3508,7 +3508,7 @@ static int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel, | |||
3508 | ata_port_for_each_link(link, ap) { | 3508 | ata_port_for_each_link(link, ap) { |
3509 | struct ata_eh_info *ehi = &link->eh_info; | 3509 | struct ata_eh_info *ehi = &link->eh_info; |
3510 | ehi->probe_mask |= (1 << ata_link_max_devices(link)) - 1; | 3510 | ehi->probe_mask |= (1 << ata_link_max_devices(link)) - 1; |
3511 | ehi->action |= ATA_EH_SOFTRESET; | 3511 | ehi->action |= ATA_EH_RESET; |
3512 | } | 3512 | } |
3513 | } else { | 3513 | } else { |
3514 | struct ata_device *dev = ata_find_dev(ap, devno); | 3514 | struct ata_device *dev = ata_find_dev(ap, devno); |
@@ -3516,7 +3516,7 @@ static int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel, | |||
3516 | if (dev) { | 3516 | if (dev) { |
3517 | struct ata_eh_info *ehi = &dev->link->eh_info; | 3517 | struct ata_eh_info *ehi = &dev->link->eh_info; |
3518 | ehi->probe_mask |= 1 << dev->devno; | 3518 | ehi->probe_mask |= 1 << dev->devno; |
3519 | ehi->action |= ATA_EH_SOFTRESET; | 3519 | ehi->action |= ATA_EH_RESET; |
3520 | ehi->flags |= ATA_EHI_RESUME_LINK; | 3520 | ehi->flags |= ATA_EHI_RESUME_LINK; |
3521 | } else | 3521 | } else |
3522 | rc = -EINVAL; | 3522 | rc = -EINVAL; |
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index 9d1e3cad4aa9..fbd423ad23bb 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c | |||
@@ -996,7 +996,7 @@ static void sata_fsl_error_intr(struct ata_port *ap) | |||
996 | /* handle fatal errors */ | 996 | /* handle fatal errors */ |
997 | if (hstatus & FATAL_ERROR_DECODE) { | 997 | if (hstatus & FATAL_ERROR_DECODE) { |
998 | err_mask |= AC_ERR_ATA_BUS; | 998 | err_mask |= AC_ERR_ATA_BUS; |
999 | action |= ATA_EH_SOFTRESET; | 999 | action |= ATA_EH_RESET; |
1000 | /* how will fatal error interrupts be completed ?? */ | 1000 | /* how will fatal error interrupts be completed ?? */ |
1001 | freeze = 1; | 1001 | freeze = 1; |
1002 | } | 1002 | } |
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index 6ebebde8454a..a4944c8ad46d 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -1524,14 +1524,14 @@ static void mv_err_intr(struct ata_port *ap, struct ata_queued_cmd *qc) | |||
1524 | EDMA_ERR_CRQB_PAR | EDMA_ERR_CRPB_PAR | | 1524 | EDMA_ERR_CRQB_PAR | EDMA_ERR_CRPB_PAR | |
1525 | EDMA_ERR_INTRL_PAR)) { | 1525 | EDMA_ERR_INTRL_PAR)) { |
1526 | err_mask |= AC_ERR_ATA_BUS; | 1526 | err_mask |= AC_ERR_ATA_BUS; |
1527 | action |= ATA_EH_HARDRESET; | 1527 | action |= ATA_EH_RESET; |
1528 | ata_ehi_push_desc(ehi, "parity error"); | 1528 | ata_ehi_push_desc(ehi, "parity error"); |
1529 | } | 1529 | } |
1530 | if (edma_err_cause & (EDMA_ERR_DEV_DCON | EDMA_ERR_DEV_CON)) { | 1530 | if (edma_err_cause & (EDMA_ERR_DEV_DCON | EDMA_ERR_DEV_CON)) { |
1531 | ata_ehi_hotplugged(ehi); | 1531 | ata_ehi_hotplugged(ehi); |
1532 | ata_ehi_push_desc(ehi, edma_err_cause & EDMA_ERR_DEV_DCON ? | 1532 | ata_ehi_push_desc(ehi, edma_err_cause & EDMA_ERR_DEV_DCON ? |
1533 | "dev disconnect" : "dev connect"); | 1533 | "dev disconnect" : "dev connect"); |
1534 | action |= ATA_EH_HARDRESET; | 1534 | action |= ATA_EH_RESET; |
1535 | } | 1535 | } |
1536 | 1536 | ||
1537 | if (IS_GEN_I(hpriv)) { | 1537 | if (IS_GEN_I(hpriv)) { |
@@ -1555,7 +1555,7 @@ static void mv_err_intr(struct ata_port *ap, struct ata_queued_cmd *qc) | |||
1555 | sata_scr_read(&ap->link, SCR_ERROR, &serr); | 1555 | sata_scr_read(&ap->link, SCR_ERROR, &serr); |
1556 | sata_scr_write_flush(&ap->link, SCR_ERROR, serr); | 1556 | sata_scr_write_flush(&ap->link, SCR_ERROR, serr); |
1557 | err_mask = AC_ERR_ATA_BUS; | 1557 | err_mask = AC_ERR_ATA_BUS; |
1558 | action |= ATA_EH_HARDRESET; | 1558 | action |= ATA_EH_RESET; |
1559 | } | 1559 | } |
1560 | } | 1560 | } |
1561 | 1561 | ||
@@ -1564,7 +1564,7 @@ static void mv_err_intr(struct ata_port *ap, struct ata_queued_cmd *qc) | |||
1564 | 1564 | ||
1565 | if (!err_mask) { | 1565 | if (!err_mask) { |
1566 | err_mask = AC_ERR_OTHER; | 1566 | err_mask = AC_ERR_OTHER; |
1567 | action |= ATA_EH_HARDRESET; | 1567 | action |= ATA_EH_RESET; |
1568 | } | 1568 | } |
1569 | 1569 | ||
1570 | ehi->serror |= serr; | 1570 | ehi->serror |= serr; |
@@ -1780,7 +1780,7 @@ static void mv_pci_error(struct ata_host *host, void __iomem *mmio) | |||
1780 | ata_ehi_push_desc(ehi, | 1780 | ata_ehi_push_desc(ehi, |
1781 | "PCI err cause 0x%08x", err_cause); | 1781 | "PCI err cause 0x%08x", err_cause); |
1782 | err_mask = AC_ERR_HOST_BUS; | 1782 | err_mask = AC_ERR_HOST_BUS; |
1783 | ehi->action = ATA_EH_HARDRESET; | 1783 | ehi->action = ATA_EH_RESET; |
1784 | qc = ata_qc_from_tag(ap, ap->link.active_tag); | 1784 | qc = ata_qc_from_tag(ap, ap->link.active_tag); |
1785 | if (qc) | 1785 | if (qc) |
1786 | qc->err_mask |= err_mask; | 1786 | qc->err_mask |= err_mask; |
@@ -2449,28 +2449,13 @@ static int mv_prereset(struct ata_link *link, unsigned long deadline) | |||
2449 | { | 2449 | { |
2450 | struct ata_port *ap = link->ap; | 2450 | struct ata_port *ap = link->ap; |
2451 | struct mv_port_priv *pp = ap->private_data; | 2451 | struct mv_port_priv *pp = ap->private_data; |
2452 | struct ata_eh_context *ehc = &link->eh_context; | ||
2453 | int rc; | ||
2454 | 2452 | ||
2455 | rc = mv_stop_dma(ap); | 2453 | mv_stop_dma(ap); |
2456 | if (rc) | ||
2457 | ehc->i.action |= ATA_EH_HARDRESET; | ||
2458 | 2454 | ||
2459 | if (!(pp->pp_flags & MV_PP_FLAG_HAD_A_RESET)) { | 2455 | if (!(pp->pp_flags & MV_PP_FLAG_HAD_A_RESET)) |
2460 | pp->pp_flags |= MV_PP_FLAG_HAD_A_RESET; | 2456 | pp->pp_flags |= MV_PP_FLAG_HAD_A_RESET; |
2461 | ehc->i.action |= ATA_EH_HARDRESET; | ||
2462 | } | ||
2463 | |||
2464 | /* if we're about to do hardreset, nothing more to do */ | ||
2465 | if (ehc->i.action & ATA_EH_HARDRESET) | ||
2466 | return 0; | ||
2467 | |||
2468 | if (ata_link_online(link)) | ||
2469 | rc = ata_wait_ready(ap, deadline); | ||
2470 | else | ||
2471 | rc = -ENODEV; | ||
2472 | 2457 | ||
2473 | return rc; | 2458 | return 0; |
2474 | } | 2459 | } |
2475 | 2460 | ||
2476 | static int mv_hardreset(struct ata_link *link, unsigned int *class, | 2461 | static int mv_hardreset(struct ata_link *link, unsigned int *class, |
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index ed5473bf7a0a..ce02e15c857c 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
@@ -929,7 +929,7 @@ static int nv_adma_check_cpb(struct ata_port *ap, int cpb_num, int force_err) | |||
929 | "notifier for tag %d with no cmd?\n", | 929 | "notifier for tag %d with no cmd?\n", |
930 | cpb_num); | 930 | cpb_num); |
931 | ehi->err_mask |= AC_ERR_HSM; | 931 | ehi->err_mask |= AC_ERR_HSM; |
932 | ehi->action |= ATA_EH_SOFTRESET; | 932 | ehi->action |= ATA_EH_RESET; |
933 | ata_port_freeze(ap); | 933 | ata_port_freeze(ap); |
934 | return 1; | 934 | return 1; |
935 | } | 935 | } |
@@ -1892,7 +1892,7 @@ static void nv_swncq_error_handler(struct ata_port *ap) | |||
1892 | 1892 | ||
1893 | if (ap->link.sactive) { | 1893 | if (ap->link.sactive) { |
1894 | nv_swncq_ncq_stop(ap); | 1894 | nv_swncq_ncq_stop(ap); |
1895 | ehc->i.action |= ATA_EH_HARDRESET; | 1895 | ehc->i.action |= ATA_EH_RESET; |
1896 | } | 1896 | } |
1897 | 1897 | ||
1898 | ata_bmdma_drive_eh(ap, ata_std_prereset, ata_std_softreset, | 1898 | ata_bmdma_drive_eh(ap, ata_std_prereset, ata_std_softreset, |
@@ -2173,7 +2173,7 @@ static int nv_swncq_sdbfis(struct ata_port *ap) | |||
2173 | ata_ehi_clear_desc(ehi); | 2173 | ata_ehi_clear_desc(ehi); |
2174 | ata_ehi_push_desc(ehi, "BMDMA stat 0x%x", host_stat); | 2174 | ata_ehi_push_desc(ehi, "BMDMA stat 0x%x", host_stat); |
2175 | ehi->err_mask |= AC_ERR_HOST_BUS; | 2175 | ehi->err_mask |= AC_ERR_HOST_BUS; |
2176 | ehi->action |= ATA_EH_SOFTRESET; | 2176 | ehi->action |= ATA_EH_RESET; |
2177 | return -EINVAL; | 2177 | return -EINVAL; |
2178 | } | 2178 | } |
2179 | 2179 | ||
@@ -2188,7 +2188,7 @@ static int nv_swncq_sdbfis(struct ata_port *ap) | |||
2188 | ata_ehi_push_desc(ehi, "illegal SWNCQ:qc_active transition" | 2188 | ata_ehi_push_desc(ehi, "illegal SWNCQ:qc_active transition" |
2189 | "(%08x->%08x)", pp->qc_active, sactive); | 2189 | "(%08x->%08x)", pp->qc_active, sactive); |
2190 | ehi->err_mask |= AC_ERR_HSM; | 2190 | ehi->err_mask |= AC_ERR_HSM; |
2191 | ehi->action |= ATA_EH_HARDRESET; | 2191 | ehi->action |= ATA_EH_RESET; |
2192 | return -EINVAL; | 2192 | return -EINVAL; |
2193 | } | 2193 | } |
2194 | for (i = 0; i < ATA_MAX_QUEUE; i++) { | 2194 | for (i = 0; i < ATA_MAX_QUEUE; i++) { |
@@ -2324,7 +2324,7 @@ static void nv_swncq_host_interrupt(struct ata_port *ap, u16 fis) | |||
2324 | ata_ehi_push_desc(ehi, "Ata error. fis:0x%X", fis); | 2324 | ata_ehi_push_desc(ehi, "Ata error. fis:0x%X", fis); |
2325 | ehi->err_mask |= AC_ERR_DEV; | 2325 | ehi->err_mask |= AC_ERR_DEV; |
2326 | ehi->serror |= serror; | 2326 | ehi->serror |= serror; |
2327 | ehi->action |= ATA_EH_SOFTRESET; | 2327 | ehi->action |= ATA_EH_RESET; |
2328 | ata_port_freeze(ap); | 2328 | ata_port_freeze(ap); |
2329 | return; | 2329 | return; |
2330 | } | 2330 | } |
@@ -2356,7 +2356,7 @@ static void nv_swncq_host_interrupt(struct ata_port *ap, u16 fis) | |||
2356 | if (pp->ncq_flags & (ncq_saw_sdb | ncq_saw_backout)) { | 2356 | if (pp->ncq_flags & (ncq_saw_sdb | ncq_saw_backout)) { |
2357 | ata_ehi_push_desc(ehi, "illegal fis transaction"); | 2357 | ata_ehi_push_desc(ehi, "illegal fis transaction"); |
2358 | ehi->err_mask |= AC_ERR_HSM; | 2358 | ehi->err_mask |= AC_ERR_HSM; |
2359 | ehi->action |= ATA_EH_HARDRESET; | 2359 | ehi->action |= ATA_EH_RESET; |
2360 | goto irq_error; | 2360 | goto irq_error; |
2361 | } | 2361 | } |
2362 | 2362 | ||
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c index df7988df7908..aa8d0323c9bb 100644 --- a/drivers/ata/sata_sil24.c +++ b/drivers/ata/sata_sil24.c | |||
@@ -286,45 +286,45 @@ static struct sil24_cerr_info { | |||
286 | "device error via D2H FIS" }, | 286 | "device error via D2H FIS" }, |
287 | [PORT_CERR_SDB] = { AC_ERR_DEV, 0, | 287 | [PORT_CERR_SDB] = { AC_ERR_DEV, 0, |
288 | "device error via SDB FIS" }, | 288 | "device error via SDB FIS" }, |
289 | [PORT_CERR_DATA] = { AC_ERR_ATA_BUS, ATA_EH_SOFTRESET, | 289 | [PORT_CERR_DATA] = { AC_ERR_ATA_BUS, ATA_EH_RESET, |
290 | "error in data FIS" }, | 290 | "error in data FIS" }, |
291 | [PORT_CERR_SEND] = { AC_ERR_ATA_BUS, ATA_EH_SOFTRESET, | 291 | [PORT_CERR_SEND] = { AC_ERR_ATA_BUS, ATA_EH_RESET, |
292 | "failed to transmit command FIS" }, | 292 | "failed to transmit command FIS" }, |
293 | [PORT_CERR_INCONSISTENT] = { AC_ERR_HSM, ATA_EH_SOFTRESET, | 293 | [PORT_CERR_INCONSISTENT] = { AC_ERR_HSM, ATA_EH_RESET, |
294 | "protocol mismatch" }, | 294 | "protocol mismatch" }, |
295 | [PORT_CERR_DIRECTION] = { AC_ERR_HSM, ATA_EH_SOFTRESET, | 295 | [PORT_CERR_DIRECTION] = { AC_ERR_HSM, ATA_EH_RESET, |
296 | "data directon mismatch" }, | 296 | "data directon mismatch" }, |
297 | [PORT_CERR_UNDERRUN] = { AC_ERR_HSM, ATA_EH_SOFTRESET, | 297 | [PORT_CERR_UNDERRUN] = { AC_ERR_HSM, ATA_EH_RESET, |
298 | "ran out of SGEs while writing" }, | 298 | "ran out of SGEs while writing" }, |
299 | [PORT_CERR_OVERRUN] = { AC_ERR_HSM, ATA_EH_SOFTRESET, | 299 | [PORT_CERR_OVERRUN] = { AC_ERR_HSM, ATA_EH_RESET, |
300 | "ran out of SGEs while reading" }, | 300 | "ran out of SGEs while reading" }, |
301 | [PORT_CERR_PKT_PROT] = { AC_ERR_HSM, ATA_EH_SOFTRESET, | 301 | [PORT_CERR_PKT_PROT] = { AC_ERR_HSM, ATA_EH_RESET, |
302 | "invalid data directon for ATAPI CDB" }, | 302 | "invalid data directon for ATAPI CDB" }, |
303 | [PORT_CERR_SGT_BOUNDARY] = { AC_ERR_SYSTEM, ATA_EH_SOFTRESET, | 303 | [PORT_CERR_SGT_BOUNDARY] = { AC_ERR_SYSTEM, ATA_EH_RESET, |
304 | "SGT not on qword boundary" }, | 304 | "SGT not on qword boundary" }, |
305 | [PORT_CERR_SGT_TGTABRT] = { AC_ERR_HOST_BUS, ATA_EH_SOFTRESET, | 305 | [PORT_CERR_SGT_TGTABRT] = { AC_ERR_HOST_BUS, ATA_EH_RESET, |
306 | "PCI target abort while fetching SGT" }, | 306 | "PCI target abort while fetching SGT" }, |
307 | [PORT_CERR_SGT_MSTABRT] = { AC_ERR_HOST_BUS, ATA_EH_SOFTRESET, | 307 | [PORT_CERR_SGT_MSTABRT] = { AC_ERR_HOST_BUS, ATA_EH_RESET, |
308 | "PCI master abort while fetching SGT" }, | 308 | "PCI master abort while fetching SGT" }, |
309 | [PORT_CERR_SGT_PCIPERR] = { AC_ERR_HOST_BUS, ATA_EH_SOFTRESET, | 309 | [PORT_CERR_SGT_PCIPERR] = { AC_ERR_HOST_BUS, ATA_EH_RESET, |
310 | "PCI parity error while fetching SGT" }, | 310 | "PCI parity error while fetching SGT" }, |
311 | [PORT_CERR_CMD_BOUNDARY] = { AC_ERR_SYSTEM, ATA_EH_SOFTRESET, | 311 | [PORT_CERR_CMD_BOUNDARY] = { AC_ERR_SYSTEM, ATA_EH_RESET, |
312 | "PRB not on qword boundary" }, | 312 | "PRB not on qword boundary" }, |
313 | [PORT_CERR_CMD_TGTABRT] = { AC_ERR_HOST_BUS, ATA_EH_SOFTRESET, | 313 | [PORT_CERR_CMD_TGTABRT] = { AC_ERR_HOST_BUS, ATA_EH_RESET, |
314 | "PCI target abort while fetching PRB" }, | 314 | "PCI target abort while fetching PRB" }, |
315 | [PORT_CERR_CMD_MSTABRT] = { AC_ERR_HOST_BUS, ATA_EH_SOFTRESET, | 315 | [PORT_CERR_CMD_MSTABRT] = { AC_ERR_HOST_BUS, ATA_EH_RESET, |
316 | "PCI master abort while fetching PRB" }, | 316 | "PCI master abort while fetching PRB" }, |
317 | [PORT_CERR_CMD_PCIPERR] = { AC_ERR_HOST_BUS, ATA_EH_SOFTRESET, | 317 | [PORT_CERR_CMD_PCIPERR] = { AC_ERR_HOST_BUS, ATA_EH_RESET, |
318 | "PCI parity error while fetching PRB" }, | 318 | "PCI parity error while fetching PRB" }, |
319 | [PORT_CERR_XFR_UNDEF] = { AC_ERR_HOST_BUS, ATA_EH_SOFTRESET, | 319 | [PORT_CERR_XFR_UNDEF] = { AC_ERR_HOST_BUS, ATA_EH_RESET, |
320 | "undefined error while transferring data" }, | 320 | "undefined error while transferring data" }, |
321 | [PORT_CERR_XFR_TGTABRT] = { AC_ERR_HOST_BUS, ATA_EH_SOFTRESET, | 321 | [PORT_CERR_XFR_TGTABRT] = { AC_ERR_HOST_BUS, ATA_EH_RESET, |
322 | "PCI target abort while transferring data" }, | 322 | "PCI target abort while transferring data" }, |
323 | [PORT_CERR_XFR_MSTABRT] = { AC_ERR_HOST_BUS, ATA_EH_SOFTRESET, | 323 | [PORT_CERR_XFR_MSTABRT] = { AC_ERR_HOST_BUS, ATA_EH_RESET, |
324 | "PCI master abort while transferring data" }, | 324 | "PCI master abort while transferring data" }, |
325 | [PORT_CERR_XFR_PCIPERR] = { AC_ERR_HOST_BUS, ATA_EH_SOFTRESET, | 325 | [PORT_CERR_XFR_PCIPERR] = { AC_ERR_HOST_BUS, ATA_EH_RESET, |
326 | "PCI parity error while transferring data" }, | 326 | "PCI parity error while transferring data" }, |
327 | [PORT_CERR_SENDSERVICE] = { AC_ERR_HSM, ATA_EH_SOFTRESET, | 327 | [PORT_CERR_SENDSERVICE] = { AC_ERR_HSM, ATA_EH_RESET, |
328 | "FIS received while sending service FIS" }, | 328 | "FIS received while sending service FIS" }, |
329 | }; | 329 | }; |
330 | 330 | ||
@@ -616,7 +616,7 @@ static int sil24_init_port(struct ata_port *ap) | |||
616 | 616 | ||
617 | if ((tmp & (PORT_CS_INIT | PORT_CS_RDY)) != PORT_CS_RDY) { | 617 | if ((tmp & (PORT_CS_INIT | PORT_CS_RDY)) != PORT_CS_RDY) { |
618 | pp->do_port_rst = 1; | 618 | pp->do_port_rst = 1; |
619 | ap->link.eh_context.i.action |= ATA_EH_HARDRESET; | 619 | ap->link.eh_context.i.action |= ATA_EH_RESET; |
620 | return -EIO; | 620 | return -EIO; |
621 | } | 621 | } |
622 | 622 | ||
@@ -1022,7 +1022,7 @@ static void sil24_error_intr(struct ata_port *ap) | |||
1022 | 1022 | ||
1023 | if (irq_stat & PORT_IRQ_UNK_FIS) { | 1023 | if (irq_stat & PORT_IRQ_UNK_FIS) { |
1024 | ehi->err_mask |= AC_ERR_HSM; | 1024 | ehi->err_mask |= AC_ERR_HSM; |
1025 | ehi->action |= ATA_EH_SOFTRESET; | 1025 | ehi->action |= ATA_EH_RESET; |
1026 | ata_ehi_push_desc(ehi, "unknown FIS"); | 1026 | ata_ehi_push_desc(ehi, "unknown FIS"); |
1027 | freeze = 1; | 1027 | freeze = 1; |
1028 | } | 1028 | } |
@@ -1043,7 +1043,7 @@ static void sil24_error_intr(struct ata_port *ap) | |||
1043 | */ | 1043 | */ |
1044 | if (ap->nr_active_links >= 3) { | 1044 | if (ap->nr_active_links >= 3) { |
1045 | ehi->err_mask |= AC_ERR_OTHER; | 1045 | ehi->err_mask |= AC_ERR_OTHER; |
1046 | ehi->action |= ATA_EH_HARDRESET; | 1046 | ehi->action |= ATA_EH_RESET; |
1047 | ata_ehi_push_desc(ehi, "PMP DMA CS errata"); | 1047 | ata_ehi_push_desc(ehi, "PMP DMA CS errata"); |
1048 | pp->do_port_rst = 1; | 1048 | pp->do_port_rst = 1; |
1049 | freeze = 1; | 1049 | freeze = 1; |
@@ -1064,7 +1064,7 @@ static void sil24_error_intr(struct ata_port *ap) | |||
1064 | irq_stat); | 1064 | irq_stat); |
1065 | } else { | 1065 | } else { |
1066 | err_mask |= AC_ERR_HSM; | 1066 | err_mask |= AC_ERR_HSM; |
1067 | action |= ATA_EH_HARDRESET; | 1067 | action |= ATA_EH_RESET; |
1068 | freeze = 1; | 1068 | freeze = 1; |
1069 | } | 1069 | } |
1070 | } else | 1070 | } else |
@@ -1078,12 +1078,12 @@ static void sil24_error_intr(struct ata_port *ap) | |||
1078 | if (ci && ci->desc) { | 1078 | if (ci && ci->desc) { |
1079 | err_mask |= ci->err_mask; | 1079 | err_mask |= ci->err_mask; |
1080 | action |= ci->action; | 1080 | action |= ci->action; |
1081 | if (action & ATA_EH_RESET_MASK) | 1081 | if (action & ATA_EH_RESET) |
1082 | freeze = 1; | 1082 | freeze = 1; |
1083 | ata_ehi_push_desc(ehi, "%s", ci->desc); | 1083 | ata_ehi_push_desc(ehi, "%s", ci->desc); |
1084 | } else { | 1084 | } else { |
1085 | err_mask |= AC_ERR_OTHER; | 1085 | err_mask |= AC_ERR_OTHER; |
1086 | action |= ATA_EH_SOFTRESET; | 1086 | action |= ATA_EH_RESET; |
1087 | freeze = 1; | 1087 | freeze = 1; |
1088 | ata_ehi_push_desc(ehi, "unknown command error %d", | 1088 | ata_ehi_push_desc(ehi, "unknown command error %d", |
1089 | cerr); | 1089 | cerr); |
@@ -1153,7 +1153,7 @@ static inline void sil24_host_intr(struct ata_port *ap) | |||
1153 | if (rc < 0) { | 1153 | if (rc < 0) { |
1154 | struct ata_eh_info *ehi = &ap->link.eh_info; | 1154 | struct ata_eh_info *ehi = &ap->link.eh_info; |
1155 | ehi->err_mask |= AC_ERR_HSM; | 1155 | ehi->err_mask |= AC_ERR_HSM; |
1156 | ehi->action |= ATA_EH_SOFTRESET; | 1156 | ehi->action |= ATA_EH_RESET; |
1157 | ata_port_freeze(ap); | 1157 | ata_port_freeze(ap); |
1158 | return; | 1158 | return; |
1159 | } | 1159 | } |
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c index 0d03f44824fb..c0e0f1d18d50 100644 --- a/drivers/ata/sata_via.c +++ b/drivers/ata/sata_via.c | |||
@@ -320,7 +320,7 @@ static int vt6420_prereset(struct ata_link *link, unsigned long deadline) | |||
320 | 320 | ||
321 | if (!online) { | 321 | if (!online) { |
322 | /* tell EH to bail */ | 322 | /* tell EH to bail */ |
323 | ehc->i.action &= ~ATA_EH_RESET_MASK; | 323 | ehc->i.action &= ~ATA_EH_RESET; |
324 | return 0; | 324 | return 0; |
325 | } | 325 | } |
326 | 326 | ||
diff --git a/include/linux/libata.h b/include/linux/libata.h index 37ee881c42ac..c63cfb3b222b 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -292,12 +292,12 @@ enum { | |||
292 | 292 | ||
293 | /* reset / recovery action types */ | 293 | /* reset / recovery action types */ |
294 | ATA_EH_REVALIDATE = (1 << 0), | 294 | ATA_EH_REVALIDATE = (1 << 0), |
295 | ATA_EH_SOFTRESET = (1 << 1), | 295 | ATA_EH_SOFTRESET = (1 << 1), /* meaningful only in ->prereset */ |
296 | ATA_EH_HARDRESET = (1 << 2), | 296 | ATA_EH_HARDRESET = (1 << 2), /* meaningful only in ->prereset */ |
297 | ATA_EH_RESET = ATA_EH_SOFTRESET | ATA_EH_HARDRESET, | ||
297 | ATA_EH_ENABLE_LINK = (1 << 3), | 298 | ATA_EH_ENABLE_LINK = (1 << 3), |
298 | ATA_EH_LPM = (1 << 4), /* link power management action */ | 299 | ATA_EH_LPM = (1 << 4), /* link power management action */ |
299 | 300 | ||
300 | ATA_EH_RESET_MASK = ATA_EH_SOFTRESET | ATA_EH_HARDRESET, | ||
301 | ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE, | 301 | ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE, |
302 | 302 | ||
303 | /* ata_eh_info->flags */ | 303 | /* ata_eh_info->flags */ |
@@ -1097,7 +1097,7 @@ extern void ata_ehi_clear_desc(struct ata_eh_info *ehi); | |||
1097 | static inline void ata_ehi_schedule_probe(struct ata_eh_info *ehi) | 1097 | static inline void ata_ehi_schedule_probe(struct ata_eh_info *ehi) |
1098 | { | 1098 | { |
1099 | ehi->flags |= ATA_EHI_RESUME_LINK; | 1099 | ehi->flags |= ATA_EHI_RESUME_LINK; |
1100 | ehi->action |= ATA_EH_SOFTRESET; | 1100 | ehi->action |= ATA_EH_RESET; |
1101 | ehi->probe_mask |= (1 << ATA_MAX_DEVICES) - 1; | 1101 | ehi->probe_mask |= (1 << ATA_MAX_DEVICES) - 1; |
1102 | } | 1102 | } |
1103 | 1103 | ||