Lines Matching refs:ap
191 struct ata_link *ata_link_next(struct ata_link *link, struct ata_port *ap, in ata_link_next() argument
202 if (sata_pmp_attached(ap)) in ata_link_next()
203 return ap->pmp_link; in ata_link_next()
206 return &ap->link; in ata_link_next()
210 if (link == &ap->link) in ata_link_next()
213 if (sata_pmp_attached(ap)) in ata_link_next()
214 return ap->pmp_link; in ata_link_next()
217 if (unlikely(ap->slave_link)) in ata_link_next()
218 return ap->slave_link; in ata_link_next()
225 if (unlikely(link == ap->slave_link)) in ata_link_next()
229 if (++link < ap->pmp_link + ap->nr_pmp_links) in ata_link_next()
233 return &ap->link; in ata_link_next()
307 struct ata_port *ap = dev->link->ap; in ata_dev_phys_link() local
309 if (!ap->slave_link) in ata_dev_phys_link()
312 return &ap->link; in ata_dev_phys_link()
313 return ap->slave_link; in ata_dev_phys_link()
329 void ata_force_cbl(struct ata_port *ap) in ata_force_cbl() argument
336 if (fe->port != -1 && fe->port != ap->print_id) in ata_force_cbl()
342 ap->cbl = fe->param.cbl; in ata_force_cbl()
343 ata_port_notice(ap, "FORCE: cable set to %s\n", fe->param.name); in ata_force_cbl()
376 if (fe->port != -1 && fe->port != link->ap->print_id) in ata_force_link_limits()
425 if (fe->port != -1 && fe->port != dev->link->ap->print_id) in ata_force_xfermask()
478 if (fe->port != -1 && fe->port != dev->link->ap->print_id) in ata_force_horkage()
662 } else if (lba48 && (dev->link->ap->flags & ATA_FLAG_PIO_LBA48)) { in ata_rwcmd_protocol()
1551 struct ata_port *ap = link->ap; in ata_exec_internal_sg() local
1563 spin_lock_irqsave(ap->lock, flags); in ata_exec_internal_sg()
1566 if (ap->pflags & ATA_PFLAG_FROZEN) { in ata_exec_internal_sg()
1567 spin_unlock_irqrestore(ap->lock, flags); in ata_exec_internal_sg()
1578 if (ap->ops->error_handler) in ata_exec_internal_sg()
1583 if (test_and_set_bit(tag, &ap->qc_allocated)) in ata_exec_internal_sg()
1585 qc = __ata_qc_from_tag(ap, tag); in ata_exec_internal_sg()
1589 qc->ap = ap; in ata_exec_internal_sg()
1595 preempted_qc_active = ap->qc_active; in ata_exec_internal_sg()
1596 preempted_nr_active_links = ap->nr_active_links; in ata_exec_internal_sg()
1599 ap->qc_active = 0; in ata_exec_internal_sg()
1600 ap->nr_active_links = 0; in ata_exec_internal_sg()
1630 spin_unlock_irqrestore(ap->lock, flags); in ata_exec_internal_sg()
1641 if (ap->ops->error_handler) in ata_exec_internal_sg()
1642 ata_eh_release(ap); in ata_exec_internal_sg()
1646 if (ap->ops->error_handler) in ata_exec_internal_sg()
1647 ata_eh_acquire(ap); in ata_exec_internal_sg()
1649 ata_sff_flush_pio_task(ap); in ata_exec_internal_sg()
1652 spin_lock_irqsave(ap->lock, flags); in ata_exec_internal_sg()
1662 if (ap->ops->error_handler) in ata_exec_internal_sg()
1663 ata_port_freeze(ap); in ata_exec_internal_sg()
1667 if (ata_msg_warn(ap)) in ata_exec_internal_sg()
1672 spin_unlock_irqrestore(ap->lock, flags); in ata_exec_internal_sg()
1676 if (ap->ops->post_internal_cmd) in ata_exec_internal_sg()
1677 ap->ops->post_internal_cmd(qc); in ata_exec_internal_sg()
1692 spin_lock_irqsave(ap->lock, flags); in ata_exec_internal_sg()
1700 ap->qc_active = preempted_qc_active; in ata_exec_internal_sg()
1701 ap->nr_active_links = preempted_nr_active_links; in ata_exec_internal_sg()
1703 spin_unlock_irqrestore(ap->lock, flags); in ata_exec_internal_sg()
1789 if (adev->link->ap->pflags & ATA_PFLAG_RESETTING) in ata_pio_need_iordy()
1794 if (adev->link->ap->flags & ATA_FLAG_NO_IORDY) in ata_pio_need_iordy()
1873 struct ata_port *ap = dev->link->ap; in ata_dev_read_id() local
1882 if (ata_msg_ctl(ap)) in ata_dev_read_id()
1915 if (ap->ops->read_id) in ata_dev_read_id()
1916 err_mask = ap->ops->read_id(dev, &tf, id); in ata_dev_read_id()
1986 if (ap->host->flags & ATA_HOST_IGNORE_ATA && in ata_dev_read_id()
2051 if (ata_msg_warn(ap)) in ata_dev_read_id()
2092 struct ata_port *ap = dev->link->ap; in ata_dev_knobble() local
2097 return ((ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(dev->id))); in ata_dev_knobble()
2103 struct ata_port *ap = dev->link->ap; in ata_dev_config_ncq() local
2116 if (ap->flags & ATA_FLAG_NCQ) { in ata_dev_config_ncq()
2117 hdepth = min(ap->scsi_host->can_queue, ATA_MAX_QUEUE - 1); in ata_dev_config_ncq()
2122 (ap->flags & ATA_FLAG_FPDMA_AA) && in ata_dev_config_ncq()
2144 if ((ap->flags & ATA_FLAG_FPDMA_AUX) && in ata_dev_config_ncq()
2147 0, ap->sector_buf, 1); in ata_dev_config_ncq()
2156 memcpy(cmds, ap->sector_buf, ATA_LOG_NCQ_SEND_RECV_SIZE); in ata_dev_config_ncq()
2184 struct ata_port *ap = dev->link->ap; in ata_dev_configure() local
2195 if (!ata_dev_enabled(dev) && ata_msg_info(ap)) { in ata_dev_configure()
2200 if (ata_msg_probe(ap)) in ata_dev_configure()
2213 if ((!atapi_enabled || (ap->flags & ATA_FLAG_NO_ATAPI)) && in ata_dev_configure()
2233 dev->link->ap->target_lpm_policy = ATA_LPM_MAX_POWER; in ata_dev_configure()
2247 if (ata_msg_probe(ap)) in ata_dev_configure()
2272 if (ata_msg_probe(ap)) in ata_dev_configure()
2331 if (ata_msg_drv(ap) && print_info) { in ata_dev_configure()
2356 if (ata_msg_drv(ap) && print_info) { in ata_dev_configure()
2372 u8 *sata_setting = ap->sector_buf; in ata_dev_configure()
2404 if (ata_msg_warn(ap)) in ata_dev_configure()
2417 (ap->flags & ATA_FLAG_AN) && ata_id_has_atapi_AN(id) && in ata_dev_configure()
2418 (!sata_pmp_attached(ap) || in ata_dev_configure()
2419 sata_scr_read(&ap->link, SCR_NOTIFICATION, &sntf) == 0)) { in ata_dev_configure()
2449 if (ata_msg_drv(ap) && print_info) in ata_dev_configure()
2466 if (ata_msg_drv(ap) && print_info) in ata_dev_configure()
2485 if (ap->ops->dev_config) in ata_dev_configure()
2486 ap->ops->dev_config(dev); in ata_dev_configure()
2511 if (ata_msg_probe(ap)) in ata_dev_configure()
2524 int ata_cable_40wire(struct ata_port *ap) in ata_cable_40wire() argument
2537 int ata_cable_80wire(struct ata_port *ap) in ata_cable_80wire() argument
2549 int ata_cable_unknown(struct ata_port *ap) in ata_cable_unknown() argument
2561 int ata_cable_ignore(struct ata_port *ap) in ata_cable_ignore() argument
2573 int ata_cable_sata(struct ata_port *ap) in ata_cable_sata() argument
2593 int ata_bus_probe(struct ata_port *ap) in ata_bus_probe() argument
2600 ata_for_each_dev(dev, &ap->link, ALL) in ata_bus_probe()
2604 ata_for_each_dev(dev, &ap->link, ALL) { in ata_bus_probe()
2620 if (ap->ops->set_piomode) in ata_bus_probe()
2621 ap->ops->set_piomode(ap, dev); in ata_bus_probe()
2625 ap->ops->phy_reset(ap); in ata_bus_probe()
2627 ata_for_each_dev(dev, &ap->link, ALL) { in ata_bus_probe()
2640 ata_for_each_dev(dev, &ap->link, ALL_REVERSE) { in ata_bus_probe()
2654 if (ap->ops->cable_detect) in ata_bus_probe()
2655 ap->cbl = ap->ops->cable_detect(ap); in ata_bus_probe()
2662 ata_for_each_dev(dev, &ap->link, ENABLED) in ata_bus_probe()
2664 ap->cbl = ATA_CBL_SATA; in ata_bus_probe()
2669 ata_for_each_dev(dev, &ap->link, ENABLED) { in ata_bus_probe()
2670 ap->link.eh_context.i.flags |= ATA_EHI_PRINTINFO; in ata_bus_probe()
2672 ap->link.eh_context.i.flags &= ~ATA_EHI_PRINTINFO; in ata_bus_probe()
2678 rc = ata_set_mode(&ap->link, &dev); in ata_bus_probe()
2682 ata_for_each_dev(dev, &ap->link, ENABLED) in ata_bus_probe()
2704 sata_down_spd_limit(&ap->link, 0); in ata_bus_probe()
2835 struct ata_link *host_link = &link->ap->link; in __sata_set_spd_needed()
3220 struct ata_port *ap = dev->link->ap; in ata_dev_set_mode() local
3232 if (nosetxfer && ap->flags & ATA_FLAG_SATA && ata_id_is_sata(dev->id)) in ata_dev_set_mode()
3318 struct ata_port *ap = link->ap; in ata_do_set_mode() local
3364 if (ap->ops->set_piomode) in ata_do_set_mode()
3365 ap->ops->set_piomode(ap, dev); in ata_do_set_mode()
3375 if (ap->ops->set_dmamode) in ata_do_set_mode()
3376 ap->ops->set_dmamode(ap, dev); in ata_do_set_mode()
3389 if (used_dma && (ap->host->flags & ATA_HOST_SIMPLEX)) in ata_do_set_mode()
3390 ap->host->simplex_claimed = ap; in ata_do_set_mode()
3426 if (link->ap->host->flags & ATA_HOST_PARALLEL_SCAN) in ata_wait_ready()
3435 WARN_ON(link == link->ap->slave_link); in ata_wait_ready()
3462 else if ((link->ap->flags & ATA_FLAG_SATA) && in ata_wait_ready()
3481 ata_msleep(link->ap, 50); in ata_wait_ready()
3502 ata_msleep(link->ap, ATA_WAIT_AFTER_RESET); in ata_wait_after_reset()
3550 ata_msleep(link->ap, interval); in sata_link_debounce()
3615 ata_msleep(link->ap, 200); in sata_link_resume()
3733 struct ata_port *ap = link->ap; in ata_std_prereset() local
3743 if (ap->flags & ATA_FLAG_SATA) { in ata_std_prereset()
3824 ata_msleep(link->ap, 1); in sata_link_hardreset()
3838 if (sata_pmp_supported(link->ap) && ata_is_host_link(link)) { in sata_link_hardreset()
3991 u16 *id = (void *)dev->link->ap->sector_buf; in ata_dev_reread_id()
4324 if ((dev->link->ap->flags & ATA_FLAG_PIO_POLLING) && in ata_dma_blacklisted()
4358 static int cable_is_40wire(struct ata_port *ap) in cable_is_40wire() argument
4364 if (ap->cbl == ATA_CBL_PATA40) in cable_is_40wire()
4368 if (ap->cbl == ATA_CBL_PATA80 || ap->cbl == ATA_CBL_SATA) in cable_is_40wire()
4375 if (ap->cbl == ATA_CBL_PATA40_SHORT) in cable_is_40wire()
4387 ata_for_each_link(link, ap, EDGE) { in cable_is_40wire()
4411 struct ata_port *ap = link->ap; in ata_dev_xfermask() local
4412 struct ata_host *host = ap->host; in ata_dev_xfermask()
4416 xfer_mask = ata_pack_xfermask(ap->pio_mask, in ata_dev_xfermask()
4417 ap->mwdma_mask, ap->udma_mask); in ata_dev_xfermask()
4442 host->simplex_claimed && host->simplex_claimed != ap) { in ata_dev_xfermask()
4448 if (ap->flags & ATA_FLAG_NO_IORDY) in ata_dev_xfermask()
4451 if (ap->ops->mode_filter) in ata_dev_xfermask()
4452 xfer_mask = ap->ops->mode_filter(dev, xfer_mask); in ata_dev_xfermask()
4464 if (cable_is_40wire(ap)) { in ata_dev_xfermask()
4611 struct ata_port *ap = qc->ap; in ata_sg_clean() local
4620 dma_unmap_sg(ap->dev, sg, qc->orig_n_elem, dir); in ata_sg_clean()
4642 struct ata_port *ap = qc->ap; in atapi_check_dma() local
4651 if (ap->ops->check_atapi_dma) in atapi_check_dma()
4652 return ap->ops->check_atapi_dma(qc); in atapi_check_dma()
4725 struct ata_port *ap = qc->ap; in ata_sg_setup() local
4728 VPRINTK("ENTER, ata%u\n", ap->print_id); in ata_sg_setup()
4730 n_elem = dma_map_sg(ap->dev, qc->sg, qc->n_elem, qc->dma_dir); in ata_sg_setup()
4776 static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap) in ata_qc_new() argument
4779 unsigned int max_queue = ap->host->n_tags; in ata_qc_new()
4783 if (unlikely(ap->pflags & ATA_PFLAG_FROZEN)) in ata_qc_new()
4786 for (i = 0, tag = ap->last_tag + 1; i < max_queue; i++, tag++) { in ata_qc_new()
4787 if (ap->flags & ATA_FLAG_LOWTAG) in ata_qc_new()
4796 if (!test_and_set_bit(tag, &ap->qc_allocated)) { in ata_qc_new()
4797 qc = __ata_qc_from_tag(ap, tag); in ata_qc_new()
4799 ap->last_tag = tag; in ata_qc_new()
4817 struct ata_port *ap = dev->link->ap; in ata_qc_new_init() local
4820 qc = ata_qc_new(ap); in ata_qc_new_init()
4823 qc->ap = ap; in ata_qc_new_init()
4844 struct ata_port *ap; in ata_qc_free() local
4848 ap = qc->ap; in ata_qc_free()
4854 clear_bit(tag, &ap->qc_allocated); in ata_qc_free()
4860 struct ata_port *ap; in __ata_qc_complete() local
4865 ap = qc->ap; in __ata_qc_complete()
4875 ap->nr_active_links--; in __ata_qc_complete()
4878 ap->nr_active_links--; in __ata_qc_complete()
4883 ap->excl_link == link)) in __ata_qc_complete()
4884 ap->excl_link = NULL; in __ata_qc_complete()
4891 ap->qc_active &= ~(1 << qc->tag); in __ata_qc_complete()
4899 struct ata_port *ap = qc->ap; in fill_result_tf() local
4902 ap->ops->qc_fill_rtf(qc); in fill_result_tf()
4935 struct ata_port *ap = qc->ap; in ata_qc_complete() local
4950 if (ap->ops->error_handler) { in ata_qc_complete()
4977 WARN_ON_ONCE(ap->pflags & ATA_PFLAG_FROZEN); in ata_qc_complete()
4996 ata_port_schedule_eh(ap); in ata_qc_complete()
5040 int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active) in ata_qc_complete_multiple() argument
5045 done_mask = ap->qc_active ^ qc_active; in ata_qc_complete_multiple()
5048 ata_port_err(ap, "illegal qc_active transition (%08x->%08x)\n", in ata_qc_complete_multiple()
5049 ap->qc_active, qc_active); in ata_qc_complete_multiple()
5057 qc = ata_qc_from_tag(ap, tag); in ata_qc_complete_multiple()
5082 struct ata_port *ap = qc->ap; in ata_qc_issue() local
5090 WARN_ON_ONCE(ap->ops->error_handler && ata_tag_valid(link->active_tag)); in ata_qc_issue()
5096 ap->nr_active_links++; in ata_qc_issue()
5101 ap->nr_active_links++; in ata_qc_issue()
5106 ap->qc_active |= 1 << qc->tag; in ata_qc_issue()
5117 (ap->flags & ATA_FLAG_PIO_DMA))) in ata_qc_issue()
5129 ap->ops->qc_prep(qc); in ata_qc_issue()
5131 qc->err_mask |= ap->ops->qc_issue(qc); in ata_qc_issue()
5156 struct ata_port *ap = link->ap; in sata_scr_valid() local
5158 return (ap->flags & ATA_FLAG_SATA) && ap->ops->scr_read; in sata_scr_valid()
5181 return link->ap->ops->scr_read(link, reg, val); in sata_scr_read()
5208 return link->ap->ops->scr_write(link, reg, val); in sata_scr_write()
5236 rc = link->ap->ops->scr_write(link, reg, val); in sata_scr_write_flush()
5238 rc = link->ap->ops->scr_read(link, reg, &val); in sata_scr_write_flush()
5313 struct ata_link *slave = link->ap->slave_link; in ata_link_online()
5339 struct ata_link *slave = link->ap->slave_link; in ata_link_offline()
5348 static void ata_port_request_pm(struct ata_port *ap, pm_message_t mesg, in ata_port_request_pm() argument
5358 if (ap->pflags & ATA_PFLAG_PM_PENDING) { in ata_port_request_pm()
5359 ata_port_wait_eh(ap); in ata_port_request_pm()
5360 WARN_ON(ap->pflags & ATA_PFLAG_PM_PENDING); in ata_port_request_pm()
5364 spin_lock_irqsave(ap->lock, flags); in ata_port_request_pm()
5366 ap->pm_mesg = mesg; in ata_port_request_pm()
5367 ap->pflags |= ATA_PFLAG_PM_PENDING; in ata_port_request_pm()
5368 ata_for_each_link(link, ap, HOST_FIRST) { in ata_port_request_pm()
5373 ata_port_schedule_eh(ap); in ata_port_request_pm()
5375 spin_unlock_irqrestore(ap->lock, flags); in ata_port_request_pm()
5378 ata_port_wait_eh(ap); in ata_port_request_pm()
5379 WARN_ON(ap->pflags & ATA_PFLAG_PM_PENDING); in ata_port_request_pm()
5394 static void ata_port_suspend(struct ata_port *ap, pm_message_t mesg) in ata_port_suspend() argument
5396 ata_port_request_pm(ap, mesg, 0, ata_port_suspend_ehi, false); in ata_port_suspend()
5399 static void ata_port_suspend_async(struct ata_port *ap, pm_message_t mesg) in ata_port_suspend_async() argument
5401 ata_port_request_pm(ap, mesg, 0, ata_port_suspend_ehi, true); in ata_port_suspend_async()
5406 struct ata_port *ap = to_ata_port(dev); in ata_port_pm_suspend() local
5411 ata_port_suspend(ap, PMSG_SUSPEND); in ata_port_pm_suspend()
5417 struct ata_port *ap = to_ata_port(dev); in ata_port_pm_freeze() local
5422 ata_port_suspend(ap, PMSG_FREEZE); in ata_port_pm_freeze()
5435 static void ata_port_resume(struct ata_port *ap, pm_message_t mesg) in ata_port_resume() argument
5437 ata_port_request_pm(ap, mesg, ATA_EH_RESET, ata_port_resume_ehi, false); in ata_port_resume()
5440 static void ata_port_resume_async(struct ata_port *ap, pm_message_t mesg) in ata_port_resume_async() argument
5442 ata_port_request_pm(ap, mesg, ATA_EH_RESET, ata_port_resume_ehi, true); in ata_port_resume_async()
5464 struct ata_port *ap = to_ata_port(dev); in ata_port_runtime_idle() local
5468 ata_for_each_link(link, ap, HOST_FIRST) { in ata_port_runtime_idle()
5508 void ata_sas_port_suspend(struct ata_port *ap) in ata_sas_port_suspend() argument
5510 ata_port_suspend_async(ap, PMSG_SUSPEND); in ata_sas_port_suspend()
5514 void ata_sas_port_resume(struct ata_port *ap) in ata_sas_port_resume() argument
5516 ata_port_resume_async(ap, PMSG_RESUME); in ata_sas_port_resume()
5564 struct ata_port *ap = link->ap; in ata_dev_init() local
5575 spin_lock_irqsave(ap->lock, flags); in ata_dev_init()
5578 spin_unlock_irqrestore(ap->lock, flags); in ata_dev_init()
5598 void ata_link_init(struct ata_port *ap, struct ata_link *link, int pmp) in ata_link_init() argument
5606 link->ap = ap; in ata_link_init()
5671 struct ata_port *ap; in ata_port_alloc() local
5675 ap = kzalloc(sizeof(*ap), GFP_KERNEL); in ata_port_alloc()
5676 if (!ap) in ata_port_alloc()
5679 ap->pflags |= ATA_PFLAG_INITIALIZING | ATA_PFLAG_FROZEN; in ata_port_alloc()
5680 ap->lock = &host->lock; in ata_port_alloc()
5681 ap->print_id = -1; in ata_port_alloc()
5682 ap->local_port_no = -1; in ata_port_alloc()
5683 ap->host = host; in ata_port_alloc()
5684 ap->dev = host->dev; in ata_port_alloc()
5688 ap->msg_enable = 0x00FF; in ata_port_alloc()
5690 ap->msg_enable = ATA_MSG_DRV | ATA_MSG_INFO | ATA_MSG_CTL | ATA_MSG_WARN | ATA_MSG_ERR; in ata_port_alloc()
5692 ap->msg_enable = ATA_MSG_DRV | ATA_MSG_ERR | ATA_MSG_WARN; in ata_port_alloc()
5695 mutex_init(&ap->scsi_scan_mutex); in ata_port_alloc()
5696 INIT_DELAYED_WORK(&ap->hotplug_task, ata_scsi_hotplug); in ata_port_alloc()
5697 INIT_WORK(&ap->scsi_rescan_task, ata_scsi_dev_rescan); in ata_port_alloc()
5698 INIT_LIST_HEAD(&ap->eh_done_q); in ata_port_alloc()
5699 init_waitqueue_head(&ap->eh_wait_q); in ata_port_alloc()
5700 init_completion(&ap->park_req_pending); in ata_port_alloc()
5701 init_timer_deferrable(&ap->fastdrain_timer); in ata_port_alloc()
5702 ap->fastdrain_timer.function = ata_eh_fastdrain_timerfn; in ata_port_alloc()
5703 ap->fastdrain_timer.data = (unsigned long)ap; in ata_port_alloc()
5705 ap->cbl = ATA_CBL_NONE; in ata_port_alloc()
5707 ata_link_init(ap, &ap->link, 0); in ata_port_alloc()
5710 ap->stats.unhandled_irq = 1; in ata_port_alloc()
5711 ap->stats.idle_irq = 1; in ata_port_alloc()
5713 ata_sff_port_init(ap); in ata_port_alloc()
5715 return ap; in ata_port_alloc()
5724 struct ata_port *ap = host->ports[i]; in ata_host_release() local
5726 if (!ap) in ata_host_release()
5729 if (ap->scsi_host) in ata_host_release()
5730 scsi_host_put(ap->scsi_host); in ata_host_release()
5732 kfree(ap->pmp_link); in ata_host_release()
5733 kfree(ap->slave_link); in ata_host_release()
5734 kfree(ap); in ata_host_release()
5789 struct ata_port *ap; in ata_host_alloc() local
5791 ap = ata_port_alloc(host); in ata_host_alloc()
5792 if (!ap) in ata_host_alloc()
5795 ap->port_no = i; in ata_host_alloc()
5796 host->ports[i] = ap; in ata_host_alloc()
5836 struct ata_port *ap = host->ports[i]; in ata_host_alloc_pinfo() local
5841 ap->pio_mask = pi->pio_mask; in ata_host_alloc_pinfo()
5842 ap->mwdma_mask = pi->mwdma_mask; in ata_host_alloc_pinfo()
5843 ap->udma_mask = pi->udma_mask; in ata_host_alloc_pinfo()
5844 ap->flags |= pi->flags; in ata_host_alloc_pinfo()
5845 ap->link.flags |= pi->link_flags; in ata_host_alloc_pinfo()
5846 ap->ops = pi->port_ops; in ata_host_alloc_pinfo()
5901 int ata_slave_link_init(struct ata_port *ap) in ata_slave_link_init() argument
5905 WARN_ON(ap->slave_link); in ata_slave_link_init()
5906 WARN_ON(ap->flags & ATA_FLAG_PMP); in ata_slave_link_init()
5912 ata_link_init(ap, link, 1); in ata_slave_link_init()
5913 ap->slave_link = link; in ata_slave_link_init()
5925 struct ata_port *ap = host->ports[i]; in ata_host_stop() local
5927 if (ap->ops->port_stop) in ata_host_stop()
5928 ap->ops->port_stop(ap); in ata_host_stop()
6013 struct ata_port *ap = host->ports[i]; in ata_host_start() local
6015 ata_finalize_port_ops(ap->ops); in ata_host_start()
6017 if (!host->ops && !ata_port_is_dummy(ap)) in ata_host_start()
6018 host->ops = ap->ops; in ata_host_start()
6020 if (ap->ops->port_stop) in ata_host_start()
6034 struct ata_port *ap = host->ports[i]; in ata_host_start() local
6036 if (ap->ops->port_start) { in ata_host_start()
6037 rc = ap->ops->port_start(ap); in ata_host_start()
6046 ata_eh_freeze_port(ap); in ata_host_start()
6056 struct ata_port *ap = host->ports[i]; in ata_host_start() local
6058 if (ap->ops->port_stop) in ata_host_start()
6059 ap->ops->port_stop(ap); in ata_host_start()
6082 void __ata_port_probe(struct ata_port *ap) in __ata_port_probe() argument
6084 struct ata_eh_info *ehi = &ap->link.eh_info; in __ata_port_probe()
6088 spin_lock_irqsave(ap->lock, flags); in __ata_port_probe()
6094 ap->pflags &= ~ATA_PFLAG_INITIALIZING; in __ata_port_probe()
6095 ap->pflags |= ATA_PFLAG_LOADING; in __ata_port_probe()
6096 ata_port_schedule_eh(ap); in __ata_port_probe()
6098 spin_unlock_irqrestore(ap->lock, flags); in __ata_port_probe()
6101 int ata_port_probe(struct ata_port *ap) in ata_port_probe() argument
6105 if (ap->ops->error_handler) { in ata_port_probe()
6106 __ata_port_probe(ap); in ata_port_probe()
6107 ata_port_wait_eh(ap); in ata_port_probe()
6109 DPRINTK("ata%u: bus probe begin\n", ap->print_id); in ata_port_probe()
6110 rc = ata_bus_probe(ap); in ata_port_probe()
6111 DPRINTK("ata%u: bus probe end\n", ap->print_id); in ata_port_probe()
6119 struct ata_port *ap = data; in async_port_probe() local
6128 if (!(ap->host->flags & ATA_HOST_PARALLEL_SCAN) && ap->port_no != 0) in async_port_probe()
6131 (void)ata_port_probe(ap); in async_port_probe()
6136 ata_scsi_scan_host(ap, 1); in async_port_probe()
6195 struct ata_port *ap = host->ports[i]; in ata_host_register() local
6199 if (ap->cbl == ATA_CBL_NONE && (ap->flags & ATA_FLAG_SATA)) in ata_host_register()
6200 ap->cbl = ATA_CBL_SATA; in ata_host_register()
6203 sata_link_init_spd(&ap->link); in ata_host_register()
6204 if (ap->slave_link) in ata_host_register()
6205 sata_link_init_spd(ap->slave_link); in ata_host_register()
6208 xfer_mask = ata_pack_xfermask(ap->pio_mask, ap->mwdma_mask, in ata_host_register()
6209 ap->udma_mask); in ata_host_register()
6211 if (!ata_port_is_dummy(ap)) { in ata_host_register()
6212 ata_port_info(ap, "%cATA max %s %s\n", in ata_host_register()
6213 (ap->flags & ATA_FLAG_SATA) ? 'S' : 'P', in ata_host_register()
6215 ap->link.eh_info.desc); in ata_host_register()
6216 ata_ehi_clear_desc(&ap->link.eh_info); in ata_host_register()
6218 ata_port_info(ap, "DUMMY\n"); in ata_host_register()
6223 struct ata_port *ap = host->ports[i]; in ata_host_register() local
6224 async_schedule(async_port_probe, ap); in ata_host_register()
6303 static void ata_port_detach(struct ata_port *ap) in ata_port_detach() argument
6309 if (!ap->ops->error_handler) in ata_port_detach()
6313 spin_lock_irqsave(ap->lock, flags); in ata_port_detach()
6314 ap->pflags |= ATA_PFLAG_UNLOADING; in ata_port_detach()
6315 ata_port_schedule_eh(ap); in ata_port_detach()
6316 spin_unlock_irqrestore(ap->lock, flags); in ata_port_detach()
6319 ata_port_wait_eh(ap); in ata_port_detach()
6322 WARN_ON(!(ap->pflags & ATA_PFLAG_UNLOADED)); in ata_port_detach()
6324 cancel_delayed_work_sync(&ap->hotplug_task); in ata_port_detach()
6328 ata_for_each_link(link, ap, HOST_FIRST) { in ata_port_detach()
6334 if (ap->pmp_link) { in ata_port_detach()
6337 ata_tlink_delete(&ap->pmp_link[i]); in ata_port_detach()
6340 scsi_remove_host(ap->scsi_host); in ata_port_detach()
6341 ata_tport_delete(ap); in ata_port_detach()
6735 void ata_msleep(struct ata_port *ap, unsigned int msecs) in ata_msleep() argument
6737 bool owns_eh = ap && ap->host->eh_owner == current; in ata_msleep()
6740 ata_eh_release(ap); in ata_msleep()
6745 ata_eh_acquire(ap); in ata_msleep()
6772 u32 ata_wait_register(struct ata_port *ap, void __iomem *reg, u32 mask, u32 val, in ata_wait_register() argument
6787 ata_msleep(ap, interval); in ata_wait_register()
6834 static void ata_dummy_error_handler(struct ata_port *ap) in ata_dummy_error_handler() argument
6854 void ata_port_printk(const struct ata_port *ap, const char *level, in ata_port_printk() argument
6865 printk("%sata%u: %pV", level, ap->print_id, &vaf); in ata_port_printk()
6882 if (sata_pmp_attached(link->ap) || link->ap->slave_link) in ata_link_printk()
6884 level, link->ap->print_id, link->pmp, &vaf); in ata_link_printk()
6887 level, link->ap->print_id, &vaf); in ata_link_printk()
6905 level, dev->link->ap->print_id, dev->link->pmp + dev->devno, in ata_dev_printk()