git: e84a75f93602 - main - nvme: Add telemetry page definitions

From: Warner Losh <imp_at_FreeBSD.org>
Date: Sat, 11 May 2024 18:10:33 UTC
The branch main has been updated by imp:

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

commit e84a75f936028bf3947f72f11eac4e25baf91b3a
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-04-07 23:48:42 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-05-11 18:09:50 +0000

    nvme: Add telemetry page definitions
    
    Add definition for page types 7 and 8 for host initiated telemetry and
    controller initiated telemetry (they differ by one byte, but that byte
    that's defined in the host version is reserved in the controller
    version).
    
    Sponsored by:           Netflix
---
 sys/dev/nvme/nvme.h | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h
index bca4df92cb25..a389fc443743 100644
--- a/sys/dev/nvme/nvme.h
+++ b/sys/dev/nvme/nvme.h
@@ -1652,6 +1652,30 @@ struct nvme_device_self_test_page {
 _Static_assert(sizeof(struct nvme_device_self_test_page) == 564,
     "bad size for nvme_device_self_test_page");
 
+/*
+ * Header structure for both host initiated telemetry (page 7) and controller
+ * initiated telemetry (page 8).
+ */
+struct nvme_telemetry_log_page {
+	uint8_t			identifier;
+	uint8_t			rsvd[4];
+	uint8_t			oui[3];
+	uint16_t		da1_last;
+	uint16_t		da2_last;
+	uint16_t		da3_last;
+	uint8_t			rsvd2[2];
+	uint32_t		da4_last;
+	uint8_t			rsvd3[361];
+	uint8_t			hi_gen;
+	uint8_t			ci_avail;
+	uint8_t			ci_gen;
+	uint8_t			reason[128];
+	/* Blocks of telemetry data follow */
+} __packed __aligned(4);
+
+_Static_assert(sizeof(struct nvme_telemetry_log_page) == 512,
+    "bad size for nvme_telemetry_log");
+
 struct nvme_discovery_log_entry {
 	uint8_t			trtype;
 	uint8_t			adrfam;