@@ -67,6 +67,64 @@ static bool drm_dp_validate_guid(struct drm_dp_mst_topology_mgr *mgr,
67
67
static int drm_dp_mst_register_i2c_bus (struct drm_dp_aux * aux );
68
68
static void drm_dp_mst_unregister_i2c_bus (struct drm_dp_aux * aux );
69
69
static void drm_dp_mst_kick_tx (struct drm_dp_mst_topology_mgr * mgr );
70
+
71
+ #define DP_STR (x ) [DP_ ## x] = #x
72
+
73
+ static const char * drm_dp_mst_req_type_str (u8 req_type )
74
+ {
75
+ static const char * const req_type_str [] = {
76
+ DP_STR (GET_MSG_TRANSACTION_VERSION ),
77
+ DP_STR (LINK_ADDRESS ),
78
+ DP_STR (CONNECTION_STATUS_NOTIFY ),
79
+ DP_STR (ENUM_PATH_RESOURCES ),
80
+ DP_STR (ALLOCATE_PAYLOAD ),
81
+ DP_STR (QUERY_PAYLOAD ),
82
+ DP_STR (RESOURCE_STATUS_NOTIFY ),
83
+ DP_STR (CLEAR_PAYLOAD_ID_TABLE ),
84
+ DP_STR (REMOTE_DPCD_READ ),
85
+ DP_STR (REMOTE_DPCD_WRITE ),
86
+ DP_STR (REMOTE_I2C_READ ),
87
+ DP_STR (REMOTE_I2C_WRITE ),
88
+ DP_STR (POWER_UP_PHY ),
89
+ DP_STR (POWER_DOWN_PHY ),
90
+ DP_STR (SINK_EVENT_NOTIFY ),
91
+ DP_STR (QUERY_STREAM_ENC_STATUS ),
92
+ };
93
+
94
+ if (req_type >= ARRAY_SIZE (req_type_str ) ||
95
+ !req_type_str [req_type ])
96
+ return "unknown" ;
97
+
98
+ return req_type_str [req_type ];
99
+ }
100
+
101
+ #undef DP_STR
102
+ #define DP_STR (x ) [DP_NAK_ ## x] = #x
103
+
104
+ static const char * drm_dp_mst_nak_reason_str (u8 nak_reason )
105
+ {
106
+ static const char * const nak_reason_str [] = {
107
+ DP_STR (WRITE_FAILURE ),
108
+ DP_STR (INVALID_READ ),
109
+ DP_STR (CRC_FAILURE ),
110
+ DP_STR (BAD_PARAM ),
111
+ DP_STR (DEFER ),
112
+ DP_STR (LINK_FAILURE ),
113
+ DP_STR (NO_RESOURCES ),
114
+ DP_STR (DPCD_FAIL ),
115
+ DP_STR (I2C_NAK ),
116
+ DP_STR (ALLOCATE_FAIL ),
117
+ };
118
+
119
+ if (nak_reason >= ARRAY_SIZE (nak_reason_str ) ||
120
+ !nak_reason_str [nak_reason ])
121
+ return "unknown" ;
122
+
123
+ return nak_reason_str [nak_reason ];
124
+ }
125
+
126
+ #undef DP_STR
127
+
70
128
/* sideband msg handling */
71
129
static u8 drm_dp_msg_header_crc4 (const uint8_t * data , size_t num_nibbles )
72
130
{
@@ -594,7 +652,8 @@ static bool drm_dp_sideband_parse_reply(struct drm_dp_sideband_msg_rx *raw,
594
652
case DP_POWER_UP_PHY :
595
653
return drm_dp_sideband_parse_power_updown_phy_ack (raw , msg );
596
654
default :
597
- DRM_ERROR ("Got unknown reply 0x%02x\n" , msg -> req_type );
655
+ DRM_ERROR ("Got unknown reply 0x%02x (%s)\n" , msg -> req_type ,
656
+ drm_dp_mst_req_type_str (msg -> req_type ));
598
657
return false;
599
658
}
600
659
}
@@ -661,7 +720,8 @@ static bool drm_dp_sideband_parse_req(struct drm_dp_sideband_msg_rx *raw,
661
720
case DP_RESOURCE_STATUS_NOTIFY :
662
721
return drm_dp_sideband_parse_resource_status_notify (raw , msg );
663
722
default :
664
- DRM_ERROR ("Got unknown request 0x%02x\n" , msg -> req_type );
723
+ DRM_ERROR ("Got unknown request 0x%02x (%s)\n" , msg -> req_type ,
724
+ drm_dp_mst_req_type_str (msg -> req_type ));
665
725
return false;
666
726
}
667
727
}
@@ -2747,7 +2807,12 @@ static int drm_dp_mst_handle_down_rep(struct drm_dp_mst_topology_mgr *mgr)
2747
2807
drm_dp_sideband_parse_reply (& mgr -> down_rep_recv , & txmsg -> reply );
2748
2808
2749
2809
if (txmsg -> reply .reply_type == DP_SIDEBAND_REPLY_NAK )
2750
- 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 );
2810
+ DRM_DEBUG_KMS ("Got NAK reply: req 0x%02x (%s), reason 0x%02x (%s), nak data 0x%02x\n" ,
2811
+ txmsg -> reply .req_type ,
2812
+ drm_dp_mst_req_type_str (txmsg -> reply .req_type ),
2813
+ txmsg -> reply .u .nak .reason ,
2814
+ drm_dp_mst_nak_reason_str (txmsg -> reply .u .nak .reason ),
2815
+ txmsg -> reply .u .nak .nak_data );
2751
2816
2752
2817
memset (& mgr -> down_rep_recv , 0 , sizeof (struct drm_dp_sideband_msg_rx ));
2753
2818
drm_dp_mst_topology_put_mstb (mstb );
0 commit comments