summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/i915/display/intel_hdcp_regs.h
blob: a568a457e53268011a6c932efc7f3dc1b7cb9fb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
/* SPDX-License-Identifier: MIT */
/*
 * Copyright © 2022 Intel Corporation
 */

#ifndef __INTEL_HDCP_REGS_H__
#define __INTEL_HDCP_REGS_H__

#include "intel_display_reg_defs.h"

#define TRANS_HDCP(__i915)		(DISPLAY_VER(__i915) >= 12)

/* HDCP Key Registers */
#define HDCP_KEY_CONF			_MMIO(0x66c00)
#define  HDCP_AKSV_SEND_TRIGGER		REG_BIT(31)
#define  HDCP_CLEAR_KEYS_TRIGGER	REG_BIT(30)
#define  HDCP_KEY_LOAD_TRIGGER		REG_BIT(8)
#define HDCP_KEY_STATUS			_MMIO(0x66c04)
#define  HDCP_FUSE_IN_PROGRESS		REG_BIT(7)
#define  HDCP_FUSE_ERROR		REG_BIT(6)
#define  HDCP_FUSE_DONE			REG_BIT(5)
#define  HDCP_KEY_LOAD_STATUS		REG_BIT(1)
#define  HDCP_KEY_LOAD_DONE		REG_BIT(0)
#define HDCP_AKSV_LO			_MMIO(0x66c10)
#define HDCP_AKSV_HI			_MMIO(0x66c14)

/* HDCP Repeater Registers */
#define HDCP_REP_CTL			_MMIO(0x66d00)
#define  HDCP_TRANSA_REP_PRESENT	REG_BIT(31)
#define  HDCP_TRANSB_REP_PRESENT	REG_BIT(30)
#define  HDCP_TRANSC_REP_PRESENT	REG_BIT(29)
#define  HDCP_TRANSD_REP_PRESENT	REG_BIT(28)
#define  HDCP_DDIB_REP_PRESENT		REG_BIT(30)
#define  HDCP_DDIA_REP_PRESENT		REG_BIT(29)
#define  HDCP_DDIC_REP_PRESENT		REG_BIT(28)
#define  HDCP_DDID_REP_PRESENT		REG_BIT(27)
#define  HDCP_DDIF_REP_PRESENT		REG_BIT(26)
#define  HDCP_DDIE_REP_PRESENT		REG_BIT(25)
#define  HDCP_TRANSA_SHA1_M0		(1 << 20)
#define  HDCP_TRANSB_SHA1_M0		(2 << 20)
#define  HDCP_TRANSC_SHA1_M0		(3 << 20)
#define  HDCP_TRANSD_SHA1_M0		(4 << 20)
#define  HDCP_DDIB_SHA1_M0		(1 << 20)
#define  HDCP_DDIA_SHA1_M0		(2 << 20)
#define  HDCP_DDIC_SHA1_M0		(3 << 20)
#define  HDCP_DDID_SHA1_M0		(4 << 20)
#define  HDCP_DDIF_SHA1_M0		(5 << 20)
#define  HDCP_DDIE_SHA1_M0		(6 << 20) /* Bspec says 5? */
#define  HDCP_SHA1_BUSY			REG_BIT(16)
#define  HDCP_SHA1_READY		REG_BIT(17)
#define  HDCP_SHA1_COMPLETE		REG_BIT(18)
#define  HDCP_SHA1_V_MATCH		REG_BIT(19)
#define  HDCP_SHA1_TEXT_32		(1 << 1)
#define  HDCP_SHA1_COMPLETE_HASH	(2 << 1)
#define  HDCP_SHA1_TEXT_24		(4 << 1)
#define  HDCP_SHA1_TEXT_16		(5 << 1)
#define  HDCP_SHA1_TEXT_8		(6 << 1)
#define  HDCP_SHA1_TEXT_0		(7 << 1)
#define HDCP_SHA_V_PRIME_H0		_MMIO(0x66d04)
#define HDCP_SHA_V_PRIME_H1		_MMIO(0x66d08)
#define HDCP_SHA_V_PRIME_H2		_MMIO(0x66d0C)
#define HDCP_SHA_V_PRIME_H3		_MMIO(0x66d10)
#define HDCP_SHA_V_PRIME_H4		_MMIO(0x66d14)
#define HDCP_SHA_V_PRIME(h)		_MMIO((0x66d04 + (h) * 4))
#define HDCP_SHA_TEXT			_MMIO(0x66d18)

