From nobody Mon Jan 29 19:03:11 2024 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 4TNyPC4yPmz59DKR; Mon, 29 Jan 2024 19:03:11 +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 4TNyPC36F3z40bm; Mon, 29 Jan 2024 19:03:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706554991; 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=mQlQFtTGXqLr6S9JnxNfHwe5dyQ/aOdqSKI7sT7E2H0=; b=wKnsH0aRtnjHtOK7NQNtSXxwN9gO+LOPVYA2hSvkMv9mBvxbt4UZHWzYjoMfuYTnBaaXoL rRoEtojGUKeZ6KwpCm96uUv6CJ6kYkJmt2lxjaENeIrXdE3lZaPTxkoZqTMNsVBrqwszRu uz7WTXYSvirdN4E1skaoiv1csxFLV7991gkHHTbo/HpZWZo1C+CzCoOK/SxIfx/jajOVbf vzlA+YMwmwbgdOfrThy+PdvCVxKi7eD3jpIPl3vaO9SOunpIy6yZ25SSTqVTJISlfY59jd 8+yZLSm8x0yCtmFirLgpO0VNmEmo/2yFeckd2DWQjsPS7SDKPy1Fhzoz8dfAcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706554991; 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=mQlQFtTGXqLr6S9JnxNfHwe5dyQ/aOdqSKI7sT7E2H0=; b=w0qpNJTJppUENrjtkgaOrOcW7udWpup4Wm8up21E/rXgyyzRTi67E5I7otSuI0ODckav5L YCIGqetesXPJ1NQzeBfH63daxLHtr7SngODxfNJebhOICVM4c6jDXKqa0gRSLcwXdcgMFA S8BBOsosBCBLlzTPioFpTc1isOkNZJhOQroErlADZDfSIiiwQZ+HrM9waT/kbGHwEdgB0x umPz5/bTS6In4mg9qKaDus/tbs/pMLKYtOsIFQcM+i59k2Knvzk/IaHuEVpyYjXYpgaZzR O0u5OO3q1VPubhraDcrYmCQK51d9M8vKgDJ7xjLH5tN2Bk6V4tuONryqvfY3yA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706554991; a=rsa-sha256; cv=none; b=PVRGvq4/N/Lgov6VTIHiK4zjvdTrHHDga1iLwI2a0ONdIhcLLDjS1yrP3hqETVjY9lHhpn DM3BZsFlFjZEH9Cvk5vMVy9xk2BxKcpEWQSjIOs7ijA1gP4VrTnbc8IKWJbWCpYd1wjW7h CGyl0FALLMdnsC6jQ5NpMt3alckE1HxD0kNzy/CJfTIJAcE69UlUuPeBi5YcYm0gM/+RSq 5uYvvZADoq4G/NHtph7egCC2ljztF8sBmCKCYPOhv/Z6gv2Pdedd0B4Bo22yhfbLqg1CQG ZP3lE83e6hzTF0ygrWo9fO4/dYa9FJ0cKCTWfEoIUM3Q8a/UxbeZinE1Z3N5YQ== 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 4TNyPC2CJ1z13p1; Mon, 29 Jan 2024 19:03:11 +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 40TJ3BPJ058860; Mon, 29 Jan 2024 19:03:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40TJ3BYL058857; Mon, 29 Jan 2024 19:03:11 GMT (envelope-from git) Date: Mon, 29 Jan 2024 19:03:11 GMT Message-Id: <202401291903.40TJ3BYL058857@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 5650bd3fe8ef - main - nvme: Use the NVMEF macro to construct fields 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5650bd3fe8eff1043ef3df33b5bdd7b24b5f2bc0 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=5650bd3fe8eff1043ef3df33b5bdd7b24b5f2bc0 commit 5650bd3fe8eff1043ef3df33b5bdd7b24b5f2bc0 Author: John Baldwin AuthorDate: 2024-01-29 19:01:13 +0000 Commit: John Baldwin CommitDate: 2024-01-29 19:01:13 +0000 nvme: Use the NVMEF macro to construct fields Reviewed by: chuck, imp Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D43605 --- sys/dev/nvme/nvme_ctrlr.c | 20 ++++++++++---------- sys/dev/nvme/nvme_ns.c | 3 ++- sys/dev/nvme/nvme_qpair.c | 10 +++++----- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index c662371aebfd..3b3b9bbe6998 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -344,25 +344,25 @@ nvme_ctrlr_enable(struct nvme_controller *ctrlr) qsize = ctrlr->adminq.num_entries - 1; aqa = 0; - aqa = (qsize & NVME_AQA_REG_ACQS_MASK) << NVME_AQA_REG_ACQS_SHIFT; - aqa |= (qsize & NVME_AQA_REG_ASQS_MASK) << NVME_AQA_REG_ASQS_SHIFT; + aqa |= NVMEF(NVME_AQA_REG_ACQS, qsize); + aqa |= NVMEF(NVME_AQA_REG_ASQS, qsize); nvme_mmio_write_4(ctrlr, aqa, aqa); /* Initialization values for CC */ cc = 0; - cc |= 1 << NVME_CC_REG_EN_SHIFT; - cc |= 0 << NVME_CC_REG_CSS_SHIFT; - cc |= 0 << NVME_CC_REG_AMS_SHIFT; - cc |= 0 << NVME_CC_REG_SHN_SHIFT; - cc |= 6 << NVME_CC_REG_IOSQES_SHIFT; /* SQ entry size == 64 == 2^6 */ - cc |= 4 << NVME_CC_REG_IOCQES_SHIFT; /* CQ entry size == 16 == 2^4 */ + cc |= NVMEF(NVME_CC_REG_EN, 1); + cc |= NVMEF(NVME_CC_REG_CSS, 0); + cc |= NVMEF(NVME_CC_REG_AMS, 0); + cc |= NVMEF(NVME_CC_REG_SHN, 0); + cc |= NVMEF(NVME_CC_REG_IOSQES, 6); /* SQ entry size == 64 == 2^6 */ + cc |= NVMEF(NVME_CC_REG_IOCQES, 4); /* CQ entry size == 16 == 2^4 */ /* * Use the Memory Page Size selected during device initialization. Note * that value stored in mps is suitable to use here without adjusting by * NVME_MPS_SHIFT. */ - cc |= ctrlr->mps << NVME_CC_REG_MPS_SHIFT; + cc |= NVMEF(NVME_CC_REG_MPS, ctrlr->mps); nvme_ctrlr_barrier(ctrlr, BUS_SPACE_BARRIER_WRITE); nvme_mmio_write_4(ctrlr, cc, cc); @@ -1557,7 +1557,7 @@ nvme_ctrlr_shutdown(struct nvme_controller *ctrlr) cc = nvme_mmio_read_4(ctrlr, cc); cc &= ~NVMEM(NVME_CC_REG_SHN); - cc |= NVME_SHN_NORMAL << NVME_CC_REG_SHN_SHIFT; + cc |= NVMEF(NVME_CC_REG_SHN, NVME_SHN_NORMAL); nvme_mmio_write_4(ctrlr, cc, cc); timeout = ticks + (ctrlr->cdata.rtd3e == 0 ? 5 * hz : diff --git a/sys/dev/nvme/nvme_ns.c b/sys/dev/nvme/nvme_ns.c index 8826a1f5ff8f..360b9f982c20 100644 --- a/sys/dev/nvme/nvme_ns.c +++ b/sys/dev/nvme/nvme_ns.c @@ -286,7 +286,8 @@ nvme_bio_child_inbed(struct bio *parent, int bio_error) bzero(&parent_cpl, sizeof(parent_cpl)); if (parent->bio_flags & BIO_ERROR) { parent_cpl.status &= ~NVMEM(NVME_STATUS_SC); - parent_cpl.status |= (NVME_SC_DATA_TRANSFER_ERROR) << NVME_STATUS_SC_SHIFT; + parent_cpl.status |= NVMEF(NVME_STATUS_SC, + NVME_SC_DATA_TRANSFER_ERROR); } nvme_ns_bio_done(parent, &parent_cpl); } diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index b886a95b1724..62d27e439180 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -493,9 +493,9 @@ nvme_qpair_manual_complete_tracker( cpl.sqid = qpair->id; cpl.cid = tr->cid; - cpl.status |= (sct & NVME_STATUS_SCT_MASK) << NVME_STATUS_SCT_SHIFT; - cpl.status |= (sc & NVME_STATUS_SC_MASK) << NVME_STATUS_SC_SHIFT; - cpl.status |= (dnr & NVME_STATUS_DNR_MASK) << NVME_STATUS_DNR_SHIFT; + cpl.status |= NVMEF(NVME_STATUS_SCT, sct); + cpl.status |= NVMEF(NVME_STATUS_SC, sc); + cpl.status |= NVMEF(NVME_STATUS_DNR, dnr); /* M=0 : this is artificial so no data in error log page */ /* CRD=0 : this is artificial and no delayed retry support anyway */ /* P=0 : phase not checked */ @@ -511,8 +511,8 @@ nvme_qpair_manual_complete_request(struct nvme_qpair *qpair, memset(&cpl, 0, sizeof(cpl)); cpl.sqid = qpair->id; - cpl.status |= (sct & NVME_STATUS_SCT_MASK) << NVME_STATUS_SCT_SHIFT; - cpl.status |= (sc & NVME_STATUS_SC_MASK) << NVME_STATUS_SC_SHIFT; + cpl.status |= NVMEF(NVME_STATUS_SCT, sct); + cpl.status |= NVMEF(NVME_STATUS_SC, sc); error = nvme_completion_is_error(&cpl);