]> git.ipfire.org Git - thirdparty/pciutils.git/commitdiff
Decoding of the Vendor-Specific Capabilities (both PCI and PCIe)
authorMartin Mares <mj@ucw.cz>
Sat, 23 Jan 2010 21:31:08 +0000 (22:31 +0100)
committerMartin Mares <mj@ucw.cz>
Sat, 23 Jan 2010 21:31:08 +0000 (22:31 +0100)
lib/header.h
ls-caps.c
ls-ecaps.c

index c611914e8f1f8956cd7807827c68d1915e6846ac..92d7d1ee932a90ea067470d7544f3b0192086b1c 100644 (file)
 #define PCI_HT_RM_CNT1         10      /* Retry Count 1 Register */
 #define PCI_HT_RM_SIZEOF       12
 
+/* Vendor-Specific Capability (see PCI_EVNDR_xxx for the PCIe version) */
+#define PCI_VNDR_LENGTH                2       /* Length byte */
+
 /* PCI Express */
 #define PCI_EXP_FLAGS          0x2     /* Capabilities register */
 #define PCI_EXP_FLAGS_VERS     0x000f  /* Capability version */
 #define  PCI_RCLINK_LINK_ADDR  8       /* Link Entry: Address (64-bit) */
 #define  PCI_RCLINK_LINK_SIZE  16      /* Link Entry: sizeof */
 
+/* PCIe Vendor-Specific Capability */
+#define PCI_EVNDR_HEADER       4       /* Vendor-Specific Header */
+#define PCI_EVNDR_REGISTERS    8       /* Vendor-Specific Registers */
+
 /* Access Control Services */
 #define PCI_ACS_CAP            0x04    /* ACS Capability Register */
 #define PCI_ACS_CAP_VALID      0x0001  /* ACS Source Validation */
index 507771a95ab139758a792a563bb081b4def0ef8c..5ca2cd43f384bf348da7167f8143b16350c7e947 100644 (file)
--- a/ls-caps.c
+++ b/ls-caps.c
@@ -1225,7 +1225,7 @@ show_caps(struct device *d)
              cap_ht(d, where, cap);
              break;
            case PCI_CAP_ID_VNDR:
-             printf("Vendor Specific Information <?>\n");
+             printf("Vendor Specific Information: Len=%02x <?>\n", BITS(cap, 0, 8));
              break;
            case PCI_CAP_ID_DBG:
              cap_debug_port(cap);
index 04140741b73cfd3ba3e5b66cd63d6e40fb98bbb9..dac87ffe0055ef0244830ebed6717c8252fd49fa 100644 (file)
@@ -362,6 +362,25 @@ cap_rclink(struct device *d, int where)
     }
 }
 
+static void
+cap_evendor(struct device *d, int where)
+{
+  u32 hdr;
+
+  printf("Vendor Specific Information: ");
+  if (!config_fetch(d, where + PCI_EVNDR_HEADER, 4))
+    {
+      printf("<unreadable>\n");
+      return;
+    }
+
+  hdr = get_conf_long(d, where + PCI_EVNDR_HEADER);
+  printf("ID=%04x Rev=%d Len=%03x <?>\n",
+    BITS(hdr, 0, 16),
+    BITS(hdr, 16, 4),
+    BITS(hdr, 20, 12));
+}
+
 void
 show_ext_caps(struct device *d)
 {
@@ -420,7 +439,7 @@ show_ext_caps(struct device *d)
            printf("Root Bridge Control Block <?>\n");
            break;
          case PCI_EXT_CAP_ID_VNDR:
-           printf("Vendor Specific Information <?>\n");
+           cap_evendor(d, where);
            break;
          case PCI_EXT_CAP_ID_ACS:
            cap_acs(d, where);