/* HDCP Auth Registers */
#define _PORTA_HDCP_AUTHENC		0x66800
#define _PORTB_HDCP_AUTHENC		0x66500
#define _PORTC_HDCP_AUTHENC		0x66600
#define _PORTD_HDCP_AUTHENC		0x66700
#define _PORTE_HDCP_AUTHENC		0x66A00
#define _PORTF_HDCP_AUTHENC		0x66900
#define _PORT_HDCP_AUTHENC(port, x)	_MMIO(_PICK(port, \
					  _PORTA_HDCP_AUTHENC, \
					  _PORTB_HDCP_AUTHENC, \
					  _PORTC_HDCP_AUTHENC, \
					  _PORTD_HDCP_AUTHENC, \
					  _PORTE_HDCP_AUTHENC, \
					  _PORTF_HDCP_AUTHENC) + (x))
#define PORT_HDCP_CONF(port)		_PORT_HDCP_AUTHENC(port, 0x0)
#define _TRANSA_HDCP_CONF		0x66400
#define _TRANSB_HDCP_CONF		0x66500
#define TRANS_HDCP_CONF(trans)		_MMIO_TRANS(trans, _TRANSA_HDCP_CONF, \
						    _TRANSB_HDCP_CONF)
#define HDCP_CONF(dev_priv, trans, port) \
					(TRANS_HDCP(dev_priv) ? \
					 TRANS_HDCP_CONF(trans) : \
					 PORT_HDCP_CONF(port))

#define  HDCP_CONF_CAPTURE_AN		REG_BIT(0)
#define  HDCP_CONF_AUTH_AND_ENC		(REG_BIT(1) | REG_BIT(0))
#define PORT_HDCP_ANINIT(port)		_PORT_HDCP_AUTHENC(port, 0x4)
#define _TRANSA_HDCP_ANINIT		0x66404
#define _TRANSB_HDCP_ANINIT		0x66504
#define TRANS_HDCP_ANINIT(trans)	_MMIO_TRANS(trans, \
						    _TRANSA_HDCP_ANINIT, \
						    _TRANSB_HDCP_ANINIT)
#define HDCP_ANINIT(dev_priv, trans, port) \
					(TRANS_HDCP(dev_priv) ? \
					 TRANS_HDCP_ANINIT(trans) : \
					 PORT_HDCP_ANINIT(port))

#define PORT_HDCP_ANLO(port)		_PORT_HDCP_AUTHENC(port, 0x8)
#define _TRANSA_HDCP_ANLO		0x66408
#define _TRANSB_HDCP_ANLO		0x66508
#define TRANS_HDCP_ANLO(trans)		_MMIO_TRANS(trans, _TRANSA_HDCP_ANLO, \
						    _TRANSB_HDCP_ANLO)
#define HDCP_ANLO(dev_priv, trans, port) \
					(TRANS_HDCP(dev_priv) ? \
					 TRANS_HDCP_ANLO(trans) : \
					 PORT_HDCP_ANLO(port))

#define PORT_HDCP_ANHI(port)		_PORT_HDCP_AUTHENC(port, 0xC)
#define _TRANSA_HDCP_ANHI		0x6640C
#define _TRANSB_HDCP_ANHI		0x6650C
#define TRANS_HDCP_ANHI(trans)		_MMIO_TRANS(trans, _TRANSA_HDCP_ANHI, \
						    _TRANSB_HDCP_ANHI)
#define HDCP_ANHI(dev_priv, trans, port) \
					(TRANS_HDCP(dev_priv) ? \
					 TRANS_HDCP_ANHI(trans) : \
					 PORT_HDCP_ANHI(port))

#define PORT_HDCP_BKSVLO(port)		_PORT_HDCP_AUTHENC(port, 0x10)
#define _TRANSA_HDCP_BKSVLO		0x66410
#define _TRANSB_HDCP_BKSVLO		0x66510
#define TRANS_HDCP_BKSVLO(trans)	_MMIO_TRANS(trans, \
						    _TRANSA_HDCP_BKSVLO, \
						    _TRANSB_HDCP_BKSVLO)
#define HDCP_BKSVLO(dev_priv, trans, port) \
					(TRANS_HDCP(dev_priv) ? \
					 TRANS_HDCP_BKSVLO(trans) : \
					 PORT_HDCP_BKSVLO(port))

