git: 3a477a9b70a3 - main - nvme: Add NVMEF helper macro as the inverse of NVMEV
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 29 Jan 2024 19:03:10 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=3a477a9b70a34dc0686630599c27f022b1e07bd8
commit 3a477a9b70a34dc0686630599c27f022b1e07bd8
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-01-29 19:00:57 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-01-29 19:00:57 +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
---
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 2c36d0813253..004fa1e9d1ca 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,