From: jeffreyalien Date: Tue, 17 Oct 2017 16:56:43 +0000 (-0500) Subject: nvme-cli : wdc-plugin Add support for WDC SN100 and SN200 devices. X-Git-Tag: v1.5~46 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=7ff5acc38f8a8a2876d933fbd335269aa281f401;p=users%2Fsagi%2Fnvme-cli.git nvme-cli : wdc-plugin Add support for WDC SN100 and SN200 devices. Update the checking for the wdc-plugin commands so that a "Device not supported" message will be displayed for non-WDC devices. Signed-off-by: jeffreyalien --- diff --git a/wdc-nvme.c b/wdc-nvme.c index 03c86c9e..b9812985 100644 --- a/wdc-nvme.c +++ b/wdc-nvme.c @@ -47,9 +47,11 @@ #define WDC_NVME_SUBCMD_SHIFT 8 #define WDC_NVME_LOG_SIZE_DATA_LEN 0x08 + /* Device Config */ -#define WDC_NVME_GF_VID 0x1c58 -#define WDC_NVME_GF_CNTL_ID 0x0003 +#define WDC_NVME_VID 0x1c58 +#define WDC_NVME_SN100_CNTL_ID 0x0003 +#define WDC_NVME_SN200_CNTL_ID 0x0023 /* Capture Diagnostics */ #define WDC_NVME_CAP_DIAG_HEADER_TOC_SIZE WDC_NVME_LOG_SIZE_DATA_LEN @@ -200,9 +202,10 @@ static int wdc_check_device(int fd) return -1; } ret = -1; - /* GF : ctrl->cntlid == PCI Device ID, use that with VID to identify GF Device */ - if ((le32_to_cpu(ctrl.cntlid) == WDC_NVME_GF_CNTL_ID) && - (le32_to_cpu(ctrl.vid) == WDC_NVME_GF_VID)) + /* WDC : ctrl->cntlid == PCI Device ID, use that with VID to identify WDC Devices */ + if ((le32_to_cpu(ctrl.vid) == WDC_NVME_VID) && + ((le32_to_cpu(ctrl.cntlid) == WDC_NVME_SN100_CNTL_ID) || + (le32_to_cpu(ctrl.cntlid) == WDC_NVME_SN200_CNTL_ID))) ret = 0; else fprintf(stderr, "WARNING : WDC : Device not supported\n");