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;
655 ata_eh_about_to_do(link, NULL, ATA_EH_REVALIDATE);
685 ata_eh_done(link, NULL, ATA_EH_REVALIDATE);
711 err_mask = sata_pmp_read(dev->link, SATA_PMP_GSCR_PROD_ID, &prod_id);
751 struct ata_link *link = &ap->link;
752 struct ata_eh_context *ehc = &link->eh_context;
753 struct ata_device *dev = link->device;
771 rc = ata_eh_reset(link, 0, prereset, softreset, hardreset,
774 ata_link_err(link, "failed to reset PMP, giving up\n");
808 sata_down_spd_limit(link, 0);
839 struct ata_link *link;
845 ata_for_each_link(link, ap, EDGE) {
846 if (!(link->flags & ATA_LFLAG_DISABLED))
854 sata_link_hardreset(link, sata_deb_timing_normal,
859 rc = sata_scr_write(link, SCR_ERROR, SERR_PHYRDY_CHG);
861 ata_link_err(link,
875 static int sata_pmp_handle_link_fail(struct ata_link *link, int *link_tries)
877 struct ata_port *ap = link->ap;
880 if (link_tries[link->pmp] && --link_tries[link->pmp])
883 /* disable this link */
884 if (!(link->flags & ATA_LFLAG_DISABLED)) {
885 ata_link_warn(link,
886 "failed to recover link after %d tries, disabling\n",
890 link->flags |= ATA_LFLAG_DISABLED;
894 ata_dev_disable(link->device);
895 link->eh_context.i.action = 0;
919 struct ata_link *pmp_link = &ap->link;
923 struct ata_link *link;
930 ata_for_each_link(link, ap, EDGE)
931 link_tries[link->pmp] = ATA_EH_PMP_LINK_TRIES;
939 ata_for_each_dev(dev, &ap->link, ALL)
948 ata_for_each_link(link, ap, EDGE)
949 link_tries[link->pmp] = ATA_EH_PMP_LINK_TRIES;
983 ops->pmp_hardreset, ops->pmp_postreset, &link);
988 rc = sata_scr_read(&ap->link, SCR_NOTIFICATION, &sntf);
990 sata_scr_write(&ap->link, SCR_NOTIFICATION, sntf);
996 ata_for_each_link(link, ap, EDGE)
997 if (link->lpm_policy > ATA_LPM_MAX_POWER)
1032 ata_for_each_link(link, ap, EDGE) {
1033 if (!(gscr_error & (1 << link->pmp)))
1036 if (sata_pmp_handle_link_fail(link, link_tries)) {
1037 ata_ehi_hotplugged(&link->eh_context.i);
1040 ata_link_warn(link,
1042 ata_link_warn(link,
1043 "Manually issue scan to resume this link\n");
1056 if (sata_pmp_handle_link_fail(link, link_tries)) {