Date: Wed, 25 Oct 2017 15:26:04 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324978 - head/sbin/nvmecontrol Message-ID: <201710251526.v9PFQ44d017789@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: imp Date: Wed Oct 25 15:26:03 2017 New Revision: 324978 URL: https://svnweb.freebsd.org/changeset/base/324978 Log: Report only the valid slots in the firmware log page. Printing the entire log page is causing confusion over available slots. Report only those slots that are valid. In the case where the firmware download isn't supported, assume that only the first slot is valid (I have no hardware to test this assumption though) Sponsored by: Netflix Modified: head/sbin/nvmecontrol/logpage.c Modified: head/sbin/nvmecontrol/logpage.c ============================================================================== --- head/sbin/nvmecontrol/logpage.c Wed Oct 25 15:25:55 2017 (r324977) +++ head/sbin/nvmecontrol/logpage.c Wed Oct 25 15:26:03 2017 (r324978) @@ -234,14 +234,19 @@ print_log_health(const struct nvme_controller_data *cd static void print_log_firmware(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused) { - int i; + int i, slots; const char *status; struct nvme_firmware_page *fw = buf; printf("Firmware Slot Log\n"); printf("=================\n"); - for (i = 0; i < MAX_FW_SLOTS; i++) { + if (cdata->oacs.firmware == 0) + slots = 1; + else + slots = MIN(cdata->frmw.num_slots, MAX_FW_SLOTS); + + for (i = 0; i < slots; i++) { printf("Slot %d: ", i + 1); if (fw->afi.slot == i + 1) status = " Active";
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201710251526.v9PFQ44d017789>