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()
405 if (link->ap->host->flags & ATA_HOST_NO_PART) in sata_link_scr_lpm()
408 if (link->ap->host->flags & ATA_HOST_NO_SSC) in sata_link_scr_lpm()
411 if (link->ap->host->flags & ATA_HOST_NO_DEVSLP) in sata_link_scr_lpm()
439 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()
633 * @ap: port in question
638 * requests normally. ap->qc_active and @qc_active is compared
651 int ata_qc_complete_multiple(struct ata_port *ap, u64 qc_active) in ata_qc_complete_multiple() argument
653 u64 done_mask, ap_qc_active = ap->qc_active; in ata_qc_complete_multiple()
657 * If the internal tag is set on ap->qc_active, then we care about in ata_qc_complete_multiple()
669 ata_port_err(ap, "illegal qc_active transition (%08llx->%08llx)\n", in ata_qc_complete_multiple()
670 ap->qc_active, qc_active); in ata_qc_complete_multiple()
678 qc = ata_qc_from_tag(ap, tag); in ata_qc_complete_multiple()
692 * @ap: port to initialize slave link for
694 * Create and initialize slave link for @ap. This enables slave
717 * handling, separate @ap->slave_link is used. All dirty details
736 int ata_slave_link_init(struct ata_port *ap) in ata_slave_link_init() argument
740 WARN_ON(ap->slave_link); in ata_slave_link_init()
741 WARN_ON(ap->flags & ATA_FLAG_PMP); in ata_slave_link_init()
747 ata_link_init(ap, link, 1); in ata_slave_link_init()
748 ap->slave_link = link; in ata_slave_link_init()
799 struct ata_port *ap = ata_shost_to_port(shost); in ata_scsi_lpm_store() local
816 spin_lock_irqsave(ap->lock, flags); in ata_scsi_lpm_store()
818 ata_for_each_link(link, ap, EDGE) { in ata_scsi_lpm_store()
819 ata_for_each_dev(dev, &ap->link, ENABLED) { in ata_scsi_lpm_store()
827 ap->target_lpm_policy = policy; in ata_scsi_lpm_store()
828 ata_port_schedule_eh(ap); in ata_scsi_lpm_store()
830 spin_unlock_irqrestore(ap->lock, flags); in ata_scsi_lpm_store()
838 struct ata_port *ap = ata_shost_to_port(shost); in ata_scsi_lpm_show() local
840 if (ap->target_lpm_policy >= ARRAY_SIZE(ata_lpm_policy_names)) in ata_scsi_lpm_show()
844 ata_lpm_policy_names[ap->target_lpm_policy]); in ata_scsi_lpm_show()
855 struct ata_port *ap; in ata_ncq_prio_enable_show() local
860 ap = ata_shost_to_port(sdev->host); in ata_ncq_prio_enable_show()
862 spin_lock_irq(ap->lock); in ata_ncq_prio_enable_show()
863 dev = ata_scsi_find_dev(ap, sdev); in ata_ncq_prio_enable_show()
872 spin_unlock_irq(ap->lock); in ata_ncq_prio_enable_show()
882 struct ata_port *ap; in ata_ncq_prio_enable_store() local
893 ap = ata_shost_to_port(sdev->host); in ata_ncq_prio_enable_store()
894 dev = ata_scsi_find_dev(ap, sdev); in ata_ncq_prio_enable_store()
898 spin_lock_irq(ap->lock); in ata_ncq_prio_enable_store()
906 ata_port_schedule_eh(ap); in ata_ncq_prio_enable_store()
907 spin_unlock_irq(ap->lock); in ata_ncq_prio_enable_store()
909 ata_port_wait_eh(ap); in ata_ncq_prio_enable_store()
912 spin_lock_irq(ap->lock); in ata_ncq_prio_enable_store()
917 spin_unlock_irq(ap->lock); in ata_ncq_prio_enable_store()
939 struct ata_port *ap = ata_shost_to_port(shost); in ata_scsi_em_message_store() local
940 if (ap->ops->em_store && (ap->flags & ATA_FLAG_EM)) in ata_scsi_em_message_store()
941 return ap->ops->em_store(ap, buf, count); in ata_scsi_em_message_store()
950 struct ata_port *ap = ata_shost_to_port(shost); in ata_scsi_em_message_show() local
952 if (ap->ops->em_show && (ap->flags & ATA_FLAG_EM)) in ata_scsi_em_message_show()
953 return ap->ops->em_show(ap, buf); in ata_scsi_em_message_show()
965 struct ata_port *ap = ata_shost_to_port(shost); in ata_scsi_em_message_type_show() local
967 return snprintf(buf, 23, "%d\n", ap->em_message_type); in ata_scsi_em_message_type_show()
978 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_scsi_activity_show() local
979 struct ata_device *atadev = ata_scsi_find_dev(ap, sdev); in ata_scsi_activity_show()
981 if (atadev && ap->ops->sw_activity_show && in ata_scsi_activity_show()
982 (ap->flags & ATA_FLAG_SW_ACTIVITY)) in ata_scsi_activity_show()
983 return ap->ops->sw_activity_show(atadev, buf); in ata_scsi_activity_show()
992 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_scsi_activity_store() local
993 struct ata_device *atadev = ata_scsi_find_dev(ap, sdev); in ata_scsi_activity_store()
997 if (atadev && ap->ops->sw_activity_store && in ata_scsi_activity_store()
998 (ap->flags & ATA_FLAG_SW_ACTIVITY)) { in ata_scsi_activity_store()
1002 rc = ap->ops->sw_activity_store(atadev, val); in ata_scsi_activity_store()
1017 * @ap: ATA port to which the device change the queue depth
1025 int __ata_change_queue_depth(struct ata_port *ap, struct scsi_device *sdev, in __ata_change_queue_depth() argument
1034 dev = ata_scsi_find_dev(ap, sdev); in __ata_change_queue_depth()
1039 spin_lock_irqsave(ap->lock, flags); in __ata_change_queue_depth()
1045 spin_unlock_irqrestore(ap->lock, flags); in __ata_change_queue_depth()
1076 struct ata_port *ap = ata_shost_to_port(sdev->host); in ata_scsi_change_queue_depth() local
1078 return __ata_change_queue_depth(ap, sdev, queue_depth); in ata_scsi_change_queue_depth()
1099 struct ata_port *ap; in ata_sas_port_alloc() local
1101 ap = ata_port_alloc(host); in ata_sas_port_alloc()
1102 if (!ap) in ata_sas_port_alloc()
1105 ap->port_no = 0; in ata_sas_port_alloc()
1106 ap->lock = &host->lock; in ata_sas_port_alloc()
1107 ap->pio_mask = port_info->pio_mask; in ata_sas_port_alloc()
1108 ap->mwdma_mask = port_info->mwdma_mask; in ata_sas_port_alloc()
1109 ap->udma_mask = port_info->udma_mask; in ata_sas_port_alloc()
1110 ap->flags |= port_info->flags; in ata_sas_port_alloc()
1111 ap->ops = port_info->port_ops; in ata_sas_port_alloc()
1112 ap->cbl = ATA_CBL_SATA; in ata_sas_port_alloc()
1114 return ap; in ata_sas_port_alloc()
1120 * @ap: Port to initialize
1130 int ata_sas_port_start(struct ata_port *ap) in ata_sas_port_start() argument
1136 if (!ap->ops->error_handler) in ata_sas_port_start()
1137 ap->pflags &= ~ATA_PFLAG_FROZEN; in ata_sas_port_start()
1144 * @ap: Port to shut down
1152 void ata_sas_port_stop(struct ata_port *ap) in ata_sas_port_stop() argument
1159 * @ap: Port to probe
1164 void ata_sas_async_probe(struct ata_port *ap) in ata_sas_async_probe() argument
1166 __ata_port_probe(ap); in ata_sas_async_probe()
1170 int ata_sas_sync_probe(struct ata_port *ap) in ata_sas_sync_probe() argument
1172 return ata_port_probe(ap); in ata_sas_sync_probe()
1179 * @ap: SATA port to initialize
1188 int ata_sas_port_init(struct ata_port *ap) in ata_sas_port_init() argument
1190 int rc = ap->ops->port_start(ap); in ata_sas_port_init()
1194 ap->print_id = atomic_inc_return(&ata_print_id); in ata_sas_port_init()
1199 int ata_sas_tport_add(struct device *parent, struct ata_port *ap) in ata_sas_tport_add() argument
1201 return ata_tport_add(parent, ap); in ata_sas_tport_add()
1205 void ata_sas_tport_delete(struct ata_port *ap) in ata_sas_tport_delete() argument
1207 ata_tport_delete(ap); in ata_sas_tport_delete()
1213 * @ap: SATA port to destroy
1217 void ata_sas_port_destroy(struct ata_port *ap) in ata_sas_port_destroy() argument
1219 if (ap->ops->port_stop) in ata_sas_port_destroy()
1220 ap->ops->port_stop(ap); in ata_sas_port_destroy()
1221 kfree(ap); in ata_sas_port_destroy()
1228 * @ap: ATA port to which SCSI device is attached
1234 int ata_sas_slave_configure(struct scsi_device *sdev, struct ata_port *ap) in ata_sas_slave_configure() argument
1237 ata_scsi_dev_config(sdev, ap->link.device); in ata_sas_slave_configure()
1245 * @ap: ATA port to which the command is being sent
1252 int ata_sas_queuecmd(struct scsi_cmnd *cmd, struct ata_port *ap) in ata_sas_queuecmd() argument
1256 ata_scsi_dump_cdb(ap, cmd); in ata_sas_queuecmd()
1258 if (likely(ata_dev_enabled(ap->link.device))) in ata_sas_queuecmd()
1259 rc = __ata_scsi_queuecmd(cmd, ap->link.device); in ata_sas_queuecmd()
1268 int ata_sas_allocate_tag(struct ata_port *ap) in ata_sas_allocate_tag() argument
1270 unsigned int max_queue = ap->host->n_tags; in ata_sas_allocate_tag()
1273 for (i = 0, tag = ap->sas_last_tag + 1; i < max_queue; i++, tag++) { in ata_sas_allocate_tag()
1280 if (!test_and_set_bit(tag, &ap->sas_tag_allocated)) { in ata_sas_allocate_tag()
1281 ap->sas_last_tag = tag; in ata_sas_allocate_tag()
1288 void ata_sas_free_tag(unsigned int tag, struct ata_port *ap) in ata_sas_free_tag() argument
1290 clear_bit(tag, &ap->sas_tag_allocated); in ata_sas_free_tag()
1295 * @ap: ATA port where async notification is received
1306 int sata_async_notification(struct ata_port *ap) in sata_async_notification() argument
1311 if (!(ap->flags & ATA_FLAG_AN)) in sata_async_notification()
1314 rc = sata_scr_read(&ap->link, SCR_NOTIFICATION, &sntf); in sata_async_notification()
1316 sata_scr_write(&ap->link, SCR_NOTIFICATION, sntf); in sata_async_notification()
1318 if (!sata_pmp_attached(ap) || rc) { in sata_async_notification()
1320 if (!sata_pmp_attached(ap)) { in sata_async_notification()
1325 struct ata_device *dev = ap->link.device; in sata_async_notification()
1337 ata_port_schedule_eh(ap); in sata_async_notification()
1345 ata_for_each_link(link, ap, EDGE) { in sata_async_notification()
1358 ata_port_schedule_eh(ap); in sata_async_notification()
1385 u8 *buf = dev->link->ap->sector_buf; in ata_eh_read_log_10h()
1437 struct ata_port *ap = link->ap; in ata_eh_analyze_ncq_error() local
1445 if (ap->pflags & ATA_PFLAG_FROZEN) in ata_eh_analyze_ncq_error()
1453 ata_qc_for_each_raw(ap, qc, tag) { in ata_eh_analyze_ncq_error()
1477 qc = __ata_qc_from_tag(ap, tag); in ata_eh_analyze_ncq_error()