Lines Matching refs: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()
67 return link->ap->ops->scr_read(link, reg, val); in sata_scr_read()
95 return link->ap->ops->scr_write(link, reg, val); in sata_scr_write()
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()
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()
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()
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 = ata_shost_to_port(sdev->host); in ata_ncq_prio_supported_show() local
847 spin_lock_irq(ap->lock); in ata_ncq_prio_supported_show()
848 dev = ata_scsi_find_dev(ap, sdev); in ata_ncq_prio_supported_show()
853 spin_unlock_irq(ap->lock); in ata_ncq_prio_supported_show()
866 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_ncq_prio_enable_show() local
871 spin_lock_irq(ap->lock); in ata_ncq_prio_enable_show()
872 dev = ata_scsi_find_dev(ap, sdev); in ata_ncq_prio_enable_show()
877 spin_unlock_irq(ap->lock); in ata_ncq_prio_enable_show()
887 struct ata_port *ap; in ata_ncq_prio_enable_store() local
898 ap = ata_shost_to_port(sdev->host); in ata_ncq_prio_enable_store()
899 dev = ata_scsi_find_dev(ap, sdev); in ata_ncq_prio_enable_store()
903 spin_lock_irq(ap->lock); in ata_ncq_prio_enable_store()
916 spin_unlock_irq(ap->lock); in ata_ncq_prio_enable_store()
947 struct ata_port *ap = ata_shost_to_port(shost); in ata_scsi_em_message_store() local
948 if (ap->ops->em_store && (ap->flags & ATA_FLAG_EM)) in ata_scsi_em_message_store()
949 return ap->ops->em_store(ap, buf, count); in ata_scsi_em_message_store()
958 struct ata_port *ap = ata_shost_to_port(shost); in ata_scsi_em_message_show() local
960 if (ap->ops->em_show && (ap->flags & ATA_FLAG_EM)) in ata_scsi_em_message_show()
961 return ap->ops->em_show(ap, buf); in ata_scsi_em_message_show()
973 struct ata_port *ap = ata_shost_to_port(shost); in ata_scsi_em_message_type_show() local
975 return snprintf(buf, 23, "%d\n", ap->em_message_type); in ata_scsi_em_message_type_show()
986 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_scsi_activity_show() local
987 struct ata_device *atadev = ata_scsi_find_dev(ap, sdev); in ata_scsi_activity_show()
989 if (atadev && ap->ops->sw_activity_show && in ata_scsi_activity_show()
990 (ap->flags & ATA_FLAG_SW_ACTIVITY)) in ata_scsi_activity_show()
991 return ap->ops->sw_activity_show(atadev, buf); in ata_scsi_activity_show()
1000 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_scsi_activity_store() local
1001 struct ata_device *atadev = ata_scsi_find_dev(ap, sdev); in ata_scsi_activity_store()
1005 if (atadev && ap->ops->sw_activity_store && in ata_scsi_activity_store()
1006 (ap->flags & ATA_FLAG_SW_ACTIVITY)) { in ata_scsi_activity_store()
1010 rc = ap->ops->sw_activity_store(atadev, val); in ata_scsi_activity_store()
1033 int __ata_change_queue_depth(struct ata_port *ap, struct scsi_device *sdev, in __ata_change_queue_depth() argument
1042 dev = ata_scsi_find_dev(ap, sdev); in __ata_change_queue_depth()
1047 spin_lock_irqsave(ap->lock, flags); in __ata_change_queue_depth()
1053 spin_unlock_irqrestore(ap->lock, flags); in __ata_change_queue_depth()
1084 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_scsi_change_queue_depth() local
1086 return __ata_change_queue_depth(ap, sdev, queue_depth); in ata_scsi_change_queue_depth()
1107 struct ata_port *ap; in ata_sas_port_alloc() local
1109 ap = ata_port_alloc(host); in ata_sas_port_alloc()
1110 if (!ap) in ata_sas_port_alloc()
1113 ap->port_no = 0; in ata_sas_port_alloc()
1114 ap->lock = &host->lock; in ata_sas_port_alloc()
1115 ap->pio_mask = port_info->pio_mask; in ata_sas_port_alloc()
1116 ap->mwdma_mask = port_info->mwdma_mask; in ata_sas_port_alloc()
1117 ap->udma_mask = port_info->udma_mask; in ata_sas_port_alloc()
1118 ap->flags |= port_info->flags; in ata_sas_port_alloc()
1119 ap->ops = port_info->port_ops; in ata_sas_port_alloc()
1120 ap->cbl = ATA_CBL_SATA; in ata_sas_port_alloc()
1122 return ap; in ata_sas_port_alloc()
1138 int ata_sas_port_start(struct ata_port *ap) in ata_sas_port_start() argument
1144 if (!ap->ops->error_handler) in ata_sas_port_start()
1145 ap->pflags &= ~ATA_PFLAG_FROZEN; in ata_sas_port_start()
1160 void ata_sas_port_stop(struct ata_port *ap) in ata_sas_port_stop() argument
1172 void ata_sas_async_probe(struct ata_port *ap) in ata_sas_async_probe() argument
1174 __ata_port_probe(ap); in ata_sas_async_probe()
1178 int ata_sas_sync_probe(struct ata_port *ap) in ata_sas_sync_probe() argument
1180 return ata_port_probe(ap); in ata_sas_sync_probe()
1196 int ata_sas_port_init(struct ata_port *ap) in ata_sas_port_init() argument
1198 int rc = ap->ops->port_start(ap); in ata_sas_port_init()
1202 ap->print_id = atomic_inc_return(&ata_print_id); in ata_sas_port_init()
1207 int ata_sas_tport_add(struct device *parent, struct ata_port *ap) in ata_sas_tport_add() argument
1209 return ata_tport_add(parent, ap); in ata_sas_tport_add()
1213 void ata_sas_tport_delete(struct ata_port *ap) in ata_sas_tport_delete() argument
1215 ata_tport_delete(ap); in ata_sas_tport_delete()
1225 void ata_sas_port_destroy(struct ata_port *ap) in ata_sas_port_destroy() argument
1227 if (ap->ops->port_stop) in ata_sas_port_destroy()
1228 ap->ops->port_stop(ap); in ata_sas_port_destroy()
1229 kfree(ap); in ata_sas_port_destroy()
1242 int ata_sas_slave_configure(struct scsi_device *sdev, struct ata_port *ap) in ata_sas_slave_configure() argument
1245 ata_scsi_dev_config(sdev, ap->link.device); in ata_sas_slave_configure()
1260 int ata_sas_queuecmd(struct scsi_cmnd *cmd, struct ata_port *ap) in ata_sas_queuecmd() argument
1264 ata_scsi_dump_cdb(ap, cmd); in ata_sas_queuecmd()
1266 if (likely(ata_dev_enabled(ap->link.device))) in ata_sas_queuecmd()
1267 rc = __ata_scsi_queuecmd(cmd, ap->link.device); in ata_sas_queuecmd()
1276 int ata_sas_allocate_tag(struct ata_port *ap) in ata_sas_allocate_tag() argument
1278 unsigned int max_queue = ap->host->n_tags; in ata_sas_allocate_tag()
1281 for (i = 0, tag = ap->sas_last_tag + 1; i < max_queue; i++, tag++) { in ata_sas_allocate_tag()
1288 if (!test_and_set_bit(tag, &ap->sas_tag_allocated)) { in ata_sas_allocate_tag()
1289 ap->sas_last_tag = tag; in ata_sas_allocate_tag()
1296 void ata_sas_free_tag(unsigned int tag, struct ata_port *ap) in ata_sas_free_tag() argument
1298 clear_bit(tag, &ap->sas_tag_allocated); in ata_sas_free_tag()
1314 int sata_async_notification(struct ata_port *ap) in sata_async_notification() argument
1319 if (!(ap->flags & ATA_FLAG_AN)) in sata_async_notification()
1322 rc = sata_scr_read(&ap->link, SCR_NOTIFICATION, &sntf); in sata_async_notification()
1324 sata_scr_write(&ap->link, SCR_NOTIFICATION, sntf); in sata_async_notification()
1326 if (!sata_pmp_attached(ap) || rc) { in sata_async_notification()
1328 if (!sata_pmp_attached(ap)) { in sata_async_notification()
1333 struct ata_device *dev = ap->link.device; in sata_async_notification()
1345 ata_port_schedule_eh(ap); in sata_async_notification()
1353 ata_for_each_link(link, ap, EDGE) { in sata_async_notification()
1366 ata_port_schedule_eh(ap); in sata_async_notification()
1393 u8 *buf = dev->link->ap->sector_buf; in ata_eh_read_log_10h()
1445 struct ata_port *ap = link->ap; in ata_eh_analyze_ncq_error() local
1453 if (ap->pflags & ATA_PFLAG_FROZEN) in ata_eh_analyze_ncq_error()
1461 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_analyze_ncq_error()
1485 qc = __ata_qc_from_tag(ap, tag); in ata_eh_analyze_ncq_error()