]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme-print: Add elpe, npss, tnvmcap and unvmcap human readable formats
authorTokunori Ikegami <ikegami.t@gmail.com>
Fri, 7 May 2021 18:04:44 +0000 (03:04 +0900)
committerTokunori Ikegami <ikegami.t@gmail.com>
Fri, 22 Oct 2021 18:29:50 +0000 (11:29 -0700)
nvme-print.c

index 3d2ae801d649d3f5eb5f167e6530fac3f5df8680..5b5bc4a3617f98c8b588e54a5fb558a4212d21dd 100644 (file)
@@ -2829,6 +2829,20 @@ static void nvme_show_id_ctrl_lpa(__u8 lpa)
        printf("\n");
 }
 
+static void nvme_show_id_ctrl_elpe(__u8 elpe)
+{
+       printf("  [7:0] : %d (0's based)\tError Log Page Entries (ELPE)\n",
+              elpe);
+       printf("\n");
+}
+
+static void nvme_show_id_ctrl_npss(__u8 npss)
+{
+       printf("  [7:0] : %d (0's based)\tNumber of Power States Support (NPSS)\n",
+              npss);
+       printf("\n");
+}
+
 static void nvme_show_id_ctrl_avscc(__u8 avscc)
 {
        __u8 rsvd = (avscc & 0xFE) >> 1;
@@ -2865,6 +2879,20 @@ static void nvme_show_id_ctrl_cctemp(__le16 cctemp)
        printf("\n");
 }
 
+static void nvme_show_id_ctrl_tnvmcap(__u8 *tnvmcap)
+{
+       printf("[127:0] : %.0Lf\tTotal NVM Capacity (TNVMCAP)\n",
+              int128_to_double(tnvmcap));
+       printf("\n");
+}
+
+static void nvme_show_id_ctrl_unvmcap(__u8 *unvmcap)
+{
+       printf("[127:0] : %.0Lf\tUnallocated NVM Capacity (UNVMCAP)\n",
+              int128_to_double(unvmcap));
+       printf("\n");
+}
+
 void nvme_show_id_ctrl_rpmbs(__le32 ctrl_rpmbs)
 {
        __u32 rpmbs = le32_to_cpu(ctrl_rpmbs);
@@ -3725,7 +3753,11 @@ void __nvme_show_id_ctrl(struct nvme_id_ctrl *ctrl, enum nvme_print_flags flags,
        if (human)
                nvme_show_id_ctrl_lpa(ctrl->lpa);
        printf("elpe      : %d\n", ctrl->elpe);
+       if (human)
+               nvme_show_id_ctrl_elpe(ctrl->elpe);
        printf("npss      : %d\n", ctrl->npss);
+       if (human)
+               nvme_show_id_ctrl_npss(ctrl->npss);
        printf("avscc     : %#x\n", ctrl->avscc);
        if (human)
                nvme_show_id_ctrl_avscc(ctrl->avscc);
@@ -3742,7 +3774,11 @@ void __nvme_show_id_ctrl(struct nvme_id_ctrl *ctrl, enum nvme_print_flags flags,
        printf("hmpre     : %d\n", le32_to_cpu(ctrl->hmpre));
        printf("hmmin     : %d\n", le32_to_cpu(ctrl->hmmin));
        printf("tnvmcap   : %.0Lf\n", int128_to_double(ctrl->tnvmcap));
+       if (human)
+               nvme_show_id_ctrl_tnvmcap(ctrl->tnvmcap);
        printf("unvmcap   : %.0Lf\n", int128_to_double(ctrl->unvmcap));
+       if (human)
+               nvme_show_id_ctrl_unvmcap(ctrl->unvmcap);
        printf("rpmbs     : %#x\n", le32_to_cpu(ctrl->rpmbs));
        if (human)
                nvme_show_id_ctrl_rpmbs(ctrl->rpmbs);