From bb97ca63e7ebc6c390b9538380e49a95cee8aa6b Mon Sep 17 00:00:00 2001 From: Gollu Appalanaidu Date: Fri, 28 May 2021 10:40:40 +0530 Subject: [PATCH] nvme: add optional copy format support id ctrl field Add the OCFS field in Identify Controller Structure, as per the Ratified TP 4065b (Simple Copy Command). Signed-off-by: Gollu Appalanaidu --- nvme-print.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/nvme-print.c b/nvme-print.c index 1556b524..88a0664b 100644 --- a/nvme-print.c +++ b/nvme-print.c @@ -327,6 +327,7 @@ static void json_nvme_id_ctrl(struct nvme_id_ctrl *ctrl, json_object_add_value_int(root, "icsvscc", ctrl->icsvscc); json_object_add_value_int(root, "nwpc", ctrl->nwpc); json_object_add_value_int(root, "acwu", le16_to_cpu(ctrl->acwu)); + json_object_add_value_int(root, "ocfs", le16_to_cpu(ctrl->ocfs)); json_object_add_value_int(root, "sgls", le32_to_cpu(ctrl->sgls)); json_object_add_value_float(root, "maxdna", maxdna); json_object_add_value_int(root, "maxcna", le32_to_cpu(ctrl->maxcna)); @@ -3338,6 +3339,17 @@ static void nvme_show_id_ctrl_nwpc(__u8 nwpc) printf("\n"); } +static void nvme_show_id_ctrl_ocfs(__u16 ocfs) +{ + __u16 rsvd = (ocfs & 0xfffe) >> 1; + __u8 copy_fmt_0 = ocfs & 0x1; + if (rsvd) + printf(" [15:1] : %#x\tReserved\n", rsvd); + printf(" [0:0] : %#x\tController Copy Format 0h %sSupported\n", + copy_fmt_0, copy_fmt_0 ? "" : "Not "); + printf("\n"); +} + static void nvme_show_id_ctrl_sgls(__le32 ctrl_sgls) { __u32 sgls = le32_to_cpu(ctrl_sgls); @@ -4131,6 +4143,9 @@ void __nvme_show_id_ctrl(struct nvme_id_ctrl *ctrl, enum nvme_print_flags flags, if (human) nvme_show_id_ctrl_nwpc(ctrl->nwpc); printf("acwu : %d\n", le16_to_cpu(ctrl->acwu)); + printf("ocfs : %#x\n", le16_to_cpu(ctrl->ocfs)); + if (human) + nvme_show_id_ctrl_ocfs(ctrl->ocfs); printf("sgls : %#x\n", le32_to_cpu(ctrl->sgls)); if (human) nvme_show_id_ctrl_sgls(ctrl->sgls); -- 2.50.1