]> mj.ucw.cz Git - pciutils.git/commitdiff
lspci: Decode PCIe DevCap "Acceptable Latencies" only for Endpoints
authorBjorn Helgaas <bhelgaas@google.com>
Mon, 9 Sep 2013 23:13:53 +0000 (17:13 -0600)
committerMartin Mares <mj@ucw.cz>
Sun, 10 Nov 2013 11:32:55 +0000 (12:32 +0100)
The PCIe Device Capabilities "Endpoint L0s Acceptable Latency" and
"Endpoint L1 Acceptable Latency" are defined only for Endpoint functions,
so don't display them unless this is an endpoint.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
ls-caps.c

index a1a1546beb953c4298c16548591681e8c9ba0b5a..347f50ab7c273d613dfac4b7ec0ae39d9d8437f4 100644 (file)
--- a/ls-caps.c
+++ b/ls-caps.c
@@ -659,11 +659,14 @@ static void cap_express_dev(struct device *d, int where, int type)
   u16 w;
 
   t = get_conf_long(d, where + PCI_EXP_DEVCAP);
-  printf("\t\tDevCap:\tMaxPayload %d bytes, PhantFunc %d, Latency L0s %s, L1 %s\n",
+  printf("\t\tDevCap:\tMaxPayload %d bytes, PhantFunc %d",
        128 << (t & PCI_EXP_DEVCAP_PAYLOAD),
-       (1 << ((t & PCI_EXP_DEVCAP_PHANTOM) >> 3)) - 1,
+       (1 << ((t & PCI_EXP_DEVCAP_PHANTOM) >> 3)) - 1);
+  if ((type == PCI_EXP_TYPE_ENDPOINT) || (type == PCI_EXP_TYPE_LEG_END))
+    printf(", Latency L0s %s, L1 %s",
        latency_l0s((t & PCI_EXP_DEVCAP_L0S) >> 6),
        latency_l1((t & PCI_EXP_DEVCAP_L1) >> 9));
+  printf("\n");
   printf("\t\t\tExtTag%c", FLAG(t, PCI_EXP_DEVCAP_EXT_TAG));
   if ((type == PCI_EXP_TYPE_ENDPOINT) || (type == PCI_EXP_TYPE_LEG_END) ||
       (type == PCI_EXP_TYPE_UPSTREAM) || (type == PCI_EXP_TYPE_PCI_BRIDGE))