Lines Matching refs:link
26 * @link: link to read PMP register for
38 static unsigned int sata_pmp_read(struct ata_link *link, int reg, u32 *r_val)
40 struct ata_port *ap = link->ap;
41 struct ata_device *pmp_dev = ap->link.device;
50 tf.device = link->pmp;
63 * @link: link to write PMP register for
75 static unsigned int sata_pmp_write(struct ata_link *link, int reg, u32 val)
77 struct ata_port *ap = link->ap;
78 struct ata_device *pmp_dev = ap->link.device;
86 tf.device = link->pmp;
111 struct ata_link *link = qc->dev->link;
112 struct ata_port *ap = link->ap;
114 if (ap->excl_link == NULL || ap->excl_link == link) {
115 if (ap->nr_active_links == 0 || ata_link_active(link)) {
120 ap->excl_link = link;
128 * @link: ATA link to read PSCR for
132 * Read PSCR @reg into @r_val for @link, to be called from
141 int sata_pmp_scr_read(struct ata_link *link, int reg, u32 *r_val)
148 err_mask = sata_pmp_read(link, reg, r_val);
150 ata_link_warn(link, "failed to read SCR %d (Emask=0x%x)\n",
159 * @link: ATA link to write PSCR for
163 * Write @val to PSCR @reg for @link, to be called from
172 int sata_pmp_scr_write(struct ata_link *link, int reg, u32 val)
179 err_mask = sata_pmp_write(link, reg, val);
181 ata_link_warn(link, "failed to write SCR %d (Emask=0x%x)\n",
189 * sata_pmp_set_lpm - configure LPM for a PMP link
190 * @link: PMP link to configure LPM for
194 * Configure LPM for @link. This function will contain any PMP
203 int sata_pmp_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
206 return sata_link_scr_lpm(link, policy, true);
232 err_mask = sata_pmp_read(dev->link, reg, &gscr[reg]);
260 struct ata_port *ap = dev->link->ap;
281 err_mask = sata_pmp_write(dev->link, SATA_PMP_GSCR_ERROR_EN,
298 err_mask = sata_pmp_read(&ap->link, PMP_GSCR_SII_POL, ®);
305 err_mask = sata_pmp_write(&ap->link, PMP_GSCR_SII_POL, reg);
361 struct ata_link *link = &pmp_link[i];
362 struct ata_eh_context *ehc = &link->eh_context;
364 link->flags = 0;
380 u32 *gscr = ap->link.device->gscr;
383 struct ata_link *link;
387 ata_for_each_link(link, ap, EDGE) {
388 /* link reports offline after LPM */
389 link->flags |= ATA_LFLAG_NO_LPM;
395 if (link->pmp < 5)
396 link->flags |= ATA_LFLAG_NO_SRST |
400 if (link->pmp == 5)
401 link->flags |= ATA_LFLAG_NO_SRST |
412 ata_for_each_link(link, ap, EDGE)
413 link->flags |= ATA_LFLAG_NO_LPM |
418 ata_for_each_link(link, ap, EDGE) {
419 /* link reports offline after LPM */
420 link->flags |= ATA_LFLAG_NO_LPM;
427 if (link->pmp <= 5)
428 link->flags |= ATA_LFLAG_NO_SRST |
434 if (link->pmp == 6)
435 link->flags |= ATA_LFLAG_NO_SRST |
454 ata_for_each_link(link, ap, EDGE) {
458 link->flags |= ATA_LFLAG_NO_LPM |
464 ata_for_each_link(link, ap, EDGE) {
466 if (link->pmp == 4)
467 link->flags |= ATA_LFLAG_DISABLED;
487 struct ata_link *link = dev->link;
488 struct ata_port *ap = link->ap;
499 if (!ata_is_host_link(link)) {
509 WARN_ON(link->pmp != 0);
510 link->pmp = SATA_PMP_CTRL_PORT;
545 link->pmp = 0;
561 struct ata_link *link = dev->link;
562 struct ata_port *ap = link->ap;
568 WARN_ON(!ata_is_host_link(link) || dev->devno ||
569 link->pmp != SATA_PMP_CTRL_PORT);
579 link->pmp = 0;
650 struct ata_link *link = dev->link;
651 struct ata_port *ap = link->ap;
657 ata_eh_about_to_do(link, NULL, ATA_EH_REVALIDATE);
687 ata_eh_done(link, NULL, ATA_EH_REVALIDATE);
715 err_mask = sata_pmp_read(dev->link, SATA_PMP_GSCR_PROD_ID, &prod_id);
755 struct ata_link *link = &ap->link;
756 struct ata_eh_context *ehc = &link->eh_context;
757 struct ata_device *dev = link->device;
777 rc = ata_eh_reset(link, 0, prereset, softreset, hardreset,
780 ata_link_err(link, "failed to reset PMP, giving up\n");
814 sata_down_spd_limit(link, 0);
847 struct ata_link *link;
853 ata_for_each_link(link, ap, EDGE) {
854 if (!(link->flags & ATA_LFLAG_DISABLED))
862 sata_link_hardreset(link, sata_deb_timing_normal,
867 rc = sata_scr_write(link, SCR_ERROR, SERR_PHYRDY_CHG);
869 ata_link_err(link,
883 static int sata_pmp_handle_link_fail(struct ata_link *link, int *link_tries)
885 struct ata_port *ap = link->ap;
888 if (link_tries[link->pmp] && --link_tries[link->pmp])
891 /* disable this link */
892 if (!(link->flags & ATA_LFLAG_DISABLED)) {
893 ata_link_warn(link,
894 "failed to recover link after %d tries, disabling\n",
898 link->flags |= ATA_LFLAG_DISABLED;
902 ata_dev_disable(link->device);
903 link->eh_context.i.action = 0;
927 struct ata_link *pmp_link = &ap->link;
931 struct ata_link *link;
938 ata_for_each_link(link, ap, EDGE)
939 link_tries[link->pmp] = ATA_EH_PMP_LINK_TRIES;
947 ata_for_each_dev(dev, &ap->link, ALL)
956 ata_for_each_link(link, ap, EDGE)
957 link_tries[link->pmp] = ATA_EH_PMP_LINK_TRIES;
991 ops->pmp_hardreset, ops->pmp_postreset, &link);
996 rc = sata_scr_read(&ap->link, SCR_NOTIFICATION, &sntf);
998 sata_scr_write(&ap->link, SCR_NOTIFICATION, sntf);
1004 ata_for_each_link(link, ap, EDGE)
1005 if (link->lpm_policy > ATA_LPM_MAX_POWER)
1040 ata_for_each_link(link, ap, EDGE) {
1041 if (!(gscr_error & (1 << link->pmp)))
1044 if (sata_pmp_handle_link_fail(link, link_tries)) {
1045 ata_ehi_hotplugged(&link->eh_context.i);
1048 ata_link_warn(link,
1050 ata_link_warn(link,
1051 "Manually issue scan to resume this link\n");
1064 if (sata_pmp_handle_link_fail(link, link_tries)) {