Lines Matching refs:ap
41 struct ata_port *ap = link->ap; in sata_pmp_read() local
42 struct ata_device *pmp_dev = ap->link.device; in sata_pmp_read()
78 struct ata_port *ap = link->ap; in sata_pmp_write() local
79 struct ata_device *pmp_dev = ap->link.device; in sata_pmp_write()
113 struct ata_port *ap = link->ap; in sata_pmp_qc_defer_cmd_switch() local
115 if (ap->excl_link == NULL || ap->excl_link == link) { in sata_pmp_qc_defer_cmd_switch()
116 if (ap->nr_active_links == 0 || ata_link_active(link)) { in sata_pmp_qc_defer_cmd_switch()
121 ap->excl_link = link; in sata_pmp_qc_defer_cmd_switch()
261 struct ata_port *ap = dev->link->ap; in sata_pmp_configure() local
277 if ((ap->flags & ATA_FLAG_AN) && in sata_pmp_configure()
299 err_mask = sata_pmp_read(&ap->link, PMP_GSCR_SII_POL, ®); in sata_pmp_configure()
306 err_mask = sata_pmp_write(&ap->link, PMP_GSCR_SII_POL, reg); in sata_pmp_configure()
337 static int sata_pmp_init_links (struct ata_port *ap, int nr_ports) in sata_pmp_init_links() argument
339 struct ata_link *pmp_link = ap->pmp_link; in sata_pmp_init_links()
349 ata_link_init(ap, &pmp_link[i], i); in sata_pmp_init_links()
351 ap->pmp_link = pmp_link; in sata_pmp_init_links()
375 ap->pmp_link = NULL; in sata_pmp_init_links()
379 static void sata_pmp_quirks(struct ata_port *ap) in sata_pmp_quirks() argument
381 u32 *gscr = ap->link.device->gscr; in sata_pmp_quirks()
388 ata_for_each_link(link, ap, EDGE) { in sata_pmp_quirks()
413 ata_for_each_link(link, ap, EDGE) in sata_pmp_quirks()
419 ata_for_each_link(link, ap, EDGE) { in sata_pmp_quirks()
449 ap->pmp_link[ap->nr_pmp_links - 1].flags |= ATA_LFLAG_NO_RETRY; in sata_pmp_quirks()
455 ata_for_each_link(link, ap, EDGE) { in sata_pmp_quirks()
465 ata_for_each_link(link, ap, EDGE) { in sata_pmp_quirks()
489 struct ata_port *ap = link->ap; in sata_pmp_attach() local
495 if (!sata_pmp_supported(ap)) { in sata_pmp_attach()
523 rc = sata_pmp_init_links(ap, sata_pmp_gscr_ports(dev->gscr)); in sata_pmp_attach()
530 spin_lock_irqsave(ap->lock, flags); in sata_pmp_attach()
531 WARN_ON(ap->nr_pmp_links); in sata_pmp_attach()
532 ap->nr_pmp_links = sata_pmp_gscr_ports(dev->gscr); in sata_pmp_attach()
533 spin_unlock_irqrestore(ap->lock, flags); in sata_pmp_attach()
535 sata_pmp_quirks(ap); in sata_pmp_attach()
537 if (ap->ops->pmp_attach) in sata_pmp_attach()
538 ap->ops->pmp_attach(ap); in sata_pmp_attach()
540 ata_for_each_link(tlink, ap, EDGE) in sata_pmp_attach()
563 struct ata_port *ap = link->ap; in sata_pmp_detach() local
572 if (ap->ops->pmp_detach) in sata_pmp_detach()
573 ap->ops->pmp_detach(ap); in sata_pmp_detach()
575 ata_for_each_link(tlink, ap, EDGE) in sata_pmp_detach()
578 spin_lock_irqsave(ap->lock, flags); in sata_pmp_detach()
579 ap->nr_pmp_links = 0; in sata_pmp_detach()
581 spin_unlock_irqrestore(ap->lock, flags); in sata_pmp_detach()
652 struct ata_port *ap = link->ap; in sata_pmp_revalidate() local
653 u32 *gscr = (void *)ap->sector_buf; in sata_pmp_revalidate()
752 static int sata_pmp_eh_recover_pmp(struct ata_port *ap, in sata_pmp_eh_recover_pmp() argument
756 struct ata_link *link = &ap->link; in sata_pmp_eh_recover_pmp()
785 ata_for_each_link(tlink, ap, EDGE) { in sata_pmp_eh_recover_pmp()
845 static int sata_pmp_eh_handle_disabled_links(struct ata_port *ap) in sata_pmp_eh_handle_disabled_links() argument
851 spin_lock_irqsave(ap->lock, flags); in sata_pmp_eh_handle_disabled_links()
853 ata_for_each_link(link, ap, EDGE) { in sata_pmp_eh_handle_disabled_links()
857 spin_unlock_irqrestore(ap->lock, flags); in sata_pmp_eh_handle_disabled_links()
875 spin_lock_irqsave(ap->lock, flags); in sata_pmp_eh_handle_disabled_links()
878 spin_unlock_irqrestore(ap->lock, flags); in sata_pmp_eh_handle_disabled_links()
885 struct ata_port *ap = link->ap; in sata_pmp_handle_link_fail() local
897 spin_lock_irqsave(ap->lock, flags); in sata_pmp_handle_link_fail()
899 spin_unlock_irqrestore(ap->lock, flags); in sata_pmp_handle_link_fail()
923 static int sata_pmp_eh_recover(struct ata_port *ap) in sata_pmp_eh_recover() argument
925 struct ata_port_operations *ops = ap->ops; in sata_pmp_eh_recover()
927 struct ata_link *pmp_link = &ap->link; in sata_pmp_eh_recover()
938 ata_for_each_link(link, ap, EDGE) in sata_pmp_eh_recover()
943 if (!sata_pmp_attached(ap)) { in sata_pmp_eh_recover()
944 rc = ata_eh_recover(ap, ops->prereset, ops->softreset, in sata_pmp_eh_recover()
947 ata_for_each_dev(dev, &ap->link, ALL) in sata_pmp_eh_recover()
956 ata_for_each_link(link, ap, EDGE) in sata_pmp_eh_recover()
963 rc = sata_pmp_eh_recover_pmp(ap, ops->prereset, ops->softreset, in sata_pmp_eh_recover()
985 rc = sata_pmp_eh_handle_disabled_links(ap); in sata_pmp_eh_recover()
990 rc = ata_eh_recover(ap, ops->pmp_prereset, ops->pmp_softreset, in sata_pmp_eh_recover()
996 rc = sata_scr_read(&ap->link, SCR_NOTIFICATION, &sntf); in sata_pmp_eh_recover()
998 sata_scr_write(&ap->link, SCR_NOTIFICATION, sntf); in sata_pmp_eh_recover()
1004 ata_for_each_link(link, ap, EDGE) in sata_pmp_eh_recover()
1040 ata_for_each_link(link, ap, EDGE) { in sata_pmp_eh_recover()
1056 ata_port_info(ap, in sata_pmp_eh_recover()
1074 if (ap->pflags & ATA_PFLAG_UNLOADING) in sata_pmp_eh_recover()
1077 if (!sata_pmp_attached(ap)) in sata_pmp_eh_recover()
1085 ata_port_err(ap, "failed to recover PMP after %d tries, giving up\n", in sata_pmp_eh_recover()
1103 void sata_pmp_error_handler(struct ata_port *ap) in sata_pmp_error_handler() argument
1105 ata_eh_autopsy(ap); in sata_pmp_error_handler()
1106 ata_eh_report(ap); in sata_pmp_error_handler()
1107 sata_pmp_eh_recover(ap); in sata_pmp_error_handler()
1108 ata_eh_finish(ap); in sata_pmp_error_handler()