diff options
author | mav <mav@FreeBSD.org> | 2018-02-01 21:14:54 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2018-02-01 21:14:54 +0000 |
commit | d43541b00cec60eaaf38b8ecb6da02dc6ccf1204 (patch) | |
tree | c3710d17e3834483ac70e5a62ce782a50e9e26fd | |
parent | 1756784674f633db19d33a466608043903fbafc4 (diff) | |
download | FreeBSD-src-d43541b00cec60eaaf38b8ecb6da02dc6ccf1204.zip FreeBSD-src-d43541b00cec60eaaf38b8ecb6da02dc6ccf1204.tar.gz |
MFC r324978: 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)
-rw-r--r-- | sbin/nvmecontrol/logpage.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sbin/nvmecontrol/logpage.c b/sbin/nvmecontrol/logpage.c index 2e43256..ccda7f0 100644 --- a/sbin/nvmecontrol/logpage.c +++ b/sbin/nvmecontrol/logpage.c @@ -234,14 +234,19 @@ print_log_health(const struct nvme_controller_data *cdata __unused, void *buf, u 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"; |