This will help upcoming caps Signed-off-by: Ben Widawsky <ben.widawsky@xxxxxxxxx> --- ls-ecaps.c | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/ls-ecaps.c b/ls-ecaps.c index 2b3f0f9..c2a13d5 100644 --- a/ls-ecaps.c +++ b/ls-ecaps.c @@ -690,35 +690,49 @@ cap_rcec(struct device *d, int where) } static void -cap_dvsec_cxl(struct device *d, int id, int where) +dvsec_cxl_device(uint8_t *data, int rev) { u16 w; - printf(": CXL\n"); - if (verbose < 2) - return; - - if (id != 0) - return; - - if (!config_fetch(d, where + PCI_CXL_CAP, 0x38 - 0xa)) + /* Legacy 1.1 revs aren't handled */ + if (rev != 1) return; - w = get_conf_word(d, where + PCI_CXL_CAP); + w = *(u16 *)(data + PCI_CXL_CAP); printf("\t\tCXLCap:\tCache%c IO%c Mem%c Mem HW Init%c HDMCount %d Viral%c\n", FLAG(w, PCI_CXL_CAP_CACHE), FLAG(w, PCI_CXL_CAP_IO), FLAG(w, PCI_CXL_CAP_MEM), FLAG(w, PCI_CXL_CAP_MEM_HWINIT), PCI_CXL_CAP_HDM_CNT(w), FLAG(w, PCI_CXL_CAP_VIRAL)); - w = get_conf_word(d, where + PCI_CXL_CTRL); + w = *(u16 *)(data + 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(w, PCI_CXL_CTRL_CACHE), FLAG(w, PCI_CXL_CTRL_IO), FLAG(w, PCI_CXL_CTRL_MEM), PCI_CXL_CTRL_CACHE_SF_COV(w), PCI_CXL_CTRL_CACHE_SF_GRAN(w), FLAG(w, PCI_CXL_CTRL_CACHE_CLN), FLAG(w, PCI_CXL_CTRL_VIRAL)); - w = get_conf_word(d, where + PCI_CXL_STATUS); + w = *(u16 *)(data + PCI_CXL_STATUS); 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, 0x38)) + return; + + dvsec_cxl_device(d->config + where, rev); +} + static void cap_dvsec(struct device *d, int where) { -- 2.31.1