Skip to content

Commit

Permalink
nvme-print: Add PEL RCI port identifier type printf function
Browse files Browse the repository at this point in the history
Change to use NVME_PEL_RCI_RCPIT definitions.

Signed-off-by: Tokunori Ikegami <[email protected]>
  • Loading branch information
ikegami-t authored and igaw committed Mar 5, 2024
1 parent 3f22c21 commit 17e19d0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
9 changes: 3 additions & 6 deletions nvme-print-stdout.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,11 @@ static void stdout_persistent_event_log_rci(__le32 pel_header_rci)
__u8 rcpit = NVME_PEL_RCI_RCPIT(rci);
__u16 rcpid = NVME_PEL_RCI_RCPID(rci);

if(rsvd19)
if (rsvd19)
printf(" [31:19] : %#x\tReserved\n", rsvd19);
printf("\tReporting Context Exists (RCE): %s(%u)\n",
rce ? "true" : "false", rce);
printf("\tReporting Context Exists (RCE): %s(%u)\n", rce ? "true" : "false", rce);
printf("\tReporting Context Port Identifier Type (RCPIT): %u(%s)\n", rcpit,
(rcpit == 0x00) ? "Does not already exist" :
(rcpit == 0x01) ? "NVM subsystem port" :
(rcpit == 0x02) ? "NVMe-MI port" : "Reserved");
nvme_pel_rci_rcpit_to_string(rcpit));
printf("\tReporting Context Port Identifier (RCPID): %#x\n\n", rcpid);
}

Expand Down
15 changes: 15 additions & 0 deletions nvme-print.c
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,21 @@ const char *nvme_host_metadata_type_to_string(enum nvme_features_id fid,
}
}

const char *nvme_pel_rci_rcpit_to_string(enum nvme_pel_rci_rcpit rcpit)
{
switch (rcpit) {
case NVME_PEL_RCI_RCPIT_NOT_EXIST:
return "Does not already exist";
case NVME_PEL_RCI_RCPIT_EST_PORT:
return "NVM subsystem port";
case NVME_PEL_RCI_RCPIT_EST_ME:
return "NVMe-MI port";
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 @@ -302,6 +302,7 @@ const char *nvme_zone_state_to_string(__u8 state);
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);

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

0 comments on commit 17e19d0

Please sign in to comment.