From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: [PATCH 5/5] drm/dp/mst: Provide better debugs for NAK replies
Date: Fri, 28 Sep 2018 21:04:03 +0300 [thread overview]
Message-ID: <20180928180403.22499-5-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20180928180403.22499-1-ville.syrjala@linux.intel.com>
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Decode the NAK reply fields to make it easier to parse the logs.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/drm_dp_mst_topology.c | 65 ++++++++++++++++++++++++++++++++++-
include/drm/drm_dp_helper.h | 1 +
2 files changed, 65 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index c0f754364cc7..1178c1655f9a 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -66,6 +66,64 @@ static bool drm_dp_validate_guid(struct drm_dp_mst_topology_mgr *mgr,
static int drm_dp_mst_register_i2c_bus(struct drm_dp_aux *aux);
static void drm_dp_mst_unregister_i2c_bus(struct drm_dp_aux *aux);
static void drm_dp_mst_kick_tx(struct drm_dp_mst_topology_mgr *mgr);
+
+#define STR(x) [DP_ ## x] = #x
+
+static const char *drm_dp_mst_req_type_str(u8 req_type)
+{
+ static const char * const req_type_str[] = {
+ STR(GET_MSG_TRANSACTION_VERSION),
+ STR(LINK_ADDRESS),
+ STR(CONNECTION_STATUS_NOTIFY),
+ STR(ENUM_PATH_RESOURCES),
+ STR(ALLOCATE_PAYLOAD),
+ STR(QUERY_PAYLOAD),
+ STR(RESOURCE_STATUS_NOTIFY),
+ STR(CLEAR_PAYLOAD_ID_TABLE),
+ STR(REMOTE_DPCD_READ),
+ STR(REMOTE_DPCD_WRITE),
+ STR(REMOTE_I2C_READ),
+ STR(REMOTE_I2C_WRITE),
+ STR(POWER_UP_PHY),
+ STR(POWER_DOWN_PHY),
+ STR(SINK_EVENT_NOTIFY),
+ STR(QUERY_STREAM_ENC_STATUS),
+ };
+
+ if (req_type >= ARRAY_SIZE(req_type_str) ||
+ !req_type_str[req_type])
+ return "unknown";
+
+ return req_type_str[req_type];
+}
+
+#undef STR
+#define STR(x) [DP_NAK_ ## x] = #x
+
+static const char *drm_dp_mst_nak_reason_str(u8 nak_reason)
+{
+ static const char * const nak_reason_str[] = {
+ STR(WRITE_FAILURE),
+ STR(INVALID_READ),
+ STR(CRC_FAILURE),
+ STR(BAD_PARAM),
+ STR(DEFER),
+ STR(LINK_FAILURE),
+ STR(NO_RESOURCES),
+ STR(DPCD_FAIL),
+ STR(I2C_NAK),
+ STR(ALLOCATE_FAIL),
+ };
+
+ if (nak_reason >= ARRAY_SIZE(nak_reason_str) ||
+ !nak_reason_str[nak_reason])
+ return "unknown";
+
+ return nak_reason_str[nak_reason];
+}
+
+#undef STR
+
/* sideband msg handling */
static u8 drm_dp_msg_header_crc4(const uint8_t *data, size_t num_nibbles)
{
@@ -2349,7 +2407,12 @@ static int drm_dp_mst_handle_down_rep(struct drm_dp_mst_topology_mgr *mgr)
drm_dp_sideband_parse_reply(&mgr->down_rep_recv, &txmsg->reply);
if (txmsg->reply.reply_type == DP_REPLY_NAK) {
- DRM_DEBUG_KMS("Got NAK reply: req 0x%02x, reason 0x%02x, nak data 0x%02x\n", txmsg->reply.req_type, txmsg->reply.u.nak.reason, txmsg->reply.u.nak.nak_data);
+ DRM_DEBUG_KMS("Got NAK reply: req 0x%02x (%s), reason 0x%02x (%s), nak data 0x%02x\n",
+ txmsg->reply.req_type,
+ drm_dp_mst_req_type_str(txmsg->reply.req_type),
+ txmsg->reply.u.nak.reason,
+ drm_dp_mst_nak_reason_str(txmsg->reply.u.nak.reason),
+ txmsg->reply.u.nak.nak_data);
}
memset(&mgr->down_rep_recv, 0, sizeof(struct drm_dp_sideband_msg_rx));
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index 2a0fd9d7066e..2453767246fb 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -918,6 +918,7 @@
#define DP_PEER_DEVICE_DP_LEGACY_CONV 0x4
/* DP 1.2 MST sideband request names DP 1.2a Table 2-80 */
+#define DP_GET_MSG_TRANSACTION_VERSION 0x00 /* DP 1.3 */
#define DP_LINK_ADDRESS 0x01
#define DP_CONNECTION_STATUS_NOTIFY 0x02
#define DP_ENUM_PATH_RESOURCES 0x10
--
2.16.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2018-09-28 18:04 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-28 18:03 [PATCH 1/5] drm/dp/mst: Configure no_stop_bit correctly for remote i2c xfers Ville Syrjala
2018-09-28 18:04 ` [PATCH 2/5] drm/dp/mst: Validate REMOTE_I2C_READ harder Ville Syrjala
2018-12-07 23:11 ` Dhinakaran Pandiyan
2018-09-28 18:04 ` [PATCH 3/5] drm/dp: Implement I2C_M_STOP for i2c-over-aux Ville Syrjala
2018-12-11 2:47 ` Dhinakaran Pandiyan
2018-12-12 10:30 ` Daniel Vetter
2018-12-12 12:12 ` Ville Syrjälä
2018-09-28 18:04 ` [PATCH 4/5] drm/dp/mst: Provide defines for ACK vs. NAK reply type Ville Syrjala
2018-12-08 0:22 ` [Intel-gfx] " Dhinakaran Pandiyan
2018-09-28 18:04 ` Ville Syrjala [this message]
2018-09-28 21:55 ` [PATCH 5/5] drm/dp/mst: Provide better debugs for NAK replies kbuild test robot
2018-12-08 0:57 ` [Intel-gfx] " Dhinakaran Pandiyan
2018-12-08 1:05 ` Dhinakaran Pandiyan
2018-10-01 11:55 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/5] drm/dp/mst: Configure no_stop_bit correctly for remote i2c xfers Patchwork
2018-10-01 12:18 ` ✓ Fi.CI.BAT: success " Patchwork
2018-10-01 13:56 ` ✓ Fi.CI.IGT: " Patchwork
2018-12-07 20:45 ` [PATCH 1/5] " Dhinakaran Pandiyan
2018-12-07 22:52 ` [Intel-gfx] " Dhinakaran Pandiyan
2018-12-10 16:39 ` Ville Syrjälä
2018-12-10 20:09 ` [Intel-gfx] " Dhinakaran Pandiyan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180928180403.22499-5-ville.syrjala@linux.intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox