Skip to content

Commit 0d47c4d

Browse files
djbwstellarhopper
authored andcommitted
tools/testing/nvdimm: Add command debug messages
Arrange the for nfit_test_ctl() path to dump command payloads similarly to the acpi_nfit_ctl() path. This is useful for comparing the sequence of command events between an emulated ACPI-NFIT platform and a real one. Cc: Vishal Verma <[email protected]> Cc: Dave Jiang <[email protected]> Cc: Ira Weiny <[email protected]> Signed-off-by: Dan Williams <[email protected]> Signed-off-by: Vishal Verma <[email protected]>
1 parent 2477065 commit 0d47c4d

File tree

1 file changed

+25
-0
lines changed
  • tools/testing/nvdimm/test

1 file changed

+25
-0
lines changed

tools/testing/nvdimm/test/nfit.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,29 @@ static int get_dimm(struct nfit_mem *nfit_mem, unsigned int func)
11921192
return i;
11931193
}
11941194

1195+
static void nfit_ctl_dbg(struct acpi_nfit_desc *acpi_desc,
1196+
struct nvdimm *nvdimm, unsigned int cmd, void *buf,
1197+
unsigned int len)
1198+
{
1199+
struct nfit_test *t = container_of(acpi_desc, typeof(*t), acpi_desc);
1200+
unsigned int func = cmd;
1201+
unsigned int family = 0;
1202+
1203+
if (cmd == ND_CMD_CALL) {
1204+
struct nd_cmd_pkg *pkg = buf;
1205+
1206+
len = pkg->nd_size_in;
1207+
family = pkg->nd_family;
1208+
buf = pkg->nd_payload;
1209+
func = pkg->nd_command;
1210+
}
1211+
dev_dbg(&t->pdev.dev, "%s family: %d cmd: %d: func: %d input length: %d\n",
1212+
nvdimm ? nvdimm_name(nvdimm) : "bus", family, cmd, func,
1213+
len);
1214+
print_hex_dump_debug("nvdimm in ", DUMP_PREFIX_OFFSET, 16, 4,
1215+
buf, min(len, 256u), true);
1216+
}
1217+
11951218
static int nfit_test_ctl(struct nvdimm_bus_descriptor *nd_desc,
11961219
struct nvdimm *nvdimm, unsigned int cmd, void *buf,
11971220
unsigned int buf_len, int *cmd_rc)
@@ -1205,6 +1228,8 @@ static int nfit_test_ctl(struct nvdimm_bus_descriptor *nd_desc,
12051228
cmd_rc = &__cmd_rc;
12061229
*cmd_rc = 0;
12071230

1231+
nfit_ctl_dbg(acpi_desc, nvdimm, cmd, buf, buf_len);
1232+
12081233
if (nvdimm) {
12091234
struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm);
12101235
unsigned long cmd_mask = nvdimm_cmd_mask(nvdimm);

0 commit comments

Comments
 (0)