Lines Matching full:ap
41 struct ata_port *ap = link->ap; in sata_scr_valid() local
43 return (ap->flags & ATA_FLAG_SATA) && ap->ops->scr_read; in sata_scr_valid()
54 * guaranteed to succeed if @link is ap->link, the cable type of
58 * None if @link is ap->link. Kernel thread context otherwise.
67 return link->ap->ops->scr_read(link, reg, val); in sata_scr_read()
82 * guaranteed to succeed if @link is ap->link, the cable type of
86 * None if @link is ap->link. Kernel thread context otherwise.
95 return link->ap->ops->scr_write(link, reg, val); in sata_scr_write()
113 * None if @link is ap->link. Kernel thread context otherwise.
124 rc = link->ap->ops->scr_write(link, reg, val); in sata_scr_write_flush()
126 rc = link->ap->ops->scr_read(link, reg, &val); in sata_scr_write_flush()
254 ata_msleep(link->ap, interval); in sata_link_debounce()
321 ata_msleep(link->ap, 200); in sata_link_resume()
426 struct ata_link *host_link = &link->ap->link; in __sata_set_spd_needed()
570 ata_msleep(link->ap, 1); in sata_link_hardreset()
584 if (sata_pmp_supported(link->ap) && ata_is_host_link(link)) { in sata_link_hardreset()
620 * @ap: port in question
625 * requests normally. ap->qc_active and @qc_active is compared
638 int ata_qc_complete_multiple(struct ata_port *ap, u64 qc_active) in ata_qc_complete_multiple() argument
640 u64 done_mask, ap_qc_active = ap->qc_active; in ata_qc_complete_multiple()
644 * If the internal tag is set on ap->qc_active, then we care about in ata_qc_complete_multiple()
656 ata_port_err(ap, "illegal qc_active transition (%08llx->%08llx)\n", in ata_qc_complete_multiple()
657 ap->qc_active, qc_active); in ata_qc_complete_multiple()
665 qc = ata_qc_from_tag(ap, tag); in ata_qc_complete_multiple()
679 * @ap: port to initialize slave link for
681 * Create and initialize slave link for @ap. This enables slave
704 * handling, separate @ap->slave_link is used. All dirty details
723 int ata_slave_link_init(struct ata_port *ap) in ata_slave_link_init() argument
727 WARN_ON(ap->slave_link); in ata_slave_link_init()
728 WARN_ON(ap->flags & ATA_FLAG_PMP); in ata_slave_link_init()
734 ata_link_init(ap, link, 1); in ata_slave_link_init()
735 ap->slave_link = link; in ata_slave_link_init()
786 struct ata_port *ap = ata_shost_to_port(shost); in ata_scsi_lpm_store() local
803 spin_lock_irqsave(ap->lock, flags); in ata_scsi_lpm_store()
805 ata_for_each_link(link, ap, EDGE) { in ata_scsi_lpm_store()
806 ata_for_each_dev(dev, &ap->link, ENABLED) { in ata_scsi_lpm_store()
814 ap->target_lpm_policy = policy; in ata_scsi_lpm_store()
815 ata_port_schedule_eh(ap); in ata_scsi_lpm_store()
817 spin_unlock_irqrestore(ap->lock, flags); in ata_scsi_lpm_store()
825 struct ata_port *ap = ata_shost_to_port(shost); in ata_scsi_lpm_show() local
827 if (ap->target_lpm_policy >= ARRAY_SIZE(ata_lpm_policy_names)) in ata_scsi_lpm_show()
831 ata_lpm_policy_names[ap->target_lpm_policy]); in ata_scsi_lpm_show()
842 struct ata_port *ap; in ata_ncq_prio_enable_show() local
847 ap = ata_shost_to_port(sdev->host); in ata_ncq_prio_enable_show()
849 spin_lock_irq(ap->lock); in ata_ncq_prio_enable_show()
850 dev = ata_scsi_find_dev(ap, sdev); in ata_ncq_prio_enable_show()
859 spin_unlock_irq(ap->lock); in ata_ncq_prio_enable_show()
869 struct ata_port *ap; in ata_ncq_prio_enable_store() local
880 ap = ata_shost_to_port(sdev->host); in ata_ncq_prio_enable_store()
881 dev = ata_scsi_find_dev(ap, sdev); in ata_ncq_prio_enable_store()
885 spin_lock_irq(ap->lock); in ata_ncq_prio_enable_store()
893 ata_port_schedule_eh(ap); in ata_ncq_prio_enable_store()
894 spin_unlock_irq(ap->lock); in ata_ncq_prio_enable_store()
896 ata_port_wait_eh(ap); in ata_ncq_prio_enable_store()
899 spin_lock_irq(ap->lock); in ata_ncq_prio_enable_store()
904 spin_unlock_irq(ap->lock); in ata_ncq_prio_enable_store()
926 struct ata_port *ap = ata_shost_to_port(shost); in ata_scsi_em_message_store() local
927 if (ap->ops->em_store && (ap->flags & ATA_FLAG_EM)) in ata_scsi_em_message_store()
928 return ap->ops->em_store(ap, buf, count); in ata_scsi_em_message_store()
937 struct ata_port *ap = ata_shost_to_port(shost); in ata_scsi_em_message_show() local
939 if (ap->ops->em_show && (ap->flags & ATA_FLAG_EM)) in ata_scsi_em_message_show()
940 return ap->ops->em_show(ap, buf); in ata_scsi_em_message_show()
952 struct ata_port *ap = ata_shost_to_port(shost); in ata_scsi_em_message_type_show() local
954 return snprintf(buf, 23, "%d\n", ap->em_message_type); in ata_scsi_em_message_type_show()
965 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_scsi_activity_show() local
966 struct ata_device *atadev = ata_scsi_find_dev(ap, sdev); in ata_scsi_activity_show()
968 if (atadev && ap->ops->sw_activity_show && in ata_scsi_activity_show()
969 (ap->flags & ATA_FLAG_SW_ACTIVITY)) in ata_scsi_activity_show()
970 return ap->ops->sw_activity_show(atadev, buf); in ata_scsi_activity_show()
979 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_scsi_activity_store() local
980 struct ata_device *atadev = ata_scsi_find_dev(ap, sdev); in ata_scsi_activity_store()
984 if (atadev && ap->ops->sw_activity_store && in ata_scsi_activity_store()
985 (ap->flags & ATA_FLAG_SW_ACTIVITY)) { in ata_scsi_activity_store()
989 rc = ap->ops->sw_activity_store(atadev, val); in ata_scsi_activity_store()
1004 * @ap: ATA port to which the device change the queue depth
1012 int __ata_change_queue_depth(struct ata_port *ap, struct scsi_device *sdev, in __ata_change_queue_depth() argument
1021 dev = ata_scsi_find_dev(ap, sdev); in __ata_change_queue_depth()
1026 spin_lock_irqsave(ap->lock, flags); in __ata_change_queue_depth()
1032 spin_unlock_irqrestore(ap->lock, flags); in __ata_change_queue_depth()
1063 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_scsi_change_queue_depth() local
1065 return __ata_change_queue_depth(ap, sdev, queue_depth); in ata_scsi_change_queue_depth()
1086 struct ata_port *ap; in ata_sas_port_alloc() local
1088 ap = ata_port_alloc(host); in ata_sas_port_alloc()
1089 if (!ap) in ata_sas_port_alloc()
1092 ap->port_no = 0; in ata_sas_port_alloc()
1093 ap->lock = &host->lock; in ata_sas_port_alloc()
1094 ap->pio_mask = port_info->pio_mask; in ata_sas_port_alloc()
1095 ap->mwdma_mask = port_info->mwdma_mask; in ata_sas_port_alloc()
1096 ap->udma_mask = port_info->udma_mask; in ata_sas_port_alloc()
1097 ap->flags |= port_info->flags; in ata_sas_port_alloc()
1098 ap->ops = port_info->port_ops; in ata_sas_port_alloc()
1099 ap->cbl = ATA_CBL_SATA; in ata_sas_port_alloc()
1101 return ap; in ata_sas_port_alloc()
1107 * @ap: Port to initialize
1117 int ata_sas_port_start(struct ata_port *ap) in ata_sas_port_start() argument
1123 if (!ap->ops->error_handler) in ata_sas_port_start()
1124 ap->pflags &= ~ATA_PFLAG_FROZEN; in ata_sas_port_start()
1131 * @ap: Port to shut down
1139 void ata_sas_port_stop(struct ata_port *ap) in ata_sas_port_stop() argument
1146 * @ap: Port to probe
1151 void ata_sas_async_probe(struct ata_port *ap) in ata_sas_async_probe() argument
1153 __ata_port_probe(ap); in ata_sas_async_probe()
1157 int ata_sas_sync_probe(struct ata_port *ap) in ata_sas_sync_probe() argument
1159 return ata_port_probe(ap); in ata_sas_sync_probe()
1166 * @ap: SATA port to initialize
1175 int ata_sas_port_init(struct ata_port *ap) in ata_sas_port_init() argument
1177 int rc = ap->ops->port_start(ap); in ata_sas_port_init()
1181 ap->print_id = atomic_inc_return(&ata_print_id); in ata_sas_port_init()
1186 int ata_sas_tport_add(struct device *parent, struct ata_port *ap) in ata_sas_tport_add() argument
1188 return ata_tport_add(parent, ap); in ata_sas_tport_add()
1192 void ata_sas_tport_delete(struct ata_port *ap) in ata_sas_tport_delete() argument
1194 ata_tport_delete(ap); in ata_sas_tport_delete()
1200 * @ap: SATA port to destroy
1204 void ata_sas_port_destroy(struct ata_port *ap) in ata_sas_port_destroy() argument
1206 if (ap->ops->port_stop) in ata_sas_port_destroy()
1207 ap->ops->port_stop(ap); in ata_sas_port_destroy()
1208 kfree(ap); in ata_sas_port_destroy()
1215 * @ap: ATA port to which SCSI device is attached
1221 int ata_sas_slave_configure(struct scsi_device *sdev, struct ata_port *ap) in ata_sas_slave_configure() argument
1224 ata_scsi_dev_config(sdev, ap->link.device); in ata_sas_slave_configure()
1232 * @ap: ATA port to which the command is being sent
1239 int ata_sas_queuecmd(struct scsi_cmnd *cmd, struct ata_port *ap) in ata_sas_queuecmd() argument
1243 ata_scsi_dump_cdb(ap, cmd); in ata_sas_queuecmd()
1245 if (likely(ata_dev_enabled(ap->link.device))) in ata_sas_queuecmd()
1246 rc = __ata_scsi_queuecmd(cmd, ap->link.device); in ata_sas_queuecmd()
1255 int ata_sas_allocate_tag(struct ata_port *ap) in ata_sas_allocate_tag() argument
1257 unsigned int max_queue = ap->host->n_tags; in ata_sas_allocate_tag()
1260 for (i = 0, tag = ap->sas_last_tag + 1; i < max_queue; i++, tag++) { in ata_sas_allocate_tag()
1267 if (!test_and_set_bit(tag, &ap->sas_tag_allocated)) { in ata_sas_allocate_tag()
1268 ap->sas_last_tag = tag; in ata_sas_allocate_tag()
1275 void ata_sas_free_tag(unsigned int tag, struct ata_port *ap) in ata_sas_free_tag() argument
1277 clear_bit(tag, &ap->sas_tag_allocated); in ata_sas_free_tag()
1282 * @ap: ATA port where async notification is received
1293 int sata_async_notification(struct ata_port *ap) in sata_async_notification() argument
1298 if (!(ap->flags & ATA_FLAG_AN)) in sata_async_notification()
1301 rc = sata_scr_read(&ap->link, SCR_NOTIFICATION, &sntf); in sata_async_notification()
1303 sata_scr_write(&ap->link, SCR_NOTIFICATION, sntf); in sata_async_notification()
1305 if (!sata_pmp_attached(ap) || rc) { in sata_async_notification()
1307 if (!sata_pmp_attached(ap)) { in sata_async_notification()
1312 struct ata_device *dev = ap->link.device; in sata_async_notification()
1324 ata_port_schedule_eh(ap); in sata_async_notification()
1332 ata_for_each_link(link, ap, EDGE) { in sata_async_notification()
1345 ata_port_schedule_eh(ap); in sata_async_notification()
1372 u8 *buf = dev->link->ap->sector_buf; in ata_eh_read_log_10h()
1424 struct ata_port *ap = link->ap; in ata_eh_analyze_ncq_error() local
1432 if (ap->pflags & ATA_PFLAG_FROZEN) in ata_eh_analyze_ncq_error()
1440 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_analyze_ncq_error()
1464 qc = __ata_qc_from_tag(ap, tag); in ata_eh_analyze_ncq_error()