Lines Matching refs:ap

180 struct ata_link *ata_link_next(struct ata_link *link, struct ata_port *ap,  in ata_link_next()  argument
191 if (sata_pmp_attached(ap)) in ata_link_next()
192 return ap->pmp_link; in ata_link_next()
195 return &ap->link; in ata_link_next()
199 if (link == &ap->link) in ata_link_next()
202 if (sata_pmp_attached(ap)) in ata_link_next()
203 return ap->pmp_link; in ata_link_next()
206 if (unlikely(ap->slave_link)) in ata_link_next()
207 return ap->slave_link; in ata_link_next()
214 if (unlikely(link == ap->slave_link)) in ata_link_next()
218 if (++link < ap->pmp_link + ap->nr_pmp_links) in ata_link_next()
222 return &ap->link; in ata_link_next()
298 struct ata_port *ap = dev->link->ap; in ata_dev_phys_link() local
300 if (!ap->slave_link) in ata_dev_phys_link()
303 return &ap->link; in ata_dev_phys_link()
304 return ap->slave_link; in ata_dev_phys_link()
321 void ata_force_cbl(struct ata_port *ap) in ata_force_cbl() argument
328 if (fe->port != -1 && fe->port != ap->print_id) in ata_force_cbl()
334 ap->cbl = fe->param.cbl; in ata_force_cbl()
335 ata_port_notice(ap, "FORCE: cable set to %s\n", fe->param.name); in ata_force_cbl()
368 if (fe->port != -1 && fe->port != link->ap->print_id) in ata_force_link_limits()
417 if (fe->port != -1 && fe->port != dev->link->ap->print_id) in ata_force_xfermask()
470 if (fe->port != -1 && fe->port != dev->link->ap->print_id) in ata_force_horkage()
587 } else if (lba48 && (dev->link->ap->flags & ATA_FLAG_PIO_LBA48)) { in ata_rwcmd_protocol()
1497 struct ata_port *ap = link->ap; in ata_exec_internal_sg() local
1510 spin_lock_irqsave(ap->lock, flags); in ata_exec_internal_sg()
1513 if (ap->pflags & ATA_PFLAG_FROZEN) { in ata_exec_internal_sg()
1514 spin_unlock_irqrestore(ap->lock, flags); in ata_exec_internal_sg()
1519 qc = __ata_qc_from_tag(ap, ATA_TAG_INTERNAL); in ata_exec_internal_sg()
1524 qc->ap = ap; in ata_exec_internal_sg()
1530 preempted_qc_active = ap->qc_active; in ata_exec_internal_sg()
1531 preempted_nr_active_links = ap->nr_active_links; in ata_exec_internal_sg()
1534 ap->qc_active = 0; in ata_exec_internal_sg()
1535 ap->nr_active_links = 0; in ata_exec_internal_sg()
1565 spin_unlock_irqrestore(ap->lock, flags); in ata_exec_internal_sg()
1576 if (ap->ops->error_handler) in ata_exec_internal_sg()
1577 ata_eh_release(ap); in ata_exec_internal_sg()
1581 if (ap->ops->error_handler) in ata_exec_internal_sg()
1582 ata_eh_acquire(ap); in ata_exec_internal_sg()
1584 ata_sff_flush_pio_task(ap); in ata_exec_internal_sg()
1587 spin_lock_irqsave(ap->lock, flags); in ata_exec_internal_sg()
1597 if (ap->ops->error_handler) in ata_exec_internal_sg()
1598 ata_port_freeze(ap); in ata_exec_internal_sg()
1602 if (ata_msg_warn(ap)) in ata_exec_internal_sg()
1607 spin_unlock_irqrestore(ap->lock, flags); in ata_exec_internal_sg()
1611 if (ap->ops->post_internal_cmd) in ata_exec_internal_sg()
1612 ap->ops->post_internal_cmd(qc); in ata_exec_internal_sg()
1629 spin_lock_irqsave(ap->lock, flags); in ata_exec_internal_sg()
1637 ap->qc_active = preempted_qc_active; in ata_exec_internal_sg()
1638 ap->nr_active_links = preempted_nr_active_links; in ata_exec_internal_sg()
1640 spin_unlock_irqrestore(ap->lock, flags); in ata_exec_internal_sg()
1699 if (adev->link->ap->pflags & ATA_PFLAG_RESETTING) in ata_pio_need_iordy()
1704 if (adev->link->ap->flags & ATA_FLAG_NO_IORDY) in ata_pio_need_iordy()
1785 struct ata_port *ap = dev->link->ap; in ata_dev_read_id() local
1794 if (ata_msg_ctl(ap)) in ata_dev_read_id()
1829 if (ap->ops->read_id) in ata_dev_read_id()
1830 err_mask = ap->ops->read_id(dev, &tf, id); in ata_dev_read_id()
1900 if (ap->host->flags & ATA_HOST_IGNORE_ATA && in ata_dev_read_id()
1966 if (ata_msg_warn(ap)) in ata_dev_read_id()
1991 unsigned long ap_flags = dev->link->ap->flags; in ata_read_log_page()
2038 struct ata_port *ap = dev->link->ap; in ata_log_supported() local
2040 if (ata_read_log_page(dev, ATA_LOG_DIRECTORY, 0, ap->sector_buf, 1)) in ata_log_supported()
2042 return get_unaligned_le16(&ap->sector_buf[log * 2]) ? true : false; in ata_log_supported()
2047 struct ata_port *ap = dev->link->ap; in ata_identify_page_supported() local
2059 err = ata_read_log_page(dev, ATA_LOG_IDENTIFY_DEVICE, 0, ap->sector_buf, in ata_identify_page_supported()
2068 for (i = 0; i < ap->sector_buf[8]; i++) { in ata_identify_page_supported()
2069 if (ap->sector_buf[9 + i] == page) in ata_identify_page_supported()
2111 struct ata_port *ap = dev->link->ap; in ata_dev_knobble() local
2116 return ((ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(dev->id))); in ata_dev_knobble()
2121 struct ata_port *ap = dev->link->ap; in ata_dev_config_ncq_send_recv() local
2129 0, ap->sector_buf, 1); in ata_dev_config_ncq_send_recv()
2138 memcpy(cmds, ap->sector_buf, ATA_LOG_NCQ_SEND_RECV_SIZE); in ata_dev_config_ncq_send_recv()
2150 struct ata_port *ap = dev->link->ap; in ata_dev_config_ncq_non_data() local
2159 0, ap->sector_buf, 1); in ata_dev_config_ncq_non_data()
2167 memcpy(cmds, ap->sector_buf, ATA_LOG_NCQ_NON_DATA_SIZE); in ata_dev_config_ncq_non_data()
2173 struct ata_port *ap = dev->link->ap; in ata_dev_config_ncq_prio() local
2184 ap->sector_buf, in ata_dev_config_ncq_prio()
2193 if (ap->sector_buf[ATA_LOG_NCQ_PRIO_OFFSET] & BIT(3)) { in ata_dev_config_ncq_prio()
2224 struct ata_port *ap = dev->link->ap; in ata_dev_config_ncq() local
2246 if (ap->flags & ATA_FLAG_NCQ) { in ata_dev_config_ncq()
2247 hdepth = min(ap->scsi_host->can_queue, ATA_MAX_QUEUE); in ata_dev_config_ncq()
2252 (ap->flags & ATA_FLAG_FPDMA_AA) && in ata_dev_config_ncq()
2274 if ((ap->flags & ATA_FLAG_FPDMA_AUX)) { in ata_dev_config_ncq()
2306 struct ata_port *ap = dev->link->ap; in ata_dev_config_zac() local
2308 u8 *identify_buf = ap->sector_buf; in ata_dev_config_zac()
2360 struct ata_port *ap = dev->link->ap; in ata_dev_config_trusted() local
2374 ap->sector_buf, 1); in ata_dev_config_trusted()
2381 trusted_cap = get_unaligned_le64(&ap->sector_buf[40]); in ata_dev_config_trusted()
2407 struct ata_port *ap = dev->link->ap; in ata_dev_configure() local
2418 if (!ata_dev_enabled(dev) && ata_msg_info(ap)) { in ata_dev_configure()
2423 if (ata_msg_probe(ap)) in ata_dev_configure()
2436 if ((!atapi_enabled || (ap->flags & ATA_FLAG_NO_ATAPI)) && in ata_dev_configure()
2454 if (ap->flags & ATA_FLAG_NO_LPM) in ata_dev_configure()
2459 dev->link->ap->target_lpm_policy = ATA_LPM_MAX_POWER; in ata_dev_configure()
2473 if (ata_msg_probe(ap)) in ata_dev_configure()
2498 if (ata_msg_probe(ap)) in ata_dev_configure()
2557 if (ata_msg_drv(ap) && print_info) { in ata_dev_configure()
2582 if (ata_msg_drv(ap) && print_info) { in ata_dev_configure()
2598 u8 *sata_setting = ap->sector_buf; in ata_dev_configure()
2632 if (ata_msg_warn(ap)) in ata_dev_configure()
2645 (ap->flags & ATA_FLAG_AN) && ata_id_has_atapi_AN(id) && in ata_dev_configure()
2646 (!sata_pmp_attached(ap) || in ata_dev_configure()
2647 sata_scr_read(&ap->link, SCR_NOTIFICATION, &sntf) == 0)) { in ata_dev_configure()
2677 if (ata_msg_drv(ap) && print_info) in ata_dev_configure()
2694 if (ata_msg_drv(ap) && print_info) in ata_dev_configure()
2717 if (ap->ops->dev_config) in ata_dev_configure()
2718 ap->ops->dev_config(dev); in ata_dev_configure()
2743 if (ata_msg_probe(ap)) in ata_dev_configure()
2756 int ata_cable_40wire(struct ata_port *ap) in ata_cable_40wire() argument
2770 int ata_cable_80wire(struct ata_port *ap) in ata_cable_80wire() argument
2783 int ata_cable_unknown(struct ata_port *ap) in ata_cable_unknown() argument
2796 int ata_cable_ignore(struct ata_port *ap) in ata_cable_ignore() argument
2809 int ata_cable_sata(struct ata_port *ap) in ata_cable_sata() argument
2830 int ata_bus_probe(struct ata_port *ap) in ata_bus_probe() argument
2837 ata_for_each_dev(dev, &ap->link, ALL) in ata_bus_probe()
2841 ata_for_each_dev(dev, &ap->link, ALL) { in ata_bus_probe()
2857 if (ap->ops->set_piomode) in ata_bus_probe()
2858 ap->ops->set_piomode(ap, dev); in ata_bus_probe()
2862 ap->ops->phy_reset(ap); in ata_bus_probe()
2864 ata_for_each_dev(dev, &ap->link, ALL) { in ata_bus_probe()
2877 ata_for_each_dev(dev, &ap->link, ALL_REVERSE) { in ata_bus_probe()
2891 if (ap->ops->cable_detect) in ata_bus_probe()
2892 ap->cbl = ap->ops->cable_detect(ap); in ata_bus_probe()
2899 ata_for_each_dev(dev, &ap->link, ENABLED) in ata_bus_probe()
2901 ap->cbl = ATA_CBL_SATA; in ata_bus_probe()
2906 ata_for_each_dev(dev, &ap->link, ENABLED) { in ata_bus_probe()
2907 ap->link.eh_context.i.flags |= ATA_EHI_PRINTINFO; in ata_bus_probe()
2909 ap->link.eh_context.i.flags &= ~ATA_EHI_PRINTINFO; in ata_bus_probe()
2915 rc = ata_set_mode(&ap->link, &dev); in ata_bus_probe()
2919 ata_for_each_dev(dev, &ap->link, ENABLED) in ata_bus_probe()
2942 sata_down_spd_limit(&ap->link, 0); in ata_bus_probe()
3222 struct ata_port *ap = dev->link->ap; in ata_dev_set_mode() local
3234 if (nosetxfer && ap->flags & ATA_FLAG_SATA && ata_id_is_sata(dev->id)) in ata_dev_set_mode()
3322 struct ata_port *ap = link->ap; in ata_do_set_mode() local
3368 if (ap->ops->set_piomode) in ata_do_set_mode()
3369 ap->ops->set_piomode(ap, dev); in ata_do_set_mode()
3379 if (ap->ops->set_dmamode) in ata_do_set_mode()
3380 ap->ops->set_dmamode(ap, dev); in ata_do_set_mode()
3393 if (used_dma && (ap->host->flags & ATA_HOST_SIMPLEX)) in ata_do_set_mode()
3394 ap->host->simplex_claimed = ap; in ata_do_set_mode()
3431 if (link->ap->host->flags & ATA_HOST_PARALLEL_SCAN) in ata_wait_ready()
3440 WARN_ON(link == link->ap->slave_link); in ata_wait_ready()
3467 else if ((link->ap->flags & ATA_FLAG_SATA) && in ata_wait_ready()
3486 ata_msleep(link->ap, 50); in ata_wait_ready()
3507 ata_msleep(link->ap, ATA_WAIT_AFTER_RESET); in ata_wait_after_reset()
3532 struct ata_port *ap = link->ap; in ata_std_prereset() local
3542 if (ap->flags & ATA_FLAG_SATA) { in ata_std_prereset()
3681 u16 *id = (void *)dev->link->ap->sector_buf; in ata_dev_reread_id()
4076 if ((dev->link->ap->flags & ATA_FLAG_PIO_POLLING) && in ata_dma_blacklisted()
4110 static int cable_is_40wire(struct ata_port *ap) in cable_is_40wire() argument
4116 if (ap->cbl == ATA_CBL_PATA40) in cable_is_40wire()
4120 if (ap->cbl == ATA_CBL_PATA80 || ap->cbl == ATA_CBL_SATA) in cable_is_40wire()
4127 if (ap->cbl == ATA_CBL_PATA40_SHORT) in cable_is_40wire()
4139 ata_for_each_link(link, ap, EDGE) { in cable_is_40wire()
4163 struct ata_port *ap = link->ap; in ata_dev_xfermask() local
4164 struct ata_host *host = ap->host; in ata_dev_xfermask()
4168 xfer_mask = ata_pack_xfermask(ap->pio_mask, in ata_dev_xfermask()
4169 ap->mwdma_mask, ap->udma_mask); in ata_dev_xfermask()
4194 host->simplex_claimed && host->simplex_claimed != ap) { in ata_dev_xfermask()
4200 if (ap->flags & ATA_FLAG_NO_IORDY) in ata_dev_xfermask()
4203 if (ap->ops->mode_filter) in ata_dev_xfermask()
4204 xfer_mask = ap->ops->mode_filter(dev, xfer_mask); in ata_dev_xfermask()
4216 if (cable_is_40wire(ap)) { in ata_dev_xfermask()
4372 struct ata_port *ap = qc->ap; in atapi_check_dma() local
4381 if (ap->ops->check_atapi_dma) in atapi_check_dma()
4382 return ap->ops->check_atapi_dma(qc); in atapi_check_dma()
4458 struct ata_port *ap = qc->ap; in ata_sg_clean() local
4467 dma_unmap_sg(ap->dev, sg, qc->orig_n_elem, dir); in ata_sg_clean()
4488 struct ata_port *ap = qc->ap; in ata_sg_setup() local
4491 VPRINTK("ENTER, ata%u\n", ap->print_id); in ata_sg_setup()
4493 n_elem = dma_map_sg(ap->dev, qc->sg, qc->n_elem, qc->dma_dir); in ata_sg_setup()
4545 struct ata_port *ap = dev->link->ap; in ata_qc_new_init() local
4549 if (unlikely(ap->pflags & ATA_PFLAG_FROZEN)) in ata_qc_new_init()
4553 if (ap->flags & ATA_FLAG_SAS_HOST) { in ata_qc_new_init()
4554 tag = ata_sas_allocate_tag(ap); in ata_qc_new_init()
4559 qc = __ata_qc_from_tag(ap, tag); in ata_qc_new_init()
4562 qc->ap = ap; in ata_qc_new_init()
4582 struct ata_port *ap; in ata_qc_free() local
4586 ap = qc->ap; in ata_qc_free()
4592 if (ap->flags & ATA_FLAG_SAS_HOST) in ata_qc_free()
4593 ata_sas_free_tag(tag, ap); in ata_qc_free()
4599 struct ata_port *ap; in __ata_qc_complete() local
4604 ap = qc->ap; in __ata_qc_complete()
4614 ap->nr_active_links--; in __ata_qc_complete()
4617 ap->nr_active_links--; in __ata_qc_complete()
4622 ap->excl_link == link)) in __ata_qc_complete()
4623 ap->excl_link = NULL; in __ata_qc_complete()
4630 ap->qc_active &= ~(1ULL << qc->tag); in __ata_qc_complete()
4638 struct ata_port *ap = qc->ap; in fill_result_tf() local
4641 ap->ops->qc_fill_rtf(qc); in fill_result_tf()
4674 struct ata_port *ap = qc->ap; in ata_qc_complete() local
4692 if (ap->ops->error_handler) { in ata_qc_complete()
4721 WARN_ON_ONCE(ap->pflags & ATA_PFLAG_FROZEN); in ata_qc_complete()
4743 ata_port_schedule_eh(ap); in ata_qc_complete()
4778 u64 ata_qc_get_active(struct ata_port *ap) in ata_qc_get_active() argument
4780 u64 qc_active = ap->qc_active; in ata_qc_get_active()
4806 struct ata_port *ap = qc->ap; in ata_qc_issue() local
4814 WARN_ON_ONCE(ap->ops->error_handler && ata_tag_valid(link->active_tag)); in ata_qc_issue()
4820 ap->nr_active_links++; in ata_qc_issue()
4825 ap->nr_active_links++; in ata_qc_issue()
4830 ap->qc_active |= 1ULL << qc->tag; in ata_qc_issue()
4840 (ap->flags & ATA_FLAG_PIO_DMA))) in ata_qc_issue()
4852 qc->err_mask |= ap->ops->qc_prep(qc); in ata_qc_issue()
4856 qc->err_mask |= ap->ops->qc_issue(qc); in ata_qc_issue()
4933 struct ata_link *slave = link->ap->slave_link; in ata_link_online()
4960 struct ata_link *slave = link->ap->slave_link; in ata_link_offline()
4970 static void ata_port_request_pm(struct ata_port *ap, pm_message_t mesg, in ata_port_request_pm() argument
4980 if (ap->pflags & ATA_PFLAG_PM_PENDING) { in ata_port_request_pm()
4981 ata_port_wait_eh(ap); in ata_port_request_pm()
4982 WARN_ON(ap->pflags & ATA_PFLAG_PM_PENDING); in ata_port_request_pm()
4986 spin_lock_irqsave(ap->lock, flags); in ata_port_request_pm()
4988 ap->pm_mesg = mesg; in ata_port_request_pm()
4989 ap->pflags |= ATA_PFLAG_PM_PENDING; in ata_port_request_pm()
4990 ata_for_each_link(link, ap, HOST_FIRST) { in ata_port_request_pm()
4995 ata_port_schedule_eh(ap); in ata_port_request_pm()
4997 spin_unlock_irqrestore(ap->lock, flags); in ata_port_request_pm()
5000 ata_port_wait_eh(ap); in ata_port_request_pm()
5001 WARN_ON(ap->pflags & ATA_PFLAG_PM_PENDING); in ata_port_request_pm()
5016 static void ata_port_suspend(struct ata_port *ap, pm_message_t mesg) in ata_port_suspend() argument
5018 ata_port_request_pm(ap, mesg, 0, ata_port_suspend_ehi, false); in ata_port_suspend()
5021 static void ata_port_suspend_async(struct ata_port *ap, pm_message_t mesg) in ata_port_suspend_async() argument
5023 ata_port_request_pm(ap, mesg, 0, ata_port_suspend_ehi, true); in ata_port_suspend_async()
5028 struct ata_port *ap = to_ata_port(dev); in ata_port_pm_suspend() local
5033 ata_port_suspend(ap, PMSG_SUSPEND); in ata_port_pm_suspend()
5039 struct ata_port *ap = to_ata_port(dev); in ata_port_pm_freeze() local
5044 ata_port_suspend(ap, PMSG_FREEZE); in ata_port_pm_freeze()
5057 static void ata_port_resume(struct ata_port *ap, pm_message_t mesg) in ata_port_resume() argument
5059 ata_port_request_pm(ap, mesg, ATA_EH_RESET, ata_port_resume_ehi, false); in ata_port_resume()
5062 static void ata_port_resume_async(struct ata_port *ap, pm_message_t mesg) in ata_port_resume_async() argument
5064 ata_port_request_pm(ap, mesg, ATA_EH_RESET, ata_port_resume_ehi, true); in ata_port_resume_async()
5086 struct ata_port *ap = to_ata_port(dev); in ata_port_runtime_idle() local
5090 ata_for_each_link(link, ap, HOST_FIRST) { in ata_port_runtime_idle()
5130 void ata_sas_port_suspend(struct ata_port *ap) in ata_sas_port_suspend() argument
5132 ata_port_suspend_async(ap, PMSG_SUSPEND); in ata_sas_port_suspend()
5136 void ata_sas_port_resume(struct ata_port *ap) in ata_sas_port_resume() argument
5138 ata_port_resume_async(ap, PMSG_RESUME); in ata_sas_port_resume()
5188 struct ata_port *ap = link->ap; in ata_dev_init() local
5199 spin_lock_irqsave(ap->lock, flags); in ata_dev_init()
5202 spin_unlock_irqrestore(ap->lock, flags); in ata_dev_init()
5222 void ata_link_init(struct ata_port *ap, struct ata_link *link, int pmp) in ata_link_init() argument
5230 link->ap = ap; in ata_link_init()
5295 struct ata_port *ap; in ata_port_alloc() local
5299 ap = kzalloc(sizeof(*ap), GFP_KERNEL); in ata_port_alloc()
5300 if (!ap) in ata_port_alloc()
5303 ap->pflags |= ATA_PFLAG_INITIALIZING | ATA_PFLAG_FROZEN; in ata_port_alloc()
5304 ap->lock = &host->lock; in ata_port_alloc()
5305 ap->print_id = -1; in ata_port_alloc()
5306 ap->local_port_no = -1; in ata_port_alloc()
5307 ap->host = host; in ata_port_alloc()
5308 ap->dev = host->dev; in ata_port_alloc()
5312 ap->msg_enable = 0x00FF; in ata_port_alloc()
5314 ap->msg_enable = ATA_MSG_DRV | ATA_MSG_INFO | ATA_MSG_CTL | ATA_MSG_WARN | ATA_MSG_ERR; in ata_port_alloc()
5316 ap->msg_enable = ATA_MSG_DRV | ATA_MSG_ERR | ATA_MSG_WARN; in ata_port_alloc()
5319 mutex_init(&ap->scsi_scan_mutex); in ata_port_alloc()
5320 INIT_DELAYED_WORK(&ap->hotplug_task, ata_scsi_hotplug); in ata_port_alloc()
5321 INIT_WORK(&ap->scsi_rescan_task, ata_scsi_dev_rescan); in ata_port_alloc()
5322 INIT_LIST_HEAD(&ap->eh_done_q); in ata_port_alloc()
5323 init_waitqueue_head(&ap->eh_wait_q); in ata_port_alloc()
5324 init_completion(&ap->park_req_pending); in ata_port_alloc()
5325 timer_setup(&ap->fastdrain_timer, ata_eh_fastdrain_timerfn, in ata_port_alloc()
5328 ap->cbl = ATA_CBL_NONE; in ata_port_alloc()
5330 ata_link_init(ap, &ap->link, 0); in ata_port_alloc()
5333 ap->stats.unhandled_irq = 1; in ata_port_alloc()
5334 ap->stats.idle_irq = 1; in ata_port_alloc()
5336 ata_sff_port_init(ap); in ata_port_alloc()
5338 return ap; in ata_port_alloc()
5347 struct ata_port *ap = host->ports[i]; in ata_devres_release() local
5349 if (!ap) in ata_devres_release()
5352 if (ap->scsi_host) in ata_devres_release()
5353 scsi_host_put(ap->scsi_host); in ata_devres_release()
5367 struct ata_port *ap = host->ports[i]; in ata_host_release() local
5369 kfree(ap->pmp_link); in ata_host_release()
5370 kfree(ap->slave_link); in ata_host_release()
5371 kfree(ap); in ata_host_release()
5441 struct ata_port *ap; in ata_host_alloc() local
5443 ap = ata_port_alloc(host); in ata_host_alloc()
5444 if (!ap) in ata_host_alloc()
5447 ap->port_no = i; in ata_host_alloc()
5448 host->ports[i] = ap; in ata_host_alloc()
5491 struct ata_port *ap = host->ports[i]; in ata_host_alloc_pinfo() local
5496 ap->pio_mask = pi->pio_mask; in ata_host_alloc_pinfo()
5497 ap->mwdma_mask = pi->mwdma_mask; in ata_host_alloc_pinfo()
5498 ap->udma_mask = pi->udma_mask; in ata_host_alloc_pinfo()
5499 ap->flags |= pi->flags; in ata_host_alloc_pinfo()
5500 ap->link.flags |= pi->link_flags; in ata_host_alloc_pinfo()
5501 ap->ops = pi->port_ops; in ata_host_alloc_pinfo()
5519 struct ata_port *ap = host->ports[i]; in ata_host_stop() local
5521 if (ap->ops->port_stop) in ata_host_stop()
5522 ap->ops->port_stop(ap); in ata_host_stop()
5607 struct ata_port *ap = host->ports[i]; in ata_host_start() local
5609 ata_finalize_port_ops(ap->ops); in ata_host_start()
5611 if (!host->ops && !ata_port_is_dummy(ap)) in ata_host_start()
5612 host->ops = ap->ops; in ata_host_start()
5614 if (ap->ops->port_stop) in ata_host_start()
5628 struct ata_port *ap = host->ports[i]; in ata_host_start() local
5630 if (ap->ops->port_start) { in ata_host_start()
5631 rc = ap->ops->port_start(ap); in ata_host_start()
5640 ata_eh_freeze_port(ap); in ata_host_start()
5650 struct ata_port *ap = host->ports[i]; in ata_host_start() local
5652 if (ap->ops->port_stop) in ata_host_start()
5653 ap->ops->port_stop(ap); in ata_host_start()
5679 void __ata_port_probe(struct ata_port *ap) in __ata_port_probe() argument
5681 struct ata_eh_info *ehi = &ap->link.eh_info; in __ata_port_probe()
5685 spin_lock_irqsave(ap->lock, flags); in __ata_port_probe()
5691 ap->pflags &= ~ATA_PFLAG_INITIALIZING; in __ata_port_probe()
5692 ap->pflags |= ATA_PFLAG_LOADING; in __ata_port_probe()
5693 ata_port_schedule_eh(ap); in __ata_port_probe()
5695 spin_unlock_irqrestore(ap->lock, flags); in __ata_port_probe()
5698 int ata_port_probe(struct ata_port *ap) in ata_port_probe() argument
5702 if (ap->ops->error_handler) { in ata_port_probe()
5703 __ata_port_probe(ap); in ata_port_probe()
5704 ata_port_wait_eh(ap); in ata_port_probe()
5706 DPRINTK("ata%u: bus probe begin\n", ap->print_id); in ata_port_probe()
5707 rc = ata_bus_probe(ap); in ata_port_probe()
5708 DPRINTK("ata%u: bus probe end\n", ap->print_id); in ata_port_probe()
5716 struct ata_port *ap = data; in async_port_probe() local
5725 if (!(ap->host->flags & ATA_HOST_PARALLEL_SCAN) && ap->port_no != 0) in async_port_probe()
5728 (void)ata_port_probe(ap); in async_port_probe()
5733 ata_scsi_scan_host(ap, 1); in async_port_probe()
5792 struct ata_port *ap = host->ports[i]; in ata_host_register() local
5796 if (ap->cbl == ATA_CBL_NONE && (ap->flags & ATA_FLAG_SATA)) in ata_host_register()
5797 ap->cbl = ATA_CBL_SATA; in ata_host_register()
5800 sata_link_init_spd(&ap->link); in ata_host_register()
5801 if (ap->slave_link) in ata_host_register()
5802 sata_link_init_spd(ap->slave_link); in ata_host_register()
5805 xfer_mask = ata_pack_xfermask(ap->pio_mask, ap->mwdma_mask, in ata_host_register()
5806 ap->udma_mask); in ata_host_register()
5808 if (!ata_port_is_dummy(ap)) { in ata_host_register()
5809 ata_port_info(ap, "%cATA max %s %s\n", in ata_host_register()
5810 (ap->flags & ATA_FLAG_SATA) ? 'S' : 'P', in ata_host_register()
5812 ap->link.eh_info.desc); in ata_host_register()
5813 ata_ehi_clear_desc(&ap->link.eh_info); in ata_host_register()
5815 ata_port_info(ap, "DUMMY\n"); in ata_host_register()
5820 struct ata_port *ap = host->ports[i]; in ata_host_register() local
5821 ap->cookie = async_schedule(async_port_probe, ap); in ata_host_register()
5909 static void ata_port_detach(struct ata_port *ap) in ata_port_detach() argument
5915 if (!ap->ops->error_handler) in ata_port_detach()
5919 spin_lock_irqsave(ap->lock, flags); in ata_port_detach()
5920 ap->pflags |= ATA_PFLAG_UNLOADING; in ata_port_detach()
5921 ata_port_schedule_eh(ap); in ata_port_detach()
5922 spin_unlock_irqrestore(ap->lock, flags); in ata_port_detach()
5925 ata_port_wait_eh(ap); in ata_port_detach()
5928 WARN_ON(!(ap->pflags & ATA_PFLAG_UNLOADED)); in ata_port_detach()
5930 cancel_delayed_work_sync(&ap->hotplug_task); in ata_port_detach()
5934 ata_for_each_link(link, ap, HOST_FIRST) { in ata_port_detach()
5940 if (ap->pmp_link) { in ata_port_detach()
5943 ata_tlink_delete(&ap->pmp_link[i]); in ata_port_detach()
5946 scsi_remove_host(ap->scsi_host); in ata_port_detach()
5947 ata_tport_delete(ap); in ata_port_detach()
6001 struct ata_port *ap = host->ports[i]; in ata_pci_shutdown_one() local
6003 ap->pflags |= ATA_PFLAG_FROZEN; in ata_pci_shutdown_one()
6006 if (ap->ops->freeze) in ata_pci_shutdown_one()
6007 ap->ops->freeze(ap); in ata_pci_shutdown_one()
6010 if (ap->ops->port_stop) in ata_pci_shutdown_one()
6011 ap->ops->port_stop(ap); in ata_pci_shutdown_one()
6382 void ata_msleep(struct ata_port *ap, unsigned int msecs) in ata_msleep() argument
6384 bool owns_eh = ap && ap->host->eh_owner == current; in ata_msleep()
6387 ata_eh_release(ap); in ata_msleep()
6397 ata_eh_acquire(ap); in ata_msleep()
6425 u32 ata_wait_register(struct ata_port *ap, void __iomem *reg, u32 mask, u32 val, in ata_wait_register() argument
6440 ata_msleep(ap, interval); in ata_wait_register()
6456 static void ata_dummy_error_handler(struct ata_port *ap) in ata_dummy_error_handler() argument
6478 void ata_port_printk(const struct ata_port *ap, const char *level, in ata_port_printk() argument
6489 printk("%sata%u: %pV", level, ap->print_id, &vaf); in ata_port_printk()
6506 if (sata_pmp_attached(link->ap) || link->ap->slave_link) in ata_link_printk()
6508 level, link->ap->print_id, link->pmp, &vaf); in ata_link_printk()
6511 level, link->ap->print_id, &vaf); in ata_link_printk()
6529 level, dev->link->ap->print_id, dev->link->pmp + dev->devno, in ata_dev_printk()