From 37f8039da834b3bc1dac7473ff75ba5dde6a9318 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 17 May 2012 15:14:16 +0100 Subject: [PATCH] Only decode defined fields of PCI Express Link Control 2 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 --- ls-caps.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/ls-caps.c b/ls-caps.c index 9645e5a..4a75ce7 100644 --- 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" -- 2.39.2