Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nvme-print: Add PEL EHAI port identifier type printf function #2244

Merged
merged 2 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions nvme-print-stdout.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
17 changes: 17 additions & 0 deletions nvme-print.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions nvme-print.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion subprojects/libnvme.wrap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[wrap-git]
url = https://github.com/linux-nvme/libnvme.git
revision = d706ff266b45d1c17522d3c54a026fdab13fe346
revision = 93f83b9bc029f5830d51964b4c5346d2bc87ca2e

[provide]
libnvme = libnvme_dep
Expand Down