Lines Matching +full:tf +full:- +full:a

1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Copyright 2003-2004 Red Hat, Inc. All rights reserved.
6 * Copyright 2003-2004 Jeff Garzik
19 #include "libata-transport.h"
30 * sata_scr_valid - test whether SCRs are accessible
43 struct ata_port *ap = link->ap; in sata_scr_valid()
45 return (ap->flags & ATA_FLAG_SATA) && ap->ops->scr_read; in sata_scr_valid()
50 * sata_scr_read - read SCR register of the specified port
56 * guaranteed to succeed if @link is ap->link, the cable type of
57 * the port is SATA and the port implements ->scr_read.
60 * None if @link is ap->link. Kernel thread context otherwise.
69 return link->ap->ops->scr_read(link, reg, val); in sata_scr_read()
70 return -EOPNOTSUPP; in sata_scr_read()
78 * sata_scr_write - write SCR register of the specified port
84 * guaranteed to succeed if @link is ap->link, the cable type of
85 * the port is SATA and the port implements ->scr_read.
88 * None if @link is ap->link. Kernel thread context otherwise.
97 return link->ap->ops->scr_write(link, reg, val); in sata_scr_write()
98 return -EOPNOTSUPP; in sata_scr_write()
106 * sata_scr_write_flush - write SCR register of the specified port and flush
115 * None if @link is ap->link. Kernel thread context otherwise.
126 rc = link->ap->ops->scr_write(link, reg, val); in sata_scr_write_flush()
128 rc = link->ap->ops->scr_read(link, reg, &val); in sata_scr_write_flush()
131 return -EOPNOTSUPP; in sata_scr_write_flush()
139 * ata_tf_to_fis - Convert ATA taskfile to SATA FIS structure
140 * @tf: Taskfile to convert
145 * Converts a standard ATA taskfile to a Serial ATA
146 * FIS structure (Register - Host to Device).
151 void ata_tf_to_fis(const struct ata_taskfile *tf, u8 pmp, int is_cmd, u8 *fis) in ata_tf_to_fis() argument
153 fis[0] = 0x27; /* Register - Host to Device FIS */ in ata_tf_to_fis()
158 fis[2] = tf->command; in ata_tf_to_fis()
159 fis[3] = tf->feature; in ata_tf_to_fis()
161 fis[4] = tf->lbal; in ata_tf_to_fis()
162 fis[5] = tf->lbam; in ata_tf_to_fis()
163 fis[6] = tf->lbah; in ata_tf_to_fis()
164 fis[7] = tf->device; in ata_tf_to_fis()
166 fis[8] = tf->hob_lbal; in ata_tf_to_fis()
167 fis[9] = tf->hob_lbam; in ata_tf_to_fis()
168 fis[10] = tf->hob_lbah; in ata_tf_to_fis()
169 fis[11] = tf->hob_feature; in ata_tf_to_fis()
171 fis[12] = tf->nsect; in ata_tf_to_fis()
172 fis[13] = tf->hob_nsect; in ata_tf_to_fis()
174 fis[15] = tf->ctl; in ata_tf_to_fis()
176 fis[16] = tf->auxiliary & 0xff; in ata_tf_to_fis()
177 fis[17] = (tf->auxiliary >> 8) & 0xff; in ata_tf_to_fis()
178 fis[18] = (tf->auxiliary >> 16) & 0xff; in ata_tf_to_fis()
179 fis[19] = (tf->auxiliary >> 24) & 0xff; in ata_tf_to_fis()
184 * ata_tf_from_fis - Convert SATA FIS to ATA taskfile
186 * @tf: Taskfile to output
188 * Converts a serial ATA FIS structure to a standard ATA taskfile.
194 void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf) in ata_tf_from_fis() argument
196 tf->status = fis[2]; in ata_tf_from_fis()
197 tf->error = fis[3]; in ata_tf_from_fis()
199 tf->lbal = fis[4]; in ata_tf_from_fis()
200 tf->lbam = fis[5]; in ata_tf_from_fis()
201 tf->lbah = fis[6]; in ata_tf_from_fis()
202 tf->device = fis[7]; in ata_tf_from_fis()
204 tf->hob_lbal = fis[8]; in ata_tf_from_fis()
205 tf->hob_lbam = fis[9]; in ata_tf_from_fis()
206 tf->hob_lbah = fis[10]; in ata_tf_from_fis()
208 tf->nsect = fis[12]; in ata_tf_from_fis()
209 tf->hob_nsect = fis[13]; in ata_tf_from_fis()
214 * sata_link_debounce - debounce SATA phy status
233 * 0 on success, -errno on failure.
256 ata_msleep(link->ap, interval); in sata_link_debounce()
276 * -EPIPE to tell upper layer to lower link speed. in sata_link_debounce()
279 return -EPIPE; in sata_link_debounce()
285 * sata_link_resume - resume SATA link
296 * 0 on success, -errno on failure.
322 if (!(link->flags & ATA_LFLAG_NO_DEBOUNCE_DELAY)) in sata_link_resume()
323 ata_msleep(link->ap, 200); in sata_link_resume()
328 } while ((scontrol & 0xf0f) != 0x300 && --tries); in sata_link_resume()
338 ATA_LINK_RESUME_TRIES - tries); in sata_link_resume()
347 return rc != -EINVAL ? rc : 0; in sata_link_resume()
352 * sata_link_scr_lpm - manipulate SControl IPM and SPM fields
367 * 0 on success, -errno otherwise.
372 struct ata_eh_context *ehc = &link->eh_context; in sata_link_scr_lpm()
407 if (link->ap->host->flags & ATA_HOST_NO_PART) in sata_link_scr_lpm()
410 if (link->ap->host->flags & ATA_HOST_NO_SSC) in sata_link_scr_lpm()
413 if (link->ap->host->flags & ATA_HOST_NO_DEVSLP) in sata_link_scr_lpm()
434 ehc->i.serror &= ~SERR_PHYRDY_CHG; in sata_link_scr_lpm()
441 struct ata_link *host_link = &link->ap->link; in __sata_set_spd_needed()
444 limit = link->sata_spd_limit; in __sata_set_spd_needed()
450 if (!ata_is_host_link(link) && host_link->sata_spd) in __sata_set_spd_needed()
451 limit &= (1 << host_link->sata_spd) - 1; in __sata_set_spd_needed()
465 * sata_set_spd_needed - is SATA spd configuration needed
469 * @link->sata_spd_limit. This function is used to determine
490 * sata_set_spd - set SATA spd according to spd limit
521 * sata_down_spd_limit - adjust SATA spd limit downward
529 * If @spd_limit is non-zero, the speed is limited to equal to or
546 return -EOPNOTSUPP; in sata_down_spd_limit()
549 * If not, use cached value in link->sata_spd. in sata_down_spd_limit()
555 spd = link->sata_spd; in sata_down_spd_limit()
557 mask = link->sata_spd_limit; in sata_down_spd_limit()
559 return -EINVAL; in sata_down_spd_limit()
562 bit = fls(mask) - 1; in sata_down_spd_limit()
570 * Otherwise, we should not force 1.5Gbps on a link where we have in sata_down_spd_limit()
575 mask &= (1 << (spd - 1)) - 1; in sata_down_spd_limit()
576 else if (link->sata_spd) in sata_down_spd_limit()
577 return -EINVAL; in sata_down_spd_limit()
581 return -EINVAL; in sata_down_spd_limit()
584 if (mask & ((1 << spd_limit) - 1)) in sata_down_spd_limit()
585 mask &= (1 << spd_limit) - 1; in sata_down_spd_limit()
587 bit = ffs(mask) - 1; in sata_down_spd_limit()
592 link->sata_spd_limit = mask; in sata_down_spd_limit()
601 * sata_link_hardreset - reset link via SATA phy reset
608 * SATA phy-reset @link using DET bits of SControl register.
622 * 0 on success, -errno otherwise.
660 /* Couldn't find anything in SATA I/II specs, but AHCI-1.1 in sata_link_hardreset()
663 ata_msleep(link->ap, 1); in sata_link_hardreset()
673 /* Link is online. From this point, -ENODEV too is an error. */ in sata_link_hardreset()
677 if (sata_pmp_supported(link->ap) && ata_is_host_link(link)) { in sata_link_hardreset()
678 /* If PMP is supported, we have to do follow-up SRST. in sata_link_hardreset()
692 rc = -EAGAIN; in sata_link_hardreset()
700 if (rc && rc != -EAGAIN) { in sata_link_hardreset()
710 * sata_std_hardreset - COMRESET w/o waiting or classification
721 * 0 if link offline, -EAGAIN if link online, -errno on errors.
726 const unsigned int *timing = sata_ehc_deb_timing(&link->eh_context); in sata_std_hardreset()
732 return -EAGAIN; in sata_std_hardreset()
738 * ata_qc_complete_multiple - Complete multiple qcs successfully
742 * Complete in-flight commands. This functions is meant to be
743 * called from low-level driver's interrupt routine to complete
744 * requests normally. ap->qc_active and @qc_active is compared
755 * Number of completed commands on success, -errno otherwise.
759 u64 done_mask, ap_qc_active = ap->qc_active; in ata_qc_complete_multiple()
763 * If the internal tag is set on ap->qc_active, then we care about in ata_qc_complete_multiple()
775 ata_port_err(ap, "illegal qc_active transition (%08llx->%08llx)\n", in ata_qc_complete_multiple()
776 ap->qc_active, qc_active); in ata_qc_complete_multiple()
777 return -EINVAL; in ata_qc_complete_multiple()
780 if (ap->ops->qc_ncq_fill_rtf) in ata_qc_complete_multiple()
781 ap->ops->qc_ncq_fill_rtf(ap, done_mask); in ata_qc_complete_multiple()
800 * ata_slave_link_init - initialize slave link
806 * In libata, a port contains links and a link contains devices.
807 * There is single host link but if a PMP is attached to it,
808 * there can be multiple fan-out links. On SATA, there's usually
809 * a single device connected to a link but PATA and SATA
810 * controllers emulating TF based interface can have two - master
813 * However, there are a few controllers which don't fit into this
814 * abstraction too well - SATA controllers which emulate TF
818 * (e.g. onlineness, link speed) but should be treated like a
826 * handling, separate @ap->slave_link is used. All dirty details
832 * prereset(M) -> prereset(S) -> hardreset(M) -> hardreset(S) ->
833 * softreset(M) -> postreset(M) -> postreset(S)
843 * 0 on success, -errno on failure.
849 WARN_ON(ap->slave_link); in ata_slave_link_init()
850 WARN_ON(ap->flags & ATA_FLAG_PMP); in ata_slave_link_init()
854 return -ENOMEM; in ata_slave_link_init()
857 ap->slave_link = link; in ata_slave_link_init()
863 * sata_lpm_ignore_phy_events - test if PHY event should be ignored
876 unsigned long lpm_timeout = link->last_lpm_change + in sata_lpm_ignore_phy_events()
880 if (link->lpm_policy > ATA_LPM_MAX_POWER) in sata_lpm_ignore_phy_events()
886 if ((link->flags & ATA_LFLAG_CHANGED) && in sata_lpm_ignore_phy_events()
923 return -EINVAL; in ata_scsi_lpm_store()
925 spin_lock_irqsave(ap->lock, flags); in ata_scsi_lpm_store()
928 ata_for_each_dev(dev, &ap->link, ENABLED) { in ata_scsi_lpm_store()
929 if (dev->quirks & ATA_QUIRK_NOLPM) { in ata_scsi_lpm_store()
930 count = -EOPNOTSUPP; in ata_scsi_lpm_store()
936 ap->target_lpm_policy = policy; in ata_scsi_lpm_store()
939 spin_unlock_irqrestore(ap->lock, flags); in ata_scsi_lpm_store()
949 if (ap->target_lpm_policy >= ARRAY_SIZE(ata_lpm_policy_names)) in ata_scsi_lpm_show()
950 return -EINVAL; in ata_scsi_lpm_show()
953 ata_lpm_policy_names[ap->target_lpm_policy]); in ata_scsi_lpm_show()
960 * ata_ncq_prio_supported - Check if device supports NCQ Priority
963 * @supported: Address of a boolean to store the result
967 * Context: Any context. Takes and releases @ap->lock.
970 * * %0 - OK. Status is stored into @supported
971 * * %-ENODEV - Failed to find the ATA device
980 spin_lock_irqsave(ap->lock, flags); in ata_ncq_prio_supported()
983 rc = -ENODEV; in ata_ncq_prio_supported()
985 *supported = dev->flags & ATA_DFLAG_NCQ_PRIO; in ata_ncq_prio_supported()
986 spin_unlock_irqrestore(ap->lock, flags); in ata_ncq_prio_supported()
997 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_ncq_prio_supported_show()
1012 * ata_ncq_prio_enabled - Check if NCQ Priority is enabled
1015 * @enabled: Address of a boolean to store the result
1019 * Context: Any context. Takes and releases @ap->lock.
1022 * * %0 - OK. Status is stored into @enabled
1023 * * %-ENODEV - Failed to find the ATA device
1032 spin_lock_irqsave(ap->lock, flags); in ata_ncq_prio_enabled()
1035 rc = -ENODEV; in ata_ncq_prio_enabled()
1037 *enabled = dev->flags & ATA_DFLAG_NCQ_PRIO_ENABLED; in ata_ncq_prio_enabled()
1038 spin_unlock_irqrestore(ap->lock, flags); in ata_ncq_prio_enabled()
1049 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_ncq_prio_enable_show()
1061 * ata_ncq_prio_enable - Enable/disable NCQ Priority
1064 * @enable: true - enable NCQ Priority, false - disable NCQ Priority
1068 * Context: Any context. Takes and releases @ap->lock.
1071 * * %0 - OK. Status is stored into @enabled
1072 * * %-ENODEV - Failed to find the ATA device
1073 * * %-EINVAL - NCQ Priority is not supported or CDL is enabled
1082 spin_lock_irqsave(ap->lock, flags); in ata_ncq_prio_enable()
1086 rc = -ENODEV; in ata_ncq_prio_enable()
1090 if (!(dev->flags & ATA_DFLAG_NCQ_PRIO)) { in ata_ncq_prio_enable()
1091 rc = -EINVAL; in ata_ncq_prio_enable()
1096 if (dev->flags & ATA_DFLAG_CDL_ENABLED) { in ata_ncq_prio_enable()
1099 rc = -EINVAL; in ata_ncq_prio_enable()
1102 dev->flags |= ATA_DFLAG_NCQ_PRIO_ENABLED; in ata_ncq_prio_enable()
1104 dev->flags &= ~ATA_DFLAG_NCQ_PRIO_ENABLED; in ata_ncq_prio_enable()
1108 spin_unlock_irqrestore(ap->lock, flags); in ata_ncq_prio_enable()
1119 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_ncq_prio_enable_store()
1161 if (ap->ops->em_store && (ap->flags & ATA_FLAG_EM)) in ata_scsi_em_message_store()
1162 return ap->ops->em_store(ap, buf, count); in ata_scsi_em_message_store()
1163 return -EINVAL; in ata_scsi_em_message_store()
1173 if (ap->ops->em_show && (ap->flags & ATA_FLAG_EM)) in ata_scsi_em_message_show()
1174 return ap->ops->em_show(ap, buf); in ata_scsi_em_message_show()
1175 return -EINVAL; in ata_scsi_em_message_show()
1188 return sysfs_emit(buf, "%d\n", ap->em_message_type); in ata_scsi_em_message_type_show()
1199 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_scsi_activity_show()
1202 if (atadev && ap->ops->sw_activity_show && in ata_scsi_activity_show()
1203 (ap->flags & ATA_FLAG_SW_ACTIVITY)) in ata_scsi_activity_show()
1204 return ap->ops->sw_activity_show(atadev, buf); in ata_scsi_activity_show()
1205 return -EINVAL; in ata_scsi_activity_show()
1213 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_scsi_activity_store()
1218 if (atadev && ap->ops->sw_activity_store && in ata_scsi_activity_store()
1219 (ap->flags & ATA_FLAG_SW_ACTIVITY)) { in ata_scsi_activity_store()
1223 rc = ap->ops->sw_activity_store(atadev, val); in ata_scsi_activity_store()
1230 return -EINVAL; in ata_scsi_activity_store()
1237 * ata_change_queue_depth - Set a device maximum queue depth
1242 * Helper to set a device maximum queue depth, usable with both libsas
1253 spin_lock_irqsave(ap->lock, flags); in ata_change_queue_depth()
1256 if (!dev || queue_depth < 1 || queue_depth == sdev->queue_depth) { in ata_change_queue_depth()
1257 spin_unlock_irqrestore(ap->lock, flags); in ata_change_queue_depth()
1258 return sdev->queue_depth; in ata_change_queue_depth()
1265 max_queue_depth = min(ATA_MAX_QUEUE, sdev->host->can_queue); in ata_change_queue_depth()
1266 max_queue_depth = min(max_queue_depth, ata_id_queue_depth(dev->id)); in ata_change_queue_depth()
1268 spin_unlock_irqrestore(ap->lock, flags); in ata_change_queue_depth()
1269 return -EINVAL; in ata_change_queue_depth()
1277 dev->flags |= ATA_DFLAG_NCQ_OFF; in ata_change_queue_depth()
1280 dev->flags &= ~ATA_DFLAG_NCQ_OFF; in ata_change_queue_depth()
1283 spin_unlock_irqrestore(ap->lock, flags); in ata_change_queue_depth()
1285 if (queue_depth == sdev->queue_depth) in ata_change_queue_depth()
1286 return sdev->queue_depth; in ata_change_queue_depth()
1293 * ata_scsi_change_queue_depth - SCSI callback for queue depth config
1297 * This is libata standard hostt->change_queue_depth callback.
1309 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_scsi_change_queue_depth()
1316 * ata_sas_device_configure - Default device_configure routine for libata
1331 return ata_scsi_dev_config(sdev, lim, ap->link.device); in ata_sas_device_configure()
1336 * ata_sas_queuecmd - Issue SCSI cdb to libata-managed device
1349 if (likely(ata_dev_enabled(ap->link.device))) in ata_sas_queuecmd()
1350 rc = __ata_scsi_queuecmd(cmd, ap->link.device); in ata_sas_queuecmd()
1352 cmd->result = (DID_BAD_TARGET << 16); in ata_sas_queuecmd()
1360 * sata_async_notification - SATA async notification handler
1377 if (!(ap->flags & ATA_FLAG_AN)) in sata_async_notification()
1380 rc = sata_scr_read(&ap->link, SCR_NOTIFICATION, &sntf); in sata_async_notification()
1382 sata_scr_write(&ap->link, SCR_NOTIFICATION, sntf); in sata_async_notification()
1391 struct ata_device *dev = ap->link.device; in sata_async_notification()
1393 if ((dev->class == ATA_DEV_ATAPI) && in sata_async_notification()
1394 (dev->flags & ATA_DFLAG_AN)) in sata_async_notification()
1412 if (!(sntf & (1 << link->pmp))) in sata_async_notification()
1415 if ((link->device->class == ATA_DEV_ATAPI) && in sata_async_notification()
1416 (link->device->flags & ATA_DFLAG_AN)) in sata_async_notification()
1417 ata_scsi_media_change_notify(link->device); in sata_async_notification()
1434 * ata_eh_read_log_10h - Read log page 10h for NCQ error details
1437 * @tf: Resulting taskfile registers of the failed command
1446 * 0 on success, -errno otherwise.
1449 int *tag, struct ata_taskfile *tf) in ata_eh_read_log_10h() argument
1451 u8 *buf = dev->sector_buf; in ata_eh_read_log_10h()
1458 return -EIO; in ata_eh_read_log_10h()
1468 return -ENOENT; in ata_eh_read_log_10h()
1472 tf->status = buf[2]; in ata_eh_read_log_10h()
1473 tf->error = buf[3]; in ata_eh_read_log_10h()
1474 tf->lbal = buf[4]; in ata_eh_read_log_10h()
1475 tf->lbam = buf[5]; in ata_eh_read_log_10h()
1476 tf->lbah = buf[6]; in ata_eh_read_log_10h()
1477 tf->device = buf[7]; in ata_eh_read_log_10h()
1478 tf->hob_lbal = buf[8]; in ata_eh_read_log_10h()
1479 tf->hob_lbam = buf[9]; in ata_eh_read_log_10h()
1480 tf->hob_lbah = buf[10]; in ata_eh_read_log_10h()
1481 tf->nsect = buf[12]; in ata_eh_read_log_10h()
1482 tf->hob_nsect = buf[13]; in ata_eh_read_log_10h()
1483 if (ata_id_has_ncq_autosense(dev->id) && (tf->status & ATA_SENSE)) in ata_eh_read_log_10h()
1484 tf->auxiliary = buf[14] << 16 | buf[15] << 8 | buf[16]; in ata_eh_read_log_10h()
1490 * ata_eh_get_ncq_success_sense - Read and process the sense data for
1502 * 0 on success, -errno otherwise.
1506 struct ata_device *dev = link->device; in ata_eh_get_ncq_success_sense()
1507 struct ata_port *ap = dev->link->ap; in ata_eh_get_ncq_success_sense()
1508 u8 *buf = dev->cdl->ncq_sense_log_buf; in ata_eh_get_ncq_success_sense()
1519 return -EIO; in ata_eh_get_ncq_success_sense()
1527 return -EIO; in ata_eh_get_ncq_success_sense()
1534 if (!(qc->flags & ATA_QCFLAG_EH) || in ata_eh_get_ncq_success_sense()
1535 !(qc->flags & ATA_QCFLAG_EH_SUCCESS_CMD) || in ata_eh_get_ncq_success_sense()
1536 qc->err_mask || in ata_eh_get_ncq_success_sense()
1537 ata_dev_phys_link(qc->dev) != link) in ata_eh_get_ncq_success_sense()
1545 qc->result_tf.status &= ~ATA_SENSE; in ata_eh_get_ncq_success_sense()
1555 ret = -EIO; in ata_eh_get_ncq_success_sense()
1559 /* Set sense without also setting scsicmd->result */ in ata_eh_get_ncq_success_sense()
1560 scsi_build_sense_buffer(dev->flags & ATA_DFLAG_D_SENSE, in ata_eh_get_ncq_success_sense()
1561 qc->scsicmd->sense_buffer, sk, in ata_eh_get_ncq_success_sense()
1563 qc->flags |= ATA_QCFLAG_SENSE_VALID; in ata_eh_get_ncq_success_sense()
1576 * ata_eh_analyze_ncq_error - analyze NCQ error
1580 * error status TF. For NCQ device errors, all LLDDs have to do
1581 * is setting AC_ERR_DEV in ehi->err_mask. This function takes
1589 struct ata_port *ap = link->ap; in ata_eh_analyze_ncq_error()
1590 struct ata_eh_context *ehc = &link->eh_context; in ata_eh_analyze_ncq_error()
1591 struct ata_device *dev = link->device; in ata_eh_analyze_ncq_error()
1593 struct ata_taskfile tf; in ata_eh_analyze_ncq_error() local
1601 if (!link->sactive || !(ehc->i.err_mask & AC_ERR_DEV)) in ata_eh_analyze_ncq_error()
1606 if (!(qc->flags & ATA_QCFLAG_EH)) in ata_eh_analyze_ncq_error()
1609 if (qc->err_mask) in ata_eh_analyze_ncq_error()
1614 memset(&tf, 0, sizeof(tf)); in ata_eh_analyze_ncq_error()
1615 rc = ata_eh_read_log_10h(dev, &tag, &tf); in ata_eh_analyze_ncq_error()
1622 if (!(link->sactive & (1 << tag))) { in ata_eh_analyze_ncq_error()
1630 memcpy(&qc->result_tf, &tf, sizeof(tf)); in ata_eh_analyze_ncq_error()
1631 qc->result_tf.flags = ATA_TFLAG_ISADDR | ATA_TFLAG_LBA | ATA_TFLAG_LBA48; in ata_eh_analyze_ncq_error()
1632 qc->err_mask |= AC_ERR_DEV | AC_ERR_NCQ; in ata_eh_analyze_ncq_error()
1636 * stored the sense data in qc->result_tf.auxiliary. in ata_eh_analyze_ncq_error()
1638 if (qc->result_tf.auxiliary) { in ata_eh_analyze_ncq_error()
1641 sense_key = (qc->result_tf.auxiliary >> 16) & 0xff; in ata_eh_analyze_ncq_error()
1642 asc = (qc->result_tf.auxiliary >> 8) & 0xff; in ata_eh_analyze_ncq_error()
1643 ascq = qc->result_tf.auxiliary & 0xff; in ata_eh_analyze_ncq_error()
1645 ata_scsi_set_sense(dev, qc->scsicmd, sense_key, asc, in ata_eh_analyze_ncq_error()
1647 ata_scsi_set_sense_information(dev, qc->scsicmd, in ata_eh_analyze_ncq_error()
1648 &qc->result_tf); in ata_eh_analyze_ncq_error()
1649 qc->flags |= ATA_QCFLAG_SENSE_VALID; in ata_eh_analyze_ncq_error()
1654 if (!(qc->flags & ATA_QCFLAG_EH) || in ata_eh_analyze_ncq_error()
1655 qc->flags & ATA_QCFLAG_EH_SUCCESS_CMD || in ata_eh_analyze_ncq_error()
1656 ata_dev_phys_link(qc->dev) != link) in ata_eh_analyze_ncq_error()
1660 if (qc->err_mask) in ata_eh_analyze_ncq_error()
1669 qc->result_tf.status &= ~ATA_ERR; in ata_eh_analyze_ncq_error()
1670 qc->result_tf.error = 0; in ata_eh_analyze_ncq_error()
1673 * If we get a NCQ error, that means that a single command was in ata_eh_analyze_ncq_error()
1678 qc->flags |= ATA_QCFLAG_RETRY; in ata_eh_analyze_ncq_error()
1681 ehc->i.err_mask &= ~AC_ERR_DEV; in ata_eh_analyze_ncq_error()