git: 7566b99458a3 - stable/14 - nvme: Add NVMEF helper macro as the inverse of NVMEV
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 26 Aug 2024 18:03:20 UTC
The branch stable/14 has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=7566b99458a31ad9ac2ef289c401fa008fd01386
commit 7566b99458a31ad9ac2ef289c401fa008fd01386
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-01-29 19:00:57 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-08-26 17:27:01 +0000
nvme: Add NVMEF helper macro as the inverse of NVMEV
This macro accepts a field name and a value for the field and
constructs the shifted field value.
Reviewed by: chuck
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D43604
(cherry picked from commit 3a477a9b70a34dc0686630599c27f022b1e07bd8)
---
sys/dev/nvme/nvme.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h
index 7b3cdd89f146..137aff792868 100644
--- a/sys/dev/nvme/nvme.h
+++ b/sys/dev/nvme/nvme.h
@@ -610,6 +610,9 @@ enum nvme_critical_warning_state {
/* Helper macro to extract value from x */
#define NVMEV(name, x) (((x) >> name##_SHIFT) & name##_MASK)
+/* Helper macro to construct a field value */
+#define NVMEF(name, x) (((x) & name##_MASK) << name##_SHIFT)
+
/* CC register SHN field values */
enum shn_value {
NVME_SHN_NORMAL = 0x1,