From 01c4d3d32c5044d3d17055c2d94d40fee9d130e1 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 1 Jul 2023 00:38:48 +0200 Subject: Adding upstream version 2.5. Signed-off-by: Daniel Baumann --- plugins/innogrit/innogrit-nvme.c | 31 ++++++++++++++++++------------- plugins/innogrit/typedef.h | 1 + 2 files changed, 19 insertions(+), 13 deletions(-) (limited to 'plugins/innogrit') diff --git a/plugins/innogrit/innogrit-nvme.c b/plugins/innogrit/innogrit-nvme.c index 1771538..cd47efa 100644 --- a/plugins/innogrit/innogrit-nvme.c +++ b/plugins/innogrit/innogrit-nvme.c @@ -146,11 +146,13 @@ static int nvme_vucmd(int fd, unsigned char opcode, unsigned int cdw12, memset(&cmd, 0, sizeof(cmd)); cmd.opcode = opcode; + cmd.cdw2 = IGVSC_SIG; + cmd.cdw10 = data_len / 4; cmd.cdw12 = cdw12; cmd.cdw13 = cdw13; cmd.cdw14 = cdw14; cmd.cdw15 = cdw15; - cmd.nsid = 0; + cmd.nsid = 0xffffffff; cmd.addr = (__u64)(__u64)(uintptr_t)data; cmd.data_len = data_len; return nvme_submit_admin_passthru(fd, &cmd, NULL); @@ -198,8 +200,8 @@ static int innogrit_vsc_geteventlog(int argc, char **argv, ret = nvme_vucmd(dev_fd(dev), 0xFE, 0x82, 0x03, 0x00, 0x00, (char *)data, 4096); if (ret == -1) return ret; - - if (data[0] == 0x5A) + + if (data[0] == 0x5A) ivsctype = 1; else ivsctype = 0; @@ -227,8 +229,9 @@ static int innogrit_vsc_geteventlog(int argc, char **argv, icount++; memset(data, 0, 4096); - if (ivsctype == 1) - ret = nvme_vucmd(dev_fd(dev), 0xFE, 0x60, 0x00, 0x00, 0x00,(char *)data, 4096); + if (ivsctype == 1) + ret = nvme_vucmd(dev_fd(dev), 0xFE, 0x60, 0x00, 0x00, 0x00, (char *)data, + 4096); else ret = nvme_vucmd(dev_fd(dev), NVME_VSC_GET_EVENT_LOG, 0, 0, (SRB_SIGNATURE >> 32), @@ -345,10 +348,10 @@ static int innogrit_vsc_getcdump(int argc, char **argv, struct command *command, ret = nvme_vucmd(dev_fd(dev), 0xFE, 0x82, 0x03, 0x00, 0x00, (char *)data, 4096); if (ret == -1) return ret; - + if (data[0] == 0x5A) { ivsctype = 1; - ret = nvme_vucmd(dev_fd(dev), 0xFE, 0x82, 0x08, 0x00, 0x00,(char *)data, 4096); + ret = nvme_vucmd(dev_fd(dev), 0xFE, 0x82, 0x08, 0x00, 0x00, (char *)data, 4096); } else { ivsctype = 0; ret = nvme_vucmd(dev_fd(dev), NVME_VSC_GET, VSC_FN_GET_CDUMP, 0x00, @@ -403,12 +406,13 @@ static int innogrit_vsc_getcdump(int argc, char **argv, struct command *command, for (icur = 0; icur < itotal; icur += 4096) { memset(data, 0, 4096); if (busevsc) { - if (ivsctype == 1) - ret = nvme_vucmd(dev_fd(dev), 0xFE, 0x82, 0x08, 0x00, 0x00,(char *)data, 4096); + if (ivsctype == 1) + ret = nvme_vucmd(dev_fd(dev), 0xFE, 0x82, 0x08, 0x00, 0x00, + (char *)data, 4096); else ret = nvme_vucmd(dev_fd(dev), NVME_VSC_GET, VSC_FN_GET_CDUMP, 0x00, (SRB_SIGNATURE >> 32), (SRB_SIGNATURE & 0xFFFFFFFF), - (char *)data, 4096); + (char *)data, 4096); } else { ret = nvme_get_nsid_log(dev_fd(dev), true, 0x07, @@ -429,12 +433,13 @@ static int innogrit_vsc_getcdump(int argc, char **argv, struct command *command, if (ipackindex != ipackcount) { memset(data, 0, 4096); if (busevsc) { - if (ivsctype == 1) - ret = nvme_vucmd(dev_fd(dev), 0xFE, 0x82, 0x08, 0x00, 0x00,(char *)data, 4096); + if (ivsctype == 1) + ret = nvme_vucmd(dev_fd(dev), 0xFE, 0x82, 0x08, 0x00, 0x00, + (char *)data, 4096); else ret = nvme_vucmd(dev_fd(dev), NVME_VSC_GET, VSC_FN_GET_CDUMP, 0x00, (SRB_SIGNATURE >> 32), (SRB_SIGNATURE & 0xFFFFFFFF), - (char *)data, 4096); + (char *)data, 4096); } else { ret = nvme_get_nsid_log(dev_fd(dev), true, 0x07, diff --git a/plugins/innogrit/typedef.h b/plugins/innogrit/typedef.h index a97a008..f2a59b4 100644 --- a/plugins/innogrit/typedef.h +++ b/plugins/innogrit/typedef.h @@ -7,6 +7,7 @@ #define NVME_VSC_GET 0xE6 #define VSC_FN_GET_CDUMP 0x08 #define EVLOG_SIG 0x65766C67 +#define IGVSC_SIG 0x69677673 #define SRB_SIGNATURE 0x544952474F4E4E49ULL #define XCLEAN_LINE "\033[K" -- cgit v1.2.3