#define PORT_HDCP_BKSVHI(port)		_PORT_HDCP_AUTHENC(port, 0x14)
#define _TRANSA_HDCP_BKSVHI		0x66414
#define _TRANSB_HDCP_BKSVHI		0x66514
#define TRANS_HDCP_BKSVHI(trans)	_MMIO_TRANS(trans, \
						    _TRANSA_HDCP_BKSVHI, \
						    _TRANSB_HDCP_BKSVHI)
#define HDCP_BKSVHI(dev_priv, trans, port) \
					(TRANS_HDCP(dev_priv) ? \
					 TRANS_HDCP_BKSVHI(trans) : \
					 PORT_HDCP_BKSVHI(port))

#define PORT_HDCP_RPRIME(port)		_PORT_HDCP_AUTHENC(port, 0x18)
#define _TRANSA_HDCP_RPRIME		0x66418
#define _TRANSB_HDCP_RPRIME		0x66518
#define TRANS_HDCP_RPRIME(trans)	_MMIO_TRANS(trans, \
						    _TRANSA_HDCP_RPRIME, \
						    _TRANSB_HDCP_RPRIME)
#define HDCP_RPRIME(dev_priv, trans, port) \
					(TRANS_HDCP(dev_priv) ? \
					 TRANS_HDCP_RPRIME(trans) : \
					 PORT_HDCP_RPRIME(port))

#define PORT_HDCP_STATUS(port)		_PORT_HDCP_AUTHENC(port, 0x1C)
#define _TRANSA_HDCP_STATUS		0x6641C
#define _TRANSB_HDCP_STATUS		0x6651C
#define TRANS_HDCP_STATUS(trans)	_MMIO_TRANS(trans, \
						    _TRANSA_HDCP_STATUS, \
						    _TRANSB_HDCP_STATUS)
#define HDCP_STATUS(dev_priv, trans, port) \
					(TRANS_HDCP(dev_priv) ? \
					 TRANS_HDCP_STATUS(trans) : \
					 PORT_HDCP_STATUS(port))

#define  HDCP_STATUS_STREAM_A_ENC	REG_BIT(31)
#define  HDCP_STATUS_STREAM_B_ENC	REG_BIT(30)
#define  HDCP_STATUS_STREAM_C_ENC	REG_BIT(29)
#define  HDCP_STATUS_STREAM_D_ENC	REG_BIT(28)
#define  HDCP_STATUS_AUTH		REG_BIT(21)
#define  HDCP_STATUS_ENC		REG_BIT(20)
#define  HDCP_STATUS_RI_MATCH		REG_BIT(19)
#define  HDCP_STATUS_R0_READY		REG_BIT(18)
#define  HDCP_STATUS_AN_READY		REG_BIT(17)
#define  HDCP_STATUS_CIPHER		REG_BIT(16)
#define  HDCP_STATUS_FRAME_CNT(x)	(((x) >> 8) & 0xff)

/* HDCP2.2 Registers */
#define _PORTA_HDCP2_BASE		0x66800
#define _PORTB_HDCP2_BASE		0x66500
#define _PORTC_HDCP2_BASE		0x66600
#define _PORTD_HDCP2_BASE		0x66700
#define _PORTE_HDCP2_BASE		0x66A00
#define _PORTF_HDCP2_BASE		0x66900
#define _PORT_HDCP2_BASE(port, x)	_MMIO(_PICK((port), \
					  _PORTA_HDCP2_BASE, \
					  _PORTB_HDCP2_BASE, \
					  _PORTC_HDCP2_BASE, \
					  _PORTD_HDCP2_BASE, \
					  _PORTE_HDCP2_BASE, \
					  _PORTF_HDCP2_BASE) + (x))

#define PORT_HDCP2_AUTH(port)		_PORT_HDCP2_BASE(port, 0x98)
#define _TRANSA_HDCP2_AUTH		0x66498
#define _TRANSB_HDCP2_AUTH		0x66598
#define TRANS_HDCP2_AUTH(trans)		_MMIO_TRANS(trans, _TRANSA_HDCP2_AUTH, \
						    _TRANSB_HDCP2_AUTH)
#define   AUTH_LINK_AUTHENTICATED	REG_BIT(31)
#define   AUTH_LINK_TYPE		REG_BIT(30)
#define   AUTH_FORCE_CLR_INPUTCTR	REG_BIT(19)
#define   AUTH_CLR_KEYS			REG_BIT(18)
#define HDCP2_AUTH(dev_priv, trans, port) \
					(TRANS_HDCP(dev_priv) ? \
					 TRANS_HDCP2_AUTH(trans) : \
					 PORT_HDCP2_AUTH(port))

