From b48f10a9927be2251669f875ca7a957de27c7c0d Mon Sep 17 00:00:00 2001 From: Minwoo Im Date: Sun, 25 Aug 2019 22:22:42 +0900 Subject: [PATCH] id-ctrl: show Controller Type(CNTRLTYPE) CNTRLTYPE has been added in 1.4 spec. Example: cntrltype : 0 [7:2] : 0 Reserved [1:0] : 0 Controller type not reported Signed-off-by: Minwoo Im --- nvme-print.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/nvme-print.c b/nvme-print.c index 45cc4cea..90b2b9de 100644 --- a/nvme-print.c +++ b/nvme-print.c @@ -222,6 +222,22 @@ static void show_nvme_id_ctrl_ctratt(__le32 ctrl_ctratt) printf("\n"); } +static void show_nvme_id_ctrl_cntrltype(__u8 cntrltype) +{ + __u8 rsvd = (cntrltype & 0xFC) >> 2; + __u8 cntrl = cntrltype & 0x3; + + static const char *type[] = { + "Controller type not reported", + "I/O Controller", + "Discovery Controller", + "Administrative Controller" + }; + + printf(" [7:2] : %#x\tReserved\n", rsvd); + printf(" [1:0] : %#x\t%s\n", cntrltype, type[cntrl]); +} + static void show_nvme_id_ctrl_oacs(__le16 ctrl_oacs) { __u16 oacs = le16_to_cpu(ctrl_oacs); @@ -1075,7 +1091,8 @@ void __show_nvme_id_ctrl(struct nvme_id_ctrl *ctrl, unsigned int mode, void (*ve if (human) show_nvme_id_ctrl_ctratt(ctrl->ctratt); printf("rrls : %#x\n", le16_to_cpu(ctrl->rrls)); - + printf("cntrltype : %d\n", ctrl->cntrltype); + show_nvme_id_ctrl_cntrltype(ctrl->cntrltype); printf("crdt1 : %u\n", le16_to_cpu(ctrl->crdt1)); printf("crdt2 : %u\n", le16_to_cpu(ctrl->crdt2)); printf("crdt3 : %u\n", le16_to_cpu(ctrl->crdt3)); -- 2.50.1