Lines Matching refs: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()
69 return link->ap->ops->scr_read(link, reg, val); in sata_scr_read()
97 return link->ap->ops->scr_write(link, reg, val); in sata_scr_write()
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()
583 ata_msleep(link->ap, 1); in sata_link_hardreset()
597 if (sata_pmp_supported(link->ap) && ata_is_host_link(link)) { in sata_link_hardreset()
650 int ata_qc_complete_multiple(struct ata_port *ap, u64 qc_active) in ata_qc_complete_multiple() argument
652 u64 done_mask, ap_qc_active = ap->qc_active; in ata_qc_complete_multiple()
668 ata_port_err(ap, "illegal qc_active transition (%08llx->%08llx)\n", in ata_qc_complete_multiple()
669 ap->qc_active, qc_active); in ata_qc_complete_multiple()
673 if (ap->ops->qc_ncq_fill_rtf) in ata_qc_complete_multiple()
674 ap->ops->qc_ncq_fill_rtf(ap, done_mask); in ata_qc_complete_multiple()
680 qc = ata_qc_from_tag(ap, tag); in ata_qc_complete_multiple()
738 int ata_slave_link_init(struct ata_port *ap) in ata_slave_link_init() argument
742 WARN_ON(ap->slave_link); in ata_slave_link_init()
743 WARN_ON(ap->flags & ATA_FLAG_PMP); in ata_slave_link_init()
749 ata_link_init(ap, link, 1); in ata_slave_link_init()
750 ap->slave_link = link; in ata_slave_link_init()
801 struct ata_port *ap = ata_shost_to_port(shost); in ata_scsi_lpm_store() local
818 spin_lock_irqsave(ap->lock, flags); in ata_scsi_lpm_store()
820 ata_for_each_link(link, ap, EDGE) { in ata_scsi_lpm_store()
821 ata_for_each_dev(dev, &ap->link, ENABLED) { in ata_scsi_lpm_store()
829 ap->target_lpm_policy = policy; in ata_scsi_lpm_store()
830 ata_port_schedule_eh(ap); in ata_scsi_lpm_store()
832 spin_unlock_irqrestore(ap->lock, flags); in ata_scsi_lpm_store()
840 struct ata_port *ap = ata_shost_to_port(shost); in ata_scsi_lpm_show() local
842 if (ap->target_lpm_policy >= ARRAY_SIZE(ata_lpm_policy_names)) in ata_scsi_lpm_show()
846 ata_lpm_policy_names[ap->target_lpm_policy]); in ata_scsi_lpm_show()
857 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_ncq_prio_supported_show() local
862 spin_lock_irq(ap->lock); in ata_ncq_prio_supported_show()
863 dev = ata_scsi_find_dev(ap, sdev); in ata_ncq_prio_supported_show()
868 spin_unlock_irq(ap->lock); in ata_ncq_prio_supported_show()
881 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_ncq_prio_enable_show() local
886 spin_lock_irq(ap->lock); in ata_ncq_prio_enable_show()
887 dev = ata_scsi_find_dev(ap, sdev); in ata_ncq_prio_enable_show()
892 spin_unlock_irq(ap->lock); in ata_ncq_prio_enable_show()
902 struct ata_port *ap; in ata_ncq_prio_enable_store() local
913 ap = ata_shost_to_port(sdev->host); in ata_ncq_prio_enable_store()
914 dev = ata_scsi_find_dev(ap, sdev); in ata_ncq_prio_enable_store()
918 spin_lock_irq(ap->lock); in ata_ncq_prio_enable_store()
938 spin_unlock_irq(ap->lock); in ata_ncq_prio_enable_store()
969 struct ata_port *ap = ata_shost_to_port(shost); in ata_scsi_em_message_store() local
970 if (ap->ops->em_store && (ap->flags & ATA_FLAG_EM)) in ata_scsi_em_message_store()
971 return ap->ops->em_store(ap, buf, count); in ata_scsi_em_message_store()
980 struct ata_port *ap = ata_shost_to_port(shost); in ata_scsi_em_message_show() local
982 if (ap->ops->em_show && (ap->flags & ATA_FLAG_EM)) in ata_scsi_em_message_show()
983 return ap->ops->em_show(ap, buf); in ata_scsi_em_message_show()
995 struct ata_port *ap = ata_shost_to_port(shost); in ata_scsi_em_message_type_show() local
997 return sysfs_emit(buf, "%d\n", ap->em_message_type); in ata_scsi_em_message_type_show()
1008 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_scsi_activity_show() local
1009 struct ata_device *atadev = ata_scsi_find_dev(ap, sdev); in ata_scsi_activity_show()
1011 if (atadev && ap->ops->sw_activity_show && in ata_scsi_activity_show()
1012 (ap->flags & ATA_FLAG_SW_ACTIVITY)) in ata_scsi_activity_show()
1013 return ap->ops->sw_activity_show(atadev, buf); in ata_scsi_activity_show()
1022 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_scsi_activity_store() local
1023 struct ata_device *atadev = ata_scsi_find_dev(ap, sdev); in ata_scsi_activity_store()
1027 if (atadev && ap->ops->sw_activity_store && in ata_scsi_activity_store()
1028 (ap->flags & ATA_FLAG_SW_ACTIVITY)) { in ata_scsi_activity_store()
1032 rc = ap->ops->sw_activity_store(atadev, val); in ata_scsi_activity_store()
1055 int ata_change_queue_depth(struct ata_port *ap, struct scsi_device *sdev, in ata_change_queue_depth() argument
1062 spin_lock_irqsave(ap->lock, flags); in ata_change_queue_depth()
1064 dev = ata_scsi_find_dev(ap, sdev); in ata_change_queue_depth()
1066 spin_unlock_irqrestore(ap->lock, flags); in ata_change_queue_depth()
1077 spin_unlock_irqrestore(ap->lock, flags); in ata_change_queue_depth()
1092 spin_unlock_irqrestore(ap->lock, flags); in ata_change_queue_depth()
1118 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_scsi_change_queue_depth() local
1120 return ata_change_queue_depth(ap, sdev, queue_depth); in ata_scsi_change_queue_depth()
1141 struct ata_port *ap; in ata_sas_port_alloc() local
1143 ap = ata_port_alloc(host); in ata_sas_port_alloc()
1144 if (!ap) in ata_sas_port_alloc()
1147 ap->port_no = 0; in ata_sas_port_alloc()
1148 ap->lock = &host->lock; in ata_sas_port_alloc()
1149 ap->pio_mask = port_info->pio_mask; in ata_sas_port_alloc()
1150 ap->mwdma_mask = port_info->mwdma_mask; in ata_sas_port_alloc()
1151 ap->udma_mask = port_info->udma_mask; in ata_sas_port_alloc()
1152 ap->flags |= port_info->flags; in ata_sas_port_alloc()
1153 ap->ops = port_info->port_ops; in ata_sas_port_alloc()
1154 ap->cbl = ATA_CBL_SATA; in ata_sas_port_alloc()
1155 ap->print_id = atomic_inc_return(&ata_print_id); in ata_sas_port_alloc()
1157 return ap; in ata_sas_port_alloc()
1161 int ata_sas_tport_add(struct device *parent, struct ata_port *ap) in ata_sas_tport_add() argument
1163 return ata_tport_add(parent, ap); in ata_sas_tport_add()
1167 void ata_sas_tport_delete(struct ata_port *ap) in ata_sas_tport_delete() argument
1169 ata_tport_delete(ap); in ata_sas_tport_delete()
1182 int ata_sas_slave_configure(struct scsi_device *sdev, struct ata_port *ap) in ata_sas_slave_configure() argument
1185 ata_scsi_dev_config(sdev, ap->link.device); in ata_sas_slave_configure()
1200 int ata_sas_queuecmd(struct scsi_cmnd *cmd, struct ata_port *ap) in ata_sas_queuecmd() argument
1204 if (likely(ata_dev_enabled(ap->link.device))) in ata_sas_queuecmd()
1205 rc = __ata_scsi_queuecmd(cmd, ap->link.device); in ata_sas_queuecmd()
1227 int sata_async_notification(struct ata_port *ap) in sata_async_notification() argument
1232 if (!(ap->flags & ATA_FLAG_AN)) in sata_async_notification()
1235 rc = sata_scr_read(&ap->link, SCR_NOTIFICATION, &sntf); in sata_async_notification()
1237 sata_scr_write(&ap->link, SCR_NOTIFICATION, sntf); in sata_async_notification()
1239 if (!sata_pmp_attached(ap) || rc) { in sata_async_notification()
1241 if (!sata_pmp_attached(ap)) { in sata_async_notification()
1246 struct ata_device *dev = ap->link.device; in sata_async_notification()
1258 ata_port_schedule_eh(ap); in sata_async_notification()
1266 ata_for_each_link(link, ap, EDGE) { in sata_async_notification()
1279 ata_port_schedule_eh(ap); in sata_async_notification()
1306 u8 *buf = dev->link->ap->sector_buf; in ata_eh_read_log_10h()
1362 struct ata_port *ap = dev->link->ap; in ata_eh_read_sense_success_ncq_log() local
1363 u8 *buf = ap->ncq_sense_buf; in ata_eh_read_sense_success_ncq_log()
1388 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_read_sense_success_ncq_log()
1447 struct ata_port *ap = link->ap; in ata_eh_analyze_ncq_error() local
1455 if (ata_port_is_frozen(ap)) in ata_eh_analyze_ncq_error()
1463 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_analyze_ncq_error()
1487 qc = __ata_qc_from_tag(ap, tag); in ata_eh_analyze_ncq_error()
1511 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_analyze_ncq_error()