[rtems-libbsd commit] NVME(4): Add SGL descriptor

Sebastian Huber sebh at rtems.org
Wed Nov 13 12:07:43 UTC 2019


Module:    rtems-libbsd
Branch:    master
Commit:    bd2bea425e7ff841b0d76748d8106d587a25ec13
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=bd2bea425e7ff841b0d76748d8106d587a25ec13

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Sep 19 07:29:24 2019 +0200

NVME(4): Add SGL descriptor

Update #3821.

---

 freebsd/sys/dev/nvme/nvme.h | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/freebsd/sys/dev/nvme/nvme.h b/freebsd/sys/dev/nvme/nvme.h
index 0d4a18b..27259dc 100644
--- a/freebsd/sys/dev/nvme/nvme.h
+++ b/freebsd/sys/dev/nvme/nvme.h
@@ -488,6 +488,20 @@ enum nvme_critical_warning_state {
 #define	NVME_SS_PAGE_SSTAT_GDE_SHIFT			(8)
 #define	NVME_SS_PAGE_SSTAT_GDE_MASK			(0x1)
 
+/* SGL descriptor field definitions */
+#define	NVME_SGL_IDENT_TYPE_DATA_BLOCK			(0)
+#define	NVME_SGL_IDENT_TYPE_BIT_BUCKET			(1)
+#define	NVME_SGL_IDENT_TYPE_SEG_DESC			(2)
+#define	NVME_SGL_IDENT_TYPE_LAST_SEG_DESC		(3)
+#define	NVME_SGL_IDENT_TYPE_KEYED_DATA_BLOCK		(4)
+#define	NVME_SGL_IDENT_TYPE_VENDOR			(0xf)
+#define	NVME_SGL_IDENT_TYPE_SHIFT			(4)
+#define	NVME_SGL_IDENT_TYPE_MASK			(0xf)
+#define	NVME_SGL_IDENT_SUB_TYPE_ADDRESS			(0)
+#define	NVME_SGL_IDENT_SUB_TYPE_OFFSET			(0x1)
+#define	NVME_SGL_IDENT_SUB_TYPE_SHIFT			(0)
+#define	NVME_SGL_IDENT_SUB_TYPE_MASK			(0xf)
+
 /* CC register SHN field values */
 enum shn_value {
 	NVME_SHN_NORMAL		= 0x1,
@@ -1451,6 +1465,16 @@ struct nvme_resv_status_ext
 
 _Static_assert(sizeof(struct nvme_resv_status_ext) == 64, "bad size for nvme_resv_status_ext");
 
+struct nvme_sgl_desc
+{
+	uint64_t		address;
+	uint32_t		length;
+	uint8_t			reserved12[3];
+	uint8_t			sgl_ident;
+} __packed __aligned(8);
+
+_Static_assert(sizeof(struct nvme_sgl_desc) == 16, "bad size for nvme_sgl_desc");
+
 #define NVME_TEST_MAX_THREADS	128
 
 struct nvme_io_test {



More information about the vc mailing list