35 #include <linux/kernel.h>
37 #include <linux/export.h>
38 #include <linux/pci.h>
39 #include <scsi/scsi.h>
45 #include "../scsi/scsi_transport_api.h"
100 static const unsigned long ata_eh_reset_timeouts[] = {
108 static const unsigned long ata_eh_identify_timeouts[] = {
115 static const unsigned long ata_eh_flush_timeouts[] = {
122 static const unsigned long ata_eh_other_timeouts[] = {
146 #define CMDS(cmds...) (const u8 []){ cmds, 0 }
150 .timeouts = ata_eh_identify_timeouts, },
152 .timeouts = ata_eh_other_timeouts, },
154 .timeouts = ata_eh_other_timeouts, },
156 .timeouts = ata_eh_other_timeouts, },
158 .timeouts = ata_eh_other_timeouts, },
160 .timeouts = ata_eh_flush_timeouts },
164 static void __ata_port_freeze(
struct ata_port *ap);
166 static void ata_eh_handle_port_suspend(
struct ata_port *ap);
167 static void ata_eh_handle_port_resume(
struct ata_port *ap);
169 static void ata_eh_handle_port_suspend(
struct ata_port *ap)
172 static void ata_eh_handle_port_resume(
struct ata_port *ap)
176 static void __ata_ehi_pushv_desc(
struct ata_eh_info *ehi,
const char *
fmt,
199 __ata_ehi_pushv_desc(ehi, fmt, args);
222 __ata_ehi_pushv_desc(ehi, fmt, args);
260 if (ap->
link.eh_info.desc_len)
264 __ata_ehi_pushv_desc(&ap->
link.eh_info, fmt, args);
301 ata_port_desc(ap,
"%s %s%llu@0x%llx", name, type, len, start);
304 start + (
unsigned long long)offset);
309 static int ata_lookup_timeout_table(
u8 cmd)
316 for (cur = ata_eh_cmd_timeout_table[i].
commands; *
cur; cur++)
340 int ent = ata_lookup_timeout_table(cmd);
347 return ata_eh_cmd_timeout_table[ent].
timeouts[
idx];
365 int ent = ata_lookup_timeout_table(cmd);
372 if (ata_eh_cmd_timeout_table[ent].timeouts[idx + 1] !=
ULONG_MAX)
376 static void ata_ering_record(
struct ata_ering *ering,
unsigned int eflags,
377 unsigned int err_mask)
413 rc = map_fn(ent, arg);
417 }
while (idx != ering->
cursor);
422 static int ata_ering_clear_cb(
struct ata_ering_entry *ent,
void *void_arg)
428 static void ata_ering_clear(
struct ata_ering *ering)
433 static unsigned int ata_eh_dev_action(
struct ata_device *
dev)
437 return ehc->
i.action | ehc->
i.dev_action[dev->
devno];
448 ehi->dev_action[tdev->
devno] &= ~action;
454 if (ehi->
action & action) {
456 ehi->dev_action[tdev->
devno] |=
457 ehi->action & action;
458 ehi->action &= ~action;
462 ehi->dev_action[dev->
devno] &= ~action;
523 struct ata_port *ap = ata_shost_to_port(host);
526 enum blk_eh_timer_return
ret;
530 if (ap->
ops->error_handler) {
531 ret = BLK_EH_NOT_HANDLED;
535 ret = BLK_EH_HANDLED;
537 qc = ata_qc_from_tag(ap, ap->
link.active_tag);
542 ret = BLK_EH_NOT_HANDLED;
544 spin_unlock_irqrestore(ap->
lock, flags);
547 DPRINTK(
"EXIT, ret=%d\n", ret);
551 static void ata_eh_unload(
struct ata_port *ap)
573 spin_unlock_irqrestore(ap->lock, flags);
590 struct ata_port *ap = ata_shost_to_port(host);
597 list_splice_init(&host->eh_cmd_q, &eh_work_q);
598 spin_unlock_irqrestore(host->host_lock, flags);
607 WARN_ON(host->host_failed || !list_empty(&eh_work_q));
645 if (ap->
ops->error_handler) {
660 if (ap->
ops->lost_interrupt)
661 ap->
ops->lost_interrupt(ap);
667 qc = __ata_qc_from_tag(ap, i);
673 if (i < ATA_MAX_QUEUE) {
698 __ata_port_freeze(ap);
700 spin_unlock_irqrestore(ap->
lock, flags);
705 spin_unlock_wait(ap->
lock);
723 if (ap->
ops->error_handler) {
733 ata_eh_handle_port_resume(ap);
750 if (ata_ncq_enabled(dev))
759 spin_unlock_irqrestore(ap->
lock, flags);
763 ap->
ops->error_handler(ap);
773 ata_eh_handle_port_suspend(ap);
783 spin_unlock_irqrestore(ap->
lock, flags);
787 "EH pending after %d tries, giving up\n",
803 spin_unlock_irqrestore(ap->
lock, flags);
807 ap->
ops->eng_timeout(ap);
829 spin_unlock_irqrestore(ap->
lock, flags);
852 spin_unlock_irqrestore(ap->
lock, flags);
858 spin_unlock_irqrestore(ap->
lock, flags);
861 if (scsi_host_in_recovery(ap->
scsi_host)) {
868 static int ata_eh_nr_in_flight(
struct ata_port *ap)
875 if (ata_qc_from_tag(ap, tag))
889 cnt = ata_eh_nr_in_flight(ap);
901 for (tag = 0; tag < ATA_MAX_QUEUE - 1; tag++) {
917 spin_unlock_irqrestore(ap->
lock, flags);
932 static void ata_eh_set_pending(
struct ata_port *ap,
int fastdrain)
946 cnt = ata_eh_nr_in_flight(ap);
976 ata_eh_set_pending(ap, 1);
985 spin_unlock_irqrestore(q->queue_lock, flags);
1002 ata_eh_set_pending(ap, 1);
1005 DPRINTK(
"port EH scheduled\n");
1043 ap->
ops->sched_eh(ap);
1048 int tag, nr_aborted = 0;
1053 ata_eh_set_pending(ap, 0);
1058 if (qc && (!link || qc->
dev->link == link)) {
1085 return ata_do_link_abort(link->
ap, link);
1102 return ata_do_link_abort(ap,
NULL);
1123 static void __ata_port_freeze(
struct ata_port *ap)
1127 if (ap->
ops->freeze)
1128 ap->
ops->freeze(ap);
1155 __ata_port_freeze(ap);
1186 if (!sata_pmp_attached(ap) || rc) {
1188 if (!sata_pmp_attached(ap)) {
1214 if (!(sntf & (1 << link->
pmp)))
1245 unsigned long flags;
1247 if (!ap->
ops->error_handler)
1251 __ata_port_freeze(ap);
1252 spin_unlock_irqrestore(ap->
lock, flags);
1266 unsigned long flags;
1268 if (!ap->
ops->error_handler)
1278 spin_unlock_irqrestore(ap->
lock, flags);
1283 static void ata_eh_scsidone(
struct scsi_cmnd *scmd)
1292 unsigned long flags;
1298 spin_unlock_irqrestore(ap->
lock, flags);
1314 __ata_eh_qc_complete(qc);
1333 __ata_eh_qc_complete(qc);
1347 if (!ata_dev_enabled(dev))
1359 ata_ering_clear(&dev->
ering);
1376 unsigned long flags;
1395 spin_unlock_irqrestore(ap->
lock, flags);
1412 unsigned int action)
1417 unsigned long flags;
1421 ata_eh_clear_action(link, dev, ehi, action);
1429 spin_unlock_irqrestore(ap->
lock, flags);
1445 unsigned int action)
1449 ata_eh_clear_action(link, dev, &ehc->
i, action);
1466 static const char *ata_err_string(
unsigned int err_mask)
1469 return "host bus error";
1471 return "ATA bus error";
1475 return "HSM violation";
1477 return "internal error";
1479 return "media error";
1481 return "invalid argument";
1483 return "device error";
1484 return "unknown error";
1507 unsigned int err_mask;
1509 DPRINTK(
"read log page - log 0x%x, page 0x%x\n", log, page);
1511 ata_tf_init(dev, &tf);
1523 DPRINTK(
"EXIT, err_mask=%x\n", err_mask);
1542 static int ata_eh_read_log_10h(
struct ata_device *dev,
1546 unsigned int err_mask;
1558 ata_dev_warn(dev,
"invalid checksum 0x%x on log page 10h\n",
1564 *tag = buf[0] & 0x1f;
1575 tf->
nsect = buf[12];
1594 static unsigned int atapi_eh_tur(
struct ata_device *dev,
u8 *r_sense_key)
1598 unsigned int err_mask;
1600 ata_tf_init(dev, &tf);
1608 *r_sense_key = tf.
feature >> 4;
1627 static unsigned int atapi_eh_request_sense(
struct ata_device *dev,
1628 u8 *sense_buf,
u8 dfl_sense_key)
1635 DPRINTK(
"ATAPI request sense\n");
1643 sense_buf[0] = 0x70;
1644 sense_buf[2] = dfl_sense_key;
1647 ata_tf_init(dev, &tf);
1676 static void ata_eh_analyze_serror(
struct ata_link *link)
1679 u32 serror = ehc->
i.serror;
1680 unsigned int err_mask = 0, action = 0;
1708 if (serror & hotplug_mask)
1709 ata_ehi_hotplugged(&ehc->
i);
1711 ehc->
i.err_mask |= err_mask;
1746 qc = __ata_qc_from_tag(ap, tag);
1756 memset(&tf, 0,
sizeof(tf));
1757 rc = ata_eh_read_log_10h(dev, &tag, &tf);
1759 ata_link_err(link,
"failed to read log page 10h (errno=%d)\n",
1764 if (!(link->
sactive & (1 << tag))) {
1765 ata_link_err(link,
"log page 10h reported inactive tag %d\n",
1771 qc = __ata_qc_from_tag(ap, tag);
1796 unsigned int tmp, action = 0;
1809 switch (qc->
dev->class) {
1821 tmp = atapi_eh_request_sense(qc->
dev,
1838 if (qc->
err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT | AC_ERR_ATA_BUS))
1844 static int ata_eh_categorize_error(
unsigned int eflags,
unsigned int err_mask,
1855 if (err_mask & AC_ERR_ATA_BUS)
1858 if (err_mask & AC_ERR_TIMEOUT)
1862 if (err_mask & AC_ERR_HSM)
1878 static int speed_down_verdict_cb(
struct ata_ering_entry *ent,
void *void_arg)
1950 static unsigned int ata_eh_speed_down_verdict(
struct ata_device *dev)
1952 const u64 j5mins = 5LLU * 60 *
HZ, j10mins = 10LLU * 60 *
HZ;
1955 unsigned int verdict = 0;
1959 arg.since = j64 -
min(j64, j5mins);
1971 if (
arg.nr_errors[ATA_ECAT_ATA_BUS] +
1972 arg.nr_errors[ATA_ECAT_TOUT_HSM] +
1978 arg.since = j64 -
min(j64, j10mins);
1981 if (
arg.nr_errors[ATA_ECAT_TOUT_HSM] +
1985 if (
arg.nr_errors[ATA_ECAT_ATA_BUS] +
1986 arg.nr_errors[ATA_ECAT_TOUT_HSM] > 3 ||
2010 static unsigned int ata_eh_speed_down(
struct ata_device *dev,
2011 unsigned int eflags,
unsigned int err_mask)
2015 unsigned int verdict;
2016 unsigned int action = 0;
2019 if (ata_eh_categorize_error(eflags, err_mask, &xfer_ok) == 0)
2023 ata_ering_record(&dev->
ering, eflags, err_mask);
2024 verdict = ata_eh_speed_down_verdict(dev);
2031 ata_dev_warn(dev,
"NCQ disabled due to excessive errors\n");
2045 static const int dma_dnxfer_sel[] =
2047 static const int pio_dnxfer_sel[] =
2052 sel = dma_dnxfer_sel[dev->
spdn_cnt];
2054 sel = pio_dnxfer_sel[dev->
spdn_cnt];
2082 ata_ering_clear(&dev->
ering);
2097 if (qc->
flags & AC_ERR_MEDIA)
2117 static void ata_eh_link_autopsy(
struct ata_link *link)
2122 unsigned int all_err_mask = 0, eflags = 0;
2135 ehc->
i.serror |= serror;
2136 ata_eh_analyze_serror(link);
2151 all_err_mask |= ehc->
i.err_mask;
2164 ehc->
i.action |= ata_eh_analyze_tf(qc, &qc->
result_tf);
2180 if (ata_eh_worth_retry(qc))
2184 ehc->
i.dev = qc->
dev;
2192 all_err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT))
2194 else if (((eflags & ATA_EFLAG_IS_IO) && all_err_mask) ||
2195 (!(eflags & ATA_EFLAG_IS_IO) && (all_err_mask & ~
AC_ERR_DEV)))
2202 ehc->
i.dev_action[ehc->
i.dev->devno] |=
2208 if ((all_err_mask & AC_ERR_TIMEOUT) && !ata_is_host_link(link))
2209 ap->
link.eh_context.i.err_mask |= AC_ERR_TIMEOUT;
2213 if (!dev && ((ata_link_max_devices(link) == 1 &&
2214 ata_dev_enabled(link->
device))))
2220 ehc->
i.action |= ata_eh_speed_down(dev, eflags, all_err_mask);
2241 ata_eh_link_autopsy(link);
2259 mehc->
i.action |= sehc->
i.action;
2260 mehc->
i.dev_action[1] |= sehc->
i.dev_action[1];
2261 mehc->
i.flags |= sehc->
i.flags;
2268 if (sata_pmp_attached(ap))
2269 ata_eh_link_autopsy(&ap->
link);
2284 #ifdef CONFIG_ATA_VERBOSE_ERROR
2375 for (i = 0; cmd_descr[
i].text; i++)
2376 if (cmd_descr[i].command == command)
2377 return cmd_descr[
i].text;
2392 static void ata_eh_link_report(
struct ata_link *link)
2396 const char *frozen, *
desc;
2398 int tag, nr_failed = 0;
2404 if (ehc->
i.desc[0] !=
'\0')
2421 if (!nr_failed && !ehc->
i.err_mask)
2428 memset(tries_buf, 0,
sizeof(tries_buf));
2430 snprintf(tries_buf,
sizeof(tries_buf) - 1,
" t%d",
2435 "SAct 0x%x SErr 0x%x action 0x%x%s%s\n",
2436 ehc->
i.err_mask, link->
sactive, ehc->
i.serror,
2437 ehc->
i.action, frozen, tries_buf);
2442 "SAct 0x%x SErr 0x%x action 0x%x%s%s\n",
2443 ehc->
i.err_mask, link->
sactive, ehc->
i.serror,
2444 ehc->
i.action, frozen, tries_buf);
2449 #ifdef CONFIG_ATA_VERBOSE_ERROR
2452 "SError: { %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s}\n",
2455 ehc->
i.serror &
SERR_DATA ?
"UnrecovData " :
"",
2457 ehc->
i.serror & SERR_PROTOCOL ?
"Proto " :
"",
2458 ehc->
i.serror & SERR_INTERNAL ?
"HostInt " :
"",
2464 ehc->
i.serror &
SERR_CRC ?
"BadCRC " :
"",
2475 const u8 *cdb = qc->
cdb;
2477 char cdb_buf[70] =
"";
2484 static const char *dma_str[] = {
2489 static const char *prot_str[] = {
2497 snprintf(data_buf,
sizeof(data_buf),
" %s %u %s",
2498 prot_str[qc->
tf.protocol], qc->
nbytes,
2502 if (ata_is_atapi(qc->
tf.protocol)) {
2507 "cdb %02x %02x %02x %02x %02x %02x %02x %02x "
2508 "%02x %02x %02x %02x %02x %02x %02x %02x\n ",
2509 cdb[0], cdb[1], cdb[2], cdb[3],
2510 cdb[4], cdb[5], cdb[6], cdb[7],
2511 cdb[8], cdb[9], cdb[10], cdb[11],
2512 cdb[12], cdb[13], cdb[14], cdb[15]);
2521 "cmd %02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x "
2523 "res %02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x "
2524 "Emask 0x%x (%s)%s\n",
2529 cmd->
device, qc->
tag, data_buf, cdb_buf,
2532 res->hob_feature,
res->hob_nsect,
2533 res->hob_lbal,
res->hob_lbam,
res->hob_lbah,
2537 #ifdef CONFIG_ATA_VERBOSE_ERROR
2551 (
res->feature & (ATA_ICRC | ATA_UNC | ATA_IDNF |
2554 res->feature & ATA_ICRC ?
"ICRC " :
"",
2555 res->feature & ATA_UNC ?
"UNC " :
"",
2556 res->feature & ATA_IDNF ?
"IDNF " :
"",
2576 ata_eh_link_report(link);
2580 unsigned int *classes,
unsigned long deadline,
2589 return reset(link, classes, deadline);
2592 static
int ata_eh_followup_srst_needed(
struct ata_link *link,
int rc)
2598 if (sata_pmp_supported(link->ap) && ata_is_host_link(link))
2611 unsigned int *classes = ehc->
classes;
2612 unsigned int lflags = link->
flags;
2614 int max_tries = 0,
try = 0;
2617 unsigned long deadline, now;
2619 unsigned long flags;
2626 while (ata_eh_reset_timeouts[max_tries] !=
ULONG_MAX)
2647 spin_unlock_irqrestore(ap->
lock, flags);
2666 if (ap->
ops->set_piomode)
2667 ap->
ops->set_piomode(ap, dev);
2676 }
else if (softreset) {
2682 unsigned long deadline = ata_deadline(
jiffies,
2687 sehc->
i.action |= ehc->
i.action;
2690 rc = prereset(link, deadline);
2696 if (slave && (rc == 0 || rc == -
ENOENT)) {
2699 tmp = prereset(slave, deadline);
2703 ehc->
i.action |= sehc->
i.action;
2717 "prereset failed (errno=%d)\n",
2729 ata_is_host_link(link))
2740 if (ata_is_host_link(link))
2743 deadline = ata_deadline(
jiffies, ata_eh_reset_timeouts[
try++]);
2748 reset == softreset ?
"soft" :
"hard");
2752 if (reset == hardreset)
2757 rc = ata_do_reset(link, reset, classes, deadline,
true);
2758 if (rc && rc != -
EAGAIN) {
2764 if (slave && reset == hardreset) {
2771 tmp = ata_do_reset(slave, reset, classes, deadline,
2779 failed_link = slave;
2786 if (reset == hardreset &&
2787 ata_eh_followup_srst_needed(link, rc)) {
2792 "follow-up softreset required but no softreset available\n");
2799 rc = ata_do_reset(link, reset, classes, deadline,
true);
2808 "no reset method available, skipping reset\n");
2836 link->
sata_spd = (sstatus >> 4) & 0xf;
2838 slave->
sata_spd = (sstatus >> 4) & 0xf;
2841 if (ata_is_host_link(link))
2852 postreset(link, classes);
2854 postreset(slave, classes);
2869 spin_unlock_irqrestore(link->
ap->lock, flags);
2885 if (classes[dev->
devno] == ATA_DEV_UNKNOWN) {
2886 ata_dev_dbg(dev,
"link online but device misclassified\n");
2891 if (ata_class_enabled(classes[dev->
devno]))
2893 "link offline, clearing class %d to NONE\n",
2894 classes[dev->
devno]);
2896 }
else if (classes[dev->
devno] == ATA_DEV_UNKNOWN) {
2898 "link status unknown, clearing UNKNOWN to NONE\n");
2903 if (classify && nr_unknown) {
2904 if (
try < max_tries) {
2906 "link online but %d devices misclassified, retrying\n",
2913 "link online but %d devices misclassified, "
2914 "device detection might fail\n", nr_unknown);
2934 spin_unlock_irqrestore(ap->
lock, flags);
2940 if (!ata_is_host_link(link) &&
2944 if (
try >= max_tries) {
2951 if (ata_is_host_link(link))
2958 unsigned long delta = deadline - now;
2961 "reset failed (errno=%d), retrying in %u secs\n",
2975 if (ata_is_host_link(link))
2980 if (
try == max_tries - 1) {
2984 }
else if (rc == -
EPIPE)
2992 static inline void ata_eh_pull_park_action(
struct ata_port *ap)
2996 unsigned long flags;
3035 spin_unlock_irqrestore(ap->
lock, flags);
3038 static void ata_eh_park_issue_cmd(
struct ata_device *dev,
int park)
3042 unsigned int err_mask;
3044 ata_tf_init(dev, &tf);
3060 if (park && (err_mask || tf.
lbal != 0xc4)) {
3066 static int ata_eh_revalidate_and_attach(
struct ata_link *link,
3072 unsigned int new_mask = 0;
3073 unsigned long flags;
3083 unsigned int action = ata_eh_dev_action(dev);
3084 unsigned int readid_flags = 0;
3112 }
else if (dev->
class == ATA_DEV_UNKNOWN &&
3127 readid_flags, dev->
id);
3136 ata_ering_clear(&dev->
ering);
3137 new_mask |= 1 << dev->
devno;
3154 if (ap->
ops->cable_detect)
3155 ap->
cbl = ap->
ops->cable_detect(ap);
3163 if (!(new_mask & (1 << dev->
devno)))
3181 spin_unlock_irqrestore(ap->
lock, flags);
3190 *r_failed_dev =
dev;
3221 ent = ata_ering_top(&dev->
ering);
3223 ent->
eflags &= ~ATA_EFLAG_DUBIOUS_XFER;
3228 if (ap->
ops->set_mode)
3229 rc = ap->
ops->set_mode(link, r_failed_dev);
3239 if (dev->
xfer_mode != saved_xfer_mode ||
3240 ata_ncq_enabled(dev) != saved_ncq)
3261 static int atapi_eh_clear_ua(
struct ata_device *dev)
3266 u8 *sense_buffer = dev->
link->ap->sector_buf;
3268 unsigned int err_mask;
3270 err_mask = atapi_eh_tur(dev, &sense_key);
3271 if (err_mask != 0 && err_mask !=
AC_ERR_DEV) {
3273 "TEST_UNIT_READY failed (err_mask=0x%x)\n",
3281 err_mask = atapi_eh_request_sense(dev, sense_buffer, sense_key);
3284 "UNIT ATTENTION (err_mask=0x%x)\n", err_mask);
3289 ata_dev_warn(dev,
"UNIT ATTENTION persists after %d tries\n",
3312 static int ata_eh_maybe_retry_flush(
struct ata_device *dev)
3318 unsigned int err_mask;
3325 qc = __ata_qc_from_tag(ap, link->
active_tag);
3335 ata_tf_init(dev, &tf);
3397 unsigned int err_mask;
3411 bool hipm = ata_id_has_hipm(dev->
id);
3412 bool dipm = ata_id_has_dipm(dev->
id) && !no_dipm;
3418 if (!lpm_dev && (hipm || dipm))
3429 if (err_mask && err_mask != AC_ERR_DEV) {
3431 "failed to disable DIPM, Emask 0x%x\n",
3440 rc = ap->
ops->set_lpm(link, policy, hints);
3455 dev = lpm_dev ? lpm_dev : link_dev;
3470 ata_id_has_dipm(dev->
id)) {
3473 if (err_mask && err_mask != AC_ERR_DEV) {
3475 "failed to enable DIPM, Emask 0x%x\n",
3497 *r_failed_dev =
dev;
3511 static int ata_link_nr_vacant(
struct ata_link *link)
3517 if (dev->
class == ATA_DEV_UNKNOWN)
3547 if (dev->
class == ATA_DEV_UNKNOWN &&
3555 static int ata_count_probe_trials_cb(
struct ata_ering_entry *ent,
void *void_arg)
3559 int *trials = void_arg;
3569 static int ata_eh_schedule_probe(
struct ata_device *dev)
3575 if (!(ehc->
i.probe_mask & (1 << dev->
devno)) ||
3588 if (ata_is_host_link(link))
3618 static int ata_eh_handle_dev_fail(
struct ata_device *dev,
int err)
3631 ehc->
i.probe_mask |= (1 << dev->
devno);
3646 if (ata_dev_enabled(dev) && !ehc->
tries[dev->
devno]) {
3655 if (ata_eh_schedule_probe(dev)) {
3698 unsigned long flags, deadline;
3711 spin_unlock_irqrestore(ap->
lock, flags);
3722 ehc->
i.action |= ehc->
i.dev_action[dev->
devno] &
3731 if (!ata_dev_enabled(dev))
3732 ata_eh_schedule_probe(dev);
3748 if (ata_eh_skip_recovery(link))
3763 prereset, softreset, hardreset, postreset);
3777 ata_eh_pull_park_action(ap);
3787 if (!(ehc->
i.dev_action[dev->
devno] &
3798 ata_eh_park_issue_cmd(dev, 1);
3817 ata_eh_park_issue_cmd(dev, 0);
3827 if (sata_pmp_attached(ap) && ata_is_host_link(link))
3831 rc = ata_eh_revalidate_and_attach(link, &dev);
3856 rc = atapi_eh_clear_ua(dev);
3866 rc = ata_eh_maybe_retry_flush(dev);
3886 ata_eh_handle_dev_fail(dev, rc);
3892 if (sata_pmp_attached(ap))
3902 if (rc && r_failed_link)
3903 *r_failed_link =
link;
3979 rc =
ata_eh_recover(ap, prereset, softreset, hardreset, postreset,
4020 static void ata_eh_handle_port_suspend(
struct ata_port *ap)
4022 unsigned long flags;
4029 spin_unlock_irqrestore(ap->
lock, flags);
4032 spin_unlock_irqrestore(ap->
lock, flags);
4044 if (ap->
ops->port_suspend)
4063 spin_unlock_irqrestore(ap->
lock, flags);
4077 static void ata_eh_handle_port_resume(
struct ata_port *ap)
4081 unsigned long flags;
4088 spin_unlock_irqrestore(ap->
lock, flags);
4091 spin_unlock_irqrestore(ap->
lock, flags);
4104 ata_ering_clear(&dev->ering);
4108 if (ap->ops->port_resume)
4109 rc = ap->ops->port_resume(ap);
4117 if (ap->pm_result) {
4118 *ap->pm_result =
rc;
4119 ap->pm_result =
NULL;
4121 spin_unlock_irqrestore(ap->
lock, flags);