From: Keith Busch Date: Wed, 8 Jun 2016 18:33:35 +0000 (-0600) Subject: Add intel marketing log page X-Git-Tag: v0.8~14 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=bae7966bc8d4bb755155efadb6d5adf9f5edfca5;p=users%2Fhch%2Fnvme-cli.git Add intel marketing log page Added as defined by public Intel datasheet on P3xxx series. Signed-off-by: Keith Busch --- diff --git a/intel-nvme.c b/intel-nvme.c index 541f3b1..0c004d2 100644 --- a/intel-nvme.c +++ b/intel-nvme.c @@ -17,7 +17,7 @@ static struct plugin intel_nvme = { .next = NULL, .commands = commands, }; - + static void init() __attribute__((constructor)); static void init() { @@ -82,3 +82,36 @@ static int get_additional_smart_log(int argc, char **argv, struct command *cmd, nvme_status_to_string(err), err); return err; } + +static int get_market_log(int argc, char **argv, struct command *cmd, struct plugin *plugin) +{ + char log[512]; + int err, fd; + + char *desc = "Get Intel Marketing Name log and show it."; + const char *raw = "dump output in binary format"; + struct config { + int raw_binary; + }; + + struct config cfg = { + }; + + const struct argconfig_commandline_options command_line_options[] = { + {"raw-binary", 'b', "", CFG_NONE, &cfg.raw_binary, no_argument, raw}, + {0} + }; + + fd = parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg)); + + err = nvme_get_log(fd, 0xffffffff, 0xdd, sizeof(log), log); + if (!err) { + if (!cfg.raw_binary) + printf("Intel Marketing Name Log:\n%s\n", log); + else + d_raw((unsigned char *)&log, sizeof(log)); + } else if (err > 0) + fprintf(stderr, "NVMe Status:%s(%x)\n", + nvme_status_to_string(err), err); + return err; +} diff --git a/intel-nvme.h b/intel-nvme.h index 5c17df7..2bd269b 100644 --- a/intel-nvme.h +++ b/intel-nvme.h @@ -9,6 +9,7 @@ COMMAND_LIST( ENTRY("id-ctrl", "Send NVMe Identify Controller", id_ctrl) ENTRY("smart-log-add", "Retrieve Intel SMART Log, show it", get_additional_smart_log) + ENTRY("market-name", "Retrieve Intel Marketing Name log, show it", get_market_log) ); #endif