• Home
  • Raw
  • Download

Lines Matching refs:link

261 	if (ap->link.eh_info.desc_len)  in ata_port_desc()
262 __ata_ehi_push_desc(&ap->link.eh_info, " "); in ata_port_desc()
265 __ata_ehi_pushv_desc(&ap->link.eh_info, fmt, args); in ata_port_desc()
340 struct ata_eh_context *ehc = &dev->link->eh_context; in ata_internal_cmd_timeout()
365 struct ata_eh_context *ehc = &dev->link->eh_context; in ata_internal_cmd_timed_out()
436 struct ata_eh_context *ehc = &dev->link->eh_context; in ata_eh_dev_action()
441 static void ata_eh_clear_action(struct ata_link *link, struct ata_device *dev, in ata_eh_clear_action() argument
448 ata_for_each_dev(tdev, link, ALL) in ata_eh_clear_action()
456 ata_for_each_dev(tdev, link, ALL) in ata_eh_clear_action()
538 qc = ata_qc_from_tag(ap, ap->link.active_tag); in ata_scsi_timed_out()
554 struct ata_link *link; in ata_eh_unload() local
561 ata_for_each_link(link, ap, PMP_FIRST) { in ata_eh_unload()
562 sata_scr_write(link, SCR_CONTROL, link->saved_scontrol & 0xff0); in ata_eh_unload()
563 ata_for_each_dev(dev, link, ALL) in ata_eh_unload()
725 struct ata_link *link; in ata_scsi_port_error_handler() local
739 ata_for_each_link(link, ap, HOST_FIRST) { in ata_scsi_port_error_handler()
740 struct ata_eh_context *ehc = &link->eh_context; in ata_scsi_port_error_handler()
743 memset(&link->eh_context, 0, sizeof(link->eh_context)); in ata_scsi_port_error_handler()
744 link->eh_context.i = link->eh_info; in ata_scsi_port_error_handler()
745 memset(&link->eh_info, 0, sizeof(link->eh_info)); in ata_scsi_port_error_handler()
747 ata_for_each_dev(dev, link, ENABLED) { in ata_scsi_port_error_handler()
794 ata_for_each_link(link, ap, HOST_FIRST) in ata_scsi_port_error_handler()
795 memset(&link->eh_info, 0, sizeof(link->eh_info)); in ata_scsi_port_error_handler()
807 WARN_ON(ata_qc_from_tag(ap, ap->link.active_tag) == NULL); in ata_scsi_port_error_handler()
1047 static int ata_do_link_abort(struct ata_port *ap, struct ata_link *link) in ata_do_link_abort() argument
1059 if (qc && (!link || qc->dev->link == link)) { in ata_do_link_abort()
1084 int ata_link_abort(struct ata_link *link) in ata_link_abort() argument
1086 return ata_do_link_abort(link->ap, link); in ata_link_abort()
1183 rc = sata_scr_read(&ap->link, SCR_NOTIFICATION, &sntf); in sata_async_notification()
1185 sata_scr_write(&ap->link, SCR_NOTIFICATION, sntf); in sata_async_notification()
1194 struct ata_device *dev = ap->link.device; in sata_async_notification()
1211 struct ata_link *link; in sata_async_notification() local
1214 ata_for_each_link(link, ap, EDGE) { in sata_async_notification()
1215 if (!(sntf & (1 << link->pmp))) in sata_async_notification()
1218 if ((link->device->class == ATA_DEV_ATAPI) && in sata_async_notification()
1219 (link->device->flags & ATA_DFLAG_AN)) in sata_async_notification()
1220 ata_scsi_media_change_notify(link->device); in sata_async_notification()
1351 if (ata_msg_drv(dev->link->ap)) in ata_dev_disable()
1374 struct ata_link *link = dev->link; in ata_eh_detach_dev() local
1375 struct ata_port *ap = link->ap; in ata_eh_detach_dev()
1376 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_detach_dev()
1391 ata_eh_clear_action(link, dev, &link->eh_info, ATA_EH_PERDEV_MASK); in ata_eh_detach_dev()
1392 ata_eh_clear_action(link, dev, &link->eh_context.i, ATA_EH_PERDEV_MASK); in ata_eh_detach_dev()
1412 void ata_eh_about_to_do(struct ata_link *link, struct ata_device *dev, in ata_eh_about_to_do() argument
1415 struct ata_port *ap = link->ap; in ata_eh_about_to_do()
1416 struct ata_eh_info *ehi = &link->eh_info; in ata_eh_about_to_do()
1417 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_about_to_do()
1422 ata_eh_clear_action(link, dev, ehi, action); in ata_eh_about_to_do()
1427 if (!(ehc->i.flags & ATA_EHI_QUIET) && link != ap->slave_link) in ata_eh_about_to_do()
1445 void ata_eh_done(struct ata_link *link, struct ata_device *dev, in ata_eh_done() argument
1448 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_done()
1450 ata_eh_clear_action(link, dev, &ehc->i, action); in ata_eh_done()
1546 u8 *buf = dev->link->ap->sector_buf; in ata_eh_read_log_10h()
1633 struct ata_port *ap = dev->link->ap; in atapi_eh_request_sense()
1677 static void ata_eh_analyze_serror(struct ata_link *link) in ata_eh_analyze_serror() argument
1679 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_analyze_serror()
1702 if (link->lpm_policy > ATA_LPM_MAX_POWER) in ata_eh_analyze_serror()
1704 else if (!(link->flags & ATA_LFLAG_DISABLED) || ata_is_host_link(link)) in ata_eh_analyze_serror()
1728 void ata_eh_analyze_ncq_error(struct ata_link *link) in ata_eh_analyze_ncq_error() argument
1730 struct ata_port *ap = link->ap; in ata_eh_analyze_ncq_error()
1731 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_analyze_ncq_error()
1732 struct ata_device *dev = link->device; in ata_eh_analyze_ncq_error()
1742 if (!link->sactive || !(ehc->i.err_mask & AC_ERR_DEV)) in ata_eh_analyze_ncq_error()
1760 ata_link_err(link, "failed to read log page 10h (errno=%d)\n", in ata_eh_analyze_ncq_error()
1765 if (!(link->sactive & (1 << tag))) { in ata_eh_analyze_ncq_error()
1766 ata_link_err(link, "log page 10h reported inactive tag %d\n", in ata_eh_analyze_ncq_error()
2014 struct ata_link *link = ata_dev_phys_link(dev); in ata_eh_speed_down() local
2039 if (sata_down_spd_limit(link, 0) == 0) { in ata_eh_speed_down()
2070 (link->ap->cbl != ATA_CBL_SATA || dev->class == ATA_DEV_ATAPI) && in ata_eh_speed_down()
2118 static void ata_eh_link_autopsy(struct ata_link *link) in ata_eh_link_autopsy() argument
2120 struct ata_port *ap = link->ap; in ata_eh_link_autopsy()
2121 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_link_autopsy()
2134 rc = sata_scr_read(link, SCR_ERROR, &serror); in ata_eh_link_autopsy()
2137 ata_eh_analyze_serror(link); in ata_eh_link_autopsy()
2146 ata_eh_analyze_ncq_error(link); in ata_eh_link_autopsy()
2158 ata_dev_phys_link(qc->dev) != link) in ata_eh_link_autopsy()
2209 if ((all_err_mask & AC_ERR_TIMEOUT) && !ata_is_host_link(link)) in ata_eh_link_autopsy()
2210 ap->link.eh_context.i.err_mask |= AC_ERR_TIMEOUT; in ata_eh_link_autopsy()
2214 if (!dev && ((ata_link_max_devices(link) == 1 && in ata_eh_link_autopsy()
2215 ata_dev_enabled(link->device)))) in ata_eh_link_autopsy()
2216 dev = link->device; in ata_eh_link_autopsy()
2239 struct ata_link *link; in ata_eh_autopsy() local
2241 ata_for_each_link(link, ap, EDGE) in ata_eh_autopsy()
2242 ata_eh_link_autopsy(link); in ata_eh_autopsy()
2249 struct ata_eh_context *mehc = &ap->link.eh_context; in ata_eh_autopsy()
2270 ata_eh_link_autopsy(&ap->link); in ata_eh_autopsy()
2401 static void ata_eh_link_report(struct ata_link *link) in ata_eh_link_report() argument
2403 struct ata_port *ap = link->ap; in ata_eh_link_report()
2404 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_link_report()
2420 ata_dev_phys_link(qc->dev) != link || in ata_eh_link_report()
2444 ehc->i.err_mask, link->sactive, ehc->i.serror, in ata_eh_link_report()
2449 ata_link_err(link, "exception Emask 0x%x " in ata_eh_link_report()
2451 ehc->i.err_mask, link->sactive, ehc->i.serror, in ata_eh_link_report()
2454 ata_link_err(link, "%s\n", desc); in ata_eh_link_report()
2459 ata_link_err(link, in ata_eh_link_report()
2488 ata_dev_phys_link(qc->dev) != link || !qc->err_mask) in ata_eh_link_report()
2582 struct ata_link *link; in ata_eh_report() local
2584 ata_for_each_link(link, ap, HOST_FIRST) in ata_eh_report()
2585 ata_eh_link_report(link); in ata_eh_report()
2588 static int ata_do_reset(struct ata_link *link, ata_reset_fn_t reset, in ata_do_reset() argument
2595 ata_for_each_dev(dev, link, ALL) in ata_do_reset()
2598 return reset(link, classes, deadline); in ata_do_reset()
2601 static int ata_eh_followup_srst_needed(struct ata_link *link, int rc) in ata_eh_followup_srst_needed() argument
2603 if ((link->flags & ATA_LFLAG_NO_SRST) || ata_link_offline(link)) in ata_eh_followup_srst_needed()
2607 if (sata_pmp_supported(link->ap) && ata_is_host_link(link)) in ata_eh_followup_srst_needed()
2612 int ata_eh_reset(struct ata_link *link, int classify, in ata_eh_reset() argument
2616 struct ata_port *ap = link->ap; in ata_eh_reset()
2618 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_reset()
2621 unsigned int lflags = link->flags; in ata_eh_reset()
2637 if (link->flags & ATA_LFLAG_RST_ONCE) in ata_eh_reset()
2639 if (link->flags & ATA_LFLAG_NO_HRST) in ata_eh_reset()
2641 if (link->flags & ATA_LFLAG_NO_SRST) in ata_eh_reset()
2658 ata_eh_about_to_do(link, NULL, ATA_EH_RESET); in ata_eh_reset()
2660 ata_for_each_dev(dev, link, ALL) { in ata_eh_reset()
2700 rc = prereset(link, deadline); in ata_eh_reset()
2718 ata_link_dbg(link, "port disabled--ignoring\n"); in ata_eh_reset()
2721 ata_for_each_dev(dev, link, ALL) in ata_eh_reset()
2726 ata_link_err(link, in ata_eh_reset()
2736 ata_for_each_dev(dev, link, ALL) in ata_eh_reset()
2739 ata_is_host_link(link)) in ata_eh_reset()
2750 if (ata_is_host_link(link)) in ata_eh_reset()
2757 ata_link_info(link, "%s resetting link\n", in ata_eh_reset()
2767 rc = ata_do_reset(link, reset, classes, deadline, true); in ata_eh_reset()
2769 failed_link = link; in ata_eh_reset()
2797 ata_eh_followup_srst_needed(link, rc)) { in ata_eh_reset()
2801 ata_link_err(link, in ata_eh_reset()
2803 failed_link = link; in ata_eh_reset()
2808 ata_eh_about_to_do(link, NULL, ATA_EH_RESET); in ata_eh_reset()
2809 rc = ata_do_reset(link, reset, classes, deadline, true); in ata_eh_reset()
2811 failed_link = link; in ata_eh_reset()
2817 ata_link_info(link, in ata_eh_reset()
2826 ata_for_each_dev(dev, link, ALL) { in ata_eh_reset()
2845 if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0) in ata_eh_reset()
2846 link->sata_spd = (sstatus >> 4) & 0xf; in ata_eh_reset()
2851 if (ata_is_host_link(link)) in ata_eh_reset()
2862 postreset(link, classes); in ata_eh_reset()
2874 spin_lock_irqsave(link->ap->lock, flags); in ata_eh_reset()
2875 memset(&link->eh_info, 0, sizeof(link->eh_info)); in ata_eh_reset()
2877 memset(&slave->eh_info, 0, sizeof(link->eh_info)); in ata_eh_reset()
2879 spin_unlock_irqrestore(link->ap->lock, flags); in ata_eh_reset()
2893 ata_for_each_dev(dev, link, ALL) { in ata_eh_reset()
2915 ata_link_warn(link, in ata_eh_reset()
2918 failed_link = link; in ata_eh_reset()
2922 ata_link_warn(link, in ata_eh_reset()
2928 ata_eh_done(link, NULL, ATA_EH_RESET); in ata_eh_reset()
2933 link->lpm_policy = ATA_LPM_UNKNOWN; /* reset LPM state */ in ata_eh_reset()
2950 if (!ata_is_host_link(link) && in ata_eh_reset()
2951 sata_scr_read(link, SCR_STATUS, &sstatus)) in ata_eh_reset()
2961 if (ata_is_host_link(link)) in ata_eh_reset()
2985 if (ata_is_host_link(link)) in ata_eh_reset()
2991 sata_down_spd_limit(link, 0); in ata_eh_reset()
3004 struct ata_link *link; in ata_eh_pull_park_action() local
3036 ata_for_each_link(link, ap, EDGE) { in ata_eh_pull_park_action()
3037 ata_for_each_dev(dev, link, ALL) { in ata_eh_pull_park_action()
3038 struct ata_eh_info *ehi = &link->eh_info; in ata_eh_pull_park_action()
3040 link->eh_context.i.dev_action[dev->devno] |= in ata_eh_pull_park_action()
3042 ata_eh_clear_action(link, dev, ehi, ATA_EH_PARK); in ata_eh_pull_park_action()
3050 struct ata_eh_context *ehc = &dev->link->eh_context; in ata_eh_park_issue_cmd()
3076 static int ata_eh_revalidate_and_attach(struct ata_link *link, in ata_eh_revalidate_and_attach() argument
3079 struct ata_port *ap = link->ap; in ata_eh_revalidate_and_attach()
3080 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_revalidate_and_attach()
3092 ata_for_each_dev(dev, link, ALL_REVERSE) { in ata_eh_revalidate_and_attach()
3107 ata_eh_about_to_do(link, dev, ATA_EH_REVALIDATE); in ata_eh_revalidate_and_attach()
3113 ata_eh_done(link, dev, ATA_EH_REVALIDATE); in ata_eh_revalidate_and_attach()
3163 if ((ehc->i.flags & ATA_EHI_DID_RESET) && ata_is_host_link(link)) { in ata_eh_revalidate_and_attach()
3172 ata_for_each_dev(dev, link, ALL) { in ata_eh_revalidate_and_attach()
3220 int ata_set_mode(struct ata_link *link, struct ata_device **r_failed_dev) in ata_set_mode() argument
3222 struct ata_port *ap = link->ap; in ata_set_mode()
3227 ata_for_each_dev(dev, link, ENABLED) { in ata_set_mode()
3239 rc = ap->ops->set_mode(link, r_failed_dev); in ata_set_mode()
3241 rc = ata_do_set_mode(link, r_failed_dev); in ata_set_mode()
3244 ata_for_each_dev(dev, link, ENABLED) { in ata_set_mode()
3245 struct ata_eh_context *ehc = &link->eh_context; in ata_set_mode()
3276 u8 *sense_buffer = dev->link->ap->sector_buf; in atapi_eh_clear_ua()
3324 struct ata_link *link = dev->link; in ata_eh_maybe_retry_flush() local
3325 struct ata_port *ap = link->ap; in ata_eh_maybe_retry_flush()
3332 if (!ata_tag_valid(link->active_tag)) in ata_eh_maybe_retry_flush()
3335 qc = __ata_qc_from_tag(ap, link->active_tag); in ata_eh_maybe_retry_flush()
3398 static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy, in ata_eh_set_lpm() argument
3401 struct ata_port *ap = ata_is_host_link(link) ? link->ap : NULL; in ata_eh_set_lpm()
3402 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_set_lpm()
3404 enum ata_lpm_policy old_policy = link->lpm_policy; in ata_eh_set_lpm()
3405 bool no_dipm = link->ap->flags & ATA_FLAG_NO_DIPM; in ata_eh_set_lpm()
3411 if ((link->flags & ATA_LFLAG_NO_LPM) || (ap && !ap->ops->set_lpm)) in ata_eh_set_lpm()
3420 ata_for_each_dev(dev, link, ENABLED) { in ata_eh_set_lpm()
3450 rc = ap->ops->set_lpm(link, policy, hints); in ata_eh_set_lpm()
3454 rc = sata_pmp_set_lpm(link, policy, hints); in ata_eh_set_lpm()
3462 link->flags |= ATA_LFLAG_NO_LPM; in ata_eh_set_lpm()
3473 link->lpm_policy = policy; in ata_eh_set_lpm()
3478 ata_for_each_dev(dev, link, ENABLED) { in ata_eh_set_lpm()
3493 link->last_lpm_change = jiffies; in ata_eh_set_lpm()
3494 link->flags |= ATA_LFLAG_CHANGED; in ata_eh_set_lpm()
3500 link->lpm_policy = old_policy; in ata_eh_set_lpm()
3506 ata_link_warn(link, "disabling LPM on the link\n"); in ata_eh_set_lpm()
3507 link->flags |= ATA_LFLAG_NO_LPM; in ata_eh_set_lpm()
3514 int ata_link_nr_enabled(struct ata_link *link) in ata_link_nr_enabled() argument
3519 ata_for_each_dev(dev, link, ENABLED) in ata_link_nr_enabled()
3524 static int ata_link_nr_vacant(struct ata_link *link) in ata_link_nr_vacant() argument
3529 ata_for_each_dev(dev, link, ALL) in ata_link_nr_vacant()
3535 static int ata_eh_skip_recovery(struct ata_link *link) in ata_eh_skip_recovery() argument
3537 struct ata_port *ap = link->ap; in ata_eh_skip_recovery()
3538 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_skip_recovery()
3542 if (link->flags & ATA_LFLAG_DISABLED) in ata_eh_skip_recovery()
3550 if ((ap->pflags & ATA_PFLAG_FROZEN) || ata_link_nr_enabled(link)) in ata_eh_skip_recovery()
3559 ata_for_each_dev(dev, link, ALL) { in ata_eh_skip_recovery()
3584 struct ata_eh_context *ehc = &dev->link->eh_context; in ata_eh_schedule_probe()
3585 struct ata_link *link = ata_dev_phys_link(dev); in ata_eh_schedule_probe() local
3600 if (link->lpm_policy > ATA_LPM_MAX_POWER) { in ata_eh_schedule_probe()
3601 if (ata_is_host_link(link)) in ata_eh_schedule_probe()
3602 link->ap->ops->set_lpm(link, ATA_LPM_MAX_POWER, in ata_eh_schedule_probe()
3605 sata_pmp_set_lpm(link, ATA_LPM_MAX_POWER, in ata_eh_schedule_probe()
3626 sata_down_spd_limit(link, 1); in ata_eh_schedule_probe()
3633 struct ata_eh_context *ehc = &dev->link->eh_context; in ata_eh_handle_dev_fail()
3708 struct ata_link *link; in ata_eh_recover() local
3716 ata_for_each_link(link, ap, EDGE) { in ata_eh_recover()
3717 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_recover()
3721 ata_eh_about_to_do(link, NULL, ATA_EH_ENABLE_LINK); in ata_eh_recover()
3723 link->flags &= ~ATA_LFLAG_DISABLED; in ata_eh_recover()
3725 ata_eh_done(link, NULL, ATA_EH_ENABLE_LINK); in ata_eh_recover()
3728 ata_for_each_dev(dev, link, ALL) { in ata_eh_recover()
3729 if (link->flags & ATA_LFLAG_NO_RETRY) in ata_eh_recover()
3757 ata_for_each_link(link, ap, EDGE) { in ata_eh_recover()
3758 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_recover()
3761 if (ata_eh_skip_recovery(link)) in ata_eh_recover()
3764 ata_for_each_dev(dev, link, ALL) in ata_eh_recover()
3769 ata_for_each_link(link, ap, EDGE) { in ata_eh_recover()
3770 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_recover()
3775 rc = ata_eh_reset(link, ata_link_nr_vacant(link), in ata_eh_recover()
3778 ata_link_err(link, "reset failed, giving up\n"); in ata_eh_recover()
3793 ata_for_each_link(link, ap, EDGE) { in ata_eh_recover()
3794 ata_for_each_dev(dev, link, ALL) { in ata_eh_recover()
3795 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_recover()
3824 ata_for_each_link(link, ap, EDGE) { in ata_eh_recover()
3825 ata_for_each_dev(dev, link, ALL) { in ata_eh_recover()
3826 if (!(link->eh_context.unloaded_mask & in ata_eh_recover()
3831 ata_eh_done(link, dev, ATA_EH_PARK); in ata_eh_recover()
3837 ata_for_each_link(link, ap, PMP_FIRST) { in ata_eh_recover()
3838 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_recover()
3840 if (sata_pmp_attached(ap) && ata_is_host_link(link)) in ata_eh_recover()
3844 rc = ata_eh_revalidate_and_attach(link, &dev); in ata_eh_recover()
3849 if (link->device->class == ATA_DEV_PMP) { in ata_eh_recover()
3856 rc = ata_set_mode(link, &dev); in ata_eh_recover()
3866 ata_for_each_dev(dev, link, ALL) { in ata_eh_recover()
3878 ata_for_each_dev(dev, link, ALL) { in ata_eh_recover()
3888 if (link->lpm_policy != ap->target_lpm_policy) { in ata_eh_recover()
3889 rc = ata_eh_set_lpm(link, ap->target_lpm_policy, &dev); in ata_eh_recover()
3918 *r_failed_link = link; in ata_eh_recover()
3997 ata_for_each_dev(dev, &ap->link, ALL) in ata_do_eh()
4019 if (hardreset == sata_std_hardreset && !sata_scr_valid(&ap->link)) in ata_std_error_handler()
4058 ata_for_each_dev(dev, &ap->link, ENABLED) { in ata_eh_handle_port_suspend()
4102 struct ata_link *link; in ata_eh_handle_port_resume() local
4125 ata_for_each_link(link, ap, HOST_FIRST) in ata_eh_handle_port_resume()
4126 ata_for_each_dev(dev, link, ALL) in ata_eh_handle_port_resume()