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()
2205 struct ata_port *ap = dev->link->ap; in ata_dev_config_ncq() local
2220 if (ap->flags & ATA_FLAG_NCQ) { in ata_dev_config_ncq()
2221 hdepth = min(ap->scsi_host->can_queue, ATA_MAX_QUEUE); in ata_dev_config_ncq()
2226 (ap->flags & ATA_FLAG_FPDMA_AA) && in ata_dev_config_ncq()
2248 if ((ap->flags & ATA_FLAG_FPDMA_AUX)) { in ata_dev_config_ncq()
2280 struct ata_port *ap = dev->link->ap; in ata_dev_config_zac() local
2282 u8 *identify_buf = ap->sector_buf; in ata_dev_config_zac()
2334 struct ata_port *ap = dev->link->ap; in ata_dev_config_trusted() local
2348 ap->sector_buf, 1); in ata_dev_config_trusted()
2355 trusted_cap = get_unaligned_le64(&ap->sector_buf[40]); in ata_dev_config_trusted()
2381 struct ata_port *ap = dev->link->ap; in ata_dev_configure() local
2392 if (!ata_dev_enabled(dev) && ata_msg_info(ap)) { in ata_dev_configure()
2397 if (ata_msg_probe(ap)) in ata_dev_configure()
2410 if ((!atapi_enabled || (ap->flags & ATA_FLAG_NO_ATAPI)) && in ata_dev_configure()
2428 if (ap->flags & ATA_FLAG_NO_LPM) in ata_dev_configure()
2433 dev->link->ap->target_lpm_policy = ATA_LPM_MAX_POWER; in ata_dev_configure()
2447 if (ata_msg_probe(ap)) in ata_dev_configure()
2472 if (ata_msg_probe(ap)) in ata_dev_configure()
2531 if (ata_msg_drv(ap) && print_info) { in ata_dev_configure()
2556 if (ata_msg_drv(ap) && print_info) { in ata_dev_configure()
2572 u8 *sata_setting = ap->sector_buf; in ata_dev_configure()
2606 if (ata_msg_warn(ap)) in ata_dev_configure()
2619 (ap->flags & ATA_FLAG_AN) && ata_id_has_atapi_AN(id) && in ata_dev_configure()
2620 (!sata_pmp_attached(ap) || in ata_dev_configure()
2621 sata_scr_read(&ap->link, SCR_NOTIFICATION, &sntf) == 0)) { in ata_dev_configure()
2651 if (ata_msg_drv(ap) && print_info) in ata_dev_configure()
2668 if (ata_msg_drv(ap) && print_info) in ata_dev_configure()
2691 if (ap->ops->dev_config) in ata_dev_configure()
2692 ap->ops->dev_config(dev); in ata_dev_configure()
2717 if (ata_msg_probe(ap)) in ata_dev_configure()
2730 int ata_cable_40wire(struct ata_port *ap) in ata_cable_40wire() argument
2744 int ata_cable_80wire(struct ata_port *ap) in ata_cable_80wire() argument
2757 int ata_cable_unknown(struct ata_port *ap) in ata_cable_unknown() argument
2770 int ata_cable_ignore(struct ata_port *ap) in ata_cable_ignore() argument
2783 int ata_cable_sata(struct ata_port *ap) in ata_cable_sata() argument
2804 int ata_bus_probe(struct ata_port *ap) in ata_bus_probe() argument
2811 ata_for_each_dev(dev, &ap->link, ALL) in ata_bus_probe()
2815 ata_for_each_dev(dev, &ap->link, ALL) { in ata_bus_probe()
2831 if (ap->ops->set_piomode) in ata_bus_probe()
2832 ap->ops->set_piomode(ap, dev); in ata_bus_probe()
2836 ap->ops->phy_reset(ap); in ata_bus_probe()
2838 ata_for_each_dev(dev, &ap->link, ALL) { in ata_bus_probe()
2851 ata_for_each_dev(dev, &ap->link, ALL_REVERSE) { in ata_bus_probe()
2865 if (ap->ops->cable_detect) in ata_bus_probe()
2866 ap->cbl = ap->ops->cable_detect(ap); in ata_bus_probe()
2873 ata_for_each_dev(dev, &ap->link, ENABLED) in ata_bus_probe()
2875 ap->cbl = ATA_CBL_SATA; in ata_bus_probe()
2880 ata_for_each_dev(dev, &ap->link, ENABLED) { in ata_bus_probe()
2881 ap->link.eh_context.i.flags |= ATA_EHI_PRINTINFO; in ata_bus_probe()
2883 ap->link.eh_context.i.flags &= ~ATA_EHI_PRINTINFO; in ata_bus_probe()
2889 rc = ata_set_mode(&ap->link, &dev); in ata_bus_probe()
2893 ata_for_each_dev(dev, &ap->link, ENABLED) in ata_bus_probe()
2916 sata_down_spd_limit(&ap->link, 0); in ata_bus_probe()
3196 struct ata_port *ap = dev->link->ap; in ata_dev_set_mode() local
3208 if (nosetxfer && ap->flags & ATA_FLAG_SATA && ata_id_is_sata(dev->id)) in ata_dev_set_mode()
3296 struct ata_port *ap = link->ap; in ata_do_set_mode() local
3342 if (ap->ops->set_piomode) in ata_do_set_mode()
3343 ap->ops->set_piomode(ap, dev); in ata_do_set_mode()
3353 if (ap->ops->set_dmamode) in ata_do_set_mode()
3354 ap->ops->set_dmamode(ap, dev); in ata_do_set_mode()
3367 if (used_dma && (ap->host->flags & ATA_HOST_SIMPLEX)) in ata_do_set_mode()
3368 ap->host->simplex_claimed = ap; in ata_do_set_mode()
3405 if (link->ap->host->flags & ATA_HOST_PARALLEL_SCAN) in ata_wait_ready()
3414 WARN_ON(link == link->ap->slave_link); in ata_wait_ready()
3441 else if ((link->ap->flags & ATA_FLAG_SATA) && in ata_wait_ready()
3460 ata_msleep(link->ap, 50); in ata_wait_ready()
3481 ata_msleep(link->ap, ATA_WAIT_AFTER_RESET); in ata_wait_after_reset()
3506 struct ata_port *ap = link->ap; in ata_std_prereset() local
3516 if (ap->flags & ATA_FLAG_SATA) { in ata_std_prereset()
3655 u16 *id = (void *)dev->link->ap->sector_buf; in ata_dev_reread_id()
4034 if ((dev->link->ap->flags & ATA_FLAG_PIO_POLLING) && in ata_dma_blacklisted()
4068 static int cable_is_40wire(struct ata_port *ap) in cable_is_40wire() argument
4074 if (ap->cbl == ATA_CBL_PATA40) in cable_is_40wire()
4078 if (ap->cbl == ATA_CBL_PATA80 || ap->cbl == ATA_CBL_SATA) in cable_is_40wire()
4085 if (ap->cbl == ATA_CBL_PATA40_SHORT) in cable_is_40wire()
4097 ata_for_each_link(link, ap, EDGE) { in cable_is_40wire()
4121 struct ata_port *ap = link->ap; in ata_dev_xfermask() local
4122 struct ata_host *host = ap->host; in ata_dev_xfermask()
4126 xfer_mask = ata_pack_xfermask(ap->pio_mask, in ata_dev_xfermask()
4127 ap->mwdma_mask, ap->udma_mask); in ata_dev_xfermask()
4152 host->simplex_claimed && host->simplex_claimed != ap) { in ata_dev_xfermask()
4158 if (ap->flags & ATA_FLAG_NO_IORDY) in ata_dev_xfermask()
4161 if (ap->ops->mode_filter) in ata_dev_xfermask()
4162 xfer_mask = ap->ops->mode_filter(dev, xfer_mask); in ata_dev_xfermask()
4174 if (cable_is_40wire(ap)) { in ata_dev_xfermask()
4330 struct ata_port *ap = qc->ap; in atapi_check_dma() local
4339 if (ap->ops->check_atapi_dma) in atapi_check_dma()
4340 return ap->ops->check_atapi_dma(qc); in atapi_check_dma()
4416 struct ata_port *ap = qc->ap; in ata_sg_clean() local
4425 dma_unmap_sg(ap->dev, sg, qc->orig_n_elem, dir); in ata_sg_clean()
4446 struct ata_port *ap = qc->ap; in ata_sg_setup() local
4449 VPRINTK("ENTER, ata%u\n", ap->print_id); in ata_sg_setup()
4451 n_elem = dma_map_sg(ap->dev, qc->sg, qc->n_elem, qc->dma_dir); in ata_sg_setup()
4503 struct ata_port *ap = dev->link->ap; in ata_qc_new_init() local
4507 if (unlikely(ap->pflags & ATA_PFLAG_FROZEN)) in ata_qc_new_init()
4511 if (ap->flags & ATA_FLAG_SAS_HOST) { in ata_qc_new_init()
4512 tag = ata_sas_allocate_tag(ap); in ata_qc_new_init()
4517 qc = __ata_qc_from_tag(ap, tag); in ata_qc_new_init()
4520 qc->ap = ap; in ata_qc_new_init()
4540 struct ata_port *ap; in ata_qc_free() local
4544 ap = qc->ap; in ata_qc_free()
4550 if (ap->flags & ATA_FLAG_SAS_HOST) in ata_qc_free()
4551 ata_sas_free_tag(tag, ap); in ata_qc_free()
4557 struct ata_port *ap; in __ata_qc_complete() local
4562 ap = qc->ap; in __ata_qc_complete()
4572 ap->nr_active_links--; in __ata_qc_complete()
4575 ap->nr_active_links--; in __ata_qc_complete()
4580 ap->excl_link == link)) in __ata_qc_complete()
4581 ap->excl_link = NULL; in __ata_qc_complete()
4588 ap->qc_active &= ~(1ULL << qc->tag); in __ata_qc_complete()
4596 struct ata_port *ap = qc->ap; in fill_result_tf() local
4599 ap->ops->qc_fill_rtf(qc); in fill_result_tf()
4632 struct ata_port *ap = qc->ap; in ata_qc_complete() local
4650 if (ap->ops->error_handler) { in ata_qc_complete()
4679 WARN_ON_ONCE(ap->pflags & ATA_PFLAG_FROZEN); in ata_qc_complete()
4701 ata_port_schedule_eh(ap); in ata_qc_complete()
4736 u64 ata_qc_get_active(struct ata_port *ap) in ata_qc_get_active() argument
4738 u64 qc_active = ap->qc_active; in ata_qc_get_active()
4764 struct ata_port *ap = qc->ap; in ata_qc_issue() local
4772 WARN_ON_ONCE(ap->ops->error_handler && ata_tag_valid(link->active_tag)); in ata_qc_issue()
4778 ap->nr_active_links++; in ata_qc_issue()
4783 ap->nr_active_links++; in ata_qc_issue()
4788 ap->qc_active |= 1ULL << qc->tag; in ata_qc_issue()
4798 (ap->flags & ATA_FLAG_PIO_DMA))) in ata_qc_issue()
4810 qc->err_mask |= ap->ops->qc_prep(qc); in ata_qc_issue()
4814 qc->err_mask |= ap->ops->qc_issue(qc); in ata_qc_issue()
4891 struct ata_link *slave = link->ap->slave_link; in ata_link_online()
4918 struct ata_link *slave = link->ap->slave_link; in ata_link_offline()
4928 static void ata_port_request_pm(struct ata_port *ap, pm_message_t mesg, in ata_port_request_pm() argument
4938 if (ap->pflags & ATA_PFLAG_PM_PENDING) { in ata_port_request_pm()
4939 ata_port_wait_eh(ap); in ata_port_request_pm()
4940 WARN_ON(ap->pflags & ATA_PFLAG_PM_PENDING); in ata_port_request_pm()
4944 spin_lock_irqsave(ap->lock, flags); in ata_port_request_pm()
4946 ap->pm_mesg = mesg; in ata_port_request_pm()
4947 ap->pflags |= ATA_PFLAG_PM_PENDING; in ata_port_request_pm()
4948 ata_for_each_link(link, ap, HOST_FIRST) { in ata_port_request_pm()
4953 ata_port_schedule_eh(ap); in ata_port_request_pm()
4955 spin_unlock_irqrestore(ap->lock, flags); in ata_port_request_pm()
4958 ata_port_wait_eh(ap); in ata_port_request_pm()
4959 WARN_ON(ap->pflags & ATA_PFLAG_PM_PENDING); in ata_port_request_pm()
4974 static void ata_port_suspend(struct ata_port *ap, pm_message_t mesg) in ata_port_suspend() argument
4976 ata_port_request_pm(ap, mesg, 0, ata_port_suspend_ehi, false); in ata_port_suspend()
4979 static void ata_port_suspend_async(struct ata_port *ap, pm_message_t mesg) in ata_port_suspend_async() argument
4981 ata_port_request_pm(ap, mesg, 0, ata_port_suspend_ehi, true); in ata_port_suspend_async()
4986 struct ata_port *ap = to_ata_port(dev); in ata_port_pm_suspend() local
4991 ata_port_suspend(ap, PMSG_SUSPEND); in ata_port_pm_suspend()
4997 struct ata_port *ap = to_ata_port(dev); in ata_port_pm_freeze() local
5002 ata_port_suspend(ap, PMSG_FREEZE); in ata_port_pm_freeze()
5015 static void ata_port_resume(struct ata_port *ap, pm_message_t mesg) in ata_port_resume() argument
5017 ata_port_request_pm(ap, mesg, ATA_EH_RESET, ata_port_resume_ehi, false); in ata_port_resume()
5020 static void ata_port_resume_async(struct ata_port *ap, pm_message_t mesg) in ata_port_resume_async() argument
5022 ata_port_request_pm(ap, mesg, ATA_EH_RESET, ata_port_resume_ehi, true); in ata_port_resume_async()
5044 struct ata_port *ap = to_ata_port(dev); in ata_port_runtime_idle() local
5048 ata_for_each_link(link, ap, HOST_FIRST) { in ata_port_runtime_idle()
5088 void ata_sas_port_suspend(struct ata_port *ap) in ata_sas_port_suspend() argument
5090 ata_port_suspend_async(ap, PMSG_SUSPEND); in ata_sas_port_suspend()
5094 void ata_sas_port_resume(struct ata_port *ap) in ata_sas_port_resume() argument
5096 ata_port_resume_async(ap, PMSG_RESUME); in ata_sas_port_resume()
5146 struct ata_port *ap = link->ap; in ata_dev_init() local
5157 spin_lock_irqsave(ap->lock, flags); in ata_dev_init()
5160 spin_unlock_irqrestore(ap->lock, flags); in ata_dev_init()
5180 void ata_link_init(struct ata_port *ap, struct ata_link *link, int pmp) in ata_link_init() argument
5188 link->ap = ap; in ata_link_init()
5253 struct ata_port *ap; in ata_port_alloc() local
5257 ap = kzalloc(sizeof(*ap), GFP_KERNEL); in ata_port_alloc()
5258 if (!ap) in ata_port_alloc()
5261 ap->pflags |= ATA_PFLAG_INITIALIZING | ATA_PFLAG_FROZEN; in ata_port_alloc()
5262 ap->lock = &host->lock; in ata_port_alloc()
5263 ap->print_id = -1; in ata_port_alloc()
5264 ap->local_port_no = -1; in ata_port_alloc()
5265 ap->host = host; in ata_port_alloc()
5266 ap->dev = host->dev; in ata_port_alloc()
5270 ap->msg_enable = 0x00FF; in ata_port_alloc()
5272 ap->msg_enable = ATA_MSG_DRV | ATA_MSG_INFO | ATA_MSG_CTL | ATA_MSG_WARN | ATA_MSG_ERR; in ata_port_alloc()
5274 ap->msg_enable = ATA_MSG_DRV | ATA_MSG_ERR | ATA_MSG_WARN; in ata_port_alloc()
5277 mutex_init(&ap->scsi_scan_mutex); in ata_port_alloc()
5278 INIT_DELAYED_WORK(&ap->hotplug_task, ata_scsi_hotplug); in ata_port_alloc()
5279 INIT_WORK(&ap->scsi_rescan_task, ata_scsi_dev_rescan); in ata_port_alloc()
5280 INIT_LIST_HEAD(&ap->eh_done_q); in ata_port_alloc()
5281 init_waitqueue_head(&ap->eh_wait_q); in ata_port_alloc()
5282 init_completion(&ap->park_req_pending); in ata_port_alloc()
5283 timer_setup(&ap->fastdrain_timer, ata_eh_fastdrain_timerfn, in ata_port_alloc()
5286 ap->cbl = ATA_CBL_NONE; in ata_port_alloc()
5288 ata_link_init(ap, &ap->link, 0); in ata_port_alloc()
5291 ap->stats.unhandled_irq = 1; in ata_port_alloc()
5292 ap->stats.idle_irq = 1; in ata_port_alloc()
5294 ata_sff_port_init(ap); in ata_port_alloc()
5296 return ap; in ata_port_alloc()
5305 struct ata_port *ap = host->ports[i]; in ata_devres_release() local
5307 if (!ap) in ata_devres_release()
5310 if (ap->scsi_host) in ata_devres_release()
5311 scsi_host_put(ap->scsi_host); in ata_devres_release()
5325 struct ata_port *ap = host->ports[i]; in ata_host_release() local
5327 kfree(ap->pmp_link); in ata_host_release()
5328 kfree(ap->slave_link); in ata_host_release()
5329 kfree(ap); in ata_host_release()
5399 struct ata_port *ap; in ata_host_alloc() local
5401 ap = ata_port_alloc(host); in ata_host_alloc()
5402 if (!ap) in ata_host_alloc()
5405 ap->port_no = i; in ata_host_alloc()
5406 host->ports[i] = ap; in ata_host_alloc()
5449 struct ata_port *ap = host->ports[i]; in ata_host_alloc_pinfo() local
5454 ap->pio_mask = pi->pio_mask; in ata_host_alloc_pinfo()
5455 ap->mwdma_mask = pi->mwdma_mask; in ata_host_alloc_pinfo()
5456 ap->udma_mask = pi->udma_mask; in ata_host_alloc_pinfo()
5457 ap->flags |= pi->flags; in ata_host_alloc_pinfo()
5458 ap->link.flags |= pi->link_flags; in ata_host_alloc_pinfo()
5459 ap->ops = pi->port_ops; in ata_host_alloc_pinfo()
5477 struct ata_port *ap = host->ports[i]; in ata_host_stop() local
5479 if (ap->ops->port_stop) in ata_host_stop()
5480 ap->ops->port_stop(ap); in ata_host_stop()
5565 struct ata_port *ap = host->ports[i]; in ata_host_start() local
5567 ata_finalize_port_ops(ap->ops); in ata_host_start()
5569 if (!host->ops && !ata_port_is_dummy(ap)) in ata_host_start()
5570 host->ops = ap->ops; in ata_host_start()
5572 if (ap->ops->port_stop) in ata_host_start()
5586 struct ata_port *ap = host->ports[i]; in ata_host_start() local
5588 if (ap->ops->port_start) { in ata_host_start()
5589 rc = ap->ops->port_start(ap); in ata_host_start()
5598 ata_eh_freeze_port(ap); in ata_host_start()
5608 struct ata_port *ap = host->ports[i]; in ata_host_start() local
5610 if (ap->ops->port_stop) in ata_host_start()
5611 ap->ops->port_stop(ap); in ata_host_start()
5637 void __ata_port_probe(struct ata_port *ap) in __ata_port_probe() argument
5639 struct ata_eh_info *ehi = &ap->link.eh_info; in __ata_port_probe()
5643 spin_lock_irqsave(ap->lock, flags); in __ata_port_probe()
5649 ap->pflags &= ~ATA_PFLAG_INITIALIZING; in __ata_port_probe()
5650 ap->pflags |= ATA_PFLAG_LOADING; in __ata_port_probe()
5651 ata_port_schedule_eh(ap); in __ata_port_probe()
5653 spin_unlock_irqrestore(ap->lock, flags); in __ata_port_probe()
5656 int ata_port_probe(struct ata_port *ap) in ata_port_probe() argument
5660 if (ap->ops->error_handler) { in ata_port_probe()
5661 __ata_port_probe(ap); in ata_port_probe()
5662 ata_port_wait_eh(ap); in ata_port_probe()
5664 DPRINTK("ata%u: bus probe begin\n", ap->print_id); in ata_port_probe()
5665 rc = ata_bus_probe(ap); in ata_port_probe()
5666 DPRINTK("ata%u: bus probe end\n", ap->print_id); in ata_port_probe()
5674 struct ata_port *ap = data; in async_port_probe() local
5683 if (!(ap->host->flags & ATA_HOST_PARALLEL_SCAN) && ap->port_no != 0) in async_port_probe()
5686 (void)ata_port_probe(ap); in async_port_probe()
5691 ata_scsi_scan_host(ap, 1); in async_port_probe()
5750 struct ata_port *ap = host->ports[i]; in ata_host_register() local
5754 if (ap->cbl == ATA_CBL_NONE && (ap->flags & ATA_FLAG_SATA)) in ata_host_register()
5755 ap->cbl = ATA_CBL_SATA; in ata_host_register()
5758 sata_link_init_spd(&ap->link); in ata_host_register()
5759 if (ap->slave_link) in ata_host_register()
5760 sata_link_init_spd(ap->slave_link); in ata_host_register()
5763 xfer_mask = ata_pack_xfermask(ap->pio_mask, ap->mwdma_mask, in ata_host_register()
5764 ap->udma_mask); in ata_host_register()
5766 if (!ata_port_is_dummy(ap)) { in ata_host_register()
5767 ata_port_info(ap, "%cATA max %s %s\n", in ata_host_register()
5768 (ap->flags & ATA_FLAG_SATA) ? 'S' : 'P', in ata_host_register()
5770 ap->link.eh_info.desc); in ata_host_register()
5771 ata_ehi_clear_desc(&ap->link.eh_info); in ata_host_register()
5773 ata_port_info(ap, "DUMMY\n"); in ata_host_register()
5778 struct ata_port *ap = host->ports[i]; in ata_host_register() local
5779 ap->cookie = async_schedule(async_port_probe, ap); in ata_host_register()
5867 static void ata_port_detach(struct ata_port *ap) in ata_port_detach() argument
5873 if (!ap->ops->error_handler) in ata_port_detach()
5877 spin_lock_irqsave(ap->lock, flags); in ata_port_detach()
5878 ap->pflags |= ATA_PFLAG_UNLOADING; in ata_port_detach()
5879 ata_port_schedule_eh(ap); in ata_port_detach()
5880 spin_unlock_irqrestore(ap->lock, flags); in ata_port_detach()
5883 ata_port_wait_eh(ap); in ata_port_detach()
5886 WARN_ON(!(ap->pflags & ATA_PFLAG_UNLOADED)); in ata_port_detach()
5888 cancel_delayed_work_sync(&ap->hotplug_task); in ata_port_detach()
5892 ata_for_each_link(link, ap, HOST_FIRST) { in ata_port_detach()
5898 if (ap->pmp_link) { in ata_port_detach()
5901 ata_tlink_delete(&ap->pmp_link[i]); in ata_port_detach()
5904 scsi_remove_host(ap->scsi_host); in ata_port_detach()
5905 ata_tport_delete(ap); in ata_port_detach()
5959 struct ata_port *ap = host->ports[i]; in ata_pci_shutdown_one() local
5961 ap->pflags |= ATA_PFLAG_FROZEN; in ata_pci_shutdown_one()
5964 if (ap->ops->freeze) in ata_pci_shutdown_one()
5965 ap->ops->freeze(ap); in ata_pci_shutdown_one()
5968 if (ap->ops->port_stop) in ata_pci_shutdown_one()
5969 ap->ops->port_stop(ap); in ata_pci_shutdown_one()
6338 void ata_msleep(struct ata_port *ap, unsigned int msecs) in ata_msleep() argument
6340 bool owns_eh = ap && ap->host->eh_owner == current; in ata_msleep()
6343 ata_eh_release(ap); in ata_msleep()
6353 ata_eh_acquire(ap); in ata_msleep()
6381 u32 ata_wait_register(struct ata_port *ap, void __iomem *reg, u32 mask, u32 val, in ata_wait_register() argument
6396 ata_msleep(ap, interval); in ata_wait_register()
6412 static void ata_dummy_error_handler(struct ata_port *ap) in ata_dummy_error_handler() argument
6434 void ata_port_printk(const struct ata_port *ap, const char *level, in ata_port_printk() argument
6445 printk("%sata%u: %pV", level, ap->print_id, &vaf); in ata_port_printk()
6462 if (sata_pmp_attached(link->ap) || link->ap->slave_link) in ata_link_printk()
6464 level, link->ap->print_id, link->pmp, &vaf); in ata_link_printk()
6467 level, link->ap->print_id, &vaf); in ata_link_printk()
6485 level, dev->link->ap->print_id, dev->link->pmp + dev->devno, in ata_dev_printk()