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 #define NOCT_BAR0 0x10
35
36 #define NOCT_BRDG_ENDIAN 0x0000
37 #define NOCT_BRDG_TIMER_PRESET 0x0004
38 #define NOCT_BRDG_STAT 0x0008
39 #define NOCT_BRDG_CTL 0x000c
40 #define NOCT_BRDG_TIMR 0x0010
41 #define NOCT_BRDG_TEST 0x0014
42 #define NOCT_BRDG_RPMR 0x0018
43 #define NOCT_PKH_TEST0 0x4000
44 #define NOCT_PKH_TEST1 0x4004
45 #define NOCT_PKH_Q_LEN 0x4008
46 #define NOCT_PKH_Q_PTR 0x400c
47 #define NOCT_PKH_Q_BASE_HI 0x4010
48 #define NOCT_PKH_Q_BASE_LO 0x4014
49 #define NOCT_PKH_IER 0x4018
50 #define NOCT_PKH_CSR 0x401c
51 #define NOCT_PKH_SKS_DATA 0x4020
52 #define NOCT_PKH_SKS_CTRL 0x4024
53 #define NOCT_PKH_CMDB_0 0x40e0
54 #define NOCT_PKH_CMDB_1 0x40e4
55 #define NOCT_PKH_CMDB_2 0x40e8
56 #define NOCT_PKH_CMDB_3 0x40ec
57 #define NOCT_PKH_CMDB_4 0x40f0
58 #define NOCT_PKH_CMDB_5 0x40f4
59 #define NOCT_PKH_CMDB_6 0x40f8
60 #define NOCT_PKH_CMDB_7 0x40fc
61 #define NOCT_PKH_BNCACHE_START 0x5000
62 #define NOCT_PKH_BNCACHE_END 0x5fff
63 #define NOCT_EA_TEST_1 0x8000
64 #define NOCT_EA_TEST_0 0x8004
65 #define NOCT_EA_Q_LEN 0x8008
66 #define NOCT_EA_Q_PTR 0x800c
67 #define NOCT_EA_Q_BASE_HI 0x8010
68 #define NOCT_EA_Q_BASE_LO 0x8014
69 #define NOCT_EA_IER 0x8018
70 #define NOCT_EA_CSR 0x801c
71 #define NOCT_EA_CTX_DAT_1 0x8020
72 #define NOCT_EA_CTX_DAT_0 0x8024
73 #define NOCT_EA_CTX_ADDR 0x8028
74 #define NOCT_EA_SDRAM_CFG 0x802c
75 #define NOCT_RNG_TOD 0xc000
76 #define NOCT_RNG_TOD_SCALE 0xc008
77 #define NOCT_RNG_TOD_READ 0xc010
78 #define NOCT_RNG_X917_KEY1 0xc018
79 #define NOCT_RNG_X917_KEY2 0xc020
80 #define NOCT_RNG_HOSTSEED 0xc028
81 #define NOCT_RNG_SAMPBIAS 0xc030
82 #define NOCT_RNG_EXTCLK_SCALE 0xc038
83 #define NOCT_RNG_WRITE 0xc040
84 #define NOCT_RNG_SEEDSAMP 0xc048
85 #define NOCT_RNG_LFSRDIAG 0xc050
86 #define NOCT_RNG_LFSRHIST_1 0xc058
87 #define NOCT_RNG_LFSRHIST_2 0xc060
88 #define NOCT_RNG_LFSRHIST_3 0xc068
89 #define NOCT_RNG_LFSRHIST_4 0xc070
90 #define NOCT_RNG_CTL 0xc078
91 #define NOCT_RNG_TEST_1 0xd000
92 #define NOCT_RNG_TEST_0 0xd004
93 #define NOCT_RNG_Q_LEN 0xd008
94 #define NOCT_RNG_Q_PTR 0xd00c
95 #define NOCT_RNG_Q_BASE_HI 0xd010
96 #define NOCT_RNG_Q_BASE_LO 0xd014
97 #define NOCT_RNG_CSR 0xd018
98
99
100 #define BRDGSTS_PKP_INT 0x80000000
101 #define BRDGSTS_CCH_INT 0x40000000
102 #define BRDGSTS_RNG_INT 0x20000000
103 #define BRDGSTS_BRG_INT 0x10000000
104 #define BRDGSTS_TMR_INT 0x08000000
105 #define BRDGSTS_CCH_ENA 0x01000000
106 #define BRDGSTS_CCH_BSY 0x00800000
107 #define BRDGSTS_CCH_ERR 0x00400000
108 #define BRDGSTS_CCH_RD_PEND 0x00200000
109 #define BRDGSTS_CCH_WR_PEND 0x00100000
110 #define BRDGSTS_PKH_ENA 0x00080000
111 #define BRDGSTS_PKH_BSY 0x00040000
112 #define BRDGSTS_PKH_ERR 0x00020000
113 #define BRDGSTS_PKH_SKS 0x00010000
114 #define BRDGSTS_HRESP_ERR 0x00002000
115 #define BRDGSTS_HBURST_ERR 0x00001000
116 #define BRDGSTS_HSIZE_ERR 0x00000800
117 #define BRDGSTS_PCIACC_ERR 0x00000400
118 #define BRDGSTS_RSVMEM_ERR 0x00000200
119 #define BRDGSTS_TRCVFIFO_PERR 0x00000100
120 #define BRDGSTS_PCIPERR 0x00000080
121
122
123 #define BRDGCTL_PKIRQ_ENA 0x80000000
124 #define BRDGCTL_EAIRQ_ENA 0x40000000
125 #define BRDGCTL_RNIRQ_ENA 0x20000000
126 #define BRDGCTL_BIRQ_ENA 0x10000000
127 #define BRDGCTL_TIRQ_ENA 0x08000000
128 #define BRDGCTL_TIMER_ENA 0x00000001
129
130
131 #define PKHQLEN_MASK 0x0000000f
132
133
134 #define PKHQPTR_READ_M 0x7fff0000
135 #define PKHQPTR_READ_S 16
136 #define PKHQPTR_WRITE_M 0x00007fff
137 #define PKHQPTR_WRITE_S 0
138
139
140 #define PKHIER_CMDSI 0x00020000
141 #define PKHIER_SKSWR 0x00010000
142 #define PKHIER_SKSOFF 0x00008000
143 #define PKHIER_PKHLEN 0x00004000
144 #define PKHIER_PKHOPCODE 0x00002000
145 #define PKHIER_BADQBASE 0x00001000
146 #define PKHIER_LOADERR 0x00000800
147 #define PKHIER_STOREERR 0x00000400
148 #define PKHIER_CMDERR 0x00000200
149 #define PKHIER_ILL 0x00000100
150 #define PKHIER_PKERESV 0x00000080
151 #define PKHIER_PKEWDT 0x00000040
152 #define PKHIER_PKENOTPRIME 0x00000020
153 #define PKHIER_PKE_B 0x00000010
154 #define PKHIER_PKE_A 0x00000008
155 #define PKHIER_PKE_M 0x00000004
156 #define PKHIER_PKE_R 0x00000002
157 #define PKHIER_PKEOPCODE 0x00000001
158
159
160 #define PKHCSR_PKH_ENA 0x80000000
161 #define PKHCSR_PKH_BUSY 0x40000000
162 #define PKHCSR_PKE_GO 0x20000000
163 #define PKHCSR_PKE_BUSY 0x10000000
164 #define PKHCSR_LINENO 0x0f000000
165 #define PKHCSR_CMDSI 0x00020000
166 #define PKHCSR_SKSWR 0x00010000
167 #define PKHCSR_SKSOFF 0x00008000
168 #define PKHCSR_PKHLEN 0x00004000
169 #define PKHCSR_PKHOPCODE 0x00002000
170 #define PKHCSR_BADQBASE 0x00001000
171 #define PKHCSR_LOADERR 0x00000800
172 #define PKHCSR_STOREERR 0x00000400
173 #define PKHCSR_CMDERR 0x00000200
174 #define PKHCSR_ILL 0x00000100
175 #define PKHCSR_PKERESV 0x00000080
176 #define PKHCSR_PKEWDT 0x00000040
177 #define PKHCSR_PKENOTPRIME 0x00000020
178 #define PKHCSR_PKE_B 0x00000010
179 #define PKHCSR_PKE_A 0x00000008
180 #define PKHCSR_PKE_M 0x00000004
181 #define PKHCSR_PKE_R 0x00000002
182 #define PKHCSR_PKEOPCODE 0x00000001
183
184
185 #define PKHSKS_GO 0x80000000
186 #define PKHSKS_PROMERR 0x40000000
187 #define PKHSKS_ACCERR 0x20000000
188 #define PKHSKS_LOCMASK 0x00003000
189 #define PKHSKS_LOC_FROMPROM 0x00002000
190 #define PKHSKS_LOC_CACHEONLY 0x00001000
191 #define PKHSKS_ADDR 0x00000fff
192
193
194
195
196
197 #define PKH_OP_CODE_MASK 0xf0000000
198 #define PKH_OP_CODE_MOD 0x00000000
199 #define PKH_OP_CODE_RMOD 0x10000000
200 #define PKH_OP_CODE_ADD 0x20000000
201 #define PKH_OP_CODE_SUB 0x30000000
202 #define PKH_OP_CODE_ADDINV 0x40000000
203 #define PKH_OP_CODE_MUL 0x50000000
204 #define PKH_OP_CODE_MULINV 0x60000000
205 #define PKH_OP_CODE_EXP 0x70000000
206 #define PKH_OP_CODE_LOAD 0x80000000
207 #define PKH_OP_CODE_STORE 0x90000000
208 #define PKH_OP_CODE_RSAPRIV 0xa0000000
209 #define PKH_OP_CODE_DSASIGN 0xb0000000
210 #define PKH_OP_CODE_NOP 0xf0000000
211 #define PKH_OP_SI 0x08000000
212
213
214 struct noct_pkh_cmd_arith {
215 volatile u_int32_t op;
216 volatile u_int32_t r;
217 volatile u_int32_t m;
218 volatile u_int32_t a;
219 volatile u_int32_t b;
220 volatile u_int32_t c;
221 volatile u_int32_t unused[2];
222 };
223
224
225 struct noct_pkh_cmd_cache {
226 volatile u_int32_t op;
227 volatile u_int32_t r;
228 volatile u_int32_t addrhi;
229 volatile u_int32_t addrlo;
230 volatile u_int32_t len;
231 volatile u_int32_t unused[3];
232 };
233
234
235 struct noct_pkh_cmd_rsapriv {
236 volatile u_int32_t op;
237 volatile u_int32_t par;
238 volatile u_int32_t unused[6];
239 };
240
241
242 struct noct_pkh_cmd_dsasign {
243 volatile u_int32_t op;
244 volatile u_int32_t par;
245 volatile u_int32_t unused[6];
246 };
247
248
249 struct noct_pkh_cmd_nop {
250 volatile u_int32_t op;
251 volatile u_int32_t unused[7];
252 };
253
254
255 union noct_pkh_cmd {
256 struct noct_pkh_cmd_arith arith;
257 struct noct_pkh_cmd_cache cache;
258 struct noct_pkh_cmd_rsapriv rsapriv;
259 struct noct_pkh_cmd_dsasign dsasign;
260 struct noct_pkh_cmd_nop nop;
261 };
262
263
264 #define EAQLEN_MASK 0x0000000f
265
266
267 #define EAQPTR_READ_M 0x7fff0000
268 #define EAQPTR_READ_S 16
269 #define EAQPTR_WRITE_M 0x00007fff
270 #define EAQPTR_WRITE_S 0
271
272
273 #define EAIER_QALIGN 0x00008000
274 #define EAIER_CMDCMPL 0x00004000
275 #define EAIER_OPERR 0x00002000
276 #define EAIER_CMDREAD 0x00001000
277 #define EAIER_CMDWRITE 0x00000800
278 #define EAIER_DATAREAD 0x00000400
279 #define EAIER_DATAWRITE 0x00000200
280 #define EAIER_INTRNLLEN 0x00000100
281 #define EAIER_EXTRNLLEN 0x00000080
282 #define EAIER_DESBLOCK 0x00000040
283 #define EAIER_DESKEY 0x00000020
284 #define EAIER_ILL 0x00000001
285
286
287 #define EACSR_ENABLE 0x80000000
288 #define EACSR_BUSY 0x40000000
289 #define EACSR_QALIGN 0x00008000
290 #define EACSR_CMDCMPL 0x00004000
291 #define EACSR_OPERR 0x00002000
292 #define EACSR_CMDREAD 0x00001000
293 #define EACSR_CMDWRITE 0x00000800
294 #define EACSR_DATAREAD 0x00000400
295 #define EACSR_DATAWRITE 0x00000200
296 #define EACSR_INTRNLLEN 0x00000100
297 #define EACSR_EXTRNLLEN 0x00000080
298 #define EACSR_DESBLOCK 0x00000040
299 #define EACSR_DESKEY 0x00000020
300 #define EACSR_ILL 0x00000001
301
302
303 #define EACTXADDR_READPEND 0x80000000
304 #define EACTXADDR_WRITEPEND 0x40000000
305 #define EACTXADDR_MASK 0x00ffffff
306
307
308 #define EASDRC_8KREFRESH 0x00000080
309 #define EASDRC_FREQ 0x0000003f
310
311
312 #define RNGCTL_RNG_ENA 0x80000000
313 #define RNGCTL_TOD_ENA 0x40000000
314 #define RNGCTL_EXTCLK_ENA 0x20000000
315 #define RNGCTL_DIAG 0x10000000
316 #define RNGCTL_BUFSRC_M 0x0c000000
317 #define RNGCTL_BUFSRC_X917 0x00000000
318 #define RNGCTL_BUFSRC_SEED 0x04000000
319 #define RNGCTL_BUFSRC_HOST 0x08000000
320 #define RNGCTL_SEEDSRC_M 0x03000000
321 #define RNGCTL_SEEDSRC_INT 0x00000000
322 #define RNGCTL_SEEDSRC_EXT 0x01000000
323 #define RNGCTL_SEEDSRC_HOST 0x02000000
324 #define RNGCTL_SEED_ERR 0x00008000
325 #define RNGCTL_X917_ERR 0x00004000
326 #define RNGCTL_KEY1PAR_ERR 0x00002000
327 #define RNGCTL_KEY2PAR_ERR 0x00001000
328 #define RNGCTL_HOSTSEEDVALID 0x00000400
329 #define RNGCTL_BUF_RDY 0x00000200
330 #define RNGCTL_ITERCNT 0x000000ff
331
332
333 #define RNGCSR_XFER_ENABLE 0x80000000
334 #define RNGCSR_XFER_BUSY 0x40000000
335 #define RNGCSR_ERR_KEY 0x00800000
336 #define RNGCSR_ERR_BUS 0x00400000
337 #define RNGCSR_ERR_DUP 0x00200000
338 #define RNGCSR_ERR_ACCESS 0x00100000
339 #define RNGCSR_INT_KEY 0x00080000
340 #define RNGCSR_INT_BUS 0x00040000
341 #define RNGCSR_INT_DUP 0x00020000
342 #define RNGCSR_INT_ACCESS 0x00010000
343
344
345 #define RNGQPTR_READ_M 0x00007fff
346 #define RNGQPTR_READ_S 0
347 #define RNGQPTR_WRITE_M 0x7fff0000
348 #define RNGQPTR_WRITE_S 16
349
350 #define EA_CMD_WORDS 32
351 struct noct_ea_cmd {
352 volatile u_int32_t buf[EA_CMD_WORDS];
353 };
354
355
356 #define EA_0_CP 0x80000000
357 #define EA_0_SI 0x40000000
358 #define EA_0_CTXIDX 0x0003ffff
359
360 #define EA_1_OPCODE 0xff000000
361 #define EA_1_ITERCNT 0x000f0000
362 #define EA_1_DATALEN 0x0000ffff
363
364 #define EA_OP_NOP 0x00000000
365 #define EA_OP_WCTX 0x01000000
366 #define EA_OP_RCTX 0x02000000
367 #define EA_OP_3DESCBCE 0x03000000
368 #define EA_OP_3DESCBCD 0x04000000
369 #define EA_OP_ARC4 0x05000000
370 #define EA_OP_MD5 0x10000000
371 #define EA_OP_MD5_APP 0x11000000
372 #define EA_OP_MD5_CMDIV 0x12000000
373 #define EA_OP_MD5_LSTIV 0x13000000
374 #define EA_OP_MD5_LSTCMD 0x14000000
375 #define EA_OP_MD5_LSTLST 0x15000000
376 #define EA_OP_MD5_KEYMAT 0x16000000
377 #define EA_OP_MD5_SKEYID 0x17000000
378 #define EA_OP_MD5_IKEKEY 0x18000000
379 #define EA_OP_SHA1 0x20000000
380 #define EA_OP_SHA1_APP 0x21000000
381 #define EA_OP_SHA1_CMDIV 0x22000000
382 #define EA_OP_SHA1_LSTIV 0x23000000
383 #define EA_OP_SHA1_LSTCMD 0x24000000
384 #define EA_OP_SHA1_LSTLST 0x25000000
385 #define EA_OP_SHA1_KEYMAT 0x26000000
386 #define EA_OP_SHA1_SKEYID 0x27000000
387 #define EA_OP_SHA1_IKEKEY 0x28000000
388 #define EA_OP_MASTER_HASH 0x30000000
389 #define EA_OP_NULL_NULL 0x80000000
390 #define EA_OP_SSL3_ARC4_MD5_E 0x81000000
391 #define EA_OP_SSL3_DES_MD5_E 0x82000000
392 #define EA_OP_SSL3_ARC4_SHA1_E 0x83000000
393 #define EA_OP_SSL3_DES_SHA1_E 0x84000000
394 #define EA_OP_SSL3_ARC4_MD5_D 0x91000000
395 #define EA_OP_SSL3_DES_MD5_D 0x92000000
396 #define EA_OP_SSL3_ARC4_SHA1_D 0x93000000
397 #define EA_OP_SSL3_DES_SHA1_D 0x94000000
398 #define EA_OP_TLS1_ARC4_MD5_E 0xa1000000
399 #define EA_OP_TLS1_DES_MD5_E 0xa2000000
400 #define EA_OP_TLS1_ARC4_SHA1_E 0xa3000000
401 #define EA_OP_TLS1_DES_SHA1_E 0xa4000000
402 #define EA_OP_TLS1_ARC4_MD5_D 0xb1000000
403 #define EA_OP_TLS1_DES_MD5_D 0xb2000000
404 #define EA_OP_TLS1_ARC4_SHA1_D 0xb3000000
405 #define EA_OP_TLS1_DES_SHA1_D 0xb4000000
406 #define EA_OP_IPS_DES_MD5_E 0xc1000000
407 #define EA_OP_IPS_DES_SHA1_E 0xc2000000
408 #define EA_OP_IPS_DES_MD5_D 0xd1000000
409 #define EA_OP_IPS_DES_SHA1_D 0xd2000000