Commit 0d47c4df authored by Dan Williams's avatar Dan Williams Committed by Vishal Verma
Browse files

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 <vishal.l.verma@intel.com>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
Signed-off-by: default avatarVishal Verma <vishal.l.verma@intel.com>
parent 24770658
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -1192,6 +1192,29 @@ static int get_dimm(struct nfit_mem *nfit_mem, unsigned int func)
	return i;
}

static void nfit_ctl_dbg(struct acpi_nfit_desc *acpi_desc,
		struct nvdimm *nvdimm, unsigned int cmd, void *buf,
		unsigned int len)
{
	struct nfit_test *t = container_of(acpi_desc, typeof(*t), acpi_desc);
	unsigned int func = cmd;
	unsigned int family = 0;

	if (cmd == ND_CMD_CALL) {
		struct nd_cmd_pkg *pkg = buf;

		len = pkg->nd_size_in;
		family = pkg->nd_family;
		buf = pkg->nd_payload;
		func = pkg->nd_command;
	}
	dev_dbg(&t->pdev.dev, "%s family: %d cmd: %d: func: %d input length: %d\n",
			nvdimm ? nvdimm_name(nvdimm) : "bus", family, cmd, func,
			len);
	print_hex_dump_debug("nvdimm in  ", DUMP_PREFIX_OFFSET, 16, 4,
			buf, min(len, 256u), true);
}

static int nfit_test_ctl(struct nvdimm_bus_descriptor *nd_desc,
		struct nvdimm *nvdimm, unsigned int cmd, void *buf,
		unsigned int buf_len, int *cmd_rc)
@@ -1205,6 +1228,8 @@ static int nfit_test_ctl(struct nvdimm_bus_descriptor *nd_desc,
		cmd_rc = &__cmd_rc;
	*cmd_rc = 0;

	nfit_ctl_dbg(acpi_desc, nvdimm, cmd, buf, buf_len);

	if (nvdimm) {
		struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm);
		unsigned long cmd_mask = nvdimm_cmd_mask(nvdimm);