]> git.ipfire.org Git - thirdparty/pciutils.git/commitdiff
Only decode defined fields of PCI Express Link Control 2
authorBen Hutchings <bhutchings@solarflare.com>
Thu, 17 May 2012 14:14:16 +0000 (15:14 +0100)
committerMartin Mares <mj@ucw.cz>
Mon, 28 May 2012 13:39:28 +0000 (15:39 +0200)
On a PCI Express multi-function device associated with an upstream
port, all bits of the Link Control 2 register are currently reserved
on functions > 0.

The Selectable De-emphasis field is reserved on all but downstream
ports.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
ls-caps.c

index 9645e5a8c40dc2049397fa2aa795dc13c742287a..4a75ce70eb84f9455bbcec4befa0f531d300056c 100644 (file)
--- a/ls-caps.c
+++ b/ls-caps.c
@@ -991,22 +991,28 @@ static const char *cap_express_link2_transmargin(int type)
     }
 }
 
-static void cap_express_link2(struct device *d, int where, int type UNUSED)
+static void cap_express_link2(struct device *d, int where, int type)
 {
   u16 w;
 
-  w = get_conf_word(d, where + PCI_EXP_LNKCTL2);
-  printf("\t\tLnkCtl2: Target Link Speed: %s, EnterCompliance%c SpeedDis%c, Selectable De-emphasis: %s\n"
-       "\t\t\t Transmit Margin: %s, EnterModifiedCompliance%c ComplianceSOS%c\n"
-       "\t\t\t Compliance De-emphasis: %s\n",
+  if (!((type == PCI_EXP_TYPE_ENDPOINT || type == PCI_EXP_TYPE_LEG_END) &&
+       (d->dev->dev != 0 || d->dev->func != 0))) {
+    w = get_conf_word(d, where + PCI_EXP_LNKCTL2);
+    printf("\t\tLnkCtl2: Target Link Speed: %s, EnterCompliance%c SpeedDis%c",
        cap_express_link2_speed(PCI_EXP_LNKCTL2_SPEED(w)),
        FLAG(w, PCI_EXP_LNKCTL2_CMPLNC),
-       FLAG(w, PCI_EXP_LNKCTL2_SPEED_DIS),
-       cap_express_link2_deemphasis(PCI_EXP_LNKCTL2_DEEMPHASIS(w)),
+       FLAG(w, PCI_EXP_LNKCTL2_SPEED_DIS));
+    if (type == PCI_EXP_TYPE_DOWNSTREAM)
+      printf(", Selectable De-emphasis: %s",
+       cap_express_link2_deemphasis(PCI_EXP_LNKCTL2_DEEMPHASIS(w)));
+    printf("\n"
+       "\t\t\t Transmit Margin: %s, EnterModifiedCompliance%c ComplianceSOS%c\n"
+       "\t\t\t Compliance De-emphasis: %s\n",
        cap_express_link2_transmargin(PCI_EXP_LNKCTL2_MARGIN(w)),
        FLAG(w, PCI_EXP_LNKCTL2_MOD_CMPLNC),
        FLAG(w, PCI_EXP_LNKCTL2_CMPLNC_SOS),
        cap_express_link2_deemphasis(PCI_EXP_LNKCTL2_COM_DEEMPHASIS(w)));
+  }
 
   w = get_conf_word(d, where + PCI_EXP_LNKSTA2);
   printf("\t\tLnkSta2: Current De-emphasis Level: %s, EqualizationComplete%c, EqualizationPhase1%c\n"