lkml.org 
[lkml]   [2021]   [Jul]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/3] fsi: occ: Add dynamic debug to dump command and response
Date
Use the dynamic branching capability of the dynamic debug subsystem
to dump the command and response with the correct OCC device name.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
drivers/fsi/fsi-occ.c | 44 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)

diff --git a/drivers/fsi/fsi-occ.c b/drivers/fsi/fsi-occ.c
index ecf738411fe2..641a6869b9df 100644
--- a/drivers/fsi/fsi-occ.c
+++ b/drivers/fsi/fsi-occ.c
@@ -21,6 +21,15 @@
#include <linux/uaccess.h>
#include <asm/unaligned.h>

+#if !defined(CONFIG_DYNAMIC_DEBUG_CORE)
+#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt)
+#if defined(DEBUG)
+#define DYNAMIC_DEBUG_BRANCH(descriptor) true
+#else /* DEBUG */
+#define DYNAMIC_DEBUG_BRANCH(descriptor) false
+#endif /* DEBUG */
+#endif /* CONFIG_DYNAMIC_DEBUG_CORE */
+
#define OCC_SRAM_BYTES 4096
#define OCC_CMD_DATA_BYTES 4090
#define OCC_RESP_DATA_BYTES 4089
@@ -359,6 +368,20 @@ static int occ_putsram(struct occ *occ, const void *data, ssize_t len,
byte_buf[len - 2] = checksum >> 8;
byte_buf[len - 1] = checksum & 0xff;

+ {
+ DEFINE_DYNAMIC_DEBUG_METADATA(ddm_occ_cmd, "OCC command");
+
+ if (DYNAMIC_DEBUG_BRANCH(ddm_occ_cmd)) {
+ char prefix[64];
+
+ snprintf(prefix, sizeof(prefix), "%s %s: cmd ",
+ dev_driver_string(occ->dev),
+ dev_name(occ->dev));
+ print_hex_dump(KERN_DEBUG, prefix, DUMP_PREFIX_OFFSET,
+ 16, 4, byte_buf, len, false);
+ }
+ }
+
rc = sbefifo_submit(occ->sbefifo, buf, cmd_len, buf, &resp_len);
if (rc)
goto free;
@@ -556,6 +579,27 @@ int fsi_occ_submit(struct device *dev, const void *request, size_t req_len,
}

*resp_len = resp_data_length + 7;
+
+ {
+ DEFINE_DYNAMIC_DEBUG_METADATA(ddm_occ_rsp,
+ "OCC response");
+ DEFINE_DYNAMIC_DEBUG_METADATA(ddm_occ_full_rsp,
+ "OCC full response");
+
+ if (DYNAMIC_DEBUG_BRANCH(ddm_occ_full_rsp) ||
+ DYNAMIC_DEBUG_BRANCH(ddm_occ_rsp)) {
+ char prefix[64];
+ size_t l = DYNAMIC_DEBUG_BRANCH(ddm_occ_full_rsp) ?
+ *resp_len : 16;
+
+ snprintf(prefix, sizeof(prefix), "%s %s: rsp ",
+ dev_driver_string(occ->dev),
+ dev_name(occ->dev));
+ print_hex_dump(KERN_DEBUG, prefix, DUMP_PREFIX_OFFSET,
+ 16, 4, resp, l, false);
+ }
+ }
+
rc = occ_verify_checksum(occ, resp, resp_data_length);

done:
--
2.27.0
\
 
 \ /
  Last update: 2021-07-16 17:22    [W:0.284 / U:0.404 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site