aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWanpeng Qian <wanpengqian@gmail.com>2022-11-04 07:48:00 +0000
committerCorvin Köhne <corvink@FreeBSD.org>2022-11-04 09:13:01 +0000
commitb631954ff07989b83378bf5cd1af5fad7162c9f9 (patch)
tree6514cc2abdafd89413d59aba9229fdba3b3716c7
parentd0b5e4a30ac985051c14b0f5e3cb3e6cdd271929 (diff)
downloadsrc-b631954ff07989b83378bf5cd1af5fad7162c9f9.tar.gz
src-b631954ff07989b83378bf5cd1af5fad7162c9f9.zip
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
-rw-r--r--usr.sbin/bhyve/pci_nvme.c4
1 files changed, 4 insertions, 0 deletions
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