From nobody Mon Aug 26 18:03:21 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 4Wsz7G0r8Lz5TMDn; Mon, 26 Aug 2024 18:03:22 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wsz7F5yrqz44tp; Mon, 26 Aug 2024 18:03:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724695401; 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=0DTUYXGnk/9SRG8Fd5isU8sgIUB377xvxld4dhCCM+o=; b=lTS/7v8SRtqzPhvhI6qVghzHIkIKxkWSZXlpj3H+v2lG9BX/IQgsoDm/zL+dUOHjlsL0zP 4k2RMyRDt2GwZeML2YcVhinKuvN0oqfmqlt1c2CjJm3LEA09T4BWjMlaqWNodHrb+Sqv// 1rVSvVrdIwfWJiID63gHj/h1sLjc9tZvvqq//2a5y6BFTG3D1KF1gSH2gIb0qG3pnjEwUF a7W99CRyEnDtu2UIP0Lqu42QQP7IvODRCChPX1kJQgWnI4nenrZ5aStGbyQEtFJev4YIFE DsvQjTGiIcq4ZzfrZjidLYflcinoB6isr3c5ba5d+wA5FLpHI0Pyvn2xQtXX/Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1724695401; a=rsa-sha256; cv=none; b=EfmmVcyICLxmVAi2uCihjHFUDKAJXF/ldSMTECXvxt404/Dx67O1ppLdbAl9NYcbgXkfZV J2Auv2P7I7b6cl1tO6QeJACrcElmrsnOpZZXirarYF/U7B6y2e+g7aZt6QVj099niO3LBA cG+b/rE5T7nLsTqMTBqbYoK/xNiQMjVpcwF8qcDoPHh/lF/GkhJ2XNqReHdIGgzvtZn5Fm pWeBkjjh8Qu5lOgKwhlDfQIdZ86DFdXVmuwct3IjDab7rURH8cuzx8P2vVFkeYUSgPYwrk tR7r0wyn0rquPYHnQ6EPiAAC9JLVt0UxvfOl1xkujoGgLkwF4K5gymn46uCf8A== 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=1724695401; 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=0DTUYXGnk/9SRG8Fd5isU8sgIUB377xvxld4dhCCM+o=; b=rX/w8OWU89ctJ9xL/tJX/E0I5kiOgeNAdmmZPhbMQpxRY/pmENvM+g/BaEVo5fq5Sr1GvY ft1v3JS8kPVVjHsHT0/Kwxwa+R0JhhEeyynrNNfv1Yj9OITgXVGSTlg7bd5lN99fTRLlIW aX3rN++eWVrOfI7DOuJ8hYrfbf3wYOQHOnkjpCHYIbTn/xDQjIbB12HyZcj13/3xnJDqP5 5crryAB9Oxoi1f5pRzBZrVhtxH5JJmPjYMnHVQnbwTyW4EZ50kX6nNVc27DOfBHaB12svV F1yhX9XiNipdw3FoEsG54qlBtkC6BmO4OZtSk4zefhE5WiGk4GOEoX3ZcWeRww== 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 4Wsz7F5WmMzGCH; Mon, 26 Aug 2024 18:03:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 47QI3L6s042842; Mon, 26 Aug 2024 18:03:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47QI3L6j042839; Mon, 26 Aug 2024 18:03:21 GMT (envelope-from git) Date: Mon, 26 Aug 2024 18:03:21 GMT Message-Id: <202408261803.47QI3L6j042839@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 4d2e2e1b440e - stable/14 - 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-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/stable/14 X-Git-Reftype: branch X-Git-Commit: 4d2e2e1b440e339d679f2fa9e146767d98f8aea8 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=4d2e2e1b440e339d679f2fa9e146767d98f8aea8 commit 4d2e2e1b440e339d679f2fa9e146767d98f8aea8 Author: John Baldwin AuthorDate: 2024-01-29 19:01:13 +0000 Commit: John Baldwin CommitDate: 2024-08-26 17:27:08 +0000 nvme: Use the NVMEF macro to construct fields Reviewed by: chuck, imp Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D43605 (cherry picked from commit 5650bd3fe8eff1043ef3df33b5bdd7b24b5f2bc0) --- 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 3ef5a2b51544..0004895d6691 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -375,25 +375,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); @@ -1601,7 +1601,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 c172663f75a3..9eb808f81a48 100644 --- a/sys/dev/nvme/nvme_ns.c +++ b/sys/dev/nvme/nvme_ns.c @@ -287,7 +287,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 e087abcb2654..ce2f30aaa5ba 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -494,9 +494,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 */ @@ -512,8 +512,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);