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 = 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()
938 struct ata_port *ap = ata_shost_to_port(shost); in ata_scsi_em_message_store() local
939 if (ap->ops->em_store && (ap->flags & ATA_FLAG_EM)) in ata_scsi_em_message_store()
940 return ap->ops->em_store(ap, buf, count); in ata_scsi_em_message_store()
949 struct ata_port *ap = ata_shost_to_port(shost); in ata_scsi_em_message_show() local
951 if (ap->ops->em_show && (ap->flags & ATA_FLAG_EM)) in ata_scsi_em_message_show()
952 return ap->ops->em_show(ap, buf); in ata_scsi_em_message_show()
964 struct ata_port *ap = ata_shost_to_port(shost); in ata_scsi_em_message_type_show() local
966 return snprintf(buf, 23, "%d\n", ap->em_message_type); in ata_scsi_em_message_type_show()
977 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_scsi_activity_show() local
978 struct ata_device *atadev = ata_scsi_find_dev(ap, sdev); in ata_scsi_activity_show()
980 if (atadev && ap->ops->sw_activity_show && in ata_scsi_activity_show()
981 (ap->flags & ATA_FLAG_SW_ACTIVITY)) in ata_scsi_activity_show()
982 return ap->ops->sw_activity_show(atadev, buf); in ata_scsi_activity_show()
991 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_scsi_activity_store() local
992 struct ata_device *atadev = ata_scsi_find_dev(ap, sdev); in ata_scsi_activity_store()
996 if (atadev && ap->ops->sw_activity_store && in ata_scsi_activity_store()
997 (ap->flags & ATA_FLAG_SW_ACTIVITY)) { in ata_scsi_activity_store()
1001 rc = ap->ops->sw_activity_store(atadev, val); in ata_scsi_activity_store()
1016 * @ap: ATA port to which the device change the queue depth
1024 int __ata_change_queue_depth(struct ata_port *ap, struct scsi_device *sdev, in __ata_change_queue_depth() argument
1033 dev = ata_scsi_find_dev(ap, sdev); in __ata_change_queue_depth()
1038 spin_lock_irqsave(ap->lock, flags); in __ata_change_queue_depth()
1044 spin_unlock_irqrestore(ap->lock, flags); in __ata_change_queue_depth()
1075 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_scsi_change_queue_depth() local
1077 return __ata_change_queue_depth(ap, sdev, queue_depth); in ata_scsi_change_queue_depth()
1098 struct ata_port *ap; in ata_sas_port_alloc() local
1100 ap = ata_port_alloc(host); in ata_sas_port_alloc()
1101 if (!ap) in ata_sas_port_alloc()
1104 ap->port_no = 0; in ata_sas_port_alloc()
1105 ap->lock = &host->lock; in ata_sas_port_alloc()
1106 ap->pio_mask = port_info->pio_mask; in ata_sas_port_alloc()
1107 ap->mwdma_mask = port_info->mwdma_mask; in ata_sas_port_alloc()
1108 ap->udma_mask = port_info->udma_mask; in ata_sas_port_alloc()
1109 ap->flags |= port_info->flags; in ata_sas_port_alloc()
1110 ap->ops = port_info->port_ops; in ata_sas_port_alloc()
1111 ap->cbl = ATA_CBL_SATA; in ata_sas_port_alloc()
1113 return ap; in ata_sas_port_alloc()
1119 * @ap: Port to initialize
1129 int ata_sas_port_start(struct ata_port *ap) in ata_sas_port_start() argument
1135 if (!ap->ops->error_handler) in ata_sas_port_start()
1136 ap->pflags &= ~ATA_PFLAG_FROZEN; in ata_sas_port_start()
1143 * @ap: Port to shut down
1151 void ata_sas_port_stop(struct ata_port *ap) in ata_sas_port_stop() argument
1158 * @ap: Port to probe
1163 void ata_sas_async_probe(struct ata_port *ap) in ata_sas_async_probe() argument
1165 __ata_port_probe(ap); in ata_sas_async_probe()
1169 int ata_sas_sync_probe(struct ata_port *ap) in ata_sas_sync_probe() argument
1171 return ata_port_probe(ap); in ata_sas_sync_probe()
1178 * @ap: SATA port to initialize
1187 int ata_sas_port_init(struct ata_port *ap) in ata_sas_port_init() argument
1189 int rc = ap->ops->port_start(ap); in ata_sas_port_init()
1193 ap->print_id = atomic_inc_return(&ata_print_id); in ata_sas_port_init()
1198 int ata_sas_tport_add(struct device *parent, struct ata_port *ap) in ata_sas_tport_add() argument
1200 return ata_tport_add(parent, ap); in ata_sas_tport_add()
1204 void ata_sas_tport_delete(struct ata_port *ap) in ata_sas_tport_delete() argument
1206 ata_tport_delete(ap); in ata_sas_tport_delete()
1212 * @ap: SATA port to destroy
1216 void ata_sas_port_destroy(struct ata_port *ap) in ata_sas_port_destroy() argument
1218 if (ap->ops->port_stop) in ata_sas_port_destroy()
1219 ap->ops->port_stop(ap); in ata_sas_port_destroy()
1220 kfree(ap); in ata_sas_port_destroy()
1227 * @ap: ATA port to which SCSI device is attached
1233 int ata_sas_slave_configure(struct scsi_device *sdev, struct ata_port *ap) in ata_sas_slave_configure() argument
1236 ata_scsi_dev_config(sdev, ap->link.device); in ata_sas_slave_configure()
1244 * @ap: ATA port to which the command is being sent
1251 int ata_sas_queuecmd(struct scsi_cmnd *cmd, struct ata_port *ap) in ata_sas_queuecmd() argument
1255 ata_scsi_dump_cdb(ap, cmd); in ata_sas_queuecmd()
1257 if (likely(ata_dev_enabled(ap->link.device))) in ata_sas_queuecmd()
1258 rc = __ata_scsi_queuecmd(cmd, ap->link.device); in ata_sas_queuecmd()
1267 int ata_sas_allocate_tag(struct ata_port *ap) in ata_sas_allocate_tag() argument
1269 unsigned int max_queue = ap->host->n_tags; in ata_sas_allocate_tag()
1272 for (i = 0, tag = ap->sas_last_tag + 1; i < max_queue; i++, tag++) { in ata_sas_allocate_tag()
1279 if (!test_and_set_bit(tag, &ap->sas_tag_allocated)) { in ata_sas_allocate_tag()
1280 ap->sas_last_tag = tag; in ata_sas_allocate_tag()
1287 void ata_sas_free_tag(unsigned int tag, struct ata_port *ap) in ata_sas_free_tag() argument
1289 clear_bit(tag, &ap->sas_tag_allocated); in ata_sas_free_tag()
1294 * @ap: ATA port where async notification is received
1305 int sata_async_notification(struct ata_port *ap) in sata_async_notification() argument
1310 if (!(ap->flags & ATA_FLAG_AN)) in sata_async_notification()
1313 rc = sata_scr_read(&ap->link, SCR_NOTIFICATION, &sntf); in sata_async_notification()
1315 sata_scr_write(&ap->link, SCR_NOTIFICATION, sntf); in sata_async_notification()
1317 if (!sata_pmp_attached(ap) || rc) { in sata_async_notification()
1319 if (!sata_pmp_attached(ap)) { in sata_async_notification()
1324 struct ata_device *dev = ap->link.device; in sata_async_notification()
1336 ata_port_schedule_eh(ap); in sata_async_notification()
1344 ata_for_each_link(link, ap, EDGE) { in sata_async_notification()
1357 ata_port_schedule_eh(ap); in sata_async_notification()
1384 u8 *buf = dev->link->ap->sector_buf; in ata_eh_read_log_10h()
1436 struct ata_port *ap = link->ap; in ata_eh_analyze_ncq_error() local
1444 if (ap->pflags & ATA_PFLAG_FROZEN) in ata_eh_analyze_ncq_error()
1452 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_analyze_ncq_error()
1476 qc = __ata_qc_from_tag(ap, tag); in ata_eh_analyze_ncq_error()