From ccbe43f93a9a82c34c0744d7bc522035043eaffd Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Tue, 19 Mar 2024 10:18:18 +0100 Subject: [PATCH 1/2] build: bump libnvme wrap Include latest libnvme changes. Signed-off-by: Daniel Wagner --- subprojects/libnvme.wrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/libnvme.wrap b/subprojects/libnvme.wrap index 4b0975691e..7b61812d5f 100644 --- a/subprojects/libnvme.wrap +++ b/subprojects/libnvme.wrap @@ -1,6 +1,6 @@ [wrap-git] url = https://github.com/linux-nvme/libnvme.git -revision = d706ff266b45d1c17522d3c54a026fdab13fe346 +revision = 93f83b9bc029f5830d51964b4c5346d2bc87ca2e [provide] libnvme = libnvme_dep From 616e31e49a4e34d499f5243f0d989d6a3d275294 Mon Sep 17 00:00:00 2001 From: Tokunori Ikegami Date: Fri, 15 Mar 2024 23:55:28 +0900 Subject: [PATCH 2/2] nvme-print: Add PEL EHAI port identifier type printf function Change to use NVME_PEL_EHAI_PIT definitions. Signed-off-by: Tokunori Ikegami --- nvme-print-stdout.c | 10 +++------- nvme-print.c | 17 +++++++++++++++++ nvme-print.h | 1 + 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/nvme-print-stdout.c b/nvme-print-stdout.c index 158fa308e8..14f0b20d2d 100644 --- a/nvme-print-stdout.c +++ b/nvme-print-stdout.c @@ -230,15 +230,11 @@ static void stdout_persistent_event_log_rci(__le32 pel_header_rci) static void stdout_persistent_event_entry_ehai(__u8 ehai) { - __u8 rsvd1 = (ehai & 0xfc) >> 2; - __u8 pit = ehai & 0x03; + __u8 rsvd1 = NVME_PEL_EHAI_RSVD(ehai); + __u8 pit = NVME_PEL_EHAI_PIT(ehai); printf(" [7:2] : %#x\tReserved\n", rsvd1); - printf("\tPort Identifier Type (PIT): %u(%s)\n", pit, - (pit == 0x00) ? "PIT not reported and PELPID does not apply" : - (pit == 0x01) ? "NVM subsystem port" : - (pit == 0x02) ? "NVMe-MI port" : - "Event not associated with any port and PELPID does not apply"); + printf("\tPort Identifier Type (PIT): %u(%s)\n", pit, nvme_pel_ehai_pit_to_string(pit)); } static void stdout_add_bitmap(int i, __u8 seb) diff --git a/nvme-print.c b/nvme-print.c index ba0b4acac7..0a8deb2a8b 100644 --- a/nvme-print.c +++ b/nvme-print.c @@ -964,6 +964,23 @@ const char *nvme_pel_rci_rcpit_to_string(enum nvme_pel_rci_rcpit rcpit) return "Reserved"; } +const char *nvme_pel_ehai_pit_to_string(enum nvme_pel_ehai_pit pit) +{ + switch (pit) { + case NVME_PEL_EHAI_PIT_NOT_REPORTED: + return "PIT not reported and PELPID does not apply"; + case NVME_PEL_EHAI_PIT_NSS_PORT: + return "NVM subsystem port"; + case NVME_PEL_EHAI_PIT_NMI_PORT: + return "NVMe-MI port"; + case NVME_PEL_EHAI_PIT_NOT_ASSOCIATED: + return "Event not associated with any port and PELPID does not apply"; + default: + break; + } + return "Reserved"; +} + void nvme_feature_show(enum nvme_features_id fid, int sel, unsigned int result) { nvme_print(show_feature, NORMAL, fid, sel, result); diff --git a/nvme-print.h b/nvme-print.h index 5ded3b6bec..d2a32f5a05 100644 --- a/nvme-print.h +++ b/nvme-print.h @@ -303,6 +303,7 @@ const char *nvme_zone_type_to_string(__u8 cond); const char *nvme_plm_window_to_string(__u32 plm); const char *nvme_ns_wp_cfg_to_string(enum nvme_ns_write_protect_cfg state); const char *nvme_pel_rci_rcpit_to_string(enum nvme_pel_rci_rcpit rcpit); +const char *nvme_pel_ehai_pit_to_string(enum nvme_pel_ehai_pit pit); void nvme_dev_full_path(nvme_ns_t n, char *path, size_t len); void nvme_generic_full_path(nvme_ns_t n, char *path, size_t len);