summaryrefslogtreecommitdiff
path: root/ls-caps.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2017-04-21 14:32:26 -0500
committerMartin Mares <mj@ucw.cz>2017-04-29 20:05:07 +0200
commit78996f1c88172dd1bf54d05faff3861999ca2aa1 (patch)
tree3a16c9b0cc44549f50bb57e14579f265da008f38 /ls-caps.c
parentf41bb847b47a67dbda41da378013df0c5e7ce8a7 (diff)
downloadpciutils-78996f1c88172dd1bf54d05faff3861999ca2aa1.tar.gz
lspci: Decode only supported ASPM exit latencies
Per PCIe spec r3.1, sec 7.8.6, the L0s Exit Latency is only valid when L0s is supported, and similarly the L1 Exit Latency is only valid when L1 is supported. Only decode the L0s and L1 Exit Latencies if they are defined. For example, on a device that supports L1 but not L0s, the difference in the "lspci -vv" output looks like this: - LnkCap: Port #1, Speed 8GT/s, Width x1, ASPM L1, Exit Latency L0s <1us, L1 <16us + LnkCap: Port #1, Speed 8GT/s, Width x1, ASPM L1, Exit Latency L1 <16us Correct the comments on the PCI_EXP_LNKCAP_L0S and PCI_EXP_LNKCAP_L1 definitions. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'ls-caps.c')
-rw-r--r--ls-caps.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/ls-caps.c b/ls-caps.c
index 2d3b59d..2111918 100644
--- a/ls-caps.c
+++ b/ls-caps.c
@@ -758,16 +758,25 @@ static const char *aspm_enabled(int code)
static void cap_express_link(struct device *d, int where, int type)
{
- u32 t;
+ u32 t, aspm;
u16 w;
t = get_conf_long(d, where + PCI_EXP_LNKCAP);
- printf("\t\tLnkCap:\tPort #%d, Speed %s, Width x%d, ASPM %s, Exit Latency L0s %s, L1 %s\n",
+ aspm = (t & PCI_EXP_LNKCAP_ASPM) >> 10;
+ printf("\t\tLnkCap:\tPort #%d, Speed %s, Width x%d, ASPM %s",
t >> 24,
link_speed(t & PCI_EXP_LNKCAP_SPEED), (t & PCI_EXP_LNKCAP_WIDTH) >> 4,
- aspm_support((t & PCI_EXP_LNKCAP_ASPM) >> 10),
- latency_l0s((t & PCI_EXP_LNKCAP_L0S) >> 12),
- latency_l1((t & PCI_EXP_LNKCAP_L1) >> 15));
+ aspm_support(aspm));
+ if (aspm)
+ {
+ printf(", Exit Latency ");
+ if (aspm & 1)
+ printf("L0s %s", latency_l0s((t & PCI_EXP_LNKCAP_L0S) >> 12));
+ if (aspm & 2)
+ printf("%sL1 %s", (aspm & 1) ? ", " : "",
+ latency_l1((t & PCI_EXP_LNKCAP_L1) >> 15));
+ }
+ printf("\n");
printf("\t\t\tClockPM%c Surprise%c LLActRep%c BwNot%c ASPMOptComp%c\n",
FLAG(t, PCI_EXP_LNKCAP_CLOCKPM),
FLAG(t, PCI_EXP_LNKCAP_SURPRISE),