git: 4e7cc8f545c2 - stable/14 - nvmecontrol: Move intel temperature page printing to little endian orderinng

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Tue, 27 Aug 2024 01:06:47 UTC
The branch stable/14 has been updated by jhb:

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

commit 4e7cc8f545c2bd3c7a104c9d53a9ca5329121094
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-04-16 22:36:41 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-08-26 18:31:03 +0000

    nvmecontrol: Move intel temperature page printing to little endian orderinng
    
    Sponsored by:           Netflix
    Reviewed by:            chuck
    Differential Revision:  https://reviews.freebsd.org/D44658
    
    (cherry picked from commit f0f7e9616da052e3d77b6e41301ccd655ae434fa)
---
 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 a01ce8d0f237..385b7d70c2aa 100644
--- a/sbin/nvmecontrol/logpage.c
+++ b/sbin/nvmecontrol/logpage.c
@@ -218,16 +218,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 cc5c9c49beb5..5e58727cbfb1 100644
--- a/sbin/nvmecontrol/modules/intel/intel.c
+++ b/sbin/nvmecontrol/modules/intel/intel.c
@@ -62,18 +62,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));
 }
 
 /*