git: f0f7e9616da0 - main - nvmecontrol: Move intel temperature page printing to little endian orderinng

From: Warner Losh <imp_at_FreeBSD.org>
Date: Wed, 17 Apr 2024 03:33:52 UTC
The branch main has been updated by imp:

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

commit f0f7e9616da052e3d77b6e41301ccd655ae434fa
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-04-16 22:36:41 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-04-17 03:30:18 +0000

    nvmecontrol: Move intel temperature page printing to little endian orderinng
    
    Sponsored by:           Netflix
    Reviewed by:            chuck
    Differential Revision:  https://reviews.freebsd.org/D44658
---
 sbin/nvmecontrol/logpage.c             | 10 ----------
 sbin/nvmecontrol/modules/intel/intel.c | 19 +++++++++++--------
 2 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/sbin/nvmecontrol/logpage.c b/sbin/nvmecontrol/logpage.c
index ede4ff82946d..dfc35f1eb788 100644
--- a/sbin/nvmecontrol/logpage.c
+++ b/sbin/nvmecontrol/logpage.c
@@ -217,16 +217,6 @@ read_logpage(int fd, uint8_t log_page, uint32_t nsid, uint8_t lsp,
 	if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0)
 		err(EX_IOERR, "get log page request failed");
 
-	/* Convert data to host endian */
-	switch (log_page) {
-	case INTEL_LOG_TEMP_STATS:
-		intel_log_temp_stats_swapbytes(
-		    (struct intel_log_temp_stats *)payload);
-		break;
-	default:
-		break;
-	}
-
 	if (nvme_completion_is_error(&pt.cpl))
 		errx(EX_IOERR, "get log page request returned error");
 }
diff --git a/sbin/nvmecontrol/modules/intel/intel.c b/sbin/nvmecontrol/modules/intel/intel.c
index 725111cd92ab..c94fdb356608 100644
--- a/sbin/nvmecontrol/modules/intel/intel.c
+++ b/sbin/nvmecontrol/modules/intel/intel.c
@@ -61,18 +61,21 @@ print_intel_temp_stats(const struct nvme_controller_data *cdata __unused, void *
 	printf("=====================\n");
 
 	printf("Current:                        ");
-	print_temp_C(temp->current);
-	printf("Overtemp Last Flags             %#jx\n", (uintmax_t)temp->overtemp_flag_last);
-	printf("Overtemp Lifetime Flags         %#jx\n", (uintmax_t)temp->overtemp_flag_life);
+	print_temp_C(letoh(temp->current));
+	printf("Overtemp Last Flags             %#jx\n",
+	    (uintmax_t)letoh(temp->overtemp_flag_last));
+	printf("Overtemp Lifetime Flags         %#jx\n",
+	    (uintmax_t)letoh(temp->overtemp_flag_life));
 	printf("Max Temperature                 ");
-	print_temp_C(temp->max_temp);
+	print_temp_C(letoh(temp->max_temp));
 	printf("Min Temperature                 ");
-	print_temp_C(temp->min_temp);
+	print_temp_C(letoh(temp->min_temp));
 	printf("Max Operating Temperature       ");
-	print_temp_C(temp->max_oper_temp);
+	print_temp_C(letoh(temp->max_oper_temp));
 	printf("Min Operating Temperature       ");
-	print_temp_C(temp->min_oper_temp);
-	printf("Estimated Temperature Offset:   %ju C/K\n", (uintmax_t)temp->est_offset);
+	print_temp_C(letoh(temp->min_oper_temp));
+	printf("Estimated Temperature Offset:   %ju C/K\n",
+	    (uintmax_t)letoh(temp->est_offset));
 }
 
 /*