#define PORT_HDCP2_CTL(port)		_PORT_HDCP2_BASE(port, 0xB0)
#define _TRANSA_HDCP2_CTL		0x664B0
#define _TRANSB_HDCP2_CTL		0x665B0
#define TRANS_HDCP2_CTL(trans)		_MMIO_TRANS(trans, _TRANSA_HDCP2_CTL, \
						    _TRANSB_HDCP2_CTL)
#define   CTL_LINK_ENCRYPTION_REQ	REG_BIT(31)
#define HDCP2_CTL(dev_priv, trans, port) \
					(TRANS_HDCP(dev_priv) ? \
					 TRANS_HDCP2_CTL(trans) : \
					 PORT_HDCP2_CTL(port))

#define PORT_HDCP2_STATUS(port)		_PORT_HDCP2_BASE(port, 0xB4)
#define _TRANSA_HDCP2_STATUS		0x664B4
#define _TRANSB_HDCP2_STATUS		0x665B4
#define TRANS_HDCP2_STATUS(trans)	_MMIO_TRANS(trans, \
						    _TRANSA_HDCP2_STATUS, \
						    _TRANSB_HDCP2_STATUS)
#define   LINK_TYPE_STATUS		REG_BIT(22)
#define   LINK_AUTH_STATUS		REG_BIT(21)
#define   LINK_ENCRYPTION_STATUS	REG_BIT(20)
#define HDCP2_STATUS(dev_priv, trans, port) \
					(TRANS_HDCP(dev_priv) ? \
					 TRANS_HDCP2_STATUS(trans) : \
					 PORT_HDCP2_STATUS(port))

#define _PIPEA_HDCP2_STREAM_STATUS	0x668C0
#define _PIPEB_HDCP2_STREAM_STATUS	0x665C0
#define _PIPEC_HDCP2_STREAM_STATUS	0x666C0
#define _PIPED_HDCP2_STREAM_STATUS	0x667C0
#define PIPE_HDCP2_STREAM_STATUS(pipe)		_MMIO(_PICK((pipe), \
						      _PIPEA_HDCP2_STREAM_STATUS, \
						      _PIPEB_HDCP2_STREAM_STATUS, \
						      _PIPEC_HDCP2_STREAM_STATUS, \
						      _PIPED_HDCP2_STREAM_STATUS))

#define _TRANSA_HDCP2_STREAM_STATUS		0x664C0
#define _TRANSB_HDCP2_STREAM_STATUS		0x665C0
#define TRANS_HDCP2_STREAM_STATUS(trans)	_MMIO_TRANS(trans, \
						    _TRANSA_HDCP2_STREAM_STATUS, \
						    _TRANSB_HDCP2_STREAM_STATUS)
#define   STREAM_ENCRYPTION_STATUS	REG_BIT(31)
#define   STREAM_TYPE_STATUS		REG_BIT(30)
#define HDCP2_STREAM_STATUS(dev_priv, trans, port) \
					(TRANS_HDCP(dev_priv) ? \
					 TRANS_HDCP2_STREAM_STATUS(trans) : \
					 PIPE_HDCP2_STREAM_STATUS(pipe))

#define _PORTA_HDCP2_AUTH_STREAM		0x66F00
#define _PORTB_HDCP2_AUTH_STREAM		0x66F04
#define PORT_HDCP2_AUTH_STREAM(port)	_MMIO_PORT(port, \
						   _PORTA_HDCP2_AUTH_STREAM, \
						   _PORTB_HDCP2_AUTH_STREAM)
#define _TRANSA_HDCP2_AUTH_STREAM		0x66F00
#define _TRANSB_HDCP2_AUTH_STREAM		0x66F04
#define TRANS_HDCP2_AUTH_STREAM(trans)	_MMIO_TRANS(trans, \
						    _TRANSA_HDCP2_AUTH_STREAM, \
						    _TRANSB_HDCP2_AUTH_STREAM)
#define   AUTH_STREAM_TYPE		REG_BIT(31)
#define HDCP2_AUTH_STREAM(dev_priv, trans, port) \
					(TRANS_HDCP(dev_priv) ? \
					 TRANS_HDCP2_AUTH_STREAM(trans) : \
					 PORT_HDCP2_AUTH_STREAM(port))

#endif /* __INTEL_HDCP_REGS_H__ */