Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Aug 2024 01:06:28 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 41f61bf23024 - stable/14 - nvme: Add constants for fields in AER completion dword 0
Message-ID:  <202408270106.47R16SnF056606@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=41f61bf230243361b8375ce19d45eb01f139014d

commit 41f61bf230243361b8375ce19d45eb01f139014d
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-03-23 00:24:06 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-08-26 18:27:48 +0000

    nvme: Add constants for fields in AER completion dword 0
    
    Reviewed by:    imp
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D44445
    
    (cherry picked from commit b354bb04cb51f373e997cb8911c32dc93243c1d7)
---
 sys/dev/nvme/nvme.h       | 8 ++++++++
 sys/dev/nvme/nvme_ctrlr.c | 5 +++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h
index 70d293cf278e..b738ab902f89 100644
--- a/sys/dev/nvme/nvme.h
+++ b/sys/dev/nvme/nvme.h
@@ -642,6 +642,14 @@ enum nvme_critical_warning_state {
 #define NVME_FEAT_SET_FID_SHIFT				(0)
 #define NVME_FEAT_SET_FID_MASK				(0xff)
 
+/* Async Events */
+#define	NVME_ASYNC_EVENT_TYPE_SHIFT			(0)
+#define	NVME_ASYNC_EVENT_TYPE_MASK			(0x7)
+#define	NVME_ASYNC_EVENT_INFO_SHIFT			(8)
+#define	NVME_ASYNC_EVENT_INFO_MASK			(0xff)
+#define	NVME_ASYNC_EVENT_LOG_PAGE_ID_SHIFT		(16)
+#define	NVME_ASYNC_EVENT_LOG_PAGE_ID_MASK		(0xff)
+
 /* Helper macro to combine *_MASK and *_SHIFT defines */
 #define NVMEM(name)	(name##_MASK << name##_SHIFT)
 
diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c
index 0004895d6691..52e412c5202a 100644
--- a/sys/dev/nvme/nvme_ctrlr.c
+++ b/sys/dev/nvme/nvme_ctrlr.c
@@ -794,10 +794,11 @@ nvme_ctrlr_async_event_cb(void *arg, const struct nvme_completion *cpl)
 	}
 
 	/* Associated log page is in bits 23:16 of completion entry dw0. */
-	aer->log_page_id = (cpl->cdw0 & 0xFF0000) >> 16;
+	aer->log_page_id = NVMEV(NVME_ASYNC_EVENT_LOG_PAGE_ID, cpl->cdw0);
 
 	nvme_printf(aer->ctrlr, "async event occurred (type 0x%x, info 0x%02x,"
-	    " page 0x%02x)\n", (cpl->cdw0 & 0x07), (cpl->cdw0 & 0xFF00) >> 8,
+	    " page 0x%02x)\n", NVMEV(NVME_ASYNC_EVENT_TYPE, cpl->cdw0),
+	    NVMEV(NVME_ASYNC_EVENT_INFO, cpl->cdw0),
 	    aer->log_page_id);
 
 	if (is_log_page_id_valid(aer->log_page_id)) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202408270106.47R16SnF056606>