Lines Matching full:ap
43 struct ata_port *ap = link->ap; in sata_scr_valid() local
45 return (ap->flags & ATA_FLAG_SATA) && ap->ops->scr_read; in sata_scr_valid()
56 * guaranteed to succeed if @link is ap->link, the cable type of
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()
84 * guaranteed to succeed if @link is ap->link, the cable type of
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()
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()
256 ata_msleep(link->ap, interval); in sata_link_debounce()
323 ata_msleep(link->ap, 200); in sata_link_resume()
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()
441 struct ata_link *host_link = &link->ap->link; in __sata_set_spd_needed()
663 ata_msleep(link->ap, 1); in sata_link_hardreset()
677 if (sata_pmp_supported(link->ap) && ata_is_host_link(link)) { in sata_link_hardreset()
739 * @ap: port in question
744 * requests normally. ap->qc_active and @qc_active is compared
757 int ata_qc_complete_multiple(struct ata_port *ap, u64 qc_active) in ata_qc_complete_multiple() argument
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()
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()
787 qc = ata_qc_from_tag(ap, tag); in ata_qc_complete_multiple()
801 * @ap: port to initialize slave link for
803 * Create and initialize slave link for @ap. This enables slave
826 * handling, separate @ap->slave_link is used. All dirty details
845 int ata_slave_link_init(struct ata_port *ap) in ata_slave_link_init() argument
849 WARN_ON(ap->slave_link); in ata_slave_link_init()
850 WARN_ON(ap->flags & ATA_FLAG_PMP); in ata_slave_link_init()
856 ata_link_init(ap, link, 1); in ata_slave_link_init()
857 ap->slave_link = link; in ata_slave_link_init()
907 static bool ata_scsi_lpm_supported(struct ata_port *ap) in ata_scsi_lpm_supported() argument
912 if ((ap->flags & ATA_FLAG_NO_LPM) || !ap->ops->set_lpm) in ata_scsi_lpm_supported()
915 ata_for_each_link(link, ap, EDGE) { in ata_scsi_lpm_supported()
929 struct ata_port *ap = ata_shost_to_port(shost); in ata_scsi_lpm_supported_show() local
933 spin_lock_irqsave(ap->lock, flags); in ata_scsi_lpm_supported_show()
934 supported = ata_scsi_lpm_supported(ap); in ata_scsi_lpm_supported_show()
935 spin_unlock_irqrestore(ap->lock, flags); in ata_scsi_lpm_supported_show()
948 struct ata_port *ap = ata_shost_to_port(shost); in ata_scsi_lpm_store() local
963 spin_lock_irqsave(ap->lock, flags); in ata_scsi_lpm_store()
965 if (!ata_scsi_lpm_supported(ap)) { in ata_scsi_lpm_store()
970 ap->target_lpm_policy = policy; in ata_scsi_lpm_store()
971 ata_port_schedule_eh(ap); in ata_scsi_lpm_store()
973 spin_unlock_irqrestore(ap->lock, flags); in ata_scsi_lpm_store()
981 struct ata_port *ap = ata_shost_to_port(shost); in ata_scsi_lpm_show() local
983 if (ap->target_lpm_policy >= ARRAY_SIZE(ata_lpm_policy_names)) in ata_scsi_lpm_show()
987 ata_lpm_policy_names[ap->target_lpm_policy]); in ata_scsi_lpm_show()
995 * @ap: ATA port of the target device
1001 * Context: Any context. Takes and releases @ap->lock.
1007 int ata_ncq_prio_supported(struct ata_port *ap, struct scsi_device *sdev, in ata_ncq_prio_supported() argument
1014 spin_lock_irqsave(ap->lock, flags); in ata_ncq_prio_supported()
1015 dev = ata_scsi_find_dev(ap, sdev); in ata_ncq_prio_supported()
1020 spin_unlock_irqrestore(ap->lock, flags); in ata_ncq_prio_supported()
1031 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_ncq_prio_supported_show() local
1035 rc = ata_ncq_prio_supported(ap, sdev, &supported); in ata_ncq_prio_supported_show()
1047 * @ap: ATA port of the target device
1053 * Context: Any context. Takes and releases @ap->lock.
1059 int ata_ncq_prio_enabled(struct ata_port *ap, struct scsi_device *sdev, in ata_ncq_prio_enabled() argument
1066 spin_lock_irqsave(ap->lock, flags); in ata_ncq_prio_enabled()
1067 dev = ata_scsi_find_dev(ap, sdev); in ata_ncq_prio_enabled()
1072 spin_unlock_irqrestore(ap->lock, flags); in ata_ncq_prio_enabled()
1083 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_ncq_prio_enable_show() local
1087 rc = ata_ncq_prio_enabled(ap, sdev, &enabled); in ata_ncq_prio_enable_show()
1096 * @ap: ATA port of the target device
1102 * Context: Any context. Takes and releases @ap->lock.
1109 int ata_ncq_prio_enable(struct ata_port *ap, struct scsi_device *sdev, in ata_ncq_prio_enable() argument
1116 spin_lock_irqsave(ap->lock, flags); in ata_ncq_prio_enable()
1118 dev = ata_scsi_find_dev(ap, sdev); in ata_ncq_prio_enable()
1142 spin_unlock_irqrestore(ap->lock, flags); in ata_ncq_prio_enable()
1153 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_ncq_prio_enable_store() local
1161 rc = ata_ncq_prio_enable(ap, sdev, enable); in ata_ncq_prio_enable_store()
1194 struct ata_port *ap = ata_shost_to_port(shost); in ata_scsi_em_message_store() local
1195 if (ap->ops->em_store && (ap->flags & ATA_FLAG_EM)) in ata_scsi_em_message_store()
1196 return ap->ops->em_store(ap, buf, count); in ata_scsi_em_message_store()
1205 struct ata_port *ap = ata_shost_to_port(shost); in ata_scsi_em_message_show() local
1207 if (ap->ops->em_show && (ap->flags & ATA_FLAG_EM)) in ata_scsi_em_message_show()
1208 return ap->ops->em_show(ap, buf); in ata_scsi_em_message_show()
1220 struct ata_port *ap = ata_shost_to_port(shost); in ata_scsi_em_message_type_show() local
1222 return sysfs_emit(buf, "%d\n", ap->em_message_type); in ata_scsi_em_message_type_show()
1233 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_scsi_activity_show() local
1234 struct ata_device *atadev = ata_scsi_find_dev(ap, sdev); in ata_scsi_activity_show()
1236 if (atadev && ap->ops->sw_activity_show && in ata_scsi_activity_show()
1237 (ap->flags & ATA_FLAG_SW_ACTIVITY)) in ata_scsi_activity_show()
1238 return ap->ops->sw_activity_show(atadev, buf); in ata_scsi_activity_show()
1247 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_scsi_activity_store() local
1248 struct ata_device *atadev = ata_scsi_find_dev(ap, sdev); in ata_scsi_activity_store()
1252 if (atadev && ap->ops->sw_activity_store && in ata_scsi_activity_store()
1253 (ap->flags & ATA_FLAG_SW_ACTIVITY)) { in ata_scsi_activity_store()
1257 rc = ap->ops->sw_activity_store(atadev, val); in ata_scsi_activity_store()
1272 * @ap: ATA port of the target device
1280 int ata_change_queue_depth(struct ata_port *ap, struct scsi_device *sdev, in ata_change_queue_depth() argument
1287 spin_lock_irqsave(ap->lock, flags); in ata_change_queue_depth()
1289 dev = ata_scsi_find_dev(ap, sdev); in ata_change_queue_depth()
1291 spin_unlock_irqrestore(ap->lock, flags); in ata_change_queue_depth()
1302 spin_unlock_irqrestore(ap->lock, flags); in ata_change_queue_depth()
1317 spin_unlock_irqrestore(ap->lock, flags); in ata_change_queue_depth()
1343 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_scsi_change_queue_depth() local
1345 return ata_change_queue_depth(ap, sdev, queue_depth); in ata_scsi_change_queue_depth()
1354 * @ap: ATA port to which SCSI device is attached
1361 struct ata_port *ap) in ata_sas_sdev_configure() argument
1365 return ata_scsi_dev_config(sdev, lim, ap->link.device); in ata_sas_sdev_configure()
1372 * @ap: ATA port to which the command is being sent
1379 int ata_sas_queuecmd(struct scsi_cmnd *cmd, struct ata_port *ap) in ata_sas_queuecmd() argument
1380 __must_hold(ap->lock) in ata_sas_queuecmd()
1382 if (likely(ata_dev_enabled(ap->link.device))) in ata_sas_queuecmd()
1383 return __ata_scsi_queuecmd(cmd, ap->link.device, ap); in ata_sas_queuecmd()
1394 * @ap: ATA port where async notification is received
1405 int sata_async_notification(struct ata_port *ap) in sata_async_notification() argument
1410 if (!(ap->flags & ATA_FLAG_AN)) in sata_async_notification()
1413 rc = sata_scr_read(&ap->link, SCR_NOTIFICATION, &sntf); in sata_async_notification()
1415 sata_scr_write(&ap->link, SCR_NOTIFICATION, sntf); in sata_async_notification()
1417 if (!sata_pmp_attached(ap) || rc) { in sata_async_notification()
1419 if (!sata_pmp_attached(ap)) { in sata_async_notification()
1424 struct ata_device *dev = ap->link.device; in sata_async_notification()
1436 ata_port_schedule_eh(ap); in sata_async_notification()
1444 ata_for_each_link(link, ap, EDGE) { in sata_async_notification()
1457 ata_port_schedule_eh(ap); in sata_async_notification()
1540 struct ata_port *ap = dev->link->ap; in ata_eh_get_ncq_success_sense() local
1570 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_get_ncq_success_sense()
1637 struct ata_port *ap = link->ap; in ata_eh_analyze_ncq_error() local
1645 if (ata_port_is_frozen(ap)) in ata_eh_analyze_ncq_error()
1653 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_analyze_ncq_error()
1677 qc = __ata_qc_from_tag(ap, tag); in ata_eh_analyze_ncq_error()
1699 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_analyze_ncq_error()