]> git.ipfire.org Git - thirdparty/pciutils.git/commitdiff
cxl: Add support for DVSEC port cap
authorBen Widawsky <ben.widawsky@intel.com>
Fri, 31 Jul 2020 21:31:17 +0000 (14:31 -0700)
committerJaxon Haws <jaxon.haws@amd.com>
Thu, 13 Oct 2022 21:18:39 +0000 (16:18 -0500)
Signed-off-by: Ben Widawsky <ben.widawsky@intel.com>
Co-authored-by: Jaxon Haws <jaxon.haws@amd.com>
Signed-off-by: Jaxon Haws <jaxon.haws@amd.com>
---
Add Viral Enable (Jonathan)
Add missing tab (Jonathan)
Add Alt Mem base/limit (Jonathan)

lib/header.h
ls-ecaps.c

index 365a59c116a1fb614b099ad10fc2f4f8c0f212ec..7cbc40f41a5deb1abed8bae72b2338b37edc1609 100644 (file)
 #define PCI_CXL_DEV_RANGE2_BASE_HI     0x30
 #define PCI_CXL_DEV_RANGE2_BASE_LO     0x34
 
+/* PCIe CXL 2.0 Designated Vendor-Specific Capabilities for Ports */
+#define PCI_CXL_PORT_EXT_LEN 0x28 /* CXL Extensions DVSEC for Ports Length */
+#define PCI_CXL_PORT_EXT_STATUS 0x0a           /* Port Extension Status */
+#define  PCI_CXL_PORT_PM_INIT_COMPLETE 0x1     /* Port Power Management Initialization Complete */
+#define PCI_CXL_PORT_CTRL 0x0c                 /* Port Control Override */
+#define  PCI_CXL_PORT_UNMASK_SBR 0x0001                /* Unmask SBR */
+#define  PCI_CXL_PORT_UNMASK_LINK 0x0002       /* Unmask Link Disable */
+#define  PCI_CXL_PORT_ALT_MEMORY 0x0004                /* Alt Memory and ID Space Enable */
+#define  PCI_CXL_PORT_ALT_BME 0x0008           /* Alt BME */
+#define  PCI_CXL_PORT_VIRAL_EN 0x4000          /* Viral Enable */
+#define PCI_CXL_PORT_ALT_BUS_BASE 0xe
+#define PCI_CXL_PORT_ALT_BUS_LIMIT 0xf
+#define PCI_CXL_PORT_ALT_MEM_BASE 0x10
+#define PCI_CXL_PORT_ALT_MEM_LIMIT 0x12
+
 /* Access Control Services */
 #define PCI_ACS_CAP            0x04    /* ACS Capability Register */
 #define PCI_ACS_CAP_VALID      0x0001  /* ACS Source Validation */
index 27014ba95baf1b9ef13b8a47d1ea6ff60d09fcfd..87f51b0ab2166ff91a6beee4e5fcc7a57fae33db 100644 (file)
@@ -778,6 +778,29 @@ dvsec_cxl_device(struct device *d, int where, int rev)
   cxl_range(range_base, range_size, 2);
 }
 
+static void
+dvsec_cxl_port(struct device *d, int where)
+{
+  u16 w, m1, m2;
+  u8 b1, b2;
+
+  w = get_conf_word(d, where + PCI_CXL_PORT_EXT_STATUS);
+  printf("\t\tCXLPortSta:\tPMComplete%c\n", FLAG(w, PCI_CXL_PORT_EXT_STATUS));
+
+  w = get_conf_word(d, where + PCI_CXL_PORT_CTRL);
+  printf("\t\tCXLPortCtl:\tUnmaskSBR%c UnmaskLinkDisable%c AltMem%c AltBME%c ViralEnable%c\n",
+    FLAG(w, PCI_CXL_PORT_UNMASK_SBR), FLAG(w, PCI_CXL_PORT_UNMASK_LINK),
+    FLAG(w, PCI_CXL_PORT_ALT_MEMORY), FLAG(w, PCI_CXL_PORT_ALT_BME),
+    FLAG(w, PCI_CXL_PORT_VIRAL_EN));
+
+  b1 = get_conf_byte(d, where + PCI_CXL_PORT_ALT_BUS_BASE);
+  b2 = get_conf_byte(d, where + PCI_CXL_PORT_ALT_BUS_LIMIT);
+  printf("\t\tAlternateBus:\t%02x-%02x\n", b1, b2);
+  m1 = get_conf_word(d, where + PCI_CXL_PORT_ALT_MEM_BASE);
+  m2 = get_conf_word(d, where + PCI_CXL_PORT_ALT_MEM_LIMIT);
+  printf("\t\tAlternateBus:\t%04x-%04x\n", m1, m2);
+}
+
 static void
 cap_dvsec_cxl(struct device *d, int id, int where)
 {
@@ -787,15 +810,24 @@ cap_dvsec_cxl(struct device *d, int id, int where)
   if (verbose < 2)
     return;
 
-  if (id != 0)
-    return;
-
   rev = BITS(get_conf_byte(d, where + 0x6), 0, 4);
 
-  if (!config_fetch(d, where, PCI_CXL_DEV_LEN))
-    return;
+  switch (id) {
+    case 0:
+      if (!config_fetch(d, where, PCI_CXL_DEV_LEN))
+        return;
 
-  dvsec_cxl_device(d, where, rev);
+      dvsec_cxl_device(d, where, rev);
+      break;
+    case 3:
+      if (!config_fetch(d, where, PCI_CXL_PORT_EXT_LEN))
+        return;
+
+      dvsec_cxl_port(d, where);
+      break;
+    default:
+      break;
+  }
 }
 
 static void