]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme-print-stdout: add human readable output for DSTO field
authorFrancis Pravin <francis.p@samsung.com>
Thu, 9 Jan 2025 13:23:59 +0000 (18:53 +0530)
committerDaniel Wagner <wagi@monom.org>
Thu, 9 Jan 2025 13:39:36 +0000 (14:39 +0100)
Add human readable output for DSTO field of Identify Controller Data
Structure.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
nvme-print-stdout.c

index a1b9573622100e844604371aa3b7345bd4caea89..484696a23ed530c4aa8a88fe095abe1aa10fda0b 100644 (file)
@@ -2141,6 +2141,22 @@ void stdout_id_ctrl_rpmbs(__le32 ctrl_rpmbs)
        printf("\n");
 }
 
+static void stdout_id_ctrl_dsto(__u8 dsto)
+{
+       __u8 rsvd2 = (dsto & 0xfc) >> 2;
+       __u8 hirs = (dsto & 0x2) >> 1;
+       __u8 sdso = dsto & 0x1;
+
+       if (rsvd2)
+               printf("  [7:2] : %#x\tReserved\n", rsvd2);
+       printf("  [1:1] : %#x\tHost-Initiated Refresh capability %sSupported\n",
+               hirs, hirs ? "" : "Not ");
+       printf("  [0:0] : %#x\tNVM subsystem supports %s at a time\n", sdso,
+               sdso ? "only one device self-test operation in progress" :
+               "one device self-test operation per controller");
+       printf("\n");
+}
+
 static void stdout_id_ctrl_hctma(__le16 ctrl_hctma)
 {
        __u16 hctma = le16_to_cpu(ctrl_hctma);
@@ -3140,6 +3156,8 @@ static void stdout_id_ctrl(struct nvme_id_ctrl *ctrl,
                stdout_id_ctrl_rpmbs(ctrl->rpmbs);
        printf("edstt     : %d\n", le16_to_cpu(ctrl->edstt));
        printf("dsto      : %d\n", ctrl->dsto);
+       if (human)
+               stdout_id_ctrl_dsto(ctrl->dsto);
        printf("fwug      : %d\n", ctrl->fwug);
        printf("kas       : %d\n", le16_to_cpu(ctrl->kas));
        printf("hctma     : %#x\n", le16_to_cpu(ctrl->hctma));