From nobody Wed Dec 27 18:52:27 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T0gk42MVxz567LR; Wed, 27 Dec 2023 18:52:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T0gk412m0z4Kxr; Wed, 27 Dec 2023 18:52:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703703148; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=moqFindge+wRWORPKN0bLOkbu0+899vK1xmYYKVPR8g=; b=U6Rj9JZccCUFka4sFlU3EwXM9SVBYSzLUYN/AJKvSHa5H/0FHRA+BI/zCArENxXtPO28Mc DEtpgcZTT7x2lBkaRqPPuXRKsC4Mz6XtegNtK+O1ol41tCXuzSdfrLiBODhF6kihQS+0mp fOko/kh0wP+3SQRDip5y20HH+Vg6suMT1hI/nHQALY9zIhFIEWIVvDYYgfAaEcmryMytgM BBCGnDuBduF1I4OBt8/K7Y+7cvBwu1/zDwsBqfZzee181SH4euPXC0uY45bDm/R9TI4WCa 2LMTxPiNFUd32jSzfVsNnY7GXrUj1PFEPdw15s8UsBdcEjWsIq6gxs+vEJEMpg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703703148; a=rsa-sha256; cv=none; b=LyjLwrcCxMXTW6/XZ68yBVG/kEHtyDhYwhLrWYsAu00dOuJgL+rUh9l4hA0PWxfbRVnEm/ Mr+JMYlJekGjNNyO/9ALpxf5waWBggKavrkpADGWmq6JV2Jj4HFPHo9eOYsznSHSRcmJj0 tiZMr6yRR5i5U+OxQh/XXbSXguNAdlqEdnt3dMstOW0ObttMtODZy7Xi3cqVUL8cHYW2Ym NvPh+OmNq0HGXc+zJlaz7uoqkdUsrpNhoN+D3lZUX/8BfsryQ9atRzXXIZSZW2L6mr7CbU 1HFq/KOQ4xC+i5+MIs8STlo/1x0tsnYjKch4QzE4lhYoCCc/FhrcUDQ0u+wvXg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703703148; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=moqFindge+wRWORPKN0bLOkbu0+899vK1xmYYKVPR8g=; b=TUGFFhFTIK6PNhtyeOWsSX+U21f2PXjf42LDXQ4alYr66qfsWKixldOvnkeBrfJTxwHUbA Szh1At+sMfNEe8D+K8NZpeiOHOWXj0sxWd+wgQtw4pIv4b4Lp5yKv6Fj+q89OQQhb+CLGJ fzFdmWN52acTYs3JbIWprK7PJQMNvLR4G6ZGVj8b2ixuQAnm8FAw28pSM+ZME4mbrJjnjC sKaj4JXke/BrIcPQHg8EgdniElfqwt681LTPE50ls68aB0x2+B1dHehCZJO+xOLGigLsuI b2ud4xBw8xHB4yOiyLOgrVT73ICXN+4BnDXdULIBCkAmrjYHQHs8kXo2P+SD/w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T0gk4069zzq5B; Wed, 27 Dec 2023 18:52:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BRIqRmC016559; Wed, 27 Dec 2023 18:52:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BRIqRWT016556; Wed, 27 Dec 2023 18:52:27 GMT (envelope-from git) Date: Wed, 27 Dec 2023 18:52:27 GMT Message-Id: <202312271852.3BRIqRWT016556@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: b46c7b1ed4e5 - main - nvme: Add some bits from NVMe 2.0c spec. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b46c7b1ed4e5307c689df72ea8a0b69e02456905 Auto-Submitted: auto-generated The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=b46c7b1ed4e5307c689df72ea8a0b69e02456905 commit b46c7b1ed4e5307c689df72ea8a0b69e02456905 Author: Alexander Motin AuthorDate: 2023-12-27 18:50:54 +0000 Commit: Alexander Motin CommitDate: 2023-12-27 18:50:54 +0000 nvme: Add some bits from NVMe 2.0c spec. MFC after: 1 week --- sys/dev/nvme/nvme.h | 26 +++++++++++++++++++++++++- sys/dev/nvme/nvme_ctrlr.c | 8 ++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h index e9b1b32c3777..3e39803f68ab 100644 --- a/sys/dev/nvme/nvme.h +++ b/sys/dev/nvme/nvme.h @@ -91,6 +91,8 @@ #define NVME_CAP_HI_REG_CSS_NVM_MASK (0x1) #define NVME_CAP_HI_REG_BPS_SHIFT (13) #define NVME_CAP_HI_REG_BPS_MASK (0x1) +#define NVME_CAP_HI_REG_CPS_SHIFT (14) +#define NVME_CAP_HI_REG_CPS_MASK (0x3) #define NVME_CAP_HI_REG_MPSMIN_SHIFT (16) #define NVME_CAP_HI_REG_MPSMIN_MASK (0xF) #define NVME_CAP_HI_REG_MPSMAX_SHIFT (20) @@ -99,6 +101,12 @@ #define NVME_CAP_HI_REG_PMRS_MASK (0x1) #define NVME_CAP_HI_REG_CMBS_SHIFT (25) #define NVME_CAP_HI_REG_CMBS_MASK (0x1) +#define NVME_CAP_HI_REG_NSSS_SHIFT (26) +#define NVME_CAP_HI_REG_NSSS_MASK (0x1) +#define NVME_CAP_HI_REG_CRWMS_SHIFT (27) +#define NVME_CAP_HI_REG_CRWMS_MASK (0x1) +#define NVME_CAP_HI_REG_CRIMS_SHIFT (28) +#define NVME_CAP_HI_REG_CRIMS_MASK (0x1) #define NVME_CAP_HI_DSTRD(x) \ (((x) >> NVME_CAP_HI_REG_DSTRD_SHIFT) & NVME_CAP_HI_REG_DSTRD_MASK) #define NVME_CAP_HI_NSSRS(x) \ @@ -109,6 +117,8 @@ (((x) >> NVME_CAP_HI_REG_CSS_NVM_SHIFT) & NVME_CAP_HI_REG_CSS_NVM_MASK) #define NVME_CAP_HI_BPS(x) \ (((x) >> NVME_CAP_HI_REG_BPS_SHIFT) & NVME_CAP_HI_REG_BPS_MASK) +#define NVME_CAP_HI_CPS(x) \ + (((x) >> NVME_CAP_HI_REG_CPS_SHIFT) & NVME_CAP_HI_REG_CPS_MASK) #define NVME_CAP_HI_MPSMIN(x) \ (((x) >> NVME_CAP_HI_REG_MPSMIN_SHIFT) & NVME_CAP_HI_REG_MPSMIN_MASK) #define NVME_CAP_HI_MPSMAX(x) \ @@ -117,6 +127,12 @@ (((x) >> NVME_CAP_HI_REG_PMRS_SHIFT) & NVME_CAP_HI_REG_PMRS_MASK) #define NVME_CAP_HI_CMBS(x) \ (((x) >> NVME_CAP_HI_REG_CMBS_SHIFT) & NVME_CAP_HI_REG_CMBS_MASK) +#define NVME_CAP_HI_NSSS(x) \ + (((x) >> NVME_CAP_HI_REG_NSSS_SHIFT) & NVME_CAP_HI_REG_NSSS_MASK) +#define NVME_CAP_HI_CRWMS(x) \ + (((x) >> NVME_CAP_HI_REG_CRWMS_SHIFT) & NVME_CAP_HI_REG_CRWMS_MASK) +#define NVME_CAP_HI_CRIMS(x) \ + (((x) >> NVME_CAP_HI_REG_CRIMS_SHIFT) & NVME_CAP_HI_REG_CRIMS_MASK) #define NVME_CC_REG_EN_SHIFT (0) #define NVME_CC_REG_EN_MASK (0x1) @@ -132,6 +148,8 @@ #define NVME_CC_REG_IOSQES_MASK (0xF) #define NVME_CC_REG_IOCQES_SHIFT (20) #define NVME_CC_REG_IOCQES_MASK (0xF) +#define NVME_CC_REG_CRIME_SHIFT (24) +#define NVME_CC_REG_CRIME_MASK (0x1) #define NVME_CSTS_REG_RDY_SHIFT (0) #define NVME_CSTS_REG_RDY_MASK (0x1) @@ -143,6 +161,8 @@ #define NVME_CSTS_REG_NVSRO_MASK (0x1) #define NVME_CSTS_REG_PP_SHIFT (5) #define NVME_CSTS_REG_PP_MASK (0x1) +#define NVME_CSTS_REG_ST_SHIFT (6) +#define NVME_CSTS_REG_ST_MASK (0x1) #define NVME_CSTS_GET_SHST(csts) (((csts) >> NVME_CSTS_REG_SHST_SHIFT) & NVME_CSTS_REG_SHST_MASK) @@ -616,7 +636,11 @@ struct nvme_registers { uint64_t bpmbl; /* Boot Partition Memory Buffer Location */ uint64_t cmbmsc; /* Controller Memory Buffer Memory Space Control */ uint32_t cmbsts; /* Controller Memory Buffer Status */ - uint8_t reserved3[3492]; /* 5Ch - DFFh */ + uint32_t cmbebs; /* Controller Memory Buffer Elasticity Buffer Size */ + uint32_t cmbswtp;/* Controller Memory Buffer Sustained Write Throughput */ + uint32_t nssd; /* NVM Subsystem Shutdown */ + uint32_t crto; /* Controller Ready Timeouts */ + uint8_t reserved3[3476]; /* 6Ch - DFFh */ uint32_t pmrcap; /* Persistent Memory Capabilities */ uint32_t pmrctl; /* Persistent Memory Region Control */ uint32_t pmrsts; /* Persistent Memory Region Status */ diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index 771e5cd1251b..845beec9f592 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -1369,15 +1369,19 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev) ctrlr->cap_hi = 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, + "CPS %x, MPSMIN %u, MPSMAX %u%s%s%s%s%s\n", cap_hi, NVME_CAP_HI_DSTRD(cap_hi), NVME_CAP_HI_NSSRS(cap_hi) ? ", NSSRS" : "", NVME_CAP_HI_CSS(cap_hi), NVME_CAP_HI_BPS(cap_hi) ? ", BPS" : "", + NVME_CAP_HI_CPS(cap_hi), NVME_CAP_HI_MPSMIN(cap_hi), NVME_CAP_HI_MPSMAX(cap_hi), NVME_CAP_HI_PMRS(cap_hi) ? ", PMRS" : "", - NVME_CAP_HI_CMBS(cap_hi) ? ", CMBS" : ""); + NVME_CAP_HI_CMBS(cap_hi) ? ", CMBS" : "", + NVME_CAP_HI_NSSS(cap_hi) ? ", NSSS" : "", + NVME_CAP_HI_CRWMS(cap_hi) ? ", CRWMS" : "", + NVME_CAP_HI_CRIMS(cap_hi) ? ", CRIMS" : ""); } if (bootverbose) { vs = nvme_mmio_read_4(ctrlr, vs);