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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
|
/*-
* Copyright (c) 2001-2003
* Fraunhofer Institute for Open Communication Systems (FhG Fokus).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Author: Hartmut Brandt <harti@freebsd.org>
*
* $FreeBSD$
*
* Fore HE driver for NATM
*/
/* check configuration */
#if HE_CONFIG_VPI_BITS + HE_CONFIG_VCI_BITS > 12
#error "hatm: too many bits configured for VPI/VCI"
#endif
#define HE_MAX_VCCS (1 << (HE_CONFIG_VPI_BITS + HE_CONFIG_VCI_BITS))
#define HE_VPI_MASK ((1 << (HE_CONFIG_VPI_BITS))-1)
#define HE_VCI_MASK ((1 << (HE_CONFIG_VCI_BITS))-1)
#define HE_VPI(CID) (((CID) >> HE_CONFIG_VCI_BITS) & HE_VPI_MASK)
#define HE_VCI(CID) ((CID) & HE_VCI_MASK)
#define HE_CID(VPI,VCI) ((((VPI) & HE_VPI_MASK) << HE_CONFIG_VCI_BITS) | \
((VCI) & HE_VCI_MASK))
/* GEN_CNTL_0 register */
#define HE_PCIR_GEN_CNTL_0 0x40
#define HE_PCIM_CTL0_64BIT (1 << 0)
#define HE_PCIM_CTL0_IGNORE_TIMEOUT (1 << 1)
#define HE_PCIM_CTL0_INIT_ENB (1 << 2)
#define HE_PCIM_CTL0_MRM (1 << 4)
#define HE_PCIM_CTL0_MRL (1 << 5)
#define HE_PCIM_CTL0_BIGENDIAN (1 << 16)
#define HE_PCIM_CTL0_INT_PROC_ENB (1 << 25)
/*
* Memory registers
*/
#define HE_REGO_FLASH 0x00000
#define HE_REGO_RESET_CNTL 0x80000
#define HE_REGM_RESET_STATE (1 << 6)
#define HE_REGO_HOST_CNTL 0x80004
#define HE_REGM_HOST_BUS64 (1 << 27)
#define HE_REGM_HOST_DESC_RD64 (1 << 26)
#define HE_REGM_HOST_DATA_RD64 (1 << 25)
#define HE_REGM_HOST_DATA_WR64 (1 << 24)
#define HE_REGM_HOST_PROM_SEL (1 << 12)
#define HE_REGM_HOST_PROM_WREN (1 << 11)
#define HE_REGM_HOST_PROM_DATA_OUT (1 << 10)
#define HE_REGS_HOST_PROM_DATA_OUT 10
#define HE_REGM_HOST_PROM_DATA_IN (1 << 9)
#define HE_REGS_HOST_PROM_DATA_IN 9
#define HE_REGM_HOST_PROM_CLOCK (1 << 8)
#define HE_REGM_HOST_PROM_BITS (0x00001f00)
#define HE_REGM_HOST_QUICK_RD (1 << 7)
#define HE_REGM_HOST_QUICK_WR (1 << 6)
#define HE_REGM_HOST_OUTFF_ENB (1 << 5)
#define HE_REGM_HOST_CMDFF_ENB (1 << 4)
#define HE_REGO_LB_SWAP 0x80008
#define HE_REGM_LBSWAP_RNUM (0xf << 27)
#define HE_REGS_LBSWAP_RNUM 27
#define HE_REGM_LBSWAP_DATA_WR_SWAP (1 << 20)
#define HE_REGM_LBSWAP_DESC_RD_SWAP (1 << 19)
#define HE_REGM_LBSWAP_DATA_RD_SWAP (1 << 18)
#define HE_REGM_LBSWAP_INTR_SWAP (1 << 17)
#define HE_REGM_LBSWAP_DESC_WR_SWAP (1 << 16)
#define HE_REGM_LBSWAP_BIG_ENDIAN (1 << 14)
#define HE_REGM_LBSWAP_XFER_SIZE (1 << 7)
#define HE_REGO_LB_MEM_ADDR 0x8000C
#define HE_REGO_LB_MEM_DATA 0x80010
#define HE_REGO_LB_MEM_ACCESS 0x80014
#define HE_REGM_LB_MEM_HNDSHK (1 << 30)
#define HE_REGM_LB_MEM_READ 0x3
#define HE_REGM_LB_MEM_WRITE 0x7
#define HE_REGO_SDRAM_CNTL 0x80018
#define HE_REGM_SDRAM_64BIT (1 << 3)
#define HE_REGO_INT_FIFO 0x8001C
#define HE_REGM_INT_FIFO_CLRA (1 << 8)
#define HE_REGM_INT_FIFO_CLRB (1 << 9)
#define HE_REGM_INT_FIFO_CLRC (1 << 10)
#define HE_REGM_INT_FIFO_CLRD (1 << 11)
#define HE_REGO_ABORT_ADDR 0x80020
#define HE_REGO_IRQ0_BASE 0x80080
#define HE_REGO_IRQ_BASE(Q) (HE_REGO_IRQ0_BASE + (Q) * 0x10 + 0x00)
#define HE_REGM_IRQ_BASE_TAIL 0x3ff
#define HE_REGO_IRQ_HEAD(Q) (HE_REGO_IRQ0_BASE + (Q) * 0x10 + 0x04)
#define HE_REGS_IRQ_HEAD_SIZE 22
#define HE_REGS_IRQ_HEAD_THRESH 12
#define HE_REGS_IRQ_HEAD_HEAD 2
#define HE_REGO_IRQ_CNTL(Q) (HE_REGO_IRQ0_BASE + (Q) * 0x10 + 0x08)
#define HE_REGM_IRQ_A (0 << 2)
#define HE_REGM_IRQ_B (1 << 2)
#define HE_REGM_IRQ_C (2 << 2)
#define HE_REGM_IRQ_D (3 << 2)
#define HE_REGO_IRQ_DATA(Q) (HE_REGO_IRQ0_BASE + (Q) * 0x10 + 0x0C)
#define HE_REGO_GRP_1_0_MAP 0x800C0
#define HE_REGO_GRP_3_2_MAP 0x800C4
#define HE_REGO_GRP_5_4_MAP 0x800C8
#define HE_REGO_GRP_7_6_MAP 0x800CC
/*
* Receive buffer pools
*/
#define HE_REGO_G0_RBPS_S 0x80400
#define HE_REGO_G0_RBPS_T 0x80404
#define HE_REGO_G0_RBPS_QI 0x80408
#define HE_REGO_G0_RBPS_BL 0x8040C
#define HE_REGO_RBP_S(K,G) (HE_REGO_G0_RBPS_S + (K) * 0x10 + (G) * 0x20)
#define HE_REGO_RBP_T(K,G) (HE_REGO_G0_RBPS_T + (K) * 0x10 + (G) * 0x20)
#define HE_REGO_RBP_QI(K,G) (HE_REGO_G0_RBPS_QI + (K) * 0x10 + (G) * 0x20)
#define HE_REGO_RBP_BL(K,G) (HE_REGO_G0_RBPS_BL + (K) * 0x10 + (G) * 0x20)
#define HE_REGS_RBP_HEAD 3
#define HE_REGS_RBP_TAIL 3
#define HE_REGS_RBP_SIZE 14
#define HE_REGM_RBP_INTR_ENB (1 << 13)
#define HE_REGS_RBP_THRESH 0
/*
* Receive buffer return queues
*/
#define HE_REGO_G0_RBRQ_ST 0x80500
#define HE_REGO_G0_RBRQ_H 0x80504
#define HE_REGO_G0_RBRQ_Q 0x80508
#define HE_REGO_G0_RBRQ_I 0x8050C
#define HE_REGO_RBRQ_ST(G) (HE_REGO_G0_RBRQ_ST + (G) * 0x10)
#define HE_REGO_RBRQ_H(G) (HE_REGO_G0_RBRQ_H + (G) * 0x10)
#define HE_REGO_RBRQ_Q(G) (HE_REGO_G0_RBRQ_Q + (G) * 0x10)
#define HE_REGO_RBRQ_I(G) (HE_REGO_G0_RBRQ_I + (G) * 0x10)
#define HE_REGS_RBRQ_HEAD 3
#define HE_REGS_RBRQ_THRESH 13
#define HE_REGS_RBRQ_SIZE 0
#define HE_REGS_RBRQ_TIME 8
#define HE_REGS_RBRQ_COUNT 0
/*
* Intermediate queues
*/
#define HE_REGO_G0_INMQ_S 0x80580
#define HE_REGO_G0_INMQ_L 0x80584
#define HE_REGO_INMQ_S(G) (HE_REGO_G0_INMQ_S + (G) * 8)
#define HE_REGO_INMQ_L(G) (HE_REGO_G0_INMQ_L + (G) * 8)
#define HE_REGO_RHCONFIG 0x805C0
#define HE_REGM_RHCONFIG_PHYENB (1 << 10)
#define HE_REGS_RHCONFIG_OAM_GID 7
#define HE_REGS_RHCONFIG_PTMR_PRE 0
/*
* Transmit buffer return queues
*/
#define HE_REGO_TBRQ0_B_T 0x80600
#define HE_REGO_TBRQ0_H 0x80604
#define HE_REGO_TBRQ0_S 0x80608
#define HE_REGO_TBRQ0_THRESH 0x8060C
#define HE_REGO_TBRQ_B_T(G) (HE_REGO_TBRQ0_B_T + (G) * 0x10)
#define HE_REGO_TBRQ_H(G) (HE_REGO_TBRQ0_H + (G) * 0x10)
#define HE_REGO_TBRQ_S(G) (HE_REGO_TBRQ0_S + (G) * 0x10)
#define HE_REGO_TBRQ_THRESH(G) (HE_REGO_TBRQ0_THRESH + (G) * 0x10)
#define HE_REGS_TBRQ_HEAD 2
/*
* Transmit packet descriptor ready queue
*/
#define HE_REGO_TPDRQ_H 0x80680
#define HE_REGS_TPDRQ_H_H 3
/* #define HE_REGM_TPDRQ_H_H ((HE_CONFIG_TPDRQ_SIZE - 1) << 3) */
#define HE_REGO_TPDRQ_T 0x80684
#define HE_REGS_TPDRQ_T_T 3
/* #define HE_REGM_TPDRQ_T_T ((HE_CONFIG_TPDRQ_SIZE - 1) << 3) */
#define HE_REGO_TPDRQ_S 0x80688
#define HE_REGO_UBUFF_BA 0x8068C
#define HE_REGO_RLBF0_H 0x806C0
#define HE_REGO_RLBF0_T 0x806C4
#define HE_REGO_RLBF1_H 0x806C8
#define HE_REGO_RLBF1_T 0x806CC
#define HE_REGO_RLBF_H(N) (HE_REGO_RLBF0_H + (N) * 8)
#define HE_REGO_RLBF_T(N) (HE_REGO_RLBF0_T + (N) * 8)
#define HE_REGO_RLBC_H 0x806D0
#define HE_REGO_RLBC_T 0x806D4
#define HE_REGO_RLBC_H2 0x806D8
#define HE_REGO_TLBF_H 0x806E0
#define HE_REGO_TLBF_T 0x806E4
#define HE_REGO_RLBF0_C 0x806E8
#define HE_REGO_RLBF1_C 0x806EC
#define HE_REGO_RLBF_C(N) (HE_REGO_RLBF0_C + (N) * 4)
#define HE_REGO_RXTHRSH 0x806F0
#define HE_REGO_LITHRSH 0x806F4
#define HE_REGO_LBARB 0x80700
#define HE_REGS_LBARB_SLICE 28
#define HE_REGS_LBARB_RNUM 23
#define HE_REGS_LBARB_THPRI 21
#define HE_REGS_LBARB_RHPRI 19
#define HE_REGS_LBARB_TLPRI 17
#define HE_REGS_LBARB_RLPRI 15
#define HE_REGS_LBARB_BUS_MULT 8
#define HE_REGS_LBARB_NET_PREF 0
#define HE_REGO_SDRAMCON 0x80704
#define HE_REGM_SDRAMCON_BANK (1 << 14)
#define HE_REGM_SDRAMCON_WIDE (1 << 13)
#define HE_REGM_SDRAMCON_TWRWAIT (1 << 12)
#define HE_REGM_SDRAMCON_TRPWAIT (1 << 11)
#define HE_REGM_SDRAMCON_TRASWAIT (1 << 10)
#define HE_REGS_SDRAMCON_REF 0
#define HE_REGO_RCCSTAT 0x8070C
#define HE_REGM_RCCSTAT_PROG (1 << 0)
#define HE_REGO_TCMCONFIG 0x80740
#define HE_REGS_TCMCONFIG_BANK_WAIT 6
#define HE_REGS_TCMCONFIG_RW_WAIT 2
#define HE_REGS_TCMCONFIG_TYPE 0
#define HE_REGO_TSRB_BA 0x80744
#define HE_REGO_TSRC_BA 0x80748
#define HE_REGO_TMABR_BA 0x8074C
#define HE_REGO_TPD_BA 0x80750
#define HE_REGO_TSRD_BA 0x80758
#define HE_REGO_TXCONFIG 0x80760
#define HE_REGS_TXCONFIG_THRESH 22
#define HE_REGM_TXCONFIG_UTMODE (1 << 21)
#define HE_REGS_TXCONFIG_VCI_MASK 17
#define HE_REGS_TXCONFIG_LBFREE 0
#define HE_REGO_TXAAL5_PROTO 0x80764
#define HE_REGO_RCMCONFIG 0x80780
#define HE_REGS_RCMCONFIG_BANK_WAIT 6
#define HE_REGS_RCMCONFIG_RW_WAIT 2
#define HE_REGS_RCMCONFIG_TYPE 0
#define HE_REGO_RCMRSRB_BA 0x80784
#define HE_REGO_RCMLBM_BA 0x80788
#define HE_REGO_RCMABR_BA 0x8078C
#define HE_REGO_RCCONFIG 0x807C0
#define HE_REGS_RCCONFIG_UTDELAY 11
#define HE_REGM_RCCONFIG_WRAP_MODE (1 << 10)
#define HE_REGM_RCCONFIG_UT_MODE (1 << 9)
#define HE_REGM_RCCONFIG_RXENB (1 << 8)
#define HE_REGS_RCCONFIG_VP 4
#define HE_REGS_RCCONFIG_VC 0
#define HE_REGO_MCC 0x807C4
#define HE_REGO_OEC 0x807C8
#define HE_REGO_DCC 0x807CC
#define HE_REGO_CEC 0x807D0
#define HE_REGO_HSP_BA 0x807F0
#define HE_REGO_LBCONFIG 0x807F4
#define HE_REGO_CON_DAT 0x807F8
#define HE_REGO_CON_CTL 0x807FC
#define HE_REGM_CON_MBOX (2 << 30)
#define HE_REGM_CON_TCM (1 << 30)
#define HE_REGM_CON_RCM (0 << 30)
#define HE_REGM_CON_WE (1 << 29)
#define HE_REGM_CON_STATUS (1 << 28)
#define HE_REGM_CON_DIS3 (1 << 22)
#define HE_REGM_CON_DIS2 (1 << 21)
#define HE_REGM_CON_DIS1 (1 << 20)
#define HE_REGM_CON_DIS0 (1 << 19)
#define HE_REGS_CON_DIS 19
#define HE_REGS_CON_ADDR 0
#define HE_REGO_SUNI 0x80800
#define HE_REGO_SUNI_END 0x80C00
#define HE_REGO_END 0x100000
/*
* MBOX registers
*/
#define HE_REGO_CS_STPER0 0x000
#define HE_REGO_CS_STPER(G) (HE_REGO_CS_STPER0 + (G))
#define HE_REGN_CS_STPER 32
#define HE_REGO_CS_STTIM0 0x020
#define HE_REGO_CS_STTIM(G) (HE_REGO_CS_STTIM0 + (G))
#define HE_REGO_CS_TGRLD0 0x040
#define HE_REGO_CS_TGRLD(G) (HE_REGO_CS_TGRLD0 + (G))
#define HE_REGO_CS_ERTHR0 0x50
#define HE_REGO_CS_ERTHR1 0x51
#define HE_REGO_CS_ERTHR2 0x52
#define HE_REGO_CS_ERTHR3 0x53
#define HE_REGO_CS_ERTHR4 0x54
#define HE_REGO_CS_ERCTL0 0x55
#define HE_REGO_CS_ERCTL1 0x56
#define HE_REGO_CS_ERCTL2 0x57
#define HE_REGO_CS_ERSTAT0 0x58
#define HE_REGO_CS_ERSTAT1 0x59
#define HE_REGO_CS_RTCCT 0x60
#define HE_REGO_CS_RTFWC 0x61
#define HE_REGO_CS_RTFWR 0x62
#define HE_REGO_CS_RTFTC 0x63
#define HE_REGO_CS_RTATR 0x64
#define HE_REGO_CS_TFBSET 0x70
#define HE_REGO_CS_TFBADD 0x71
#define HE_REGO_CS_TFBSUB 0x72
#define HE_REGO_CS_WCRMAX 0x73
#define HE_REGO_CS_WCRMIN 0x74
#define HE_REGO_CS_WCRINC 0x75
#define HE_REGO_CS_WCRDEC 0x76
#define HE_REGO_CS_WCRCEIL 0x77
#define HE_REGO_CS_BWDCNT 0x78
#define HE_REGO_CS_OTPPER 0x80
#define HE_REGO_CS_OTWPER 0x81
#define HE_REGO_CS_OTTLIM 0x82
#define HE_REGO_CS_OTTCNT 0x83
#define HE_REGO_CS_HGRRT0 0x90
#define HE_REGO_CS_HGRRT(G) (HE_REGO_CS_HGRRT0 + (G))
#define HE_REGO_CS_ORPTRS 0xA0
#define HE_REGO_RCON_CLOSE 0x100
#define HE_REGO_CS_END 0x101
#define HE_REGT_CS_ERTHR { \
{ /* 155 */ \
{ 0x000800ea, 0x000400ea, 0x000200ea }, /* ERTHR0 */ \
{ 0x000C3388, 0x00063388, 0x00033388 }, /* ERTHR1 */ \
{ 0x00101018, 0x00081018, 0x00041018 }, /* ERTHR2 */ \
{ 0x00181dac, 0x000c1dac, 0x00061dac }, /* ERTHR3 */ \
{ 0x0028051a, 0x0014051a, 0x000a051a }, /* ERTHR4 */ \
}, { /* 622 */ \
{ 0x000800fa, 0x000400fa, 0x000200fa }, /* ERTHR0 */ \
{ 0x000c33cb, 0x000633cb, 0x000333cb }, /* ERTHR1 */ \
{ 0x0010101b, 0x0008101b, 0x0004101b }, /* ERTHR2 */ \
{ 0x00181dac, 0x000c1dac, 0x00061dac }, /* ERTHR3 */ \
{ 0x00280600, 0x00140600, 0x000a0600 }, /* ERTHR4 */ \
} \
}
#define HE_REGT_CS_ERCTL { \
{ 0x0235e4b1, 0x4701, 0x64b1 }, /* 155 */ \
{ 0x023de8b3, 0x1801, 0x68b3 } /* 622 */ \
}
#define HE_REGT_CS_ERSTAT { \
{ 0x1280, 0x64b1 }, /* 155 */ \
{ 0x1280, 0x68b3 }, /* 622 */ \
}
#define HE_REGT_CS_RTFWR { \
0xf424, /* 155 */ \
0x14585 /* 622 */ \
}
#define HE_REGT_CS_RTATR { \
0x4680, /* 155 */ \
0x4680 /* 622 */ \
}
#define HE_REGT_CS_BWALLOC { \
{ 0x000563b7, 0x64b1, 0x5ab1, 0xe4b1, 0xdab1, 0x64b1 }, /* 155 */\
{ 0x00159ece, 0x68b3, 0x5eb3, 0xe8b3, 0xdeb3, 0x68b3 }, /* 622 */\
}
#define HE_REGT_CS_ORCF { \
{ 0x6, 0x1e }, /* 155 */ \
{ 0x5, 0x14 } /* 622 */ \
}
/*
* TSRs - NR is relative to the starting number of the block
*/
#define HE_REGO_TSRA(BASE,CID,NR) ((BASE) + ((CID) << 3) + (NR))
#define HE_REGO_TSRB(BASE,CID,NR) ((BASE) + ((CID) << 2) + (NR))
#define HE_REGO_TSRC(BASE,CID,NR) ((BASE) + ((CID) << 1) + (NR))
#define HE_REGO_TSRD(BASE,CID) ((BASE) + (CID))
#define HE_REGM_TSR0_CONN_STATE (7 << 28)
#define HE_REGS_TSR0_CONN_STATE 28
#define HE_REGM_TSR0_USE_WMIN (1 << 23)
#define HE_REGM_TSR0_GROUP (7 << 18)
#define HE_REGS_TSR0_GROUP 18
#define HE_REGM_TSR0_TRAFFIC (3 << 16)
#define HE_REGS_TSR0_TRAFFIC 16
#define HE_REGM_TSR0_TRAFFIC_CBR 0
#define HE_REGM_TSR0_TRAFFIC_UBR 1
#define HE_REGM_TSR0_TRAFFIC_ABR 2
#define HE_REGM_TSR0_PROT (1 << 15)
#define HE_REGM_TSR0_AAL (3 << 12)
#define HE_REGS_TSR0_AAL 12
#define HE_REGM_TSR0_AAL_5 0
#define HE_REGM_TSR0_AAL_0 1
#define HE_REGM_TSR0_AAL_0T 2
#define HE_REGM_TSR0_HALT_ER (1 << 11)
#define HE_REGM_TSR0_MARK_CI (1 << 10)
#define HE_REGM_TSR0_MARK_ER (1 << 9)
#define HE_REGM_TSR0_UPDATE_GER (1 << 8)
#define HE_REGM_TSR0_RC 0xff
#define HE_REGM_TSR1_PCR (0x7fff << 16)
#define HE_REGS_TSR1_PCR 16
#define HE_REGM_TSR1_MCR (0x7fff << 0)
#define HE_REGS_TSR1_MCR 0
#define HE_REGM_TSR2_ACR (0x7fff << 16)
#define HE_REGS_TSR2_ACR 16
#define HE_REGM_TSR3_NRM (0xff << 24)
#define HE_REGS_TSR3_NRM 24
#define HE_REGM_TSR3_CRM (0xff << 0)
#define HE_REGS_TSR3_CRM 0
#define HE_REGM_TSR4_FLUSH (1 << 31)
#define HE_REGM_TSR4_SESS_END (1 << 30)
#define HE_REGM_TSR4_OAM_CRC10 (1 << 28)
#define HE_REGM_TSR4_NULL_CRC10 (1 << 27)
#define HE_REGM_TSR4_PROT (1 << 26)
#define HE_REGM_TSR4_AAL (3 << 24)
#define HE_REGS_TSR4_AAL 24
#define HE_REGM_TSR4_AAL_5 0
#define HE_REGM_TSR4_AAL_0 1
#define HE_REGM_TSR4_AAL_0T 2
#define HE_REGM_TSR9_INIT 0x00100000
#define HE_REGM_TSR11_ICR (0x7fff << 16)
#define HE_REGS_TSR11_ICR 16
#define HE_REGM_TSR11_TRM (0x7 << 13)
#define HE_REGS_TSR11_TRM 13
#define HE_REGM_TSR11_NRM (0x7 << 10)
#define HE_REGS_TSR11_NRM 10
#define HE_REGM_TSR11_ADTF 0x3ff
#define HE_REGS_TSR11_ADTF 0
#define HE_REGM_TSR13_RDF (0xf << 23)
#define HE_REGS_TSR13_RDF 23
#define HE_REGM_TSR13_RIF (0xf << 19)
#define HE_REGS_TSR13_RIF 19
#define HE_REGM_TSR13_CDF (0x7 << 16)
#define HE_REGS_TSR13_CDF 16
#define HE_REGM_TSR13_CRM 0xffff
#define HE_REGS_TSR13_CRM 0
#define HE_REGM_TSR14_CBR_DELETE (1 << 31)
#define HE_REGM_TSR14_ABR_CLOSE (1 << 16)
/*
* RSRs
*/
#define HE_REGO_RSRA(BASE,CID,NR) ((BASE) + ((CID) << 3) + (NR))
#define HE_REGO_RSRB(BASE,CID,NR) ((BASE) + ((CID) << 1) + (NR))
#define HE_REGM_RSR0_PTI7 (1 << 15)
#define HE_REGM_RSR0_RM (1 << 14)
#define HE_REGM_RSR0_F5OAM (1 << 13)
#define HE_REGM_RSR0_STARTPDU (1 << 10)
#define HE_REGM_RSR0_OPEN (1 << 6)
#define HE_REGM_RSR0_PPD (1 << 5)
#define HE_REGM_RSR0_EPD (1 << 4)
#define HE_REGM_RSR0_TCPCS (1 << 3)
#define HE_REGM_RSR0_AAL 0x7
#define HE_REGM_RSR0_AAL_5 0x0
#define HE_REGM_RSR0_AAL_0 0x1
#define HE_REGM_RSR0_AAL_0T 0x2
#define HE_REGM_RSR0_AAL_RAW 0x3
#define HE_REGM_RSR0_AAL_RAWCRC10 0x4
#define HE_REGM_RSR1_AQI (1 << 20)
#define HE_REGM_RSR1_RBPL_ONLY (1 << 19)
#define HE_REGM_RSR1_GROUP (7 << 16)
#define HE_REGS_RSR1_GROUP 16
#define HE_REGM_RSR4_AQI (1 << 30)
#define HE_REGM_RSR4_GROUP (7 << 27)
#define HE_REGS_RSR4_GROUP 27
#define HE_REGM_RSR4_RBPL_ONLY (1 << 26)
/*
* Relative to RCMABR_BA
*/
#define HE_REGO_CM_GQTBL 0x000
#define HE_REGL_CM_GQTBL 0x100
#define HE_REGO_CM_RGTBL 0x100
#define HE_REGL_CM_RGTBL 0x100
#define HE_REGO_CM_TNRMTBL 0x200
#define HE_REGL_CM_TNRMTBL 0x100
#define HE_REGO_CM_ORCF 0x300
#define HE_REGL_CM_ORCF 0x100
#define HE_REGO_CM_RTGTBL 0x400
#define HE_REGL_CM_RTGTBL 0x200
#define HE_REGO_CM_IRCF 0x600
#define HE_REGL_CM_IRCF 0x200
/*
* Interrupt Status
*/
#define HE_REGM_ITYPE 0xf8
#define HE_REGM_IGROUP 0x07
#define HE_REGM_ITYPE_TBRQ (0x0 << 3)
#define HE_REGM_ITYPE_TPD (0x1 << 3)
#define HE_REGM_ITYPE_RBPS (0x2 << 3)
#define HE_REGM_ITYPE_RBPL (0x3 << 3)
#define HE_REGM_ITYPE_RBRQ (0x4 << 3)
#define HE_REGM_ITYPE_RBRQT (0x5 << 3)
#define HE_REGM_ITYPE_PHYS (0x6 << 3)
#define HE_REGM_ITYPE_UNKNOWN 0xf8
#define HE_REGM_ITYPE_ERR 0x80
#define HE_REGM_ITYPE_PERR 0x81
#define HE_REGM_ITYPE_ABORT 0x82
#define HE_REGM_ITYPE_INVALID 0xf8
/*
* Serial EEPROM
*/
#define HE_EEPROM_PROD_ID 0x08
#define HE_EEPROM_PROD_ID_LEN 30
#define HE_EEPROM_REV 0x26
#define HE_EEPROM_REV_LEN 4
#define HE_EEPROM_M_SN 0x3A
#define HE_EEPROM_MEDIA 0x3E
#define HE_EEPROM_MAC 0x42
#define HE_MEDIA_UTP155 0x06
#define HE_MEDIA_MMF155 0x26
#define HE_MEDIA_MMF622 0x27
#define HE_MEDIA_SMF155 0x46
#define HE_MEDIA_SMF622 0x47
#define HE_622_CLOCK 66667000
#define HE_155_CLOCK 50000000
/*
* Statistics
*/
struct fatm_statshe {
};
/*
* Queue entries
*/
/* Receive Buffer Pool Queue entry */
struct he_rbpen {
uint32_t phys; /* physical address */
uint32_t handle; /* handle or virtual address */
};
/* Receive Buffer Return Queue entry */
struct he_rbrqen {
uint32_t addr; /* handle and flags */
uint32_t len; /* length and CID */
};
#define HE_REGM_RBRQ_ADDR 0xFFFFFFC0
#define HE_REGS_RBRQ_ADDR 6
#define HE_REGM_RBRQ_FLAGS 0x0000003F
#define HE_REGM_RBRQ_HBUF_ERROR (1 << 0)
#define HE_REGM_RBRQ_CON_CLOSED (1 << 1)
#define HE_REGM_RBRQ_AAL5_PROT (1 << 2)
#define HE_REGM_RBRQ_END_PDU (1 << 3)
#define HE_REGM_RBRQ_LEN_ERROR (1 << 4)
#define HE_REGM_RBRQ_CRC_ERROR (1 << 5)
#define HE_REGM_RBRQ_CID (0x1fff << 16)
#define HE_REGS_RBRQ_CID 16
#define HE_REGM_RBRQ_LEN 0xffff
/* Transmit Packet Descriptor Ready Queue entry */
struct he_tpdrqen {
uint32_t tpd; /* physical address */
uint32_t cid; /* connection id */
};
/* Transmit buffer return queue */
struct he_tbrqen {
uint32_t addr; /* handle and flags */
};
#define HE_REGM_TBRQ_ADDR 0xffffffc0
#define HE_REGM_TBRQ_FLAGS 0x0000000a
#define HE_REGM_TBRQ_EOS 0x00000008
#define HE_REGM_TBRQ_MULT 0x00000002
struct he_tpd {
uint32_t addr; /* handle or virtual address and flags */
uint32_t res; /* reserved */
struct {
uint32_t addr; /* buffer address */
uint32_t len; /* buffer length and flags */
} bufs[3];
};
#define HE_REGM_TPD_ADDR 0xffffffC0
#define HE_REGS_TPD_ADDR 6
#define HE_REGM_TPD_INTR 0x0001
#define HE_REGM_TPD_CLP 0x0002
#define HE_REGM_TPD_EOS 0x0004
#define HE_REGM_TPD_PTI 0x0038
#define HE_REGS_TPD_PTI 3
#define HE_REGM_TPD_LST 0x80000000
/*
* The HOST STATUS PAGE
*/
struct he_hsp {
struct {
uint32_t tbrq_tail;
uint32_t res1[15];
uint32_t rbrq_tail;
uint32_t res2[15];
} group[8];
};
#define HE_MAX_PDU (65535)
|