Author: mav Date: Sat Nov 14 01:45:34 2020 New Revision: 367659 URL: https://svnweb.freebsd.org/changeset/base/367659
Log: Add PMRCAP printing and fix earlier CAP_HI. MFC after: 3 days Modified: head/sys/dev/nvme/nvme.h head/sys/dev/nvme/nvme_ctrlr.c Modified: head/sys/dev/nvme/nvme.h ============================================================================== --- head/sys/dev/nvme/nvme.h Sat Nov 14 01:39:27 2020 (r367658) +++ head/sys/dev/nvme/nvme.h Sat Nov 14 01:45:34 2020 (r367659) @@ -150,6 +150,36 @@ #define NVME_AQA_REG_ACQS_SHIFT (16) #define NVME_AQA_REG_ACQS_MASK (0xFFF) +#define NVME_PMRCAP_REG_RDS_SHIFT (3) +#define NVME_PMRCAP_REG_RDS_MASK (0x1) +#define NVME_PMRCAP_REG_WDS_SHIFT (4) +#define NVME_PMRCAP_REG_WDS_MASK (0x1) +#define NVME_PMRCAP_REG_BIR_SHIFT (5) +#define NVME_PMRCAP_REG_BIR_MASK (0x7) +#define NVME_PMRCAP_REG_PMRTU_SHIFT (8) +#define NVME_PMRCAP_REG_PMRTU_MASK (0x3) +#define NVME_PMRCAP_REG_PMRWBM_SHIFT (10) +#define NVME_PMRCAP_REG_PMRWBM_MASK (0xf) +#define NVME_PMRCAP_REG_PMRTO_SHIFT (16) +#define NVME_PMRCAP_REG_PMRTO_MASK (0xff) +#define NVME_PMRCAP_REG_CMSS_SHIFT (24) +#define NVME_PMRCAP_REG_CMSS_MASK (0x1) + +#define NVME_PMRCAP_RDS(x) \ + (((x) >> NVME_PMRCAP_REG_RDS_SHIFT) & NVME_PMRCAP_REG_RDS_MASK) +#define NVME_PMRCAP_WDS(x) \ + (((x) >> NVME_PMRCAP_REG_WDS_SHIFT) & NVME_PMRCAP_REG_WDS_MASK) +#define NVME_PMRCAP_BIR(x) \ + (((x) >> NVME_PMRCAP_REG_BIR_SHIFT) & NVME_PMRCAP_REG_BIR_MASK) +#define NVME_PMRCAP_PMRTU(x) \ + (((x) >> NVME_PMRCAP_REG_PMRTU_SHIFT) & NVME_PMRCAP_REG_PMRTU_MASK) +#define NVME_PMRCAP_PMRWBM(x) \ + (((x) >> NVME_PMRCAP_REG_PMRWBM_SHIFT) & NVME_PMRCAP_REG_PMRWBM_MASK) +#define NVME_PMRCAP_PMRTO(x) \ + (((x) >> NVME_PMRCAP_REG_PMRTO_SHIFT) & NVME_PMRCAP_REG_PMRTO_MASK) +#define NVME_PMRCAP_CMSS(x) \ + (((x) >> NVME_PMRCAP_REG_CMSS_SHIFT) & NVME_PMRCAP_REG_CMSS_MASK) + /* Command field definitions */ #define NVME_CMD_FUSE_SHIFT (8) Modified: head/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- head/sys/dev/nvme/nvme_ctrlr.c Sat Nov 14 01:39:27 2020 (r367658) +++ head/sys/dev/nvme/nvme_ctrlr.c Sat Nov 14 01:45:34 2020 (r367659) @@ -1367,7 +1367,7 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, de struct make_dev_args md_args; uint32_t cap_lo; uint32_t cap_hi; - uint32_t to, vs; + uint32_t to, vs, pmrcap; uint8_t mpsmin; int status, timeout_period; @@ -1390,20 +1390,32 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, de cap_hi = nvme_mmio_read_4(ctrlr, cap_hi); if (bootverbose) { device_printf(dev, "CapHi: 0x%08x: DSTRD %u%s, CSS %x%s, " - "MPSMIN %u, MPSMAX %u %s%s\n", cap_hi, + "MPSMIN %u, MPSMAX %u%s%s\n", cap_hi, NVME_CAP_HI_DSTRD(cap_hi), - NVME_CAP_HI_NSSRS(cap_lo) ? ", NSSRS" : "", + NVME_CAP_HI_NSSRS(cap_hi) ? ", NSSRS" : "", NVME_CAP_HI_CSS(cap_hi), - NVME_CAP_HI_BPS(cap_lo) ? ", BPS" : "", + NVME_CAP_HI_BPS(cap_hi) ? ", BPS" : "", NVME_CAP_HI_MPSMIN(cap_hi), NVME_CAP_HI_MPSMAX(cap_hi), - NVME_CAP_HI_PMRS(cap_lo) ? ", PMRS" : "", - NVME_CAP_HI_CMBS(cap_lo) ? ", CMBS" : ""); + NVME_CAP_HI_PMRS(cap_hi) ? ", PMRS" : "", + NVME_CAP_HI_CMBS(cap_hi) ? ", CMBS" : ""); } if (bootverbose) { vs = nvme_mmio_read_4(ctrlr, vs); device_printf(dev, "Version: 0x%08x: %d.%d\n", vs, NVME_MAJOR(vs), NVME_MINOR(vs)); + } + if (bootverbose && NVME_CAP_HI_PMRS(cap_hi)) { + pmrcap = nvme_mmio_read_4(ctrlr, pmrcap); + device_printf(dev, "PMRCap: 0x%08x: BIR %u%s%s, PMRTU %u, " + "PMRWBM %x, PMRTO %u%s\n", pmrcap, + NVME_PMRCAP_BIR(pmrcap), + NVME_PMRCAP_RDS(pmrcap) ? ", RDS" : "", + NVME_PMRCAP_WDS(pmrcap) ? ", WDS" : "", + NVME_PMRCAP_PMRTU(pmrcap), + NVME_PMRCAP_PMRWBM(pmrcap), + NVME_PMRCAP_PMRTO(pmrcap), + NVME_PMRCAP_CMSS(pmrcap) ? ", CMSS" : ""); } ctrlr->dstrd = NVME_CAP_HI_DSTRD(cap_hi) + 2; _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"