Lines Matching +full:deep +full:- +full:touch
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * libata-eh.c - libata error handling
8 * as Documentation/driver-api/libata.rst
11 * http://www.sata-io.org/
59 /* Waiting in ->prereset can never be reliable. It's
97 15000, /* Some drives are slow to read log pages when waking-up */
129 * ehc->cmd_timeout_idx keeps track of which timeout to use per
170 ehi->desc_len += vscnprintf(ehi->desc + ehi->desc_len, in __ata_ehi_pushv_desc()
171 ATA_EH_DESC_LEN - ehi->desc_len, in __ata_ehi_pushv_desc()
176 * __ata_ehi_push_desc - push error description without adding separator
180 * Format string according to @fmt and append it to @ehi->desc.
196 * ata_ehi_push_desc - push error description with separator
200 * Format string according to @fmt and append it to @ehi->desc.
201 * If @ehi->desc is not empty, ", " is added in-between.
210 if (ehi->desc_len) in ata_ehi_push_desc()
220 * ata_ehi_clear_desc - clean error description
223 * Clear @ehi->desc.
230 ehi->desc[0] = '\0'; in ata_ehi_clear_desc()
231 ehi->desc_len = 0; in ata_ehi_clear_desc()
236 * ata_port_desc - append port description
242 * in-between. This function is to be used while initializing
252 WARN_ON(!(ap->pflags & ATA_PFLAG_INITIALIZING)); in ata_port_desc()
254 if (ap->link.eh_info.desc_len) in ata_port_desc()
255 __ata_ehi_push_desc(&ap->link.eh_info, " "); in ata_port_desc()
258 __ata_ehi_pushv_desc(&ap->link.eh_info, fmt, args); in ata_port_desc()
265 * ata_port_pbar_desc - append PCI BAR description
282 struct pci_dev *pdev = to_pci_dev(ap->host->dev); in ata_port_pbar_desc()
315 return -1; in ata_lookup_timeout_table()
319 * ata_internal_cmd_timeout - determine timeout for an internal command
333 struct ata_eh_context *ehc = &dev->link->eh_context; in ata_internal_cmd_timeout()
340 idx = ehc->cmd_timeout_idx[dev->devno][ent]; in ata_internal_cmd_timeout()
345 * ata_internal_cmd_timed_out - notification for internal command timeout
358 struct ata_eh_context *ehc = &dev->link->eh_context; in ata_internal_cmd_timed_out()
365 idx = ehc->cmd_timeout_idx[dev->devno][ent]; in ata_internal_cmd_timed_out()
367 ehc->cmd_timeout_idx[dev->devno][ent]++; in ata_internal_cmd_timed_out()
377 ering->cursor++; in ata_ering_record()
378 ering->cursor %= ATA_ERING_SIZE; in ata_ering_record()
380 ent = &ering->ring[ering->cursor]; in ata_ering_record()
381 ent->eflags = eflags; in ata_ering_record()
382 ent->err_mask = err_mask; in ata_ering_record()
383 ent->timestamp = get_jiffies_64(); in ata_ering_record()
388 struct ata_ering_entry *ent = &ering->ring[ering->cursor]; in ata_ering_top()
390 if (ent->err_mask) in ata_ering_top()
402 idx = ering->cursor; in ata_ering_map()
404 ent = &ering->ring[idx]; in ata_ering_map()
405 if (!ent->err_mask) in ata_ering_map()
410 idx = (idx - 1 + ATA_ERING_SIZE) % ATA_ERING_SIZE; in ata_ering_map()
411 } while (idx != ering->cursor); in ata_ering_map()
418 ent->eflags |= ATA_EFLAG_OLD_ER; in ata_ering_clear_cb()
429 struct ata_eh_context *ehc = &dev->link->eh_context; in ata_eh_dev_action()
431 return ehc->i.action | ehc->i.dev_action[dev->devno]; in ata_eh_dev_action()
440 ehi->action &= ~action; in ata_eh_clear_action()
442 ehi->dev_action[tdev->devno] &= ~action; in ata_eh_clear_action()
444 /* doesn't make sense for port-wide EH actions */ in ata_eh_clear_action()
447 /* break ehi->action into ehi->dev_action */ in ata_eh_clear_action()
448 if (ehi->action & action) { in ata_eh_clear_action()
450 ehi->dev_action[tdev->devno] |= in ata_eh_clear_action()
451 ehi->action & action; in ata_eh_clear_action()
452 ehi->action &= ~action; in ata_eh_clear_action()
455 /* turn off the specified per-dev action */ in ata_eh_clear_action()
456 ehi->dev_action[dev->devno] &= ~action; in ata_eh_clear_action()
461 * ata_eh_acquire - acquire EH ownership
473 mutex_lock(&ap->host->eh_mutex); in ata_eh_acquire()
474 WARN_ON_ONCE(ap->host->eh_owner); in ata_eh_acquire()
475 ap->host->eh_owner = current; in ata_eh_acquire()
479 * ata_eh_release - release EH ownership
490 WARN_ON_ONCE(ap->host->eh_owner != current); in ata_eh_release()
491 ap->host->eh_owner = NULL; in ata_eh_release()
492 mutex_unlock(&ap->host->eh_mutex); in ata_eh_release()
505 sata_scr_write(link, SCR_CONTROL, link->saved_scontrol & 0xff0); in ata_eh_unload()
511 spin_lock_irqsave(ap->lock, flags); in ata_eh_unload()
514 ap->pflags &= ~ATA_PFLAG_EH_PENDING; /* clear pending from freeze */ in ata_eh_unload()
515 ap->pflags |= ATA_PFLAG_UNLOADED; in ata_eh_unload()
517 spin_unlock_irqrestore(ap->lock, flags); in ata_eh_unload()
521 * ata_scsi_error - SCSI layer error handler callback
524 * Handles SCSI-layer-thrown error events.
538 spin_lock_irqsave(host->host_lock, flags); in ata_scsi_error()
539 list_splice_init(&host->eh_cmd_q, &eh_work_q); in ata_scsi_error()
540 spin_unlock_irqrestore(host->host_lock, flags); in ata_scsi_error()
554 * ata_scsi_cmd_error_handler - error callback for a list of commands
560 * ap->eh_done_q. This function is the first part of the libata error
574 /* For new EH, all qcs are finished in one of three ways - in ata_scsi_cmd_error_handler()
586 spin_lock_irqsave(ap->lock, flags); in ata_scsi_cmd_error_handler()
587 if (ap->ops->error_handler) { in ata_scsi_cmd_error_handler()
591 /* This must occur under the ap->lock as we don't want in ata_scsi_cmd_error_handler()
595 non-notified command and completes much like an IRQ handler. in ata_scsi_cmd_error_handler()
600 if (ap->ops->lost_interrupt) in ata_scsi_cmd_error_handler()
601 ap->ops->lost_interrupt(ap); in ata_scsi_cmd_error_handler()
607 if (qc->flags & ATA_QCFLAG_ACTIVE && in ata_scsi_cmd_error_handler()
608 qc->scsicmd == scmd) in ata_scsi_cmd_error_handler()
614 if (!(qc->flags & ATA_QCFLAG_FAILED)) { in ata_scsi_cmd_error_handler()
616 qc->err_mask |= AC_ERR_TIMEOUT; in ata_scsi_cmd_error_handler()
617 qc->flags |= ATA_QCFLAG_FAILED; in ata_scsi_cmd_error_handler()
625 scmd->retries = scmd->allowed; in ata_scsi_cmd_error_handler()
626 scsi_eh_finish_cmd(scmd, &ap->eh_done_q); in ata_scsi_cmd_error_handler()
641 ap->eh_tries = ATA_EH_MAX_TRIES; in ata_scsi_cmd_error_handler()
643 spin_unlock_irqrestore(ap->lock, flags); in ata_scsi_cmd_error_handler()
649 * ata_scsi_port_error_handler - recover the port after the commands
661 if (ap->ops->error_handler) { in ata_scsi_port_error_handler()
668 del_timer_sync(&ap->fastdrain_timer); in ata_scsi_port_error_handler()
674 spin_lock_irqsave(ap->lock, flags); in ata_scsi_port_error_handler()
677 struct ata_eh_context *ehc = &link->eh_context; in ata_scsi_port_error_handler()
680 memset(&link->eh_context, 0, sizeof(link->eh_context)); in ata_scsi_port_error_handler()
681 link->eh_context.i = link->eh_info; in ata_scsi_port_error_handler()
682 memset(&link->eh_info, 0, sizeof(link->eh_info)); in ata_scsi_port_error_handler()
685 int devno = dev->devno; in ata_scsi_port_error_handler()
687 ehc->saved_xfer_mode[devno] = dev->xfer_mode; in ata_scsi_port_error_handler()
689 ehc->saved_ncq_enabled |= 1 << devno; in ata_scsi_port_error_handler()
693 ap->pflags |= ATA_PFLAG_EH_IN_PROGRESS; in ata_scsi_port_error_handler()
694 ap->pflags &= ~ATA_PFLAG_EH_PENDING; in ata_scsi_port_error_handler()
695 ap->excl_link = NULL; /* don't maintain exclusion over EH */ in ata_scsi_port_error_handler()
697 spin_unlock_irqrestore(ap->lock, flags); in ata_scsi_port_error_handler()
700 if (!(ap->pflags & (ATA_PFLAG_UNLOADING | ATA_PFLAG_SUSPENDED))) in ata_scsi_port_error_handler()
701 ap->ops->error_handler(ap); in ata_scsi_port_error_handler()
704 if ((ap->pflags & ATA_PFLAG_UNLOADING) && in ata_scsi_port_error_handler()
705 !(ap->pflags & ATA_PFLAG_UNLOADED)) in ata_scsi_port_error_handler()
713 /* Exception might have happened after ->error_handler in ata_scsi_port_error_handler()
717 spin_lock_irqsave(ap->lock, flags); in ata_scsi_port_error_handler()
719 if (ap->pflags & ATA_PFLAG_EH_PENDING) { in ata_scsi_port_error_handler()
720 if (--ap->eh_tries) { in ata_scsi_port_error_handler()
721 spin_unlock_irqrestore(ap->lock, flags); in ata_scsi_port_error_handler()
727 ap->pflags &= ~ATA_PFLAG_EH_PENDING; in ata_scsi_port_error_handler()
732 memset(&link->eh_info, 0, sizeof(link->eh_info)); in ata_scsi_port_error_handler()
735 * ap->lock such that if exception occurs after this in ata_scsi_port_error_handler()
737 * re-initiate EH. in ata_scsi_port_error_handler()
739 ap->ops->end_eh(ap); in ata_scsi_port_error_handler()
741 spin_unlock_irqrestore(ap->lock, flags); in ata_scsi_port_error_handler()
744 WARN_ON(ata_qc_from_tag(ap, ap->link.active_tag) == NULL); in ata_scsi_port_error_handler()
745 ap->ops->eng_timeout(ap); in ata_scsi_port_error_handler()
748 scsi_eh_flush_done_q(&ap->eh_done_q); in ata_scsi_port_error_handler()
751 spin_lock_irqsave(ap->lock, flags); in ata_scsi_port_error_handler()
753 if (ap->pflags & ATA_PFLAG_LOADING) in ata_scsi_port_error_handler()
754 ap->pflags &= ~ATA_PFLAG_LOADING; in ata_scsi_port_error_handler()
755 else if ((ap->pflags & ATA_PFLAG_SCSI_HOTPLUG) && in ata_scsi_port_error_handler()
756 !(ap->flags & ATA_FLAG_SAS_HOST)) in ata_scsi_port_error_handler()
757 schedule_delayed_work(&ap->hotplug_task, 0); in ata_scsi_port_error_handler()
759 if (ap->pflags & ATA_PFLAG_RECOVERED) in ata_scsi_port_error_handler()
762 ap->pflags &= ~(ATA_PFLAG_SCSI_HOTPLUG | ATA_PFLAG_RECOVERED); in ata_scsi_port_error_handler()
765 ap->pflags &= ~ATA_PFLAG_EH_IN_PROGRESS; in ata_scsi_port_error_handler()
766 wake_up_all(&ap->eh_wait_q); in ata_scsi_port_error_handler()
768 spin_unlock_irqrestore(ap->lock, flags); in ata_scsi_port_error_handler()
773 * ata_port_wait_eh - Wait for the currently pending EH to complete
787 spin_lock_irqsave(ap->lock, flags); in ata_port_wait_eh()
789 while (ap->pflags & (ATA_PFLAG_EH_PENDING | ATA_PFLAG_EH_IN_PROGRESS)) { in ata_port_wait_eh()
790 prepare_to_wait(&ap->eh_wait_q, &wait, TASK_UNINTERRUPTIBLE); in ata_port_wait_eh()
791 spin_unlock_irqrestore(ap->lock, flags); in ata_port_wait_eh()
793 spin_lock_irqsave(ap->lock, flags); in ata_port_wait_eh()
795 finish_wait(&ap->eh_wait_q, &wait); in ata_port_wait_eh()
797 spin_unlock_irqrestore(ap->lock, flags); in ata_port_wait_eh()
800 if (scsi_host_in_recovery(ap->scsi_host)) { in ata_port_wait_eh()
813 /* count only non-internal commands */ in ata_eh_nr_in_flight()
828 spin_lock_irqsave(ap->lock, flags); in ata_eh_fastdrain_timerfn()
836 if (cnt == ap->fastdrain_cnt) { in ata_eh_fastdrain_timerfn()
841 * in-flight qcs as timed out and freeze the port. in ata_eh_fastdrain_timerfn()
845 qc->err_mask |= AC_ERR_TIMEOUT; in ata_eh_fastdrain_timerfn()
851 ap->fastdrain_cnt = cnt; in ata_eh_fastdrain_timerfn()
852 ap->fastdrain_timer.expires = in ata_eh_fastdrain_timerfn()
854 add_timer(&ap->fastdrain_timer); in ata_eh_fastdrain_timerfn()
858 spin_unlock_irqrestore(ap->lock, flags); in ata_eh_fastdrain_timerfn()
862 * ata_eh_set_pending - set ATA_PFLAG_EH_PENDING and activate fast drain
867 * is non-zero and EH wasn't pending before. Fast drain ensures
878 if (ap->pflags & ATA_PFLAG_EH_PENDING) in ata_eh_set_pending()
881 ap->pflags |= ATA_PFLAG_EH_PENDING; in ata_eh_set_pending()
886 /* do we have in-flight qcs? */ in ata_eh_set_pending()
892 ap->fastdrain_cnt = cnt; in ata_eh_set_pending()
893 ap->fastdrain_timer.expires = in ata_eh_set_pending()
895 add_timer(&ap->fastdrain_timer); in ata_eh_set_pending()
899 * ata_qc_schedule_eh - schedule qc for error handling
910 struct ata_port *ap = qc->ap; in ata_qc_schedule_eh()
912 WARN_ON(!ap->ops->error_handler); in ata_qc_schedule_eh()
914 qc->flags |= ATA_QCFLAG_FAILED; in ata_qc_schedule_eh()
922 blk_abort_request(scsi_cmd_to_rq(qc->scsicmd)); in ata_qc_schedule_eh()
926 * ata_std_sched_eh - non-libsas ata_ports issue eh with this common routine
934 WARN_ON(!ap->ops->error_handler); in ata_std_sched_eh()
936 if (ap->pflags & ATA_PFLAG_INITIALIZING) in ata_std_sched_eh()
940 scsi_schedule_eh(ap->scsi_host); in ata_std_sched_eh()
947 * ata_std_end_eh - non-libsas ata_ports complete eh with this common routine
951 * shost, so host fields can be directly manipulated under ap->lock, in
952 * the libsas case we need to hold a lock at the ha->level to coordinate
960 struct Scsi_Host *host = ap->scsi_host; in ata_std_end_eh()
962 host->host_eh_scheduled = 0; in ata_std_end_eh()
968 * ata_port_schedule_eh - schedule error handling without a qc
980 ap->ops->sched_eh(ap); in ata_port_schedule_eh()
989 WARN_ON(!ap->ops->error_handler); in ata_do_link_abort()
996 if (qc && (!link || qc->dev->link == link)) { in ata_do_link_abort()
997 qc->flags |= ATA_QCFLAG_FAILED; in ata_do_link_abort()
1010 * ata_link_abort - abort all qc's on the link
1023 return ata_do_link_abort(link->ap, link); in ata_link_abort()
1028 * ata_port_abort - abort all qc's on the port
1046 * __ata_port_freeze - freeze port
1054 * ap->ops->freeze() callback can be used for freezing the port
1055 * hardware-wise (e.g. mask interrupt and stop DMA engine). If a
1056 * port cannot be frozen hardware-wise, the interrupt handler
1065 WARN_ON(!ap->ops->error_handler); in __ata_port_freeze()
1067 if (ap->ops->freeze) in __ata_port_freeze()
1068 ap->ops->freeze(ap); in __ata_port_freeze()
1070 ap->pflags |= ATA_PFLAG_FROZEN; in __ata_port_freeze()
1076 * ata_port_freeze - abort & freeze port
1091 WARN_ON(!ap->ops->error_handler); in ata_port_freeze()
1100 * ata_eh_freeze_port - EH helper to freeze port
1112 if (!ap->ops->error_handler) in ata_eh_freeze_port()
1115 spin_lock_irqsave(ap->lock, flags); in ata_eh_freeze_port()
1117 spin_unlock_irqrestore(ap->lock, flags); in ata_eh_freeze_port()
1122 * ata_eh_thaw_port - EH helper to thaw port
1134 if (!ap->ops->error_handler) in ata_eh_thaw_port()
1137 spin_lock_irqsave(ap->lock, flags); in ata_eh_thaw_port()
1139 ap->pflags &= ~ATA_PFLAG_FROZEN; in ata_eh_thaw_port()
1141 if (ap->ops->thaw) in ata_eh_thaw_port()
1142 ap->ops->thaw(ap); in ata_eh_thaw_port()
1144 spin_unlock_irqrestore(ap->lock, flags); in ata_eh_thaw_port()
1156 struct ata_port *ap = qc->ap; in __ata_eh_qc_complete()
1157 struct scsi_cmnd *scmd = qc->scsicmd; in __ata_eh_qc_complete()
1160 spin_lock_irqsave(ap->lock, flags); in __ata_eh_qc_complete()
1161 qc->scsidone = ata_eh_scsidone; in __ata_eh_qc_complete()
1163 WARN_ON(ata_tag_valid(qc->tag)); in __ata_eh_qc_complete()
1164 spin_unlock_irqrestore(ap->lock, flags); in __ata_eh_qc_complete()
1166 scsi_eh_finish_cmd(scmd, &ap->eh_done_q); in __ata_eh_qc_complete()
1170 * ata_eh_qc_complete - Complete an active ATA command from EH
1178 struct scsi_cmnd *scmd = qc->scsicmd; in ata_eh_qc_complete()
1179 scmd->retries = scmd->allowed; in ata_eh_qc_complete()
1184 * ata_eh_qc_retry - Tell midlayer to retry an ATA command after EH
1190 * SCSI midlayer limits the number of retries to scmd->allowed.
1191 * scmd->allowed is incremented for commands which get retried
1192 * due to unrelated failures (qc->err_mask is zero).
1196 struct scsi_cmnd *scmd = qc->scsicmd; in ata_eh_qc_retry()
1197 if (!qc->err_mask) in ata_eh_qc_retry()
1198 scmd->allowed++; in ata_eh_qc_retry()
1203 * ata_dev_disable - disable ATA device
1219 dev->class++; in ata_dev_disable()
1224 ata_ering_clear(&dev->ering); in ata_dev_disable()
1229 * ata_eh_detach_dev - detach ATA device
1239 struct ata_link *link = dev->link; in ata_eh_detach_dev()
1240 struct ata_port *ap = link->ap; in ata_eh_detach_dev()
1241 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_detach_dev()
1246 spin_lock_irqsave(ap->lock, flags); in ata_eh_detach_dev()
1248 dev->flags &= ~ATA_DFLAG_DETACH; in ata_eh_detach_dev()
1251 dev->flags |= ATA_DFLAG_DETACHED; in ata_eh_detach_dev()
1252 ap->pflags |= ATA_PFLAG_SCSI_HOTPLUG; in ata_eh_detach_dev()
1255 /* clear per-dev EH info */ in ata_eh_detach_dev()
1256 ata_eh_clear_action(link, dev, &link->eh_info, ATA_EH_PERDEV_MASK); in ata_eh_detach_dev()
1257 ata_eh_clear_action(link, dev, &link->eh_context.i, ATA_EH_PERDEV_MASK); in ata_eh_detach_dev()
1258 ehc->saved_xfer_mode[dev->devno] = 0; in ata_eh_detach_dev()
1259 ehc->saved_ncq_enabled &= ~(1 << dev->devno); in ata_eh_detach_dev()
1261 spin_unlock_irqrestore(ap->lock, flags); in ata_eh_detach_dev()
1265 * ata_eh_about_to_do - about to perform eh_action
1267 * @dev: target ATA dev for per-dev action (can be NULL)
1271 * in @link->eh_info such that eh actions are not unnecessarily
1280 struct ata_port *ap = link->ap; in ata_eh_about_to_do()
1281 struct ata_eh_info *ehi = &link->eh_info; in ata_eh_about_to_do()
1282 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_about_to_do()
1285 trace_ata_eh_about_to_do(link, dev ? dev->devno : 0, action); in ata_eh_about_to_do()
1287 spin_lock_irqsave(ap->lock, flags); in ata_eh_about_to_do()
1294 if (!(ehc->i.flags & ATA_EHI_QUIET) && link != ap->slave_link) in ata_eh_about_to_do()
1295 ap->pflags |= ATA_PFLAG_RECOVERED; in ata_eh_about_to_do()
1297 spin_unlock_irqrestore(ap->lock, flags); in ata_eh_about_to_do()
1301 * ata_eh_done - EH action complete
1303 * @dev: target ATA dev for per-dev action (can be NULL)
1307 * in @link->eh_context.
1315 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_done()
1317 trace_ata_eh_done(link, dev ? dev->devno : 0, action); in ata_eh_done()
1319 ata_eh_clear_action(link, dev, &ehc->i, action); in ata_eh_done()
1323 * ata_err_string - convert err_mask to descriptive string
1362 * atapi_eh_tur - perform ATAPI TEST_UNIT_READY
1393 * ata_eh_request_sense - perform REQUEST_SENSE_DATA_EXT
1404 struct scsi_cmnd *cmd = qc->scsicmd; in ata_eh_request_sense()
1405 struct ata_device *dev = qc->dev; in ata_eh_request_sense()
1409 if (qc->ap->pflags & ATA_PFLAG_FROZEN) { in ata_eh_request_sense()
1414 if (!cmd || qc->flags & ATA_QCFLAG_SENSE_VALID) in ata_eh_request_sense()
1417 if (!ata_id_sense_reporting_enabled(dev->id)) { in ata_eh_request_sense()
1418 ata_dev_warn(qc->dev, "sense data reporting disabled\n"); in ata_eh_request_sense()
1432 qc->flags |= ATA_QCFLAG_SENSE_VALID; in ata_eh_request_sense()
1440 * atapi_eh_request_sense - perform ATAPI REQUEST_SENSE
1459 struct ata_port *ap = dev->link->ap; in atapi_eh_request_sense()
1465 * for the case where they are -not- overwritten in atapi_eh_request_sense()
1477 if (ap->flags & ATA_FLAG_PIO_DMA) { in atapi_eh_request_sense()
1491 * ata_eh_analyze_serror - analyze SError for a failed port
1502 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_analyze_serror()
1503 u32 serror = ehc->i.serror; in ata_eh_analyze_serror()
1525 if (link->lpm_policy > ATA_LPM_MAX_POWER) in ata_eh_analyze_serror()
1527 else if (!(link->flags & ATA_LFLAG_DISABLED) || ata_is_host_link(link)) in ata_eh_analyze_serror()
1533 ata_ehi_hotplugged(&ehc->i); in ata_eh_analyze_serror()
1535 ehc->i.err_mask |= err_mask; in ata_eh_analyze_serror()
1536 ehc->i.action |= action; in ata_eh_analyze_serror()
1540 * ata_eh_analyze_tf - analyze taskfile of a failed qc
1555 const struct ata_taskfile *tf = &qc->result_tf; in ata_eh_analyze_tf()
1557 u8 stat = tf->status, err = tf->error; in ata_eh_analyze_tf()
1560 qc->err_mask |= AC_ERR_HSM; in ata_eh_analyze_tf()
1565 qc->err_mask |= AC_ERR_DEV; in ata_eh_analyze_tf()
1576 switch (qc->dev->class) { in ata_eh_analyze_tf()
1583 qc->err_mask |= AC_ERR_ATA_BUS; in ata_eh_analyze_tf()
1585 qc->err_mask |= AC_ERR_MEDIA; in ata_eh_analyze_tf()
1587 qc->err_mask |= AC_ERR_INVALID; in ata_eh_analyze_tf()
1591 if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) { in ata_eh_analyze_tf()
1592 tmp = atapi_eh_request_sense(qc->dev, in ata_eh_analyze_tf()
1593 qc->scsicmd->sense_buffer, in ata_eh_analyze_tf()
1594 qc->result_tf.error >> 4); in ata_eh_analyze_tf()
1596 qc->flags |= ATA_QCFLAG_SENSE_VALID; in ata_eh_analyze_tf()
1598 qc->err_mask |= tmp; in ata_eh_analyze_tf()
1602 if (qc->flags & ATA_QCFLAG_SENSE_VALID) { in ata_eh_analyze_tf()
1603 enum scsi_disposition ret = scsi_check_sense(qc->scsicmd); in ata_eh_analyze_tf()
1614 qc->flags |= ATA_QCFLAG_RETRY; in ata_eh_analyze_tf()
1615 qc->err_mask |= AC_ERR_OTHER; in ata_eh_analyze_tf()
1617 qc->err_mask |= AC_ERR_HSM; in ata_eh_analyze_tf()
1620 if (qc->err_mask & (AC_ERR_HSM | AC_ERR_TIMEOUT | AC_ERR_ATA_BUS)) in ata_eh_analyze_tf()
1665 if ((ent->eflags & ATA_EFLAG_OLD_ER) || (ent->timestamp < arg->since)) in speed_down_verdict_cb()
1666 return -1; in speed_down_verdict_cb()
1668 cat = ata_eh_categorize_error(ent->eflags, ent->err_mask, in speed_down_verdict_cb()
1669 &arg->xfer_ok); in speed_down_verdict_cb()
1670 arg->nr_errors[cat]++; in speed_down_verdict_cb()
1676 * ata_eh_speed_down_verdict - Determine speed down verdict
1703 * taken per error. An action triggered by non-DUBIOUS errors
1741 arg.since = j64 - min(j64, j5mins); in ata_eh_speed_down_verdict()
1742 ata_ering_map(&dev->ering, speed_down_verdict_cb, &arg); in ata_eh_speed_down_verdict()
1760 arg.since = j64 - min(j64, j10mins); in ata_eh_speed_down_verdict()
1761 ata_ering_map(&dev->ering, speed_down_verdict_cb, &arg); in ata_eh_speed_down_verdict()
1776 * ata_eh_speed_down - record error and speed down if necessary
1800 /* don't bother if Cat-0 error */ in ata_eh_speed_down()
1805 ata_ering_record(&dev->ering, eflags, err_mask); in ata_eh_speed_down()
1810 (dev->flags & (ATA_DFLAG_PIO | ATA_DFLAG_NCQ | in ata_eh_speed_down()
1812 dev->flags |= ATA_DFLAG_NCQ_OFF; in ata_eh_speed_down()
1826 if (dev->spdn_cnt < 2) { in ata_eh_speed_down()
1833 if (dev->xfer_shift != ATA_SHIFT_PIO) in ata_eh_speed_down()
1834 sel = dma_dnxfer_sel[dev->spdn_cnt]; in ata_eh_speed_down()
1836 sel = pio_dnxfer_sel[dev->spdn_cnt]; in ata_eh_speed_down()
1838 dev->spdn_cnt++; in ata_eh_speed_down()
1850 if ((verdict & ATA_EH_SPDN_FALLBACK_TO_PIO) && (dev->spdn_cnt >= 2) && in ata_eh_speed_down()
1851 (link->ap->cbl != ATA_CBL_SATA || dev->class == ATA_DEV_ATAPI) && in ata_eh_speed_down()
1852 (dev->xfer_shift != ATA_SHIFT_PIO)) { in ata_eh_speed_down()
1854 dev->spdn_cnt = 0; in ata_eh_speed_down()
1864 ata_ering_clear(&dev->ering); in ata_eh_speed_down()
1869 * ata_eh_worth_retry - analyze error and decide whether to retry
1874 * because the drive itself has probably already taken 10-30 seconds
1879 if (qc->err_mask & AC_ERR_MEDIA) in ata_eh_worth_retry()
1881 if (qc->flags & ATA_QCFLAG_IO) in ata_eh_worth_retry()
1883 if (qc->err_mask & AC_ERR_INVALID) in ata_eh_worth_retry()
1885 return qc->err_mask != AC_ERR_DEV; /* retry if not dev error */ in ata_eh_worth_retry()
1889 * ata_eh_quiet - check if we need to be quiet about a command error
1897 if (qc->scsicmd && scsi_cmd_to_rq(qc->scsicmd)->rq_flags & RQF_QUIET) in ata_eh_quiet()
1898 qc->flags |= ATA_QCFLAG_QUIET; in ata_eh_quiet()
1899 return qc->flags & ATA_QCFLAG_QUIET; in ata_eh_quiet()
1903 * ata_eh_link_autopsy - analyze error and determine recovery action
1915 struct ata_port *ap = link->ap; in ata_eh_link_autopsy()
1916 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_link_autopsy()
1924 if (ehc->i.flags & ATA_EHI_NO_AUTOPSY) in ata_eh_link_autopsy()
1930 ehc->i.serror |= serror; in ata_eh_link_autopsy()
1932 } else if (rc != -EOPNOTSUPP) { in ata_eh_link_autopsy()
1934 ehc->i.probe_mask |= ATA_ALL_DEVICES; in ata_eh_link_autopsy()
1935 ehc->i.action |= ATA_EH_RESET; in ata_eh_link_autopsy()
1936 ehc->i.err_mask |= AC_ERR_OTHER; in ata_eh_link_autopsy()
1943 if (ehc->i.err_mask & ~AC_ERR_OTHER) in ata_eh_link_autopsy()
1944 ehc->i.err_mask &= ~AC_ERR_OTHER; in ata_eh_link_autopsy()
1946 all_err_mask |= ehc->i.err_mask; in ata_eh_link_autopsy()
1949 if (!(qc->flags & ATA_QCFLAG_FAILED) || in ata_eh_link_autopsy()
1950 ata_dev_phys_link(qc->dev) != link) in ata_eh_link_autopsy()
1954 qc->err_mask |= ehc->i.err_mask; in ata_eh_link_autopsy()
1957 ehc->i.action |= ata_eh_analyze_tf(qc); in ata_eh_link_autopsy()
1960 if (qc->err_mask & AC_ERR_ATA_BUS) in ata_eh_link_autopsy()
1961 qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_MEDIA | in ata_eh_link_autopsy()
1965 if (qc->err_mask & ~AC_ERR_OTHER) in ata_eh_link_autopsy()
1966 qc->err_mask &= ~AC_ERR_OTHER; in ata_eh_link_autopsy()
1975 if (qc->flags & ATA_QCFLAG_SENSE_VALID) in ata_eh_link_autopsy()
1976 qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER); in ata_eh_link_autopsy()
1978 qc->flags |= ATA_QCFLAG_RETRY; in ata_eh_link_autopsy()
1981 ehc->i.dev = qc->dev; in ata_eh_link_autopsy()
1982 all_err_mask |= qc->err_mask; in ata_eh_link_autopsy()
1983 if (qc->flags & ATA_QCFLAG_IO) in ata_eh_link_autopsy()
1995 ehc->i.flags |= ATA_EHI_QUIET; in ata_eh_link_autopsy()
1998 if (ap->pflags & ATA_PFLAG_FROZEN || in ata_eh_link_autopsy()
2000 ehc->i.action |= ATA_EH_RESET; in ata_eh_link_autopsy()
2003 ehc->i.action |= ATA_EH_REVALIDATE; in ata_eh_link_autopsy()
2006 * perform per-dev EH action only on the offending device. in ata_eh_link_autopsy()
2008 if (ehc->i.dev) { in ata_eh_link_autopsy()
2009 ehc->i.dev_action[ehc->i.dev->devno] |= in ata_eh_link_autopsy()
2010 ehc->i.action & ATA_EH_PERDEV_MASK; in ata_eh_link_autopsy()
2011 ehc->i.action &= ~ATA_EH_PERDEV_MASK; in ata_eh_link_autopsy()
2016 ap->link.eh_context.i.err_mask |= AC_ERR_TIMEOUT; in ata_eh_link_autopsy()
2019 dev = ehc->i.dev; in ata_eh_link_autopsy()
2021 ata_dev_enabled(link->device)))) in ata_eh_link_autopsy()
2022 dev = link->device; in ata_eh_link_autopsy()
2025 if (dev->flags & ATA_DFLAG_DUBIOUS_XFER) in ata_eh_link_autopsy()
2027 ehc->i.action |= ata_eh_speed_down(dev, eflags, all_err_mask); in ata_eh_link_autopsy()
2028 trace_ata_eh_link_autopsy(dev, ehc->i.action, all_err_mask); in ata_eh_link_autopsy()
2033 * ata_eh_autopsy - analyze error and determine recovery action
2053 if (ap->slave_link) { in ata_eh_autopsy()
2054 struct ata_eh_context *mehc = &ap->link.eh_context; in ata_eh_autopsy()
2055 struct ata_eh_context *sehc = &ap->slave_link->eh_context; in ata_eh_autopsy()
2058 sehc->i.flags |= mehc->i.flags & ATA_EHI_TO_SLAVE_MASK; in ata_eh_autopsy()
2061 ata_eh_link_autopsy(ap->slave_link); in ata_eh_autopsy()
2064 ata_eh_about_to_do(ap->slave_link, NULL, ATA_EH_ALL_ACTIONS); in ata_eh_autopsy()
2065 mehc->i.action |= sehc->i.action; in ata_eh_autopsy()
2066 mehc->i.dev_action[1] |= sehc->i.dev_action[1]; in ata_eh_autopsy()
2067 mehc->i.flags |= sehc->i.flags; in ata_eh_autopsy()
2068 ata_eh_done(ap->slave_link, NULL, ATA_EH_ALL_ACTIONS); in ata_eh_autopsy()
2075 ata_eh_link_autopsy(&ap->link); in ata_eh_autopsy()
2079 * ata_get_cmd_name - get name for ATA command
2122 { ATA_CMD_NCQ_NON_DATA, "NCQ NON-DATA" }, in ata_get_cmd_name()
2151 { ATA_CMD_TRUSTED_NONDATA, "TRUSTED NON-DATA" }, in ata_get_cmd_name()
2201 * ata_eh_link_report - report error handling to user
2211 struct ata_port *ap = link->ap; in ata_eh_link_report()
2212 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_link_report()
2218 if (ehc->i.flags & ATA_EHI_QUIET) in ata_eh_link_report()
2222 if (ehc->i.desc[0] != '\0') in ata_eh_link_report()
2223 desc = ehc->i.desc; in ata_eh_link_report()
2226 if (!(qc->flags & ATA_QCFLAG_FAILED) || in ata_eh_link_report()
2227 ata_dev_phys_link(qc->dev) != link || in ata_eh_link_report()
2228 ((qc->flags & ATA_QCFLAG_QUIET) && in ata_eh_link_report()
2229 qc->err_mask == AC_ERR_DEV)) in ata_eh_link_report()
2231 if (qc->flags & ATA_QCFLAG_SENSE_VALID && !qc->err_mask) in ata_eh_link_report()
2237 if (!nr_failed && !ehc->i.err_mask) in ata_eh_link_report()
2241 if (ap->pflags & ATA_PFLAG_FROZEN) in ata_eh_link_report()
2244 if (ap->eh_tries < ATA_EH_MAX_TRIES) in ata_eh_link_report()
2246 ap->eh_tries); in ata_eh_link_report()
2248 if (ehc->i.dev) { in ata_eh_link_report()
2249 ata_dev_err(ehc->i.dev, "exception Emask 0x%x " in ata_eh_link_report()
2251 ehc->i.err_mask, link->sactive, ehc->i.serror, in ata_eh_link_report()
2252 ehc->i.action, frozen, tries_buf); in ata_eh_link_report()
2254 ata_dev_err(ehc->i.dev, "%s\n", desc); in ata_eh_link_report()
2258 ehc->i.err_mask, link->sactive, ehc->i.serror, in ata_eh_link_report()
2259 ehc->i.action, frozen, tries_buf); in ata_eh_link_report()
2265 if (ehc->i.serror) in ata_eh_link_report()
2268 ehc->i.serror & SERR_DATA_RECOVERED ? "RecovData " : "", in ata_eh_link_report()
2269 ehc->i.serror & SERR_COMM_RECOVERED ? "RecovComm " : "", in ata_eh_link_report()
2270 ehc->i.serror & SERR_DATA ? "UnrecovData " : "", in ata_eh_link_report()
2271 ehc->i.serror & SERR_PERSISTENT ? "Persist " : "", in ata_eh_link_report()
2272 ehc->i.serror & SERR_PROTOCOL ? "Proto " : "", in ata_eh_link_report()
2273 ehc->i.serror & SERR_INTERNAL ? "HostInt " : "", in ata_eh_link_report()
2274 ehc->i.serror & SERR_PHYRDY_CHG ? "PHYRdyChg " : "", in ata_eh_link_report()
2275 ehc->i.serror & SERR_PHY_INT_ERR ? "PHYInt " : "", in ata_eh_link_report()
2276 ehc->i.serror & SERR_COMM_WAKE ? "CommWake " : "", in ata_eh_link_report()
2277 ehc->i.serror & SERR_10B_8B_ERR ? "10B8B " : "", in ata_eh_link_report()
2278 ehc->i.serror & SERR_DISPARITY ? "Dispar " : "", in ata_eh_link_report()
2279 ehc->i.serror & SERR_CRC ? "BadCRC " : "", in ata_eh_link_report()
2280 ehc->i.serror & SERR_HANDSHAKE ? "Handshk " : "", in ata_eh_link_report()
2281 ehc->i.serror & SERR_LINK_SEQ_ERR ? "LinkSeq " : "", in ata_eh_link_report()
2282 ehc->i.serror & SERR_TRANS_ST_ERROR ? "TrStaTrns " : "", in ata_eh_link_report()
2283 ehc->i.serror & SERR_UNRECOG_FIS ? "UnrecFIS " : "", in ata_eh_link_report()
2284 ehc->i.serror & SERR_DEV_XCHG ? "DevExch " : ""); in ata_eh_link_report()
2288 struct ata_taskfile *cmd = &qc->tf, *res = &qc->result_tf; in ata_eh_link_report()
2292 if (!(qc->flags & ATA_QCFLAG_FAILED) || in ata_eh_link_report()
2293 ata_dev_phys_link(qc->dev) != link || !qc->err_mask) in ata_eh_link_report()
2296 if (qc->dma_dir != DMA_NONE) { in ata_eh_link_report()
2304 switch (qc->tf.protocol) { in ata_eh_link_report()
2334 prot_str, qc->nbytes, dma_str[qc->dma_dir]); in ata_eh_link_report()
2337 if (ata_is_atapi(qc->tf.protocol)) { in ata_eh_link_report()
2338 const u8 *cdb = qc->cdb; in ata_eh_link_report()
2339 size_t cdb_len = qc->dev->cdb_len; in ata_eh_link_report()
2341 if (qc->scsicmd) { in ata_eh_link_report()
2342 cdb = qc->scsicmd->cmnd; in ata_eh_link_report()
2343 cdb_len = qc->scsicmd->cmd_len; in ata_eh_link_report()
2348 ata_dev_err(qc->dev, "failed command: %s\n", in ata_eh_link_report()
2349 ata_get_cmd_name(cmd->command)); in ata_eh_link_report()
2351 ata_dev_err(qc->dev, in ata_eh_link_report()
2356 cmd->command, cmd->feature, cmd->nsect, in ata_eh_link_report()
2357 cmd->lbal, cmd->lbam, cmd->lbah, in ata_eh_link_report()
2358 cmd->hob_feature, cmd->hob_nsect, in ata_eh_link_report()
2359 cmd->hob_lbal, cmd->hob_lbam, cmd->hob_lbah, in ata_eh_link_report()
2360 cmd->device, qc->tag, data_buf, cdb_buf, in ata_eh_link_report()
2361 res->status, res->error, res->nsect, in ata_eh_link_report()
2362 res->lbal, res->lbam, res->lbah, in ata_eh_link_report()
2363 res->hob_feature, res->hob_nsect, in ata_eh_link_report()
2364 res->hob_lbal, res->hob_lbam, res->hob_lbah, in ata_eh_link_report()
2365 res->device, qc->err_mask, ata_err_string(qc->err_mask), in ata_eh_link_report()
2366 qc->err_mask & AC_ERR_NCQ ? " <F>" : ""); in ata_eh_link_report()
2369 if (res->status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | in ata_eh_link_report()
2371 if (res->status & ATA_BUSY) in ata_eh_link_report()
2372 ata_dev_err(qc->dev, "status: { Busy }\n"); in ata_eh_link_report()
2374 ata_dev_err(qc->dev, "status: { %s%s%s%s%s}\n", in ata_eh_link_report()
2375 res->status & ATA_DRDY ? "DRDY " : "", in ata_eh_link_report()
2376 res->status & ATA_DF ? "DF " : "", in ata_eh_link_report()
2377 res->status & ATA_DRQ ? "DRQ " : "", in ata_eh_link_report()
2378 res->status & ATA_SENSE ? "SENSE " : "", in ata_eh_link_report()
2379 res->status & ATA_ERR ? "ERR " : ""); in ata_eh_link_report()
2382 if (cmd->command != ATA_CMD_PACKET && in ata_eh_link_report()
2383 (res->error & (ATA_ICRC | ATA_UNC | ATA_AMNF | ATA_IDNF | in ata_eh_link_report()
2385 ata_dev_err(qc->dev, "error: { %s%s%s%s%s}\n", in ata_eh_link_report()
2386 res->error & ATA_ICRC ? "ICRC " : "", in ata_eh_link_report()
2387 res->error & ATA_UNC ? "UNC " : "", in ata_eh_link_report()
2388 res->error & ATA_AMNF ? "AMNF " : "", in ata_eh_link_report()
2389 res->error & ATA_IDNF ? "IDNF " : "", in ata_eh_link_report()
2390 res->error & ATA_ABORTED ? "ABRT " : ""); in ata_eh_link_report()
2396 * ata_eh_report - report error handling to user
2420 classes[dev->devno] = ATA_DEV_UNKNOWN; in ata_do_reset()
2427 if ((link->flags & ATA_LFLAG_NO_SRST) || ata_link_offline(link)) in ata_eh_followup_srst_needed()
2429 if (rc == -EAGAIN) in ata_eh_followup_srst_needed()
2431 if (sata_pmp_supported(link->ap) && ata_is_host_link(link)) in ata_eh_followup_srst_needed()
2440 struct ata_port *ap = link->ap; in ata_eh_reset()
2441 struct ata_link *slave = ap->slave_link; in ata_eh_reset()
2442 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_reset()
2443 struct ata_eh_context *sehc = slave ? &slave->eh_context : NULL; in ata_eh_reset()
2444 unsigned int *classes = ehc->classes; in ata_eh_reset()
2445 unsigned int lflags = link->flags; in ata_eh_reset()
2446 int verbose = !(ehc->i.flags & ATA_EHI_QUIET); in ata_eh_reset()
2461 if (link->flags & ATA_LFLAG_RST_ONCE) in ata_eh_reset()
2463 if (link->flags & ATA_LFLAG_NO_HRST) in ata_eh_reset()
2465 if (link->flags & ATA_LFLAG_NO_SRST) in ata_eh_reset()
2469 if (ehc->i.flags & ATA_EHI_DID_RESET) { in ata_eh_reset()
2471 WARN_ON(time_after(ehc->last_reset, now)); in ata_eh_reset()
2472 deadline = ata_deadline(ehc->last_reset, in ata_eh_reset()
2475 schedule_timeout_uninterruptible(deadline - now); in ata_eh_reset()
2478 spin_lock_irqsave(ap->lock, flags); in ata_eh_reset()
2479 ap->pflags |= ATA_PFLAG_RESETTING; in ata_eh_reset()
2480 spin_unlock_irqrestore(ap->lock, flags); in ata_eh_reset()
2489 * suitable controller mode we should not touch the in ata_eh_reset()
2492 dev->pio_mode = XFER_PIO_0; in ata_eh_reset()
2493 dev->dma_mode = 0xff; in ata_eh_reset()
2497 * touch the DMA setup as that will be dealt with when in ata_eh_reset()
2500 if (ap->ops->set_piomode) in ata_eh_reset()
2501 ap->ops->set_piomode(ap, dev); in ata_eh_reset()
2506 ehc->i.action &= ~ATA_EH_RESET; in ata_eh_reset()
2509 ehc->i.action |= ATA_EH_HARDRESET; in ata_eh_reset()
2512 ehc->i.action |= ATA_EH_SOFTRESET; in ata_eh_reset()
2520 sehc->i.action &= ~ATA_EH_RESET; in ata_eh_reset()
2521 sehc->i.action |= ehc->i.action; in ata_eh_reset()
2528 * -ENOENT or clear ATA_EH_RESET. in ata_eh_reset()
2530 if (slave && (rc == 0 || rc == -ENOENT)) { in ata_eh_reset()
2534 if (tmp != -ENOENT) in ata_eh_reset()
2537 ehc->i.action |= sehc->i.action; in ata_eh_reset()
2541 if (rc == -ENOENT) { in ata_eh_reset()
2542 ata_link_dbg(link, "port disabled--ignoring\n"); in ata_eh_reset()
2543 ehc->i.action &= ~ATA_EH_RESET; in ata_eh_reset()
2546 classes[dev->devno] = ATA_DEV_NONE; in ata_eh_reset()
2559 if (reset && !(ehc->i.action & ATA_EH_RESET)) { in ata_eh_reset()
2561 classes[dev->devno] = ATA_DEV_NONE; in ata_eh_reset()
2562 if ((ap->pflags & ATA_PFLAG_FROZEN) && in ata_eh_reset()
2585 ehc->last_reset = jiffies; in ata_eh_reset()
2587 ehc->i.flags |= ATA_EHI_DID_HARDRESET; in ata_eh_reset()
2590 ehc->i.flags |= ATA_EHI_DID_SOFTRESET; in ata_eh_reset()
2599 if (rc && rc != -EAGAIN) { in ata_eh_reset()
2618 case -EAGAIN: in ata_eh_reset()
2619 rc = -EAGAIN; in ata_eh_reset()
2630 /* perform follow-up SRST if necessary */ in ata_eh_reset()
2637 "follow-up softreset required but no softreset available\n"); in ata_eh_reset()
2639 rc = -EINVAL; in ata_eh_reset()
2661 * Post-reset processing in ata_eh_reset()
2668 dev->pio_mode = XFER_PIO_0; in ata_eh_reset()
2669 dev->flags &= ~ATA_DFLAG_SLEEPING; in ata_eh_reset()
2676 classes[dev->devno] = ATA_DEV_ATA; in ata_eh_reset()
2678 classes[dev->devno] = ATA_DEV_SEMB_UNSUP; in ata_eh_reset()
2683 link->sata_spd = (sstatus >> 4) & 0xf; in ata_eh_reset()
2685 slave->sata_spd = (sstatus >> 4) & 0xf; in ata_eh_reset()
2710 * information and re-thaw the port if frozen. As reset is the in ata_eh_reset()
2714 spin_lock_irqsave(link->ap->lock, flags); in ata_eh_reset()
2715 memset(&link->eh_info, 0, sizeof(link->eh_info)); in ata_eh_reset()
2717 memset(&slave->eh_info, 0, sizeof(link->eh_info)); in ata_eh_reset()
2718 ap->pflags &= ~ATA_PFLAG_EH_PENDING; in ata_eh_reset()
2719 spin_unlock_irqrestore(link->ap->lock, flags); in ata_eh_reset()
2721 if (ap->pflags & ATA_PFLAG_FROZEN) in ata_eh_reset()
2735 if (classes[dev->devno] == ATA_DEV_UNKNOWN) { in ata_eh_reset()
2737 classes[dev->devno] = ATA_DEV_NONE; in ata_eh_reset()
2741 if (ata_class_enabled(classes[dev->devno])) in ata_eh_reset()
2744 classes[dev->devno]); in ata_eh_reset()
2745 classes[dev->devno] = ATA_DEV_NONE; in ata_eh_reset()
2746 } else if (classes[dev->devno] == ATA_DEV_UNKNOWN) { in ata_eh_reset()
2749 classes[dev->devno] = ATA_DEV_NONE; in ata_eh_reset()
2759 rc = -EAGAIN; in ata_eh_reset()
2771 ehc->last_reset = jiffies; /* update to completion time */ in ata_eh_reset()
2772 ehc->i.action |= ATA_EH_REVALIDATE; in ata_eh_reset()
2773 link->lpm_policy = ATA_LPM_UNKNOWN; /* reset LPM state */ in ata_eh_reset()
2778 ehc->i.flags &= ~ATA_EHI_HOTPLUGGED; in ata_eh_reset()
2780 sehc->i.flags &= ~ATA_EHI_HOTPLUGGED; in ata_eh_reset()
2782 spin_lock_irqsave(ap->lock, flags); in ata_eh_reset()
2783 ap->pflags &= ~ATA_PFLAG_RESETTING; in ata_eh_reset()
2784 spin_unlock_irqrestore(ap->lock, flags); in ata_eh_reset()
2789 /* if SCR isn't accessible on a fan-out port, PMP needs to be reset */ in ata_eh_reset()
2792 rc = -ERESTART; in ata_eh_reset()
2808 unsigned long delta = deadline - now; in ata_eh_reset()
2822 * They need to be reset - as well as the PMP - before retrying. in ata_eh_reset()
2824 if (rc == -ERESTART) { in ata_eh_reset()
2830 if (try == max_tries - 1) { in ata_eh_reset()
2834 } else if (rc == -EPIPE) in ata_eh_reset()
2860 * Additionally, all write accesses to &ap->park_req_pending in ata_eh_pull_park_action()
2867 * park_req_pending.done is non-zero by the time we reach in ata_eh_pull_park_action()
2874 spin_lock_irqsave(ap->lock, flags); in ata_eh_pull_park_action()
2875 reinit_completion(&ap->park_req_pending); in ata_eh_pull_park_action()
2878 struct ata_eh_info *ehi = &link->eh_info; in ata_eh_pull_park_action()
2880 link->eh_context.i.dev_action[dev->devno] |= in ata_eh_pull_park_action()
2881 ehi->dev_action[dev->devno] & ATA_EH_PARK; in ata_eh_pull_park_action()
2885 spin_unlock_irqrestore(ap->lock, flags); in ata_eh_pull_park_action()
2890 struct ata_eh_context *ehc = &dev->link->eh_context; in ata_eh_park_issue_cmd()
2896 ehc->unloaded_mask |= 1 << dev->devno; in ata_eh_park_issue_cmd()
2903 ehc->unloaded_mask &= ~(1 << dev->devno); in ata_eh_park_issue_cmd()
2912 ehc->unloaded_mask &= ~(1 << dev->devno); in ata_eh_park_issue_cmd()
2919 struct ata_port *ap = link->ap; in ata_eh_revalidate_and_attach()
2920 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_revalidate_and_attach()
2927 * be done backwards such that PDIAG- is released by the slave in ata_eh_revalidate_and_attach()
2934 if (ehc->i.flags & ATA_EHI_DID_RESET) in ata_eh_revalidate_and_attach()
2938 WARN_ON(dev->class == ATA_DEV_PMP); in ata_eh_revalidate_and_attach()
2941 * The link may be in a deep sleep, wake it up. in ata_eh_revalidate_and_attach()
2943 * If the link is in deep sleep, ata_phys_link_offline() in ata_eh_revalidate_and_attach()
2948 * to ap->target_lpm_policy after revalidation is done. in ata_eh_revalidate_and_attach()
2950 if (link->lpm_policy > ATA_LPM_MAX_POWER) { in ata_eh_revalidate_and_attach()
2958 rc = -EIO; in ata_eh_revalidate_and_attach()
2963 rc = ata_dev_revalidate(dev, ehc->classes[dev->devno], in ata_eh_revalidate_and_attach()
2973 ehc->i.flags |= ATA_EHI_SETMODE; in ata_eh_revalidate_and_attach()
2976 schedule_work(&(ap->scsi_rescan_task)); in ata_eh_revalidate_and_attach()
2977 } else if (dev->class == ATA_DEV_UNKNOWN && in ata_eh_revalidate_and_attach()
2978 ehc->tries[dev->devno] && in ata_eh_revalidate_and_attach()
2979 ata_class_enabled(ehc->classes[dev->devno])) { in ata_eh_revalidate_and_attach()
2980 /* Temporarily set dev->class, it will be in ata_eh_revalidate_and_attach()
2986 dev->class = ehc->classes[dev->devno]; in ata_eh_revalidate_and_attach()
2988 if (dev->class == ATA_DEV_PMP) in ata_eh_revalidate_and_attach()
2991 rc = ata_dev_read_id(dev, &dev->class, in ata_eh_revalidate_and_attach()
2992 readid_flags, dev->id); in ata_eh_revalidate_and_attach()
2995 ehc->classes[dev->devno] = dev->class; in ata_eh_revalidate_and_attach()
2996 dev->class = ATA_DEV_UNKNOWN; in ata_eh_revalidate_and_attach()
3001 ata_ering_clear(&dev->ering); in ata_eh_revalidate_and_attach()
3002 new_mask |= 1 << dev->devno; in ata_eh_revalidate_and_attach()
3004 case -ENOENT: in ata_eh_revalidate_and_attach()
3005 /* IDENTIFY was issued to non-existent in ata_eh_revalidate_and_attach()
3017 /* PDIAG- should have been released, ask cable type if post-reset */ in ata_eh_revalidate_and_attach()
3018 if ((ehc->i.flags & ATA_EHI_DID_RESET) && ata_is_host_link(link)) { in ata_eh_revalidate_and_attach()
3019 if (ap->ops->cable_detect) in ata_eh_revalidate_and_attach()
3020 ap->cbl = ap->ops->cable_detect(ap); in ata_eh_revalidate_and_attach()
3028 if (!(new_mask & (1 << dev->devno))) in ata_eh_revalidate_and_attach()
3031 dev->class = ehc->classes[dev->devno]; in ata_eh_revalidate_and_attach()
3033 if (dev->class == ATA_DEV_PMP) in ata_eh_revalidate_and_attach()
3036 ehc->i.flags |= ATA_EHI_PRINTINFO; in ata_eh_revalidate_and_attach()
3038 ehc->i.flags &= ~ATA_EHI_PRINTINFO; in ata_eh_revalidate_and_attach()
3040 dev->class = ATA_DEV_UNKNOWN; in ata_eh_revalidate_and_attach()
3044 spin_lock_irqsave(ap->lock, flags); in ata_eh_revalidate_and_attach()
3045 ap->pflags |= ATA_PFLAG_SCSI_HOTPLUG; in ata_eh_revalidate_and_attach()
3046 spin_unlock_irqrestore(ap->lock, flags); in ata_eh_revalidate_and_attach()
3049 ehc->i.flags |= ATA_EHI_SETMODE; in ata_eh_revalidate_and_attach()
3060 * ata_set_mode - Program timings and issue SET FEATURES - XFER
3076 struct ata_port *ap = link->ap; in ata_set_mode()
3082 if (!(dev->flags & ATA_DFLAG_DUBIOUS_XFER)) { in ata_set_mode()
3085 ent = ata_ering_top(&dev->ering); in ata_set_mode()
3087 ent->eflags &= ~ATA_EFLAG_DUBIOUS_XFER; in ata_set_mode()
3092 if (ap->ops->set_mode) in ata_set_mode()
3093 rc = ap->ops->set_mode(link, r_failed_dev); in ata_set_mode()
3099 struct ata_eh_context *ehc = &link->eh_context; in ata_set_mode()
3100 u8 saved_xfer_mode = ehc->saved_xfer_mode[dev->devno]; in ata_set_mode()
3101 u8 saved_ncq = !!(ehc->saved_ncq_enabled & (1 << dev->devno)); in ata_set_mode()
3103 if (dev->xfer_mode != saved_xfer_mode || in ata_set_mode()
3105 dev->flags |= ATA_DFLAG_DUBIOUS_XFER; in ata_set_mode()
3112 * atapi_eh_clear_ua - Clear ATAPI UNIT ATTENTION after reset
3123 * 0 on success, -errno on failure.
3130 u8 *sense_buffer = dev->link->ap->sector_buf; in atapi_eh_clear_ua()
3139 return -EIO; in atapi_eh_clear_ua()
3149 return -EIO; in atapi_eh_clear_ua()
3160 * ata_eh_maybe_retry_flush - Retry FLUSH if necessary
3174 * 0 if EH can continue, -errno if EH needs to be repeated.
3178 struct ata_link *link = dev->link; in ata_eh_maybe_retry_flush()
3179 struct ata_port *ap = link->ap; in ata_eh_maybe_retry_flush()
3186 if (!ata_tag_valid(link->active_tag)) in ata_eh_maybe_retry_flush()
3189 qc = __ata_qc_from_tag(ap, link->active_tag); in ata_eh_maybe_retry_flush()
3190 if (qc->dev != dev || (qc->tf.command != ATA_CMD_FLUSH_EXT && in ata_eh_maybe_retry_flush()
3191 qc->tf.command != ATA_CMD_FLUSH)) in ata_eh_maybe_retry_flush()
3195 if (qc->err_mask & AC_ERR_DEV) in ata_eh_maybe_retry_flush()
3201 tf.command = qc->tf.command; in ata_eh_maybe_retry_flush()
3206 tf.command, qc->err_mask); in ata_eh_maybe_retry_flush()
3214 * retrying it should do the trick - whatever was in in ata_eh_maybe_retry_flush()
3218 qc->scsicmd->allowed = max(qc->scsicmd->allowed, 1); in ata_eh_maybe_retry_flush()
3222 rc = -EIO; in ata_eh_maybe_retry_flush()
3226 qc->err_mask |= AC_ERR_DEV; in ata_eh_maybe_retry_flush()
3227 qc->result_tf = tf; in ata_eh_maybe_retry_flush()
3228 if (!(ap->pflags & ATA_PFLAG_FROZEN)) in ata_eh_maybe_retry_flush()
3236 * ata_eh_set_lpm - configure SATA interface power management
3250 * 0 on success, -errno on failure.
3255 struct ata_port *ap = ata_is_host_link(link) ? link->ap : NULL; in ata_eh_set_lpm()
3256 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_set_lpm()
3258 enum ata_lpm_policy old_policy = link->lpm_policy; in ata_eh_set_lpm()
3259 bool no_dipm = link->ap->flags & ATA_FLAG_NO_DIPM; in ata_eh_set_lpm()
3266 (link->flags & ATA_LFLAG_NO_LPM) || (ap && !ap->ops->set_lpm)) in ata_eh_set_lpm()
3276 bool hipm = ata_id_has_hipm(dev->id); in ata_eh_set_lpm()
3277 bool dipm = ata_id_has_dipm(dev->id) && !no_dipm; in ata_eh_set_lpm()
3298 rc = -EIO; in ata_eh_set_lpm()
3305 rc = ap->ops->set_lpm(link, policy, hints); in ata_eh_set_lpm()
3306 if (!rc && ap->slave_link) in ata_eh_set_lpm()
3307 rc = ap->ops->set_lpm(ap->slave_link, policy, hints); in ata_eh_set_lpm()
3316 if (rc == -EOPNOTSUPP) { in ata_eh_set_lpm()
3317 link->flags |= ATA_LFLAG_NO_LPM; in ata_eh_set_lpm()
3328 link->lpm_policy = policy; in ata_eh_set_lpm()
3329 if (ap && ap->slave_link) in ata_eh_set_lpm()
3330 ap->slave_link->lpm_policy = policy; in ata_eh_set_lpm()
3335 ata_id_has_dipm(dev->id)) { in ata_eh_set_lpm()
3342 rc = -EIO; in ata_eh_set_lpm()
3348 link->last_lpm_change = jiffies; in ata_eh_set_lpm()
3349 link->flags |= ATA_LFLAG_CHANGED; in ata_eh_set_lpm()
3355 link->lpm_policy = old_policy; in ata_eh_set_lpm()
3356 if (ap && ap->slave_link) in ata_eh_set_lpm()
3357 ap->slave_link->lpm_policy = old_policy; in ata_eh_set_lpm()
3360 if (!dev || ehc->tries[dev->devno] <= 2) { in ata_eh_set_lpm()
3362 link->flags |= ATA_LFLAG_NO_LPM; in ata_eh_set_lpm()
3385 if (dev->class == ATA_DEV_UNKNOWN) in ata_link_nr_vacant()
3392 struct ata_port *ap = link->ap; in ata_eh_skip_recovery()
3393 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_skip_recovery()
3397 if (link->flags & ATA_LFLAG_DISABLED) in ata_eh_skip_recovery()
3401 if (ehc->i.flags & ATA_EHI_NO_RECOVERY) in ata_eh_skip_recovery()
3405 if ((ap->pflags & ATA_PFLAG_FROZEN) || ata_link_nr_enabled(link)) in ata_eh_skip_recovery()
3409 if ((ehc->i.action & ATA_EH_RESET) && in ata_eh_skip_recovery()
3410 !(ehc->i.flags & ATA_EHI_DID_RESET)) in ata_eh_skip_recovery()
3415 if (dev->class == ATA_DEV_UNKNOWN && in ata_eh_skip_recovery()
3416 ehc->classes[dev->devno] != ATA_DEV_NONE) in ata_eh_skip_recovery()
3429 if ((ent->eflags & ATA_EFLAG_OLD_ER) || in ata_count_probe_trials_cb()
3430 (ent->timestamp < now - min(now, interval))) in ata_count_probe_trials_cb()
3431 return -1; in ata_count_probe_trials_cb()
3439 struct ata_eh_context *ehc = &dev->link->eh_context; in ata_eh_schedule_probe()
3443 if (!(ehc->i.probe_mask & (1 << dev->devno)) || in ata_eh_schedule_probe()
3444 (ehc->did_probe_mask & (1 << dev->devno))) in ata_eh_schedule_probe()
3449 ehc->did_probe_mask |= (1 << dev->devno); in ata_eh_schedule_probe()
3450 ehc->i.action |= ATA_EH_RESET; in ata_eh_schedule_probe()
3451 ehc->saved_xfer_mode[dev->devno] = 0; in ata_eh_schedule_probe()
3452 ehc->saved_ncq_enabled &= ~(1 << dev->devno); in ata_eh_schedule_probe()
3454 /* the link maybe in a deep sleep, wake it up */ in ata_eh_schedule_probe()
3455 if (link->lpm_policy > ATA_LPM_MAX_POWER) { in ata_eh_schedule_probe()
3457 link->ap->ops->set_lpm(link, ATA_LPM_MAX_POWER, in ata_eh_schedule_probe()
3477 ata_ering_record(&dev->ering, 0, AC_ERR_OTHER); in ata_eh_schedule_probe()
3478 ata_ering_map(&dev->ering, ata_count_probe_trials_cb, &trials); in ata_eh_schedule_probe()
3488 struct ata_eh_context *ehc = &dev->link->eh_context; in ata_eh_handle_dev_fail()
3490 /* -EAGAIN from EH routine indicates retry without prejudice. in ata_eh_handle_dev_fail()
3493 if (err != -EAGAIN) in ata_eh_handle_dev_fail()
3494 ehc->tries[dev->devno]--; in ata_eh_handle_dev_fail()
3497 case -ENODEV: in ata_eh_handle_dev_fail()
3499 ehc->i.probe_mask |= (1 << dev->devno); in ata_eh_handle_dev_fail()
3501 case -EINVAL: in ata_eh_handle_dev_fail()
3503 ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1); in ata_eh_handle_dev_fail()
3505 case -EIO: in ata_eh_handle_dev_fail()
3506 if (ehc->tries[dev->devno] == 1) { in ata_eh_handle_dev_fail()
3511 if (dev->pio_mode > XFER_PIO_0) in ata_eh_handle_dev_fail()
3516 if (ata_dev_enabled(dev) && !ehc->tries[dev->devno]) { in ata_eh_handle_dev_fail()
3526 ehc->tries[dev->devno] = ATA_EH_DEV_TRIES; in ata_eh_handle_dev_fail()
3527 memset(ehc->cmd_timeout_idx[dev->devno], 0, in ata_eh_handle_dev_fail()
3528 sizeof(ehc->cmd_timeout_idx[dev->devno])); in ata_eh_handle_dev_fail()
3533 ehc->i.action |= ATA_EH_RESET; in ata_eh_handle_dev_fail()
3539 * ata_eh_recover - recover host port after error
3558 * 0 on success, -errno on failure.
3572 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_recover()
3574 /* re-enable link? */ in ata_eh_recover()
3575 if (ehc->i.action & ATA_EH_ENABLE_LINK) { in ata_eh_recover()
3577 spin_lock_irqsave(ap->lock, flags); in ata_eh_recover()
3578 link->flags &= ~ATA_LFLAG_DISABLED; in ata_eh_recover()
3579 spin_unlock_irqrestore(ap->lock, flags); in ata_eh_recover()
3584 if (link->flags & ATA_LFLAG_NO_RETRY) in ata_eh_recover()
3585 ehc->tries[dev->devno] = 1; in ata_eh_recover()
3587 ehc->tries[dev->devno] = ATA_EH_DEV_TRIES; in ata_eh_recover()
3590 ehc->i.action |= ehc->i.dev_action[dev->devno] & in ata_eh_recover()
3592 ehc->i.dev_action[dev->devno] &= ATA_EH_PERDEV_MASK; in ata_eh_recover()
3595 if (dev->flags & ATA_DFLAG_DETACH) in ata_eh_recover()
3608 if (ap->pflags & ATA_PFLAG_UNLOADING) in ata_eh_recover()
3613 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_recover()
3617 ehc->i.action = 0; in ata_eh_recover()
3620 ehc->classes[dev->devno] = ATA_DEV_UNKNOWN; in ata_eh_recover()
3625 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_recover()
3627 if (!(ehc->i.action & ATA_EH_RESET)) in ata_eh_recover()
3643 * ap->park_req_pending in ata_eh_recover()
3650 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_recover()
3653 if (dev->class != ATA_DEV_ATA && in ata_eh_recover()
3654 dev->class != ATA_DEV_ZAC) in ata_eh_recover()
3656 if (!(ehc->i.dev_action[dev->devno] & in ata_eh_recover()
3659 tmp = dev->unpark_deadline; in ata_eh_recover()
3664 if (ehc->unloaded_mask & (1 << dev->devno)) in ata_eh_recover()
3676 deadline = wait_for_completion_timeout(&ap->park_req_pending, in ata_eh_recover()
3677 deadline - now); in ata_eh_recover()
3682 if (!(link->eh_context.unloaded_mask & in ata_eh_recover()
3683 (1 << dev->devno))) in ata_eh_recover()
3694 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_recover()
3705 if (link->device->class == ATA_DEV_PMP) { in ata_eh_recover()
3706 ehc->i.action = 0; in ata_eh_recover()
3711 if (ehc->i.flags & ATA_EHI_SETMODE) { in ata_eh_recover()
3715 ehc->i.flags &= ~ATA_EHI_SETMODE; in ata_eh_recover()
3721 if (ehc->i.flags & ATA_EHI_DID_RESET) { in ata_eh_recover()
3723 if (dev->class != ATA_DEV_ATAPI) in ata_eh_recover()
3735 if (dev->class != ATA_DEV_ATA && in ata_eh_recover()
3736 dev->class != ATA_DEV_ZAC) in ata_eh_recover()
3745 if (link->lpm_policy != ap->target_lpm_policy) { in ata_eh_recover()
3746 rc = ata_eh_set_lpm(link, ap->target_lpm_policy, &dev); in ata_eh_recover()
3752 ehc->i.flags = 0; in ata_eh_recover()
3760 if (ap->pflags & ATA_PFLAG_FROZEN) { in ata_eh_recover()
3781 * ata_eh_finish - finish up EH
3797 if (!(qc->flags & ATA_QCFLAG_FAILED)) in ata_eh_finish()
3800 if (qc->err_mask) { in ata_eh_finish()
3805 if (qc->flags & ATA_QCFLAG_RETRY) in ata_eh_finish()
3810 if (qc->flags & ATA_QCFLAG_SENSE_VALID) { in ata_eh_finish()
3814 memset(&qc->result_tf, 0, sizeof(qc->result_tf)); in ata_eh_finish()
3821 WARN_ON(ap->nr_active_links); in ata_eh_finish()
3822 ap->nr_active_links = 0; in ata_eh_finish()
3826 * ata_do_eh - do standard error handling
3852 ata_for_each_dev(dev, &ap->link, ALL) in ata_do_eh()
3860 * ata_std_error_handler - standard error handler
3870 struct ata_port_operations *ops = ap->ops; in ata_std_error_handler()
3871 ata_reset_fn_t hardreset = ops->hardreset; in ata_std_error_handler()
3873 /* ignore built-in hardreset if SCR access is not available */ in ata_std_error_handler()
3874 if (hardreset == sata_std_hardreset && !sata_scr_valid(&ap->link)) in ata_std_error_handler()
3877 ata_do_eh(ap, ops->prereset, ops->softreset, hardreset, ops->postreset); in ata_std_error_handler()
3883 * ata_eh_handle_port_suspend - perform port suspend operation
3898 spin_lock_irqsave(ap->lock, flags); in ata_eh_handle_port_suspend()
3899 if (!(ap->pflags & ATA_PFLAG_PM_PENDING) || in ata_eh_handle_port_suspend()
3900 ap->pm_mesg.event & PM_EVENT_RESUME) { in ata_eh_handle_port_suspend()
3901 spin_unlock_irqrestore(ap->lock, flags); in ata_eh_handle_port_suspend()
3904 spin_unlock_irqrestore(ap->lock, flags); in ata_eh_handle_port_suspend()
3906 WARN_ON(ap->pflags & ATA_PFLAG_SUSPENDED); in ata_eh_handle_port_suspend()
3913 if (PMSG_IS_AUTO(ap->pm_mesg)) { in ata_eh_handle_port_suspend()
3914 ata_for_each_dev(dev, &ap->link, ENABLED) { in ata_eh_handle_port_suspend()
3923 if (ap->ops->port_suspend) in ata_eh_handle_port_suspend()
3924 rc = ap->ops->port_suspend(ap, ap->pm_mesg); in ata_eh_handle_port_suspend()
3926 ata_acpi_set_state(ap, ap->pm_mesg); in ata_eh_handle_port_suspend()
3929 spin_lock_irqsave(ap->lock, flags); in ata_eh_handle_port_suspend()
3931 ap->pflags &= ~ATA_PFLAG_PM_PENDING; in ata_eh_handle_port_suspend()
3933 ap->pflags |= ATA_PFLAG_SUSPENDED; in ata_eh_handle_port_suspend()
3934 else if (ap->pflags & ATA_PFLAG_FROZEN) in ata_eh_handle_port_suspend()
3937 spin_unlock_irqrestore(ap->lock, flags); in ata_eh_handle_port_suspend()
3943 * ata_eh_handle_port_resume - perform port resume operation
3958 spin_lock_irqsave(ap->lock, flags); in ata_eh_handle_port_resume()
3959 if (!(ap->pflags & ATA_PFLAG_PM_PENDING) || in ata_eh_handle_port_resume()
3960 !(ap->pm_mesg.event & PM_EVENT_RESUME)) { in ata_eh_handle_port_resume()
3961 spin_unlock_irqrestore(ap->lock, flags); in ata_eh_handle_port_resume()
3964 spin_unlock_irqrestore(ap->lock, flags); in ata_eh_handle_port_resume()
3966 WARN_ON(!(ap->pflags & ATA_PFLAG_SUSPENDED)); in ata_eh_handle_port_resume()
3977 ata_ering_clear(&dev->ering); in ata_eh_handle_port_resume()
3979 ata_acpi_set_state(ap, ap->pm_mesg); in ata_eh_handle_port_resume()
3981 if (ap->ops->port_resume) in ata_eh_handle_port_resume()
3982 ap->ops->port_resume(ap); in ata_eh_handle_port_resume()
3988 spin_lock_irqsave(ap->lock, flags); in ata_eh_handle_port_resume()
3989 ap->pflags &= ~(ATA_PFLAG_PM_PENDING | ATA_PFLAG_SUSPENDED); in ata_eh_handle_port_resume()
3990 spin_unlock_irqrestore(ap->lock, flags); in ata_eh_handle_port_resume()