From b631954ff07989b83378bf5cd1af5fad7162c9f9 Mon Sep 17 00:00:00 2001 From: Wanpeng Qian Date: Fri, 4 Nov 2022 08:48:00 +0100 Subject: bhyve: initial PowerCycles value Currently PowerCycles field of Log Page is 0 and it is an invalid value. This patch will initial the PowerCycles data to 1. MFC after: 1 week Approved by: manu (mentor) Reviewed By: grehan (older version), chuck, corvink Differential Revision: https://reviews.freebsd.org/D32558 --- usr.sbin/bhyve/pci_nvme.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c index 01b7649642a8..b341b70f4e48 100644 --- a/usr.sbin/bhyve/pci_nvme.c +++ b/usr.sbin/bhyve/pci_nvme.c @@ -688,6 +688,7 @@ pci_nvme_init_nsdata(struct pci_nvme_softc *sc, static void pci_nvme_init_logpages(struct pci_nvme_softc *sc) { + __uint128_t power_cycles = 1; memset(&sc->err_log, 0, sizeof(sc->err_log)); memset(&sc->health_log, 0, sizeof(sc->health_log)); @@ -707,6 +708,9 @@ pci_nvme_init_logpages(struct pci_nvme_softc *sc) sc->fw_log.afi = (1 << NVME_FIRMWARE_PAGE_AFI_SLOT_SHIFT); memcpy(&sc->fw_log.revision[0], sc->ctrldata.fr, sizeof(sc->fw_log.revision[0])); + + memcpy(&sc->health_log.power_cycles, &power_cycles, + sizeof(sc->health_log.power_cycles)); } static void -- cgit v1.2.3