X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ls-ecaps.c;h=fca19211b3ad8acf35f2aa98c04e3dc5401b38ef;hb=bd853ef840a9c479ad36fadbe4d36ef1ca447aed;hp=b3bba0bf71283861daf16b7fa58f8898f630c206;hpb=5f1d1265ff626deb6813abba00af82acdec3293e;p=pciutils.git diff --git a/ls-ecaps.c b/ls-ecaps.c index b3bba0b..fca1921 100644 --- a/ls-ecaps.c +++ b/ls-ecaps.c @@ -634,6 +634,57 @@ cap_rclink(struct device *d, int where) } } +static void +cap_cxl(struct device *d, int where) +{ + u16 l; + + printf("CXL Designated Vendor-Specific:\n"); + if (verbose < 2) + return; + + if (!config_fetch(d, where + PCI_CXL_CAP, 12)) + return; + + l = get_conf_word(d, where + PCI_CXL_CAP); + printf("\t\tCXLCap:\tCache%c IO%c Mem%c Mem HW Init%c HDMCount %d Viral%c\n", + FLAG(l, PCI_CXL_CAP_CACHE), FLAG(l, PCI_CXL_CAP_IO), FLAG(l, PCI_CXL_CAP_MEM), + FLAG(l, PCI_CXL_CAP_MEM_HWINIT), PCI_CXL_CAP_HDM_CNT(l), FLAG(l, PCI_CXL_CAP_VIRAL)); + + l = get_conf_word(d, where + PCI_CXL_CTRL); + printf("\t\tCXLCtl:\tCache%c IO%c Mem%c Cache SF Cov %d Cache SF Gran %d Cache Clean%c Viral%c\n", + FLAG(l, PCI_CXL_CTRL_CACHE), FLAG(l, PCI_CXL_CTRL_IO), FLAG(l, PCI_CXL_CTRL_MEM), + PCI_CXL_CTRL_CACHE_SF_COV(l), PCI_CXL_CTRL_CACHE_SF_GRAN(l), FLAG(l, PCI_CXL_CTRL_CACHE_CLN), + FLAG(l, PCI_CXL_CTRL_VIRAL)); + + l = get_conf_word(d, where + PCI_CXL_STATUS); + printf("\t\tCXLSta:\tViral%c\n", FLAG(l, PCI_CXL_STATUS_VIRAL)); +} + +static int +is_cxl_cap(struct device *d, int where) +{ + u32 hdr; + u16 w; + + if (!config_fetch(d, where + PCI_DVSEC_HEADER1, 8)) + return 0; + + /* Check for supported Vendor */ + hdr = get_conf_long(d, where + PCI_DVSEC_HEADER1); + w = BITS(hdr, 0, 16); + if (w != PCI_VENDOR_ID_INTEL) + return 0; + + /* Check for Designated Vendor-Specific ID */ + hdr = get_conf_long(d, where + PCI_DVSEC_HEADER2); + w = BITS(hdr, 0, 16); + if (w == PCI_DVSEC_INTEL_CXL) + return 1; + + return 0; +} + static void cap_dvsec(struct device *d, int where) { @@ -947,7 +998,10 @@ show_ext_caps(struct device *d, int type) printf("Readiness Time Reporting \n"); break; case PCI_EXT_CAP_ID_DVSEC: - cap_dvsec(d, where); + if (is_cxl_cap(d, where)) + cap_cxl(d, where); + else + cap_dvsec(d, where); break; case PCI_EXT_CAP_ID_VF_REBAR: printf("VF Resizable BAR \n");