Lines Matching refs:ap
186 struct ata_link *ata_link_next(struct ata_link *link, struct ata_port *ap, in ata_link_next() argument
197 if (sata_pmp_attached(ap)) in ata_link_next()
198 return ap->pmp_link; in ata_link_next()
201 return &ap->link; in ata_link_next()
205 if (link == &ap->link) in ata_link_next()
208 if (sata_pmp_attached(ap)) in ata_link_next()
209 return ap->pmp_link; in ata_link_next()
212 if (unlikely(ap->slave_link)) in ata_link_next()
213 return ap->slave_link; in ata_link_next()
220 if (unlikely(link == ap->slave_link)) in ata_link_next()
224 if (++link < ap->pmp_link + ap->nr_pmp_links) in ata_link_next()
228 return &ap->link; in ata_link_next()
304 struct ata_port *ap = dev->link->ap; in ata_dev_phys_link() local
306 if (!ap->slave_link) in ata_dev_phys_link()
309 return &ap->link; in ata_dev_phys_link()
310 return ap->slave_link; in ata_dev_phys_link()
327 void ata_force_cbl(struct ata_port *ap) in ata_force_cbl() argument
334 if (fe->port != -1 && fe->port != ap->print_id) in ata_force_cbl()
340 ap->cbl = fe->param.cbl; in ata_force_cbl()
341 ata_port_notice(ap, "FORCE: cable set to %s\n", fe->param.name); in ata_force_cbl()
374 if (fe->port != -1 && fe->port != link->ap->print_id) in ata_force_link_limits()
423 if (fe->port != -1 && fe->port != dev->link->ap->print_id) in ata_force_xfermask()
476 if (fe->port != -1 && fe->port != dev->link->ap->print_id) in ata_force_horkage()
593 } else if (lba48 && (dev->link->ap->flags & ATA_FLAG_PIO_LBA48)) { in ata_rwcmd_protocol()
1500 struct ata_port *ap = link->ap; in ata_exec_internal_sg() local
1513 spin_lock_irqsave(ap->lock, flags); in ata_exec_internal_sg()
1516 if (ap->pflags & ATA_PFLAG_FROZEN) { in ata_exec_internal_sg()
1517 spin_unlock_irqrestore(ap->lock, flags); in ata_exec_internal_sg()
1522 qc = __ata_qc_from_tag(ap, ATA_TAG_INTERNAL); in ata_exec_internal_sg()
1527 qc->ap = ap; in ata_exec_internal_sg()
1533 preempted_qc_active = ap->qc_active; in ata_exec_internal_sg()
1534 preempted_nr_active_links = ap->nr_active_links; in ata_exec_internal_sg()
1537 ap->qc_active = 0; in ata_exec_internal_sg()
1538 ap->nr_active_links = 0; in ata_exec_internal_sg()
1568 spin_unlock_irqrestore(ap->lock, flags); in ata_exec_internal_sg()
1579 if (ap->ops->error_handler) in ata_exec_internal_sg()
1580 ata_eh_release(ap); in ata_exec_internal_sg()
1584 if (ap->ops->error_handler) in ata_exec_internal_sg()
1585 ata_eh_acquire(ap); in ata_exec_internal_sg()
1587 ata_sff_flush_pio_task(ap); in ata_exec_internal_sg()
1590 spin_lock_irqsave(ap->lock, flags); in ata_exec_internal_sg()
1600 if (ap->ops->error_handler) in ata_exec_internal_sg()
1601 ata_port_freeze(ap); in ata_exec_internal_sg()
1605 if (ata_msg_warn(ap)) in ata_exec_internal_sg()
1610 spin_unlock_irqrestore(ap->lock, flags); in ata_exec_internal_sg()
1614 if (ap->ops->post_internal_cmd) in ata_exec_internal_sg()
1615 ap->ops->post_internal_cmd(qc); in ata_exec_internal_sg()
1632 spin_lock_irqsave(ap->lock, flags); in ata_exec_internal_sg()
1640 ap->qc_active = preempted_qc_active; in ata_exec_internal_sg()
1641 ap->nr_active_links = preempted_nr_active_links; in ata_exec_internal_sg()
1643 spin_unlock_irqrestore(ap->lock, flags); in ata_exec_internal_sg()
1702 if (adev->link->ap->pflags & ATA_PFLAG_RESETTING) in ata_pio_need_iordy()
1707 if (adev->link->ap->flags & ATA_FLAG_NO_IORDY) in ata_pio_need_iordy()
1788 struct ata_port *ap = dev->link->ap; in ata_dev_read_id() local
1797 if (ata_msg_ctl(ap)) in ata_dev_read_id()
1832 if (ap->ops->read_id) in ata_dev_read_id()
1833 err_mask = ap->ops->read_id(dev, &tf, id); in ata_dev_read_id()
1903 if (ap->host->flags & ATA_HOST_IGNORE_ATA && in ata_dev_read_id()
1969 if (ata_msg_warn(ap)) in ata_dev_read_id()
1994 unsigned long ap_flags = dev->link->ap->flags; in ata_read_log_page()
2044 struct ata_port *ap = dev->link->ap; in ata_log_supported() local
2046 if (ata_read_log_page(dev, ATA_LOG_DIRECTORY, 0, ap->sector_buf, 1)) in ata_log_supported()
2048 return get_unaligned_le16(&ap->sector_buf[log * 2]) ? true : false; in ata_log_supported()
2053 struct ata_port *ap = dev->link->ap; in ata_identify_page_supported() local
2076 err = ata_read_log_page(dev, ATA_LOG_IDENTIFY_DEVICE, 0, ap->sector_buf, in ata_identify_page_supported()
2081 for (i = 0; i < ap->sector_buf[8]; i++) { in ata_identify_page_supported()
2082 if (ap->sector_buf[9 + i] == page) in ata_identify_page_supported()
2124 struct ata_port *ap = dev->link->ap; in ata_dev_knobble() local
2129 return ((ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(dev->id))); in ata_dev_knobble()
2134 struct ata_port *ap = dev->link->ap; in ata_dev_config_ncq_send_recv() local
2142 0, ap->sector_buf, 1); in ata_dev_config_ncq_send_recv()
2147 memcpy(cmds, ap->sector_buf, ATA_LOG_NCQ_SEND_RECV_SIZE); in ata_dev_config_ncq_send_recv()
2159 struct ata_port *ap = dev->link->ap; in ata_dev_config_ncq_non_data() local
2168 0, ap->sector_buf, 1); in ata_dev_config_ncq_non_data()
2172 memcpy(cmds, ap->sector_buf, ATA_LOG_NCQ_NON_DATA_SIZE); in ata_dev_config_ncq_non_data()
2178 struct ata_port *ap = dev->link->ap; in ata_dev_config_ncq_prio() local
2187 ap->sector_buf, in ata_dev_config_ncq_prio()
2192 if (!(ap->sector_buf[ATA_LOG_NCQ_PRIO_OFFSET] & BIT(3))) in ata_dev_config_ncq_prio()
2226 struct ata_port *ap = dev->link->ap; in ata_dev_config_ncq() local
2248 if (ap->flags & ATA_FLAG_NCQ) { in ata_dev_config_ncq()
2249 hdepth = min(ap->scsi_host->can_queue, ATA_MAX_QUEUE); in ata_dev_config_ncq()
2254 (ap->flags & ATA_FLAG_FPDMA_AA) && in ata_dev_config_ncq()
2276 if ((ap->flags & ATA_FLAG_FPDMA_AUX)) { in ata_dev_config_ncq()
2308 struct ata_port *ap = dev->link->ap; in ata_dev_config_zac() local
2310 u8 *identify_buf = ap->sector_buf; in ata_dev_config_zac()
2362 struct ata_port *ap = dev->link->ap; in ata_dev_config_trusted() local
2376 ap->sector_buf, 1); in ata_dev_config_trusted()
2380 trusted_cap = get_unaligned_le64(&ap->sector_buf[40]); in ata_dev_config_trusted()
2393 struct ata_port *ap = dev->link->ap; in ata_dev_config_lba() local
2415 if (ata_msg_drv(ap) && ata_dev_print_info(dev)) in ata_dev_config_lba()
2426 struct ata_port *ap = dev->link->ap; in ata_dev_config_chs() local
2442 if (ata_msg_drv(ap) && ata_dev_print_info(dev)) in ata_dev_config_chs()
2452 u8 *sata_setting = dev->link->ap->sector_buf; in ata_dev_config_devslp()
2559 struct ata_port *ap = dev->link->ap; in ata_dev_configure() local
2569 if (!ata_dev_enabled(dev) && ata_msg_info(ap)) { in ata_dev_configure()
2574 if (ata_msg_probe(ap)) in ata_dev_configure()
2587 if ((!atapi_enabled || (ap->flags & ATA_FLAG_NO_ATAPI)) && in ata_dev_configure()
2605 if (ap->flags & ATA_FLAG_NO_LPM) in ata_dev_configure()
2610 dev->link->ap->target_lpm_policy = ATA_LPM_MAX_POWER; in ata_dev_configure()
2624 if (ata_msg_probe(ap)) in ata_dev_configure()
2649 if (ata_msg_probe(ap)) in ata_dev_configure()
2688 if (ata_msg_drv(ap) && print_info) in ata_dev_configure()
2708 if (ata_msg_drv(ap) && print_info) in ata_dev_configure()
2721 if (ata_msg_warn(ap)) in ata_dev_configure()
2734 (ap->flags & ATA_FLAG_AN) && ata_id_has_atapi_AN(id) && in ata_dev_configure()
2735 (!sata_pmp_attached(ap) || in ata_dev_configure()
2736 sata_scr_read(&ap->link, SCR_NOTIFICATION, &sntf) == 0)) { in ata_dev_configure()
2766 if (ata_msg_drv(ap) && print_info) in ata_dev_configure()
2783 if (ata_msg_drv(ap) && print_info) in ata_dev_configure()
2806 if (ap->ops->dev_config) in ata_dev_configure()
2807 ap->ops->dev_config(dev); in ata_dev_configure()
2832 if (ata_msg_probe(ap)) in ata_dev_configure()
2845 int ata_cable_40wire(struct ata_port *ap) in ata_cable_40wire() argument
2859 int ata_cable_80wire(struct ata_port *ap) in ata_cable_80wire() argument
2872 int ata_cable_unknown(struct ata_port *ap) in ata_cable_unknown() argument
2885 int ata_cable_ignore(struct ata_port *ap) in ata_cable_ignore() argument
2898 int ata_cable_sata(struct ata_port *ap) in ata_cable_sata() argument
2919 int ata_bus_probe(struct ata_port *ap) in ata_bus_probe() argument
2926 ata_for_each_dev(dev, &ap->link, ALL) in ata_bus_probe()
2930 ata_for_each_dev(dev, &ap->link, ALL) { in ata_bus_probe()
2946 if (ap->ops->set_piomode) in ata_bus_probe()
2947 ap->ops->set_piomode(ap, dev); in ata_bus_probe()
2951 ap->ops->phy_reset(ap); in ata_bus_probe()
2953 ata_for_each_dev(dev, &ap->link, ALL) { in ata_bus_probe()
2966 ata_for_each_dev(dev, &ap->link, ALL_REVERSE) { in ata_bus_probe()
2980 if (ap->ops->cable_detect) in ata_bus_probe()
2981 ap->cbl = ap->ops->cable_detect(ap); in ata_bus_probe()
2988 ata_for_each_dev(dev, &ap->link, ENABLED) in ata_bus_probe()
2990 ap->cbl = ATA_CBL_SATA; in ata_bus_probe()
2995 ata_for_each_dev(dev, &ap->link, ENABLED) { in ata_bus_probe()
2996 ap->link.eh_context.i.flags |= ATA_EHI_PRINTINFO; in ata_bus_probe()
2998 ap->link.eh_context.i.flags &= ~ATA_EHI_PRINTINFO; in ata_bus_probe()
3004 rc = ata_set_mode(&ap->link, &dev); in ata_bus_probe()
3008 ata_for_each_dev(dev, &ap->link, ENABLED) in ata_bus_probe()
3031 sata_down_spd_limit(&ap->link, 0); in ata_bus_probe()
3311 struct ata_port *ap = dev->link->ap; in ata_dev_set_mode() local
3323 if (nosetxfer && ap->flags & ATA_FLAG_SATA && ata_id_is_sata(dev->id)) in ata_dev_set_mode()
3411 struct ata_port *ap = link->ap; in ata_do_set_mode() local
3457 if (ap->ops->set_piomode) in ata_do_set_mode()
3458 ap->ops->set_piomode(ap, dev); in ata_do_set_mode()
3468 if (ap->ops->set_dmamode) in ata_do_set_mode()
3469 ap->ops->set_dmamode(ap, dev); in ata_do_set_mode()
3482 if (used_dma && (ap->host->flags & ATA_HOST_SIMPLEX)) in ata_do_set_mode()
3483 ap->host->simplex_claimed = ap; in ata_do_set_mode()
3520 if (link->ap->host->flags & ATA_HOST_PARALLEL_SCAN) in ata_wait_ready()
3529 WARN_ON(link == link->ap->slave_link); in ata_wait_ready()
3556 else if ((link->ap->flags & ATA_FLAG_SATA) && in ata_wait_ready()
3575 ata_msleep(link->ap, 50); in ata_wait_ready()
3596 ata_msleep(link->ap, ATA_WAIT_AFTER_RESET); in ata_wait_after_reset()
3621 struct ata_port *ap = link->ap; in ata_std_prereset() local
3631 if (ap->flags & ATA_FLAG_SATA) { in ata_std_prereset()
3770 u16 *id = (void *)dev->link->ap->sector_buf; in ata_dev_reread_id()
4157 if ((dev->link->ap->flags & ATA_FLAG_PIO_POLLING) && in ata_dma_blacklisted()
4191 static int cable_is_40wire(struct ata_port *ap) in cable_is_40wire() argument
4197 if (ap->cbl == ATA_CBL_PATA40) in cable_is_40wire()
4201 if (ap->cbl == ATA_CBL_PATA80 || ap->cbl == ATA_CBL_SATA) in cable_is_40wire()
4208 if (ap->cbl == ATA_CBL_PATA40_SHORT) in cable_is_40wire()
4220 ata_for_each_link(link, ap, EDGE) { in cable_is_40wire()
4244 struct ata_port *ap = link->ap; in ata_dev_xfermask() local
4245 struct ata_host *host = ap->host; in ata_dev_xfermask()
4249 xfer_mask = ata_pack_xfermask(ap->pio_mask, in ata_dev_xfermask()
4250 ap->mwdma_mask, ap->udma_mask); in ata_dev_xfermask()
4275 host->simplex_claimed && host->simplex_claimed != ap) { in ata_dev_xfermask()
4281 if (ap->flags & ATA_FLAG_NO_IORDY) in ata_dev_xfermask()
4284 if (ap->ops->mode_filter) in ata_dev_xfermask()
4285 xfer_mask = ap->ops->mode_filter(dev, xfer_mask); in ata_dev_xfermask()
4297 if (cable_is_40wire(ap)) { in ata_dev_xfermask()
4453 struct ata_port *ap = qc->ap; in atapi_check_dma() local
4462 if (ap->ops->check_atapi_dma) in atapi_check_dma()
4463 return ap->ops->check_atapi_dma(qc); in atapi_check_dma()
4539 struct ata_port *ap = qc->ap; in ata_sg_clean() local
4548 dma_unmap_sg(ap->dev, sg, qc->orig_n_elem, dir); in ata_sg_clean()
4569 struct ata_port *ap = qc->ap; in ata_sg_setup() local
4572 VPRINTK("ENTER, ata%u\n", ap->print_id); in ata_sg_setup()
4574 n_elem = dma_map_sg(ap->dev, qc->sg, qc->n_elem, qc->dma_dir); in ata_sg_setup()
4626 struct ata_port *ap = dev->link->ap; in ata_qc_new_init() local
4630 if (unlikely(ap->pflags & ATA_PFLAG_FROZEN)) in ata_qc_new_init()
4634 if (ap->flags & ATA_FLAG_SAS_HOST) { in ata_qc_new_init()
4635 tag = ata_sas_allocate_tag(ap); in ata_qc_new_init()
4640 qc = __ata_qc_from_tag(ap, tag); in ata_qc_new_init()
4643 qc->ap = ap; in ata_qc_new_init()
4663 struct ata_port *ap; in ata_qc_free() local
4667 ap = qc->ap; in ata_qc_free()
4673 if (ap->flags & ATA_FLAG_SAS_HOST) in ata_qc_free()
4674 ata_sas_free_tag(tag, ap); in ata_qc_free()
4680 struct ata_port *ap; in __ata_qc_complete() local
4685 ap = qc->ap; in __ata_qc_complete()
4695 ap->nr_active_links--; in __ata_qc_complete()
4698 ap->nr_active_links--; in __ata_qc_complete()
4703 ap->excl_link == link)) in __ata_qc_complete()
4704 ap->excl_link = NULL; in __ata_qc_complete()
4711 ap->qc_active &= ~(1ULL << qc->tag); in __ata_qc_complete()
4719 struct ata_port *ap = qc->ap; in fill_result_tf() local
4722 ap->ops->qc_fill_rtf(qc); in fill_result_tf()
4755 struct ata_port *ap = qc->ap; in ata_qc_complete() local
4773 if (ap->ops->error_handler) { in ata_qc_complete()
4802 WARN_ON_ONCE(ap->pflags & ATA_PFLAG_FROZEN); in ata_qc_complete()
4824 ata_port_schedule_eh(ap); in ata_qc_complete()
4859 u64 ata_qc_get_active(struct ata_port *ap) in ata_qc_get_active() argument
4861 u64 qc_active = ap->qc_active; in ata_qc_get_active()
4887 struct ata_port *ap = qc->ap; in ata_qc_issue() local
4895 WARN_ON_ONCE(ap->ops->error_handler && ata_tag_valid(link->active_tag)); in ata_qc_issue()
4901 ap->nr_active_links++; in ata_qc_issue()
4906 ap->nr_active_links++; in ata_qc_issue()
4911 ap->qc_active |= 1ULL << qc->tag; in ata_qc_issue()
4921 (ap->flags & ATA_FLAG_PIO_DMA))) in ata_qc_issue()
4933 qc->err_mask |= ap->ops->qc_prep(qc); in ata_qc_issue()
4937 qc->err_mask |= ap->ops->qc_issue(qc); in ata_qc_issue()
5014 struct ata_link *slave = link->ap->slave_link; in ata_link_online()
5041 struct ata_link *slave = link->ap->slave_link; in ata_link_offline()
5051 static void ata_port_request_pm(struct ata_port *ap, pm_message_t mesg, in ata_port_request_pm() argument
5061 if (ap->pflags & ATA_PFLAG_PM_PENDING) { in ata_port_request_pm()
5062 ata_port_wait_eh(ap); in ata_port_request_pm()
5063 WARN_ON(ap->pflags & ATA_PFLAG_PM_PENDING); in ata_port_request_pm()
5067 spin_lock_irqsave(ap->lock, flags); in ata_port_request_pm()
5069 ap->pm_mesg = mesg; in ata_port_request_pm()
5070 ap->pflags |= ATA_PFLAG_PM_PENDING; in ata_port_request_pm()
5071 ata_for_each_link(link, ap, HOST_FIRST) { in ata_port_request_pm()
5076 ata_port_schedule_eh(ap); in ata_port_request_pm()
5078 spin_unlock_irqrestore(ap->lock, flags); in ata_port_request_pm()
5081 ata_port_wait_eh(ap); in ata_port_request_pm()
5082 WARN_ON(ap->pflags & ATA_PFLAG_PM_PENDING); in ata_port_request_pm()
5097 static void ata_port_suspend(struct ata_port *ap, pm_message_t mesg) in ata_port_suspend() argument
5099 ata_port_request_pm(ap, mesg, 0, ata_port_suspend_ehi, false); in ata_port_suspend()
5102 static void ata_port_suspend_async(struct ata_port *ap, pm_message_t mesg) in ata_port_suspend_async() argument
5104 ata_port_request_pm(ap, mesg, 0, ata_port_suspend_ehi, true); in ata_port_suspend_async()
5109 struct ata_port *ap = to_ata_port(dev); in ata_port_pm_suspend() local
5114 ata_port_suspend(ap, PMSG_SUSPEND); in ata_port_pm_suspend()
5120 struct ata_port *ap = to_ata_port(dev); in ata_port_pm_freeze() local
5125 ata_port_suspend(ap, PMSG_FREEZE); in ata_port_pm_freeze()
5138 static void ata_port_resume(struct ata_port *ap, pm_message_t mesg) in ata_port_resume() argument
5140 ata_port_request_pm(ap, mesg, ATA_EH_RESET, ata_port_resume_ehi, false); in ata_port_resume()
5143 static void ata_port_resume_async(struct ata_port *ap, pm_message_t mesg) in ata_port_resume_async() argument
5145 ata_port_request_pm(ap, mesg, ATA_EH_RESET, ata_port_resume_ehi, true); in ata_port_resume_async()
5167 struct ata_port *ap = to_ata_port(dev); in ata_port_runtime_idle() local
5171 ata_for_each_link(link, ap, HOST_FIRST) { in ata_port_runtime_idle()
5211 void ata_sas_port_suspend(struct ata_port *ap) in ata_sas_port_suspend() argument
5213 ata_port_suspend_async(ap, PMSG_SUSPEND); in ata_sas_port_suspend()
5217 void ata_sas_port_resume(struct ata_port *ap) in ata_sas_port_resume() argument
5219 ata_port_resume_async(ap, PMSG_RESUME); in ata_sas_port_resume()
5269 struct ata_port *ap = link->ap; in ata_dev_init() local
5280 spin_lock_irqsave(ap->lock, flags); in ata_dev_init()
5283 spin_unlock_irqrestore(ap->lock, flags); in ata_dev_init()
5303 void ata_link_init(struct ata_port *ap, struct ata_link *link, int pmp) in ata_link_init() argument
5311 link->ap = ap; in ata_link_init()
5376 struct ata_port *ap; in ata_port_alloc() local
5380 ap = kzalloc(sizeof(*ap), GFP_KERNEL); in ata_port_alloc()
5381 if (!ap) in ata_port_alloc()
5384 ap->pflags |= ATA_PFLAG_INITIALIZING | ATA_PFLAG_FROZEN; in ata_port_alloc()
5385 ap->lock = &host->lock; in ata_port_alloc()
5386 ap->print_id = -1; in ata_port_alloc()
5387 ap->local_port_no = -1; in ata_port_alloc()
5388 ap->host = host; in ata_port_alloc()
5389 ap->dev = host->dev; in ata_port_alloc()
5393 ap->msg_enable = 0x00FF; in ata_port_alloc()
5395 ap->msg_enable = ATA_MSG_DRV | ATA_MSG_INFO | ATA_MSG_CTL | ATA_MSG_WARN | ATA_MSG_ERR; in ata_port_alloc()
5397 ap->msg_enable = ATA_MSG_DRV | ATA_MSG_ERR | ATA_MSG_WARN; in ata_port_alloc()
5400 mutex_init(&ap->scsi_scan_mutex); in ata_port_alloc()
5401 INIT_DELAYED_WORK(&ap->hotplug_task, ata_scsi_hotplug); in ata_port_alloc()
5402 INIT_WORK(&ap->scsi_rescan_task, ata_scsi_dev_rescan); in ata_port_alloc()
5403 INIT_LIST_HEAD(&ap->eh_done_q); in ata_port_alloc()
5404 init_waitqueue_head(&ap->eh_wait_q); in ata_port_alloc()
5405 init_completion(&ap->park_req_pending); in ata_port_alloc()
5406 timer_setup(&ap->fastdrain_timer, ata_eh_fastdrain_timerfn, in ata_port_alloc()
5409 ap->cbl = ATA_CBL_NONE; in ata_port_alloc()
5411 ata_link_init(ap, &ap->link, 0); in ata_port_alloc()
5414 ap->stats.unhandled_irq = 1; in ata_port_alloc()
5415 ap->stats.idle_irq = 1; in ata_port_alloc()
5417 ata_sff_port_init(ap); in ata_port_alloc()
5419 return ap; in ata_port_alloc()
5428 struct ata_port *ap = host->ports[i]; in ata_devres_release() local
5430 if (!ap) in ata_devres_release()
5433 if (ap->scsi_host) in ata_devres_release()
5434 scsi_host_put(ap->scsi_host); in ata_devres_release()
5448 struct ata_port *ap = host->ports[i]; in ata_host_release() local
5450 kfree(ap->pmp_link); in ata_host_release()
5451 kfree(ap->slave_link); in ata_host_release()
5452 kfree(ap); in ata_host_release()
5522 struct ata_port *ap; in ata_host_alloc() local
5524 ap = ata_port_alloc(host); in ata_host_alloc()
5525 if (!ap) in ata_host_alloc()
5528 ap->port_no = i; in ata_host_alloc()
5529 host->ports[i] = ap; in ata_host_alloc()
5572 struct ata_port *ap = host->ports[i]; in ata_host_alloc_pinfo() local
5577 ap->pio_mask = pi->pio_mask; in ata_host_alloc_pinfo()
5578 ap->mwdma_mask = pi->mwdma_mask; in ata_host_alloc_pinfo()
5579 ap->udma_mask = pi->udma_mask; in ata_host_alloc_pinfo()
5580 ap->flags |= pi->flags; in ata_host_alloc_pinfo()
5581 ap->link.flags |= pi->link_flags; in ata_host_alloc_pinfo()
5582 ap->ops = pi->port_ops; in ata_host_alloc_pinfo()
5600 struct ata_port *ap = host->ports[i]; in ata_host_stop() local
5602 if (ap->ops->port_stop) in ata_host_stop()
5603 ap->ops->port_stop(ap); in ata_host_stop()
5688 struct ata_port *ap = host->ports[i]; in ata_host_start() local
5690 ata_finalize_port_ops(ap->ops); in ata_host_start()
5692 if (!host->ops && !ata_port_is_dummy(ap)) in ata_host_start()
5693 host->ops = ap->ops; in ata_host_start()
5695 if (ap->ops->port_stop) in ata_host_start()
5709 struct ata_port *ap = host->ports[i]; in ata_host_start() local
5711 if (ap->ops->port_start) { in ata_host_start()
5712 rc = ap->ops->port_start(ap); in ata_host_start()
5721 ata_eh_freeze_port(ap); in ata_host_start()
5731 struct ata_port *ap = host->ports[i]; in ata_host_start() local
5733 if (ap->ops->port_stop) in ata_host_start()
5734 ap->ops->port_stop(ap); in ata_host_start()
5760 void __ata_port_probe(struct ata_port *ap) in __ata_port_probe() argument
5762 struct ata_eh_info *ehi = &ap->link.eh_info; in __ata_port_probe()
5766 spin_lock_irqsave(ap->lock, flags); in __ata_port_probe()
5772 ap->pflags &= ~ATA_PFLAG_INITIALIZING; in __ata_port_probe()
5773 ap->pflags |= ATA_PFLAG_LOADING; in __ata_port_probe()
5774 ata_port_schedule_eh(ap); in __ata_port_probe()
5776 spin_unlock_irqrestore(ap->lock, flags); in __ata_port_probe()
5779 int ata_port_probe(struct ata_port *ap) in ata_port_probe() argument
5783 if (ap->ops->error_handler) { in ata_port_probe()
5784 __ata_port_probe(ap); in ata_port_probe()
5785 ata_port_wait_eh(ap); in ata_port_probe()
5787 DPRINTK("ata%u: bus probe begin\n", ap->print_id); in ata_port_probe()
5788 rc = ata_bus_probe(ap); in ata_port_probe()
5789 DPRINTK("ata%u: bus probe end\n", ap->print_id); in ata_port_probe()
5797 struct ata_port *ap = data; in async_port_probe() local
5806 if (!(ap->host->flags & ATA_HOST_PARALLEL_SCAN) && ap->port_no != 0) in async_port_probe()
5809 (void)ata_port_probe(ap); in async_port_probe()
5814 ata_scsi_scan_host(ap, 1); in async_port_probe()
5873 struct ata_port *ap = host->ports[i]; in ata_host_register() local
5877 if (ap->cbl == ATA_CBL_NONE && (ap->flags & ATA_FLAG_SATA)) in ata_host_register()
5878 ap->cbl = ATA_CBL_SATA; in ata_host_register()
5881 sata_link_init_spd(&ap->link); in ata_host_register()
5882 if (ap->slave_link) in ata_host_register()
5883 sata_link_init_spd(ap->slave_link); in ata_host_register()
5886 xfer_mask = ata_pack_xfermask(ap->pio_mask, ap->mwdma_mask, in ata_host_register()
5887 ap->udma_mask); in ata_host_register()
5889 if (!ata_port_is_dummy(ap)) { in ata_host_register()
5890 ata_port_info(ap, "%cATA max %s %s\n", in ata_host_register()
5891 (ap->flags & ATA_FLAG_SATA) ? 'S' : 'P', in ata_host_register()
5893 ap->link.eh_info.desc); in ata_host_register()
5894 ata_ehi_clear_desc(&ap->link.eh_info); in ata_host_register()
5896 ata_port_info(ap, "DUMMY\n"); in ata_host_register()
5901 struct ata_port *ap = host->ports[i]; in ata_host_register() local
5902 ap->cookie = async_schedule(async_port_probe, ap); in ata_host_register()
5990 static void ata_port_detach(struct ata_port *ap) in ata_port_detach() argument
5996 if (!ap->ops->error_handler) in ata_port_detach()
6000 spin_lock_irqsave(ap->lock, flags); in ata_port_detach()
6001 ap->pflags |= ATA_PFLAG_UNLOADING; in ata_port_detach()
6002 ata_port_schedule_eh(ap); in ata_port_detach()
6003 spin_unlock_irqrestore(ap->lock, flags); in ata_port_detach()
6006 ata_port_wait_eh(ap); in ata_port_detach()
6009 WARN_ON(!(ap->pflags & ATA_PFLAG_UNLOADED)); in ata_port_detach()
6011 cancel_delayed_work_sync(&ap->hotplug_task); in ata_port_detach()
6015 ata_for_each_link(link, ap, HOST_FIRST) { in ata_port_detach()
6021 if (ap->pmp_link) { in ata_port_detach()
6024 ata_tlink_delete(&ap->pmp_link[i]); in ata_port_detach()
6027 scsi_remove_host(ap->scsi_host); in ata_port_detach()
6028 ata_tport_delete(ap); in ata_port_detach()
6082 struct ata_port *ap = host->ports[i]; in ata_pci_shutdown_one() local
6084 ap->pflags |= ATA_PFLAG_FROZEN; in ata_pci_shutdown_one()
6087 if (ap->ops->freeze) in ata_pci_shutdown_one()
6088 ap->ops->freeze(ap); in ata_pci_shutdown_one()
6091 if (ap->ops->port_stop) in ata_pci_shutdown_one()
6092 ap->ops->port_stop(ap); in ata_pci_shutdown_one()
6463 void ata_msleep(struct ata_port *ap, unsigned int msecs) in ata_msleep() argument
6465 bool owns_eh = ap && ap->host->eh_owner == current; in ata_msleep()
6468 ata_eh_release(ap); in ata_msleep()
6478 ata_eh_acquire(ap); in ata_msleep()
6506 u32 ata_wait_register(struct ata_port *ap, void __iomem *reg, u32 mask, u32 val, in ata_wait_register() argument
6521 ata_msleep(ap, interval); in ata_wait_register()
6537 static void ata_dummy_error_handler(struct ata_port *ap) in ata_dummy_error_handler() argument
6559 void ata_port_printk(const struct ata_port *ap, const char *level, in ata_port_printk() argument
6570 printk("%sata%u: %pV", level, ap->print_id, &vaf); in ata_port_printk()
6587 if (sata_pmp_attached(link->ap) || link->ap->slave_link) in ata_link_printk()
6589 level, link->ap->print_id, link->pmp, &vaf); in ata_link_printk()
6592 level, link->ap->print_id, &vaf); in ata_link_printk()
6610 level, dev->link->ap->print_id, dev->link->pmp + dev->devno, in ata_dev_printk()