From nobody Fri Mar 01 22:19:44 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TmjFD5Tpkz5D94J; Fri, 1 Mar 2024 22:19:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TmjFD4xB7z49sB; Fri, 1 Mar 2024 22:19:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709331584; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=F6MkYxwNH0AycSs4XrL+jZRER0u8x84gC6S+vqDSnXQ=; b=vFdq87ygxgR6tS/SmbcPV3e/pqmFl45pomRl1u3h3mdNIvksIZ7r79OpHyEb9kSIhQBMcE fNX8ElsC91FKIj+JfiZouBGui03iQ+JMr1qGroqZmet+eiFceh4WpS+BLmBxnXRdz5BnTE 2vNNHF3g2hFuQ1FPICuSAtPx2/jfO7BsrFrZNRWpgMLzrcLZMqONT4JgHoVjOG9zDuMz1Q 5F7LiKfwUR42aErdWvgTPIQ+uUxPajonuP99qODP6CkdIf3/BcOtrdoRqma237i3FuVPUB EE2sQn/xrMP9w30GCp/cY1K7bKDvgeiYIueIIm9D0f726gOO7i+U9zzlx9LJAQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1709331584; a=rsa-sha256; cv=none; b=o4WUgy02LvnJmVE9Eu8erKgMjPjxAWSZR3lukousTsTeLz+qXW5c84L/hvqcPDHWyz4vZb x5u7xd4lFwwttXcnVZJ9tcq4CR4r1Igav5I27/RxpvZvIcvxaTDx2rpE88YpfjnrNt5i6W dJ4+rHOfQnWHqhdNyV5oRIJ8y6Z21bSaGIvBLdaJvX93rW9uCMzbLiK3Ar+7FiuG0p20TZ fvpd0rDWGdQG7rH7cPG2oqJnh20dW3vRP5KApTWHsKNVEl0J+TX95R69Heri4R6AiMNF3z J8da4oAzTRr+OI5Xj3hXdS7diunOosadLJLWVUjBcBT1AIv3+K3Tw7mGSk5bUQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709331584; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=F6MkYxwNH0AycSs4XrL+jZRER0u8x84gC6S+vqDSnXQ=; b=BskAnCSo44LU3mNc4BFmE2w4rflXeSWnHBEFM39W2B0m1mwpl1KByFTBUNLtqWGMDVolK+ DgCS4L6Uf3zHazLAyer4SLT4sme0iEQlIR1Cq+6mwbx97vNR3U4hbh+fs0bNTX07oSqs/5 igQaD3MR5/ft5PURVyHJ8531iA113hr1mBhx7hzUX1BBXQwgUvTpzwoWiiiKM6B80mPodb 92O9iV6BQdjyZU/k48UDXp8fwM/ve170Z5BNvi5hi7vLYBqvH7WZjUXDfGrCAl3b9d5W8u r3kva7+WHRn8ZAXq0QZIzY1IjJRtlWKXlw4z1MDE9ace02yQbRZeC8U+5QkLYA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TmjFD4QSfzkd1; Fri, 1 Mar 2024 22:19:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 421MJiFh054718; Fri, 1 Mar 2024 22:19:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 421MJiS5054715; Fri, 1 Mar 2024 22:19:44 GMT (envelope-from git) Date: Fri, 1 Mar 2024 22:19:44 GMT Message-Id: <202403012219.421MJiS5054715@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 7485926e09a0 - main - nvme: Firmware revisions in the firmware slot info logpage are ASCII strings List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7485926e09a08fbfe83a9bc908e7d43aaca4c172 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=7485926e09a08fbfe83a9bc908e7d43aaca4c172 commit 7485926e09a08fbfe83a9bc908e7d43aaca4c172 Author: John Baldwin AuthorDate: 2024-03-01 22:18:43 +0000 Commit: John Baldwin CommitDate: 2024-03-01 22:18:43 +0000 nvme: Firmware revisions in the firmware slot info logpage are ASCII strings In particular, don't try to byteswap the values as 64-bit integers and always print a non-empty version as a string. Reviewed by: chuck, imp Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D44121 --- sbin/nvmecontrol/logpage.c | 13 ++----------- sys/dev/nvme/nvme.h | 14 ++------------ sys/dev/nvme/nvme_ctrlr.c | 4 ---- 3 files changed, 4 insertions(+), 27 deletions(-) diff --git a/sbin/nvmecontrol/logpage.c b/sbin/nvmecontrol/logpage.c index 52be71d7ef69..a4004d3fe2ea 100644 --- a/sbin/nvmecontrol/logpage.c +++ b/sbin/nvmecontrol/logpage.c @@ -229,10 +229,6 @@ read_logpage(int fd, uint8_t log_page, uint32_t nsid, uint8_t lsp, nvme_health_information_page_swapbytes( (struct nvme_health_information_page *)payload); break; - case NVME_LOG_FIRMWARE_SLOT: - nvme_firmware_page_swapbytes( - (struct nvme_firmware_page *)payload); - break; case NVME_LOG_CHANGED_NAMESPACE: nvme_ns_list_swapbytes((struct nvme_ns_list *)payload); break; @@ -425,15 +421,10 @@ print_log_firmware(const struct nvme_controller_data *cdata, void *buf, uint32_t else status = "Inactive"; - if (fw->revision[i] == 0LLU) + if (fw->revision[i][0] == '\0') printf("Empty\n"); else - if (isprint(*(char *)&fw->revision[i])) - printf("[%s] %.8s\n", status, - (char *)&fw->revision[i]); - else - printf("[%s] %016jx\n", status, - fw->revision[i]); + printf("[%s] %.8s\n", status, fw->revision[i]); } } diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h index 004fa1e9d1ca..137aff792868 100644 --- a/sys/dev/nvme/nvme.h +++ b/sys/dev/nvme/nvme.h @@ -1465,7 +1465,8 @@ _Static_assert(sizeof(struct nvme_health_information_page) == 512, "bad size for struct nvme_firmware_page { uint8_t afi; uint8_t reserved[7]; - uint64_t revision[7]; /* revisions for 7 slots */ + /* revisions for 7 slots */ + uint8_t revision[7][NVME_FIRMWARE_REVISION_LENGTH]; uint8_t reserved2[448]; } __packed __aligned(4); @@ -2006,17 +2007,6 @@ void nvme_health_information_page_swapbytes( #endif } -static inline -void nvme_firmware_page_swapbytes(struct nvme_firmware_page *s __unused) -{ -#if _BYTE_ORDER != _LITTLE_ENDIAN - int i; - - for (i = 0; i < 7; i++) - s->revision[i] = le64toh(s->revision[i]); -#endif -} - static inline void nvme_ns_list_swapbytes(struct nvme_ns_list *s __unused) { diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index 3b3b9bbe6998..b29512455fda 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -682,10 +682,6 @@ nvme_ctrlr_async_event_log_page_cb(void *arg, const struct nvme_completion *cpl) nvme_health_information_page_swapbytes( (struct nvme_health_information_page *)aer->log_page_buffer); break; - case NVME_LOG_FIRMWARE_SLOT: - nvme_firmware_page_swapbytes( - (struct nvme_firmware_page *)aer->log_page_buffer); - break; case NVME_LOG_CHANGED_NAMESPACE: nvme_ns_list_swapbytes( (struct nvme_ns_list *)aer->log_page_buffer);