]> mj.ucw.cz Git - pciutils.git/commitdiff
lspci: Decode Precision Time Measurement capabiltity
authorYong, Jonathan <jonathan.yong@intel.com>
Tue, 10 May 2016 03:15:55 +0000 (03:15 +0000)
committerMartin Mares <mj@ucw.cz>
Sat, 14 May 2016 09:22:59 +0000 (11:22 +0200)
Section 7.32 Precision Time Management (or Measurement) from the
PCI Express Base 3.1 specification is an optional Extended Capability
for discovering and controlling the distribution of a PTM Hierarchy.

Signed-off-by: Yong, Jonathan <jonathan.yong@intel.com>
lib/header.h
ls-ecaps.c

index b8f7dc14c58fe0005dadbfc86d253bca97d9576e..8463641cbdab0ff3929f64d0bccdb0602ee88065 100644 (file)
 #define PCI_EXT_CAP_ID_LTR     0x18    /* Latency Tolerance Reporting */
 #define PCI_EXT_CAP_ID_PASID   0x1b    /* Process Address Space ID */
 #define PCI_EXT_CAP_ID_L1PM    0x1e    /* L1 PM Substates */
+#define PCI_EXT_CAP_ID_PTM     0x1f    /* Precision Time Measurement */
 
 /*** Definitions of capabilities ***/
 
index 82984356537280e055f3051206c5a7d6738939e0..0273240f51fe65939c5812067b79248710e8fcb7 100644 (file)
@@ -548,6 +548,65 @@ cap_l1pm(struct device *d, int where)
     }
 }
 
+static void
+cap_ptm(struct device *d, int where)
+{
+  u32 buff;
+  u16 clock;
+
+  printf("Precision Time Measurement\n");
+
+  if (verbose < 2)
+    return;
+
+  if (!config_fetch(d, where + 4, 8))
+    {
+      printf("\t\t<unreadable>\n");
+      return;
+    }
+
+  buff = get_conf_long(d, where + 4);
+  printf("\t\tPTMCap: ");
+  printf("Requester:%c Responder:%c Root:%c\n",
+    FLAG(buff, 0x1),
+    FLAG(buff, 0x2),
+    FLAG(buff, 0x4));
+
+  clock = BITS(buff, 8, 8);
+  printf("\t\tPTMClockGranularity: ");
+  switch (clock)
+    {
+      case 0x00:
+        printf("Unimplemented\n");
+        break;
+      case 0xff:
+        printf("Greater than 254ns\n");
+        break;
+      default:
+        printf("%huns\n", clock);
+    }
+
+  buff = get_conf_long(d, where + 8);
+  printf("\t\tPTMControl: ");
+  printf("Enabled:%c RootSelected:%c\n",
+    FLAG(buff, 0x1),
+    FLAG(buff, 0x2));
+
+  clock = BITS(buff, 8, 8);
+  printf("\t\tPTMEffectiveGranularity: ");
+  switch (clock)
+    {
+      case 0x00:
+        printf("Unknown\n");
+        break;
+      case 0xff:
+        printf("Greater than 254ns\n");
+        break;
+      default:
+        printf("%huns\n", clock);
+    }
+}
+
 void
 show_ext_caps(struct device *d)
 {
@@ -635,6 +694,9 @@ show_ext_caps(struct device *d)
          case PCI_EXT_CAP_ID_L1PM:
            cap_l1pm(d, where);
            break;
+         case PCI_EXT_CAP_ID_PTM:
+           cap_ptm(d, where);
+           break;
          default:
            printf("#%02x\n", id);
            break;