1 /*
2  * Copyright 2019 Advanced Micro Devices, Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20  * OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * Authors: AMD
23  *
24  */
25 
26 
27 #include "hdcp.h"
28 
mod_hdcp_dump_binary_message(uint8_t * msg,uint32_t msg_size,uint8_t * buf,uint32_t buf_size)29 void mod_hdcp_dump_binary_message(uint8_t *msg, uint32_t msg_size,
30 		uint8_t *buf, uint32_t buf_size)
31 {
32 	const uint8_t bytes_per_line = 16,
33 			byte_size = 3,
34 			newline_size = 1,
35 			terminator_size = 1;
36 	uint32_t line_count = msg_size / bytes_per_line,
37 			trailing_bytes = msg_size % bytes_per_line;
38 	uint32_t target_size = (byte_size * bytes_per_line + newline_size) * line_count +
39 			byte_size * trailing_bytes + newline_size + terminator_size;
40 	uint32_t buf_pos = 0;
41 	uint32_t i = 0;
42 
43 	if (buf_size >= target_size) {
44 		for (i = 0; i < msg_size; i++) {
45 			if (i % bytes_per_line == 0)
46 				buf[buf_pos++] = '\n';
47 			sprintf(&buf[buf_pos], "%02X ", msg[i]);
48 			buf_pos += byte_size;
49 		}
50 		buf[buf_pos++] = '\0';
51 	}
52 }
53 
mod_hdcp_log_ddc_trace(struct mod_hdcp * hdcp)54 void mod_hdcp_log_ddc_trace(struct mod_hdcp *hdcp)
55 {
56 	if (is_hdcp1(hdcp)) {
57 		HDCP_DDC_READ_TRACE(hdcp, "BKSV", hdcp->auth.msg.hdcp1.bksv,
58 				sizeof(hdcp->auth.msg.hdcp1.bksv));
59 		HDCP_DDC_READ_TRACE(hdcp, "BCAPS", &hdcp->auth.msg.hdcp1.bcaps,
60 				sizeof(hdcp->auth.msg.hdcp1.bcaps));
61 		HDCP_DDC_READ_TRACE(hdcp, "BSTATUS",
62 				(uint8_t *)&hdcp->auth.msg.hdcp1.bstatus,
63 				sizeof(hdcp->auth.msg.hdcp1.bstatus));
64 		HDCP_DDC_WRITE_TRACE(hdcp, "AN", hdcp->auth.msg.hdcp1.an,
65 				sizeof(hdcp->auth.msg.hdcp1.an));
66 		HDCP_DDC_WRITE_TRACE(hdcp, "AKSV", hdcp->auth.msg.hdcp1.aksv,
67 				sizeof(hdcp->auth.msg.hdcp1.aksv));
68 		HDCP_DDC_WRITE_TRACE(hdcp, "AINFO", &hdcp->auth.msg.hdcp1.ainfo,
69 				sizeof(hdcp->auth.msg.hdcp1.ainfo));
70 		HDCP_DDC_READ_TRACE(hdcp, "RI' / R0'",
71 				(uint8_t *)&hdcp->auth.msg.hdcp1.r0p,
72 				sizeof(hdcp->auth.msg.hdcp1.r0p));
73 		HDCP_DDC_READ_TRACE(hdcp, "BINFO",
74 				(uint8_t *)&hdcp->auth.msg.hdcp1.binfo_dp,
75 				sizeof(hdcp->auth.msg.hdcp1.binfo_dp));
76 		HDCP_DDC_READ_TRACE(hdcp, "KSVLIST", hdcp->auth.msg.hdcp1.ksvlist,
77 				hdcp->auth.msg.hdcp1.ksvlist_size);
78 		HDCP_DDC_READ_TRACE(hdcp, "V'", hdcp->auth.msg.hdcp1.vp,
79 				sizeof(hdcp->auth.msg.hdcp1.vp));
80 	} else if (is_hdcp2(hdcp)) {
81 		HDCP_DDC_READ_TRACE(hdcp, "HDCP2Version",
82 				&hdcp->auth.msg.hdcp2.hdcp2version_hdmi,
83 				sizeof(hdcp->auth.msg.hdcp2.hdcp2version_hdmi));
84 		HDCP_DDC_READ_TRACE(hdcp, "Rx Caps", hdcp->auth.msg.hdcp2.rxcaps_dp,
85 				sizeof(hdcp->auth.msg.hdcp2.rxcaps_dp));
86 		HDCP_DDC_WRITE_TRACE(hdcp, "AKE Init", hdcp->auth.msg.hdcp2.ake_init,
87 				sizeof(hdcp->auth.msg.hdcp2.ake_init));
88 		HDCP_DDC_READ_TRACE(hdcp, "AKE Cert", hdcp->auth.msg.hdcp2.ake_cert,
89 				sizeof(hdcp->auth.msg.hdcp2.ake_cert));
90 		HDCP_DDC_WRITE_TRACE(hdcp, "Stored KM",
91 				hdcp->auth.msg.hdcp2.ake_stored_km,
92 				sizeof(hdcp->auth.msg.hdcp2.ake_stored_km));
93 		HDCP_DDC_WRITE_TRACE(hdcp, "No Stored KM",
94 				hdcp->auth.msg.hdcp2.ake_no_stored_km,
95 				sizeof(hdcp->auth.msg.hdcp2.ake_no_stored_km));
96 		HDCP_DDC_READ_TRACE(hdcp, "H'", hdcp->auth.msg.hdcp2.ake_h_prime,
97 				sizeof(hdcp->auth.msg.hdcp2.ake_h_prime));
98 		HDCP_DDC_READ_TRACE(hdcp, "Pairing Info",
99 				hdcp->auth.msg.hdcp2.ake_pairing_info,
100 				sizeof(hdcp->auth.msg.hdcp2.ake_pairing_info));
101 		HDCP_DDC_WRITE_TRACE(hdcp, "LC Init", hdcp->auth.msg.hdcp2.lc_init,
102 				sizeof(hdcp->auth.msg.hdcp2.lc_init));
103 		HDCP_DDC_READ_TRACE(hdcp, "L'", hdcp->auth.msg.hdcp2.lc_l_prime,
104 				sizeof(hdcp->auth.msg.hdcp2.lc_l_prime));
105 		HDCP_DDC_WRITE_TRACE(hdcp, "Exchange KS", hdcp->auth.msg.hdcp2.ske_eks,
106 				sizeof(hdcp->auth.msg.hdcp2.ske_eks));
107 		HDCP_DDC_READ_TRACE(hdcp, "Rx Status",
108 				(uint8_t *)&hdcp->auth.msg.hdcp2.rxstatus,
109 				sizeof(hdcp->auth.msg.hdcp2.rxstatus));
110 		HDCP_DDC_READ_TRACE(hdcp, "Rx Id List",
111 				hdcp->auth.msg.hdcp2.rx_id_list,
112 				hdcp->auth.msg.hdcp2.rx_id_list_size);
113 		HDCP_DDC_WRITE_TRACE(hdcp, "Rx Id List Ack",
114 				hdcp->auth.msg.hdcp2.repeater_auth_ack,
115 				sizeof(hdcp->auth.msg.hdcp2.repeater_auth_ack));
116 		HDCP_DDC_WRITE_TRACE(hdcp, "Content Stream Management",
117 				hdcp->auth.msg.hdcp2.repeater_auth_stream_manage,
118 				hdcp->auth.msg.hdcp2.stream_manage_size);
119 		HDCP_DDC_READ_TRACE(hdcp, "Stream Ready",
120 				hdcp->auth.msg.hdcp2.repeater_auth_stream_ready,
121 				sizeof(hdcp->auth.msg.hdcp2.repeater_auth_stream_ready));
122 		HDCP_DDC_WRITE_TRACE(hdcp, "Content Stream Type",
123 				hdcp->auth.msg.hdcp2.content_stream_type_dp,
124 				sizeof(hdcp->auth.msg.hdcp2.content_stream_type_dp));
125 	}
126 }
127 
mod_hdcp_status_to_str(int32_t status)128 char *mod_hdcp_status_to_str(int32_t status)
129 {
130 	switch (status) {
131 	case MOD_HDCP_STATUS_SUCCESS:
132 		return "MOD_HDCP_STATUS_SUCCESS";
133 	case MOD_HDCP_STATUS_FAILURE:
134 		return "MOD_HDCP_STATUS_FAILURE";
135 	case MOD_HDCP_STATUS_RESET_NEEDED:
136 		return "MOD_HDCP_STATUS_RESET_NEEDED";
137 	case MOD_HDCP_STATUS_DISPLAY_OUT_OF_BOUND:
138 		return "MOD_HDCP_STATUS_DISPLAY_OUT_OF_BOUND";
139 	case MOD_HDCP_STATUS_DISPLAY_NOT_FOUND:
140 		return "MOD_HDCP_STATUS_DISPLAY_NOT_FOUND";
141 	case MOD_HDCP_STATUS_INVALID_STATE:
142 		return "MOD_HDCP_STATUS_INVALID_STATE";
143 	case MOD_HDCP_STATUS_NOT_IMPLEMENTED:
144 		return "MOD_HDCP_STATUS_NOT_IMPLEMENTED";
145 	case MOD_HDCP_STATUS_INTERNAL_POLICY_FAILURE:
146 		return "MOD_HDCP_STATUS_INTERNAL_POLICY_FAILURE";
147 	case MOD_HDCP_STATUS_UPDATE_TOPOLOGY_FAILURE:
148 		return "MOD_HDCP_STATUS_UPDATE_TOPOLOGY_FAILURE";
149 	case MOD_HDCP_STATUS_CREATE_PSP_SERVICE_FAILURE:
150 		return "MOD_HDCP_STATUS_CREATE_PSP_SERVICE_FAILURE";
151 	case MOD_HDCP_STATUS_DESTROY_PSP_SERVICE_FAILURE:
152 		return "MOD_HDCP_STATUS_DESTROY_PSP_SERVICE_FAILURE";
153 	case MOD_HDCP_STATUS_HDCP1_CREATE_SESSION_FAILURE:
154 		return "MOD_HDCP_STATUS_HDCP1_CREATE_SESSION_FAILURE";
155 	case MOD_HDCP_STATUS_HDCP1_DESTROY_SESSION_FAILURE:
156 		return "MOD_HDCP_STATUS_HDCP1_DESTROY_SESSION_FAILURE";
157 	case MOD_HDCP_STATUS_HDCP1_VALIDATE_ENCRYPTION_FAILURE:
158 		return "MOD_HDCP_STATUS_HDCP1_VALIDATE_ENCRYPTION_FAILURE";
159 	case MOD_HDCP_STATUS_HDCP1_NOT_HDCP_REPEATER:
160 		return "MOD_HDCP_STATUS_HDCP1_NOT_HDCP_REPEATER";
161 	case MOD_HDCP_STATUS_HDCP1_NOT_CAPABLE:
162 		return "MOD_HDCP_STATUS_HDCP1_NOT_CAPABLE";
163 	case MOD_HDCP_STATUS_HDCP1_R0_PRIME_PENDING:
164 		return "MOD_HDCP_STATUS_HDCP1_R0_PRIME_PENDING";
165 	case MOD_HDCP_STATUS_HDCP1_VALIDATE_RX_FAILURE:
166 		return "MOD_HDCP_STATUS_HDCP1_VALIDATE_RX_FAILURE";
167 	case MOD_HDCP_STATUS_HDCP1_BKSV_REVOKED:
168 		return "MOD_HDCP_STATUS_HDCP1_BKSV_REVOKED";
169 	case MOD_HDCP_STATUS_HDCP1_KSV_LIST_NOT_READY:
170 		return "MOD_HDCP_STATUS_HDCP1_KSV_LIST_NOT_READY";
171 	case MOD_HDCP_STATUS_HDCP1_VALIDATE_KSV_LIST_FAILURE:
172 		return "MOD_HDCP_STATUS_HDCP1_VALIDATE_KSV_LIST_FAILURE";
173 	case MOD_HDCP_STATUS_HDCP1_KSV_LIST_REVOKED:
174 		return "MOD_HDCP_STATUS_HDCP1_KSV_LIST_REVOKED";
175 	case MOD_HDCP_STATUS_HDCP1_ENABLE_ENCRYPTION_FAILURE:
176 		return "MOD_HDCP_STATUS_HDCP1_ENABLE_ENCRYPTION_FAILURE";
177 	case MOD_HDCP_STATUS_HDCP1_ENABLE_STREAM_ENCRYPTION_FAILURE:
178 		return "MOD_HDCP_STATUS_HDCP1_ENABLE_STREAM_ENCRYPTION_FAILURE";
179 	case MOD_HDCP_STATUS_HDCP1_MAX_CASCADE_EXCEEDED_FAILURE:
180 		return "MOD_HDCP_STATUS_HDCP1_MAX_CASCADE_EXCEEDED_FAILURE";
181 	case MOD_HDCP_STATUS_HDCP1_MAX_DEVS_EXCEEDED_FAILURE:
182 		return "MOD_HDCP_STATUS_HDCP1_MAX_DEVS_EXCEEDED_FAILURE";
183 	case MOD_HDCP_STATUS_HDCP1_DEVICE_COUNT_MISMATCH_FAILURE:
184 		return "MOD_HDCP_STATUS_HDCP1_DEVICE_COUNT_MISMATCH_FAILURE";
185 	case MOD_HDCP_STATUS_HDCP1_LINK_INTEGRITY_FAILURE:
186 		return "MOD_HDCP_STATUS_HDCP1_LINK_INTEGRITY_FAILURE";
187 	case MOD_HDCP_STATUS_HDCP1_REAUTH_REQUEST_ISSUED:
188 		return "MOD_HDCP_STATUS_HDCP1_REAUTH_REQUEST_ISSUED";
189 	case MOD_HDCP_STATUS_HDCP1_LINK_MAINTENANCE_FAILURE:
190 		return "MOD_HDCP_STATUS_HDCP1_LINK_MAINTENANCE_FAILURE";
191 	case MOD_HDCP_STATUS_HDCP1_INVALID_BKSV:
192 		return "MOD_HDCP_STATUS_HDCP1_INVALID_BKSV";
193 	case MOD_HDCP_STATUS_DDC_FAILURE:
194 		return "MOD_HDCP_STATUS_DDC_FAILURE";
195 	case MOD_HDCP_STATUS_INVALID_OPERATION:
196 		return "MOD_HDCP_STATUS_INVALID_OPERATION";
197 	case MOD_HDCP_STATUS_HDCP2_NOT_CAPABLE:
198 		return "MOD_HDCP_STATUS_HDCP2_NOT_CAPABLE";
199 	case MOD_HDCP_STATUS_HDCP2_CREATE_SESSION_FAILURE:
200 		return "MOD_HDCP_STATUS_HDCP2_CREATE_SESSION_FAILURE";
201 	case MOD_HDCP_STATUS_HDCP2_DESTROY_SESSION_FAILURE:
202 		return "MOD_HDCP_STATUS_HDCP2_DESTROY_SESSION_FAILURE";
203 	case MOD_HDCP_STATUS_HDCP2_PREP_AKE_INIT_FAILURE:
204 		return "MOD_HDCP_STATUS_HDCP2_PREP_AKE_INIT_FAILURE";
205 	case MOD_HDCP_STATUS_HDCP2_AKE_CERT_PENDING:
206 		return "MOD_HDCP_STATUS_HDCP2_AKE_CERT_PENDING";
207 	case MOD_HDCP_STATUS_HDCP2_H_PRIME_PENDING:
208 		return "MOD_HDCP_STATUS_HDCP2_H_PRIME_PENDING";
209 	case MOD_HDCP_STATUS_HDCP2_PAIRING_INFO_PENDING:
210 		return "MOD_HDCP_STATUS_HDCP2_PAIRING_INFO_PENDING";
211 	case MOD_HDCP_STATUS_HDCP2_VALIDATE_AKE_CERT_FAILURE:
212 		return "MOD_HDCP_STATUS_HDCP2_VALIDATE_AKE_CERT_FAILURE";
213 	case MOD_HDCP_STATUS_HDCP2_AKE_CERT_REVOKED:
214 		return "MOD_HDCP_STATUS_HDCP2_AKE_CERT_REVOKED";
215 	case MOD_HDCP_STATUS_HDCP2_VALIDATE_H_PRIME_FAILURE:
216 		return "MOD_HDCP_STATUS_HDCP2_VALIDATE_H_PRIME_FAILURE";
217 	case MOD_HDCP_STATUS_HDCP2_VALIDATE_PAIRING_INFO_FAILURE:
218 		return "MOD_HDCP_STATUS_HDCP2_VALIDATE_PAIRING_INFO_FAILURE";
219 	case MOD_HDCP_STATUS_HDCP2_PREP_LC_INIT_FAILURE:
220 		return "MOD_HDCP_STATUS_HDCP2_PREP_LC_INIT_FAILURE";
221 	case MOD_HDCP_STATUS_HDCP2_L_PRIME_PENDING:
222 		return "MOD_HDCP_STATUS_HDCP2_L_PRIME_PENDING";
223 	case MOD_HDCP_STATUS_HDCP2_VALIDATE_L_PRIME_FAILURE:
224 		return "MOD_HDCP_STATUS_HDCP2_VALIDATE_L_PRIME_FAILURE";
225 	case MOD_HDCP_STATUS_HDCP2_PREP_EKS_FAILURE:
226 		return "MOD_HDCP_STATUS_HDCP2_PREP_EKS_FAILURE";
227 	case MOD_HDCP_STATUS_HDCP2_ENABLE_ENCRYPTION_FAILURE:
228 		return "MOD_HDCP_STATUS_HDCP2_ENABLE_ENCRYPTION_FAILURE";
229 	case MOD_HDCP_STATUS_HDCP2_VALIDATE_RX_ID_LIST_FAILURE:
230 		return "MOD_HDCP_STATUS_HDCP2_VALIDATE_RX_ID_LIST_FAILURE";
231 	case MOD_HDCP_STATUS_HDCP2_RX_ID_LIST_REVOKED:
232 		return "MOD_HDCP_STATUS_HDCP2_RX_ID_LIST_REVOKED";
233 	case MOD_HDCP_STATUS_HDCP2_RX_ID_LIST_NOT_READY:
234 		return "MOD_HDCP_STATUS_HDCP2_RX_ID_LIST_NOT_READY";
235 	case MOD_HDCP_STATUS_HDCP2_ENABLE_STREAM_ENCRYPTION_FAILURE:
236 		return "MOD_HDCP_STATUS_HDCP2_ENABLE_STREAM_ENCRYPTION_FAILURE";
237 	case MOD_HDCP_STATUS_HDCP2_STREAM_READY_PENDING:
238 		return "MOD_HDCP_STATUS_HDCP2_STREAM_READY_PENDING";
239 	case MOD_HDCP_STATUS_HDCP2_VALIDATE_STREAM_READY_FAILURE:
240 		return "MOD_HDCP_STATUS_HDCP2_VALIDATE_STREAM_READY_FAILURE";
241 	case MOD_HDCP_STATUS_HDCP2_PREPARE_STREAM_MANAGEMENT_FAILURE:
242 		return "MOD_HDCP_STATUS_HDCP2_PREPARE_STREAM_MANAGEMENT_FAILURE";
243 	case MOD_HDCP_STATUS_HDCP2_REAUTH_REQUEST:
244 		return "MOD_HDCP_STATUS_HDCP2_REAUTH_REQUEST";
245 	case MOD_HDCP_STATUS_HDCP2_REAUTH_LINK_INTEGRITY_FAILURE:
246 		return "MOD_HDCP_STATUS_HDCP2_REAUTH_LINK_INTEGRITY_FAILURE";
247 	case MOD_HDCP_STATUS_HDCP2_DEVICE_COUNT_MISMATCH_FAILURE:
248 		return "MOD_HDCP_STATUS_HDCP2_DEVICE_COUNT_MISMATCH_FAILURE";
249 	case MOD_HDCP_STATUS_UNSUPPORTED_PSP_VER_FAILURE:
250 		return "MOD_HDCP_STATUS_UNSUPPORTED_PSP_VER_FAILURE";
251 	default:
252 		return "MOD_HDCP_STATUS_UNKNOWN";
253 	}
254 }
255 
mod_hdcp_state_id_to_str(int32_t id)256 char *mod_hdcp_state_id_to_str(int32_t id)
257 {
258 	switch (id) {
259 	case HDCP_UNINITIALIZED:
260 		return "HDCP_UNINITIALIZED";
261 	case HDCP_INITIALIZED:
262 		return "HDCP_INITIALIZED";
263 	case HDCP_CP_NOT_DESIRED:
264 		return "HDCP_CP_NOT_DESIRED";
265 	case H1_A0_WAIT_FOR_ACTIVE_RX:
266 		return "H1_A0_WAIT_FOR_ACTIVE_RX";
267 	case H1_A1_EXCHANGE_KSVS:
268 		return "H1_A1_EXCHANGE_KSVS";
269 	case H1_A2_COMPUTATIONS_A3_VALIDATE_RX_A6_TEST_FOR_REPEATER:
270 		return "H1_A2_COMPUTATIONS_A3_VALIDATE_RX_A6_TEST_FOR_REPEATER";
271 	case H1_A45_AUTHENTICATED:
272 		return "H1_A45_AUTHENTICATED";
273 	case H1_A8_WAIT_FOR_READY:
274 		return "H1_A8_WAIT_FOR_READY";
275 	case H1_A9_READ_KSV_LIST:
276 		return "H1_A9_READ_KSV_LIST";
277 	case D1_A0_DETERMINE_RX_HDCP_CAPABLE:
278 		return "D1_A0_DETERMINE_RX_HDCP_CAPABLE";
279 	case D1_A1_EXCHANGE_KSVS:
280 		return "D1_A1_EXCHANGE_KSVS";
281 	case D1_A23_WAIT_FOR_R0_PRIME:
282 		return "D1_A23_WAIT_FOR_R0_PRIME";
283 	case D1_A2_COMPUTATIONS_A3_VALIDATE_RX_A5_TEST_FOR_REPEATER:
284 		return "D1_A2_COMPUTATIONS_A3_VALIDATE_RX_A5_TEST_FOR_REPEATER";
285 	case D1_A4_AUTHENTICATED:
286 		return "D1_A4_AUTHENTICATED";
287 	case D1_A6_WAIT_FOR_READY:
288 		return "D1_A6_WAIT_FOR_READY";
289 	case D1_A7_READ_KSV_LIST:
290 		return "D1_A7_READ_KSV_LIST";
291 	case H2_A0_KNOWN_HDCP2_CAPABLE_RX:
292 		return "H2_A0_KNOWN_HDCP2_CAPABLE_RX";
293 	case H2_A1_SEND_AKE_INIT:
294 		return "H2_A1_SEND_AKE_INIT";
295 	case H2_A1_VALIDATE_AKE_CERT:
296 		return "H2_A1_VALIDATE_AKE_CERT";
297 	case H2_A1_SEND_NO_STORED_KM:
298 		return "H2_A1_SEND_NO_STORED_KM";
299 	case H2_A1_READ_H_PRIME:
300 		return "H2_A1_READ_H_PRIME";
301 	case H2_A1_READ_PAIRING_INFO_AND_VALIDATE_H_PRIME:
302 		return "H2_A1_READ_PAIRING_INFO_AND_VALIDATE_H_PRIME";
303 	case H2_A1_SEND_STORED_KM:
304 		return "H2_A1_SEND_STORED_KM";
305 	case H2_A1_VALIDATE_H_PRIME:
306 		return "H2_A1_VALIDATE_H_PRIME";
307 	case H2_A2_LOCALITY_CHECK:
308 		return "H2_A2_LOCALITY_CHECK";
309 	case H2_A3_EXCHANGE_KS_AND_TEST_FOR_REPEATER:
310 		return "H2_A3_EXCHANGE_KS_AND_TEST_FOR_REPEATER";
311 	case H2_ENABLE_ENCRYPTION:
312 		return "H2_ENABLE_ENCRYPTION";
313 	case H2_A5_AUTHENTICATED:
314 		return "H2_A5_AUTHENTICATED";
315 	case H2_A6_WAIT_FOR_RX_ID_LIST:
316 		return "H2_A6_WAIT_FOR_RX_ID_LIST";
317 	case H2_A78_VERIFY_RX_ID_LIST_AND_SEND_ACK:
318 		return "H2_A78_VERIFY_RX_ID_LIST_AND_SEND_ACK";
319 	case H2_A9_SEND_STREAM_MANAGEMENT:
320 		return "H2_A9_SEND_STREAM_MANAGEMENT";
321 	case H2_A9_VALIDATE_STREAM_READY:
322 		return "H2_A9_VALIDATE_STREAM_READY";
323 	case D2_A0_DETERMINE_RX_HDCP_CAPABLE:
324 		return "D2_A0_DETERMINE_RX_HDCP_CAPABLE";
325 	case D2_A1_SEND_AKE_INIT:
326 		return "D2_A1_SEND_AKE_INIT";
327 	case D2_A1_VALIDATE_AKE_CERT:
328 		return "D2_A1_VALIDATE_AKE_CERT";
329 	case D2_A1_SEND_NO_STORED_KM:
330 		return "D2_A1_SEND_NO_STORED_KM";
331 	case D2_A1_READ_H_PRIME:
332 		return "D2_A1_READ_H_PRIME";
333 	case D2_A1_READ_PAIRING_INFO_AND_VALIDATE_H_PRIME:
334 		return "D2_A1_READ_PAIRING_INFO_AND_VALIDATE_H_PRIME";
335 	case D2_A1_SEND_STORED_KM:
336 		return "D2_A1_SEND_STORED_KM";
337 	case D2_A1_VALIDATE_H_PRIME:
338 		return "D2_A1_VALIDATE_H_PRIME";
339 	case D2_A2_LOCALITY_CHECK:
340 		return "D2_A2_LOCALITY_CHECK";
341 	case D2_A34_EXCHANGE_KS_AND_TEST_FOR_REPEATER:
342 		return "D2_A34_EXCHANGE_KS_AND_TEST_FOR_REPEATER";
343 	case D2_SEND_CONTENT_STREAM_TYPE:
344 		return "D2_SEND_CONTENT_STREAM_TYPE";
345 	case D2_ENABLE_ENCRYPTION:
346 		return "D2_ENABLE_ENCRYPTION";
347 	case D2_A5_AUTHENTICATED:
348 		return "D2_A5_AUTHENTICATED";
349 	case D2_A6_WAIT_FOR_RX_ID_LIST:
350 		return "D2_A6_WAIT_FOR_RX_ID_LIST";
351 	case D2_A78_VERIFY_RX_ID_LIST_AND_SEND_ACK:
352 		return "D2_A78_VERIFY_RX_ID_LIST_AND_SEND_ACK";
353 	case D2_A9_SEND_STREAM_MANAGEMENT:
354 		return "D2_A9_SEND_STREAM_MANAGEMENT";
355 	case D2_A9_VALIDATE_STREAM_READY:
356 		return "D2_A9_VALIDATE_STREAM_READY";
357 	default:
358 		return "UNKNOWN_STATE_ID";
359 	}
360 }
361 
362