From nobody Mon Apr 08 19:04:41 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 4VCz6d44byz5HYSm; Mon, 8 Apr 2024 19:04:41 +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 4VCz6d1s2Qz4h0K; Mon, 8 Apr 2024 19:04:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712603081; 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=Krft7X1np5mtq6NqMO9NR688pC5n0Z6IUZW0Xge9nRg=; b=rojIyJ21kT+PqZoldTE3K87LIYbxL1dp8OF8kEBkxIwqDTpVjOfH+Q3jGchaXzaJidfzxn jZqRq+A0g+nS7OeYY3nwIIO6C7mxPhhzPHbEzIPl+j5RU0NCKz5bxlTB3jfj0oPzcigORA PHooNE2vQSsIRiNjjd6HmSxfZ3ziAwcxF4be8Vi4ysnWJ+xhRLMD09laEcfmFV2qwP2Ync 8N7q6gKF8SCjXXmW4WKv/RwTWRj98O8QU4ifgMvCaLoAtHjI/GptOKueCfJ0QHodiUNedo ML/yEjBCKowU5EEEWfQuOscId7buA1b6xJ+uieE/EJM2kt+AlWsJfeUANXD63A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1712603081; a=rsa-sha256; cv=none; b=xgwslym/2Mn3aigKBcIDoM1zXvvYeLKpVOJFX2DFjeAsqMJZzzOfUrNItJztkI84GEuLei +/x9bCHMVfoormCFHwy0l8ZQYmYvmBj6IOMoJYD4mS7kpqgBbIFbYtA+pzq4NBCOm+gmTB /zKiqXRJCyoQTKhWl26+eRmOmoBbOkuCtsRITsB2ri1Iai4JWZGr8OQzlSR/Bcb0ofhF1t /A+QfLBstSwMybB/lH5phX0fdqmYYeQTEsHEGF42ui/pjKwRvI3F3OPk9qSAsvHpIShxfG Z8/TItrminJKi65UJiflsvq6vqiSj4+g6z/y8ivynyFpnQTuGwwyXp+X4nvU1A== 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=1712603081; 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=Krft7X1np5mtq6NqMO9NR688pC5n0Z6IUZW0Xge9nRg=; b=OkR8pZF7vT/RjLua7naDsQpJlGbt7P6bsdqaiQU/mTwOG1uK0bXdQ/boYILzD9QCfbRv31 lK9Z1godSWbBzv4uok6q4W9ViiytOLjD0+ir+MVaQu+MyPV6hhIj6sYw0KJfdOaFFmOjjw JAoqFT2SjNH5cdWhQkUv8Hy2QsY3oAX00lefTlu2++qb9dVr2lxxQcDnbWNXjqcqtBd4uW +lhlXTfjM1GjELfH86I2amdrVLXrmgFsUehuelVEd5uJcCsxoERLyWtg2k77bO4awDqPft wQsLviw1I4IU5p0KoMugeNQ0n83NMGpwDtR51812ldTGHsyv1r1Qyr6IfomM0A== 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 4VCz6d1TBBzMx9; Mon, 8 Apr 2024 19:04:41 +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 438J4fuF094837; Mon, 8 Apr 2024 19:04:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 438J4fn5094834; Mon, 8 Apr 2024 19:04:41 GMT (envelope-from git) Date: Mon, 8 Apr 2024 19:04:41 GMT Message-Id: <202404081904.438J4fn5094834@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 16089905240f - stable/14 - 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/stable/14 X-Git-Reftype: branch X-Git-Commit: 16089905240f848ba0070fa8ae6622a0e198e9d7 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=16089905240f848ba0070fa8ae6622a0e198e9d7 commit 16089905240f848ba0070fa8ae6622a0e198e9d7 Author: John Baldwin AuthorDate: 2024-03-01 22:18:43 +0000 Commit: John Baldwin CommitDate: 2024-04-08 18:01:02 +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 (cherry picked from commit 7485926e09a08fbfe83a9bc908e7d43aaca4c172) --- 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 725815edc475..31ec3a443716 100644 --- a/sbin/nvmecontrol/logpage.c +++ b/sbin/nvmecontrol/logpage.c @@ -230,10 +230,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; @@ -429,15 +425,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 3e39803f68ab..315dbdd5a3c8 100644 --- a/sys/dev/nvme/nvme.h +++ b/sys/dev/nvme/nvme.h @@ -1455,7 +1455,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); @@ -1997,17 +1998,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 55573669562c..e659a3776957 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -714,10 +714,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);