From: Ben Widawsky Date: Fri, 31 Jul 2020 19:37:15 +0000 (-0700) Subject: cxl: Rework caps to new function X-Git-Tag: v3.9.0~27^2~5 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=0d4491cb4520e11eca129c44d3fe9d27109187dc;p=pciutils.git cxl: Rework caps to new function This will help upcoming caps Signed-off-by: Ben Widawsky Co-authored-by: Jaxon Haws Signed-off-by: Jaxon Haws --- diff --git a/ls-ecaps.c b/ls-ecaps.c index b080a19..432d95a 100644 --- a/ls-ecaps.c +++ b/ls-ecaps.c @@ -690,18 +690,12 @@ cap_rcec(struct device *d, int where) } static void -cap_dvsec_cxl(struct device *d, int id, int where) +dvsec_cxl_device(struct device *d, int where, int rev) { u16 w; - printf(": CXL\n"); - if (verbose < 2) - return; - - if (id != 0) - return; - - if (!config_fetch(d, where + PCI_CXL_CAP, PCI_CXL_DEV_LEN - PCI_CXL_CAP)) + /* Legacy 1.1 revs aren't handled */ + if (rev < 1) return; w = get_conf_word(d, where + PCI_CXL_CAP); @@ -719,6 +713,26 @@ cap_dvsec_cxl(struct device *d, int id, int where) printf("\t\tCXLSta:\tViral%c\n", FLAG(w, PCI_CXL_STATUS_VIRAL)); } +static void +cap_dvsec_cxl(struct device *d, int id, int where) +{ + u8 rev; + + printf(": CXL\n"); + 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; + + dvsec_cxl_device(d, where, rev); +} + static void cap_dvsec(struct device *d, int where) {